summaryrefslogtreecommitdiff
path: root/examples/cpu-hello-world/shader.slang
blob: bac5832a8db98a91b9e1e0e4702eb35b485385e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// shader.slang

//TEST_INPUT:ubuffer(random(float, 4096, -1.0, 1.0), stride=4):dxbinding(0),glbinding(0),name=ioBuffer
RWStructuredBuffer<float> ioBuffer;

[numthreads(4, 1, 1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
    uint tid = dispatchThreadID.x;

    float i = ioBuffer[tid];
    float o = i < 0.5 ? (i + i) : sqrt(i);

    ioBuffer[tid] = o;
}