From cd12d88994e4f6be4898732682035f2a1b7d8e9a Mon Sep 17 00:00:00 2001 From: Samuliak <samuliak77@gmail.com> Date: Tue, 2 Jul 2024 16:58:29 +0200 Subject: [PATCH] flip y positions --- src/host_shaders/metal_shaders.metal | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/host_shaders/metal_shaders.metal b/src/host_shaders/metal_shaders.metal index 580e9d9c..fcb28ddd 100644 --- a/src/host_shaders/metal_shaders.metal +++ b/src/host_shaders/metal_shaders.metal @@ -10,6 +10,7 @@ vertex DisplayVertexOut vertexDisplay(uint vid [[vertex_id]]) { DisplayVertexOut out; out.uv = float2((vid << 1) & 2, vid & 2); out.position = float4(out.uv * 2.0f + -1.0f, 0.0f, 1.0f); + out.position.y = -out.position.y; return out; } @@ -86,6 +87,8 @@ vertex DrawVertexOut vertexDraw(DrawVertexIn in [[stage_in]], constant PicaRegs& out.position = in.position; // HACK: rotate the position out.position.xy = -out.position.yx; + // Flip the y position + out.position.y = -out.position.y; // in.position.z is in range of [-1 ... 1], convert it to [0 ... 1] out.position.z = (in.position.z + 1.0) * 0.5;