radv: Respect max extent for modifiers

Some of our modifiers only support upto a certain range, expose this in ImageFormatProperties.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13056>
This commit is contained in:
Joshua Ashton 2021-10-09 23:18:02 +01:00 committed by Marge Bot
parent baff748cb0
commit f63ec0128c

View file

@ -1218,6 +1218,8 @@ radv_check_modifier_support(struct radv_physical_device *dev,
const VkPhysicalDeviceImageFormatInfo2 *info,
VkImageFormatProperties *props, VkFormat format, uint64_t modifier)
{
uint32_t max_width, max_height;
if (info->type != VK_IMAGE_TYPE_2D)
return VK_ERROR_FORMAT_NOT_SUPPORTED;
@ -1278,6 +1280,11 @@ radv_check_modifier_support(struct radv_physical_device *dev,
props->maxMipLevels = 1;
props->maxArrayLayers = 1;
}
ac_modifier_max_extent(&dev->rad_info, modifier, &max_width, &max_height);
props->maxExtent.width = MIN2(props->maxExtent.width, max_width);
props->maxExtent.height = MIN2(props->maxExtent.width, max_height);
/* We don't support MSAA for modifiers */
props->sampleCounts &= VK_SAMPLE_COUNT_1_BIT;
return VK_SUCCESS;