Path: blob/a-new-beginning/Folium-iOS/Shaders/Grape.metal
2 views
//
// Grape.metal
// Folium-iOS
//
// Created by Jarrod Norwell on 13/10/2025.
//
#include <metal_stdlib>
using namespace metal;
struct Vertex {
float2 position [[attribute(0)]];
float2 texcoord [[attribute(1)]];
};
struct Varying {
float4 position [[position]];
float2 texcoord;
};
vertex Varying grape_vertex_main(const device Vertex *vertices [[buffer(0)]], uint vid [[vertex_id]]) {
Varying out;
out.position = float4(vertices[vid].position, 0.0, 1.0);
out.texcoord = vertices[vid].texcoord;
return out;
}
fragment float4 grape_fragment_main(Varying in [[stage_in]],
texture2d<half> tex [[texture(0)]],
sampler samp [[sampler(0)]]) {
constexpr sampler s(coord::normalized, address::clamp_to_edge, filter::nearest);
half4 c = tex.sample(s, in.texcoord);
return float4(c);
}