Preserve sRGB midtones on the SDR UNORM swapchain fallback #2001

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

@⁠lgr123 on GitHub · 2026-11-25 17:55 UTC · original
lgr123:lgr123/present-srgb-unorm-fallback → main · +202 −15 · 2 files · 1 commits · open

Claimed as RT-PRESENT-SRGB-UNORM-FALLBACK.

On the RTX 5070, restricting surface formats to the driver's advertised SDR UNORM formats made the native presenter turn synthetic grey bytes 128/188 into 55/128. The swapchain still used nonlinear sRGB, so these linearized bytes darkened midtones. The default sRGB swapchain and composed controls preserved 128/188.

Copy encoded bytes for matching format layouts at 1:1. For scaling or channel reordering, keep the existing filtered blit through a reusable matching sRGB image before copying the encoded bytes to the UNORM swapchain. This also works for transfer-only source images. If the intermediate cannot be created, keep presenting through the previous blit and emit a warning.

Reviewer check

Run ctest -R ^xbox_present$ --output-on-failure from the configured Windows runtime build. The synthetic surface-format test forces SDR UNORM and checks RGBA/BGRA at 1:1 and with crop/scale. No game files required.

Tested

  • Windows, NVIDIA RTX 5070, driver 621.24. The aligned public main build at b9320a1 passed xbox_present (1 of 1).
  • A separate production-presenter matrix confirmed the default native sRGB path, forced UNORM, direct and intermediary transfer-only paths, filtered midpoints, compositor, repeated scaled frames and the injected allocation-failure warning.
  • The display did not offer ST.2084. The routine HDR10 swapchain case skipped, and SDR tone-map and PQ encoder tests ran.
  • Source-only check and git diff --check passed.

GPUs tested: NVIDIA RTX 5070, driver 621.24, Windows.

AI-assisted: yes.

Checklist

  • Based on public main.
  • One topic.
  • No game data, keys or protection workarounds.
**@⁠lgr123** on GitHub · 2026-11-25 17:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2001) `lgr123:lgr123/present-srgb-unorm-fallback` → `main` · +202 −15 · 2 files · 1 commits · open Claimed as [RT-PRESENT-SRGB-UNORM-FALLBACK](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608). On the RTX 5070, restricting surface formats to the driver's advertised SDR UNORM formats made the native presenter turn synthetic grey bytes **128/188 into 55/128**. The swapchain still used nonlinear sRGB, so these linearized bytes darkened midtones. The default sRGB swapchain and composed controls preserved **128/188**. Copy encoded bytes for matching format layouts at 1:1. For scaling or channel reordering, keep the existing filtered blit through a reusable matching sRGB image before copying the encoded bytes to the UNORM swapchain. This also works for transfer-only source images. If the intermediate cannot be created, keep presenting through the previous blit and emit a warning. ### Reviewer check Run `ctest -R ^xbox_present$ --output-on-failure` from the configured Windows runtime build. The synthetic surface-format test forces SDR UNORM and checks RGBA/BGRA at 1:1 and with crop/scale. No game files required. ### Tested - Windows, NVIDIA RTX 5070, driver 621.24. The aligned public main build at `b9320a1` passed `xbox_present` (1 of 1). - A separate production-presenter matrix confirmed the default native sRGB path, forced UNORM, direct and intermediary transfer-only paths, filtered midpoints, compositor, repeated scaled frames and the injected allocation-failure warning. - The display did not offer ST.2084. The routine HDR10 swapchain case skipped, and SDR tone-map and PQ encoder tests ran. - Source-only check and `git diff --check` passed. GPUs tested: NVIDIA RTX 5070, driver 621.24, Windows. AI-assisted: yes. ### Checklist - [x] Based on public main. - [x] One topic. - [x] No game data, keys or protection workarounds.
Copy encoded bytes at one-to-one size when channel order matches. For scaled or differently ordered sources, blit into a compatible sRGB image before copying the encoded result to the swapchain. Keep presentation with a warning if the staging image is unavailable.

Cover forced SDR UNORM through the Xbox presentation test on Windows with an NVIDIA RTX 5070. No game data was used. AI-assisted with OpenAI Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:14:22 +00:00
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/2001/head:github-bot/gh-2001'
git switch 'github-bot/gh-2001'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2001'
git switch 'github-bot/gh-2001'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2001'
git switch 'github-bot/gh-2001'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2001'
git switch 'main'
git merge --squash 'github-bot/gh-2001'
git switch 'main'
git merge --ff-only 'github-bot/gh-2001'
git switch 'main'
git merge 'github-bot/gh-2001'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.