Report XG tile ranges for nine-mip BC5 and BC7 arrays #1304

Merged
R0Y00 merged 1 commit from upstream-pr/1311 into main 2026-11-24 07:42:18 +00:00
R0Y00 commented 2026-11-24 07:31:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T07:31:53Z.


Refs #874. Follows #1300.

XG slot 10 now reports the standard and packed 64 KiB tile ranges for single-sample BC5_UNORM and BC7_UNORM textures at 1024×512 and 1024×1024 with nine mips, one or two slices, layout 0x109, default alignment and zero flags. The added profile covers tile queries only. The six-mip profile from #1300 uses the same query implementation.

A packed mip at the beginning of a request retains its caller-owned slot. Subsequent standard mips in the next slice use their original positions and their per-slice tile offset. Eighty source-built queries cover output guards, packed-only requests, partial ranges, array crossings, null outputs and unsigned count/first boundaries.

The optional pinned Mesa AddrLib oracle checks eight combinations of width/height, slice count and format on the Navi21 configuration. A separate source-built comparison with XCL at 64b3f355 agreed on packing and the sparse output contract. For 1024×512 the old desktop fallback yielded 11 tiles, two standard mips and standard starts 0 and 8. Both references give 12 tiles, three standard mips and starts 4, 2 and 1.

Tested on x64 Windows 11 26200.9974, MSVC Release, with the optional AMD dependency configured from tools/fetch_addrlib.py. The six-mip GPU regressions used WARP and RTX 4060 Laptop (32.0.16.1656), debug layer off.

ctest --test-dir out/release --output-on-failure --no-tests=error -R '^(startup_xg_bc_tiling|xg_bc64_tiling_reference|startup_xg_bc_chain_(hardware|warp)|startup_xg_bc7_layout)$'
python -B tests/docs_links_check.py

5/5 tests passed, zero skips. The documentation check passed for 289 links.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6576899026 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1311). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T07:31:53Z. --- Refs #874. Follows #1300. XG slot 10 now reports the standard and packed 64 KiB tile ranges for single-sample BC5_UNORM and BC7_UNORM textures at 1024×512 and 1024×1024 with nine mips, one or two slices, layout 0x109, default alignment and zero flags. The added profile covers tile queries only. The six-mip profile from #1300 uses the same query implementation. A packed mip at the beginning of a request retains its caller-owned slot. Subsequent standard mips in the next slice use their original positions and their per-slice tile offset. Eighty source-built queries cover output guards, packed-only requests, partial ranges, array crossings, null outputs and unsigned count/first boundaries. The optional pinned Mesa AddrLib oracle checks eight combinations of width/height, slice count and format on the Navi21 configuration. A separate source-built comparison with [XCL at 64b3f355](https://github.com/ivall/xcl/blob/64b3f35599bb7102f55d640e1a791e7d6dd3b175/crates/xcl/src/hle/xg.rs#L610-L658) agreed on packing and the sparse output contract. For 1024×512 the old desktop fallback yielded 11 tiles, two standard mips and standard starts 0 and 8. Both references give 12 tiles, three standard mips and starts 4, 2 and 1. Tested on x64 Windows 11 26200.9974, MSVC Release, with the optional AMD dependency configured from `tools/fetch_addrlib.py`. The six-mip GPU regressions used WARP and RTX 4060 Laptop (32.0.16.1656), debug layer off. ```powershell ctest --test-dir out/release --output-on-failure --no-tests=error -R '^(startup_xg_bc_tiling|xg_bc64_tiling_reference|startup_xg_bc_chain_(hardware|warp)|startup_xg_bc7_layout)$' python -B tests/docs_links_check.py ``` 5/5 tests passed, zero skips. The documentation check passed for 289 links.
tedin7 commented 2026-11-24 07:39:09 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T07:39:09Z.

Review: COMMENTED


Reviewed at commit 976540cc5407bda9715f290ed2d3eb5f572531cd.

Code Review

  • src/startup_stubs/bc64_chain.h / xg_bc64.inl / xg_xs.cpp: supports_nine_mip_tiling() cleanly isolates 1024×512 and 1024×1024, 1–2 slice, 9-mip BC5_UNORM/BC7_UNORM (0x109 layout) descriptors onto bc_tiling_table (slot 10 only), preserving bc_table for the 6-mip 1024×1024 single-slice case.
  • bc64_tiling(): bottom-up standard mip tile allocation (12 tiles/slice for 1024×512 with starts {4, 2, 1}, 22 tiles/slice for 1024×1024 with starts {6, 2, 1}), overflow-safe available = first < subresources ? subresources - first : 0 clamping, original-index placement in tilings[i], and packed-mip / out-of-range sentinel preservation match the documented behavior.
  • tests/startup_xg_bc_tiling_check.py & tests/xg_swizzle_select_check.cpp: 80 subresource queries (including cross-slice packed-to-standard boundaries, count == nullptr, tilings == nullptr, and 0xffffffff bounds) plus the optional AddrLib --bc64-tiling reference check are well-structured.

