[Mesa-dev] [PATCH] radv: set ac_surf_info::num_channels correctly
Samuel Pitoiset
samuel.pitoiset at gmail.com
Wed Apr 25 16:21:06 UTC 2018
On 04/25/2018 05:11 PM, Bas Nieuwenhuizen wrote:
> Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
>
> Do we want this in 18.1?
Not sure if we have to, but we can backport it.
I will run a full CTS before pushing all pending fixes.
>
> On Wed, Apr 25, 2018 at 11:22 AM, Samuel Pitoiset
> <samuel.pitoiset at gmail.com> wrote:
>> num_channels has been introduced since "ac/surface: don't set
>> the display flag for obviously unsupported cases".
>>
>> Based on RadeonSI.
>>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
>> ---
>> src/amd/vulkan/radv_image.c | 2 +-
>> src/amd/vulkan/vk_format.h | 7 +++++++
>> 2 files changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/amd/vulkan/radv_image.c b/src/amd/vulkan/radv_image.c
>> index 942df56d42..5dfd0dc739 100644
>> --- a/src/amd/vulkan/radv_image.c
>> +++ b/src/amd/vulkan/radv_image.c
>> @@ -968,7 +968,7 @@ radv_image_create(VkDevice _device,
>> image->info.samples = pCreateInfo->samples;
>> image->info.array_size = pCreateInfo->arrayLayers;
>> image->info.levels = pCreateInfo->mipLevels;
>> - image->info.num_channels = 4; /* TODO: set this correctly */
>> + image->info.num_channels = vk_format_get_nr_components(format);
>>
>> image->vk_format = pCreateInfo->format;
>> image->tiling = pCreateInfo->tiling;
>> diff --git a/src/amd/vulkan/vk_format.h b/src/amd/vulkan/vk_format.h
>> index 43265ed3d9..b8cb4f4ed3 100644
>> --- a/src/amd/vulkan/vk_format.h
>> +++ b/src/amd/vulkan/vk_format.h
>> @@ -488,4 +488,11 @@ vk_to_non_srgb_format(VkFormat format)
>> }
>> }
>>
>> +static inline unsigned
>> +vk_format_get_nr_components(VkFormat format)
>> +{
>> + const struct vk_format_description *desc = vk_format_description(format);
>> + return desc->nr_channels;
>> +}
>> +
>> #endif /* VK_FORMAT_H */
>> --
>> 2.17.0
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list