yum-mirror/slang

Making it easier to work with shaders

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

skallweitNVRefactor shader cache (#2558)c2dc1a86e

master
826 B31 linesraw
1// shader-cache-multiple-entry-points.slang
2
3[shader("compute")]
4[numthreads(4, 1, 1)]
5void computeA(
6    uint3 sv_dispatchThreadID: SV_DispatchThreadID,
7    uniform RWStructuredBuffer<float> buffer)
8{
9    var input = buffer[sv_dispatchThreadID.x];
10    buffer[sv_dispatchThreadID.x] = input + 1.0f;
11}
12           
13[shader("compute")]
14[numthreads(4, 1, 1)]
15void computeB(
16    uint3 sv_dispatchThreadID: SV_DispatchThreadID,
17    uniform RWStructuredBuffer<float> buffer)
18{
19    var input = buffer[sv_dispatchThreadID.x];
20    buffer[sv_dispatchThreadID.x] = input + 2.0f;
21}
22
23[shader("compute")]
24[numthreads(4, 1, 1)]
25void computeC(
26    uint3 sv_dispatchThreadID: SV_DispatchThreadID,
27    uniform RWStructuredBuffer<float> buffer)
28{
29    var input = buffer[sv_dispatchThreadID.x];
30    buffer[sv_dispatchThreadID.x] = input + 3.0f;
31}