yum-mirror/slang

Making it easier to work with shaders

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

Darren WihandiAdd SampleCmpLevel intrinsics (#6004)2249d6ffb

master
894 B19 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-via-glsl -entry computeMain -profile glsl_450 -stage compute
2//DISABLED_TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly -entry computeMain -profile glsl_450 -stage compute
3
4Texture2DArray t2dArray;
5RWStructuredBuffer<float4> result;
6SamplerComparisonState s;
7
8// CHECK: OpSourceExtension "GL_EXT_texture_shadow_lod"
9// CHECK: %{{[0-9]*}} = OpImageSampleDrefExplicitLod %float %{{[0-9]*}} %{{[0-9]*}} %{{[0-9]*}} Lod|ConstOffset %float_0 %{{[0-9]*}}
10// CHECK: %{{[0-9]*}} = OpImageSampleDrefExplicitLod %float %{{[0-9]*}} %{{[0-9]*}} %{{[0-9]*}} Lod|ConstOffset %float_1_5 %{{[0-9]*}}
11
12[numthreads(1,1,1)]
13void computeMain()
14{
15    result[0] = t2dArray.SampleCmpLevelZero(s, float3(1, 2, 3), 0.5, int2(0, 0));
16
17    float level = 1.5;
18    result[1] = t2dArray.SampleCmpLevel(s, float3(1, 2, 3), 0.5, level, int2(0, 0));
19}