mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
tests: Collect D3D12 test options in a dedicated structure.
This commit is contained in:
parent
8d7159b4be
commit
c8a05a8b10
Notes:
Alexandre Julliard
2023-03-10 21:36:20 +01:00
Approved-by: Henri Verbeet (@hverbeet) Approved-by: Zebediah Figura (@zfigura) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/117
@ -455,7 +455,7 @@ static void check_buffer_uint_(unsigned int line, ID3D12Resource *buffer,
|
||||
|
||||
static bool broken_on_warp(bool condition)
|
||||
{
|
||||
return broken(use_warp_device && condition);
|
||||
return broken(test_options.use_warp_device && condition);
|
||||
}
|
||||
|
||||
static bool is_min_max_filtering_supported(ID3D12Device *device)
|
||||
@ -2347,7 +2347,8 @@ static void test_create_reserved_resource(void)
|
||||
hr = ID3D12Device_CreateReservedResource(device,
|
||||
&resource_desc, D3D12_RESOURCE_STATE_COMMON, NULL,
|
||||
&IID_ID3D12Resource, (void **)&resource);
|
||||
ok(hr == (standard_swizzle ? S_OK : E_INVALIDARG) || broken(use_warp_device), "Got unexpected hr %#x.\n", hr);
|
||||
ok(hr == (standard_swizzle ? S_OK : E_INVALIDARG) || broken(test_options.use_warp_device),
|
||||
"Got unexpected hr %#x.\n", hr);
|
||||
if (SUCCEEDED(hr))
|
||||
ID3D12Resource_Release(resource);
|
||||
|
||||
@ -5302,7 +5303,7 @@ static void test_draw_instanced(void)
|
||||
|
||||
ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL);
|
||||
|
||||
if (!use_warp_device)
|
||||
if (!test_options.use_warp_device)
|
||||
{
|
||||
/* This draw call is ignored. */
|
||||
ID3D12GraphicsCommandList_DrawInstanced(command_list, 3, 1, 0, 0);
|
||||
@ -5347,7 +5348,7 @@ static void test_draw_indexed_instanced(void)
|
||||
|
||||
ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL);
|
||||
|
||||
if (!use_warp_device)
|
||||
if (!test_options.use_warp_device)
|
||||
{
|
||||
/* This draw call is ignored. */
|
||||
ID3D12GraphicsCommandList_DrawIndexedInstanced(command_list, 3, 1, 0, 0, 0);
|
||||
@ -7430,7 +7431,7 @@ static void test_bundle_state_inheritance(void)
|
||||
return;
|
||||
}
|
||||
|
||||
if (use_warp_device)
|
||||
if (test_options.use_warp_device)
|
||||
{
|
||||
skip("Bundle state inheritance test crashes on WARP.\n");
|
||||
return;
|
||||
@ -10430,7 +10431,7 @@ static void test_shader_instructions(void)
|
||||
{
|
||||
vkd3d_test_set_context("%u:%s", i, tests[i].ps->name);
|
||||
|
||||
if (tests[i].skip_on_warp && use_warp_device)
|
||||
if (tests[i].skip_on_warp && test_options.use_warp_device)
|
||||
{
|
||||
skip("Skipping shader '%s' test on WARP.\n", tests[i].ps->name);
|
||||
continue;
|
||||
@ -10483,7 +10484,7 @@ static void test_shader_instructions(void)
|
||||
{
|
||||
vkd3d_test_set_context("%u:%s", i, uint_tests[i].ps->name);
|
||||
|
||||
if (uint_tests[i].skip_on_warp && use_warp_device)
|
||||
if (uint_tests[i].skip_on_warp && test_options.use_warp_device)
|
||||
{
|
||||
skip("Skipping shader '%s' test on WARP.\n", uint_tests[i].ps->name);
|
||||
continue;
|
||||
@ -13652,7 +13653,7 @@ static void test_texture_ld(void)
|
||||
{{ 3, 3, 3, 3}, 0x55555555},
|
||||
};
|
||||
|
||||
if (use_warp_device)
|
||||
if (test_options.use_warp_device)
|
||||
{
|
||||
skip("WARP device is removed when ps_ld is used.\n");
|
||||
return;
|
||||
@ -31927,7 +31928,7 @@ static void test_multisample_rendering(void)
|
||||
static const D3D12_SHADER_BYTECODE ps_resolve = {ps_resolve_code, sizeof(ps_resolve_code)};
|
||||
static const unsigned int expected_colors[] = {0xff0000ff, 0xff00ff00, 0xffff0000, 0xff000000};
|
||||
|
||||
if (use_warp_device)
|
||||
if (test_options.use_warp_device)
|
||||
{
|
||||
skip("Sample shading tests fail on WARP.\n");
|
||||
return;
|
||||
@ -32166,7 +32167,7 @@ static void test_coverage(void)
|
||||
{ ~0u, 0xff00ff00},
|
||||
};
|
||||
|
||||
if (use_warp_device)
|
||||
if (test_options.use_warp_device)
|
||||
{
|
||||
skip("Sample shading tests fail on WARP.\n");
|
||||
return;
|
||||
@ -32577,7 +32578,7 @@ static void test_shader_eval_attribute(void)
|
||||
static const struct vec4 expected_vec4 = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||
static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f};
|
||||
|
||||
if (use_warp_device)
|
||||
if (test_options.use_warp_device)
|
||||
{
|
||||
skip("Sample shading tests fail on WARP.\n");
|
||||
return;
|
||||
@ -36106,7 +36107,7 @@ static void test_clock_calibration(void)
|
||||
START_TEST(d3d12)
|
||||
{
|
||||
parse_args(argc, argv);
|
||||
enable_d3d12_debug_layer(argc, argv);
|
||||
enable_d3d12_debug_layer();
|
||||
init_adapter_info();
|
||||
|
||||
pfn_D3D12CreateVersionedRootSignatureDeserializer = get_d3d12_pfn(D3D12CreateVersionedRootSignatureDeserializer);
|
||||
|
@ -258,8 +258,13 @@ static void wait_queue_idle_(unsigned int line, ID3D12Device *device, ID3D12Comm
|
||||
ID3D12Fence_Release(fence);
|
||||
}
|
||||
|
||||
static bool use_warp_device;
|
||||
static unsigned int use_adapter_idx;
|
||||
static struct test_options
|
||||
{
|
||||
bool use_warp_device;
|
||||
unsigned int adapter_idx;
|
||||
bool enable_debug_layer;
|
||||
bool enable_gpu_based_validation;
|
||||
} test_options;
|
||||
|
||||
#ifdef VKD3D_CROSSTEST
|
||||
static IUnknown *create_warp_adapter(IDXGIFactory4 *factory)
|
||||
@ -283,13 +288,13 @@ static IUnknown *create_adapter(void)
|
||||
hr = CreateDXGIFactory1(&IID_IDXGIFactory4, (void **)&factory);
|
||||
ok(hr == S_OK, "Failed to create IDXGIFactory4, hr %#x.\n", hr);
|
||||
|
||||
if (use_warp_device && (adapter = create_warp_adapter(factory)))
|
||||
if (test_options.use_warp_device && (adapter = create_warp_adapter(factory)))
|
||||
{
|
||||
IDXGIFactory4_Release(factory);
|
||||
return adapter;
|
||||
}
|
||||
|
||||
hr = IDXGIFactory4_EnumAdapters(factory, use_adapter_idx, (IDXGIAdapter **)&adapter);
|
||||
hr = IDXGIFactory4_EnumAdapters(factory, test_options.adapter_idx, (IDXGIAdapter **)&adapter);
|
||||
IDXGIFactory4_Release(factory);
|
||||
if (FAILED(hr))
|
||||
trace("Failed to get adapter, hr %#x.\n", hr);
|
||||
@ -302,7 +307,8 @@ static ID3D12Device *create_device(void)
|
||||
ID3D12Device *device;
|
||||
HRESULT hr;
|
||||
|
||||
if ((use_warp_device || use_adapter_idx) && !(adapter = create_adapter()))
|
||||
if ((test_options.use_warp_device || test_options.adapter_idx)
|
||||
&& !(adapter = create_adapter()))
|
||||
{
|
||||
trace("Failed to create adapter.\n");
|
||||
return NULL;
|
||||
@ -344,7 +350,7 @@ static void init_adapter_info(void)
|
||||
if (desc.VendorId == 0x1414 && desc.DeviceId == 0x008c)
|
||||
{
|
||||
trace("Using WARP device.\n");
|
||||
use_warp_device = true;
|
||||
test_options.use_warp_device = true;
|
||||
}
|
||||
|
||||
IDXGIAdapter_Release(dxgi_adapter);
|
||||
@ -493,9 +499,9 @@ static VkPhysicalDevice select_physical_device(struct vkd3d_instance *instance)
|
||||
vr = vkEnumeratePhysicalDevices(vk_instance, &count, NULL);
|
||||
ok(vr == VK_SUCCESS, "Got unexpected VkResult %d.\n", vr);
|
||||
|
||||
if (use_adapter_idx >= count)
|
||||
if (test_options.adapter_idx >= count)
|
||||
{
|
||||
trace("Invalid physical device index %u.\n", use_adapter_idx);
|
||||
trace("Invalid physical device index %u.\n", test_options.adapter_idx);
|
||||
return VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
@ -504,7 +510,7 @@ static VkPhysicalDevice select_physical_device(struct vkd3d_instance *instance)
|
||||
vr = vkEnumeratePhysicalDevices(vk_instance, &count, vk_physical_devices);
|
||||
ok(vr == VK_SUCCESS, "Got unexpected VkResult %d.\n", vr);
|
||||
|
||||
vk_physical_device = vk_physical_devices[use_adapter_idx];
|
||||
vk_physical_device = vk_physical_devices[test_options.adapter_idx];
|
||||
|
||||
free(vk_physical_devices);
|
||||
|
||||
@ -676,34 +682,28 @@ static void parse_args(int argc, char **argv)
|
||||
for (i = 1; i < argc; ++i)
|
||||
{
|
||||
if (!strcmp(argv[i], "--warp"))
|
||||
use_warp_device = true;
|
||||
test_options.use_warp_device = true;
|
||||
else if (!strcmp(argv[i], "--adapter") && i + 1 < argc)
|
||||
use_adapter_idx = atoi(argv[++i]);
|
||||
test_options.adapter_idx = atoi(argv[++i]);
|
||||
else if (!strcmp(argv[i], "--validate"))
|
||||
test_options.enable_debug_layer = true;
|
||||
else if (!strcmp(argv[i], "--gbv"))
|
||||
test_options.enable_gpu_based_validation = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void enable_d3d12_debug_layer(int argc, char **argv)
|
||||
static void enable_d3d12_debug_layer(void)
|
||||
{
|
||||
bool enable_debug_layer = false, enable_gpu_based_validation = false;
|
||||
ID3D12Debug1 *debug1;
|
||||
ID3D12Debug *debug;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 1; i < argc; ++i)
|
||||
{
|
||||
if (!strcmp(argv[i], "--validate"))
|
||||
enable_debug_layer = true;
|
||||
else if (!strcmp(argv[i], "--gbv"))
|
||||
enable_gpu_based_validation = true;
|
||||
}
|
||||
|
||||
if (enable_gpu_based_validation)
|
||||
if (test_options.enable_gpu_based_validation)
|
||||
{
|
||||
if (SUCCEEDED(D3D12GetDebugInterface(&IID_ID3D12Debug1, (void **)&debug1)))
|
||||
{
|
||||
ID3D12Debug1_SetEnableGPUBasedValidation(debug1, true);
|
||||
ID3D12Debug1_Release(debug1);
|
||||
enable_debug_layer = true;
|
||||
test_options.enable_debug_layer = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -711,7 +711,8 @@ static void enable_d3d12_debug_layer(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (enable_debug_layer && SUCCEEDED(D3D12GetDebugInterface(&IID_ID3D12Debug, (void **)&debug)))
|
||||
if (test_options.enable_debug_layer
|
||||
&& SUCCEEDED(D3D12GetDebugInterface(&IID_ID3D12Debug, (void **)&debug)))
|
||||
{
|
||||
ID3D12Debug_EnableDebugLayer(debug);
|
||||
ID3D12Debug_Release(debug);
|
||||
|
@ -327,7 +327,7 @@ static void test_invalid_unordered_access_views(void)
|
||||
START_TEST(d3d12_invalid_usage)
|
||||
{
|
||||
parse_args(argc, argv);
|
||||
enable_d3d12_debug_layer(argc, argv);
|
||||
enable_d3d12_debug_layer();
|
||||
init_adapter_info();
|
||||
|
||||
run_test(test_invalid_resource_barriers);
|
||||
|
@ -576,7 +576,7 @@ static void test_thread_id(void)
|
||||
START_TEST(hlsl_d3d12)
|
||||
{
|
||||
parse_args(argc, argv);
|
||||
enable_d3d12_debug_layer(argc, argv);
|
||||
enable_d3d12_debug_layer();
|
||||
init_adapter_info();
|
||||
|
||||
run_test(test_preprocess);
|
||||
|
@ -523,7 +523,7 @@ void run_shader_tests_d3d12(int argc, char **argv)
|
||||
HRESULT hr;
|
||||
|
||||
parse_args(argc, argv);
|
||||
enable_d3d12_debug_layer(argc, argv);
|
||||
enable_d3d12_debug_layer();
|
||||
init_adapter_info();
|
||||
init_test_context(&runner.test_context, &desc);
|
||||
device = runner.test_context.device;
|
||||
|
Loading…
Reference in New Issue
Block a user