startup: check the slice footprint plan and re-read rules #1479
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1486"
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 Asimmimx on 2026-11-24T12:45:58Z.
Change
Refs #1149. This adds a device-free check for
src/startup_stubs/slice_footprints.h. The header is used by:xg_xs.cpp): layout, copy-into, andsupports()inXGCreateTextureComputer;d3d12_draw.inl.It is reached today through
startup_nv12_draw,startup_plane_refresh, thestartup_xg_bc*checks and the stream-consumer WARP draws. I probed it against 20 CPU and WARP tests (listed below). 10 of 14 single-point mutants left all 20 passing. The survivors were all in the re-read checks,supports(), the constructor's mip limit and null-device guard, and the byte span of the last row. Theupload()mutants were all caught, so this check leavesupload()out.startup_slice_footprintsincludes only the header and has 51 cases with hand-worked expected values. For example:GetCopyableFootprintscomes from a stand-in device: a method table whose slot 38 records the call. Slot 38 is the position ofGetCopyableFootprintsinID3D12DeviceVtbl;d3d12_xs_device.cppnames it "Device slot 38". Every other slot fails the test. This keeps the constructor cases independent of the adapter. A null device is also checked, because XG's copy-into builds a plan before it tests the device.startup_slice_footprints_padded_controlruns--mutate padded-last-row, which expects the full row pitch for the last row, and must fail (WILL_FAIL).The change is test, CMake and
docs/startup-runtime.mdonly. The CMake block follows thestartup_plane_refresh/startup_nv12_drawregistrations, apart from the other open #1149 PRs.Verification
Commit
93672b99(main) plus this change,devpreset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0.tests/docs_links_check.py,tests/bidi_controls_check.pyandgit diff --checkpassed.Mutation probe
I applied each mutation to the header alone, rebuilt the affected binaries, ran the tests, then reverted. None of this is committed. "Existing" means these 20 tests:
startup_{plane_refresh,nv12_draw,stream_request,stream_draw,mrt_fxc,mrt_dxc,logical_view,xg_bc7_draw,slot57_blend_draw,packed_target_draw,address_srv,placed_vertex,address_bc_view,xg_bc_chain,xg_bc_array}_warp;startup_xg_bc_tilingandstartup_xg_bc7_layout;cpu_shim_{draw,texture_reuse,upload_texture}_warp.On the unmodified header 19 pass and
startup_logical_view_warpskips (77).startup_slice_footprintsSubresourceIndex = 0<=→<MipLevels == 1droppedDepthOrArraySize == 1droppedsupports: odd-width check droppedsupports: NV12MipLevels == 1droppedsupports:SampleDesc.Count == 1droppedsupports:Width && Heightdroppedmips <= max_mips→<(refuses 15 mips)device &&guard dropped+ row_bytesdropped (short last row)upload: placed offset instead of the ring offsetupload: slice strideslice * slicesupload: mip and plane swappedChecklist
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T13:04:44Z.
Review: COMMENTED
Peer review of PR #1486 (
0468663422ef91cb3c82dc06819eb4325f0281cd).Code & Diff Audit
CMakeLists.txt,docs/startup-runtime.md, andtests/startup_slice_footprints_check.cpp;src/startup_stubs/slice_footprints.his untouched.SliceFootprints::supports(): tests odd 3D/array non-NV12 textures, valid even 2D single-mip/single-layer/single-sample NV12 sizes, and 12 rejected NV12 variants (odd/zero dimensions, >1/0 mips, >1/0 layers, >1 samples, 3D/1D/buffer).recheck_cpu_texture(): tests 1-frame vs 15-frame thresholds (R8 single-plane vs multi-mip/array/R8G8/RGBA8) and the inclusive 32 MiB byte cap.ID3D12Device: traps all vtable slots except slot 38 (GetCopyableFootprints), verifies exactfirst=0,base=0,count=mips*planes, output pointer wiring, mip limit (1..15, rejecting0and16), invalid NV12 rejection, and null-device safety.bytes(): checks last-row unpadded byte span across 2D, NV12 chroma, index 29, multi-slice 3D, and a2^32(4 GiB) 64-bit span.--mutate padded-last-rownegative control (startup_slice_footprints_padded_control,WILL_FAIL TRUE) confirms full-pitch last-row expectations fail as intended.tests/docs_links_check.py,tests/bidi_controls_check.py, andgit diff --check origin/main...HEADall pass on Linux. Title-neutral.Win2025 Verification
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP) at commit
0468663422ef91cb3c82dc06819eb4325f0281cd:--preset dev):cmake --build --preset dev --target startup_slice_footprints_check -- -j 6):3.94s(configure1.79s)ctest --preset dev -R '^startup_slice_footprints' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (0.09s:startup_slice_footprints0.02s,startup_slice_footprints_padded_control0.01s)/O2(--preset release):cmake --build --preset release --target startup_slice_footprints_check -- -j 6):1.38s(configure1.70s)ctest --preset release -R '^startup_slice_footprints' --parallel 4 --no-tests=error --output-on-failure): 2/2 passed (0.08s:startup_slice_footprints0.01s,startup_slice_footprints_padded_control0.01s)