yum-mirror/slang

Making it easier to work with shaders

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

Yong HeWarning on lossy implicit casts. (#2367)adaea0e99

master
770 B26 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj
2//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
3//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj
4//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj
5//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj
6
7//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
8RWStructuredBuffer<int> outputBuffer;
9
10[numthreads(4, 1, 1)]
11void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
12{
13    uint idx = dispatchThreadID.x;
14    
15    uint ti = 0;
16    
17    ti += max(2, idx);
18    ti += min(idx, 1);
19    ti += (idx * 3) %5;
20    
21    ti += clamp(idx * 10, 11, 23);
22    
23    ti += countbits(idx * 13);
24    
25    outputBuffer[idx] = int(ti); 
26}