Skip to content

Commit

Permalink
WGPU: Add new test and explanation for disabled test (shader-slang#5731)
Browse files Browse the repository at this point in the history
* Add buffer swizzle store test using structured buffers

This helps to address shader-slang#5612

* WGPU: Add explanation for tests/bugs/buffer-swizzle-store.slang

This closes shader-slang#5612.

* Manual formatting fix

* format code

---------

Co-authored-by: slangbot <[email protected]>
  • Loading branch information
aleino-nv and slangbot authored Dec 4, 2024
1 parent 59ba259 commit 697045f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/bugs/buffer-swizzle-store.slang
Original file line number Diff line number Diff line change
@@ -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
Expand Down
27 changes: 27 additions & 0 deletions tests/compute/structured-buffer-swizzle-store.slang
Original file line number Diff line number Diff line change
@@ -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);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4

0 comments on commit 697045f

Please sign in to comment.