mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
tests/shader_runner: Store shader sources as an array.
This commit is contained in:
parent
ccdac48923
commit
b492ebc374
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
@ -958,7 +958,7 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
|
|||||||
" return pos;\n"
|
" return pos;\n"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
if (!runner->hs_source != !runner->ds_source)
|
if (!runner->shader_source[SHADER_TYPE_HS] != !runner->shader_source[SHADER_TYPE_DS])
|
||||||
fatal_error("Have a domain or hull shader but not both.\n");
|
fatal_error("Have a domain or hull shader but not both.\n");
|
||||||
|
|
||||||
set_default_target(runner);
|
set_default_target(runner);
|
||||||
@ -987,8 +987,8 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
|
|||||||
set_resource(runner, ¶ms);
|
set_resource(runner, ¶ms);
|
||||||
free(params.data);
|
free(params.data);
|
||||||
|
|
||||||
if (!runner->vs_source)
|
if (!runner->shader_source[SHADER_TYPE_VS])
|
||||||
runner->vs_source = strdup(vs_source);
|
runner->shader_source[SHADER_TYPE_VS] = strdup(vs_source);
|
||||||
|
|
||||||
runner->sample_count = 1;
|
runner->sample_count = 1;
|
||||||
for (i = 0; i < runner->resource_count; ++i)
|
for (i = 0; i < runner->resource_count; ++i)
|
||||||
@ -1005,7 +1005,7 @@ static void parse_test_directive(struct shader_runner *runner, const char *line)
|
|||||||
unsigned int vertex_count, instance_count;
|
unsigned int vertex_count, instance_count;
|
||||||
D3D_PRIMITIVE_TOPOLOGY topology;
|
D3D_PRIMITIVE_TOPOLOGY topology;
|
||||||
|
|
||||||
if (!runner->hs_source != !runner->ds_source)
|
if (!runner->shader_source[SHADER_TYPE_HS] != !runner->shader_source[SHADER_TYPE_DS])
|
||||||
fatal_error("Have a domain or hull shader but not both.\n");
|
fatal_error("Have a domain or hull shader but not both.\n");
|
||||||
|
|
||||||
set_default_target(runner);
|
set_default_target(runner);
|
||||||
@ -1823,8 +1823,8 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
|
|||||||
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_CS,
|
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_CS,
|
||||||
expect_hr);
|
expect_hr);
|
||||||
}
|
}
|
||||||
free(runner->cs_source);
|
free(runner->shader_source[SHADER_TYPE_CS]);
|
||||||
runner->cs_source = shader_source;
|
runner->shader_source[SHADER_TYPE_CS] = shader_source;
|
||||||
shader_source = NULL;
|
shader_source = NULL;
|
||||||
shader_source_len = 0;
|
shader_source_len = 0;
|
||||||
shader_source_size = 0;
|
shader_source_size = 0;
|
||||||
@ -1838,8 +1838,8 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
|
|||||||
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_PS,
|
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_PS,
|
||||||
expect_hr);
|
expect_hr);
|
||||||
}
|
}
|
||||||
free(runner->ps_source);
|
free(runner->shader_source[SHADER_TYPE_PS]);
|
||||||
runner->ps_source = shader_source;
|
runner->shader_source[SHADER_TYPE_PS] = shader_source;
|
||||||
shader_source = NULL;
|
shader_source = NULL;
|
||||||
shader_source_len = 0;
|
shader_source_len = 0;
|
||||||
shader_source_size = 0;
|
shader_source_size = 0;
|
||||||
@ -1853,8 +1853,8 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
|
|||||||
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_VS,
|
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_VS,
|
||||||
expect_hr);
|
expect_hr);
|
||||||
}
|
}
|
||||||
free(runner->vs_source);
|
free(runner->shader_source[SHADER_TYPE_VS]);
|
||||||
runner->vs_source = shader_source;
|
runner->shader_source[SHADER_TYPE_VS] = shader_source;
|
||||||
shader_source = NULL;
|
shader_source = NULL;
|
||||||
shader_source_len = 0;
|
shader_source_len = 0;
|
||||||
shader_source_size = 0;
|
shader_source_size = 0;
|
||||||
@ -1868,8 +1868,8 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
|
|||||||
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_FX,
|
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_FX,
|
||||||
expect_hr);
|
expect_hr);
|
||||||
}
|
}
|
||||||
free(runner->fx_source);
|
free(runner->shader_source[SHADER_TYPE_FX]);
|
||||||
runner->fx_source = shader_source;
|
runner->shader_source[SHADER_TYPE_FX] = shader_source;
|
||||||
shader_source = NULL;
|
shader_source = NULL;
|
||||||
shader_source_len = 0;
|
shader_source_len = 0;
|
||||||
shader_source_size = 0;
|
shader_source_size = 0;
|
||||||
@ -1883,8 +1883,8 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
|
|||||||
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_HS,
|
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_HS,
|
||||||
expect_hr);
|
expect_hr);
|
||||||
}
|
}
|
||||||
free(runner->hs_source);
|
free(runner->shader_source[SHADER_TYPE_HS]);
|
||||||
runner->hs_source = shader_source;
|
runner->shader_source[SHADER_TYPE_HS] = shader_source;
|
||||||
shader_source = NULL;
|
shader_source = NULL;
|
||||||
shader_source_len = 0;
|
shader_source_len = 0;
|
||||||
shader_source_size = 0;
|
shader_source_size = 0;
|
||||||
@ -1898,8 +1898,8 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
|
|||||||
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_DS,
|
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_DS,
|
||||||
expect_hr);
|
expect_hr);
|
||||||
}
|
}
|
||||||
free(runner->ds_source);
|
free(runner->shader_source[SHADER_TYPE_DS]);
|
||||||
runner->ds_source = shader_source;
|
runner->shader_source[SHADER_TYPE_DS] = shader_source;
|
||||||
shader_source = NULL;
|
shader_source = NULL;
|
||||||
shader_source_len = 0;
|
shader_source_len = 0;
|
||||||
shader_source_size = 0;
|
shader_source_size = 0;
|
||||||
@ -1913,8 +1913,8 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
|
|||||||
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_GS,
|
compile_shader(runner, dxc_compiler, shader_source, shader_source_len, SHADER_TYPE_GS,
|
||||||
expect_hr);
|
expect_hr);
|
||||||
}
|
}
|
||||||
free(runner->gs_source);
|
free(runner->shader_source[SHADER_TYPE_GS]);
|
||||||
runner->gs_source = shader_source;
|
runner->shader_source[SHADER_TYPE_GS] = shader_source;
|
||||||
shader_source = NULL;
|
shader_source = NULL;
|
||||||
shader_source_len = 0;
|
shader_source_len = 0;
|
||||||
shader_source_size = 0;
|
shader_source_size = 0;
|
||||||
@ -2212,13 +2212,8 @@ void run_shader_tests(struct shader_runner *runner, const struct shader_runner_c
|
|||||||
for (i = 0; i < runner->input_element_count; ++i)
|
for (i = 0; i < runner->input_element_count; ++i)
|
||||||
free(runner->input_elements[i].name);
|
free(runner->input_elements[i].name);
|
||||||
free(runner->input_elements);
|
free(runner->input_elements);
|
||||||
free(runner->vs_source);
|
for (i = 0; i < SHADER_TYPE_COUNT; ++i)
|
||||||
free(runner->ps_source);
|
free(runner->shader_source[i]);
|
||||||
free(runner->cs_source);
|
|
||||||
free(runner->hs_source);
|
|
||||||
free(runner->ds_source);
|
|
||||||
free(runner->gs_source);
|
|
||||||
free(runner->fx_source);
|
|
||||||
free(runner->uniforms);
|
free(runner->uniforms);
|
||||||
for (i = 0; i < runner->resource_count; ++i)
|
for (i = 0; i < runner->resource_count; ++i)
|
||||||
{
|
{
|
||||||
|
@ -49,6 +49,7 @@ enum shader_type
|
|||||||
SHADER_TYPE_DS,
|
SHADER_TYPE_DS,
|
||||||
SHADER_TYPE_GS,
|
SHADER_TYPE_GS,
|
||||||
SHADER_TYPE_FX,
|
SHADER_TYPE_FX,
|
||||||
|
SHADER_TYPE_COUNT,
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *shader_type_string(enum shader_type type);
|
const char *shader_type_string(enum shader_type type);
|
||||||
@ -179,13 +180,7 @@ struct shader_runner
|
|||||||
|
|
||||||
bool is_todo;
|
bool is_todo;
|
||||||
|
|
||||||
char *vs_source;
|
char *shader_source[SHADER_TYPE_COUNT];
|
||||||
char *ps_source;
|
|
||||||
char *cs_source;
|
|
||||||
char *fx_source;
|
|
||||||
char *hs_source;
|
|
||||||
char *ds_source;
|
|
||||||
char *gs_source;
|
|
||||||
enum shader_model minimum_shader_model;
|
enum shader_model minimum_shader_model;
|
||||||
enum shader_model maximum_shader_model;
|
enum shader_model maximum_shader_model;
|
||||||
bool require_shader_caps[SHADER_CAP_COUNT];
|
bool require_shader_caps[SHADER_CAP_COUNT];
|
||||||
|
@ -75,8 +75,9 @@ static struct d3d11_shader_runner *d3d11_shader_runner(struct shader_runner *r)
|
|||||||
return CONTAINING_RECORD(r, struct d3d11_shader_runner, r);
|
return CONTAINING_RECORD(r, struct d3d11_shader_runner, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ID3D10Blob *compile_shader(const struct d3d11_shader_runner *runner, const char *source, const char *type)
|
static ID3D10Blob *compile_shader(const struct d3d11_shader_runner *runner, enum shader_type type)
|
||||||
{
|
{
|
||||||
|
const char *source = runner->r.shader_source[type];
|
||||||
ID3D10Blob *blob = NULL, *errors = NULL;
|
ID3D10Blob *blob = NULL, *errors = NULL;
|
||||||
char profile[7];
|
char profile[7];
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
@ -91,7 +92,7 @@ static ID3D10Blob *compile_shader(const struct d3d11_shader_runner *runner, cons
|
|||||||
[SHADER_MODEL_5_1] = "5_1",
|
[SHADER_MODEL_5_1] = "5_1",
|
||||||
};
|
};
|
||||||
|
|
||||||
sprintf(profile, "%s_%s", type, shader_models[runner->r.minimum_shader_model]);
|
sprintf(profile, "%s_%s", shader_type_string(type), shader_models[runner->r.minimum_shader_model]);
|
||||||
hr = D3DCompile(source, strlen(source), NULL, NULL, NULL, "main", profile, runner->r.compile_options, 0, &blob, &errors);
|
hr = D3DCompile(source, strlen(source), NULL, NULL, NULL, "main", profile, runner->r.compile_options, 0, &blob, &errors);
|
||||||
ok(hr == S_OK, "Failed to compile shader, hr %#lx.\n", hr);
|
ok(hr == S_OK, "Failed to compile shader, hr %#lx.\n", hr);
|
||||||
if (errors)
|
if (errors)
|
||||||
@ -613,7 +614,7 @@ static bool d3d11_runner_dispatch(struct shader_runner *r, unsigned int x, unsig
|
|||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (!(cs_code = compile_shader(runner, runner->r.cs_source, "cs")))
|
if (!(cs_code = compile_shader(runner, SHADER_TYPE_CS)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
hr = ID3D11Device_CreateComputeShader(device, ID3D10Blob_GetBufferPointer(cs_code),
|
hr = ID3D11Device_CreateComputeShader(device, ID3D10Blob_GetBufferPointer(cs_code),
|
||||||
@ -714,23 +715,23 @@ static bool d3d11_runner_draw(struct shader_runner *r,
|
|||||||
unsigned int i;
|
unsigned int i;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
vs_code = compile_shader(runner, runner->r.vs_source, "vs");
|
vs_code = compile_shader(runner, SHADER_TYPE_VS);
|
||||||
ps_code = compile_shader(runner, runner->r.ps_source, "ps");
|
ps_code = compile_shader(runner, SHADER_TYPE_PS);
|
||||||
succeeded = vs_code && ps_code;
|
succeeded = vs_code && ps_code;
|
||||||
|
|
||||||
if (runner->r.hs_source)
|
if (runner->r.shader_source[SHADER_TYPE_HS])
|
||||||
{
|
{
|
||||||
hs_code = compile_shader(runner, runner->r.hs_source, "hs");
|
hs_code = compile_shader(runner, SHADER_TYPE_HS);
|
||||||
succeeded = succeeded && hs_code;
|
succeeded = succeeded && hs_code;
|
||||||
}
|
}
|
||||||
if (runner->r.ds_source)
|
if (runner->r.shader_source[SHADER_TYPE_DS])
|
||||||
{
|
{
|
||||||
ds_code = compile_shader(runner, runner->r.ds_source, "ds");
|
ds_code = compile_shader(runner, SHADER_TYPE_DS);
|
||||||
succeeded = succeeded && ds_code;
|
succeeded = succeeded && ds_code;
|
||||||
}
|
}
|
||||||
if (runner->r.gs_source)
|
if (runner->r.shader_source[SHADER_TYPE_GS])
|
||||||
{
|
{
|
||||||
gs_code = compile_shader(runner, runner->r.gs_source, "gs");
|
gs_code = compile_shader(runner, SHADER_TYPE_GS);
|
||||||
succeeded = succeeded && gs_code;
|
succeeded = succeeded && gs_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,8 +65,9 @@ static struct d3d12_shader_runner *d3d12_shader_runner(struct shader_runner *r)
|
|||||||
return CONTAINING_RECORD(r, struct d3d12_shader_runner, r);
|
return CONTAINING_RECORD(r, struct d3d12_shader_runner, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ID3D10Blob *compile_shader(const struct d3d12_shader_runner *runner, const char *source, enum shader_type type)
|
static ID3D10Blob *compile_shader(const struct d3d12_shader_runner *runner, enum shader_type type)
|
||||||
{
|
{
|
||||||
|
const char *source = runner->r.shader_source[type];
|
||||||
ID3D10Blob *blob = NULL, *errors = NULL;
|
ID3D10Blob *blob = NULL, *errors = NULL;
|
||||||
char profile[7];
|
char profile[7];
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
@ -396,7 +397,7 @@ static bool d3d12_runner_dispatch(struct shader_runner *r, unsigned int x, unsig
|
|||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
cs_code = compile_shader(runner, runner->r.cs_source, SHADER_TYPE_CS);
|
cs_code = compile_shader(runner, SHADER_TYPE_CS);
|
||||||
todo_if(runner->r.is_todo && runner->r.minimum_shader_model < SHADER_MODEL_6_0) ok(cs_code, "Failed to compile shader.\n");
|
todo_if(runner->r.is_todo && runner->r.minimum_shader_model < SHADER_MODEL_6_0) ok(cs_code, "Failed to compile shader.\n");
|
||||||
if (!cs_code)
|
if (!cs_code)
|
||||||
return false;
|
return false;
|
||||||
@ -790,23 +791,23 @@ static bool d3d12_runner_draw(struct shader_runner *r,
|
|||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
ps_code = compile_shader(runner, runner->r.ps_source, SHADER_TYPE_PS);
|
ps_code = compile_shader(runner, SHADER_TYPE_PS);
|
||||||
vs_code = compile_shader(runner, runner->r.vs_source, SHADER_TYPE_VS);
|
vs_code = compile_shader(runner, SHADER_TYPE_VS);
|
||||||
succeeded = ps_code && vs_code;
|
succeeded = ps_code && vs_code;
|
||||||
|
|
||||||
if (runner->r.hs_source)
|
if (runner->r.shader_source[SHADER_TYPE_HS])
|
||||||
{
|
{
|
||||||
hs_code = compile_shader(runner, runner->r.hs_source, SHADER_TYPE_HS);
|
hs_code = compile_shader(runner, SHADER_TYPE_HS);
|
||||||
succeeded = succeeded && hs_code;
|
succeeded = succeeded && hs_code;
|
||||||
}
|
}
|
||||||
if (runner->r.ds_source)
|
if (runner->r.shader_source[SHADER_TYPE_DS])
|
||||||
{
|
{
|
||||||
ds_code = compile_shader(runner, runner->r.ds_source, SHADER_TYPE_DS);
|
ds_code = compile_shader(runner, SHADER_TYPE_DS);
|
||||||
succeeded = succeeded && ds_code;
|
succeeded = succeeded && ds_code;
|
||||||
}
|
}
|
||||||
if (runner->r.gs_source)
|
if (runner->r.shader_source[SHADER_TYPE_GS])
|
||||||
{
|
{
|
||||||
gs_code = compile_shader(runner, runner->r.gs_source, SHADER_TYPE_GS);
|
gs_code = compile_shader(runner, SHADER_TYPE_GS);
|
||||||
succeeded = succeeded && gs_code;
|
succeeded = succeeded && gs_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,8 +57,9 @@ static struct d3d9_shader_runner *d3d9_shader_runner(struct shader_runner *r)
|
|||||||
|
|
||||||
static IDirect3D9 *(WINAPI *pDirect3DCreate9)(UINT sdk_version);
|
static IDirect3D9 *(WINAPI *pDirect3DCreate9)(UINT sdk_version);
|
||||||
|
|
||||||
static ID3D10Blob *compile_shader(const struct d3d9_shader_runner *runner, const char *source, const char *type)
|
static ID3D10Blob *compile_shader(const struct d3d9_shader_runner *runner, enum shader_type type)
|
||||||
{
|
{
|
||||||
|
const char *source = runner->r.shader_source[type];
|
||||||
ID3D10Blob *blob = NULL, *errors = NULL;
|
ID3D10Blob *blob = NULL, *errors = NULL;
|
||||||
char profile[7];
|
char profile[7];
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
@ -69,7 +70,7 @@ static ID3D10Blob *compile_shader(const struct d3d9_shader_runner *runner, const
|
|||||||
[SHADER_MODEL_3_0] = "3_0",
|
[SHADER_MODEL_3_0] = "3_0",
|
||||||
};
|
};
|
||||||
|
|
||||||
sprintf(profile, "%s_%s", type, shader_models[runner->r.minimum_shader_model]);
|
sprintf(profile, "%s_%s", shader_type_string(type), shader_models[runner->r.minimum_shader_model]);
|
||||||
hr = D3DCompile(source, strlen(source), NULL, NULL, NULL, "main", profile, runner->r.compile_options, 0, &blob, &errors);
|
hr = D3DCompile(source, strlen(source), NULL, NULL, NULL, "main", profile, runner->r.compile_options, 0, &blob, &errors);
|
||||||
ok(hr == S_OK, "Failed to compile shader, hr %#lx.\n", hr);
|
ok(hr == S_OK, "Failed to compile shader, hr %#lx.\n", hr);
|
||||||
if (errors)
|
if (errors)
|
||||||
@ -361,10 +362,10 @@ static bool d3d9_runner_draw(struct shader_runner *r,
|
|||||||
if (instance_count > 1)
|
if (instance_count > 1)
|
||||||
fatal_error("Unhandled instance count %u.\n", instance_count);
|
fatal_error("Unhandled instance count %u.\n", instance_count);
|
||||||
|
|
||||||
if (!(vs_code = compile_shader(runner, runner->r.vs_source, "vs")))
|
if (!(vs_code = compile_shader(runner, SHADER_TYPE_VS)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!(ps_code = compile_shader(runner, runner->r.ps_source, "ps")))
|
if (!(ps_code = compile_shader(runner, SHADER_TYPE_PS)))
|
||||||
{
|
{
|
||||||
ID3D10Blob_Release(vs_code);
|
ID3D10Blob_Release(vs_code);
|
||||||
return false;
|
return false;
|
||||||
|
@ -533,8 +533,9 @@ static void gl_runner_destroy_resource(struct shader_runner *r, struct resource
|
|||||||
free(resource);
|
free(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ID3DBlob *compile_hlsl(const struct shader_runner *runner, const char *source, const char *type)
|
static ID3DBlob *compile_hlsl(const struct shader_runner *runner, enum shader_type type)
|
||||||
{
|
{
|
||||||
|
const char *source = runner->shader_source[type];
|
||||||
ID3DBlob *blob = NULL, *errors = NULL;
|
ID3DBlob *blob = NULL, *errors = NULL;
|
||||||
char profile[7];
|
char profile[7];
|
||||||
|
|
||||||
@ -546,7 +547,7 @@ static ID3DBlob *compile_hlsl(const struct shader_runner *runner, const char *so
|
|||||||
[SHADER_MODEL_5_1] = "5_1",
|
[SHADER_MODEL_5_1] = "5_1",
|
||||||
};
|
};
|
||||||
|
|
||||||
sprintf(profile, "%s_%s", type, shader_models[runner->minimum_shader_model]);
|
sprintf(profile, "%s_%s", shader_type_string(type), shader_models[runner->minimum_shader_model]);
|
||||||
D3DCompile(source, strlen(source), NULL, NULL, NULL, "main",
|
D3DCompile(source, strlen(source), NULL, NULL, NULL, "main",
|
||||||
profile, runner->compile_options, 0, &blob, &errors);
|
profile, runner->compile_options, 0, &blob, &errors);
|
||||||
if (errors)
|
if (errors)
|
||||||
@ -742,7 +743,7 @@ static GLuint compile_compute_shader_program(struct gl_runner *runner)
|
|||||||
bool ret;
|
bool ret;
|
||||||
|
|
||||||
reset_combined_samplers(runner);
|
reset_combined_samplers(runner);
|
||||||
if (!(cs_blob = compile_hlsl(&runner->r, runner->r.cs_source, "cs")))
|
if (!(cs_blob = compile_hlsl(&runner->r, SHADER_TYPE_CS)))
|
||||||
return false;
|
return false;
|
||||||
ret = compile_shader(runner, cs_blob, &cs_code);
|
ret = compile_shader(runner, cs_blob, &cs_code);
|
||||||
ID3D10Blob_Release(cs_blob);
|
ID3D10Blob_Release(cs_blob);
|
||||||
@ -916,23 +917,23 @@ static GLuint compile_graphics_shader_program(struct gl_runner *runner, ID3D10Bl
|
|||||||
|
|
||||||
reset_combined_samplers(runner);
|
reset_combined_samplers(runner);
|
||||||
|
|
||||||
*vs_blob = compile_hlsl(&runner->r, runner->r.vs_source, "vs");
|
*vs_blob = compile_hlsl(&runner->r, SHADER_TYPE_VS);
|
||||||
fs_blob = compile_hlsl(&runner->r, runner->r.ps_source, "ps");
|
fs_blob = compile_hlsl(&runner->r, SHADER_TYPE_PS);
|
||||||
succeeded = *vs_blob && fs_blob;
|
succeeded = *vs_blob && fs_blob;
|
||||||
|
|
||||||
if (runner->r.hs_source)
|
if (runner->r.shader_source[SHADER_TYPE_HS])
|
||||||
{
|
{
|
||||||
hs_blob = compile_hlsl(&runner->r, runner->r.hs_source, "hs");
|
hs_blob = compile_hlsl(&runner->r, SHADER_TYPE_HS);
|
||||||
succeeded = succeeded && hs_blob;
|
succeeded = succeeded && hs_blob;
|
||||||
}
|
}
|
||||||
if (runner->r.ds_source)
|
if (runner->r.shader_source[SHADER_TYPE_DS])
|
||||||
{
|
{
|
||||||
ds_blob = compile_hlsl(&runner->r, runner->r.ds_source, "ds");
|
ds_blob = compile_hlsl(&runner->r, SHADER_TYPE_DS);
|
||||||
succeeded = succeeded && ds_blob;
|
succeeded = succeeded && ds_blob;
|
||||||
}
|
}
|
||||||
if (runner->r.gs_source)
|
if (runner->r.shader_source[SHADER_TYPE_GS])
|
||||||
{
|
{
|
||||||
gs_blob = compile_hlsl(&runner->r, runner->r.gs_source, "gs");
|
gs_blob = compile_hlsl(&runner->r, SHADER_TYPE_GS);
|
||||||
succeeded = succeeded && gs_blob;
|
succeeded = succeeded && gs_blob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,14 +503,15 @@ static bool compile_shader(struct vulkan_shader_runner *runner,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool create_shader_stage(struct vulkan_shader_runner *runner, VkPipelineShaderStageCreateInfo *stage_info,
|
static bool create_shader_stage(struct vulkan_shader_runner *runner,
|
||||||
const char *type, enum VkShaderStageFlagBits stage, const char *source)
|
VkPipelineShaderStageCreateInfo *stage_info, enum shader_type type, enum VkShaderStageFlagBits stage)
|
||||||
{
|
{
|
||||||
VkShaderModuleCreateInfo module_info = {.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO};
|
VkShaderModuleCreateInfo module_info = {.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO};
|
||||||
const struct vulkan_test_context *context = &runner->context;
|
const struct vulkan_test_context *context = &runner->context;
|
||||||
|
const char *source = runner->r.shader_source[type];
|
||||||
struct vkd3d_shader_code spirv;
|
struct vkd3d_shader_code spirv;
|
||||||
|
|
||||||
if (!compile_shader(runner, source, type, &spirv))
|
if (!compile_shader(runner, source, shader_type_string(type), &spirv))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
memset(stage_info, 0, sizeof(*stage_info));
|
memset(stage_info, 0, sizeof(*stage_info));
|
||||||
@ -621,22 +622,19 @@ static VkPipeline create_graphics_pipeline(struct vulkan_shader_runner *runner,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
memset(stage_desc, 0, sizeof(stage_desc));
|
memset(stage_desc, 0, sizeof(stage_desc));
|
||||||
ret = create_shader_stage(runner, &stage_desc[stage_count++],
|
ret = create_shader_stage(runner, &stage_desc[stage_count++], SHADER_TYPE_VS, VK_SHADER_STAGE_VERTEX_BIT);
|
||||||
"vs", VK_SHADER_STAGE_VERTEX_BIT, runner->r.vs_source);
|
ret &= create_shader_stage(runner, &stage_desc[stage_count++], SHADER_TYPE_PS, VK_SHADER_STAGE_FRAGMENT_BIT);
|
||||||
ret &= create_shader_stage(runner, &stage_desc[stage_count++],
|
|
||||||
"ps", VK_SHADER_STAGE_FRAGMENT_BIT, runner->r.ps_source);
|
|
||||||
|
|
||||||
if (runner->r.hs_source)
|
if (runner->r.shader_source[SHADER_TYPE_HS])
|
||||||
{
|
{
|
||||||
ret &= create_shader_stage(runner, &stage_desc[stage_count++], "hs",
|
ret &= create_shader_stage(runner, &stage_desc[stage_count++],
|
||||||
VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT, runner->r.hs_source);
|
SHADER_TYPE_HS, VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT);
|
||||||
ret &= create_shader_stage(runner, &stage_desc[stage_count++], "ds",
|
ret &= create_shader_stage(runner, &stage_desc[stage_count++],
|
||||||
VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT, runner->r.ds_source);
|
SHADER_TYPE_DS, VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (runner->r.gs_source)
|
if (runner->r.shader_source[SHADER_TYPE_GS])
|
||||||
ret &= create_shader_stage(runner, &stage_desc[stage_count++],
|
ret &= create_shader_stage(runner, &stage_desc[stage_count++], SHADER_TYPE_GS, VK_SHADER_STAGE_GEOMETRY_BIT);
|
||||||
"gs", VK_SHADER_STAGE_GEOMETRY_BIT, runner->r.gs_source);
|
|
||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
@ -756,7 +754,7 @@ static VkPipeline create_graphics_pipeline(struct vulkan_shader_runner *runner,
|
|||||||
pipeline_desc.renderPass = render_pass;
|
pipeline_desc.renderPass = render_pass;
|
||||||
pipeline_desc.subpass = 0;
|
pipeline_desc.subpass = 0;
|
||||||
|
|
||||||
if (runner->r.hs_source)
|
if (runner->r.shader_source[SHADER_TYPE_HS])
|
||||||
{
|
{
|
||||||
tessellation_info.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO;
|
tessellation_info.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO;
|
||||||
tessellation_info.pNext = NULL;
|
tessellation_info.pNext = NULL;
|
||||||
@ -783,7 +781,7 @@ static VkPipeline create_compute_pipeline(struct vulkan_shader_runner *runner, V
|
|||||||
VkPipeline pipeline;
|
VkPipeline pipeline;
|
||||||
bool ret;
|
bool ret;
|
||||||
|
|
||||||
ret = create_shader_stage(runner, &pipeline_desc.stage, "cs", VK_SHADER_STAGE_COMPUTE_BIT, runner->r.cs_source);
|
ret = create_shader_stage(runner, &pipeline_desc.stage, SHADER_TYPE_CS, VK_SHADER_STAGE_COMPUTE_BIT);
|
||||||
todo_if (runner->r.is_todo) ok(ret, "Failed to compile shader.\n");
|
todo_if (runner->r.is_todo) ok(ret, "Failed to compile shader.\n");
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return VK_NULL_HANDLE;
|
return VK_NULL_HANDLE;
|
||||||
|
Loading…
Reference in New Issue
Block a user