tests: Enable compiler backwards compatibility mode only for shaders that require it.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2023-08-25 15:05:51 +02:00 committed by Alexandre Julliard
parent 9624e2f904
commit 269747dbf3
Notes: Alexandre Julliard 2023-08-28 22:17:11 +02:00
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/316
6 changed files with 13 additions and 6 deletions

View File

@ -34,6 +34,8 @@ size (1, 1)
size (1, 1) size (1, 1)
4.0 4.0 4.0 1.0 4.0 4.0 4.0 1.0
[require]
options: backcompat
[pixel shader] [pixel shader]
sampler sam; sampler sam;

View File

@ -83,6 +83,9 @@ size (1, 1)
% The "allocation size" for textures affects the starting register id for the next resource in the % The "allocation size" for textures affects the starting register id for the next resource in the
% table, and may be larger than the "bind count". % table, and may be larger than the "bind count".
[require]
options: backcompat
[pixel shader] [pixel shader]
// Name Type Format Dim HLSL Bind Count // Name Type Format Dim HLSL Bind Count
// ------------------------------ ---------- ------- ----------- -------------- ------ // ------------------------------ ---------- ------- ----------- -------------- ------

View File

@ -148,6 +148,7 @@ static void parse_require_directive(struct shader_runner *runner, const char *li
{ 0, "none" }, { 0, "none" },
{ D3DCOMPILE_PACK_MATRIX_ROW_MAJOR, "row-major" }, { D3DCOMPILE_PACK_MATRIX_ROW_MAJOR, "row-major" },
{ D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR, "column-major" }, { D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR, "column-major" },
{ D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY, "backcompat" },
}; };
runner->compile_options = 0; runner->compile_options = 0;
@ -773,7 +774,6 @@ static HRESULT map_unidentified_hrs(HRESULT hr)
static void compile_shader(struct shader_runner *runner, const char *source, size_t len, const char *type, HRESULT expect) static void compile_shader(struct shader_runner *runner, const char *source, size_t len, const char *type, HRESULT expect)
{ {
UINT flags = runner->compile_options | D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY;
ID3D10Blob *blob = NULL, *errors = NULL; ID3D10Blob *blob = NULL, *errors = NULL;
char profile[7]; char profile[7];
HRESULT hr; HRESULT hr;
@ -789,7 +789,7 @@ static void compile_shader(struct shader_runner *runner, const char *source, siz
}; };
sprintf(profile, "%s_%s", type, shader_models[runner->minimum_shader_model]); sprintf(profile, "%s_%s", type, shader_models[runner->minimum_shader_model]);
hr = D3DCompile(source, len, NULL, NULL, NULL, "main", profile, flags, 0, &blob, &errors); hr = D3DCompile(source, len, NULL, NULL, NULL, "main", profile, runner->compile_options, 0, &blob, &errors);
hr = map_unidentified_hrs(hr); hr = map_unidentified_hrs(hr);
ok(hr == expect, "Got unexpected hr %#x.\n", hr); ok(hr == expect, "Got unexpected hr %#x.\n", hr);
if (hr == S_OK) if (hr == S_OK)

View File

@ -74,7 +74,6 @@ static struct d3d11_shader_runner *d3d11_shader_runner(struct 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, const char *source, const char *type)
{ {
UINT flags = runner->r.compile_options | D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY;
ID3D10Blob *blob = NULL, *errors = NULL; ID3D10Blob *blob = NULL, *errors = NULL;
char profile[7]; char profile[7];
HRESULT hr; HRESULT hr;
@ -90,7 +89,7 @@ static ID3D10Blob *compile_shader(const struct d3d11_shader_runner *runner, cons
}; };
sprintf(profile, "%s_%s", type, shader_models[runner->r.minimum_shader_model]); sprintf(profile, "%s_%s", type, shader_models[runner->r.minimum_shader_model]);
hr = D3DCompile(source, strlen(source), NULL, NULL, NULL, "main", profile, flags, 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)
{ {

View File

@ -58,7 +58,6 @@ static struct d3d12_shader_runner *d3d12_shader_runner(struct shader_runner *r)
static ID3D10Blob *compile_shader(const struct d3d12_shader_runner *runner, const char *source, const char *type) static ID3D10Blob *compile_shader(const struct d3d12_shader_runner *runner, const char *source, const char *type)
{ {
UINT flags = runner->r.compile_options | D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY;
ID3D10Blob *blob = NULL, *errors = NULL; ID3D10Blob *blob = NULL, *errors = NULL;
char profile[7]; char profile[7];
HRESULT hr; HRESULT hr;
@ -74,7 +73,7 @@ static ID3D10Blob *compile_shader(const struct d3d12_shader_runner *runner, cons
}; };
sprintf(profile, "%s_%s", type, shader_models[runner->r.minimum_shader_model]); sprintf(profile, "%s_%s", type, shader_models[runner->r.minimum_shader_model]);
hr = D3DCompile(source, strlen(source), NULL, NULL, NULL, "main", profile, flags, 0, &blob, &errors); hr = D3DCompile(source, strlen(source), NULL, NULL, NULL, "main", profile, runner->r.compile_options, 0, &blob, &errors);
ok(FAILED(hr) == !blob, "Got unexpected hr %#x, blob %p.\n", hr, blob); ok(FAILED(hr) == !blob, "Got unexpected hr %#x, blob %p.\n", hr, blob);
if (errors) if (errors)
{ {

View File

@ -430,6 +430,10 @@ static bool compile_shader(const struct vulkan_shader_runner *runner, const char
compile_options &= ~(D3DCOMPILE_PACK_MATRIX_ROW_MAJOR | D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR); compile_options &= ~(D3DCOMPILE_PACK_MATRIX_ROW_MAJOR | D3DCOMPILE_PACK_MATRIX_COLUMN_MAJOR);
} }
/* FIXME: ignore compatibility flag for now */
if (compile_options & D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY)
compile_options &= ~D3DCOMPILE_ENABLE_BACKWARDS_COMPATIBILITY;
if (compile_options) if (compile_options)
fatal_error("Unsupported compiler options %#x.\n", compile_options); fatal_error("Unsupported compiler options %#x.\n", compile_options);
} }