yum-mirror/slang

Making it easier to work with shaders

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

Yong HeType legalization and autodiff bug fixes. (#2722)259a015fe

master
768 B28 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type
2//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type
3//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj -output-using-type
4//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj -output-using-type
5
6//TEST_INPUT:ubuffer(data=[0], stride=4):out,name outputBuffer
7RWStructuredBuffer<float> outputBuffer;
8
9void test(inout float v, int i)
10{
11    while (true)
12    {
13        i--;
14        if (i < 2)
15        {
16            v += 1.0;
17            return;
18        }
19    }
20}
21
22[numthreads(4, 1, 1)]
23void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
24{
25    float v = 2.0;
26    test(v, 3);
27    outputBuffer[0] = v; // Expect 3.0
28}