d3d12_xs: blend state for slot 57 native pipelines from state blob A (RT-SLOT57-BLEND-STATE) #1671
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs rebase
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!1671
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1671/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@OreoFR on GitHub · 2026-11-25 07:43 UTC · original
OreoFR:rt-slot57-blend-state→main· +478 −5 · 7 files · 6 commits · merged 2026-11-25 13:28 UTCClaimed in the coordination issue as: RT-SLOT57-BLEND-STATE (#1608)
Depends on: #1592
#1592 is a conflict only: both add an
#includeon the same line ofruntime/shims/d3d12_xs_native_pso.h. Everything else merges, and I'll rebase onto whichever lands first. This builds on no other PR. The real-boot test also used #1558 and #1547 to get past the landing screen on NVIDIA; this change doesn't need them.What and why
Since #939, every graphics pipeline the game creates through device slot 57 goes through the native factory (
runtime/shims/d3d12_xs_native_pso.h). The factory built each PSO from a zeroed desc and set onlyRenderTargetWriteMask, so every target drew with blending off. The record's state blob A, which carries the blend state, was never read (native_pso.h: "blend, raster, depth, not decoded"). That is the cause of the picture regression QemmHD bisected to #939 (#939):Blob A's shared block holds context register values in the RDNA2 layout. Measured over all 5,680 distinct blobs in the 1.0.2.1 pipeline library (25,471 graphics records):
+0xd0..+0xecCB_BLEND0..7_CONTROL: 34 distinct values, all in-range blends.+0x78CB_TARGET_MASK: it matches blob B's targets in 17,626 records.+0x7cCB_COLOR_CONTROL: ROP3 copy everywhere.The counts and the layout are in
docs/fspx.md, "State blob A". Aggregate counts only; no blob bytes are quoted anywhere.runtime/src/native_pso.h:decode_state_a_blendchecks the measured shapes and the tag, then reads the registers.d3d12_target_blendandd3d12_blendmap them to D3D12 blend values: RDNA2 factor andCOMB_FCNtoD3D12_BLENDandD3D12_BLEND_OP, alpha taken from the colour fields withoutSEPARATE_ALPHA_BLEND, and each target'sCB_TARGET_MASKnibble as its write mask.plan()fillsFixedState::blend.runtime/shims/d3d12_xs_native_pso.h:fill_blend_statebuildsD3D12_BLEND_DESCfrom it, withIndependentBlendEnablewhere targets differ. Both the VS and the mesh paths use it.SRC1factors, since the translator declares no second pixel-shader output;runtime/test/native_pso_blend_test.cpp(portable, standard library only): synthetic blobs for both families, the shape and tag checks, the register mapping including the subtract/reverse-subtract order and the non-separate alpha case, the refused forms, andplan().Tested
main+ #1558 + #1547 (needed on NVIDIA to get past the landing screen) + this branch, fresh first-run profile, factory on.CB_BLEND0 f1010f01pipelines, as expected.native_pso_blend,xs_proxy_mockandxbox_native_base_drawpass.GPUs tested: NVIDIA GeForce RTX 4070 Laptop GPU, driver 591.59 (32.0.15.9159), Windows 11
AI-assisted: yes
@QemmHD offered an A/B on a 4070 SUPER with the factory on and off; that would cover a second machine.
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (Not a translator change; the measurement is indocs/fspx.md.)🤖 Generated with Claude Code
@OreoFR on GitHub · 2026-11-25 08:20 UTC · original · edited 2026-11-25 08:25 UTC
I pushed two fixes after a second real-boot run turned up one refused pipeline (
slot 57 call 1 failed with 0x80070057), the first pipeline the title creates. It writesR32_FLOAT,B4G4R4A4_UNORMandR8_UINTwithMAXblending on every target:4e7b764db: integer targets (UINT/SINT) keep blending off. The colour block bypasses blending there, and D3D12 refuses a PSO that asks for it.f5576377d: on this RTX 4070 Laptop,B4G4R4A4isn't renderable, so the Vulkan layer draws it into an RGBA8 stand-in and refuses blending on it (E_NOTIMPL), because the stand-in quantizes the output before blending. When the device refuses the decoded blend state, the factory turns blending off on those targets only, then on every target if it's still refused. It no longer leaves the pipeline to the PC description path, which fails on this machine.After both fixes, the same boot has no refused slot 57 pipeline and no device loss, and the first-run pages, legal screens and slideshow still draw correctly. Blending on the RGBA8 stand-in is something the layer could allow approximately, but that's a separate decision about the layer.
#1691 (depth, stencil and raster state from the same blob, RT-SLOT57-DEPTH-RASTER) is stacked on this branch and already includes these fixes. Merging this one first leaves #1691 with only its own two commits to review. @QemmHD if you A/B, #1691's branch covers both.
AI-assisted.
@whoalin1 on GitHub · 2026-11-25 08:24 UTC · original
Independent verification (native Windows; RTX 4070 SUPER + AMD Radeon gfx1036 iGPU,
LEONIDA_VK_VALIDATION=1): builds clean (815-step rebuild); newnative_pso_blendportable test passes on both GPUs. ctest overnative_pso_blend|xs_proxy_mock|pso_stream|d3d12_pso_validation|d3d12_draw|d3d12_pipeline_library(15 tests): NVIDIA 14/15 — onlyd3d12_pipeline_library_hostcrashes (0xc0000409); AMD passes the PR-relevant tests, withd3d12_draw/d3d12_pso_validationfailing on the iGPU's 128-byte push-constant limit andd3d12_pipeline_libraryskipping. All failures reproduce identically on cleanorigin/main(3f81d46ac) — pre-existing/environmental, not caused by this PR. Caveat:xbox_native_base_drawneeds llvm-mc/spirv tools not installed here, so GPU coverage of the blend path is indirect. AI-assisted verification.@QemmHD on GitHub · 2026-11-25 09:01 UTC · original
Real-boot A/B on native Windows 11, RTX 4070 SUPER (NVIDIA 621.24), MSVC RelWithDebInfo. The slot 57 native graphics factory is on in both arms, with
LEONIDA_TITLE_WINDOWS_MB=1024and #1558's fallback in both. Arm A =3f81d46ac(this PR's base), arm B =81f33de1c(this head).CreateNativeGraphicsPipelineStateok / failedCreatePipelineStatefailedThanks @OreoFR, this is the fix for what I reported on #939.
AI-assisted (Claude Code, Claude Opus 5.5).
@OreoFR on GitHub · 2026-11-25 09:03 UTC · original
@QemmHD thanks for the A/B. The 4
CB_BLEND0 f1010f01lines are the dual-source (SRC1) pipelines: #1703, stacked on this PR, builds them with their real blend by moving the pixel shader'sSV_Target1toLocation 0, Index 1. On a real boot withLEONIDA_VK_VALIDATION=1, those lines are gone and no pipeline is refused. TheB4G4R4A4line is expected on NVIDIA, as you say.AI-assisted.
@kawaii-shakal on GitHub · 2026-11-25 11:57 UTC · original
Tested on a real boot: this fixes the solid glyph blocks for us too. Menu and first-run text now renders as glyphs, on an RTX 5070 Ti (Blackwell, NVIDIA 617.42, Windows 11 Pro 26300).
mainbcaa13dad, plus this PR, #1691 and #1703 at188207a9d, plus my own open runtime PRs (#1715, #1732, #1734 and others, none touching PSO state). Built with VS 2026 RelWithDebInfo.slot 57: the device refused this pipeline's blend state, so it was built with blending off on its B4G4R4A4 targets.AI-assisted (Claude Code, Claude Opus 5.5).
@OreoFR on GitHub · 2026-11-25 12:03 UTC · original
@kawaii-shakal thanks, a second machine and GPU family showing the glyphs instead of the solid blocks is exactly what this needed. Your log matches mine: the
B4G4R4A4step is the only fallback that fires in a real boot.Since your run, adrianmjim pointed out in #1703 that the fallback also caught unrelated
E_NOTIMPLrefusals.668d65b4blimits it to pipelines that blend aB4G4R4A4target, which is the case your boot hit, so nothing changes for what you saw. The log line now reads "the device refused blending on this pipeline's B4G4R4A4 stand-in targets".AI-assisted.
@aslan2142 on GitHub · 2026-11-25 13:28 UTC · original
Merged: this is the fix for the solid glyph blocks and the opaque, black-backed layers that every boot since #939 showed. Thank you, @OreoFR, and thanks to @QemmHD for the A/B and to @kawaii-shakal and @whoalin1 for the independent runs.
RT-SLOT57-BLEND-STATEin #1608 came before the PR and is unedited.native_pso_blendpasses.main+ this branch: nothing goes from pass to fail, and the newnative_pso_blendandnative_pso_fallbacktests pass on both devices.xmemfailed once on the iGPU in the full run; it also fails now and then when run alone onmain's identical XMem code, so it is a pre-existing flake, not this change.CB_BLEND0 f1010f01lines) are stacked on this and come next.#includeconflict ind3d12_xs_native_pso.hyou mentioned.main384abe5b0+668d65b4b: it merges cleanly; the semantic suite passes (489 files, 6,288 tests, 0 files failed); the 14 docs and writer tests pass;check_no_game_data.pyis clean on the 7 changed files.AI-assisted (Claude Code, Claude Opus 5.5).