yum-mirror/slang

Making it easier to work with shaders

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

Yong HeUnify stdlib `Texture` types into one generic type. (#3327)4c78efd0c

master
717 B27 linesraw
1// gather-texture2darray.slang
2
3//TEST:SIMPLE(filecheck=SPIRV): -target spirv -entry main -stage compute -emit-spirv-directly
4//TEST:SIMPLE(filecheck=DXIL): -target dxil -profile sm_6_1 -entry main -stage compute
5//TEST:SIMPLE(filecheck=SPIRV): -target spirv -entry main -stage compute
6
7// Test gathering from a `Texture2DArray`
8
9Texture2DArray<uint> t;
10Texture2DArray<float4> t1;
11SamplerState s;
12RWBuffer<uint4> b;
13
14[shader("compute")]
15[numthreads(32, 1, 1)]
16void main(uint3 tid : SV_DispatchThreadID)
17{
18    // DXIL: @dx.op.textureGather.i32
19    // DXIL: @dx.op.textureGather.f32
20
21    // SPIRV: OpImageGather
22    // SPIRV: OpImageGather
23
24    b[tid.x] = t.Gather(s, tid);
25
26    b[tid.x] += uint4(t1.Gather(s, tid));
27}