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
633 B23 linesraw
1// image-load.slang
2
3// This test confirms that `.Load()` on a `RWTexure*`
4// gets properly converted to a call to `imageLoad`
5// and not just `texelFetch` as it would for a `Texture*`.
6
7//TEST:SIMPLE(filecheck=CHECK): -target spirv -entry main -stage compute -emit-spirv-directly
8//TEST:SIMPLE(filecheck=CHECK): -target spirv -entry main -stage compute
9
10struct Params
11{
12	RWTexture2DArray<float> tex;
13}
14
15ParameterBlock<Params> gParams;
16
17void main(uint3 tid : SV_DispatchThreadID)
18{
19    // CHECK: OpImageRead
20    // CHECK: OpImageWrite
21    float f = gParams.tex.Load(int3(int2(tid.xy), int(tid.z)));
22    gParams.tex[tid] = f + 1.0;
23}