mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:45:54 +01:00
[PR #1671] [MERGED] d3d12_xs: blend state for slot 57 native pipelines from state blob A (RT-SLOT57-BLEND-STATE) #1687
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1687
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1671
Author: @OreoFR
Created: 11/25/2026
Status: ✅ Merged
Merged: 11/25/2026
Merged by: @aslan2142
Base:
main← Head:rt-slot57-blend-state📝 Commits (6)
70d3517d3d12_xs: blend state for slot 57 native pipelines from state blob A (RT-SLOT57-BLEND-STATE)2f44380docs: state blob A's colour-target registers, measured over the library (RT-SLOT57-BLEND-STATE)4e7b764d3d12_xs: integer render targets keep blending off in slot 57 native PSOs (RT-SLOT57-BLEND-STATE)f557637d3d12_xs: a native PSO whose blend state the device refuses is built with blending off on its stand-in targets (RT-SLOT57-BLEND-STATE)81f33dedocs: the stand-in-target fallback of RT-SLOT57-BLEND-STATE668d65bd3d12_xs: slot 57 retries only a pipeline that blends a B4G4R4A4 stand-in (RT-SLOT57-BLEND-STATE review)📊 Changes
7 files changed (+478 additions, -5 deletions)
View changed files
📝
docs/fspx.md(+45 -2)📝
runtime/CMakeLists.txt(+7 -0)📝
runtime/shims/d3d12_xs_native_pso.h(+66 -2)➕
runtime/shims/d3d12_xs_native_pso_fallback.h(+25 -0)📝
runtime/src/native_pso.h(+119 -1)➕
runtime/test/native_pso_blend_test.cpp(+143 -0)➕
runtime/test/native_pso_fallback_test.cpp(+73 -0)📄 Description
Claimed in the coordination issue as: RT-SLOT57-BLEND-STATE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7155828305)
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 (https://github.com/ubiquitarianism/leonida/pull/939#issuecomment-7155793736):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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.