tests/d3d12: Check whether the d3d12 device supports geometry shaders.

This commit is contained in:
Henri Verbeet
2025-08-04 17:23:35 +02:00
parent 4bb880f9ed
commit 47a183c75b
Notes: Henri Verbeet 2025-08-06 13:02:39 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1668
2 changed files with 30 additions and 5 deletions

View File

@@ -28287,6 +28287,14 @@ static void test_geometry_shader(void)
desc.no_pipeline = true; desc.no_pipeline = true;
if (!init_test_context(&context, &desc)) if (!init_test_context(&context, &desc))
return; return;
if (!is_geometry_shader_supported(context.device))
{
skip("The device does not support geometry shaders.\n");
destroy_test_context(&context);
return;
}
device = context.device; device = context.device;
command_list = context.list; command_list = context.list;
queue = context.queue; queue = context.queue;
@@ -28342,7 +28350,6 @@ static void test_geometry_shader(void)
color = get_readback_uint(&rb.rb, 255, 240, 0); color = get_readback_uint(&rb.rb, 255, 240, 0);
ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color); ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
color = get_readback_uint(&rb.rb, 320, 240, 0); color = get_readback_uint(&rb.rb, 320, 240, 0);
bug_if(is_mvk_device(device))
ok(compare_color(color, 0xffffff00, 1), "Got unexpected color 0x%08x.\n", color); ok(compare_color(color, 0xffffff00, 1), "Got unexpected color 0x%08x.\n", color);
color = get_readback_uint(&rb.rb, 385, 240, 0); color = get_readback_uint(&rb.rb, 385, 240, 0);
ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color); ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
@@ -28357,7 +28364,6 @@ static void test_geometry_shader(void)
color = get_readback_uint(&rb.rb, 255, 240, 0); color = get_readback_uint(&rb.rb, 255, 240, 0);
ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color); ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
color = get_readback_uint(&rb.rb, 320, 240, 0); color = get_readback_uint(&rb.rb, 320, 240, 0);
bug_if(is_mvk_device(device))
ok(compare_color(color, 0xffffff00, 1), "Got unexpected color 0x%08x.\n", color); ok(compare_color(color, 0xffffff00, 1), "Got unexpected color 0x%08x.\n", color);
color = get_readback_uint(&rb.rb, 385, 240, 0); color = get_readback_uint(&rb.rb, 385, 240, 0);
ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color); ok(compare_color(color, 0xff0000ff, 1), "Got unexpected color 0x%08x.\n", color);
@@ -28530,6 +28536,14 @@ static void test_layered_rendering(void)
desc.no_pipeline = true; desc.no_pipeline = true;
if (!init_test_context(&context, &desc)) if (!init_test_context(&context, &desc))
return; return;
if (!is_geometry_shader_supported(context.device))
{
skip("The device does not support geometry shaders.\n");
destroy_test_context(&context);
return;
}
device = context.device; device = context.device;
command_list = context.list; command_list = context.list;
queue = context.queue; queue = context.queue;
@@ -28563,15 +28577,12 @@ static void test_layered_rendering(void)
transition_resource_state(command_list, context.render_target, transition_resource_state(command_list, context.render_target,
D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE);
bug_if(is_mvk_device(device))
check_sub_resource_uint(context.render_target, 0, queue, command_list, 0xff00ff00, 0); check_sub_resource_uint(context.render_target, 0, queue, command_list, 0xff00ff00, 0);
reset_command_list(command_list, context.allocator); reset_command_list(command_list, context.allocator);
check_sub_resource_uint(context.render_target, 1, queue, command_list, 0xffffffff, 0); check_sub_resource_uint(context.render_target, 1, queue, command_list, 0xffffffff, 0);
reset_command_list(command_list, context.allocator); reset_command_list(command_list, context.allocator);
bug_if(is_mvk_device(device))
check_sub_resource_uint(context.render_target, 2, queue, command_list, 0x00000000, 0); check_sub_resource_uint(context.render_target, 2, queue, command_list, 0x00000000, 0);
reset_command_list(command_list, context.allocator); reset_command_list(command_list, context.allocator);
bug_if(is_mvk_device(device))
check_sub_resource_uint(context.render_target, 3, queue, command_list, 0xffffff00, 0); check_sub_resource_uint(context.render_target, 3, queue, command_list, 0xffffff00, 0);
ID3D12Resource_Release(vb); ID3D12Resource_Release(vb);

View File

@@ -558,6 +558,11 @@ static inline bool is_depth_clip_enable_supported(ID3D12Device *device)
return true; return true;
} }
static inline bool is_geometry_shader_supported(ID3D12Device *device)
{
return true;
}
#else #else
#define VKD3D_AGILITY_SDK_EXPORTS #define VKD3D_AGILITY_SDK_EXPORTS
@@ -940,6 +945,15 @@ static inline bool is_depth_clip_enable_supported(ID3D12Device *device)
VkPhysicalDevice vk_physical_device = vkd3d_get_vk_physical_device(device); VkPhysicalDevice vk_physical_device = vkd3d_get_vk_physical_device(device);
return check_device_extension(vk_physical_device, VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME); return check_device_extension(vk_physical_device, VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME);
} }
static inline bool is_geometry_shader_supported(ID3D12Device *device)
{
VkPhysicalDeviceFeatures features;
vkGetPhysicalDeviceFeatures(vkd3d_get_vk_physical_device(device), &features);
return features.geometryShader;
}
#endif #endif
static void enable_d3d12_debug_layer(void) static void enable_d3d12_debug_layer(void)