GPU capture: decode XR-biased RGB before image scaling #2516

Open
github-bot wants to merge 1 commit from github-bot/gh-2516 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 15:10 UTC · original
andrewpozdnakov7-jpg:codex2/capture-xr-bias → main · +22 −2 · 1 files · 1 commits · open

Capture diagnostics already unpack R10G10B10_XR_BIAS_A2_UNORM as 10:10:10:2 after #372. They still use the raw RGB codes when scaling the image, so the code for black is interpreted as a positive color.

Decode RGB with the XR conversion (channel - 384) / 510 before the existing capture scaling. The other 10:10:10:2 formats keep their original interpretation.

The same synthetic format-89 pixel with all three channels at code 384 produced white on 940d32f and black with the fix. The [894, 639, 384] control produces [255, 127, 0] in the diagnostic image. All three capture tests, strict GPU diagnostics Clippy, and staged asset policy passed on Windows.

Microsoft XR conversion rules · Coordination claim

Please retain the Git author when cherry-picking or rebasing. If you fold the change into another commit, please add Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

AI-assisted with Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 15:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/2516) `andrewpozdnakov7-jpg:codex2/capture-xr-bias` → `main` · +22 −2 · 1 files · 1 commits · open Capture diagnostics already unpack `R10G10B10_XR_BIAS_A2_UNORM` as 10:10:10:2 after #372. They still use the raw RGB codes when scaling the image, so the code for black is interpreted as a positive color. Decode RGB with the XR conversion `(channel - 384) / 510` before the existing capture scaling. The other 10:10:10:2 formats keep their original interpretation. The same synthetic format-89 pixel with all three channels at code `384` produced white on `940d32f` and black with the fix. The `[894, 639, 384]` control produces `[255, 127, 0]` in the diagnostic image. All three capture tests, strict GPU diagnostics Clippy, and staged asset policy passed on Windows. [Microsoft XR conversion rules](https://learn.microsoft.com/en-us/windows-hardware/drivers/display/xr-bias-color-channel-conversion-rules) · [Coordination claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633) Please retain the Git author when cherry-picking or rebasing. If you fold the change into another commit, please add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`. AI-assisted with Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:08:01 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:56 UTC · original

Automated triage for the maintainers. Merge candidate: in crates/victory-gpu/src/capture.rs, to_rgba now decodes R10G10B10_XR_BIAS_A2 (format 89) channels as (code - 384) / 510 before scaling, and leaves the other 10:10:10:2 formats alone. On main, colour formats scale from low = 0, so the raw code 384 that means black showed up as a bright colour. The conversion matches the public XR-bias rules linked in the PR, and the change only touches diagnostic captures. CI (check) passes.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2516#issuecomment-7167449335) <!-- victory-triage v1 head=c9f7f75ac70fd774c78426e95cd399b743e8590e verdict=merge-candidate at=2026-11-25T15:56:23Z --> Automated triage for the maintainers. Merge candidate: in `crates/victory-gpu/src/capture.rs`, `to_rgba` now decodes `R10G10B10_XR_BIAS_A2` (format 89) channels as `(code - 384) / 510` before scaling, and leaves the other 10:10:10:2 formats alone. On main, colour formats scale from `low = 0`, so the raw code 384 that means black showed up as a bright colour. The conversion matches the public XR-bias rules linked in the PR, and the change only touches diagnostic captures. CI (`check`) passes. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 00:52 UTC · original

Code review and RTX 5090 + WARP verification at head c9f7f75ac70f merged cleanly onto main (63bcca43c6a0):

  • Code review (crates/victory-gpu/src/capture.rs:659-668, 699-725):
    • Decoding format 89 (DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM) via (channel - 384.0) / 510.0 before scaling matches the DXGI spec (384 -> 0.0, 894 -> 1.0, [-0.752941, +1.252941]) while leaving 23..=25 untouched.
    • Downstream scaling (low = 0.0, high = p99 of non-zero abs, .clamp(0.0, 1.0)) cleanly clamps negative extended values < 384 to 0 and avoids division by zero on all-negative images; verified the updated green-channel expectation (50) matches ((511-384)/510) / ((1023-384)/510) * 255.
  • Verified (Windows 11, NVIDIA RTX 5090 + WARP, VICTORY_D3D12_DEBUG=1, Rust 1.98.1):
    • cargo xtask policy: 191 files ok; cargo clippy -p victory-gpu --all-targets --locked -- -D warnings (default + --features diagnostics): 0 warnings
    • victory-gpu --lib --features diagnostics capture: 12/12 passed on both RTX 5090 and WARP (including xr_bias_targets_decode_black_and_extended_range_channels).

LGTM.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 00:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/2516#issuecomment-7179204876) Code review and RTX 5090 + WARP verification at head `c9f7f75ac70f` merged cleanly onto `main` (`63bcca43c6a0`): - **Code review (`crates/victory-gpu/src/capture.rs:659-668, 699-725`)**: - Decoding format `89` (`DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM`) via `(channel - 384.0) / 510.0` before scaling matches the DXGI spec (`384 -> 0.0`, `894 -> 1.0`, `[-0.752941, +1.252941]`) while leaving `23..=25` untouched. - Downstream scaling (`low = 0.0`, `high = p99` of non-zero `abs`, `.clamp(0.0, 1.0)`) cleanly clamps negative extended values `< 384` to `0` and avoids division by zero on all-negative images; verified the updated green-channel expectation (`50`) matches `((511-384)/510) / ((1023-384)/510) * 255`. - **Verified (Windows 11, NVIDIA RTX 5090 + WARP, `VICTORY_D3D12_DEBUG=1`, Rust 1.98.1)**: - `cargo xtask policy`: `191 files ok`; `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` (default + `--features diagnostics`): 0 warnings - `victory-gpu --lib --features diagnostics capture`: **12/12 passed** on both RTX 5090 and WARP (including `xr_bias_targets_decode_black_and_extended_range_channels`). LGTM.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2516/head:github-bot/gh-2516'
git switch 'github-bot/gh-2516'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2516'
git switch 'github-bot/gh-2516'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2516'
git switch 'github-bot/gh-2516'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2516'
git switch 'main'
git merge --squash 'github-bot/gh-2516'
git switch 'main'
git merge --ff-only 'github-bot/gh-2516'
git switch 'main'
git merge 'github-bot/gh-2516'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2516
No description provided.