Flip BGRA surface texture sampling

This commit is contained in:
2026-05-13 09:51:59 -04:00
parent 8238526cc1
commit 9212b0be24
+5 -1
View File
@@ -890,7 +890,11 @@ fragment float4 surface_bgra_fragment(SurfaceFragmentInput input [[stage_in]],
texture2d<float> 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) {