From cf9f1eb41f182965ce3d66465f54d113a1b2232b Mon Sep 17 00:00:00 2001 From: dfattal Date: Thu, 4 Jun 2026 23:45:30 -0700 Subject: [PATCH] fix(client/gl): don't toggle flip_y on window-space layers (#429) The GL client compositor blanket-toggled flip_y on every layer type, including window-space (HUD) layers. That toggle is correct for GL-rendered content (bottom-up framebuffer rows), but window-space HUD pixels are CPU-uploaded top-down (D2D/CG row order), so the shared texture already matches the D3D11 convention. In-process this went unnoticed: the GL native compositor bakes the top-down contract into its window-space shader and ignores flip_y. On the IPC/workspace path the D3D11 service honors flip_y as a V-flip, so GL clients' HUDs rendered upside down while projection stayed correct. Pass window-space layer data through unchanged. Verified upright both standalone (in-process GL) and under the shell (IPC -> D3D11 service) with cube_handle_gl_win. Fixes #429 Co-Authored-By: Claude Opus 4.8 (1M context) --- src/xrt/compositor/client/comp_gl_client.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/xrt/compositor/client/comp_gl_client.c b/src/xrt/compositor/client/comp_gl_client.c index 0f93a1dc9..778d195a0 100644 --- a/src/xrt/compositor/client/comp_gl_client.c +++ b/src/xrt/compositor/client/comp_gl_client.c @@ -399,10 +399,17 @@ client_gl_compositor_layer_window_space(struct xrt_compositor *xc, xscfb = to_native_swapchain(xsc); - struct xrt_layer_data d = *data; - d.flip_y = !d.flip_y; - - return xrt_comp_layer_window_space(xcn, xdev, xscfb, &d); + /* + * No flip_y toggle here, unlike the other layer types: the + * window-space contract is that HUD pixels are uploaded top-down + * (D2D/CG row order, image top at texel row 0) regardless of client + * API, so the shared texture already matches the D3D11/Vulkan + * convention. The in-process GL compositor bakes that assumption + * into its window-space shader (ignores flip_y), and the D3D11 + * service honors flip_y as a V-flip — toggling it here Y-flipped GL + * clients' HUDs on the IPC/workspace path (#429). + */ + return xrt_comp_layer_window_space(xcn, xdev, xscfb, data); } static xrt_result_t