Debian Codegraph @

third_party/spirv-cross/reference/shaders-msl/frag/helper-invocation.msl21.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 float4 FragColor [[color(0)]];
11 };
12
13 struct main0_in
14 {
15 float2 vUV [[user(locn0)]];
16 };
17
18 static inline __attribute__((always_inline))
19 float4 foo(thread bool& gl_HelperInvocation, thread texture2d<float> uSampler, thread const sampler uSamplerSmplr, thread float2& vUV)
20 {
21 float4 color;
22 if (!gl_HelperInvocation)
23 {
24 color = uSampler.sample(uSamplerSmplr, vUV, level(0.0));
25 }
26 else
27 {
28 color = float4(1.0);
29 }
30 return color;
31 }
32
33 fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]])
34 {
35 main0_out out = {};
36 bool gl_HelperInvocation = simd_is_helper_thread();
37 out.FragColor = foo(gl_HelperInvocation, uSampler, uSamplerSmplr, in.vUV);
38 return out;
39 }
40