yum-mirror/slang

Making it easier to work with shaders

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

Sami Kiminki (NVIDIA)8503 wgsl depth texture (#8645)5c672cef1

master
682 B25 linesraw
1//TEST:SIMPLE(filecheck=SPIRV): -target spirv
2//TEST:SIMPLE(filecheck=SPIRV): -target spirv -entry psMain -stage pixel
3
4// SPIRV: OpTypeImage %{{.*}} 2D 1 0 0 1 Unknown
5
6[[vk::binding(0, 0)]] DepthTexture2D depthTexture : register(t0);
7[[vk::binding(1, 0)]] SamplerComparisonState comparisonSampler : register(s0);
8
9[[shader("pixel")]]
10float4 psMain(
11    float4 position : SV_POSITION,
12    float2 texCoord : TEXCOORD0
13) : SV_TARGET {
14    float comparison = depthTexture.SampleCmp(
15        comparisonSampler,
16        texCoord,
17        0.5
18    );
19
20    if (comparison != 0.0) {
21        return float4(1.0, 1.0, 1.0, 1.0);
22    } else {
23        return float4(0.0, 0.0, 0.0, 1.0);
24    }
25}