Break everything :D

This commit is contained in:
Isaac Marovitz
2024-05-18 18:54:55 -04:00
committed by Evan Husted
parent 96d884a15b
commit c7b6e4cf80
15 changed files with 885 additions and 542 deletions

View File

@@ -0,0 +1,39 @@
#include <metal_stdlib>
using namespace metal;
// ------------------
// Simple Blit Shader
// ------------------
constant float2 quadVertices[] = {
float2(-1, -1),
float2(-1, 1),
float2( 1, 1),
float2(-1, -1),
float2( 1, 1),
float2( 1, -1)
};
struct CopyVertexOut {
float4 position [[position]];
float2 uv;
};
vertex CopyVertexOut vertexMain(unsigned short vid [[vertex_id]]) {
float2 position = quadVertices[vid];
CopyVertexOut out;
out.position = float4(position, 0, 1);
out.position.y = -out.position.y;
out.uv = position * 0.5f + 0.5f;
return out;
}
fragment float4 fragmentMain(CopyVertexOut in [[stage_in]],
texture2d<float, access::sample> texture [[texture(0)]],
sampler sampler [[sampler(0)]]) {
return texture.sample(sampler, in.uv);
}