yum-mirror/slang

Making it easier to work with shaders

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

Yong HeVarious gfx fixes. (#2132)d4145519d

master
586 B32 linesraw
1// sampler-array.slang
2
3// Test sampler array parameters.
4
5struct S1
6{
7    Texture2D tex[32];
8    SamplerState samplers[32];
9    float data;
10    float test(int i)
11    {
12        return tex[i].SampleLevel(samplers[i], float2(0.0, 0.0), 0.0).x + data;
13    }
14}
15
16struct S0
17{
18    float data;
19    RaytracingAccelerationStructure acc;
20    ParameterBlock<S1> s;
21}
22
23ParameterBlock<S0> g;
24RWStructuredBuffer<float> buffer;
25
26[shader("compute")]
27[numthreads(1,1,1)]
28void computeMain(
29    uint3 sv_dispatchThreadID : SV_DispatchThreadID)
30{
31    buffer[0] = g.data * g.s.test(sv_dispatchThreadID.x);
32}