-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathShaders.metal
More file actions
38 lines (29 loc) · 936 Bytes
/
Shaders.metal
File metadata and controls
38 lines (29 loc) · 936 Bytes
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
//
// Shaders.metal
// AudioLabSwift
//
// Created by Eric Larson
// Copyright © 2020 Eric Larson. All rights reserved.
//
// started with shader code from the following very helpful repository:
// https://github.com/RedQueenCoder/Metal-Learning-Projects/blob/master/2DDrawing/Star/Star/GameViewController.swift
#include <metal_stdlib>
using namespace metal;
struct VertexInOut
{
float4 position [[position]];
float4 color;
};
vertex VertexInOut passThroughVertex(uint vid [[ vertex_id ]],
constant packed_float4* position [[ buffer(0) ]],
constant packed_float4* color [[ buffer(1) ]])
{
VertexInOut outVertex;
outVertex.position = position[vid];
outVertex.color = color[vid];
return outVertex;
};
fragment half4 passThroughFragment(VertexInOut inFrag [[stage_in]])
{
return half4(inFrag.color);
};