-- v3: tests: Do not crash if the render target doesn't support MSAA 8. tests: Do not crash if a pipeline statistics query heap cannot be created.
From: Giovanni Mascellani gmascellani@codeweavers.com
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 29f907dec..cb9d66156 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 213ab22ee..914d1ac06 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 0748ab6dd..b7579fc07 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -23760,9 +23760,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; @@ -23901,7 +23903,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 973f980ca..6c0a4ef12 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);
From: Giovanni Mascellani gmascellani@codeweavers.com
This currently happens on MoltenVK. --- tests/d3d12.c | 13 +++++++++++-- tests/d3d12_test_utils.h | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/tests/d3d12.c b/tests/d3d12.c index b7579fc07..4f1fc5bde 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -32422,6 +32422,7 @@ static void test_shader_get_render_target_sample_count(void) struct test_context_desc desc; struct test_context context; ID3D12CommandQueue *queue; + struct vec4 sample_count; HRESULT hr;
static const float black[4]; @@ -32442,20 +32443,28 @@ static void test_shader_get_render_target_sample_count(void) 0x0100003e, }; static const D3D12_SHADER_BYTECODE ps = {ps_code, sizeof(ps_code)}; - static const struct vec4 sample_count = {8.0f, 8.0f, 8.0f, 8.0f};
memset(&desc, 0, sizeof(desc)); desc.rt_format = DXGI_FORMAT_R32G32B32A32_FLOAT; desc.sample_desc.Count = 8; desc.no_pipeline = true; + desc.check_multisampling = true; if (!init_test_context(&context, &desc)) return; command_list = context.list; queue = context.queue; + bug_if(is_mvk_device(context.device)) + ok(context.render_target_desc.SampleDesc.Count == 8, "Failed to create render target with MSAA 8, got %u.\n", + context.render_target_desc.SampleDesc.Count); + + sample_count.x = context.render_target_desc.SampleDesc.Count; + sample_count.y = context.render_target_desc.SampleDesc.Count; + sample_count.z = context.render_target_desc.SampleDesc.Count; + sample_count.w = context.render_target_desc.SampleDesc.Count;
init_pipeline_state_desc(&pso_desc, context.root_signature, context.render_target_desc.Format, NULL, &ps, NULL); - pso_desc.SampleDesc.Count = desc.sample_desc.Count; + pso_desc.SampleDesc.Count = context.render_target_desc.SampleDesc.Count; hr = ID3D12Device_CreateGraphicsPipelineState(context.device, &pso_desc, &IID_ID3D12PipelineState, (void **)&context.pipeline_state); ok(hr == S_OK, "Failed to create pipeline, hr %#x.\n", hr); diff --git a/tests/d3d12_test_utils.h b/tests/d3d12_test_utils.h index 9df50c565..2c7b10f45 100644 --- a/tests/d3d12_test_utils.h +++ b/tests/d3d12_test_utils.h @@ -934,6 +934,7 @@ struct test_context_desc unsigned int rt_width, rt_height, rt_array_size; DXGI_FORMAT rt_format; DXGI_SAMPLE_DESC sample_desc; + bool check_multisampling; unsigned int rt_descriptor_count; unsigned int root_signature_flags; bool no_render_target; @@ -965,6 +966,24 @@ struct test_context RECT scissor_rect; };
+#define check_multisample_support(a, b, c) check_multisample_support_(__LINE__, a, b, c) +static unsigned int check_multisample_support_(unsigned int line, ID3D12Device *device, + DXGI_FORMAT format, unsigned int sample_count) +{ + D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS format_support = + { + .Format = format, + .SampleCount = sample_count, + }; + HRESULT hr; + + hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, + &format_support, sizeof(format_support)); + ok_(line)(hr == S_OK, "Cannot check feature support, hr %#x.\n", hr); + + return format_support.NumQualityLevels; +} + #define create_render_target(context, a, b, c) create_render_target_(__LINE__, context, a, b, c) static void create_render_target_(unsigned int line, struct test_context *context, const struct test_context_desc *desc, ID3D12Resource **render_target, @@ -994,6 +1013,22 @@ static void create_render_target_(unsigned int line, struct test_context *contex clear_value.Color[1] = 1.0f; clear_value.Color[2] = 1.0f; clear_value.Color[3] = 1.0f; + + if (desc && desc->check_multisampling) + { + for (; resource_desc.SampleDesc.Count != 1; resource_desc.SampleDesc.Count /= 2) + { + unsigned int quality_level_count = check_multisample_support_(line, context->device, + resource_desc.Format, resource_desc.SampleDesc.Count); + + if (quality_level_count != 0) + { + resource_desc.SampleDesc.Quality = min(resource_desc.SampleDesc.Quality, quality_level_count - 1); + break; + } + } + } + hr = ID3D12Device_CreateCommittedResource(context->device, &heap_properties, D3D12_HEAP_FLAG_NONE, &resource_desc, D3D12_RESOURCE_STATE_RENDER_TARGET, &clear_value,
This merge request was approved by Henri Verbeet.