tests: compare XG-style swizzle selection with AMD addrlib #972
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/979"
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 rasptum on 2026-11-23T19:36:31Z.
Refs #870. This is the XG slice from the claim and the scope note, which R0Y00 accepted at 18:45Z. It is a source-built comparison of XG-style swizzle selection against AMD addrlib. It does not bind a production
xg_xs.dllexport. It is separate from the #874 configuration work.These results are AddrLib observations. A match establishes the chosen PC reference behavior only. The Xbox-specific XG selection and its inputs still need separate evidence.
Inputs (recorded by the test)
src/amd/addrlib, tagmesa-25.1.0, commit5c142e46f3f6e752ed745fd48912ebb8fad67145. The license is MIT (SPDX header, copyright AMD). I didn't use the GPUOpen PAL copy, because itsaddrtypes.hhas no 64-bit types for MSVC.ac_fake_hw_db.hat the same tag). TheAddrCreateinputs follow Mesa'sac_addrlib_create:chipEngine0xD,chipFamily0x8F (NV),chipRevision0x28,gbAddrConfig0x444 (NUM_PIPES4,NUM_PKRS4),createFlags0.gfx9_get_preferred_swizzle_mode:ADDR_RSRC_TEX_2D,ADDR_RSRC_LOC_INVIS, 256 B and variable blocks forbidden, one slice, one sample.DirectXTexXboxTile.cppat a8e5dbf (MIT). The caller asks XG withXGComputeOptimalSwizzleModeand stores the result inXG_TEXTURE2D_DESC::SwizzleMode. DirectXTex does not select a mode itself.Reference table (all
ADDR_OK, identical in dev and release)8_8_8_8, 8 mips, SRVSW_64KB_R_X8_8_8_8, 11 mips, SRVSW_64KB_R_X8, SRVSW_4KB_D_X8_8_8_8, SRVSW_4KB_D_X32, SRVSW_LINEAR8_8_8_8, RTSW_64KB_R_X8_8_8_8, display RTSW_64KB_R_X32, depthSW_64KB_Z_X32_32_32_32, 10 mips, UAVSW_64KB_R_X16, UAVSW_64KB_R_XControls
SW_LINEARprovider disagrees on all 9 tiled rows. A first run with placeholder expectations failed every row, so the table check is not vacuous.SW_LINEAR. The depth target is refused withADDR_INVALIDPARAMSinstead of getting a tiled mode.SW_LINEAR, including the 4096x1 row.ADDR_INVALIDPARAMS.Trimmed
This PR has no explicit layout or texel-address assertions, since R0Y00 reported that those already pass locally. My earlier layout and upload caller (D3D12 footprint provider, readback, tight-pitch and linear-fallback layout controls) stays on a local branch, available if wanted.
Tested
8e8bf20on185ffbe.mainhas since moved to0bcda16; the merge tree is clean, and I didn't rerun on the newermain.devandreleasefull builds passed.ctest --preset <p> --no-tests=error -R '^xg_swizzle_select$|desktop_root_signature|era_heap_allocation|offscreen_warp'passed 4/4.-DXBOX2WINDOWS_ADDRLIB_DIR=),xg_swizzle_selectbuilds and reports Skipped (77). I checked this indev.tests/docs_links_check.py,tests/bidi_controls_check.pyandtests/hardware_reports_check.pypassed.pr_overlap_check.py --autofound no overlap.🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T19:52:24Z.
I fetched the pinned Mesa 5c142e46 and ran the optional test with the real library on Windows. CTest reported 1/1 passed, 0 skips: exact modes and alignments for all ten entries, nine mismatches for the always-linear control, depth refusal when forced linear, and pitch controls. An existing CMake cache kept the optional path empty after the fetch, so
783bb9bdocuments setting the path explicitly; I reconfigured the old cache with that command and verified it runs. The results describe the PC AddrLib reference.Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-23T20:05:14Z.
Two small points from reading the diff (not built or run here):
ADDR_SW_LINEAR) with the table's constant modes and never calls addrlib, so it cannot fail unless the table is edited.tools/fetch_addrlib.pypins the commit and checksrev-parse HEAD, butcheckouthas no--force, so local edits underout/deps/mesasurvive a re-run andrev-parsedoes not see them.Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-23T20:27:54Z.
Thanks @Leyukaka, both points were right. The follow-up is #996:
WILL_FAILCTest,xg_swizzle_select_mutation, swaps that provider in for the provider under test, and the run fails.tools/fetch_addrlib.pynow force-checks-out the pin, cleans the dependency checkout, and fails ifgit statusstill reports anything.AI-assisted (Claude Code).