summaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorDarren Wihandi <65404740+fairywreath@users.noreply.github.com>2025-04-14 14:48:17 -0600
committerGitHub <noreply@github.com>2025-04-14 14:48:17 -0600
commit705d00ab8528e0d7c14f68b7d0e15fb57280c16e (patch)
treeacf6e024ef803c5a49e2c6c0075ab0d9a49a11d3 /tests/bugs
parentd6f4780e8a608fa37597116d5b0ac5c80034c2aa (diff)
Fix matrix division by scalar for Metal and WGSL targets (#6752)
* Fix matrix division by scalar for Metal and WGSL targets * Add tests * Minor fix * Fix compilation error * Convert to multiplication for WGSL * Minor cleanup --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/matrix-divided-by-scalar.slang21
1 files changed, 21 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];
+}
+