From 09630ada901ee356f2fec2c519ce0a71259ba225 Mon Sep 17 00:00:00 2001 From: Giovanni Mascellani Date: Fri, 23 Feb 2024 13:58:02 +0100 Subject: [PATCH] tests: Allow compiling shaders with DXC on crosstests. This is currently disabled on the CI because dxcompiler.dll is not available. --- gitlab/test.yml | 2 ++ tests/shader_runner.c | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/gitlab/test.yml b/gitlab/test.yml index 65a75d0e..a25918dc 100644 --- a/gitlab/test.yml +++ b/gitlab/test.yml @@ -19,8 +19,10 @@ test-win-64: extends: .test-win variables: TEST_ARCH: "64" + VKD3D_TESTS_SKIP_DXC: "1" test-win-32: extends: .test-win variables: TEST_ARCH: "32" + VKD3D_TESTS_SKIP_DXC: "1" diff --git a/tests/shader_runner.c b/tests/shader_runner.c index 4a44e3c9..a639d716 100644 --- a/tests/shader_runner.c +++ b/tests/shader_runner.c @@ -2083,7 +2083,7 @@ out: } #endif -#if defined(SONAME_LIBDXCOMPILER) && !defined(VKD3D_CROSSTEST) +#if (defined(SONAME_LIBDXCOMPILER) || defined(VKD3D_CROSSTEST)) static IDxcCompiler3 *dxcompiler_create(void) { DxcCreateInstanceProc create_instance; @@ -2095,7 +2095,11 @@ static IDxcCompiler3 *dxcompiler_create(void) if ((skip_dxc = getenv("VKD3D_TESTS_SKIP_DXC")) && strcmp(skip_dxc, "") != 0) return NULL; +#ifdef VKD3D_CROSSTEST + dll = vkd3d_dlopen("dxcompiler.dll"); +#else dll = vkd3d_dlopen(SONAME_LIBDXCOMPILER); +#endif ok(dll, "Failed to load dxcompiler library, %s.\n", vkd3d_dlerror()); if (!dll) return NULL; @@ -2112,7 +2116,7 @@ static IDxcCompiler3 *dxcompiler_create(void) return compiler; } -#elif !defined(VKD3D_CROSSTEST) +#else static IDxcCompiler3 *dxcompiler_create(void) { return NULL; @@ -2121,9 +2125,7 @@ static IDxcCompiler3 *dxcompiler_create(void) START_TEST(shader_runner) { -#ifndef VKD3D_CROSSTEST IDxcCompiler3 *dxc_compiler; -#endif parse_args(argc, argv); @@ -2134,7 +2136,14 @@ START_TEST(shader_runner) run_shader_tests_d3d11(); - run_shader_tests_d3d12(NULL); + dxc_compiler = dxcompiler_create(); + run_shader_tests_d3d12(dxc_compiler); + + if (dxc_compiler) + { + IDxcCompiler3_Release(dxc_compiler); + print_dll_version("dxcompiler.dll"); + } print_dll_version("d3dcompiler_47.dll"); print_dll_version("dxgi.dll");