summaryrefslogtreecommitdiffstats
path: root/tests/compute
diff options
context:
space:
mode:
authorAnders Leino <aleino@nvidia.com>2024-12-04 10:58:40 +0200
committerGitHub <noreply@github.com>2024-12-04 00:58:40 -0800
commit697045f1b4f7d0977c69fd5b67089d735fff428d (patch)
tree6fbd8b3242e088496187148d104442a452bf8fc1 /tests/compute
parent59ba2594dedac02ad2ef7bc049bd78f5412e1a92 (diff)
WGPU: Add new test and explanation for disabled test (#5731)
* Add buffer swizzle store test using structured buffers This helps to address #5612 * WGPU: Add explanation for tests/bugs/buffer-swizzle-store.slang This closes #5612. * Manual formatting fix * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'tests/compute')
-rw-r--r--tests/compute/structured-buffer-swizzle-store.slang27
-rw-r--r--tests/compute/structured-buffer-swizzle-store.slang.expected.txt1
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/compute/structured-buffer-swizzle-store.slang b/tests/compute/structured-buffer-swizzle-store.slang
new file mode 100644
index 000000000..7f07f0033
--- /dev/null
+++ b/tests/compute/structured-buffer-swizzle-store.slang
@@ -0,0 +1,27 @@
+//TEST(compute):COMPARE_COMPUTE: -shaderobj
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4),name=buf
+RWStructuredBuffer<float4> buf;
+
+//TEST_INPUT:ubuffer(data=[0], stride=4):out,name outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+[numthreads(1,1,1)]
+void computeMain()
+{
+ float sum = 0.0f;
+
+ buf[0].wxyz = float4(1.0, 0.0, 0.0, 0.0);
+ sum += buf[0].w;
+
+ buf[0].xwyz = float4(0.0, 1.0, 0.0, 0.0);
+ sum += buf[0].w;
+
+ buf[0].xywz = float4(0.0, 0.0, 1.0, 0.0);
+ sum += buf[0].w;
+
+ buf[0].xyzw = float4(0.0, 0.0, 0.0, 1.0);
+ sum += buf[0].w;
+
+ outputBuffer[0] = int(sum);
+}
diff --git a/tests/compute/structured-buffer-swizzle-store.slang.expected.txt b/tests/compute/structured-buffer-swizzle-store.slang.expected.txt
new file mode 100644
index 000000000..b8626c4cf
--- /dev/null
+++ b/tests/compute/structured-buffer-swizzle-store.slang.expected.txt
@@ -0,0 +1 @@
+4