gfx10: align 4-byte display swizzle row with GFX10.3 RbPlus (x2y2) #3789

Open
github-bot wants to merge 22 commits from github-bot/gh-3787 into main AGit
Owner

@⁠Holastor on GitHub · 2026-12-01 22:06 UTC · original
Holastor:gfx10/rbplus-4byte-display-swizzle → main · +1423 −100 · 17 files · 22 commits · draft

Depends on #1469

Aligns the 4-byte _D / display swizzle row with GFX10.3 / RDNA2 RbPlus (----x0x1y0y1x2y2) across both src/startup_stubs/gfx10_texture.h and src/startup_stubs/gfx10_layout.h, and restores the corresponding Mesa 25.1.0 AddrLib (supportRbPlus = 1) pins.

Changes

  • src/startup_stubs/gfx10_texture.h and src/startup_stubs/gfx10_layout.h: update 4-byte _D / display pattern to ----x0x1y0y1x2y2.
  • tests/startup_gfx10_layout_check.cpp: update 4-byte display equations (0x102, 0x106, 0x10a) to ... Y0 Y1 X2 Y2 ....
  • tests/startup_xg_gfx10_check.py and tests/xg_swizzle_select_check.cpp: restore RbPlus pins (R32 64x64 1m 256B_D AddrLib comparison).
  • docs/startup-runtime.md and docs/experiments.md: document that the 4-byte display row uses GFX10.3 RbPlus x2y2 and differs from the 4-byte standard row y2x2.

Verification (release)

  • ctest --preset release --no-tests=error -R ^(startup_xg_.*|xg_.*|startup_gfx10_layout.*)$ -V: 20/20 passed
  • docs_links_check.py, bidi_controls_check.py, gfx10_texture_roundtrip_check.py: PASS

Background & Rationale

  • In AMD Mesa AddrLib (src/amd/addrlib/src/gfx10/gfx10SwizzlePattern.h), GFX10.3 / RDNA2 hardware with supportRbPlus = 1 selects GFX10_SW_256_D_RBPLUS_PATINFO (and SW_4K_D_RBPLUS / SW_64K_D_RBPLUS), which uses pattern index 39 (----x0x1y0y1x2y2: bit 6 = x2, bit 7 = y2) for 4-byte elements, whereas non-RbPlus Navi1x uses pattern index 2 (----x0x1y0y1y2x2).
  • Keeping this change isolated in #3787 lets #1469 merge first with a single consistent equation across gfx10_texture.h and gfx10_layout.h, while updating both headers, pins, and docs atomically here once @⁠R0Y00 confirms the GFX10.3 RbPlus row.
  • Will be rebased onto main and marked ready for review right after #1469 lands.
