yum-mirror/slang

Making it easier to work with shaders

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

Yong HeAdd Loop Unrolling Pass. (#2644)4dbc74a95

master
498 B19 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
2//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj
3
4//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
5RWStructuredBuffer<uint> outputBuffer;
6
7[numthreads(1, 1, 1)]
8void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
9{
10    int i = 0;
11    [ForceUnroll]
12    while (i < 5 && dispatchThreadID.x == 0)
13    {
14        if (i >= 3)
15            break;
16        outputBuffer[i] = i;
17        i++;
18    }
19}