[PR #2368] [CLOSED] d3d12_xs: the stand-in blend fallback reads the blend state D3D12 applies #2373

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2368
Author: @ERROR890
Created: 11/26/2026
Status: ❌ Closed

Base: main ← Head: fix/native-pso-standin-blend


📝 Commits (2)

  • 5a830ef d3d12_xs: the stand-in blend fallback reads the blend state D3D12 applies
  • 27cc6af Merge main (fbf100b1b..e57bc63bc) into fix/native-pso-standin-blend

📊 Changes

2 files changed (+94 additions, -7 deletions)

View changed files

📝 runtime/shims/d3d12_xs_native_pso_fallback.h (+31 -7)
📝 runtime/test/native_pso_fallback_test.cpp (+63 -0)

📄 Description

Claimed in the coordination issue as: NATIVE-PSO-STANDIN-BLEND
(https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7197231884)

Depends on: none.

Fixes: none.

What and why

without_stand_in_blend (runtime/shims/d3d12_xs_native_pso_fallback.h) decides whether a graphics pipeline is
retried with blending off on its B4G4R4A4 stand-in targets. It read BlendState.RenderTarget[i] for the target's own
index, but D3D12 only gives every target its own entry when IndependentBlendEnable is TRUE; with it FALSE,
RenderTarget[0] describes all of them and the rest are ignored. Two consequences:

  • a pipeline that does blend a stand-in target at index > 0 was never retried, because the ignored entry usually
    says no blend, so the pipeline stayed missing;
  • a pipeline that does not blend one could be retried because an ignored entry said it did.

The rewrite had the matching problem: it set IndependentBlendEnable = TRUE to turn blending off on the stand-in
alone, without first giving the other targets the state they inherited from RenderTarget[0], so turning the flag on
made each of them read its own (usually zeroed) entry and silently stop blending.

What changes:

  • the entry that applies to a target is RenderTarget[IndependentBlendEnable ? i : 0], and a target whose blend is a
    logic op counts too, since the layer's refusal tests BlendEnable || LogicOpEnable;
  • when the flag has to go on, RenderTarget[0] is copied into all eight entries first, and only then are blending and
    logic ops turned off on the stand-in targets;
  • independent blending on input behaves as before: only the stand-in target changes.

native_pso_fallback_test gains the cases: the stand-in at index > 0 under non-independent blending; the ignored
entry that must not cause a retry; the inherited state every other target keeps once the flag goes on; the independent
case where only the stand-in changes; and a stand-in whose blend is a logic op. The existing four cases still pass.

Testing

Built native_pso_fallback_test with MSVC 19.44 (Windows SDK 10.0.26100) on Windows 11 26H2, Ninja build.
With this change:  native_pso_fallback: ok  (exit 0)
On main:           7 assertions fail (the new cases), exit 1.
ctest -R "native_pso_fallback|native_pso_blend|native_pso_depth|pso_stream|process_cmdline" --output-on-failure:
100% tests passed, 0 tests failed out of 5.
Synthetic descriptor fixtures only. AI-assisted.

GPUs tested: n/a. This is a pure decision-logic change in a header plus its unit test; no Vulkan device, no D3D12
object and no game files are involved.

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (No translator
    change in this pull request.)

🔄 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/2368 **Author:** [@ERROR890](https://github.com/ERROR890) **Created:** 11/26/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/native-pso-standin-blend` --- ### 📝 Commits (2) - [`5a830ef`](https://github.com/ubiquitarianism/leonida/commit/5a830ef0ee4b35489b7e7d1bc2bfeef9b5c8d040) d3d12_xs: the stand-in blend fallback reads the blend state D3D12 applies - [`27cc6af`](https://github.com/ubiquitarianism/leonida/commit/27cc6af745910835fda317c716344a6cf35629b0) Merge main (fbf100b1b..e57bc63bc) into fix/native-pso-standin-blend ### 📊 Changes **2 files changed** (+94 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `runtime/shims/d3d12_xs_native_pso_fallback.h` (+31 -7) 📝 `runtime/test/native_pso_fallback_test.cpp` (+63 -0) </details> ### 📄 Description Claimed in the coordination issue as: NATIVE-PSO-STANDIN-BLEND (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7197231884) Depends on: none. Fixes: none. ### What and why `without_stand_in_blend` (`runtime/shims/d3d12_xs_native_pso_fallback.h`) decides whether a graphics pipeline is retried with blending off on its B4G4R4A4 stand-in targets. It read `BlendState.RenderTarget[i]` for the target's own index, but D3D12 only gives every target its own entry when `IndependentBlendEnable` is TRUE; with it FALSE, `RenderTarget[0]` describes all of them and the rest are ignored. Two consequences: - a pipeline that **does** blend a stand-in target at index > 0 was never retried, because the ignored entry usually says no blend, so the pipeline stayed missing; - a pipeline that does **not** blend one could be retried because an ignored entry said it did. The rewrite had the matching problem: it set `IndependentBlendEnable = TRUE` to turn blending off on the stand-in alone, without first giving the other targets the state they inherited from `RenderTarget[0]`, so turning the flag on made each of them read its own (usually zeroed) entry and silently stop blending. What changes: - the entry that applies to a target is `RenderTarget[IndependentBlendEnable ? i : 0]`, and a target whose blend is a logic op counts too, since the layer's refusal tests `BlendEnable || LogicOpEnable`; - when the flag has to go on, `RenderTarget[0]` is copied into all eight entries first, and only then are blending and logic ops turned off on the stand-in targets; - independent blending on input behaves as before: only the stand-in target changes. `native_pso_fallback_test` gains the cases: the stand-in at index > 0 under non-independent blending; the ignored entry that must not cause a retry; the inherited state every other target keeps once the flag goes on; the independent case where only the stand-in changes; and a stand-in whose blend is a logic op. The existing four cases still pass. ### Testing ``` Built native_pso_fallback_test with MSVC 19.44 (Windows SDK 10.0.26100) on Windows 11 26H2, Ninja build. With this change: native_pso_fallback: ok (exit 0) On main: 7 assertions fail (the new cases), exit 1. ctest -R "native_pso_fallback|native_pso_blend|native_pso_depth|pso_stream|process_cmdline" --output-on-failure: 100% tests passed, 0 tests failed out of 5. Synthetic descriptor fixtures only. AI-assisted. ``` GPUs tested: n/a. This is a pure decision-logic change in a header plus its unit test; no Vulkan device, no D3D12 object and no game files are involved. ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (No translator change in this pull request.) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 21:21:01 +01:00
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#2373
No description provided.