startup: check the packed stand-in tag round trip #1546
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1553"
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-24T13:52:53Z.
Change
Refs #1149. This extends
startup_packed_target, the device-free check forsrc/startup_stubs/packed_target_format.h. When an adapter cannot create a B5G5R5A1, B4G4R4A4 or B5G6R5 render target, the stand-in creates an R8G8B8A8 texture instead.mark_packed_stand_inthen tags that texture with the requested format throughSetPrivateData, andpacked_stand_in_ofreads the tag back so thatpacked_viewcan accept the packed view on the stand-in.The selection rule (
packed_target_stand_in) and the view verdicts (packed_view) are well covered. The tag round trip is not covered at all:startup_packed_targetcalls the helpers only with literal arguments.So three single-point mutants left every existing test passing:
packed_stand_in_ofalways returningDXGI_FORMAT_UNKNOWN.This adds a fake
ID3D12Resourcethat holds one private-data entry. ItsGetPrivateDataanswers like a D3D12 object: the stored size,DXGI_ERROR_NOT_FOUNDorDXGI_ERROR_MORE_DATA. It also adds 15 hand-worked rows. For each packed format:stand_in;unchanged);tagjoins the existingforeach(mutation ...)list asstartup_packed_target_tag_control. That control reads every tag back as none and must fail (WILL_FAIL). There is no new executable. The rest of the change is two sentences in the existing "Checks" bullet ofdocs/startup-runtime.md.Verification
Commit
309cfede(main) plus this change,devpreset (Debug), Windows 11 Pro build 26300.9974, MSVC 19.51.36260, Windows SDK 10.0.26100.0.On an AMD Radeon RX 6600 (driver 32.0.21045.29003, run serially), the hardware draw also never reaches the stand-in:
WARP 10.0.26100.9818 also logs all three formats as described.
tests/docs_links_check.py,tests/bidi_controls_check.pyandgit diff --checkpassed.Mutation probe
I applied each mutation to the header alone, rebuilt, ran the tests, then reverted. None of this is committed.
startup_packed_target, 4 controls,draw_warp)desc.Formatdraw_warp)SetPrivateDatasizesizeof / 2packed_stand_in_ofalways UNKNOWNpacked_viewdropsresource_format == R8G8B8A8packed_target_formatdrops B4G4R4A4markdrops thepacked_target_format(requested)checkpacked_stand_in_ofdrops the size checkThe three survivors cannot be reached by a real caller:
markonly tags R8G8B8A8 textures, so a tagged texture in another format never exists.The fake's
GetPrivateDatafollows the documented D3D12 behaviour. I did not compare it against a real resource.Checklist
AI-assisted (Claude Code).
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T15:54:21Z.
Review: COMMENTED
Technical review (Linux only: the test is Windows-flavoured C++, so it was built with MinGW and run under Wine; no Windows or GPU run was done).
Checked out the PR head (
b50dfca3) in a clean tree. MinGW's d3d12.h declaresID3D12Resource::GetDescasD3D12_RESOURCE_DESC* GetDesc(D3D12_RESOURCE_DESC*), not the by-value form the MSVC headers have, sostartup_packed_target_check.cppdoes not compile as is with MinGW. I verified on a ported copy (the fake resource's GetDesc signature and the onecreated->GetDesc().Formatcall in the header changed to the out-parameter form; nothing else). The logic under test is unchanged by the port.What I ran:
startup_packed_target: PASS (77 rows).--mutate stand-in,array,b565,view,tag: each exits non-zero (16, 9, 6, 6 and 6 failing rows), so the newtagcontrol also fails as the CMake WILL_FAIL entry expects.stand_in; a texture created in the packed format carries no tag and its view staysunchanged; an untagged R8G8B8A8 texture refuses a packed view; a B5G5R5A1 view of a B4G4R4A4 stand-in is refused.Local mutation check on
packed_target_format.h(ported copy, each restored afterwards):GetDesc().Format == R8G8B8A8_UNORMcondition inmark_packed_stand_in: caught.sizeof(requested): caught.bytes != sizeof(requested)check inpacked_stand_in_of: not caught. No row gives the resource a tag of the wrong size.FAILED(...)check onGetPrivateData: not caught. With the output left at UNKNOWN the result is the same for an untagged texture.packed_target_format(requested)test inmark_packed_stand_in: not caught. No row calls it with a non-packed requested format on an R8G8B8A8 texture.Suggestions (non-blocking): add a row where the fake resource holds a tag of a different size (for example one byte), and one where
mark_packed_stand_inis called with a non-packed requested format on an R8G8B8A8 texture; both must stay untagged. That would pin the three guards above.Docs: the new text in
docs/startup-runtime.mdmatches what the test checks. It is worth keeping the wording that the behaviour was measured on the adapter tested, since this review could not confirm it on hardware.No defects found.
AI-assisted; commands listed were executed locally.