diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-10-11 14:14:08 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-10-11 14:14:08 -0400 |
| commit | 9c17d0be79834a8ebe2888aed8905bae355cb674 (patch) | |
| tree | f0ebf7d256f43af686f63c6375f2a53bd12dc1a3 /tests | |
| parent | deeb8647012fc6362f1bb33842cf0842e16f13b7 (diff) | |
Support for unbounded array of arrays (#1078)
* WIP: Unsized arrays on CPU.
* unbounded-array-of-array working on CPU.
* Remove some left over comments.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/compute/unbounded-array-of-array.slang | 35 | ||||
| -rw-r--r-- | tests/compute/unbounded-array-of-array.slang.expected.txt | 8 |
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/compute/unbounded-array-of-array.slang b/tests/compute/unbounded-array-of-array.slang new file mode 100644 index 000000000..760740282 --- /dev/null +++ b/tests/compute/unbounded-array-of-array.slang @@ -0,0 +1,35 @@ +//DISABLE_TEST:CPU_REFLECTION: -profile cs_5_0 -entry computeMain -target cpp +//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute + +struct IntAoa { RWStructuredBuffer<int> array[]; } + +//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.array +ParameterBlock<IntAoa> g_aoa; + +//TEST_INPUT:ubuffer(data=[1 2 3 4], stride=4):name=g_aoa.array[0] +//TEST_INPUT:ubuffer(data=[8 17 34], stride=4):name=g_aoa.array[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.array[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 diff --git a/tests/compute/unbounded-array-of-array.slang.expected.txt b/tests/compute/unbounded-array-of-array.slang.expected.txt new file mode 100644 index 000000000..aeec8496c --- /dev/null +++ b/tests/compute/unbounded-array-of-array.slang.expected.txt @@ -0,0 +1,8 @@ +1 +2 +3 +4 +8 +11 +22 +22 |
