This one is similar to the negative viewport height feature
introduced by VK_KHR_maintenance1. Though, both extensions
can't be enabled at the same time.

Signed-off-by: Samuel Pitoiset <[email protected]>
---
 src/amd/vulkan/radv_device.c      | 21 +++++++++++++++++++++
 src/amd/vulkan/radv_extensions.py |  1 +
 2 files changed, 22 insertions(+)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 36ba0c3833..5ceabeda93 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -1191,6 +1191,16 @@ static int radv_get_device_extension_index(const char 
*name)
        return -1;
 }
 
+static bool radv_is_device_extension_enabled(struct radv_device *device,
+                                            const char *name)
+{
+       int index = radv_get_device_extension_index(name);
+
+       if (index < 0)
+               return false;
+       return device->enabled_extensions.extensions[index];
+}
+
 VkResult radv_CreateDevice(
        VkPhysicalDevice                            physicalDevice,
        const VkDeviceCreateInfo*                   pCreateInfo,
@@ -1243,6 +1253,17 @@ VkResult radv_CreateDevice(
                device->enabled_extensions.extensions[index] = true;
        }
 
+       /* From Vulkan 1.0.69 spec:
+        *
+        * "ppEnabledExtensionNames must not contain both VK_KHR_maintenance1
+        *  and VK_AMD_negative_viewport_height"
+        */
+       if (radv_is_device_extension_enabled(device, "VK_KHR_maintenance1") &&
+           radv_is_device_extension_enabled(device, 
"VK_AMD_negative_viewport_height")) {
+               assert(!"ppEnabledExtensionNames must not contain both "
+                       "VK_KHR_maintenance1 and 
VK_AMD_negative_viewport_height");
+       }
+
        keep_shader_info = device->enabled_extensions.AMD_shader_info;
 
        mtx_init(&device->shader_slab_mutex, mtx_plain);
diff --git a/src/amd/vulkan/radv_extensions.py 
b/src/amd/vulkan/radv_extensions.py
index bfee1f76fa..13fb40945d 100644
--- a/src/amd/vulkan/radv_extensions.py
+++ b/src/amd/vulkan/radv_extensions.py
@@ -92,6 +92,7 @@ EXTENSIONS = [
     Extension('VK_EXT_global_priority',                   1, 
'device->rad_info.has_ctx_priority'),
     Extension('VK_AMD_draw_indirect_count',               1, True),
     Extension('VK_AMD_gcn_shader',                        1, True),
+    Extension('VK_AMD_negative_viewport_height',          1, True),
     Extension('VK_AMD_rasterization_order',               1, 
'device->rad_info.chip_class >= VI && device->rad_info.max_se >= 2'),
     Extension('VK_AMD_shader_info',                       1, True),
 ]
-- 
2.16.2

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to