yum-mirror/slang

Making it easier to work with shaders

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

Pankaj MistryFix nonuniform decoration on direct-to-spirv backend path. (#3338) (#3417)b6da04424

master
600 B27 linesraw
1// vk-texture-indexing.slang
2
3//TEST:SIMPLE(filecheck=CHECK):-target spirv -entry main -stage fragment
4//TEST:SIMPLE(filecheck=CHECK):-target spirv -entry main -stage fragment -emit-spirv-directly
5
6struct Params
7{
8    Texture2D<float> textures[10];
9    SamplerState sampler;
10};
11
12ParameterBlock<Params> gParams;
13
14float fetchData(uint2 coords, uint index)
15{
16    return gParams.textures[NonUniformResourceIndex(index)][coords];
17}
18
19float4 main(
20	uint3 uv : UV)
21    : SV_Target
22{
23    // CHECK: OpDecorate %{{.*}} NonUniform
24    // CHECK: OpImageFetch
25    float v = fetchData(uv.xy, uv.z);
26    return v;
27}