yum-mirror/slang

Making it easier to work with shaders

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

Yong HeAdd API for whole program compilation. (#1562)94d3f2bd9

master
372 B16 linesraw
1// shader.slang
2
3//TEST_INPUT:ubuffer(random(float, 4096, -1.0, 1.0), stride=4):name=ioBuffer
4RWStructuredBuffer<float> ioBuffer;
5
6[shader("compute")]
7[numthreads(4, 1, 1)]
8void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
9{
10    uint tid = dispatchThreadID.x;
11
12    float i = ioBuffer[tid];
13    float o = i < 0.5 ? (i + i) : sqrt(i);
14
15    ioBuffer[tid] = o;
16}