summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-11-06 10:58:09 -0800
committerGitHub <noreply@github.com>2024-11-06 10:58:09 -0800
commitb86703432629bbfd75a902671d15e40c591065a7 (patch)
tree2109f87304fa534034f01812551f29be098c4710 /tests
parentf8294202ce8d5658f6308eeaed634058db9bbb4b (diff)
[WGSL] Enable arbitrary arrays in uniform buffers. (#5497)
* [WGSL] Enable arbitrary arrays in uniform buffers. * format code * Undo irrelevant change and fixups. * Update expected failure list. * Fix. * Rename. --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/compute/non-square-row-major.slang3
-rw-r--r--tests/expected-failure-github.txt1
-rw-r--r--tests/wgsl/uniform-array-2.slang23
-rw-r--r--tests/wgsl/uniform-array.slang21
4 files changed, 45 insertions, 3 deletions
diff --git a/tests/compute/non-square-row-major.slang b/tests/compute/non-square-row-major.slang
index 20f6ec139..50c2185ac 100644
--- a/tests/compute/non-square-row-major.slang
+++ b/tests/compute/non-square-row-major.slang
@@ -3,14 +3,13 @@
// Note! This test doesn't work on CUDA or CPU targets, because both these targets
// assume matrices are tightly packed, whereas GPU targets align rows to 16 bytes.
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=ALIGNED):-slang -compute -wgpu -output-using-type -xslang -matrix-layout-row-major -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=PACKED):-cpu -compute -output-using-type -compile-arg -O3 -xslang -matrix-layout-row-major -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=ALIGNED):-slang -compute -output-using-type -xslang -matrix-layout-row-major -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=ALIGNED):-slang -compute -dx12 -output-using-type -xslang -matrix-layout-row-major -shaderobj
//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=ALIGNED):-vk -compute -output-using-type -xslang -matrix-layout-row-major -shaderobj
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=PACKED):-cuda -compute -output-using-type -xslang -matrix-layout-row-major -shaderobj
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=PACKED): -slang -output-using-type -shaderobj -mtl
-//DISABLE_TEST(compute):COMPARE_COMPUTE:-wgpu
-
// matrix<R, C>
//TEST_INPUT:cbuffer(data=[1.0 2.0 3.0 4.0 5.0 6.0 0.0 0.0 10.0 20.0 0.0 0.0 ]):name matrixBuffer
diff --git a/tests/expected-failure-github.txt b/tests/expected-failure-github.txt
index dfb99eb35..f2ddf35a0 100644
--- a/tests/expected-failure-github.txt
+++ b/tests/expected-failure-github.txt
@@ -55,7 +55,6 @@ tests/compute/interface-shader-param-in-struct.slang.4 syn (wgpu)
tests/compute/interface-shader-param.slang.5 syn (wgpu)
tests/compute/kernel-context-threading.slang.6 syn (wgpu)
tests/compute/loop-unroll.slang.7 syn (wgpu)
-tests/compute/non-square-row-major.slang.6 syn (wgpu)
tests/compute/parameter-block (wgpu)
tests/compute/texture-get-dimensions (wgpu)
tests/compute/texture-sampling (wgpu)
diff --git a/tests/wgsl/uniform-array-2.slang b/tests/wgsl/uniform-array-2.slang
new file mode 100644
index 000000000..10cf39990
--- /dev/null
+++ b/tests/wgsl/uniform-array-2.slang
@@ -0,0 +1,23 @@
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-slang -compute -wgpu -output-using-type
+
+struct Params{
+ int2 data[2];
+ int scalarData[2];
+}
+
+//TEST_INPUT:set params = cbuffer(data=[0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15])
+ConstantBuffer<Params> params;
+
+//TEST_INPUT:set outputBuffer = out ubuffer(data=[0 0 0 0], stride=4)
+RWStructuredBuffer<float> outputBuffer;
+
+float helper(float2 v)
+{return v.y;}
+
+[numthreads(1,1,1)]
+void computeMain()
+{
+ // CHECK: 17
+ outputBuffer[0] = helper(params.data[1]) + params.scalarData[1];
+}
+
diff --git a/tests/wgsl/uniform-array.slang b/tests/wgsl/uniform-array.slang
new file mode 100644
index 000000000..5956f6755
--- /dev/null
+++ b/tests/wgsl/uniform-array.slang
@@ -0,0 +1,21 @@
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-slang -compute -wgpu -output-using-type
+
+struct MyPoint { int x; int y; int type; }
+
+struct Params{
+ MyPoint data[2];
+}
+
+//TEST_INPUT:set params = cbuffer(data=[0 1 2 3 4 5 6 7 8 9 10 11])
+ConstantBuffer<Params> params;
+
+//TEST_INPUT:set outputBuffer = out ubuffer(data=[0 0 0 0], stride=4)
+RWStructuredBuffer<float> outputBuffer;
+
+[numthreads(1,1,1)]
+void computeMain()
+{
+ // CHECK: 5
+ outputBuffer[0] = params.data[1].y;
+}
+