tests/shader_runner: Store the dxc_compiler in the shader_runner.

This commit is contained in:
Elizabeth Figura 2024-10-24 15:57:43 -05:00 committed by Henri Verbeet
parent b492ebc374
commit 591ae5e18e
Notes: Henri Verbeet 2024-10-28 18:11:45 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1216
3 changed files with 15 additions and 23 deletions

View File

@ -1472,7 +1472,7 @@ HRESULT dxc_compiler_compile_shader(void *dxc_compiler, enum shader_type type,
return hr;
}
static void compile_shader(struct shader_runner *runner, IDxcCompiler3 *dxc_compiler, const char *source, size_t len,
static void compile_shader(struct shader_runner *runner, const char *source, size_t len,
enum shader_type type, HRESULT expect)
{
bool use_dxcompiler = runner->minimum_shader_model >= SHADER_MODEL_6_0;
@ -1501,8 +1501,8 @@ static void compile_shader(struct shader_runner *runner, IDxcCompiler3 *dxc_comp
if (use_dxcompiler)
{
assert(dxc_compiler);
hr = dxc_compiler_compile_shader(dxc_compiler, type, runner->compile_options, source, &blob);
assert(runner->dxc_compiler);
hr = dxc_compiler_compile_shader(runner->dxc_compiler, type, runner->compile_options, source, &blob);
}
else
{
@ -1751,6 +1751,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
memset(runner, 0, sizeof(*runner));
runner->ops = ops;
runner->caps = caps;
runner->dxc_compiler = dxc_compiler;
runner->minimum_shader_model = caps->minimum_shader_model;
runner->maximum_shader_model = caps->maximum_shader_model;
runner->alpha_test_func = VKD3D_SHADER_COMPARISON_FUNC_ALWAYS;
@ -1820,8 +1821,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
if (test_action != TEST_ACTION_SKIP_COMPILATION)
{
todo_if (state == STATE_SHADER_COMPUTE_TODO)
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_CS,
expect_hr);
compile_shader(runner, shader_source, shader_source_len, SHADER_TYPE_CS, expect_hr);
}
free(runner->shader_source[SHADER_TYPE_CS]);
runner->shader_source[SHADER_TYPE_CS] = shader_source;
@ -1835,8 +1835,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
if (test_action != TEST_ACTION_SKIP_COMPILATION)
{
todo_if (state == STATE_SHADER_PIXEL_TODO)
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_PS,
expect_hr);
compile_shader(runner, shader_source, shader_source_len, SHADER_TYPE_PS, expect_hr);
}
free(runner->shader_source[SHADER_TYPE_PS]);
runner->shader_source[SHADER_TYPE_PS] = shader_source;
@ -1850,8 +1849,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
if (test_action != TEST_ACTION_SKIP_COMPILATION)
{
todo_if (state == STATE_SHADER_VERTEX_TODO)
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_VS,
expect_hr);
compile_shader(runner, shader_source, shader_source_len, SHADER_TYPE_VS, expect_hr);
}
free(runner->shader_source[SHADER_TYPE_VS]);
runner->shader_source[SHADER_TYPE_VS] = shader_source;
@ -1865,8 +1863,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
if (test_action != TEST_ACTION_SKIP_COMPILATION)
{
todo_if (state == STATE_SHADER_EFFECT_TODO)
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_FX,
expect_hr);
compile_shader(runner, shader_source, shader_source_len, SHADER_TYPE_FX, expect_hr);
}
free(runner->shader_source[SHADER_TYPE_FX]);
runner->shader_source[SHADER_TYPE_FX] = shader_source;
@ -1880,8 +1877,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
if (test_action != TEST_ACTION_SKIP_COMPILATION)
{
todo_if (state == STATE_SHADER_HULL_TODO)
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_HS,
expect_hr);
compile_shader(runner, shader_source, shader_source_len, SHADER_TYPE_HS, expect_hr);
}
free(runner->shader_source[SHADER_TYPE_HS]);
runner->shader_source[SHADER_TYPE_HS] = shader_source;
@ -1895,8 +1891,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
if (test_action != TEST_ACTION_SKIP_COMPILATION)
{
todo_if (state == STATE_SHADER_DOMAIN_TODO)
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_DS,
expect_hr);
compile_shader(runner, shader_source, shader_source_len, SHADER_TYPE_DS, expect_hr);
}
free(runner->shader_source[SHADER_TYPE_DS]);
runner->shader_source[SHADER_TYPE_DS] = shader_source;
@ -1910,8 +1905,7 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
if (test_action != TEST_ACTION_SKIP_COMPILATION)
{
todo_if (state == STATE_SHADER_GEOMETRY_TODO)
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_GS,
expect_hr);
compile_shader(runner, shader_source, shader_source_len, SHADER_TYPE_GS, expect_hr);
}
free(runner->shader_source[SHADER_TYPE_GS]);
runner->shader_source[SHADER_TYPE_GS] = shader_source;

View File

@ -206,6 +206,8 @@ struct shader_runner
struct input_element *input_elements;
size_t input_element_count, input_element_capacity;
IDxcCompiler3 *dxc_compiler;
unsigned int compile_options;
D3D12_COMPARISON_FUNC depth_func;

View File

@ -56,8 +56,6 @@ struct d3d12_shader_runner
ID3D12CommandQueue *compute_queue;
ID3D12CommandAllocator *compute_allocator;
ID3D12GraphicsCommandList *compute_list;
IDxcCompiler3 *dxc_compiler;
};
static struct d3d12_shader_runner *d3d12_shader_runner(struct shader_runner *r)
@ -85,8 +83,8 @@ static ID3D10Blob *compile_shader(const struct d3d12_shader_runner *runner, enum
if (runner->r.minimum_shader_model >= SHADER_MODEL_6_0)
{
assert(runner->dxc_compiler);
hr = dxc_compiler_compile_shader(runner->dxc_compiler, type, runner->r.compile_options, source, &blob);
assert(runner->r.dxc_compiler);
hr = dxc_compiler_compile_shader(runner->r.dxc_compiler, type, runner->r.compile_options, source, &blob);
}
else
{
@ -1095,8 +1093,6 @@ static void run_shader_tests_for_model_range(void *dxc_compiler,
d3d12_runner_init_caps(&runner, minimum_shader_model, maximum_shader_model);
runner.dxc_compiler = dxc_compiler;
runner.compute_queue = create_command_queue(device,
D3D12_COMMAND_LIST_TYPE_COMPUTE, D3D12_COMMAND_QUEUE_PRIORITY_NORMAL);