summaryrefslogtreecommitdiff
path: root/examples/cpu-hello-world/shader.slang
blob: 6611962d76dbbf10e5a6dbd1396eacdff2593dba (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):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;
}