metal-examples-tutorials/ch04/chapter04/Shaders.metal

25 lines
484 B
Metal

//
// Shaders.metal
// chapter04
//
// Created by Marius on 1/26/16.
// Copyright © 2016 Marius Horga. All rights reserved.
//
#include <metal_stdlib>
using namespace metal;
struct Vertex {
float4 position [[position]];
float4 color;
};
vertex Vertex vertex_func(constant Vertex *vertices [[buffer(0)]],
uint vid [[vertex_id]]) {
return vertices[vid];
}
fragment float4 fragment_func(Vertex vert [[stage_in]]) {
return vert.color;
}