From: Francisco Casas fcasas@codeweavers.com
Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- Francisco, I did a couple of minor changes: * in the patch subject, "Textures" -> "textures" * added a 1 ULP tolerance in one test, to have it accepted on my machine
Notice that, after a patch by Zeb, on master you don't need to mark the probe directive as todo if the draw directive is todo too. --- Makefile.am | 1 + tests/hlsl-initializer-objects.shader_test | 109 +++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 tests/hlsl-initializer-objects.shader_test
diff --git a/Makefile.am b/Makefile.am index 2742e77c..dd3ce1ff 100644 --- a/Makefile.am +++ b/Makefile.am @@ -79,6 +79,7 @@ vkd3d_shader_tests = \ tests/hlsl-initializer-invalid-arg-count.shader_test \ tests/hlsl-initializer-implicit-array.shader_test \ tests/hlsl-initializer-local-array.shader_test \ + tests/hlsl-initializer-objects.shader_test \ tests/hlsl-initializer-nested.shader_test \ tests/hlsl-initializer-numeric.shader_test \ tests/hlsl-initializer-matrix.shader_test \ diff --git a/tests/hlsl-initializer-objects.shader_test b/tests/hlsl-initializer-objects.shader_test new file mode 100644 index 00000000..2306d07f --- /dev/null +++ b/tests/hlsl-initializer-objects.shader_test @@ -0,0 +1,109 @@ +[require] +shader model >= 4.0 + +[texture 0] +size (3, 3) +0.1 0.1 0.1 0.1 0.2 0.2 0.2 0.2 0.3 0.3 0.3 0.3 +0.4 0.4 0.4 0.4 0.5 0.5 0.5 0.5 0.6 0.6 0.6 0.6 +0.7 0.7 0.7 0.7 0.8 0.8 0.8 0.8 0.9 0.9 0.9 0.9 + +[texture 1] +size (2, 2) +0.1 0.1 0.1 0.0 0.2 0.2 0.2 0.0 +0.4 0.4 0.4 0.0 0.5 0.5 0.5 0.0 + + +[pixel shader] +Texture2D tex1; +Texture2D tex2; + +float4 main() : sv_target +{ + Texture2D q[2] = {tex1, tex2}; + + return q[0].Load(int3(0, 0, 0)) + q[1].Load(int3(0, 0, 0)); +} + +[test] +todo draw quad +todo probe all rgba (0.2, 0.2, 0.2, 0.1) + + +[pixel shader] +Texture2D tex; + +struct foo +{ + float2 aa; + Texture2D bb; + Texture2D cc; + float4 dd; +}; + +float4 main() : sv_target +{ + struct foo q = {10, 20, tex, tex, 30, 40, 50, 60}; + + return q.bb.Load(int3(2, 0, 0)) + q.cc.Load(int3(1, 2, 0)) + q.dd; +} + +[test] +todo draw quad +todo probe all rgba (31.1, 41.1, 51.1, 61.1) 1 + + +[pixel shader] +Texture2D tex1; +Texture2D tex2; + +struct foo +{ + float2 aa; + Texture2D bb[2]; // NOTE: this cannot be initialized in shader model >= 5.1 + float4 cc; +}; + +float4 main() : sv_target +{ + struct foo q = {10, 20, tex1, tex2, 30, 40, 50, 60}; + + return q.bb[0].Load(int3(0, 0, 0)) + q.bb[1].Load(int3(1, 1, 0)) + q.cc; +} + + +[pixel shader fail todo] +Texture2D tex; + +struct foo +{ + float2 aa; + Texture2D bb; + Texture2D cc; + float4 dd; +}; + +float4 main() : sv_target +{ + struct foo q = {10, 20, tex, 30, 40, 50, 60}; + + return 0.0; +} + + +[pixel shader fail todo] +Texture2D tex; + +struct foo +{ + float2 aa; + Texture2D bb; + Texture2D cc; + float4 dd; +}; + +float4 main() : sv_target +{ + struct foo q = {10, 20, tex, tex, tex, 30, 40, 50, 60}; + + return 0.0; +}