startup: answer XG slot 10 for layout 0x10a from a 64 KiB tile plan #1547

Merged
JohnConnorNPC merged 1 commit from upstream-pr/1554 into main 2026-11-24 14:13:18 +00:00
JohnConnorNPC commented 2026-11-24 13:53:00 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by JohnConnorNPC on 2026-11-24T13:53:00Z.


Change

XG texture-computer slot 10 (the tiling query) now answers a two-dimensional texture with layout 0x10a from a small tile plan, src/startup_stubs/tile64_plan.h, instead of a desktop reserved resource.

The rule:

  • A mip that is at most half a tile wide and at most one tile high shares one tile with every smaller mip. That tile is the first tile of the slice and is reported as the packed tile.
  • Every other mip is a standard mip on a whole-tile grid. The standard mips follow the shared tile from the smallest to the largest.
  • Slices follow each other.

Tile shapes: 512×256 texels for 8-byte blocks, 256×256 for 16-byte blocks and 8-bit formats, 256×128 for 16-bit formats, 128×128 for 32-bit formats with 8-bit channels. Other formats, other layouts (including the existing nine-mip 0x109 shapes) and three-dimensional textures are answered as before.

Why

A desktop reserved resource puts the largest mip at tile 0 and the packed tile last. For a 2048×2048 BC7 texture with ten mips it reports standard mips at tiles 0, 64, 80, 84 and the packed tile at 85. The plan reports the packed tile at 0 and the standard mips at 22, 6, 2, 1. The nine-mip 0x109 values already in the repository (6, 2, 1 in a 22-tile slice) are what the same rule gives for those sizes.

A console executable that streams texture levels from a pool uses the slot-10 start of a level as that level's place in the pool. With the desktop order every level is looked for at the wrong place. That is the large zlib failed class in #1198: requests for a whole, valid compressed chunk at its file offset plus a constant multiple of 64 KiB. The two constants seen there, 0xE0000 and 0x3A0000, are the distance between a level's desktop start and its pool position for a 1024-wide and a 2048-wide BC7 texture.

Refs #1198

What was measured

The rule against pool files. Texture pool files of one console package, read with the boundary() and descriptor parsers of tools/texture_descriptors.py. A pool stores each level of a texture as its own chunk, smallest first, and each texture record carries size, format, slice count and the split between standard and packed mips. For 39,283 texture records in 57 pool files (179 distinct combinations of size, format, slice count, mip split and level sizes; 18 formats) the rule reproduces every level's size in tiles, with no mismatch. The number of standard mips the rule gives, capped at three, equals the record's own count in every case. The package is not distributed; the fitting script is local and I can put it in a follow-up PR as an offline tool if that is wanted.

One executable, before and after. Startup debugger, scripted first-run input, clang-cl build under Wine 11.0 with vkd3d-proton, RTX 4070 Ti SUPER (550.163.1). Both builds are main at bb6c9a0c with #1429 and #1390 merged in and the local prefix switch described in #1198. The executable made 177 distinct slot-10 queries, all two-dimensional, layout 0x10a.

without the plan with the plan
run stopped at 253 s, null write in the executable 330 s timeout
zlib failed 11,377 by 250 s 2 by 250 s, 3 by 320 s
chunk-table reads that start at a chunk start 8,207 by 249 s 25,829 by 325 s
chunk-table reads that start elsewhere 11,622 by 249 s 0 by 325 s
requests queued 63,244 by 250 s 57,293 by 250 s, 75,909 by 320 s

The runs with the plan used the trial build, which is this change on the older base. The branch itself is rebased on current main and was only run through the tests below.

Tests

startup_xg_tile64_tiling (new): 18 shapes, 120 queries. It checks the tile total, the packed-mip record, the tile shape, the standard-mip entries at their positions in the requested range, array slices, and sentinel bytes over packed entries and the rest of the caller's array. The expected values are written out in the test and recomputed there by a separate Python model. Control: the desktop order for the 2048×2048 case must not be what comes back.

