Mesa (main): radv: Respect max extent for modifiers

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 11 12:24:32 UTC 2021


Module: Mesa
Branch: main
Commit: f63ec0128c8025f50a33181411d138f643e716b5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f63ec0128c8025f50a33181411d138f643e716b5

Author: Joshua Ashton <joshua at froggi.es>
Date:   Sat Oct  9 23:18:02 2021 +0100

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 at froggi.es>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13056>

---

 src/amd/vulkan/radv_formats.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c
index 158ca1e311e..a63d09bd28f 100644
--- a/src/amd/vulkan/radv_formats.c
+++ b/src/amd/vulkan/radv_formats.c
@@ -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;



More information about the mesa-commit mailing list