summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/matrix-mult.glsl28
-rw-r--r--tests/cross-compile/matrix-mult.slang14
-rw-r--r--tests/cross-compile/matrix-mult.slang.glsl25
3 files changed, 67 insertions, 0 deletions
diff --git a/tests/bugs/matrix-mult.glsl b/tests/bugs/matrix-mult.glsl
new file mode 100644
index 000000000..b427dee14
--- /dev/null
+++ b/tests/bugs/matrix-mult.glsl
@@ -0,0 +1,28 @@
+//TEST:COMPARE_GLSL:-profile glsl_fragment_450 -no-checking
+// matrix-mult.glsl
+#version 450
+
+// Confirm that we don't exchange the operands
+// to a matrix-vector multiply when we recognize
+// one in "raw" GLSL code.
+
+#ifdef __SLANG__
+__import empty;
+#endif
+
+layout(binding = 0)
+uniform C
+{
+ mat4x4 m;
+};
+
+layout(location = 0)
+in vec4 v;
+
+layout(location = 0)
+out vec4 r;
+
+void main()
+{
+ r = m * v;
+}
diff --git a/tests/cross-compile/matrix-mult.slang b/tests/cross-compile/matrix-mult.slang
new file mode 100644
index 000000000..180a806e2
--- /dev/null
+++ b/tests/cross-compile/matrix-mult.slang
@@ -0,0 +1,14 @@
+//TEST:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly
+
+// Confirm that order of arguments to matrix-vector
+// multiplication gets reversed when generating GLSL.
+
+cbuffer C
+{
+ float4x3 m;
+};
+
+float4 main(float3 v) : SV_Target
+{
+ return mul(m, v);
+}
diff --git a/tests/cross-compile/matrix-mult.slang.glsl b/tests/cross-compile/matrix-mult.slang.glsl
new file mode 100644
index 000000000..0349d854e
--- /dev/null
+++ b/tests/cross-compile/matrix-mult.slang.glsl
@@ -0,0 +1,25 @@
+//TEST_IGNORE_FILE:
+
+layout(binding = 0)
+uniform C
+{
+ mat4x3 m;
+};
+
+vec4 main_(vec3 v)
+{
+ return v * m;
+}
+
+layout(location = 0)
+in vec3 SLANG_in_v;
+
+layout(location = 0)
+out vec4 SLANG_out_main_result;
+
+void main()
+{
+ vec3 v = SLANG_in_v;
+ vec4 main_result = main_(v);
+ SLANG_out_main_result = main_result;
+}