1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <metal_stdlib>
using namespace metal;
struct Uniforms {
float4x4 mvp;
};
struct VertexInput {
float3 position [[attribute(0)]];
float2 uv [[attribute(1)]];
};
struct Interpolated {
float4 position [[position]];
float2 uv [[user(locn0)]];
float3 normal [[user(locn1)]];
};
struct Interpolated_In {
float2 uv [[user(locn0)]];
float3 normal [[user(locn1)]];
};
struct FragmentOutput {
float4 color [[user(locn0)]];
};
vertex Interpolated_In vs_main(VertexInput input [[stage_in]],
constant Uniforms& uniforms [[buffer(0)]]) {
Interpolated_In __luma_output;
float4 clip_pos = (uniforms.mvp * float4(input.position, 1.0));
__luma_output.position = clip_pos;
__luma_output.uv = input.uv;
__luma_output.normal = float3(0.0, 1.0, 0.0);
return __luma_output;
}
fragment FragmentOutput fs_main(Interpolated_In input [[stage_in]]) {
FragmentOutput __luma_output;
__luma_output.color = float4(input.uv, 0.0, 1.0);
return __luma_output;
}