-- v3: ci: Build Mesa for release. tests: Pop the test context when leaving its scope. tests: Add llvmpipe among the Mesa drivers. tests: Skip tests that crash on llvmpipe. tests: Do not crash on some test failures.
From: Giovanni Mascellani gmascellani@codeweavers.com
This failures are observed to happen on llvmpipe. --- tests/d3d12.c | 16 ++++++++++++++++ tests/d3d12_crosstest.h | 13 +++++++++++++ 2 files changed, 29 insertions(+)
diff --git a/tests/d3d12.c b/tests/d3d12.c index b8d20a581..34c37b604 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -19214,8 +19214,16 @@ static void test_descriptors_visibility(void) root_signature_desc.NumStaticSamplers = 2; root_signature_desc.pStaticSamplers = sampler_desc; hr = create_root_signature(device, &root_signature_desc, &context.root_signature); + /* llvmpipe has maxBoundDescriptorSet == 8, which is smaller than we currently need. */ + todo_if(is_llvmpipe_device(device)) ok(SUCCEEDED(hr), "Failed to create root signature, hr %#x.\n", hr);
+ if (FAILED(hr)) + { + destroy_test_context(&context); + return; + } + context.pipeline_state = create_pipeline_state(device, context.root_signature, context.render_target_desc.Format, &vs, &ps, NULL); @@ -20858,8 +20866,16 @@ static void test_depth_stencil_sampling(void) root_signature_desc.NumStaticSamplers = 2; root_signature_desc.pStaticSamplers = sampler_desc; hr = create_root_signature(device, &root_signature_desc, &context.root_signature); + /* llvmpipe has maxBoundDescriptorSet == 8, which is smaller than we currently need. */ + todo_if(is_llvmpipe_device(device)) ok(SUCCEEDED(hr), "Failed to create root signature, hr %#x.\n", hr);
+ if (FAILED(hr)) + { + destroy_test_context(&context); + return; + } + pso_compare = create_pipeline_state(device, context.root_signature, context.render_target_desc.Format, NULL, &ps_compare, NULL); pso_depth = create_pipeline_state(device, diff --git a/tests/d3d12_crosstest.h b/tests/d3d12_crosstest.h index 6c0a4ef12..e24016459 100644 --- a/tests/d3d12_crosstest.h +++ b/tests/d3d12_crosstest.h @@ -401,6 +401,11 @@ static inline bool is_mesa_intel_device(ID3D12Device *device) return false; }
+static inline bool is_llvmpipe_device(ID3D12Device *device) +{ + return false; +} + static inline bool is_nvidia_device(ID3D12Device *device) { return false; @@ -649,6 +654,14 @@ static inline bool is_mesa_intel_device(ID3D12Device *device) return properties.driverID == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA_KHR; }
+static inline bool is_llvmpipe_device(ID3D12Device *device) +{ + VkPhysicalDeviceDriverPropertiesKHR properties; + + get_driver_properties(device, &properties); + return properties.driverID == VK_DRIVER_ID_MESA_LLVMPIPE; +} + static inline bool is_nvidia_device(ID3D12Device *device) { VkPhysicalDeviceDriverPropertiesKHR properties;
From: Giovanni Mascellani gmascellani@codeweavers.com
--- tests/d3d12.c | 18 ++++++++++++++++ tests/d3d12_crosstest.h | 48 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+)
diff --git a/tests/d3d12.c b/tests/d3d12.c index 34c37b604..550ec5936 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -19588,6 +19588,15 @@ static void test_null_srv(void) queue = context.queue; device = context.device;
+ if (is_llvmpipe_device_gte(device, 23, 2, 1)) + { + /* llvmpipe crashes with mutable descriptors are used. I don't + * know yet whether this is a bug in vkd3d or Mesa. */ + skip("Test crashes on llvmpipe, skipping.\n"); + destroy_test_context(&context); + return; + } + context.root_signature = create_texture_root_signature(context.device, D3D12_SHADER_VISIBILITY_PIXEL, 4, 0);
@@ -19803,6 +19812,15 @@ static void test_null_uav(void) command_list = context.list; queue = context.queue;
+ if (is_llvmpipe_device_gte(device, 23, 2, 1)) + { + /* llvmpipe crashes with mutable descriptors are used. I don't + * know yet whether this is a bug in vkd3d or Mesa. */ + skip("Test crashes on llvmpipe, skipping.\n"); + destroy_test_context(&context); + return; + } + descriptor_ranges[0].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_UAV; descriptor_ranges[0].NumDescriptors = 1; descriptor_ranges[0].BaseShaderRegister = 1; diff --git a/tests/d3d12_crosstest.h b/tests/d3d12_crosstest.h index e24016459..ea515d09a 100644 --- a/tests/d3d12_crosstest.h +++ b/tests/d3d12_crosstest.h @@ -406,6 +406,12 @@ static inline bool is_llvmpipe_device(ID3D12Device *device) return false; }
+static inline bool is_llvmpipe_device_gte(ID3D12Device *device, + uint32_t major, uint32_t minor, uint32_t patch) +{ + return false; +} + static inline bool is_nvidia_device(ID3D12Device *device) { return false; @@ -564,6 +570,20 @@ static ID3D12Device *create_device(void) return SUCCEEDED(hr) ? device : NULL; }
+static void get_physical_device_properties( + ID3D12Device *device, VkPhysicalDeviceProperties *device_properties) +{ + PFN_vkGetPhysicalDeviceProperties pfn_vkGetPhysicalDeviceProperties; + VkPhysicalDevice vk_physical_device; + VkInstance vk_instance; + + vk_instance = vkd3d_instance_get_vk_instance(vkd3d_instance_from_device(device)); + pfn_vkGetPhysicalDeviceProperties = (void *)vkGetInstanceProcAddr(vk_instance, + "vkGetPhysicalDeviceProperties"); + vk_physical_device = vkd3d_get_vk_physical_device(device); + pfn_vkGetPhysicalDeviceProperties(vk_physical_device, device_properties); +} + static bool get_driver_properties(ID3D12Device *device, VkPhysicalDeviceDriverPropertiesKHR *driver_properties) { PFN_vkGetPhysicalDeviceProperties2KHR pfn_vkGetPhysicalDeviceProperties2KHR; @@ -662,6 +682,34 @@ static inline bool is_llvmpipe_device(ID3D12Device *device) return properties.driverID == VK_DRIVER_ID_MESA_LLVMPIPE; }
+static inline bool is_llvmpipe_device_gte(ID3D12Device *device, + uint32_t major, uint32_t minor, uint32_t patch) +{ + VkPhysicalDeviceDriverPropertiesKHR driver_properties; + VkPhysicalDeviceProperties device_properties; + + get_driver_properties(device, &driver_properties); + get_physical_device_properties(device, &device_properties); + if (driver_properties.driverID != VK_DRIVER_ID_MESA_LLVMPIPE) + return false; + + if (device_properties.driverVersion == 1) + { + uint32_t driver_major, driver_minor, driver_patch; + + /* llvmpipe doesn't provide a valid driverVersion value, so we resort to parsing the + * driverInfo string. */ + if (sscanf(driver_properties.driverInfo, "Mesa %u.%u.%u", + &driver_major, &driver_minor, &driver_patch) == 3) + { + device_properties.driverVersion = VK_MAKE_API_VERSION(0, + driver_major, driver_minor, driver_patch); + } + } + + return device_properties.driverVersion >= VK_MAKE_API_VERSION(0, major, minor, patch); +} + static inline bool is_nvidia_device(ID3D12Device *device) { VkPhysicalDeviceDriverPropertiesKHR properties;
From: Giovanni Mascellani gmascellani@codeweavers.com
--- tests/d3d12_crosstest.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/tests/d3d12_crosstest.h b/tests/d3d12_crosstest.h index ea515d09a..150a12fc0 100644 --- a/tests/d3d12_crosstest.h +++ b/tests/d3d12_crosstest.h @@ -663,6 +663,7 @@ static inline bool is_mesa_device(ID3D12Device *device)
get_driver_properties(device, &properties); return properties.driverID == VK_DRIVER_ID_MESA_RADV_KHR + || properties.driverID == VK_DRIVER_ID_MESA_LLVMPIPE || properties.driverID == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA_KHR; }
From: Giovanni Mascellani gmascellani@codeweavers.com
--- tests/d3d12.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/tests/d3d12.c b/tests/d3d12.c index 550ec5936..4c3809a70 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -32472,7 +32472,10 @@ static void test_resource_allocation_info(void) ok(infos1[i].SizeInBytes == sizes[i], "Got unexpected size %"PRIu64".\n", infos1[i].SizeInBytes);
if (!i) + { + vkd3d_test_pop_context(); continue; + }
ok(infos1[i].Offset - infos1[i - 1].Offset >= infos1[i - 1].SizeInBytes, "Got unexpected prev size %"PRIu64", prev offset %"PRIu64", offset %"PRIu64".\n",
From: Giovanni Mascellani gmascellani@codeweavers.com
Otherwise it trips on a few failed assertions in d3d12.c. --- gitlab/image.docker | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gitlab/image.docker b/gitlab/image.docker index fb3ed6260..9807e3060 100644 --- a/gitlab/image.docker +++ b/gitlab/image.docker @@ -75,7 +75,7 @@ RUN export DEBIAN_FRONTEND=noninteractive; \ cd mesa && \ mkdir build && \ cd build && \ - meson setup -Dprefix=/opt/mesa24 -Dplatforms= -Dvideo-codecs= -Dvulkan-drivers=swrast -Dgallium-drivers=swrast -Dopengl=true -Degl=enabled -Dglvnd=true -Dshared-glapi=enabled -Dglx=disabled -Dgles1=disabled -Dgles2=disabled .. && \ + meson setup --buildtype release -Dprefix=/opt/mesa24 -Dplatforms= -Dvideo-codecs= -Dvulkan-drivers=swrast -Dgallium-drivers=swrast -Dopengl=true -Degl=enabled -Dglvnd=true -Dshared-glapi=enabled -Dglx=disabled -Dgles1=disabled -Dgles2=disabled .. && \ meson install && \ cd ../.. && \ rm -fr mesa && \
On Tue Apr 9 12:34:57 2024 +0000, Henri Verbeet wrote:
Where do these crashes happen exactly? I don't think I see them on the CI.
I added some comments, tighter checks and recompiled Mesa in release mode. Now the CI shouldn't crash anymore, once the new driver is in place. [This is a test run with the updated driver](https://gitlab.winehq.org/giomasce/vkd3d/-/jobs/68142).
+ /* llvmpipe has maxBoundDescriptorSet == 8, which is smaller than we currently need. */
"... which is less than ...", probably. Might not hurt to include version information here as well.
+ /* llvmpipe crashes with mutable descriptors are used. I don't + * know yet whether this is a bug in vkd3d or Mesa. */
"crashes when"
+static void get_physical_device_properties( + ID3D12Device *device, VkPhysicalDeviceProperties *device_properties) +{ + PFN_vkGetPhysicalDeviceProperties pfn_vkGetPhysicalDeviceProperties; + VkPhysicalDevice vk_physical_device; + VkInstance vk_instance; + + vk_instance = vkd3d_instance_get_vk_instance(vkd3d_instance_from_device(device)); + pfn_vkGetPhysicalDeviceProperties = (void *)vkGetInstanceProcAddr(vk_instance, + "vkGetPhysicalDeviceProperties"); + vk_physical_device = vkd3d_get_vk_physical_device(device); + pfn_vkGetPhysicalDeviceProperties(vk_physical_device, device_properties); +}
I think the main point of this function is retrieving "device_properties.driverVersion" in is_llvmpipe_device_gte(), right? Should we just return "device_properties2.properties.driverVersion" from get_driver_properties() instead?