Run directly under Wine against the cross-built DLL (I have no CTest run on Windows):

python -B tests/startup_xg_tile64_tiling_check.py xg_xs.dll
startup_xg_tile64_tiling: 18 shapes, 120 queries

python -B tests/startup_xg_bc_tiling_check.py xg_xs.dll
80 BC5/BC7 subresource queries matched counts, starts and sentinel bytes

Against a build without the change the new test fails on the first shape:

AssertionError: ((98, 2048, 2048, 1, 10), 0)

docs_links_check.py and bidi_controls_check.py pass. docs/experiments.md has a new section after the nine-mip one.

Not verified

  • Windows, and a physical-GPU or WARP run of the suite. Everything above is on a translation-layer host.
  • Anything inside a tile. This is evidence for tile counts and order only; slots 2, 8 and 9 are unchanged for these textures.
  • Formats in the tile-shape table that the pool files do not contain. Measured formats are 28, 29, 54, 61, 65, 71, 72, 74, 77, 78, 80, 83, 87, 91, 95, 96, 98 and 99; the rest of each family is by block or texel size.
  • Layout 0x109 beyond the two nine-mip shapes. It is left on its current paths.
  • A texture large enough for six or more standard mips next to a packed tile. None is in the pool files.
  • One 168 s run with the plan stopped on a write to an unmapped destination inside the storage stand-in. It did not recur in the next two runs (247 s and 330 s) and I have not explained it.
  • The loading screen is still blank and bcpack failed requests remain (135 by 250 s). Both are separate from this change.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6583339430 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1554). Originally posted by [JohnConnorNPC](https://github.com/JohnConnorNPC) on 2026-11-24T13:53:00Z. --- ## Change XG texture-computer slot 10 (the tiling query) now answers a two-dimensional texture with layout `0x10a` from a small tile plan, `src/startup_stubs/tile64_plan.h`, instead of a desktop reserved resource. The rule: - A mip that is at most half a tile wide and at most one tile high shares one tile with every smaller mip. That tile is the first tile of the slice and is reported as the packed tile. - Every other mip is a standard mip on a whole-tile grid. The standard mips follow the shared tile from the smallest to the largest. - Slices follow each other. Tile shapes: 512×256 texels for 8-byte blocks, 256×256 for 16-byte blocks and 8-bit formats, 256×128 for 16-bit formats, 128×128 for 32-bit formats with 8-bit channels. Other formats, other layouts (including the existing nine-mip `0x109` shapes) and three-dimensional textures are answered as before. ## Why A desktop reserved resource puts the largest mip at tile 0 and the packed tile last. For a 2048×2048 BC7 texture with ten mips it reports standard mips at tiles 0, 64, 80, 84 and the packed tile at 85. The plan reports the packed tile at 0 and the standard mips at 22, 6, 2, 1. The nine-mip `0x109` values already in the repository (6, 2, 1 in a 22-tile slice) are what the same rule gives for those sizes. A console executable that streams texture levels from a pool uses the slot-10 start of a level as that level's place in the pool. With the desktop order every level is looked for at the wrong place. That is the large `zlib failed` class in #1198: requests for a whole, valid compressed chunk at its file offset plus a constant multiple of 64 KiB. The two constants seen there, `0xE0000` and `0x3A0000`, are the distance between a level's desktop start and its pool position for a 1024-wide and a 2048-wide BC7 texture. Refs #1198 ## What was measured **The rule against pool files.** Texture pool files of one console package, read with the `boundary()` and descriptor parsers of `tools/texture_descriptors.py`. A pool stores each level of a texture as its own chunk, smallest first, and each texture record carries size, format, slice count and the split between standard and packed mips. For 39,283 texture records in 57 pool files (179 distinct combinations of size, format, slice count, mip split and level sizes; 18 formats) the rule reproduces every level's size in tiles, with no mismatch. The number of standard mips the rule gives, capped at three, equals the record's own count in every case. The package is not distributed; the fitting script is local and I can put it in a follow-up PR as an offline tool if that is wanted. **One executable, before and after.** Startup debugger, scripted first-run input, clang-cl build under Wine 11.0 with vkd3d-proton, RTX 4070 Ti SUPER (550.163.1). Both builds are `main` at `bb6c9a0c` with #1429 and #1390 merged in and the local prefix switch described in #1198. The executable made 177 distinct slot-10 queries, all two-dimensional, layout `0x10a`. | | without the plan | with the plan | |---|---|---| | run | stopped at 253 s, null write in the executable | 330 s timeout | | `zlib failed` | 11,377 by 250 s | 2 by 250 s, 3 by 320 s | | chunk-table reads that start at a chunk start | 8,207 by 249 s | 25,829 by 325 s | | chunk-table reads that start elsewhere | 11,622 by 249 s | 0 by 325 s | | requests queued | 63,244 by 250 s | 57,293 by 250 s, 75,909 by 320 s | The runs with the plan used the trial build, which is this change on the older base. The branch itself is rebased on current `main` and was only run through the tests below. ## Tests `startup_xg_tile64_tiling` (new): 18 shapes, 120 queries. It checks the tile total, the packed-mip record, the tile shape, the standard-mip entries at their positions in the requested range, array slices, and sentinel bytes over packed entries and the rest of the caller's array. The expected values are written out in the test and recomputed there by a separate Python model. Control: the desktop order for the 2048×2048 case must not be what comes back. Run directly under Wine against the cross-built DLL (I have no CTest run on Windows): ``` python -B tests/startup_xg_tile64_tiling_check.py xg_xs.dll startup_xg_tile64_tiling: 18 shapes, 120 queries python -B tests/startup_xg_bc_tiling_check.py xg_xs.dll 80 BC5/BC7 subresource queries matched counts, starts and sentinel bytes ``` Against a build without the change the new test fails on the first shape: ``` AssertionError: ((98, 2048, 2048, 1, 10), 0) ``` `docs_links_check.py` and `bidi_controls_check.py` pass. `docs/experiments.md` has a new section after the nine-mip one. ## Not verified - Windows, and a physical-GPU or WARP run of the suite. Everything above is on a translation-layer host. - Anything inside a tile. This is evidence for tile counts and order only; slots 2, 8 and 9 are unchanged for these textures. - Formats in the tile-shape table that the pool files do not contain. Measured formats are 28, 29, 54, 61, 65, 71, 72, 74, 77, 78, 80, 83, 87, 91, 95, 96, 98 and 99; the rest of each family is by block or texel size. - Layout `0x109` beyond the two nine-mip shapes. It is left on its current paths. - A texture large enough for six or more standard mips next to a packed tile. None is in the pool files. - One 168 s run with the plan stopped on a write to an unmapped destination inside the storage stand-in. It did not recur in the next two runs (247 s and 330 s) and I have not explained it. - The loading screen is still blank and `bcpack failed` requests remain (135 by 250 s). Both are separate from this change.
upstream-sync closed this pull request 2026-11-24 15:01:58 +00:00
R0Y00 commented 2026-11-24 15:02:21 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T14:14:14Z.


Verified be98528a on Windows x64 with MSVC 19.51 in Release. After building startup_stub_xg_xs, ctest --preset release --no-tests=error -R "^startup_xg_(tile64_tiling|bc_tiling)$" passed both tests with zero skips. That covers the slot-10 tile query and the existing BC tiling regression. The startup comparison in #1198 is separate contributor evidence.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7134051903 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1554#issuecomment-7134051903). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T14:14:14Z. --- Verified be98528a on Windows x64 with MSVC 19.51 in Release. After building startup_stub_xg_xs, ctest --preset release --no-tests=error -R "^startup_xg_(tile64_tiling|bc_tiling)$" passed both tests with zero skips. That covers the slot-10 tile query and the existing BC tiling regression. The startup comparison in #1198 is separate contributor evidence.
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!1547
No description provided.