From 9212b0be24fc092a590eb34f1b47788cf2cebb61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Wed, 13 May 2026 09:51:59 -0400 Subject: [PATCH] Flip BGRA surface texture sampling --- third_party/gpui/src/platform/mac/shaders.metal | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/third_party/gpui/src/platform/mac/shaders.metal b/third_party/gpui/src/platform/mac/shaders.metal index c0e4dea..72ec83c 100644 --- a/third_party/gpui/src/platform/mac/shaders.metal +++ b/third_party/gpui/src/platform/mac/shaders.metal @@ -890,7 +890,11 @@ fragment float4 surface_bgra_fragment(SurfaceFragmentInput input [[stage_in]], texture2d bgra_texture [[texture(SurfaceInputIndex_YTexture)]]) { constexpr sampler texture_sampler(mag_filter::linear, min_filter::linear); - return bgra_texture.sample(texture_sampler, input.texture_position); + // Servo's CGL-backed IOSurfaces use the opposite framebuffer origin from + // GPUI's surface quad, so flip both texture axes for browser frames. + float2 texture_position = + float2(1.0 - input.texture_position.x, 1.0 - input.texture_position.y); + return bgra_texture.sample(texture_sampler, texture_position); } float4 hsla_to_rgba(Hsla hsla) {