summaryrefslogtreecommitdiffstats
path: root/tests/hlsl-intrinsic/texture/gather-texture2darray.slang
blob: 785305a2213e2793353f184b4c5ea1d8dbc0fd08 (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
// gather-texture2darray.slang

//TEST:SIMPLE(filecheck=SPIRV): -target spirv -entry main -stage compute -emit-spirv-directly
//TEST:SIMPLE(filecheck=DXIL): -target dxil -profile sm_6_1 -entry main -stage compute
//TEST:SIMPLE(filecheck=SPIRV): -target spirv -entry main -stage compute

// Test gathering from a `Texture2DArray`

Texture2DArray<uint> t;
Texture2DArray<float4> t1;
SamplerState s;
RWBuffer<uint4> b;

[shader("compute")]
[numthreads(32, 1, 1)]
void main(uint3 tid : SV_DispatchThreadID)
{
    // DXIL: @dx.op.textureGather.i32
    // DXIL: @dx.op.textureGather.f32

    // SPIRV: OpImageGather
    // SPIRV: OpImageGather

    b[tid.x] = t.Gather(s, tid);

    b[tid.x] += uint4(t1.Gather(s, tid));
}