Module: vkd3d
Branch: master
Commit: 721c7aa22c818c3f54a253fe1df7491f4f21d990
URL: https://gitlab.winehq.org/wine/vkd3d/-/commit/721c7aa22c818c3f54a253fe1df74…
Author: Zebediah Figura <zfigura(a)codeweavers.com>
Date: Tue Jan 31 18:49:38 2023 -0600
tests: Add more tests for function definitions.
---
tests/hlsl-function.shader_test | 61 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/tests/hlsl-function.shader_test b/tests/hlsl-function.shader_test
index e3ed5819..fa35963d 100644
--- a/tests/hlsl-function.shader_test
+++ b/tests/hlsl-function.shader_test
@@ -106,8 +106,39 @@ float4 main() : sv_target
return 0;
}
+% The function must have been at least declared before calling it. It may have
+% been declared with a different but compatible type, though.
+
+[pixel shader fail]
+
+float4 main() : sv_target
+{
+ func();
+ return 0;
+}
+
+void func()
+{
+}
+
+[pixel shader todo]
+
+void func();
+
+float4 main() : sv_target
+{
+ func();
+ return 0;
+}
+
+void func()
+{
+}
+
[pixel shader fail]
+void func(float arg);
+
float4 main() : sv_target
{
func();
@@ -120,6 +151,36 @@ void func()
[pixel shader todo]
+/* This is something of an internal test: we need to make sure that we use the
+ * correct variables for a function's arguments and returns regardless of
+ * whether it's been defined yet.
+ *
+ * Also, make sure that we can handle the case where the argument names differ.
+ */
+
+float2 concat(float x, float y);
+
+float2 func(void)
+{
+ return concat(0.1, 0.2);
+}
+
+float2 concat(float a, float b)
+{
+ return float2(a, b);
+}
+
+float4 main() : sv_target
+{
+ return float4(func(), concat(0.3, 0.4));
+}
+
+[test]
+todo draw quad
+todo probe all rgba (0.1, 0.2, 0.3, 0.4)
+
+[pixel shader todo]
+
float func(in float a, out float b, inout float c)
{
c -= 0.2;