diff options
| author | ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> | 2024-06-24 09:16:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-24 09:16:28 -0400 |
| commit | cf8d1ceffcfbbb64734e6180a2c0cebd033f5b2e (patch) | |
| tree | 5ccbc854e3c363822d6e85c2fb5812d7c2572381 /tests | |
| parent | d349fd9e1f65fd32b2f4ea0e38c5084256d0dd04 (diff) | |
Implementing `tbuffer` layout(s) (#4436)
* Implementing `tbuffer` layouts.
1. Add to layout options 'TextureBuffer' layouts.
2. Add on to existing logic a way to allocate appropriate registers for TextureBufferType (this was made to work with parameter block logic).
3. Added asserts so objects missing a layout will gracefully crash
This means `tbuffer` now works for hlsl,glsl,metal targets, spirv has yet to implement logic for `TextureBufferType`.
* disable metal tests and fix emitting code a bit
fixing the emitting code means metal compilation emits a useful error (help point users/developers to #4435)
* fix warning
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/hlsl/tbuffer.slang | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/hlsl/tbuffer.slang b/tests/hlsl/tbuffer.slang new file mode 100644 index 000000000..a1bebf2e1 --- /dev/null +++ b/tests/hlsl/tbuffer.slang @@ -0,0 +1,40 @@ +//TEST:SIMPLE(filecheck=HLSL): -target hlsl -stage compute -entry computeMain +//TEST:SIMPLE(filecheck=GLSL): -target glsl -stage compute -entry computeMain + +// Metal backend requires a new legalization pass to support emitting `TextureBufferType` +//DISABLE_TEST:SIMPLE(filecheck=METAL): -target metal -stage compute -entry computeMain +//DISABLE_TEST:SIMPLE(filecheck=METALLIB): -target metallib -stage compute -entry computeMain + +// SPIRV backend has no support for emitting `TextureBufferType` +//DISABLE_TEST:SIMPLE(filecheck=SPIRV): -target spirv -stage compute -entry computeMain + +tbuffer tbuf : register(t0) +{ + float4 tb_val1; +} + +tbuffer tbuf2 : register(t1) +{ + Texture2D<float4> texture2D; + float4 tb_val2; +} + + +// HLSL-DAG: t0 +// HLSL-DAG: t1 +// HLSL-DAG: t2 + +// GLSL-DAG: binding = 0 +// GLSL-DAG: binding = 1 +// GLSL-DAG: binding = 2 + +// METAL-DAG: [texture(0)] +// METAL-DAG: [texture(1)] +// METAL-DAG: [texture(2)] +// METALLIB: @computeMain + +RWStructuredBuffer<float4> outputBuffer; +[numthreads(1,1,1)] +float4 computeMain() { + outputBuffer[0] = tb_val1 + texture2D[0] + tb_val2; +} |
