fix(multi): macOS shared-surface content draws through the _SRGB atlas view (#1801) - #1802
Merged
Merged
Conversation
…s view (#1801) The macOS service composites each client with comp_multi_content_blend, sampling it as its DECLARED format, but drew into the encoded atlas through its UNORM framebuffer. An _SRGB client (the ADR-044 recommended choice) was hardware-decoded and stored raw, one decode too dark. The content pass now takes the target #1795 resolved for the decorations: the atlas's _SRGB view (or an _SRGB atlas). The focus-glow style colour is display-referred and is decoded on the CPU before it reaches an encoding target (new u_color_srgb_decode, for constants only). DXR_COLOR_LEGACY_UNORM_ENCODED=1 keeps the old UNORM target. Measured on the pre-weave atlas (macOS arm64, sim_display, cube_handle_vk_macos in the workspace): - _SRGB client: brightest-px luminance 61 -> 120; the static floor grid is (13,13,25), matching the UNORM passthrough reference (13,13,26) - legacy hatch: 65, unchanged - shell chrome bytes unchanged Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1801.
Problem
On the macOS service's shared surface, every app that declares an
_SRGBcolour swapchain is drawn one sRGB decode too dark.render_shared_surface_locked()samples each client as its declared format (so_SRGBis hardware-decoded to linear), then draws into the encodedB8G8R8A8_UNORMatlas through its UNORM framebuffer. Nothing re-encodes.Fix
shared_resolve_deco_target): the atlas's_SRGBview, or the atlas itself when it is_SRGB. Content and decorations are now on one rule.u_color_srgb_decode, constants only, next to the encode oracle).DXR_COLOR_LEGACY_UNORM_ENCODED=1keeps the old UNORM target, byte for byte.macOS only: the function is inside
#ifdef XRT_OS_MACOS. The Android and Linux service flavours are untouched and remain unaudited.Behaviour change, per the contract: a UNORM client on this surface is now read as linear and encoded, the same as vk_native. An app that writes display-referred bytes into UNORM looks washed out here too, and the fix for that is app-side (ADR-044 §2).
Verification (pre-weave atlas, macOS arm64, sim_display,
cube_handle_vk_macosin the workspace, shell-pvtmainwith #122)The atlas was dumped with a local, uncommitted readback after the decoration pass.
_SRGBclient_SRGBclient_SRGBclientDXR_SWAPCHAIN_ENCODING=unorm)The gap between 120 and 131 comes from the cube rotating between captures. The grid is static, and it matches the reference.
The shell chrome bytes (title pill, text, close button, backdrop) are identical to the #1795 captures.
Tests:
tests_aux_color_encoding: decode → encode round-trips all 256 bytes.tests_comp_color_policy: new pin that the content pass resolves its target and never begins on the bare UNORM framebuffer. Mutation-checked: reverting the begin call fails it.Not done
os_mutex_lockassert incommon_shutdownon a client thread. Crash reports exist from before this change.🤖 Generated with Claude Code