-
-
Save rmirabelli/ee99a6073a80ce493bebf337bbd46ef1 to your computer and use it in GitHub Desktop.
A shader library right in the playground source -- you can replace these shaders to experiment more!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create a shader library in source (not precompiled) | |
let runtimeLibrary = try device?.makeLibrary(source: """ | |
#include <metal_stdlib> | |
using namespace metal; | |
vertex float4 copy_vertex( | |
const device packed_float3* vertex_array [[buffer(0)]], | |
unsigned int vid [[vertex_id]]) { | |
return float4(vertex_array[vid], 1.0); | |
} | |
fragment half4 constant_color() { | |
return half4(0.75,0.95,0.35,1.0); | |
} | |
""", options: nil) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment