summaryrefslogtreecommitdiffstats
path: root/tests/language-feature
diff options
context:
space:
mode:
Diffstat (limited to 'tests/language-feature')
-rw-r--r--tests/language-feature/0-array-1.slang12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/language-feature/0-array-1.slang b/tests/language-feature/0-array-1.slang
index 327f71444..b02be1af0 100644
--- a/tests/language-feature/0-array-1.slang
+++ b/tests/language-feature/0-array-1.slang
@@ -10,7 +10,7 @@ uniform MyData* myData;
uniform int * output;
[numthreads(1, 1, 1)]
-void computeMain()
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
// These are all ill-formed, but we want to still ensure our backend
// can handle them gracefully without crashing.
@@ -18,9 +18,13 @@ void computeMain()
// by a `if` statement that checks the size before accessing.
// The condition would then evaluate to false and causing all the accessing
// code to be optimized out.
- InterlockedAdd(myData.a[0][0][0], 1);
- myData.a[0][0][0] += 1;
- output[0] = myData.a[0][0][0];
+
+ // Use runtime values to access the 0-sized array to avoid triggering
+ // the new out-of-bounds diagnostic for constant indices
+ uint runtimeIndex = dispatchThreadID.x;
+ InterlockedAdd(myData.a[runtimeIndex][runtimeIndex][runtimeIndex], 1);
+ myData.a[runtimeIndex][runtimeIndex][runtimeIndex] += 1;
+ output[0] = myData.a[runtimeIndex][runtimeIndex][runtimeIndex];
}
//SPV: OpEntryPoint