summaryrefslogtreecommitdiffstats
path: root/tests/ir/loop-unroll-0.slang
blob: d97acac0eaa6bbf85dc7b9633611c6bc0ef6ba92 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj

//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<uint> outputBuffer;

[numthreads(1, 1, 1)]
void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
{
    int i = 0;
    [ForceUnroll]
    while (i < 5 && dispatchThreadID.x == 0)
    {
        if (i >= 3)
            break;
        outputBuffer[i] = i;
        i++;
    }
}