diff options
Diffstat (limited to 'tests/compute')
| -rw-r--r-- | tests/compute/dump-repro.slang | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/compute/dump-repro.slang b/tests/compute/dump-repro.slang new file mode 100644 index 000000000..eebe04852 --- /dev/null +++ b/tests/compute/dump-repro.slang @@ -0,0 +1,31 @@ +//TEST(compute):SIMPLE:-target hlsl -dump-repro repro.slang-repro + +//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):dxbinding(0),glbinding(0),out,name outputBuffer +RWStructuredBuffer<int> outputBuffer; + +//TEST_INPUT:array(size=2):name g_aoa +RWStructuredBuffer<int> g_aoa[]; + +//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4):name=g_aoa[0] +//TEST_INPUT:ubuffer(data=[8 17 34], stride=4):name=g_aoa[1] + +[numthreads(8, 1, 1)] +void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID) +{ + int index = int(dispatchThreadID.x); + + int baseIndex = index >> 2; + int innerIndex = index & 3; + + RWStructuredBuffer<int> buffer = g_aoa[baseIndex]; + + // Get the size + uint bufferCount, bufferStride; + buffer.GetDimensions(bufferCount, bufferStride); + + if (innerIndex >= bufferCount) + { + innerIndex = bufferCount - 1; + } + outputBuffer[index] = buffer[innerIndex]; +}
\ No newline at end of file |
