startup: read slot 57 mesh blend words at the shifted offset #3503
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3503"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-29T18:34:35Z.
Refs #3416
state_block_blend.hread the eightCB_BLENDn_CONTROLwords of a slot 57 state block A at +0xD0 without looking at the layout tag at +0x004.pipeline_state_decode.halready applies the mesh layout's +0x54 shift to the depth-stencil words. The blend reader now applies the same shift.What changes
find_blendon state block A, then B, else draws without blending. The reason is logged as before.state_block_a_shiftreturnsstd::optional. The depth-stencil reader takes.value_or(0), so it still uses the vertex offsets for other tags.startup_stream_consumer.cpp,startup_slot57_depth.cpp) now write tag 4.find_blendheuristic instead. Not measured.Evidence
One long local run of the application, 134 slot-57 creation captures, all with layout tag 6:
This is consistency only: no single blend enable was toggled between two pipelines to confirm the mapping.
Tests
startup_state_block_blendgains a tag-6 block with distinct valid words at +0x124 and a valid decoy at +0xD0, the same block with tag 4, a tag-6 block one byte short of 0x144, and an unknown tag. The refusal cases check that the outputs stay untouched.Base
77d63db8,devpreset,X2W_WITH_OPUS=OFF:12/12 passed, 0 skipped.
Mutations in
state_block_blend.h, each restored afterwards:startup_state_block_blendresultRemoving the tag write from the
startup_stream_consumer.cppfixture makesstartup_slot57_blend_draw_warpfail: the blended draw reads (255,0,0,128) where (128,0,128,191) is expected.Not covered
CB_TARGET_MASKis still not located.Imported from R0Y00/Xbox2Windows. Originally posted by Not-Saii on 2026-11-29T22:02:52Z.
Review: APPROVED
I reviewed head
ea3a90c20885f465d056c0053434c3cf2292fb0f: a static read, then a build and test run in an isolated Windows Sandbox (networking disabled, PR tree mapped read-only). The decoder change is correct and well tested. The vertex layout keeps +0xD0, the mesh layout reads +0x124, and short blocks and unknown tags are refused without touching the outputs. Nothing below blocks the merge.I found no downloads, network calls, CMake/CI changes or agent-config changes.
SHOULD
The mesh-layout result doesn't reach a mesh draw yet. Please say so in the PR body and at
docs/startup-runtime.md:3200-3206.bound->blendhas one consumer:effective_blend_state→pipeline_for, which builds a VS/PSD3D12_GRAPHICS_PIPELINE_STATE_DESC(src/startup_stubs/d3d12_draw.inl:1399-1402, 1505-1532).src/startup_stubs/native_mesh57.inl:417).blend from … at +0x124log line, not what a mesh draw blends. The same applies to the behaviour note about thefind_blendfallback.No draw-level test reads at +0x124. The sandbox mutation below confirms it: with the shift dropped,
startup_slot57_blend_draw_{warp,hardware}still pass, because the fixture now writes tag 4 and the check assertsat +0xd0. The&whereplumbing ind3d12_draw.inl:1129-1130is therefore covered for tag 4 only. The fixture's spec string can already write the tag, so one more case instartup_slot57_blend_draw_check.pywould cover it: spec4:6,124:<BLEND>,d0:<another valid word>, asserting the blended colour andat +0x124.Evidence fields (AGENTS.md "Evidence"). The
_hardwareresults in the PR body don't give the adapter, driver, Windows build or debug-layer status, and they name the base, not the head, as the build under test.NIT
state_block_blend.h:41-49: the length check runs before the layout check. An unknown-tag block that is also shorter than +0xF0 logs "shorter than the blend words", not "unknown state block A layout". The behaviour is the same.pipeline_state_decode.h:61,.value_or(0)). This is documented and covered bystartup_pipeline_statefor tag 5. Refusing in the depth reader too could be a follow-up.find_blendon state block A, then B (d3d12_draw.inl:1133-1134), so the "unblended" part depends on that heuristic finding nothing.startup_state_block_blend_check.cpphas no case for a tag-6 block whose eight words are all present but disabled. That should succeed unblended with offset 0x124.pipeline_state_decode.h:20still says "not used by the draw path yet". That was stale before this PR, and the header now also feeds the blend reader.What the tests prove
startup_state_block_blend:startup_pipeline_state(+_offset_control,_mesh_shift_control): thestd::optionalrefactor leaves the depth reader unchanged for tags 4, 6 and 5.startup_depth_state(+_switch_control): the depth path throughdepth_state_apply.his unchanged.startup_slot57_blend_draw_*: end to end throughtranslation_forfor tag 4, including the new offset reporting.startup_slot57_depth_*,startup_indirect_requests_*,native_startup_request_cache_*: the retaggedstartup_slot57_depth/startup_stream_consumerfixtures still create and draw slot 57 pipelines, with exact pixel comparisons in the last test.startup_indirect_draw_indexed.cpppass an empty or 8-byte state block A, so they are refused before and after this change.Sandbox run
ea3a90c20885f465d056c0053434c3cf2292fb0f, exported tree,devpreset (Debug).cmake --preset dev -DX2W_WITH_OPUS=OFF. I built only the targets these tests need, then:startup_state_block_blend,startup_pipeline_state,startup_pipeline_state_offset_control,startup_pipeline_state_mesh_shift_control,startup_depth_state,startup_depth_state_switch_control,startup_slot57_depth_warp,startup_slot57_blend_draw_warp,startup_indirect_requests_warp,startup_slot57_depth_hardware,startup_slot57_blend_draw_hardware,startup_indirect_requests_hardware,native_startup_request_cache_warp,native_startup_request_cache_hardware.X2W_D3D12_DEBUGwas unset, so the checks used their default of 0, andd3d12SDKLayers.dllisn't present in the sandbox image.Mutation
state_block_blend.h:42toconst std::size_t offset = state_block_blend_offset + 0;. This reverts the fix and still compiles.startup_state_block_blendfailed withFAIL mesh layoutandFAIL short mesh block(2 FAILED).startup_slot57_blend_drawbackends; that is SHOULD 2.startup_state_block_blendpasses again.CI
Run 46296026189 passed, but the Windows job builds and runs only the
prpreset (82 smoke tests, fixed targets). It compiled the stand-in that includes both changed headers. It did not buildstartup_state_block_blend_check,startup_slot57_depthorstartup_stream_consumer, and it ran none of the tests above.