tests: Add some tests for shaders which fail to preprocess.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-11-24 00:29:57 -06:00 committed by Alexandre Julliard
parent 5642fbaae7
commit 3bf15d6345
3 changed files with 35 additions and 0 deletions

View File

@ -67,6 +67,7 @@ vkd3d_shader_tests = \
tests/preproc-if.shader_test \ tests/preproc-if.shader_test \
tests/preproc-ifdef.shader_test \ tests/preproc-ifdef.shader_test \
tests/preproc-if-expr.shader_test \ tests/preproc-if-expr.shader_test \
tests/preproc-invalid.shader_test \
tests/preproc-macro.shader_test \ tests/preproc-macro.shader_test \
tests/swizzle-0.shader_test \ tests/swizzle-0.shader_test \
tests/swizzle-1.shader_test \ tests/swizzle-1.shader_test \
@ -213,6 +214,7 @@ XFAIL_TESTS = \
tests/preproc-if.shader_test \ tests/preproc-if.shader_test \
tests/preproc-ifdef.shader_test \ tests/preproc-ifdef.shader_test \
tests/preproc-if-expr.shader_test \ tests/preproc-if-expr.shader_test \
tests/preproc-invalid.shader_test \
tests/preproc-macro.shader_test \ tests/preproc-macro.shader_test \
tests/swizzle-0.shader_test \ tests/swizzle-0.shader_test \
tests/swizzle-1.shader_test \ tests/swizzle-1.shader_test \

View File

@ -0,0 +1,8 @@
[preproc fail]
#error
[preproc fail]
#include <nonexistent_file>
[preproc fail]
#include "nonexistent_file"

View File

@ -103,6 +103,7 @@ enum parse_state
{ {
STATE_NONE, STATE_NONE,
STATE_PREPROC, STATE_PREPROC,
STATE_PREPROC_INVALID,
STATE_SHADER_INVALID_PIXEL, STATE_SHADER_INVALID_PIXEL,
STATE_SHADER_PIXEL, STATE_SHADER_PIXEL,
STATE_TEST, STATE_TEST,
@ -347,6 +348,27 @@ START_TEST(shader_runner_d3d12)
break; break;
} }
case STATE_PREPROC_INVALID:
{
ID3D10Blob *blob = NULL, *errors = NULL;
HRESULT hr;
hr = D3DPreprocess(shader_source, strlen(shader_source), NULL, NULL, NULL, &blob, &errors);
ok(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
ok(!blob, "Expected no compiled shader blob.\n");
ok(!!errors, "Expected non-NULL error blob.\n");
if (errors)
{
if (vkd3d_test_state.debug_level)
trace("%s\n", (char *)ID3D10Blob_GetBufferPointer(errors));
ID3D10Blob_Release(errors);
}
shader_source_len = 0;
break;
}
case STATE_PREPROC: case STATE_PREPROC:
{ {
ID3D10Blob *blob = NULL, *errors = NULL; ID3D10Blob *blob = NULL, *errors = NULL;
@ -389,6 +411,8 @@ START_TEST(shader_runner_d3d12)
state = STATE_TEST; state = STATE_TEST;
else if (!strcmp(line, "[preproc]\n")) else if (!strcmp(line, "[preproc]\n"))
state = STATE_PREPROC; state = STATE_PREPROC;
else if (!strcmp(line, "[preproc fail]\n"))
state = STATE_PREPROC_INVALID;
vkd3d_test_set_context("Section %.*s, line %u", strlen(line) - 1, line, line_number); vkd3d_test_set_context("Section %.*s, line %u", strlen(line) - 1, line, line_number);
} }
@ -402,6 +426,7 @@ START_TEST(shader_runner_d3d12)
break; break;
case STATE_PREPROC: case STATE_PREPROC:
case STATE_PREPROC_INVALID:
case STATE_SHADER_INVALID_PIXEL: case STATE_SHADER_INVALID_PIXEL:
case STATE_SHADER_PIXEL: case STATE_SHADER_PIXEL:
{ {