#include using namespace metal; struct VertexOut { float4 position [[position]]; float2 texCoord; }; vertex VertexOut vertex_main(uint vertexID [[vertex_id]]) { float2 pos[] = { {-1.0, -1.0}, { 1.0, -1.0}, {-1.0, 1.0}, { 1.0, 1.0}, }; float2 uv[] = { {0.0, 1.0}, {1.0, 1.0}, {0.0, 0.0}, {1.0, 0.0}, }; VertexOut out; out.position = float4(pos[vertexID], 0.0, 1.0); out.texCoord = uv[vertexID]; return out; } fragment float4 fragment_main(VertexOut in [[stage_in]], texture2d tex [[texture(0)]]) { constexpr sampler s(filter::linear); return pow(tex.sample(s, in.texCoord), 0.45f); }