yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeSupport constant folding for static array access. (#5248)75481ea3b

master
412 B18 linesraw
1//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): 
2
3int check<int v>()
4{
5    return v;
6}
7
8//TEST_INPUT:ubuffer(data=[0], stride=4):out,name=outputBuffer
9RWStructuredBuffer<int> outputBuffer;
10
11[numthreads(1, 1, 1)]
12void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
13{
14    int tid = dispatchThreadID.x;
15    const int a[] = { 1, 2, 3, 4 };
16    // CHECK: 4
17    outputBuffer[tid] = check<a[3]>();
18}