Commit 8ce03e20 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

d3dcompiler/tests: Port some tests to shader model 4.

In particular, port those for which there is an interesting difference in code generation. Signed-off-by: 's avatarZebediah Figura <zfigura@codeweavers.com> Signed-off-by: 's avatarMatteo Bruni <mbruni@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 6f809561
...@@ -5,5 +5,6 @@ EXTRADEFS = -DD3D_COMPILER_VERSION=43 ...@@ -5,5 +5,6 @@ EXTRADEFS = -DD3D_COMPILER_VERSION=43
C_SRCS = \ C_SRCS = \
asm.c \ asm.c \
blob.c \ blob.c \
hlsl_d3d11.c \
hlsl_d3d9.c \ hlsl_d3d9.c \
reflection.c reflection.c
...@@ -578,63 +578,68 @@ static void test_fail(void) ...@@ -578,63 +578,68 @@ static void test_fail(void)
{ {
static const char *tests[] = static const char *tests[] =
{ {
"float4 test(float2 pos: TEXCOORD0) : COLOR\n" "float4 test() : SV_TARGET\n"
"{\n" "{\n"
" return y;\n" " return y;\n"
"}", "}",
"float4 test(float2 pos: TEXCOORD0) : COLOR\n" "float4 test() : SV_TARGET\n"
"{\n" "{\n"
" float4 x = float4(0, 0, 0, 0);\n" " float4 x = float4(0, 0, 0, 0);\n"
" x.xzzx = float4(1, 2, 3, 4);\n" " x.xzzx = float4(1, 2, 3, 4);\n"
" return x;\n" " return x;\n"
"}", "}",
"float4 test(float2 pos: TEXCOORD0) : COLOR\n" "float4 test(float2 pos: TEXCOORD0) : SV_TARGET\n"
"{\n" "{\n"
" float4 x = pos;\n" " float4 x = pos;\n"
" return x;\n" " return x;\n"
"}", "}",
"float4 test(float2 pos, TEXCOORD0) ; COLOR\n" "float4 test(float2 pos, TEXCOORD0) ; SV_TARGET\n"
"{\n" "{\n"
" pos = float4 x;\n" " pos = float4 x;\n"
" mul(float4(5, 4, 3, 2), mvp) = x;\n" " mul(float4(5, 4, 3, 2), mvp) = x;\n"
" return float4;\n" " return float4;\n"
"}", "}",
"float4 563r(float2 45s: TEXCOORD0) : COLOR\n" "float4 563r(float2 45s: TEXCOORD0) : SV_TARGET\n"
"{\n" "{\n"
" float2 x = 45s;\n" " float2 x = 45s;\n"
" return float4(x.x, x.y, 0, 0);\n" " return float4(x.x, x.y, 0, 0);\n"
"}", "}",
"float4 test(float2 pos: TEXCOORD0) : COLOR\n" "float4 test() : SV_TARGET\n"
"{\n" "{\n"
" struct { int b,c; } x = {0};\n" " struct { int b,c; } x = {0};\n"
" return y;\n" " return y;\n"
"}", "}",
"float4 test(float2 pos: TEXCOORD0) : COLOR\n" "float4 test() : SV_TARGET\n"
"{\n" "{\n"
" struct {} x = {};\n" " struct {} x = {};\n"
" return y;\n" " return y;\n"
"}", "}",
}; };
static const char *targets[] = {"ps_2_0", "ps_3_0", "ps_4_0"};
ID3D10Blob *compiled, *errors; ID3D10Blob *compiled, *errors;
unsigned int i; unsigned int i, j;
HRESULT hr; HRESULT hr;
for (i = 0; i < ARRAY_SIZE(tests); ++i) for (j = 0; j < ARRAY_SIZE(targets); ++j)
{ {
compiled = errors = NULL; for (i = 0; i < ARRAY_SIZE(tests); ++i)
hr = ppD3DCompile(tests[i], strlen(tests[i]), NULL, NULL, NULL, "test", "ps_2_0", 0, 0, &compiled, &errors); {
todo_wine ok(hr == E_FAIL, "Test %u, got unexpected hr %#x.\n", i, hr); compiled = errors = NULL;
todo_wine_if (i == 1) ok(!!errors, "Test %u, expected non-NULL error blob.\n", i); hr = ppD3DCompile(tests[i], strlen(tests[i]), NULL, NULL, NULL, "test", targets[j], 0, 0, &compiled, &errors);
ok(!compiled, "Test %u, expected no compiled shader blob.\n", i); todo_wine ok(hr == E_FAIL, "Test %u, target %s, got unexpected hr %#x.\n", i, targets[j], hr);
if (errors) todo_wine_if (i == 1) ok(!!errors, "Test %u, target %s, expected non-NULL error blob.\n", i, targets[j]);
ID3D10Blob_Release(errors); ok(!compiled, "Test %u, target %s, expected no compiled shader blob.\n", i, targets[j]);
if (errors)
ID3D10Blob_Release(errors);
}
} }
} }
......
...@@ -6,5 +6,6 @@ PARENTSRC = ../../d3dcompiler_43/tests ...@@ -6,5 +6,6 @@ PARENTSRC = ../../d3dcompiler_43/tests
C_SRCS = \ C_SRCS = \
asm.c \ asm.c \
blob.c \ blob.c \
hlsl_d3d11.c \
hlsl_d3d9.c \ hlsl_d3d9.c \
reflection.c reflection.c
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment