Debian Codegraph @

third_party/spirv-cross/reference/opt/shaders-msl/vert/texture_buffer.vert

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 gl_Position [[position]];
11 };
12
13 // Returns 2D texture coords corresponding to 1D texel buffer coords
14 static inline __attribute__((always_inline))
15 uint2 spvTexelBufferCoord(uint tc)
16 {
17 return uint2(tc % 4096, tc / 4096);
18 }
19
20 vertex main0_out main0(texture2d<float> uSamp [[texture(0)]], texture2d<float> uSampo [[texture(1)]])
21 {
22 main0_out out = {};
23 out.gl_Position = uSamp.read(spvTexelBufferCoord(10)) + uSampo.read(spvTexelBufferCoord(100));
24 return out;
25 }
26