diff options
| author | Yong He <yonghe@outlook.com> | 2024-10-09 17:15:20 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-09 17:15:20 -0700 |
| commit | 75481ea3b0654eeb727cabc718258984e7753e02 (patch) | |
| tree | 4d2e56517d1413ca45c4038049035fd971ac903d /tests/language-feature | |
| parent | b8aab84e2c4c3e6d91d75ffcebfcc2f6e84da01c (diff) | |
Support constant folding for static array access. (#5248)
* Support constant folding for static array access.
* Fix test.
Diffstat (limited to 'tests/language-feature')
| -rw-r--r-- | tests/language-feature/constants/static-array-indexing.slang | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/language-feature/constants/static-array-indexing.slang b/tests/language-feature/constants/static-array-indexing.slang new file mode 100644 index 000000000..0a7963b34 --- /dev/null +++ b/tests/language-feature/constants/static-array-indexing.slang @@ -0,0 +1,18 @@ +//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): + +int check<int v>() +{ + return v; +} + +//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer +RWStructuredBuffer<int> outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) +{ + int tid = dispatchThreadID.x; + const int a[] = { 1, 2, 3, 4 }; + // CHECK: 4 + outputBuffer[tid] = check<a[3]>(); +} |
