Module: vkd3d Branch: master Commit: 653b109d8f44dfc7287b5389d95a04c9bc732e21 URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/653b109d8f44dfc7287b5389d95a04...
Author: Francisco Casas fcasas@codeweavers.com Date: Wed Oct 12 12:39:06 2022 -0300
tests: Test implicit casts between types that are equal component-wise.
---
Makefile.am | 1 + tests/cast-componentwise-equal.shader_test | 226 +++++++++++++++++++++++++++++ 2 files changed, 227 insertions(+)
diff --git a/Makefile.am b/Makefile.am index a0cd584f..83f75d64 100644 --- a/Makefile.am +++ b/Makefile.am @@ -58,6 +58,7 @@ vkd3d_shader_tests = \ tests/arithmetic-uint.shader_test \ tests/bitwise.shader_test \ tests/cast-broadcast.shader_test \ + tests/cast-componentwise-equal.shader_test \ tests/cast-to-float.shader_test \ tests/cast-to-half.shader_test \ tests/cast-to-int.shader_test \ diff --git a/tests/cast-componentwise-equal.shader_test b/tests/cast-componentwise-equal.shader_test new file mode 100644 index 00000000..ac329112 --- /dev/null +++ b/tests/cast-componentwise-equal.shader_test @@ -0,0 +1,226 @@ +[pixel shader fail] +struct apple +{ + float3 aa; + float bb; +}; + +float4 main() : sv_target +{ + float4 f = {1, 2, 3, 4}; + struct apple a; + + a = f; + return a.aa.xyzx; +} + + +[pixel shader fail] +struct apple +{ + float aa; + float bb; +}; + +float4 main() : sv_target +{ + struct apple a = {1, 2}; + float2 f; + + f = a; + return f.xyxy; +} + + +[pixel shader] +struct apple +{ + float3 aa; + float bb; +}; + +float4 main() : sv_target +{ + float f[4] = {1, 2, 3, 4}; + struct apple a; + + a = f; + return a.aa.xyzx; +} + + +[test] +todo draw quad +todo probe all rgba (1.0, 2.0, 3.0, 1.0) + + +[pixel shader fail] +struct apple +{ + float3 aa; + int bb; +}; + +float4 main() : sv_target +{ + float f[4] = {1, 2, 3, 4}; + struct apple a; + + a = f; + return a.aa.xyzx; +} + + +[pixel shader] +struct apple +{ + float3 aa; + float bb; +}; + +float4 main() : sv_target +{ + struct apple a = {5, 6, 7, 8}; + float f[4]; + + f = a; + return float4(f); +} + + +[test] +todo draw quad +todo probe all rgba (5.0, 6.0, 7.0, 8.0) + + +[pixel shader] +Texture2D tex; + +struct apple +{ + int2 aa; + Texture2D bb; + float cc; +}; + +struct banana +{ + int aa[2]; + Texture2D bb; + float cc; +}; + +float4 main() : sv_target +{ + struct apple a = {1, 2, tex, 4}; + struct banana b; + + b = a; + return b.cc; +} + +[test] +todo draw quad +todo probe all rgba (4.0, 4.0, 4.0, 4.0) + + +[pixel shader] +Texture2D tex; + +struct apple +{ + int2 aa; + Texture2D bb; + float cc; +}; + +struct banana +{ + int aa[2]; + Texture2D bb; + float cc; +}; + +float4 fun(struct banana b) +{ + return b.cc; +} + +float4 main() : sv_target +{ + struct apple a = {1, 2, tex, 5}; + + return fun(a); +} + +[test] +todo draw quad +todo probe all rgba (5.0, 5.0, 5.0, 5.0) + + +[pixel shader] +struct apple +{ + float3 xx[2]; + int4 yy; +}; + +struct banana +{ + struct apple apples[2]; + int3 bb[2]; + int4 cc[3]; +}; + +struct cherry +{ + int2 xx; + int yy[3]; +}; + +struct donut +{ + float4 aa; + float2 bb; + int cc[4]; + float dd[6]; + struct cherry cherries[4]; + int2 ee; +}; + +float4 main() : sv_target +{ + struct banana b = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37}; + struct donut d; + + d = b; + return d.aa + d.cherries[3].yy[2] + d.ee.xyxx; +} + +[test] +todo draw quad +todo probe all rgba (71.0, 73.0, 73.0, 74.0) + + +[pixel shader fail] +struct apple +{ + float3 aa; + int bb; +}; + +struct banana +{ + float3 aa; + float bb; +}; + +float4 main() : sv_target +{ + struct apple a = {1, 2, 3, 4}; + struct banana b; + + b = a; + return b.bb; +}