yum-mirror/slang

Making it easier to work with shaders

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

kaizhangNVFix issue of infinity float literal (#5489)0336a3a8d

master
777 B27 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
2//TEST(compute,vulkan):COMPARE_COMPUTE_EX:-vk -slang -compute -shaderobj
3//TEST(compute):COMPARE_COMPUTE_EX:-cpu -slang -compute -shaderobj
4//TEST(compute):COMPARE_COMPUTE_EX:-wgpu -slang -compute -shaderobj
5
6
7//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
8RWStructuredBuffer<float> outputBuffer;
9
10[numthreads(4, 1, 1)]
11void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
12{
13    int idx = int(dispatchThreadID.x);
14
15    float a;
16    
17    switch (idx)
18    {
19        default:
20        case 0:     a = 1.#INF; break;
21        case 1:     a = 2.4#INFf; break;
22        case 2:     a = float(234.5#INFl); break;
23        case 3:     a = -1.#INF; break;
24    }
25    
26    outputBuffer[idx] = a;
27}