From 9f4a5688685aba14670d4a82e123b22241e4fa15 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Wed, 31 Jul 2024 13:59:38 +0200 Subject: [PATCH] tests: Mark a couple of tests as working on recent NVIDIA GPUs. I don't know the exact version that fixed this todo, but on the same hardware this test was failing a couple of years ago, so I presume something was fixed at some point. I am writing my current driver version, but a lower one might turn out to be sufficient. --- tests/d3d12.c | 3 ++- tests/d3d12_crosstest.h | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/tests/d3d12.c b/tests/d3d12.c index 38a51b01..813ad81b 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -11483,7 +11483,8 @@ static void test_shader_instructions(void) transition_resource_state(command_list, context.render_target, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); - todo_if(uint_tests[i].is_todo || (uint_tests[i].todo_on_nvidia && is_nvidia_device(context.device))) + todo_if(uint_tests[i].is_todo || + (uint_tests[i].todo_on_nvidia && is_nvidia_device_lt(context.device, 535, 183, 1))) check_sub_resource_uvec4(context.render_target, 0, queue, command_list, &uint_tests[i].output.u); reset_command_list(command_list, context.allocator); diff --git a/tests/d3d12_crosstest.h b/tests/d3d12_crosstest.h index b42696a8..8e168313 100644 --- a/tests/d3d12_crosstest.h +++ b/tests/d3d12_crosstest.h @@ -501,6 +501,12 @@ static inline bool is_nvidia_device(ID3D12Device *device) return false; } +static inline bool is_nvidia_device_lt(ID3D12Device *device, + uint32_t major, uint32_t minor, uint32_t patch) +{ + return false; +} + static inline bool is_qualcomm_device(ID3D12Device *device) { return false; @@ -800,6 +806,23 @@ static inline bool is_nvidia_device(ID3D12Device *device) return properties.driverID == VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR; } +/* NVIDIA uses a different bit pattern than standard Vulkan. */ +#define NV_MAKE_API_VERSION(major, minor, patch) \ + ((((uint32_t)(major)) << 22u) | (((uint32_t)(minor)) << 14u) | (((uint32_t)(patch)) << 6u)) + +static inline bool is_nvidia_device_lt(ID3D12Device *device, + uint32_t major, uint32_t minor, uint32_t patch) +{ + VkPhysicalDeviceDriverPropertiesKHR driver_properties; + VkPhysicalDeviceProperties device_properties; + + get_driver_properties(device, &device_properties, &driver_properties); + if (driver_properties.driverID != VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR) + return false; + + return device_properties.driverVersion < NV_MAKE_API_VERSION(major, minor, patch); +} + static inline bool is_qualcomm_device(ID3D12Device *device) { VkPhysicalDeviceDriverPropertiesKHR properties;