[PR #2014] Treat BGRX overlays as opaque in PresentX composition #2023

Open
opened 2026-11-26 21:19:46 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2014
Author: @lgr123
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: lgr123/present-bgrx-opaque-plane


📝 Commits (1)

  • 71d41e4 Treat BGRX PresentX overlays as opaque

📊 Changes

6 files changed (+40 additions, -7 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+3 -0)
📝 runtime/shims/d3d12_com.h (+7 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+0 -7)
📝 runtime/shims/xbox_present.cpp (+1 -0)
📝 runtime/src/vulkan_present.h (+2 -0)
📝 runtime/test/xbox_present_test.cpp (+27 -0)

📄 Description

Claimed as RT-PRESENT-BGRX-OPAQUE-PLANE.

On public main, a synthetic green BGRX overlay disappeared when its unused X byte was zero. The sampled result was the base color 51/153/230. With X set to 255, the same input was green 0/255/0. Genuine BGRA controls correctly distinguished alpha 0 and 255. DXGI defines BGRX's X channel as unused, so the overlay should be opaque at either value.

Carry the BGRX format distinction into the compositor and use alpha-one swizzle for the sampled view of the secondary plane. The surrounding image retains the base plane outside the overlay rectangle. Ordinary BGRA/RGBA and direct presentation preserve their existing paths.

Reviewer check

Run the Windows synthetic xbox_present test. The regression uses both BGRX UNORM and sRGB, selects X = 0 and 255, checks straight and premultiplied inputs, and compares pixel placement and genuine BGRA alpha controls.

Tested

  • Windows, NVIDIA RTX 5070, driver 621.24. The before test failed at the first BGRX X=0 pixel in the destination rectangle. After the patch, native xbox_present, d3d12_present, and d3d12_typeless_families all passed.
  • This display does not offer HDR10 ST.2084. The routine HDR10 swapchain case skipped and the SDR tone-map and PQ encoder tests ran.
  • Public base b9320a1. Clean merge-tree with #2001. Source-only check and git diff --check passed.
  • Synthetic fixtures only. No game files.

GPUs tested: NVIDIA RTX 5070, 621.24, Windows.

AI-assisted: yes.

Checklist

  • Based on public main.
  • One topic.
  • No game data, keys or protection workarounds.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2014 **Author:** [@lgr123](https://github.com/lgr123) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `lgr123/present-bgrx-opaque-plane` --- ### 📝 Commits (1) - [`71d41e4`](https://github.com/ubiquitarianism/leonida/commit/71d41e418a3fd62003a34ee7373fe98d0444136b) Treat BGRX PresentX overlays as opaque ### 📊 Changes **6 files changed** (+40 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+3 -0) 📝 `runtime/shims/d3d12_com.h` (+7 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+0 -7) 📝 `runtime/shims/xbox_present.cpp` (+1 -0) 📝 `runtime/src/vulkan_present.h` (+2 -0) 📝 `runtime/test/xbox_present_test.cpp` (+27 -0) </details> ### 📄 Description Claimed as [RT-PRESENT-BGRX-OPAQUE-PLANE](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7170365624). On public main, a synthetic green BGRX overlay disappeared when its unused X byte was zero. The sampled result was the base color **51/153/230**. With X set to 255, the same input was green **0/255/0**. Genuine BGRA controls correctly distinguished alpha 0 and 255. DXGI defines BGRX's X channel as unused, so the overlay should be opaque at either value. Carry the BGRX format distinction into the compositor and use alpha-one swizzle for the sampled view of the secondary plane. The surrounding image retains the base plane outside the overlay rectangle. Ordinary BGRA/RGBA and direct presentation preserve their existing paths. ### Reviewer check Run the Windows synthetic `xbox_present` test. The regression uses both BGRX UNORM and sRGB, selects X = 0 and 255, checks straight and premultiplied inputs, and compares pixel placement and genuine BGRA alpha controls. ### Tested - Windows, NVIDIA RTX 5070, driver 621.24. The before test failed at the first BGRX X=0 pixel in the destination rectangle. After the patch, native `xbox_present`, `d3d12_present`, and `d3d12_typeless_families` all passed. - This display does not offer HDR10 ST.2084. The routine HDR10 swapchain case skipped and the SDR tone-map and PQ encoder tests ran. - Public base `b9320a1`. Clean merge-tree with #2001. Source-only check and `git diff --check` passed. - Synthetic fixtures only. No game files. GPUs tested: NVIDIA RTX 5070, 621.24, Windows. AI-assisted: yes. ### Checklist - [x] Based on public main. - [x] One topic. - [x] No game data, keys or protection workarounds. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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
starred/leonida#2023
No description provided.