From 54142eb0bd918f96e729a441257ac40a9c3c5257 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 19 Feb 2024 17:01:00 +0100 Subject: [PATCH] tests/shader_runner: Print information about the run configuration in run_shader_tests(). --- tests/shader_runner.c | 30 +++++++++++++++++++----------- tests/shader_runner.h | 1 + tests/shader_runner_d3d11.c | 9 +-------- tests/shader_runner_d3d12.c | 15 +++++---------- tests/shader_runner_d3d9.c | 9 +-------- tests/shader_runner_gl.c | 2 +- tests/shader_runner_vulkan.c | 3 +-- 7 files changed, 29 insertions(+), 40 deletions(-) diff --git a/tests/shader_runner.c b/tests/shader_runner.c index bdf639e4..299c4845 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -64,6 +64,22 @@ typedef int HRESULT; struct test_options test_options = {0}; +#ifdef VKD3D_CROSSTEST +static const char HLSL_COMPILER[] = "d3dcompiler47.dll"; +#else +static const char HLSL_COMPILER[] = "vkd3d-shader"; +#endif +static const char *const model_strings[] = +{ + [SHADER_MODEL_2_0] = "2.0", + [SHADER_MODEL_3_0] = "3.0", + [SHADER_MODEL_4_0] = "4.0", + [SHADER_MODEL_4_1] = "4.1", + [SHADER_MODEL_5_0] = "5.0", + [SHADER_MODEL_5_1] = "5.1", + [SHADER_MODEL_6_0] = "6.0", +}; + void fatal_error(const char *format, ...) { va_list args; @@ -248,17 +264,6 @@ static void parse_require_directive(struct shader_runner *runner, const char *li if (match_string(line, "shader model >=", &line) || (less_than = match_string(line, "shader model <", &line))) { - static const char *const model_strings[] = - { - [SHADER_MODEL_2_0] = "2.0", - [SHADER_MODEL_3_0] = "3.0", - [SHADER_MODEL_4_0] = "4.0", - [SHADER_MODEL_4_1] = "4.1", - [SHADER_MODEL_5_0] = "5.0", - [SHADER_MODEL_5_1] = "5.1", - [SHADER_MODEL_6_0] = "6.0", - }; - for (i = 0; i < ARRAY_SIZE(model_strings); ++i) { if (match_string(line, model_strings[i], &line)) @@ -1338,6 +1343,9 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c const char *testname; FILE *f; + trace("Compiling SM%s-SM%s shaders with %s and executing with %s.\n", + model_strings[caps->minimum_shader_model], model_strings[caps->maximum_shader_model], + dxc_compiler ? "dxcompiler" : HLSL_COMPILER, caps->runner); trace(" float64: %u.\n", caps->float64); trace(" int64: %u.\n", caps->int64); trace(" rov: %u.\n", caps->rov); diff --git a/tests/shader_runner.h b/tests/shader_runner.h index 10637368..5ad6a278 100644 --- a/tests/shader_runner.h +++ b/tests/shader_runner.h @@ -119,6 +119,7 @@ struct input_element struct shader_runner_caps { + const char *runner; enum shader_model minimum_shader_model; enum shader_model maximum_shader_model; bool float64; diff --git a/tests/shader_runner_d3d11.c b/tests/shader_runner_d3d11.c index 5cd7340e..0d13fc00 100644 --- a/tests/shader_runner_d3d11.c +++ b/tests/shader_runner_d3d11.c @@ -32,12 +32,6 @@ #include "shader_runner.h" #include "vkd3d_test.h" -#ifdef VKD3D_CROSSTEST -static const char HLSL_COMPILER[] = "d3dcompiler47.dll"; -#else -static const char HLSL_COMPILER[] = "vkd3d-shader"; -#endif - static HRESULT (WINAPI *pCreateDXGIFactory1)(REFIID iid, void **factory); static HRESULT (WINAPI *pD3D11CreateDevice)(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_type, @@ -275,6 +269,7 @@ static BOOL init_test_context(struct d3d11_shader_runner *runner) return FALSE; } + runner->caps.runner = "d3d11.dll"; runner->caps.minimum_shader_model = SHADER_MODEL_4_0; runner->caps.maximum_shader_model = SHADER_MODEL_5_1; @@ -794,8 +789,6 @@ void run_shader_tests_d3d11(void) struct d3d11_shader_runner runner; HMODULE dxgi_module, d3d11_module; - trace("Compiling SM4-SM5 shaders with %s and executing with d3d11.dll\n", HLSL_COMPILER); - d3d11_module = LoadLibraryA("d3d11.dll"); dxgi_module = LoadLibraryA("dxgi.dll"); if (d3d11_module && dxgi_module) diff --git a/tests/shader_runner_d3d12.c b/tests/shader_runner_d3d12.c index da6edbbd..b7a29431 100644 --- a/tests/shader_runner_d3d12.c +++ b/tests/shader_runner_d3d12.c @@ -25,14 +25,6 @@ #include "shader_runner.h" #include "dxcompiler.h" -#ifdef VKD3D_CROSSTEST -static const char HLSL_COMPILER[] = "d3dcompiler47.dll"; -static const char SHADER_RUNNER[] = "d3d12.dll"; -#else -static const char HLSL_COMPILER[] = "vkd3d-shader"; -static const char SHADER_RUNNER[] = "vkd3d"; -#endif - struct d3d12_resource { struct resource r; @@ -630,6 +622,11 @@ static void d3d12_runner_init_caps(struct d3d12_shader_runner *runner) hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_D3D12_OPTIONS1, &options1, sizeof(options1)); ok(hr == S_OK, "Failed to check feature options1 support, hr %#x.\n", hr); +#ifdef VKD3D_CROSSTEST + runner->caps.runner = "d3d12.dll"; +#else + runner->caps.runner = "vkd3d"; +#endif runner->caps.minimum_shader_model = SHADER_MODEL_4_0; runner->caps.maximum_shader_model = SHADER_MODEL_5_1; runner->caps.float64 = options.DoublePrecisionFloatShaderOps; @@ -671,13 +668,11 @@ void run_shader_tests_d3d12(void *dxc_compiler) runner.compute_allocator, NULL, &IID_ID3D12GraphicsCommandList, (void **)&runner.compute_list); ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr); - trace("Compiling SM4-SM5 shaders with %s and executing with %s\n", HLSL_COMPILER, SHADER_RUNNER); run_shader_tests(&runner.r, &runner.caps, &d3d12_runner_ops, NULL); if (dxc_compiler) { runner.caps.minimum_shader_model = SHADER_MODEL_6_0; runner.caps.maximum_shader_model = SHADER_MODEL_6_0; - trace("Compiling SM6 shaders with dxcompiler and executing with %s\n", SHADER_RUNNER); run_shader_tests(&runner.r, &runner.caps, &d3d12_runner_ops, dxc_compiler); } diff --git a/tests/shader_runner_d3d9.c b/tests/shader_runner_d3d9.c index 7bad3dc2..4ddb8ffe 100644 --- a/tests/shader_runner_d3d9.c +++ b/tests/shader_runner_d3d9.c @@ -27,12 +27,6 @@ #include "shader_runner.h" #include "vkd3d_test.h" -#ifdef VKD3D_CROSSTEST -static const char HLSL_COMPILER[] = "d3dcompiler47.dll"; -#else -static const char HLSL_COMPILER[] = "vkd3d-shader"; -#endif - struct d3d9_resource { struct resource r; @@ -155,6 +149,7 @@ static bool init_test_context(struct d3d9_shader_runner *runner) return false; } + runner->caps.runner = "d3d9.dll"; runner->caps.minimum_shader_model = SHADER_MODEL_2_0; runner->caps.maximum_shader_model = SHADER_MODEL_3_0; @@ -539,8 +534,6 @@ void run_shader_tests_d3d9(void) struct d3d9_shader_runner runner; HMODULE d3d9_module; - trace("Compiling SM2-SM3 shaders with %s and executing with d3d9.dll\n", HLSL_COMPILER); - if (!(d3d9_module = LoadLibraryA("d3d9.dll"))) return; diff --git a/tests/shader_runner_gl.c b/tests/shader_runner_gl.c index 906a70aa..f4e4fa75 100644 --- a/tests/shader_runner_gl.c +++ b/tests/shader_runner_gl.c @@ -225,6 +225,7 @@ static bool gl_runner_init(struct gl_runner *runner) eglTerminate(display); continue; } + runner->caps.runner = "OpenGL"; runner->caps.minimum_shader_model = SHADER_MODEL_4_0; runner->caps.maximum_shader_model = SHADER_MODEL_5_1; @@ -1031,7 +1032,6 @@ void run_shader_tests_gl(void) if (!gl_runner_init(&runner)) goto done; - trace("Compiling SM4-SM5 shaders with vkd3d-shader and executing with OpenGL\n"); run_shader_tests(&runner.r, &runner.caps, &gl_runner_ops, NULL); gl_runner_cleanup(&runner); done: diff --git a/tests/shader_runner_vulkan.c b/tests/shader_runner_vulkan.c index 56407fbf..f9ab204f 100644 --- a/tests/shader_runner_vulkan.c +++ b/tests/shader_runner_vulkan.c @@ -1356,6 +1356,7 @@ static bool init_vulkan_runner(struct vulkan_shader_runner *runner) goto out_destroy_instance; } + runner->caps.runner = "Vulkan"; VK_CALL(vkGetPhysicalDeviceFeatures(runner->phys_device, &ret_features)); device_desc.pEnabledFeatures = &features; @@ -1453,12 +1454,10 @@ void run_shader_tests_vulkan(void) runner.caps.minimum_shader_model = SHADER_MODEL_2_0; runner.caps.maximum_shader_model = SHADER_MODEL_3_0; - trace("Compiling SM2-SM3 shaders with vkd3d-shader and executing with Vulkan\n"); run_shader_tests(&runner.r, &runner.caps, &vulkan_runner_ops, NULL); runner.caps.minimum_shader_model = SHADER_MODEL_4_0; runner.caps.maximum_shader_model = SHADER_MODEL_5_1; - trace("Compiling SM4-SM5 shaders with vkd3d-shader and executing with Vulkan\n"); run_shader_tests(&runner.r, &runner.caps, &vulkan_runner_ops, NULL); cleanup_vulkan_runner(&runner);