d3d12: an integer render target bypasses its blender (D3D-INTEGER-TARGET-BLEND-BYPASS) #2023

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

@⁠BubsMcgee on GitHub · 2026-11-25 18:22 UTC · original
BubsMcgee:fix/integer-target-blend-bypass → main · +58 −2 · 2 files · 1 commits · open

Ports the first concrete gap from DexNom/VIctory (source-only Rust runtime,
GPL-3.0-or-later), commit ddb7332, reimplemented for this Vulkan layer.

What

  • A render target whose format is integer no longer gets blendEnable = VK_TRUE. The layer clears the enable for
    that target only, keeps its colorWriteMask (and every other target's state), and no longer counts it as a
    dual-source consumer.
  • The console's native state keeps CB_BLENDn regardless of the format, and D3D12Xbox bypasses the blender on
    integer surfaces. PC D3D12 rejects that state at pipeline creation, and Vulkan requires
    blendEnable = VK_FALSE (VUID-VkPipelineColorBlendAttachmentState-blendEnable-04727), so forwarding it could
    only fail the pipeline — the failed-CreatePipelineState class reported on RADV in #1915.

Test

  • d3d12_pso_validation_test §3b creates a layer-only pipeline with an R8G8B8A8_UINT target, blending enabled
    and a red write mask. PC D3D12 rejects the same state, so it is deliberately not in the parity set.
  • Windows 11, RTX 3080 Ti, driver 616.64: PASS (61 layer checks, 100 host comparisons), with the plain run and
    with LEONIDA_VK_VALIDATION=1.

Attribution

Adapted from DexNom/VIctory ddb7332 (GPL-3.0-or-later), "Restore 40 shader variants and repair integer-target
blending"; noted in the code comment. AI-assisted.

Claimed as D3D-INTEGER-TARGET-BLEND-BYPASS in the coordination issue.

**@⁠BubsMcgee** on GitHub · 2026-11-25 18:22 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2023) `BubsMcgee:fix/integer-target-blend-bypass` → `main` · +58 −2 · 2 files · 1 commits · open Ports the first concrete gap from [DexNom/VIctory](https://github.com/DexNom/VIctory) (source-only Rust runtime, GPL-3.0-or-later), commit `ddb7332`, reimplemented for this Vulkan layer. ## What - A render target whose format is integer no longer gets `blendEnable = VK_TRUE`. The layer clears the enable for that target only, keeps its `colorWriteMask` (and every other target's state), and no longer counts it as a dual-source consumer. - The console's native state keeps `CB_BLENDn` regardless of the format, and D3D12Xbox bypasses the blender on integer surfaces. PC D3D12 rejects that state at pipeline creation, and Vulkan requires `blendEnable = VK_FALSE` (VUID-VkPipelineColorBlendAttachmentState-blendEnable-04727), so forwarding it could only fail the pipeline — the failed-`CreatePipelineState` class reported on RADV in #1915. ## Test - `d3d12_pso_validation_test` §3b creates a layer-only pipeline with an `R8G8B8A8_UINT` target, blending enabled and a red write mask. PC D3D12 rejects the same state, so it is deliberately not in the parity set. - Windows 11, RTX 3080 Ti, driver 616.64: `PASS (61 layer checks, 100 host comparisons)`, with the plain run and with `LEONIDA_VK_VALIDATION=1`. ## Attribution Adapted from DexNom/VIctory `ddb7332` (GPL-3.0-or-later), "Restore 40 shader variants and repair integer-target blending"; noted in the code comment. AI-assisted. Claimed as `D3D-INTEGER-TARGET-BLEND-BYPASS` in the coordination issue.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:15:03 +00:00
Author
Owner

@⁠BubsMcgee on GitHub · 2026-11-25 19:12 UTC · original

Ready for review: integer-target blending bypass (no blend state on integer RTVs, dual-source excluded for integer targets), from DexNom/VIctory ddb7332. New layer-only PSO test added; d3d12_pso_validation_test is 61/61 layer checks and 100/100 host comparisons plain and with LEONIDA_VK_VALIDATION=1 on an RTX 3080 Ti (616.64). Mergeable; the red status is the repo-wide checks backlog.

**@⁠BubsMcgee** on GitHub · 2026-11-25 19:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2023#issuecomment-7171974270) Ready for review: integer-target blending bypass (no blend state on integer RTVs, dual-source excluded for integer targets), from DexNom/VIctory ddb7332. New layer-only PSO test added; d3d12_pso_validation_test is 61/61 layer checks and 100/100 host comparisons plain and with LEONIDA_VK_VALIDATION=1 on an RTX 3080 Ti (616.64). Mergeable; the red status is the repo-wide checks backlog.
Author
Owner

@⁠Tauwni on GitHub · 2026-11-27 12:09 UTC · original

Tested for RT-STATE-AUDIT-PIPELINE on a Mac: Apple M3, macOS 26.5.1, Wine 11.0 (WineHQ macOS build, its MoltenVK 1.4.1), clang-cl/lld-link 23.1.6 cross build. Merged onto main 2859d0c9b, no game files.

  • With this PR: d3d12_pso_validation, d3d12_draw, d3d12_depth24_draw, d3d12_bundle and gfx10_descriptors pass. Same as main, no regression.
  • This PR's d3d12_pso_validation_test.cpp alone on main, without the fix: the test fails. So it is a test that fails on main and passes with the change (MEASURED, 1 run each).

GPUs tested: Apple M3 (profile S), MoltenVK 1.4.1 under Wine.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠Tauwni** on GitHub · 2026-11-27 12:09 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2023#issuecomment-7217902801) Tested for RT-STATE-AUDIT-PIPELINE on a Mac: Apple M3, macOS 26.5.1, Wine 11.0 (WineHQ macOS build, its MoltenVK 1.4.1), clang-cl/lld-link 23.1.6 cross build. Merged onto `main` `2859d0c9b`, no game files. - With this PR: `d3d12_pso_validation`, `d3d12_draw`, `d3d12_depth24_draw`, `d3d12_bundle` and `gfx10_descriptors` pass. Same as `main`, no regression. - This PR's `d3d12_pso_validation_test.cpp` alone on `main`, without the fix: the test fails. So it is a test that fails on `main` and passes with the change (MEASURED, 1 run each). GPUs tested: Apple M3 (profile S), MoltenVK 1.4.1 under Wine. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠Tauwni on GitHub · 2026-11-27 14:18 UTC · original

CORRECTION to my comment above (#2023).

Wrong line: "This PR's d3d12_pso_validation_test.cpp alone on main, without the fix: the test fails. So it is a test that fails on main and passes with the change."

What I measured since (2 runs each, Apple M3, Wine 11.0 with its MoltenVK 1.4.1, main 2859d0c9b):

  • With this PR's test file on main, the test prints PASS (60 layer checks, 0 host comparisons), so its §3b check passes there. On this driver, creating the pipeline with blending on an R8G8B8A8_UINT target succeeds, so §3b doesn't catch the bug on MoltenVK. Only the validation layer would. (60, not 61: the LogicOp XOR case skips because this MoltenVK has no logicOp.)
  • The "failure" was ctest's timeout: the process hangs at exit after printing PASS. It does that with and without this PR, so it's a Wine-on-Mac exit hang, not this change.

So on a Mac under Wine, this test neither fails on main nor shows the fix. Your RTX 3080 Ti run and RADV remain the evidence for it. What still holds: no regression with the PR in the other four tests.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠Tauwni** on GitHub · 2026-11-27 14:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2023#issuecomment-7220623609) CORRECTION to my comment above (https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2023). Wrong line: "This PR's `d3d12_pso_validation_test.cpp` alone on `main`, without the fix: the test fails. So it is a test that fails on `main` and passes with the change." What I measured since (2 runs each, Apple M3, Wine 11.0 with its MoltenVK 1.4.1, `main` `2859d0c9b`): - With this PR's test file on `main`, the test prints `PASS (60 layer checks, 0 host comparisons)`, so its §3b check passes there. On this driver, creating the pipeline with blending on an `R8G8B8A8_UINT` target succeeds, so §3b doesn't catch the bug on MoltenVK. Only the validation layer would. (60, not 61: the `LogicOp XOR` case skips because this MoltenVK has no `logicOp`.) - The "failure" was ctest's timeout: the process hangs at exit after printing PASS. It does that **with and without this PR**, so it's a Wine-on-Mac exit hang, not this change. So on a Mac under Wine, this test neither fails on `main` nor shows the fix. Your RTX 3080 Ti run and RADV remain the evidence for it. What still holds: no regression with the PR in the other four tests. AI-assisted (Claude Code, Claude Opus 5.5).
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/2023/head:github-bot/gh-2023'
git switch 'github-bot/gh-2023'

Merge

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