From 6dfdbb5c2674a2e363e06de36f03513d35af6577 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Mon, 18 Sep 2023 11:56:20 +0200 Subject: [PATCH] tests: Do not crash if a pipeline statistics query heap cannot be created. This currently happens on MoltenVK. --- README | 2 +- configure.ac | 2 +- tests/d3d12.c | 11 ++++++++++- tests/d3d12_crosstest.h | 13 +++++++++++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/README b/README index 29f907de..cb9d6615 100644 --- a/README +++ b/README @@ -9,7 +9,7 @@ similar, but not identical, to Direct3D 12. Building vkd3d ============== -Vkd3d depends on SPIRV-Headers and Vulkan-Headers (>= 1.2.139). +Vkd3d depends on SPIRV-Headers and Vulkan-Headers (>= 1.2.148). Vkd3d generates some of its headers from IDL files. If you are using the release tarballs, then these headers are pre-generated and are included. If diff --git a/configure.ac b/configure.ac index 52d233a4..07eeabbf 100644 --- a/configure.ac +++ b/configure.ac @@ -83,7 +83,7 @@ AS_IF([test "x$ac_cv_header_spirv_unified1_GLSL_std_450_h" != "xyes" \ -a "x$ac_cv_header_vulkan_GLSL_std_450_h" != "xyes"], [AC_MSG_ERROR([GLSL.std.450.h not found.])]) -VKD3D_CHECK_VULKAN_HEADER_VERSION([139], [AC_MSG_ERROR([Vulkan headers are too old, 1.2.139 is required.])]) +VKD3D_CHECK_VULKAN_HEADER_VERSION([148], [AC_MSG_ERROR([Vulkan headers are too old, 1.2.148 is required.])]) AC_CHECK_DECL([SpvCapabilityDemoteToHelperInvocationEXT],, [AC_MSG_ERROR([SPIR-V headers are too old.])], [ #ifdef HAVE_SPIRV_UNIFIED1_SPIRV_H diff --git a/tests/d3d12.c b/tests/d3d12.c index ac0468b9..b15d1120 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -23740,9 +23740,11 @@ static void test_create_query_heap(void) heap_desc.NodeMask = 0; hr = ID3D12Device_CreateQueryHeap(device, &heap_desc, &IID_ID3D12QueryHeap, (void **)&query_heap); + bug_if(types[i] == D3D12_QUERY_HEAP_TYPE_PIPELINE_STATISTICS && is_mvk_device(device)) ok(hr == S_OK, "Failed to create query heap, type %u, hr %#x.\n", types[i], hr); - ID3D12QueryHeap_Release(query_heap); + if (hr == S_OK) + ID3D12QueryHeap_Release(query_heap); } heap_desc.Type = D3D12_QUERY_HEAP_TYPE_SO_STATISTICS; @@ -23881,7 +23883,14 @@ static void test_query_pipeline_statistics(void) heap_desc.Count = 2; heap_desc.NodeMask = 0; hr = ID3D12Device_CreateQueryHeap(device, &heap_desc, &IID_ID3D12QueryHeap, (void **)&query_heap); + bug_if(is_mvk_device(device)) ok(SUCCEEDED(hr), "Failed to create query heap, type %u, hr %#x.\n", heap_desc.Type, hr); + if (FAILED(hr)) + { + ID3D12PipelineState_Release(pso); + destroy_test_context(&context); + return; + } resource = create_readback_buffer(device, 2 * sizeof(struct D3D12_QUERY_DATA_PIPELINE_STATISTICS)); diff --git a/tests/d3d12_crosstest.h b/tests/d3d12_crosstest.h index 973f980c..6c0a4ef1 100644 --- a/tests/d3d12_crosstest.h +++ b/tests/d3d12_crosstest.h @@ -411,6 +411,11 @@ static inline bool is_radv_device(ID3D12Device *device) return false; } +static inline bool is_mvk_device(ID3D12Device *device) +{ + return false; +} + static inline bool is_depth_clip_enable_supported(ID3D12Device *device) { return true; @@ -660,6 +665,14 @@ static inline bool is_radv_device(ID3D12Device *device) return properties.driverID == VK_DRIVER_ID_MESA_RADV_KHR; } +static inline bool is_mvk_device(ID3D12Device *device) +{ + VkPhysicalDeviceDriverPropertiesKHR properties; + + get_driver_properties(device, &properties); + return properties.driverID == VK_DRIVER_ID_MOLTENVK; +} + static inline bool is_depth_clip_enable_supported(ID3D12Device *device) { VkPhysicalDevice vk_physical_device = vkd3d_get_vk_physical_device(device);