summaryrefslogtreecommitdiffstats
path: root/tools/gfx-unit-test/sampler-array.slang
blob: 1439f6cdd1ce679f7dbbce18d516580aab74ab99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// sampler-array.slang

// Test sampler array parameters.

struct S1
{
    Texture2D tex[32];
    SamplerState samplers[32];
    float data;
    float test(int i)
    {
        return tex[i].SampleLevel(samplers[i], float2(0.0, 0.0), 0.0).x + data;
    }
}

struct S0
{
    float data;
    RaytracingAccelerationStructure acc;
    ParameterBlock<S1> s;
}

ParameterBlock<S0> g;
RWStructuredBuffer<float> buffer;

[shader("compute")]
[numthreads(1,1,1)]
void computeMain(
    uint3 sv_dispatchThreadID : SV_DispatchThreadID)
{
    buffer[0] = g.data * g.s.test(sv_dispatchThreadID.x);
}