Skip to content

Treat BGRX overlays as opaque in PresentX composition - #2014

Open
lgr123 wants to merge 1 commit into
ProjectLeonida:mainfrom
lgr123:lgr123/present-bgrx-opaque-plane
Open

lgr123 wants to merge 1 commit into
ProjectLeonida:mainfrom
lgr123:lgr123/present-bgrx-opaque-plane

Conversation

@lgr123

@lgr123 lgr123 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

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 Preserve sRGB midtones on the SDR UNORM swapchain fallback #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.

Preserve the DXGI alpha semantics when the Vulkan composer samples plane 1. Use the existing BGRX format classification to swizzle sampled alpha to one while retaining the overlay placement and the behavior of real alpha formats.
@djrolfes

Copy link
Copy Markdown
Contributor

Independent Linux/Wine + NVIDIA GPU verification at head 71d41e418 (applied cleanly onto main 43a9d562d, Profile M, no game files).

  • Environment: NVIDIA GeForce RTX 3070 Ti 8 GB (desktop), driver 620.73.04, Arch Linux 7.2.15, wine-11.22 (XWayland), clang-cl 23.1.5 + xwin SDK 10.0.26100 cross-build, Ryzen 7 5800X, 31 GiB RAM.
  • Build & test: xbox_present_test.exe cross-compiled cleanly and ran under Wine with LEONIDA_PRESENT_PLANE1=0 alongside a clean main (43a9d562d) control build.
  • Measured result:
    • Both new BGRX/BGRA overlay checks passed:
      • compose: BGRA overlay still uses its alpha
      • compose: BGRX UNORM and sRGB overlays are opaque inside their placement for both alpha modes
    • All other single-plane, 2-plane compose, alpha, SDR EOTF, and HDR10 tone-map checks passed identically to main.
    • One unrelated pre-existing resize check (line 1253: present_planes(&one, 1), matching main line 1226) failed under our unfocused Hyprland workspace environment; HDR10 swapchain skipped (no ST.2084 surface format).
  • Not tested: native Windows or an HDR10-capable ST.2084 output.

AI-assisted: Antigravity (Gemini 4 Neon); no game data.

@lixonik lixonik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the diff and tested merged onto main (493867366) with Ninja Release (MSVC).

Treating DXGI_FORMAT_B8G8R8X8_UNORM / B8G8R8X8_UNORM_SRGB overlay planes as opaque via opaque_alpha + VK_COMPONENT_SWIZZLE_ONE on the view is clean, minimal, and keeps BGRA overlays blending normally.

Tests run

  • xbox_present_test.exe (with LEONIDA_PRESENT_PLANE1=0): both new compose checks passed on real Vulkan hardware:
    • compose: BGRA overlay still uses its alpha
    • compose: BGRX UNORM and sRGB overlays are opaque inside their placement for both alpha modes
  • Note: later in the same binary, case F hits the pre-existing main resize readback failure (present_planes(&one, 1)), unrelated to this PR (tracked in #2507).

GPUs tested: NVIDIA GeForce RTX 5070 12 GB (Windows 11, driver 610.88, Vulkan 1.4.341; VK_LAYER_KHRONOS_validation not installed locally).

AI-assisted (Antigravity, Gemini).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants