summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/matrix-divided-by-scalar.slang21
-rw-r--r--tests/diagnostics/division-by-matrix.slang15
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/bugs/matrix-divided-by-scalar.slang b/tests/bugs/matrix-divided-by-scalar.slang
new file mode 100644
index 000000000..27c23e501
--- /dev/null
+++ b/tests/bugs/matrix-divided-by-scalar.slang
@@ -0,0 +1,21 @@
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -compute -entry computeMain -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-metal -compute -entry computeMain -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-wgpu -compute -entry computeMain -output-using-type
+
+//TEST_INPUT:ubuffer(data=[3.5], stride=4):name inputBuffer
+StructuredBuffer<float> inputBuffer;
+
+//TEST_INPUT:ubuffer(data=[0 0], stride=4):out,name outputBuffer
+RWStructuredBuffer<float> outputBuffer;
+
+[shader("compute")]
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ // CHECK: 6.0
+ outputBuffer[0] = (float3x3(15.0) / 2.5)[0][0];
+
+ // CHECK: 4.0
+ outputBuffer[1] = (float4x4(14.0) / inputBuffer[0])[0][0];
+}
+
diff --git a/tests/diagnostics/division-by-matrix.slang b/tests/diagnostics/division-by-matrix.slang
new file mode 100644
index 000000000..6ed78d353
--- /dev/null
+++ b/tests/diagnostics/division-by-matrix.slang
@@ -0,0 +1,15 @@
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target metal
+//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target wgsl
+
+RWStructuredBuffer<float> outputBuffer;
+
+[shader("compute")]
+[numthreads(1, 1, 1)]
+void computeMain()
+{
+ // CHECK: error 56102: division by matrix is not supported
+ float3x3 divisor = float3x3(2.5);
+ divisor[1][1] = 1.5;
+ outputBuffer[0] = (float3x3(15) / divisor)[0][0];
+}
+