Zebediah Figura : tests: Add some simple tests for HLSL function calls.
Alexandre Julliard
julliard at winehq.org
Thu Feb 24 15:28:55 CST 2022
Module: vkd3d
Branch: master
Commit: cdd7f3d3627e43db1ae12e4c330adf138925c88d
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=cdd7f3d3627e43db1ae12e4c330adf138925c88d
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Thu Feb 24 15:06:13 2022 +0100
tests: Add some simple tests for HLSL function calls.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
Makefile.am | 2 +
tests/hlsl-function.shader_test | 164 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 166 insertions(+)
diff --git a/Makefile.am b/Makefile.am
index 2425706..57cf578 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -65,6 +65,7 @@ vkd3d_shader_tests = \
tests/hlsl-cross.shader_test \
tests/hlsl-duplicate-modifiers.shader_test \
tests/hlsl-for.shader_test \
+ tests/hlsl-function.shader_test \
tests/hlsl-function-overload.shader_test \
tests/hlsl-gather-offset.shader_test \
tests/hlsl-gather.shader_test \
@@ -316,6 +317,7 @@ XFAIL_TESTS = \
tests/hlsl-bool-cast.shader_test \
tests/hlsl-duplicate-modifiers.shader_test \
tests/hlsl-for.shader_test \
+ tests/hlsl-function.shader_test \
tests/hlsl-function-overload.shader_test \
tests/hlsl-gather.shader_test \
tests/hlsl-intrinsic-override.shader_test \
diff --git a/tests/hlsl-function.shader_test b/tests/hlsl-function.shader_test
new file mode 100644
index 0000000..8d17605
--- /dev/null
+++ b/tests/hlsl-function.shader_test
@@ -0,0 +1,164 @@
+[pixel shader fail]
+
+float4 func();
+
+float4 main() : sv_target
+{
+ return func();
+}
+
+% It's legal to call an undefined function in unused code, though.
+
+[pixel shader]
+
+float4 func();
+
+float4 unused()
+{
+ return func();
+}
+
+float4 main() : sv_target
+{
+ return 0;
+}
+
+[pixel shader fail]
+
+void func(inout float o)
+{
+ o += 0.1;
+}
+
+float4 main() : sv_target
+{
+ float x = 0;
+ func(x + 1);
+ return 0;
+}
+
+[pixel shader fail]
+
+void func(inout float2 o)
+{
+ o += 0.1;
+}
+
+float4 main() : sv_target
+{
+ float2 x = 0;
+ func(x.yy);
+ return 0;
+}
+
+[pixel shader fail]
+
+void func(out float o)
+{
+ o = 0.1;
+}
+
+float4 main() : sv_target
+{
+ const float x = 0;
+ func(x);
+ return x;
+}
+
+[pixel shader fail]
+
+void func(inout float o)
+{
+}
+
+float4 main() : sv_target
+{
+ const float x = 0;
+ func(x);
+ return x;
+}
+
+[pixel shader fail]
+
+void func()
+{
+}
+
+float4 main() : sv_target
+{
+ return func();
+}
+
+[pixel shader fail]
+
+void foo()
+{
+}
+
+void bar()
+{
+ return foo();
+}
+
+float4 main() : sv_target
+{
+ bar();
+ return 0;
+}
+
+[pixel shader fail]
+
+float4 main() : sv_target
+{
+ func();
+ return 0;
+}
+
+void func()
+{
+}
+
+[pixel shader]
+
+float func(in float a, out float b, inout float c)
+{
+ c -= 0.2;
+ b = a * 2;
+ return a + 0.2;
+}
+
+float4 main() : sv_target
+{
+ float x[2], ret;
+
+ x[0] = 0.1;
+ x[1] = 0.9;
+ ret = func(0.3, x[0], x[1]);
+
+ return float4(ret, x[0], x[1], 0);
+}
+
+[test]
+draw quad
+probe all rgba (0.5, 0.6, 0.7, 0)
+
+[pixel shader]
+
+void func(in float a, inout float2 b)
+{
+ b.y += 0.1;
+ b *= a;
+}
+
+float4 main() : sv_target
+{
+ float3 q = float3(0.1, 0.2, 0.3);
+
+ func(3.0, q.zx);
+ func(0.5, q.yz);
+ return float4(q, 0);
+}
+
+[test]
+draw quad
+probe all rgba (0.6, 0.1, 0.5, 0)
More information about the wine-cvs
mailing list