**@⁠Holastor** on GitHub · 2026-12-01 22:06 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3787) `Holastor:gfx10/rbplus-4byte-display-swizzle` → `main` · +1423 −100 · 17 files · 22 commits · draft Depends on #1469 Aligns the 4-byte `_D` / `display` swizzle row with GFX10.3 / RDNA2 RbPlus (`----x0x1y0y1x2y2`) across both `src/startup_stubs/gfx10_texture.h` and `src/startup_stubs/gfx10_layout.h`, and restores the corresponding Mesa 25.1.0 AddrLib (`supportRbPlus = 1`) pins. ### Changes - `src/startup_stubs/gfx10_texture.h` and `src/startup_stubs/gfx10_layout.h`: update 4-byte `_D` / `display` pattern to `----x0x1y0y1x2y2`. - `tests/startup_gfx10_layout_check.cpp`: update 4-byte display equations (`0x102`, `0x106`, `0x10a`) to `... Y0 Y1 X2 Y2 ...`. - `tests/startup_xg_gfx10_check.py` and `tests/xg_swizzle_select_check.cpp`: restore RbPlus pins (`R32 64x64 1m 256B_D` AddrLib comparison). - `docs/startup-runtime.md` and `docs/experiments.md`: document that the 4-byte display row uses GFX10.3 RbPlus `x2y2` and differs from the 4-byte standard row `y2x2`. ### Verification (`release`) - `ctest --preset release --no-tests=error -R ^(startup_xg_.*|xg_.*|startup_gfx10_layout.*)$ -V`: **20/20 passed** - `docs_links_check.py`, `bidi_controls_check.py`, `gfx10_texture_roundtrip_check.py`: **PASS** ### Background & Rationale - In AMD Mesa AddrLib (`src/amd/addrlib/src/gfx10/gfx10SwizzlePattern.h`), GFX10.3 / RDNA2 hardware with `supportRbPlus = 1` selects `GFX10_SW_256_D_RBPLUS_PATINFO` (and `SW_4K_D_RBPLUS` / `SW_64K_D_RBPLUS`), which uses pattern index 39 (`----x0x1y0y1x2y2`: bit 6 = `x2`, bit 7 = `y2`) for 4-byte elements, whereas non-RbPlus Navi1x uses pattern index 2 (`----x0x1y0y1y2x2`). - Keeping this change isolated in `#3787` lets `#1469` merge first with a single consistent equation across `gfx10_texture.h` and `gfx10_layout.h`, while updating both headers, pins, and docs atomically here once @⁠R0Y00 confirms the GFX10.3 RbPlus row. - Will be rebased onto `main` and marked ready for review right after `#1469` lands.
Add clean-room GFX10 texture tiling and detiling runtime in src/startup_stubs/:
- Implement src/startup_stubs/gfx10_texture.h using AMD GFX10 addrlib micro-tile equations (SPDX-License-Identifier: MIT, derived from Mesa src/amd/addrlib).
- Support Thin S and Thin D 256-byte micro-tiles across 1B, 2B, 4B, 8B, and 16B elements (BC1-BC7, R8, R16, R32, RG8, RGBA8, BGRA8, RGBA16, RGBA32, D16, D24S8, D32F).
- Support non-XOR swizzle modes: SW_64KB_S, SW_64KB_D, SW_4KB_S, SW_4KB_D, SW_256B_S, SW_256B_D, and SW_LINEAR.
- Implement mip tail packing, origin placement, and linear<->tiled subresource transfers (copy_subresource<into>).
- Wire TextureComputer slots in xg_xs.dll (slots 2, 3, 4, 5, 6, 8, 9, 10), including functional slot 9 (CopyFromSubresource detile).
- Integrate general GFX10 detiling into D3D12 runtime upload_texture and publish_tiled_texture.
- Add synthetic verification test suite tests/startup_xg_gfx10_check.py covering 12 texture shapes, formats, and swizzle configurations.

Verification:
ctest --preset dev --no-tests=error -R '^(startup_xg_|bc7_|texture_bc|bcpack)' -V
19/19 tests passed (100%)
Resolve the CMakePresets.json conflict by keeping upstream's new pr targets and filter entries alongside this branch's XG targets and tests.

Co-Authored-By: Claude Code <[email protected]>
Add BC7 81x69 4m 4KB_S and BC7 129x129 4m 4KB_S to the GFX10 addrlib oracle. The 81x69 shape alone does not discriminate: at 4 KB BC7 the tile is 16x16 blocks, so the ShiftCeil extents (11x9 at mip 1) and the rounded-down ones (10x9) still fit one tile. 129x129 crosses the tile boundary at mip 1 (17 vs 16 blocks), so reverting the tiled mip_start loop to columns/rows fails it: surf=61440 vs 49152.

Verified against Mesa 25.1.0 addrlib (navi21); the mutation was applied locally, run, and reverted.

Co-Authored-By: Claude Code <[email protected]>
The nine-mip BC5/BC7 section reads as if XG slots 2/3/6/8/9/10 handled
layout 0x109 only. Note the general computer in the next section and keep
the pins specific to the earlier shape. In startup-runtime.md, name the
scope of Gfx10Texture after #1469 instead of describing it as future work.

Co-Authored-By: Claude Code <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 22:08:00 +00:00
This pull request has changes conflicting with the target branch.
  • CMakePresets.json
  • src/startup_stubs/d3d12_draw.inl
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3789/head:github-bot/gh-3787'
git switch 'github-bot/gh-3787'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3787'
git switch 'github-bot/gh-3787'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3787'
git switch 'github-bot/gh-3787'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3787'
git switch 'main'
git merge --squash 'github-bot/gh-3787'
git switch 'main'
git merge --ff-only 'github-bot/gh-3787'
git switch 'main'
git merge 'github-bot/gh-3787'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.