Skip to content

Instantly share code, notes, and snippets.

@patskovn
Last active March 3, 2024 20:09
Show Gist options
  • Select an option

  • Save patskovn/8d3fd7bea263b1b06d0c95ecd152427d to your computer and use it in GitHub Desktop.

Select an option

Save patskovn/8d3fd7bea263b1b06d0c95ecd152427d to your computer and use it in GitHub Desktop.
struct VertexIn {
simd_float4 position;
simd_float4 color;
};
struct VertexOut {
simd_float4 position [[position]];
simd_float4 color;
};
vertex VertexOut vertex_main(uint vertexID [[vertex_id]],
constant VertexIn *vertices [[buffer(0)]]) {
VertexIn in = vertices[vertexID];
VertexOut out;
out.position = in.position;
out.color = in.color;
return out;
}
fragment float4 fragment_main(VertexOut in [[stage_in]]) {
return in.color;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment