tests/shader-runner: Call each runner only once.

If the runners require multiple calls to run_shader_tests() for
different shader model ranges, these are moved inside the sole runner
call.

For the same reason, the trace() messages are also moved inside the
runner calls.
This commit is contained in:
Francisco Casas 2023-12-14 03:08:41 -03:00 committed by Alexandre Julliard
parent 79de3ec766
commit 671f4ec2b2
Notes: Alexandre Julliard 2024-01-24 22:53:52 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/514
7 changed files with 48 additions and 27 deletions

View File

@ -1711,61 +1711,50 @@ START_TEST(shader_runner)
#if defined(VKD3D_CROSSTEST)
trace("Running tests from a Windows cross build\n");
trace("Compiling shaders with d3dcompiler_47.dll and executing with d3d9.dll\n");
run_shader_tests_d3d9();
trace("Compiling shaders with d3dcompiler_47.dll and executing with d3d11.dll\n");
run_shader_tests_d3d11();
trace("Compiling shaders with d3dcompiler_47.dll and executing with d3d12.dll\n");
run_shader_tests_d3d12(NULL, SHADER_MODEL_4_0, SHADER_MODEL_5_1);
run_shader_tests_d3d12(NULL);
print_dll_version("d3dcompiler_47.dll");
print_dll_version("dxgi.dll");
print_dll_version("d3d9.dll");
print_dll_version("d3d11.dll");
print_dll_version("d3d12.dll");
#elif defined(_WIN32)
trace("Running tests from a Windows non-cross build\n");
trace("Compiling shaders with vkd3d-shader and executing with d3d9.dll\n");
run_shader_tests_d3d9();
trace("Compiling shaders with vkd3d-shader and executing with d3d11.dll\n");
run_shader_tests_d3d11();
trace("Compiling shaders with vkd3d-shader and executing with vkd3d\n");
run_shader_tests_d3d12(NULL, SHADER_MODEL_4_0, SHADER_MODEL_5_1);
dxc_compiler = dxcompiler_create();
run_shader_tests_d3d12(dxc_compiler);
if ((dxc_compiler = dxcompiler_create()))
if (dxc_compiler)
{
trace("Compiling shaders with dxcompiler and executing with vkd3d\n");
run_shader_tests_d3d12(dxc_compiler, SHADER_MODEL_6_0, SHADER_MODEL_6_0);
IDxcCompiler3_Release(dxc_compiler);
print_dll_version(SONAME_LIBDXCOMPILER);
}
print_dll_version("d3d9.dll");
print_dll_version("d3d11.dll");
#else
trace("Running tests from a Unix build\n");
# ifdef HAVE_OPENGL
trace("Compiling shaders with vkd3d-shader and executing with OpenGL\n");
run_shader_tests_gl();
# endif
trace("Compiling shaders with vkd3d-shader and executing with Vulkan\n");
run_shader_tests_vulkan();
trace("Compiling shaders with vkd3d-shader and executing with vkd3d\n");
run_shader_tests_d3d12(NULL, SHADER_MODEL_4_0, SHADER_MODEL_5_1);
dxc_compiler = dxcompiler_create();
run_shader_tests_d3d12(dxc_compiler);
if ((dxc_compiler = dxcompiler_create()))
{
trace("Compiling shaders with dxcompiler and executing with vkd3d\n");
run_shader_tests_d3d12(dxc_compiler, SHADER_MODEL_6_0, SHADER_MODEL_6_0);
if (dxc_compiler)
IDxcCompiler3_Release(dxc_compiler);
}
#endif
}

View File

@ -179,5 +179,4 @@ void run_shader_tests_d3d11(void);
void run_shader_tests_gl(void);
void run_shader_tests_vulkan(void);
#endif
void run_shader_tests_d3d12(void *dxc_compiler, enum shader_model minimum_shader_model,
enum shader_model maximum_shader_model);
void run_shader_tests_d3d12(void *dxc_compiler);

View File

@ -32,6 +32,12 @@
#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,
@ -757,6 +763,8 @@ 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)

View File

@ -25,6 +25,14 @@
#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;
@ -586,8 +594,7 @@ static const struct shader_runner_ops d3d12_runner_ops =
.release_readback = d3d12_runner_release_readback,
};
void run_shader_tests_d3d12(void *dxc_compiler, enum shader_model minimum_shader_model,
enum shader_model maximum_shader_model)
void run_shader_tests_d3d12(void *dxc_compiler)
{
static const struct test_context_desc desc =
{
@ -627,10 +634,17 @@ void run_shader_tests_d3d12(void *dxc_compiler, enum shader_model minimum_shader
hr = ID3D12Device_CheckFeatureSupport(device, D3D12_FEATURE_D3D12_OPTIONS1,
&runner.options1, sizeof(runner.options1));
ok(hr == S_OK, "Failed to check feature options1 support, hr %#x.\n", hr);
if (maximum_shader_model >= SHADER_MODEL_6_0)
trace("Compiling SM4-SM5 shaders with %s and executing with %s\n", HLSL_COMPILER, SHADER_RUNNER);
run_shader_tests(&runner.r, &d3d12_runner_ops, dxc_compiler, SHADER_MODEL_4_0, SHADER_MODEL_5_1);
if (dxc_compiler)
{
trace("Int64ShaderOps: %u.\n", runner.options1.Int64ShaderOps);
run_shader_tests(&runner.r, &d3d12_runner_ops, dxc_compiler, minimum_shader_model, maximum_shader_model);
trace("Compiling SM6 shaders with dxcompiler and executing with %s\n", SHADER_RUNNER);
run_shader_tests(&runner.r, &d3d12_runner_ops, dxc_compiler, SHADER_MODEL_6_0, SHADER_MODEL_6_0);
}
ID3D12GraphicsCommandList_Release(runner.compute_list);
ID3D12CommandAllocator_Release(runner.compute_allocator);

View File

@ -27,6 +27,12 @@
#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;
@ -534,6 +540,8 @@ 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);
d3d9_module = LoadLibraryA("d3d9.dll");
if (d3d9_module)
{

View File

@ -996,6 +996,8 @@ void run_shader_tests_gl(void)
vkd3d_test_name = "shader_runner_gl";
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, &gl_runner_ops, NULL, SHADER_MODEL_4_0, SHADER_MODEL_5_1);
gl_runner_cleanup(&runner);
done:

View File

@ -1420,6 +1420,7 @@ void run_shader_tests_vulkan(void)
if (!init_vulkan_runner(&runner))
return;
trace("Compiling SM2-SM5 shaders with vkd3d-shader and executing with Vulkan\n");
run_shader_tests(&runner.r, &vulkan_runner_ops, NULL, SHADER_MODEL_2_0, SHADER_MODEL_5_1);
cleanup_vulkan_runner(&runner);