From 697045f1b4f7d0977c69fd5b67089d735fff428d Mon Sep 17 00:00:00 2001 From: Anders Leino Date: Wed, 4 Dec 2024 10:58:40 +0200 Subject: [PATCH] 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> --- tests/bugs/buffer-swizzle-store.slang | 2 +- .../structured-buffer-swizzle-store.slang | 27 +++++++++++++++++++ ...ed-buffer-swizzle-store.slang.expected.txt | 1 + 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/compute/structured-buffer-swizzle-store.slang create mode 100644 tests/compute/structured-buffer-swizzle-store.slang.expected.txt diff --git a/tests/bugs/buffer-swizzle-store.slang b/tests/bugs/buffer-swizzle-store.slang index 6fdcc4df39..33e8a8ab9b 100644 --- a/tests/bugs/buffer-swizzle-store.slang +++ b/tests/bugs/buffer-swizzle-store.slang @@ -1,7 +1,7 @@ //TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type //TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type //TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl -output-using-type -// Slang-RHI/WGPU: Invalid bind group layout entry used #5612 +// Not supported in WGSL: read-write storage texture with "rg16f" format //DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-wgpu //TEST_INPUT: RWTexture2D(format=R16G16_FLOAT, size=4, content = one, mipMaps = 1):name g_test diff --git a/tests/compute/structured-buffer-swizzle-store.slang b/tests/compute/structured-buffer-swizzle-store.slang new file mode 100644 index 0000000000..7f07f00331 --- /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 buf; + +//TEST_INPUT:ubuffer(data=[0], stride=4):out,name outputBuffer +RWStructuredBuffer 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 0000000000..b8626c4cff --- /dev/null +++ b/tests/compute/structured-buffer-swizzle-store.slang.expected.txt @@ -0,0 +1 @@ +4