startup: read mesh pipeline state blocks at their shifted layout #2298
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2306"
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 denn0x on 2026-11-25T11:28:57Z.
Refs #1999 (item A)
What
State block A of a slot 57 pipeline comes in two layouts. Vertex pipelines carry 4 in the word at +0x004, and the depth-stencil words sit where #2124 reads them (+0xB8 to +0xC4). Mesh pipelines carry 6 there, and every field from +0x058 on sits 0x54 bytes later, so
DB_DEPTH_CONTROLis at +0x10C. Both layouts were measured locally. Before this change, a mesh pipeline's block was read at the vertex offsets, so its depth-stencil state came from unrelated words.src/startup_stubs/pipeline_state_decode.h:state_block_a_shift()returns 0 or 0x54 from the word at +0x004.read_depth_stencil_wordsapplies the shift, reportsmesh_layout, and refuses a mesh block too short for the shifted words.state_block_blend.h(the +0xD0 blend words) is not changed here. The docs say so.Test
tests/startup_pipeline_state_check.cppaddslayout_cases:The new
startup_pipeline_state_mesh_shift_controlrun moves the mesh words to the vertex offsets and must fail. It fails 3 of 39 checks.The six tests are
startup_state_block_blend,startup_pipeline_state,_offset_control,_mesh_shift_control,startup_depth_stateand_switch_control.Environment: Windows 11, MSVC Build Tools (VS 18), Ninja Release build of the whole tree (
all) on this branch. The tests are device-free, so there were no GPU runs and no capability skips.Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T11:32:05Z.
Review: COMMENTED
Review of head
8c6af1b3b0537523f5c2e99cf07e384cb897bc8f(comment only, no approval).Result: no P1, no P2. Two nits.
Scope:
pipeline_state_decode.h(+0x004 layout word, 0x54 shift from +0x058, shifted length check),tests/startup_pipeline_state_check.cpp(layout_cases,--mutate mesh-shift), CMake control test, docs. Title and body are neutral. Mergeable. CI was still pending when I looked (Linux Python checks, Windows build, gfx1013 fixtures).Logic read
state_block_a_shiftreturns 0 for a null or tiny block, 0x54 only when the word at +0x004 is exactly 6. Any other value keeps the old vertex offsets, so existing callers behave as before.read_depth_stencil_wordschecksa_refmask_bf + s + 4, so a mesh block cut short is refused instead of read out of bounds.memcpyatoff + sstays inside that bound.depth_state_apply.h:27. It is unchanged and gets the right words for both layouts.Commands executed locally (Linux, mingw-w64 cross build plus wine, since the header needs
d3d12.h)git diff --check origin/main...HEAD: clean.python3 tests/docs_links_check.py: 18 files, 446 links, ok.python3 tests/bidi_controls_check.py: 1593 files, ok.x86_64-w64-mingw32-g++ -std=c++17 -static -Isrc tests/startup_pipeline_state_check.cpp, run under wine:0 of 39 checks failed.--mutate mesh-shift:3 of 39 checks failed, exit 1 (the WILL_FAIL control works).tests/startup_depth_state_check.cppbuilt and run:0 of 10 checks failed.Mutations of the new logic (each reverted with
git checkout -- .)other layout values...,short mesh block refusedand the mesh case), killed.+ s:short mesh block refusedfails, killed.Nits
state_block_blend.h(+0xD0 blend words) is still read at the vertex offsets for mesh pipelines. The docs say so, but a mesh pipeline's blend state will be wrong until a follow-up. Worth a tracking line on #1999.I did not run the Windows WARP pipeline: the change is pure header and CPU-side parsing, with no shader or GPU path.
AI-assisted; commands listed were executed locally.