Debian Codegraph @

third_party/spirv-cross/reference/shaders-msl/frag/sample-depth-propagate-state-from-resource.frag

raw
1 #pragma clang diagnostic ignored "-Wmissing-prototypes"
2
3 #include <metal_stdlib>
4 #include <simd/simd.h>
5
6 using namespace metal;
7
8 struct main0_out
9 {
10 float FragColor [[color(0)]];
11 };
12
13 struct main0_in
14 {
15 float3 vUV [[user(locn0)]];
16 };
17
18 static inline __attribute__((always_inline))
19 float sample_normal2(thread const depth2d<float> tex, thread sampler uSampler, thread float3& vUV)
20 {
21 return float4(tex.sample(uSampler, vUV.xy)).x;
22 }
23
24 static inline __attribute__((always_inline))
25 float sample_normal(thread const depth2d<float> tex, thread sampler uSampler, thread float3& vUV)
26 {
27 return sample_normal2(tex, uSampler, vUV);
28 }
29
30 static inline __attribute__((always_inline))
31 float sample_comp(thread const depth2d<float> tex, thread float3& vUV, thread sampler uSamplerShadow)
32 {
33 return tex.sample_compare(uSamplerShadow, vUV.xy, vUV.z);
34 }
35
36 fragment main0_out main0(main0_in in [[stage_in]], depth2d<float> uTexture [[texture(0)]], sampler uSampler [[sampler(0)]], sampler uSamplerShadow [[sampler(1)]])
37 {
38 main0_out out = {};
39 out.FragColor = sample_normal(uTexture, uSampler, in.vUV);
40 out.FragColor += sample_comp(uTexture, in.vUV, uSamplerShadow);
41 return out;
42 }
43