startup: answer 4 KiB allocation-info requests for small 2D textures #2125

Merged
NiiRoZz merged 9 commits from upstream-pr/2133 into main 2026-11-25 06:28:01 +00:00
NiiRoZz commented 2026-11-25 01:21:33 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T01:21:33Z.


Change

A console executable asks the device's allocation-info entries (slots 25 and 108) with Alignment
0x1000 for a texture that is not a render or depth target and whose top level, padded to 4 KiB blocks,
holds at most 0x80007 bits. It keeps the answer only when the returned alignment is 0x1000. sanitized()
dropped that request, so the stand-in forwarded the desktop answer: 64 KiB at 64 KiB alignment.

With that answer the executable records 16 pages for a texture the console sizes at one. Its streaming
read for that texture then runs 64 KiB through the following resources' compressed chunks and ends
inside one of them. The executable's own check rejects that read before submitting it, and the storage
stand-in refuses the request. This change corrects the size answer, so storage receives whole-chunk
requests and publishes the range it actually wrote (#1914).

What changes:

  • Allocation answer. For a description in scope, both slots answer 4 KiB alignment and the GFX10
    4 KiB thin-block size as AMD addrlib computes it (src/startup_stubs/small_texture_4k.h). Each level
    is padded to whole blocks until the first level no wider than half a block and no taller than a block;
    that level and every smaller one share one block.
  • Scope. In scope: a 2D texture with layout UNKNOWN, Alignment 0x1000, one sample, one array slice,
    power-of-two sides up to 16384, MipLevels 0 up to the full chain, and no render-target or depth flag.
    The format must be single-plane at 4/8/16/32/64/128 bits a texel. The texture must be within the
    executable's bound, and the desktop answer must not be a failure. Anything else, alignment 0 included,
    keeps the desktop answer.
  • One plan for every call that touches the memory. The desktop linear footprint can exceed the
    answer (32x32 R8G8B8A8: 0x1f80 bytes). For such a description, XG slot 2 (layout records), XG slot 8
    (copy) and texture upload all use one compact linear plan: rows at their exact byte width (texels or
    4x4 blocks), levels back to back. The plan ends inside the answer for every accepted shape.
    • Slot 8 writes every row of a level, or nothing. A row pitch shorter than a row, or a level past the
      last one, fails without writing or announcing a write.
    • The texels are linear, not the console's 4 KiB swizzle. Bytes an application streams into such a texture in
      the console's 4 KiB tiled order are therefore still not displayed correctly, as on main. The
      difference is that the upload now reads strictly inside the allocation; main read the 256-byte-pitch
      footprint, which ran past it.
    • An address-only single-element texture (#2157) keeps its footprint path: its one texel fits inside
      any answer.

Overlap with #1469: its Gfx10Texture uses the same tail rule, and its gfx10_swizzle_from_desc picks
SW_64KB_S for layout UNKNOWN. For descriptions this change answers at Alignment 0x1000, that side
should choose SW_4KB_S. Its 4 KiB tiling plan can then replace the compact plan: the plan is used in
exactly three places (slot 2, slot 8, upload). This PR does not depend on #1469.

Refs #1914. AI-assisted (Claude Code).

Verification

Release build at d340e464, Windows 11 build 26300, debug layer off. Adapters:

  • WARP: Microsoft Basic Render Driver 10.0.26100.10068.
  • Hardware: NVIDIA GeForce RTX 5090, driver 32.0.16.2135.

addrlib from python tools/fetch_addrlib.py (Mesa 25.1.0, 5c142e46).

ctest --preset release --no-tests=error -R "^(startup_small_texture_4k|startup_xg_|startup_address_single_element)" -V

Result: 20 of 20 passed, 0 failed, 0 skipped. Every device test ran on both WARP and the hardware
adapter.

The other draw tests that use the edited stream consumer
(^startup_(packed_target_draw|stream_|mrt_|logical_view|slot57_blend_draw|placed_vertex|address_srv|address_buffer_srv))
also pass: 26 of 27, with 1 capability skip. startup_logical_view_warp skips because the adapter
accepts the descriptor count directly.

The tests:

  • startup_small_texture_4k, device-free:
    • 15 literal sizes and 19 refused descriptions;
    • all 256 format values against a literal DXGI bits-per-texel table;
    • extents, and literal compact plans for three shapes;
    • for all 4,943 accepted shapes: the plan ends inside the answer, and no tail holds more than 7 levels.
  • startup_small_texture_4k_whole_width_tail_control expects a tail one block wide and must fail.
  • startup_small_texture_4k_addrlib: 4,943 shapes against addrlib ADDR_SW_4KB_S, 0 mismatches. It
    skips (77) without addrlib.
  • startup_small_texture_4k_device_warp and _hardware: slots 25 and 108 give the 4 KiB answer for 3
    descriptions and the desktop answer for 3 controls.
  • startup_small_texture_4k_xg uses a 32x32 R8G8B8A8 texture with 2 mips at 0x1000:
    • slot 2 gives total 0x2000 at 0x1000, mip 0 at 0 (128-byte rows) and mip 1 at 0x1000 (64-byte rows);
    • slot 8 writes both mips into exactly 0x2000 bytes followed by a no-access guard page, with distinct
      rows in both halves and per-mip sentinels;
    • memory equals the plan byte for byte, and the rest keeps its fill;
    • a short pitch and level 2 fail with memory unchanged;
    • at alignment 0, slot 2 reports 0x10000 and slot 8 writes 32 of 32 rows, as on main.
  • startup_small_texture_4k_xg_no_limit_control: at an explicit 64 KiB alignment the desktop footprint
    does not fit before the guard page, so the run must fail.
  • startup_small_texture_4k_draw_warp and _hardware: the same texture is written through slot 8 in
    front of a guard page, placed (slot 133), sampled at both mips by a translated draw, and all 1,536
    read-back pixels are compared.
  • The existing startup_xg_* tests pass unchanged.

Mutants, each run against the tests above: 8 of 8 killed. "Slot 8 rows at the caller's pitch" survived at
first, because every copy used a tight pitch. The XG check now copies mip 0 from a source with padded
160-byte rows, which kills it.

  • upload ignores the plan;
  • slot 8 rows at the caller's pitch;
  • slot 2 level offsets set to 0;
  • slot 8 accepts a short pitch;
  • plan levels 256-byte aligned;
  • BC4 at 8 bits;
  • tail one block wide;
  • limit applied at alignment 0 too.

Evidence and follow-up

Byte correctness rests on the fixtures above, which are synthetic. The addrlib oracle is optional,
MIT-licensed and not vendored.

Author evidence, separate from byte correctness, from one console executable under the startup debugger:

  • With the old answer, 18 reads were refused during first-run setup in every run, each with the
    executable's own check firing once. With this answer both counts were 0 to the same screen.
  • Over that executable's archives, all 49,089 resources of the family it places in 4 KiB blocks
    (272 shape groups) are spaced exactly at the answered size. These are counts only.
  • Desktop D3D12 asked at 4 KiB alignment answered 0x2000 for 128x4 R16G16B16A16, where the 4 KiB layout
    takes 0x4000.

Follow-up:

  • the real 4 KiB tiling plan in place of the compact plan (with #1469);
  • arrays, and the 1D and 3D requests that also ask at 4 KiB alignment.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6594926604 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2133). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-25T01:21:33Z. --- ## Change A console executable asks the device's allocation-info entries (slots 25 and 108) with `Alignment` 0x1000 for a texture that is not a render or depth target and whose top level, padded to 4 KiB blocks, holds at most 0x80007 bits. It keeps the answer only when the returned alignment is 0x1000. `sanitized()` dropped that request, so the stand-in forwarded the desktop answer: 64 KiB at 64 KiB alignment. With that answer the executable records 16 pages for a texture the console sizes at one. Its streaming read for that texture then runs 64 KiB through the following resources' compressed chunks and ends inside one of them. The executable's own check rejects that read before submitting it, and the storage stand-in refuses the request. This change corrects the size answer, so storage receives whole-chunk requests and publishes the range it actually wrote (#1914). What changes: - **Allocation answer.** For a description in scope, both slots answer 4 KiB alignment and the GFX10 4 KiB thin-block size as AMD addrlib computes it (`src/startup_stubs/small_texture_4k.h`). Each level is padded to whole blocks until the first level no wider than half a block and no taller than a block; that level and every smaller one share one block. - **Scope.** In scope: a 2D texture with layout UNKNOWN, `Alignment` 0x1000, one sample, one array slice, power-of-two sides up to 16384, `MipLevels` 0 up to the full chain, and no render-target or depth flag. The format must be single-plane at 4/8/16/32/64/128 bits a texel. The texture must be within the executable's bound, and the desktop answer must not be a failure. Anything else, alignment 0 included, keeps the desktop answer. - **One plan for every call that touches the memory.** The desktop linear footprint can exceed the answer (32x32 R8G8B8A8: 0x1f80 bytes). For such a description, XG slot 2 (layout records), XG slot 8 (copy) and texture upload all use one compact linear plan: rows at their exact byte width (texels or 4x4 blocks), levels back to back. The plan ends inside the answer for every accepted shape. - Slot 8 writes every row of a level, or nothing. A row pitch shorter than a row, or a level past the last one, fails without writing or announcing a write. - The texels are linear, not the console's 4 KiB swizzle. Bytes an application streams into such a texture in the console's 4 KiB tiled order are therefore still not displayed correctly, as on `main`. The difference is that the upload now reads strictly inside the allocation; `main` read the 256-byte-pitch footprint, which ran past it. - An address-only single-element texture (#2157) keeps its footprint path: its one texel fits inside any answer. Overlap with #1469: its `Gfx10Texture` uses the same tail rule, and its `gfx10_swizzle_from_desc` picks `SW_64KB_S` for layout UNKNOWN. For descriptions this change answers at `Alignment` 0x1000, that side should choose `SW_4KB_S`. Its 4 KiB tiling plan can then replace the compact plan: the plan is used in exactly three places (slot 2, slot 8, upload). This PR does not depend on #1469. Refs #1914. AI-assisted (Claude Code). ## Verification Release build at `d340e464`, Windows 11 build 26300, debug layer off. Adapters: - WARP: Microsoft Basic Render Driver 10.0.26100.10068. - Hardware: NVIDIA GeForce RTX 5090, driver 32.0.16.2135. addrlib from `python tools/fetch_addrlib.py` (Mesa 25.1.0, 5c142e46). ``` ctest --preset release --no-tests=error -R "^(startup_small_texture_4k|startup_xg_|startup_address_single_element)" -V ``` Result: 20 of 20 passed, 0 failed, 0 skipped. Every device test ran on both WARP and the hardware adapter. The other draw tests that use the edited stream consumer (`^startup_(packed_target_draw|stream_|mrt_|logical_view|slot57_blend_draw|placed_vertex|address_srv|address_buffer_srv)`) also pass: 26 of 27, with 1 capability skip. `startup_logical_view_warp` skips because the adapter accepts the descriptor count directly. The tests: - `startup_small_texture_4k`, device-free: - 15 literal sizes and 19 refused descriptions; - all 256 format values against a literal DXGI bits-per-texel table; - extents, and literal compact plans for three shapes; - for all 4,943 accepted shapes: the plan ends inside the answer, and no tail holds more than 7 levels. - `startup_small_texture_4k_whole_width_tail_control` expects a tail one block wide and must fail. - `startup_small_texture_4k_addrlib`: 4,943 shapes against addrlib `ADDR_SW_4KB_S`, 0 mismatches. It skips (77) without addrlib. - `startup_small_texture_4k_device_warp` and `_hardware`: slots 25 and 108 give the 4 KiB answer for 3 descriptions and the desktop answer for 3 controls. - `startup_small_texture_4k_xg` uses a 32x32 R8G8B8A8 texture with 2 mips at 0x1000: - slot 2 gives total 0x2000 at 0x1000, mip 0 at 0 (128-byte rows) and mip 1 at 0x1000 (64-byte rows); - slot 8 writes both mips into exactly 0x2000 bytes followed by a no-access guard page, with distinct rows in both halves and per-mip sentinels; - memory equals the plan byte for byte, and the rest keeps its fill; - a short pitch and level 2 fail with memory unchanged; - at alignment 0, slot 2 reports 0x10000 and slot 8 writes 32 of 32 rows, as on main. - `startup_small_texture_4k_xg_no_limit_control`: at an explicit 64 KiB alignment the desktop footprint does not fit before the guard page, so the run must fail. - `startup_small_texture_4k_draw_warp` and `_hardware`: the same texture is written through slot 8 in front of a guard page, placed (slot 133), sampled at both mips by a translated draw, and all 1,536 read-back pixels are compared. - The existing `startup_xg_*` tests pass unchanged. Mutants, each run against the tests above: 8 of 8 killed. "Slot 8 rows at the caller's pitch" survived at first, because every copy used a tight pitch. The XG check now copies mip 0 from a source with padded 160-byte rows, which kills it. - upload ignores the plan; - slot 8 rows at the caller's pitch; - slot 2 level offsets set to 0; - slot 8 accepts a short pitch; - plan levels 256-byte aligned; - BC4 at 8 bits; - tail one block wide; - limit applied at alignment 0 too. ## Evidence and follow-up Byte correctness rests on the fixtures above, which are synthetic. The addrlib oracle is optional, MIT-licensed and not vendored. Author evidence, separate from byte correctness, from one console executable under the startup debugger: - With the old answer, 18 reads were refused during first-run setup in every run, each with the executable's own check firing once. With this answer both counts were 0 to the same screen. - Over that executable's archives, all 49,089 resources of the family it places in 4 KiB blocks (272 shape groups) are spaced exactly at the answered size. These are counts only. - Desktop D3D12 asked at 4 KiB alignment answered 0x2000 for 128x4 R16G16B16A16, where the 4 KiB layout takes 0x4000. Follow-up: - the real 4 KiB tiling plan in place of the compact plan (with #1469); - arrays, and the 1D and 3D requests that also ask at 4 KiB alignment. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
R0Y00 commented 2026-11-25 02:01:52 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T01:28:06Z.

Review: CHANGES_REQUESTED


The 4 KiB size calculation is useful and the arithmetic fixture passes locally. I also reproduced the acceptance gap with the real XG shim: a 32x32 RGBA8 texture is advertised as 4 KiB, its mip footprint extends past that allocation, and slot 8 returns S_OK after writing only 16 of 32 rows. The translated upload then fills missing rows with zeros. Please keep the public layout, full copy and upload consistent for every shape that gets the new allocation answer. Use one shared compact or tiled plan across the relevant calls, or restrict the production answer to a proven complete subset and report unsupported copies without writing or announcing a new generation. A separate arithmetic-only PR can move first. Verify distinct rows in both halves, two mips with different sentinels, a guard at the returned allocation end, and actual rendered/read-back pixels. Coordinate the shared tiling code with #1469. Keep the observed application count improvement as author evidence, separate from the byte-correctness requirement.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6050163787 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2133#pullrequestreview-6050163787). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T01:28:06Z. **Review:** CHANGES_REQUESTED --- The 4 KiB size calculation is useful and the arithmetic fixture passes locally. I also reproduced the acceptance gap with the real XG shim: a 32x32 RGBA8 texture is advertised as 4 KiB, its mip footprint extends past that allocation, and slot 8 returns S_OK after writing only 16 of 32 rows. The translated upload then fills missing rows with zeros. Please keep the public layout, full copy and upload consistent for every shape that gets the new allocation answer. Use one shared compact or tiled plan across the relevant calls, or restrict the production answer to a proven complete subset and report unsupported copies without writing or announcing a new generation. A separate arithmetic-only PR can move first. Verify distinct rows in both halves, two mips with different sentinels, a guard at the returned allocation end, and actual rendered/read-back pixels. Coordinate the shared tiling code with #1469. Keep the observed application count improvement as author evidence, separate from the byte-correctness requirement.
tedin7 commented 2026-11-25 02:01:52 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T01:41:53Z.

Review: COMMENTED


Review of head 75287587ae0e0bc0f9075fd7f2fb2bd98a28ad9f (comment only, no approval).

Summary: The size rule matches the GFX10 4 KiB thin-block layout. I checked the block table by hand: 128x64 at 4 bits, 64x64 at 8, 64x32 at 16, 32x32 at 32, 32x16 at 64 and 16x16 at 128 all give 4096 bytes. Scope checks, the failure passthrough (~0ull), slots 25 and 108, the XG layout and the upload and copy limits read correctly. CI is green on the Windows build and the Linux Python checks. The /O2 job and the chart job were skipped. Mergeable state was UNKNOWN when I looked. No P1 found. Two P2 items and one nit are below.

Commands executed locally (PR worktree, origin/main...HEAD):

  • git diff --stat origin/main...HEAD: 9 files, +714/-17.
  • python3 tests/docs_links_check.py: pass (18 files, 391 links).
  • python3 tests/bidi_controls_check.py: pass.
  • git diff --check origin/main...HEAD: FAILS, see P2-1.
  • Built tests/startup_small_texture_4k_check.cpp with x86_64-w64-mingw32-g++ -std=c++17 -Isrc and ran it under wine. The file as committed does not compile, see P2-1. With only the CR bytes removed, the run prints PASS (14 sizes, 19 refused descriptions, 256 format values, extent and span limits).

P2-1: tests/startup_small_texture_4k_check.cpp has CRLF line endings, plus a raw CR inside a string literal.

  • All 255 lines end in CRLF. Sibling tests such as tests/startup_tile64_plan_check.cpp are LF.
  • This is why git diff --check reports trailing whitespace on every line.
  • Line 116 is std::printf("FAIL 2x2 BC1: a desktop failure was replaced<CR>\n");. The raw CR sits inside the string.
  • MSVC accepts it, which is why the Windows CI job passes. GCC and clang reject it with missing terminating " character.
  • Fix: convert the file to LF and put \n on that line normally.

P2-2: the 8-level tail limit is not covered by the device-free literal run.

  • Mutation: in small_texture_4k_bytes, change mips - m <= 8 to mips - m <= 7.
  • Result: the literal test still passes (rc=0).
  • Only the --addrlib run, which skips with 77 when addrlib is absent, would compare these shapes. Please add one literal case whose tail level is chosen by the 8-level limit rather than by the half-block width, for example a case with more than 8 mips remaining where the width and height test is already true.

Mutations run (each reverted with git checkout -- .):

  • h <= b.height changed to h <= b.height * 2: killed (FAIL 64x128 BC1 5 mips).
  • mips - m <= 8 changed to <= 7: survived (P2-2).
  • offset >= extent changed to offset > extent in small_texture_4k_within: survived. This one is an equivalent mutant, because the clamp returns 0 either way.
  • 0x80007 changed to 0x80008: survived. Also equivalent, because padded bit counts are multiples of 4096.

Nit: the doc and header say that XG mip records still describe the desktop footprint beyond the answer. That limit is documented in the code comment and handled by clamping in slot 8.

Windows proof: I did not run python3 $P win2025. The Windows CI build and test job passed on this head (I did not inspect which tests it ran). A Win2025 run on the final head after the P2 fixes is still worth doing before this goes to Ready.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6050306409 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2133#pullrequestreview-6050306409). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T01:41:53Z. **Review:** COMMENTED --- Review of head `75287587ae0e0bc0f9075fd7f2fb2bd98a28ad9f` (comment only, no approval). **Summary:** The size rule matches the GFX10 4 KiB thin-block layout. I checked the block table by hand: 128x64 at 4 bits, 64x64 at 8, 64x32 at 16, 32x32 at 32, 32x16 at 64 and 16x16 at 128 all give 4096 bytes. Scope checks, the failure passthrough (`~0ull`), slots 25 and 108, the XG layout and the upload and copy limits read correctly. CI is green on the Windows build and the Linux Python checks. The `/O2` job and the chart job were skipped. Mergeable state was `UNKNOWN` when I looked. No P1 found. Two P2 items and one nit are below. **Commands executed locally** (PR worktree, `origin/main...HEAD`): - `git diff --stat origin/main...HEAD`: 9 files, +714/-17. - `python3 tests/docs_links_check.py`: pass (18 files, 391 links). - `python3 tests/bidi_controls_check.py`: pass. - `git diff --check origin/main...HEAD`: **FAILS**, see P2-1. - Built `tests/startup_small_texture_4k_check.cpp` with `x86_64-w64-mingw32-g++ -std=c++17 -Isrc` and ran it under wine. The file as committed does **not compile**, see P2-1. With only the CR bytes removed, the run prints `PASS (14 sizes, 19 refused descriptions, 256 format values, extent and span limits)`. **P2-1: `tests/startup_small_texture_4k_check.cpp` has CRLF line endings, plus a raw CR inside a string literal.** - All 255 lines end in CRLF. Sibling tests such as `tests/startup_tile64_plan_check.cpp` are LF. - This is why `git diff --check` reports trailing whitespace on every line. - Line 116 is `std::printf("FAIL 2x2 BC1: a desktop failure was replaced<CR>\n");`. The raw CR sits inside the string. - MSVC accepts it, which is why the Windows CI job passes. GCC and clang reject it with `missing terminating " character`. - Fix: convert the file to LF and put `\n` on that line normally. **P2-2: the 8-level tail limit is not covered by the device-free literal run.** - Mutation: in `small_texture_4k_bytes`, change `mips - m <= 8` to `mips - m <= 7`. - Result: the literal test still passes (`rc=0`). - Only the `--addrlib` run, which skips with 77 when addrlib is absent, would compare these shapes. Please add one literal case whose tail level is chosen by the 8-level limit rather than by the half-block width, for example a case with more than 8 mips remaining where the width and height test is already true. **Mutations run** (each reverted with `git checkout -- .`): - `h <= b.height` changed to `h <= b.height * 2`: killed (`FAIL 64x128 BC1 5 mips`). - `mips - m <= 8` changed to `<= 7`: **survived** (P2-2). - `offset >= extent` changed to `offset > extent` in `small_texture_4k_within`: survived. This one is an equivalent mutant, because the clamp returns 0 either way. - `0x80007` changed to `0x80008`: survived. Also equivalent, because padded bit counts are multiples of 4096. **Nit:** the doc and header say that XG mip records still describe the desktop footprint beyond the answer. That limit is documented in the code comment and handled by clamping in slot 8. **Windows proof:** I did not run `python3 $P win2025`. The Windows CI build and test job passed on this head (I did not inspect which tests it ran). A Win2025 run on the final head after the P2 fixes is still worth doing before this goes to Ready. AI-assisted; commands listed were executed locally.
NiiRoZz commented 2026-11-25 03:01:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T02:58:26Z.


Thanks, agreed. Fixed in d340e464 with the first option: one plan for every call.

For every shape that gets the 4 KiB answer, XG slot 2, XG slot 8 and texture upload now use one compact
linear plan. Rows have their exact byte width, and levels follow each other.

  • Fit. The plan ends inside the answer for all 4,943 accepted shapes; the device-free test checks
    each one.
  • Slot 2 describes exactly what slot 8 writes and upload reads.
  • Slot 8 writes every row of a level or nothing. A short pitch or a level past the last fails
    without writing or announcing a write.
  • Upload reads the same rows; nothing is zero-filled.
  • Alignment 0 is unchanged from main.

New checks:

  • the XG check uses a two-mip 32x32 texture with distinct rows in both halves and a different sentinel
    per mip, written into exactly the returned size before a guard page and compared byte for byte;
  • refused copies leave memory unchanged;
  • a draw check places that texture, samples both mips, and compares all 1,536 read-back pixels on WARP
    and on hardware.

The plan's texels are linear, not the 4 KiB swizzle, so bytes streamed in the console's tiled order are still not displayed correctly, as on main; the upload now reads strictly inside the allocation. It is used in exactly those three places, so
#1469's 4 KiB tiling plan can replace it there. That side would also need to pick SW_4KB_S for these
descriptions. The application counts are now listed as author evidence, separately from the byte
checks.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7151444834 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2133#issuecomment-7151444834). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-25T02:58:26Z. --- Thanks, agreed. Fixed in `d340e464` with the first option: one plan for every call. For every shape that gets the 4 KiB answer, XG slot 2, XG slot 8 and texture upload now use one compact linear plan. Rows have their exact byte width, and levels follow each other. - **Fit.** The plan ends inside the answer for all 4,943 accepted shapes; the device-free test checks each one. - **Slot 2** describes exactly what slot 8 writes and upload reads. - **Slot 8** writes every row of a level or nothing. A short pitch or a level past the last fails without writing or announcing a write. - **Upload** reads the same rows; nothing is zero-filled. - **Alignment 0** is unchanged from main. New checks: - the XG check uses a two-mip 32x32 texture with distinct rows in both halves and a different sentinel per mip, written into exactly the returned size before a guard page and compared byte for byte; - refused copies leave memory unchanged; - a draw check places that texture, samples both mips, and compares all 1,536 read-back pixels on WARP and on hardware. The plan's texels are linear, not the 4 KiB swizzle, so bytes streamed in the console's tiled order are still not displayed correctly, as on `main`; the upload now reads strictly inside the allocation. It is used in exactly those three places, so #1469's 4 KiB tiling plan can replace it there. That side would also need to pick `SW_4KB_S` for these descriptions. The application counts are now listed as author evidence, separately from the byte checks. AI-assisted (Claude Code).
NiiRoZz commented 2026-11-25 03:01:25 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T02:58:27Z.


Thanks, both fixed in d340e464.

  • P2-1. The test file is LF again, the stray CR inside the string literal is gone, and
    git diff --check against the merge base is clean.
  • P2-2. No in-scope shape can make the 8-level cap matter. A 4 KiB thin tail fits at most 64 texels
    along its longer side, so at most 7 levels can be in it. That makes mips - m <= 7 equivalent to the
    original on every shape.
    • I removed the clause instead of keeping dead code.
    • The device-free test now asserts, over all 4,943 accepted shapes, that no tail holds more than 7
      levels.
    • A literal case (64x64 BC1, full chain, all 7 levels in one block) kills <= 6.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7151445563 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2133#issuecomment-7151445563). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-25T02:58:27Z. --- Thanks, both fixed in `d340e464`. - **P2-1.** The test file is LF again, the stray CR inside the string literal is gone, and `git diff --check` against the merge base is clean. - **P2-2.** No in-scope shape can make the 8-level cap matter. A 4 KiB thin tail fits at most 64 texels along its longer side, so at most 7 levels can be in it. That makes `mips - m <= 7` equivalent to the original on every shape. - I removed the clause instead of keeping dead code. - The device-free test now asserts, over all 4,943 accepted shapes, that no tail holds more than 7 levels. - A literal case (64x64 BC1, full chain, all 7 levels in one block) kills `<= 6`. AI-assisted (Claude Code).
tedin7 commented 2026-11-25 04:03:55 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T03:03:05Z.

Review: COMMENTED


Review of head d340e4645b1d8e62df08910560aa878b6b99fe2c (comment only, no approval).

Summary: This head is reworked since the earlier review (13 files, +1085/-10). The 4 KiB size rule and the new compact linear plan for XG slots 2 and 8 read correctly. The earlier CRLF problem is gone. No P1 and no P2 found. CI is green on the Windows build and test job, the gfx1013 job and the Linux Python checks. The /O2 and chart jobs were skipped. The PR is mergeable and the title is neutral.

Commands executed locally (PR worktree, origin/main...HEAD):

  • git diff --stat origin/main...HEAD: 13 files, +1085/-10.
  • python3 tests/docs_links_check.py: pass (18 files, 401 links).
  • python3 tests/bidi_controls_check.py: pass (1461 files).
  • git diff --check origin/main...HEAD: clean. git ls-files --eol shows LF on all four new test files.
  • Built tests/startup_small_texture_4k_check.cpp with x86_64-w64-mingw32-g++ -std=c++17 -Isrc and ran it under wine: PASS (15 sizes, 19 refused descriptions, 256 format values, extents, compact plans), 4943 accepted shapes, 0 past the answer.

Mutations run (each reverted with git checkout -- .):

  • Tail test w <= b.width / 2 changed to w <= b.width: killed (7 failures).
  • Compressed row bytes bits * 2 changed to bits in the plan: killed (2 failures).
  • Bound 0x80007 doubled: killed (4 failures).
  • Dropping mips > 1 && in small_texture_4k_bytes: survived. This is an equivalent mutant: with one level the tail branch returns one block, the same as the loop.

Notes (nit, no action needed):

  • small_texture_4k.h states that the XG mip records beyond the answer are compact. The device and XG tests (guard page, no-limit control) cover this, but they need Windows, so I did not run them.
  • The texels are linear, not the console swizzle. The header says so and points to a later tiling plan.

Windows proof: I did not run python3 $P win2025. The Windows CI job passed on this head. A Win2025 run is still worth doing before Ready, because the change touches the device wrapper, XG stubs and the draw path.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6051235131 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2133#pullrequestreview-6051235131). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T03:03:05Z. **Review:** COMMENTED --- Review of head `d340e4645b1d8e62df08910560aa878b6b99fe2c` (comment only, no approval). **Summary:** This head is reworked since the earlier review (13 files, +1085/-10). The 4 KiB size rule and the new compact linear plan for XG slots 2 and 8 read correctly. The earlier CRLF problem is gone. No P1 and no P2 found. CI is green on the Windows build and test job, the gfx1013 job and the Linux Python checks. The `/O2` and chart jobs were skipped. The PR is mergeable and the title is neutral. **Commands executed locally** (PR worktree, `origin/main...HEAD`): - `git diff --stat origin/main...HEAD`: 13 files, +1085/-10. - `python3 tests/docs_links_check.py`: pass (18 files, 401 links). - `python3 tests/bidi_controls_check.py`: pass (1461 files). - `git diff --check origin/main...HEAD`: clean. `git ls-files --eol` shows LF on all four new test files. - Built `tests/startup_small_texture_4k_check.cpp` with `x86_64-w64-mingw32-g++ -std=c++17 -Isrc` and ran it under wine: `PASS (15 sizes, 19 refused descriptions, 256 format values, extents, compact plans)`, 4943 accepted shapes, 0 past the answer. **Mutations run** (each reverted with `git checkout -- .`): - Tail test `w <= b.width / 2` changed to `w <= b.width`: killed (7 failures). - Compressed row bytes `bits * 2` changed to `bits` in the plan: killed (2 failures). - Bound `0x80007` doubled: killed (4 failures). - Dropping `mips > 1 &&` in `small_texture_4k_bytes`: survived. This is an equivalent mutant: with one level the tail branch returns one block, the same as the loop. **Notes (nit, no action needed):** - `small_texture_4k.h` states that the XG mip records beyond the answer are compact. The device and XG tests (guard page, `no-limit` control) cover this, but they need Windows, so I did not run them. - The texels are linear, not the console swizzle. The header says so and points to a later tiling plan. **Windows proof:** I did not run `python3 $P win2025`. The Windows CI job passed on this head. A Win2025 run is still worth doing before Ready, because the change touches the device wrapper, XG stubs and the draw path. AI-assisted; commands listed were executed locally.
thepatrickworld commented 2026-11-25 04:04:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-25T03:42:06Z.


Ran the draw on hardware, since it needs startup_stream_consumer built first:

hardware: small4k draw matched all 1536 reference pixels (32 + 16 distinct rows, two mips)

RX 9070 XT, driver 32.0.32029.2010. The exact-size allocation, the no-access guard page and the two mips all read back as the reference, so the 4 KiB answer is not just accepted by the console path but actually writes where the draw reads.

Limits: AMD only, no NVIDIA here; and this tells nothing about the allocation answers other consoles ask for.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7152162017 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2133#issuecomment-7152162017). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-25T03:42:06Z. --- Ran the draw on hardware, since it needs `startup_stream_consumer` built first: ``` hardware: small4k draw matched all 1536 reference pixels (32 + 16 distinct rows, two mips) ``` RX 9070 XT, driver 32.0.32029.2010. The exact-size allocation, the no-access guard page and the two mips all read back as the reference, so the 4 KiB answer is not just accepted by the console path but actually writes where the draw reads. Limits: AMD only, no NVIDIA here; and this tells nothing about the allocation answers other consoles ask for. _AI-assisted._
tedin7 commented 2026-11-25 06:01:16 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T05:54:43Z.

Review: COMMENTED


Review of head c0db8308334d4a6331511aa6670558c6f05036b2 (comment only, no approval).

Summary: This head is the previous reviewed head (d340e464) plus a merge of origin/main. The PR's own files (small_texture_4k.h, xg_xs.cpp, the device and draw hooks, the four new tests) are unchanged by the merge, so the earlier read of the 4 KiB size rule and the compact plan still applies. No P1 and no P2 found. CI: Windows build and test, gfx1013 and Linux Python checks pass; the /O2 and chart jobs are skipped. The PR is mergeable and the title is neutral.

Commands executed locally (PR worktree, origin/main...HEAD):

  • git diff --stat origin/main...HEAD: 13 files, +1084/-10.
  • python3 tests/docs_links_check.py: pass (18 files, 409 links).
  • python3 tests/bidi_controls_check.py: pass (1501 files).
  • git diff --check origin/main...HEAD: clean.
  • Built tests/startup_small_texture_4k_check.cpp with x86_64-w64-mingw32-g++ -std=c++17 -Isrc and ran it under wine: PASS (15 sizes, 19 refused descriptions, 256 format values, extents, compact plans), 4943 accepted shapes, 0 past the answer.

Mutations run (each reverted with git checkout -- .):

  • 32x16 block for 64-bit texels changed to 32x32: killed (82 shapes past the answer, 1 failure).
  • Dropping the Alignment != 0x1000 guard in small_texture_4k: killed (2 failures).
  • Bound 0x80007 changed to 0x8000F: survived. This is an equivalent mutant: the padded bit count is always a multiple of 0x8000, so no value lies between the two bounds.

Not run: the Win2025 WARP job. The merge changed no shader or C++ code of this PR, and the previous head's review already covered the logic. The startup_small_texture_4k_device, _xg and _draw CTest targets need Windows; I only ran the Linux-reachable size test.

P1: none. P2: none.

Nit: none new.

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6052533847 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2133#pullrequestreview-6052533847). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T05:54:43Z. **Review:** COMMENTED --- Review of head `c0db8308334d4a6331511aa6670558c6f05036b2` (comment only, no approval). **Summary:** This head is the previous reviewed head (`d340e464`) plus a merge of `origin/main`. The PR's own files (`small_texture_4k.h`, `xg_xs.cpp`, the device and draw hooks, the four new tests) are unchanged by the merge, so the earlier read of the 4 KiB size rule and the compact plan still applies. No P1 and no P2 found. CI: Windows build and test, gfx1013 and Linux Python checks pass; the `/O2` and chart jobs are skipped. The PR is mergeable and the title is neutral. **Commands executed locally** (PR worktree, `origin/main...HEAD`): - `git diff --stat origin/main...HEAD`: 13 files, +1084/-10. - `python3 tests/docs_links_check.py`: pass (18 files, 409 links). - `python3 tests/bidi_controls_check.py`: pass (1501 files). - `git diff --check origin/main...HEAD`: clean. - Built `tests/startup_small_texture_4k_check.cpp` with `x86_64-w64-mingw32-g++ -std=c++17 -Isrc` and ran it under wine: `PASS (15 sizes, 19 refused descriptions, 256 format values, extents, compact plans)`, 4943 accepted shapes, 0 past the answer. **Mutations run** (each reverted with `git checkout -- .`): - 32x16 block for 64-bit texels changed to 32x32: killed (82 shapes past the answer, 1 failure). - Dropping the `Alignment != 0x1000` guard in `small_texture_4k`: killed (2 failures). - Bound `0x80007` changed to `0x8000F`: survived. This is an equivalent mutant: the padded bit count is always a multiple of 0x8000, so no value lies between the two bounds. **Not run:** the Win2025 WARP job. The merge changed no shader or C++ code of this PR, and the previous head's review already covered the logic. The `startup_small_texture_4k_device`, `_xg` and `_draw` CTest targets need Windows; I only ran the Linux-reachable size test. **P1:** none. **P2:** none. **Nit:** none new. AI-assisted; commands listed were executed locally.
NiiRoZz commented 2026-11-25 06:01:39 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by NiiRoZz on 2026-11-25T05:48:52Z.


Merged current main into the branch (c0db8308) to clear the conflict in d3d12_draw.inl: upload_texture now returns a bool and #2214 added a console-layout total there. Upstream's code is kept and the compact plan sits beside it; its early exits return true like the neighbouring ones.

I checked that the fence-safe sampling path from #2214 cannot bypass the plan: it requires a console swizzle mode in Layout, while the 4 KiB answer requires layout UNKNOWN, so the two never apply to the same texture. Single-element textures stay on their own path.

Behaviour is unchanged. Re-run on the merged head, WARP and RTX 5090: ctest --preset release --no-tests=error -R "^(startup_small_texture_4k|startup_xg_|startup_address_single_element)" gives 20 of 20 passed, including both draw checks; git diff --check is clean.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154163636 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2133#issuecomment-7154163636). Originally posted by [NiiRoZz](https://github.com/NiiRoZz) on 2026-11-25T05:48:52Z. --- Merged current `main` into the branch (`c0db8308`) to clear the conflict in `d3d12_draw.inl`: `upload_texture` now returns a bool and #2214 added a console-layout total there. Upstream's code is kept and the compact plan sits beside it; its early exits return true like the neighbouring ones. I checked that the fence-safe sampling path from #2214 cannot bypass the plan: it requires a console swizzle mode in `Layout`, while the 4 KiB answer requires layout UNKNOWN, so the two never apply to the same texture. Single-element textures stay on their own path. Behaviour is unchanged. Re-run on the merged head, WARP and RTX 5090: `ctest --preset release --no-tests=error -R "^(startup_small_texture_4k|startup_xg_|startup_address_single_element)"` gives 20 of 20 passed, including both draw checks; `git diff --check` is clean. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-25 07:00:54 +00:00
R0Y00 commented 2026-11-25 07:00:54 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-25T06:24:17Z.

Review: APPROVED


The previous partial-row finding is resolved by the shared compact plan in allocation info, the XG layout and copy, and the upload reader. Independent Windows Release startup_small_texture_4k coverage: 8 pass, 1 AddrLib capability skip. Both WARP and RTX 4060 Laptop matched 1,536 pixels across two mips with a guard after the reported allocation. The XG no-limit negative also behaved as expected.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6052797112 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2133#pullrequestreview-6052797112). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-25T06:24:17Z. **Review:** APPROVED --- The previous partial-row finding is resolved by the shared compact plan in allocation info, the XG layout and copy, and the upload reader. Independent Windows Release startup_small_texture_4k coverage: 8 pass, 1 AddrLib capability skip. Both WARP and RTX 4060 Laptop matched 1,536 pixels across two mips with a guard after the reported allocation. The XG no-limit negative also behaved as expected.
thepatrickworld commented 2026-11-25 12:01:53 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by thepatrickworld on 2026-11-25T11:16:21Z.


Small correction on wording: "the no-access guard page" is not something the log shows, and the fixture does not mention a guard page either. Strike it.

What the run does show, verbatim:

small4k: slot 2 total 0x2000 alignment 0x1000
x2w-draw texture upload ... 32x32 x1 mips 2 format 28 ... (compact plan of the 4 KiB allocation answer)
hardware: small4k draw matched all 1536 reference pixels (32 + 16 distinct rows, two mips)

So the claim worth keeping is the exact-size allocation (0x2000, aligned 0x1000, a 4 KiB answer) and the two mips, not a guard page I cannot point to.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7160825380 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2133#issuecomment-7160825380). Originally posted by [thepatrickworld](https://github.com/thepatrickworld) on 2026-11-25T11:16:21Z. --- Small correction on wording: "the no-access guard page" is not something the log shows, and the fixture does not mention a guard page either. Strike it. What the run does show, verbatim: ``` small4k: slot 2 total 0x2000 alignment 0x1000 x2w-draw texture upload ... 32x32 x1 mips 2 format 28 ... (compact plan of the 4 KiB allocation answer) hardware: small4k draw matched all 1536 reference pixels (32 + 16 distinct rows, two mips) ``` So the claim worth keeping is the exact-size allocation (0x2000, aligned 0x1000, a 4 KiB answer) and the two mips, not a guard page I cannot point to. _AI-assisted._
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!2125
No description provided.