Verification

  • Linux (976540cc):
    • git diff --check origin/main...HEAD: pass
    • /root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py: pass (16 Markdown files, 289 links)
    • /root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py: pass (1092 files)
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP, --target startup_stub_xg_xs xg_swizzle_select_check):
    • Debug (--preset dev): ctest --preset dev -R '^(startup_xg_bc_tiling|xg_bc64_tiling_reference|xg_swizzle_select|startup_xg_bc7_layout)$' --parallel 4 --no-tests=error --output-on-failure — 2/4 passed (startup_xg_bc_tiling, startup_xg_bc7_layout), 2 skipped (exit 77: xg_bc64_tiling_reference, xg_swizzle_select, AddrLib not configured on VM)
    • Release /O2 (--preset release): ctest --preset release -R '^(startup_xg_bc_tiling|xg_bc64_tiling_reference|xg_swizzle_select|startup_xg_bc7_layout)$' --parallel 4 --no-tests=error --output-on-failure — 2/4 passed (startup_xg_bc_tiling, startup_xg_bc7_layout), 2 skipped (exit 77: AddrLib not configured on VM)
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6035371598 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1311#pullrequestreview-6035371598). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T07:39:09Z. **Review:** COMMENTED --- Reviewed at commit `976540cc5407bda9715f290ed2d3eb5f572531cd`. ### Code Review - `src/startup_stubs/bc64_chain.h` / `xg_bc64.inl` / `xg_xs.cpp`: `supports_nine_mip_tiling()` cleanly isolates 1024×512 and 1024×1024, 1–2 slice, 9-mip BC5_UNORM/BC7_UNORM (`0x109` layout) descriptors onto `bc_tiling_table` (slot 10 only), preserving `bc_table` for the 6-mip 1024×1024 single-slice case. - `bc64_tiling()`: bottom-up standard mip tile allocation (`12` tiles/slice for 1024×512 with starts `{4, 2, 1}`, `22` tiles/slice for 1024×1024 with starts `{6, 2, 1}`), overflow-safe `available = first < subresources ? subresources - first : 0` clamping, original-index placement in `tilings[i]`, and packed-mip / out-of-range sentinel preservation match the documented behavior. - `tests/startup_xg_bc_tiling_check.py` & `tests/xg_swizzle_select_check.cpp`: 80 subresource queries (including cross-slice packed-to-standard boundaries, `count == nullptr`, `tilings == nullptr`, and `0xffffffff` bounds) plus the optional AddrLib `--bc64-tiling` reference check are well-structured. ### Verification - **Linux** (`976540cc`): - `git diff --check origin/main...HEAD`: pass - `/root/.local/share/x2w-rev-venv/bin/python -B tests/docs_links_check.py`: pass (16 Markdown files, 289 links) - `/root/.local/share/x2w-rev-venv/bin/python -B tests/bidi_controls_check.py`: pass (1092 files) - **Windows Server 2025** (Build 26100, MSVC 14.44.35207 + D3D12 WARP, `--target startup_stub_xg_xs xg_swizzle_select_check`): - **Debug (`--preset dev`)**: `ctest --preset dev -R '^(startup_xg_bc_tiling|xg_bc64_tiling_reference|xg_swizzle_select|startup_xg_bc7_layout)$' --parallel 4 --no-tests=error --output-on-failure` — **2/4 passed** (`startup_xg_bc_tiling`, `startup_xg_bc7_layout`), 2 skipped (exit 77: `xg_bc64_tiling_reference`, `xg_swizzle_select`, AddrLib not configured on VM) - **Release `/O2` (`--preset release`)**: `ctest --preset release -R '^(startup_xg_bc_tiling|xg_bc64_tiling_reference|xg_swizzle_select|startup_xg_bc7_layout)$' --parallel 4 --no-tests=error --output-on-failure` — **2/4 passed** (`startup_xg_bc_tiling`, `startup_xg_bc7_layout`), 2 skipped (exit 77: AddrLib not configured on VM)
upstream-sync closed this pull request 2026-11-24 08:01:34 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!1304
No description provided.