diff options
| author | Darren Wihandi <65404740+fairywreath@users.noreply.github.com> | 2025-01-24 16:13:16 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-24 13:13:16 -0800 |
| commit | 0dd9076db2154d787f6e06b713721e877b746b83 (patch) | |
| tree | 24f75b2c612fc0ee5a3ba8157c4d0dde7ff9a3a0 /tests | |
| parent | 92c9fffb95c92b0bc07eb1c656375928b5cd5c33 (diff) | |
Add bgra8 format (#6163)
* add brga8 format
* add tests
* minor fixes
* cleanup
* maybe fix broken quad control test
* add missing xslang flag on test
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/diagnostics/image-format-unsupported-by-backend.slang | 19 | ||||
| -rw-r--r-- | tests/hlsl-intrinsic/quad-control/quad-control-comp-functionality.slang | 6 | ||||
| -rw-r--r-- | tests/wgsl/texture-storage.slang | 11 |
3 files changed, 35 insertions, 1 deletions
diff --git a/tests/diagnostics/image-format-unsupported-by-backend.slang b/tests/diagnostics/image-format-unsupported-by-backend.slang new file mode 100644 index 000000000..270c2b63e --- /dev/null +++ b/tests/diagnostics/image-format-unsupported-by-backend.slang @@ -0,0 +1,19 @@ +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK_SPIRV): -target spirv +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK_GLSL): -target glsl +//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK_WGSL): -target wgsl + +// CHECK_SPIRV: warning 31105{{.*}}bgra8 +// CHECK_GLSL: warning 31105{{.*}}bgra8 +[format("bgra8")] +RWTexture2D<float4> outputTexture; + +// CHECK_WGSL: warning 31105{{.*}}rg8 +[format("rg8")] +RWTexture2D<float4> outputTexture2; + +[numthreads(8, 8, 1)] +void main(uint3 threadID : SV_DispatchThreadID) +{ + outputTexture[threadID.xy] = float4(1.0, 1.0, 1.0, 1.0); + outputTexture2[threadID.xy] = float4(1.0, 1.0, 1.0, 1.0); +} diff --git a/tests/hlsl-intrinsic/quad-control/quad-control-comp-functionality.slang b/tests/hlsl-intrinsic/quad-control/quad-control-comp-functionality.slang index c8f82772d..01771f7a4 100644 --- a/tests/hlsl-intrinsic/quad-control/quad-control-comp-functionality.slang +++ b/tests/hlsl-intrinsic/quad-control/quad-control-comp-functionality.slang @@ -1,6 +1,6 @@ //TEST(compute):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -emit-spirv-directly //TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -profile cs_6_7 -dx12 -use-dxil -shaderobj -render-feature hardware-device -//TEST(compute):COMPARE_COMPUTE_EX:-metal -compute -shaderobj +//TEST(compute):COMPARE_COMPUTE_EX:-metal -compute -shaderobj -xslang -DMETAL //TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer RWStructuredBuffer<uint> outputBuffer; @@ -8,7 +8,11 @@ RWStructuredBuffer<uint> outputBuffer; [numthreads(16, 1, 1)] void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) { +#if !defined(METAL) + uint index = WaveGetLaneIndex(); +#else uint index = dispatchThreadID.x; +#endif if (index < 4) { diff --git a/tests/wgsl/texture-storage.slang b/tests/wgsl/texture-storage.slang index 1109dbfb1..62c8d13c8 100644 --- a/tests/wgsl/texture-storage.slang +++ b/tests/wgsl/texture-storage.slang @@ -28,6 +28,16 @@ RWStructuredBuffer<int> outputBuffer; [format("rgba8")] RWTexture3D<float4> w3D_f32v4; [format("rgba8")] RWTexture2DArray<float4> w2DArray_f32v4; +//TEST_INPUT: RWTexture1D(format=B8G8R8A8_UNORM, size=4, content = zero):name w1D_f32_bgra_v4 +//TEST_INPUT: RWTexture2D(format=B8G8R8A8_UNORM, size=4, content = zero):name w2D_f32_bgra_v4 +//TEST_INPUT: RWTexture3D(format=B8G8R8A8_UNORM, size=4, content = zero):name w3D_f32_bgra_v4 +//TEST_INPUT: RWTexture2D(format=B8G8R8A8_UNORM, size=4, content = zero, arrayLength=2):name w2DArray_f32_bgra_v4 +// WGSL: var w1D_f32_bgra_v4{{[^:]*}}: texture_storage_1d<bgra8unorm, read_write> +[format("bgra8")] RWTexture1D<float4> w1D_f32_bgra_v4; +[format("bgra8")] RWTexture2D<float4> w2D_f32_bgra_v4; +[format("bgra8")] RWTexture3D<float4> w3D_f32_bgra_v4; +[format("bgra8")] RWTexture2DArray<float4> w2DArray_f32_bgra_v4; + // i32 types //TEST_INPUT: RWTexture1D(format=R32G32_SINT, size=4, content = zero):name w1D_i32v2 @@ -127,6 +137,7 @@ void fragMain() bool result = true && TEST_textureStorage_StoreLoad<float2>(w1D_f32v2, w2D_f32v2, w3D_f32v2, w2DArray_f32v2) && TEST_textureStorage_StoreLoad<float4>(w1D_f32v4, w2D_f32v4, w3D_f32v4, w2DArray_f32v4) + && TEST_textureStorage_StoreLoad<float4>(w1D_f32_bgra_v4, w2D_f32_bgra_v4, w3D_f32_bgra_v4, w2DArray_f32_bgra_v4) && TEST_textureStorage_StoreLoad<int32_t2>(w1D_i32v2, w2D_i32v2, w3D_i32v2, w2DArray_i32v2) && TEST_textureStorage_StoreLoad<int32_t4>(w1D_i32v4, w2D_i32v4, w3D_i32v4, w2DArray_i32v4) && TEST_textureStorage_StoreLoad<uint32_t2>(w1D_u32v2, w2D_u32v2, w3D_u32v2, w2DArray_u32v2) |
