Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- Makefile.am | 6 ++++-- tests/shader_runner_d3d12.c | 23 +++++++++++++++++++++++ tests/trigonometry.shader_test | 24 ++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 tests/trigonometry.shader_test
diff --git a/Makefile.am b/Makefile.am index 27bc00b6..2e286bc8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,7 +61,8 @@ vkd3d_shader_tests = \ tests/swizzle-4.shader_test \ tests/swizzle-5.shader_test \ tests/swizzle-6.shader_test \ - tests/swizzle-7.shader_test + tests/swizzle-7.shader_test \ + tests/trigonometry.shader_test
vkd3d_test_headers = \ tests/d3d12_crosstest.h \ @@ -192,7 +193,8 @@ XFAIL_TESTS = \ tests/swizzle-4.shader_test \ tests/swizzle-5.shader_test \ tests/swizzle-6.shader_test \ - tests/swizzle-7.shader_test + tests/swizzle-7.shader_test \ + tests/trigonometry.shader_test endif
if BUILD_DEMOS diff --git a/tests/shader_runner_d3d12.c b/tests/shader_runner_d3d12.c index 709fc006..0e9694a4 100644 --- a/tests/shader_runner_d3d12.c +++ b/tests/shader_runner_d3d12.c @@ -190,6 +190,29 @@ static void parse_test_directive(struct shader_context *context, const char *lin release_resource_readback(&rb); reset_command_list(context->c.list, context->c.allocator); } + else if (match_string(line, "probe rgba", &line)) + { + struct resource_readback rb; + unsigned int x, y, ulps; + struct vec4 v; + RECT rect; + int ret; + + ret = sscanf(line, "( %u , %u ) ( %f , %f , %f , %f ) %u", &x, &y, &v.x, &v.y, &v.z, &v.w, &ulps); + if (ret < 6) + goto err; + if (ret < 7) + ulps = 0; + + get_texture_readback_with_command_list(context->c.render_target, 0, &rb, context->c.queue, context->c.list); + rect.left = x; + rect.right = x + 1; + rect.top = y; + rect.bottom = y + 1; + check_readback_data_vec4(&rb, &rect, &v, ulps); + release_resource_readback(&rb); + reset_command_list(context->c.list, context->c.allocator); + } else if (match_string(line, "uniform", &line)) { unsigned int offset; diff --git a/tests/trigonometry.shader_test b/tests/trigonometry.shader_test new file mode 100644 index 00000000..07a280a0 --- /dev/null +++ b/tests/trigonometry.shader_test @@ -0,0 +1,24 @@ +[pixel shader] +float4 main(float4 pos : SV_POSITION) : SV_TARGET +{ + return float4(sin(pos.x - 0.5), cos(pos.x - 0.5), 0, 0); +} + +[test] +draw quad +probe rgba ( 0, 0) ( 0.00000000, 1.00000000, 0.0, 0.0) +probe rgba ( 1, 0) ( 0.84147098, 0.54030231, 0.0, 0.0) 1024 +probe rgba ( 2, 0) ( 0.90929743, -0.41614684, 0.0, 0.0) 1024 +probe rgba ( 3, 0) ( 0.14112001, -0.98999250, 0.0, 0.0) 1024 +probe rgba ( 4, 0) (-0.75680250, -0.65364362, 0.0, 0.0) 1024 +probe rgba ( 5, 0) (-0.95892427, 0.28366219, 0.0, 0.0) 1024 +probe rgba ( 6, 0) (-0.27941550, 0.96017029, 0.0, 0.0) 1024 +probe rgba ( 7, 0) ( 0.65698660, 0.75390225, 0.0, 0.0) 1024 +probe rgba ( 8, 0) ( 0.98935825, -0.14550003, 0.0, 0.0) 1024 +probe rgba ( 9, 0) ( 0.41211849, -0.91113026, 0.0, 0.0) 1024 +probe rgba (10, 0) (-0.54402111, -0.83907153, 0.0, 0.0) 1024 +probe rgba (11, 0) (-0.99999021, 0.00442570, 0.0, 0.0) 1024 +probe rgba (12, 0) (-0.53657292, 0.84385396, 0.0, 0.0) 1024 +probe rgba (13, 0) ( 0.42016704, 0.90744678, 0.0, 0.0) 1024 +probe rgba (14, 0) ( 0.99060736, 0.13673722, 0.0, 0.0) 1024 +probe rgba (15, 0) ( 0.65028784, -0.75968791, 0.0, 0.0) 1024
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- Makefile.am | 2 ++ tests/hlsl-comma.shader_test | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 tests/hlsl-comma.shader_test
diff --git a/Makefile.am b/Makefile.am index 2e286bc8..c6d9b063 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,6 +51,7 @@ vkd3d_shader_runners = \
vkd3d_shader_tests = \ tests/conditional.shader_test \ + tests/hlsl-comma.shader_test \ tests/hlsl-vector-indexing.shader_test \ tests/hlsl-vector-indexing-uniform.shader_test \ tests/math.shader_test \ @@ -183,6 +184,7 @@ tests_vkd3d_shader_api_LDADD = libvkd3d-shader.la SHADER_TEST_LOG_COMPILER = tests/shader_runner_d3d12 XFAIL_TESTS = \ tests/conditional.shader_test \ + tests/hlsl-comma.shader_test \ tests/hlsl-vector-indexing.shader_test \ tests/hlsl-vector-indexing-uniform.shader_test \ tests/math.shader_test \ diff --git a/tests/hlsl-comma.shader_test b/tests/hlsl-comma.shader_test new file mode 100644 index 00000000..23bee71a --- /dev/null +++ b/tests/hlsl-comma.shader_test @@ -0,0 +1,10 @@ +[pixel shader] +float4 main(): sv_target +{ + float4 ret; + return (ret = float4(0.1, 0.2, 0.3, 0.4)), ret + 0.5; +} + +[test] +draw quad +probe all rgba (0.6, 0.7, 0.8, 0.9)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- Makefile.am | 4 ++++ tests/hlsl-return-implicit-conversion.shader_test | 9 +++++++++ tests/hlsl-return-void.shader_test | 11 +++++++++++ 3 files changed, 24 insertions(+) create mode 100644 tests/hlsl-return-implicit-conversion.shader_test create mode 100644 tests/hlsl-return-void.shader_test
diff --git a/Makefile.am b/Makefile.am index c6d9b063..efe0c7cc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -52,6 +52,8 @@ vkd3d_shader_runners = \ vkd3d_shader_tests = \ tests/conditional.shader_test \ tests/hlsl-comma.shader_test \ + tests/hlsl-return-implicit-conversion.shader_test \ + tests/hlsl-return-void.shader_test \ tests/hlsl-vector-indexing.shader_test \ tests/hlsl-vector-indexing-uniform.shader_test \ tests/math.shader_test \ @@ -185,6 +187,8 @@ SHADER_TEST_LOG_COMPILER = tests/shader_runner_d3d12 XFAIL_TESTS = \ tests/conditional.shader_test \ tests/hlsl-comma.shader_test \ + tests/hlsl-return-implicit-conversion.shader_test \ + tests/hlsl-return-void.shader_test \ tests/hlsl-vector-indexing.shader_test \ tests/hlsl-vector-indexing-uniform.shader_test \ tests/math.shader_test \ diff --git a/tests/hlsl-return-implicit-conversion.shader_test b/tests/hlsl-return-implicit-conversion.shader_test new file mode 100644 index 00000000..527387b3 --- /dev/null +++ b/tests/hlsl-return-implicit-conversion.shader_test @@ -0,0 +1,9 @@ +[pixel shader] +float4 main() : sv_target +{ + return float2x2(0.4, 0.3, 0.2, 0.1); +} + +[test] +draw quad +probe all rgba (0.4, 0.3, 0.2, 0.1) diff --git a/tests/hlsl-return-void.shader_test b/tests/hlsl-return-void.shader_test new file mode 100644 index 00000000..1948ec51 --- /dev/null +++ b/tests/hlsl-return-void.shader_test @@ -0,0 +1,11 @@ +[pixel shader] +void main(out float4 ret : sv_target) +{ + ret = float4(0.1, 0.2, 0.3, 0.4); + return; + ret = float4(0.5, 0.6, 0.7, 0.8); +} + +[test] +draw quad +probe all rgba (0.1, 0.2, 0.3, 0.4)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- Makefile.am | 2 ++ tests/hlsl-array-dimension.shader_test | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/hlsl-array-dimension.shader_test
diff --git a/Makefile.am b/Makefile.am index efe0c7cc..7911a8ea 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,6 +51,7 @@ vkd3d_shader_runners = \
vkd3d_shader_tests = \ tests/conditional.shader_test \ + tests/hlsl-array-dimension.shader_test \ tests/hlsl-comma.shader_test \ tests/hlsl-return-implicit-conversion.shader_test \ tests/hlsl-return-void.shader_test \ @@ -186,6 +187,7 @@ tests_vkd3d_shader_api_LDADD = libvkd3d-shader.la SHADER_TEST_LOG_COMPILER = tests/shader_runner_d3d12 XFAIL_TESTS = \ tests/conditional.shader_test \ + tests/hlsl-array-dimension.shader_test \ tests/hlsl-comma.shader_test \ tests/hlsl-return-implicit-conversion.shader_test \ tests/hlsl-return-void.shader_test \ diff --git a/tests/hlsl-array-dimension.shader_test b/tests/hlsl-array-dimension.shader_test new file mode 100644 index 00000000..fdb52b14 --- /dev/null +++ b/tests/hlsl-array-dimension.shader_test @@ -0,0 +1,16 @@ +# Test what kinds of expressions are valid array dimensions. +[pixel shader] +float4 main() : sv_target +{ + const int dim = 4; + float a[2 * 2] = {0.1, 0.2, 0.3, 0.4}; + float b[4.1] = a; + float c[dim] = b; + float d[true] = {c[0]}; + float e[65536]; + return float4(d[0], c[0], c[1], c[3]); +} + +[test] +draw quad +probe all rgba (0.1, 0.1, 0.2, 0.4)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- Makefile.am | 4 ++++ tests/hlsl-majority-pragma.shader_test | 21 +++++++++++++++++++++ tests/hlsl-majority-typedef.shader_test | 22 ++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 tests/hlsl-majority-pragma.shader_test create mode 100644 tests/hlsl-majority-typedef.shader_test
diff --git a/Makefile.am b/Makefile.am index 7911a8ea..415e6862 100644 --- a/Makefile.am +++ b/Makefile.am @@ -53,6 +53,8 @@ vkd3d_shader_tests = \ tests/conditional.shader_test \ tests/hlsl-array-dimension.shader_test \ tests/hlsl-comma.shader_test \ + tests/hlsl-majority-pragma.shader_test \ + tests/hlsl-majority-typedef.shader_test \ tests/hlsl-return-implicit-conversion.shader_test \ tests/hlsl-return-void.shader_test \ tests/hlsl-vector-indexing.shader_test \ @@ -189,6 +191,8 @@ XFAIL_TESTS = \ tests/conditional.shader_test \ tests/hlsl-array-dimension.shader_test \ tests/hlsl-comma.shader_test \ + tests/hlsl-majority-pragma.shader_test \ + tests/hlsl-majority-typedef.shader_test \ tests/hlsl-return-implicit-conversion.shader_test \ tests/hlsl-return-void.shader_test \ tests/hlsl-vector-indexing.shader_test \ diff --git a/tests/hlsl-majority-pragma.shader_test b/tests/hlsl-majority-pragma.shader_test new file mode 100644 index 00000000..e7fc75cd --- /dev/null +++ b/tests/hlsl-majority-pragma.shader_test @@ -0,0 +1,21 @@ +[pixel shader] +#pragma pack_matrix(row_major) +uniform float2x2 r; +#pragma pack_matrix(column_major) +uniform float2x2 c; + +float4 main() : sv_target +{ + float4 ret; + ret.xy = mul(r, float2(0.5, 0.6)); + ret.zw = mul(c, float2(0.5, 0.6)); + return ret; +} + +[test] +uniform 0 float4 0.1 0.2 0.0 0.0 +uniform 4 float4 0.3 0.4 0.0 0.0 +uniform 8 float4 0.1 0.3 0.0 0.0 +uniform 12 float4 0.2 0.4 0.0 0.0 +draw quad +probe all rgba (0.17, 0.39, 0.17, 0.39) 1 diff --git a/tests/hlsl-majority-typedef.shader_test b/tests/hlsl-majority-typedef.shader_test new file mode 100644 index 00000000..1460e9a0 --- /dev/null +++ b/tests/hlsl-majority-typedef.shader_test @@ -0,0 +1,22 @@ +[pixel shader] +typedef float2x2 matrix_t; +typedef row_major matrix_t row_matrix_t; +typedef column_major matrix_t col_matrix_t; +uniform row_matrix_t r; +uniform col_matrix_t c; + +float4 main() : sv_target +{ + float4 ret; + ret.xy = mul(r, float2(0.5, 0.6)); + ret.zw = mul(c, float2(0.5, 0.6)); + return ret; +} + +[test] +uniform 0 float4 0.1 0.2 0.0 0.0 +uniform 4 float4 0.3 0.4 0.0 0.0 +uniform 8 float4 0.1 0.3 0.0 0.0 +uniform 12 float4 0.2 0.4 0.0 0.0 +draw quad +probe all rgba (0.17, 0.39, 0.17, 0.39) 1
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com