Textures: require thick 3D mip-tail levels to fit within block depth #1604

Open
OtavioTadeu wants to merge 1 commit from upstream-pr/1614 into main
OtavioTadeu commented 2026-11-24 18:15:12 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by OtavioTadeu on 2026-11-24T18:15:12Z.


What is in it

  • Addresses XCL-BT-014 (Part of #1488): track padded depth in tiling::Chain::new_3d and include per-axis thick block depth bounds (td, halving bh/bw/bd by blk % 3) when selecting first_tail for thick 3D layouts.
  • Add thick_3d_mip_tail_respects_block_depth unit test covering 4 KiB and 64 KiB thick 3D mip chains and volume tile/detile round-trips.

Tested

  • hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce GTX 1660 SUPER (driver 32.0.16.1088, Turing wave32), AMD Ryzen 5 5600G, Windows 11 26200, rustc 1.100.0, debug
  • cargo test -p xcl --lib gpu::tiling: 15 passed, 0 failed
  • cargo test --workspace -- --test-threads=4: 777 passed, 0 failed, 41 ignored (SKIPPED GPU tests: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask [no wave64], gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware [no wave64], heap_window_out_of_memory_falls_back_to_the_switch_form [no heap windows])

Regression run

  • scripts/smoke.ps1 -Game retail_title -Seconds 60 (main baseline vs PR head on NVIDIA GeForce GTX 1660 SUPER):

xcl-smoke v1

commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485

gpu: NVIDIA GeForce GTX 1660 SUPER

title: retail_title

seconds: 60

exit: 0x0

frames shown: 631 (PresentX 631)

presents per 2 s (last 3): 47 47 49

device removals: 0

crashes: 0

peak commit: 15199 MB


xcl-smoke v1

commit: f2ba8f443a022677f74632a4170e28c4079e8f2e

gpu: NVIDIA GeForce GTX 1660 SUPER

title: retail_title

seconds: 60

exit: 0x0

frames shown: 639 (PresentX 639)

presents per 2 s (last 3): 49 40 38

device removals: 0

crashes: 0

peak commit: 15193 MB

Not tested

  • AMD / Intel / native wave64 GPUs, Linux/Wine, and extended gameplay past the 60 s smoke window

AI use

  • Antigravity (Gemini 4 Neon) implemented the depth-bounds fix, unit test, and commit message; human reviewed.
<!-- greyfinch-sync:ivall/xcl:issue:5477806149 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1614). Originally posted by [OtavioTadeu](https://github.com/OtavioTadeu) on 2026-11-24T18:15:12Z. --- **What is in it** - Addresses `XCL-BT-014` (Part of #1488): track padded depth in `tiling::Chain::new_3d` and include per-axis thick block depth bounds (`td`, halving `bh`/`bw`/`bd` by `blk % 3`) when selecting `first_tail` for thick 3D layouts. - Add `thick_3d_mip_tail_respects_block_depth` unit test covering 4 KiB and 64 KiB thick 3D mip chains and volume tile/detile round-trips. **Tested** - hardware (GPU + driver, CPU), Rust version, debug / release: NVIDIA GeForce GTX 1660 SUPER (driver 32.0.16.1088, Turing wave32), AMD Ryzen 5 5600G, Windows 11 26200, rustc 1.100.0, debug - `cargo test -p xcl --lib gpu::tiling`: 15 passed, 0 failed - `cargo test --workspace -- --test-threads=4`: 777 passed, 0 failed, 41 ignored (SKIPPED GPU tests: `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask` [no wave64], `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware` [no wave64], `heap_window_out_of_memory_falls_back_to_the_switch_form` [no heap windows]) **Regression run** - `scripts/smoke.ps1 -Game retail_title -Seconds 60` (`main` baseline vs PR head on NVIDIA GeForce GTX 1660 SUPER): ``` xcl-smoke v1 commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485 gpu: NVIDIA GeForce GTX 1660 SUPER title: retail_title seconds: 60 exit: 0x0 frames shown: 631 (PresentX 631) presents per 2 s (last 3): 47 47 49 device removals: 0 crashes: 0 peak commit: 15199 MB ``` ``` xcl-smoke v1 commit: f2ba8f443a022677f74632a4170e28c4079e8f2e gpu: NVIDIA GeForce GTX 1660 SUPER title: retail_title seconds: 60 exit: 0x0 frames shown: 639 (PresentX 639) presents per 2 s (last 3): 49 40 38 device removals: 0 crashes: 0 peak commit: 15193 MB ``` **Not tested** - AMD / Intel / native wave64 GPUs, Linux/Wine, and extended gameplay past the 60 s smoke window **AI use** - Antigravity (Gemini 4 Neon) implemented the depth-bounds fix, unit test, and commit message; human reviewed.
Anon64 commented 2026-11-24 19:07:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-24T18:23:33Z.


Regression run for this PR: head f2ba8f4, based on main 9e3831e. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, XCL_NETWORK=0, A pressed every 4 s from 20 s, scripts/smoke.ps1 on a retail title for 60 s, back to back with the main run.

main 9e3831e:

xcl-smoke v1
commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1587 (PresentX 1588)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 99220 MB

this PR:

xcl-smoke v1
commit: f2ba8f443a022677f74632a4170e28c4079e8f2e
gpu: NVIDIA GeForce RTX 3060
title: retail-title
seconds: 60
exit: 0x0
frames shown: 1515 (PresentX 1515)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 94751 MB

No device removals or crashes; 95 % of main's frames, 95 % of its peak commit.

Peak commit on this machine is mostly the pipeline preload's DXC compiles (#1035) and varies a lot from run to run, so it says little about this PR.

Not tested: the whole suite; whether the title reaches the changed code in these 60 s.

Written with Claude Code (Claude Opus 5.5) from runs on this machine.

<!-- greyfinch-sync:ivall/xcl:comment:7140580142 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1614#issuecomment-7140580142). Originally posted by [Anon64](https://github.com/Anon64) on 2026-11-24T18:23:33Z. --- Regression run for this PR: head `f2ba8f4`, based on `main` `9e3831e`. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release, `XCL_NETWORK=0`, A pressed every 4 s from 20 s, `scripts/smoke.ps1` on a retail title for 60 s, back to back with the `main` run. main `9e3831e`: ``` xcl-smoke v1 commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485 gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1587 (PresentX 1588) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 99220 MB ``` this PR: ``` xcl-smoke v1 commit: f2ba8f443a022677f74632a4170e28c4079e8f2e gpu: NVIDIA GeForce RTX 3060 title: retail-title seconds: 60 exit: 0x0 frames shown: 1515 (PresentX 1515) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 94751 MB ``` No device removals or crashes; 95 % of main's frames, 95 % of its peak commit. Peak commit on this machine is mostly the pipeline preload's DXC compiles (#1035) and varies a lot from run to run, so it says little about this PR. **Not tested:** the whole suite; whether the title reaches the changed code in these 60 s. Written with Claude Code (Claude Opus 5.5) from runs on this machine.
futurepro62 commented 2026-11-24 19:07:53 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T19:00:28Z.


Full-suite run, since this PR has no test report yet. Tested exact head f2ba8f4 (on its base 9e3831e).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form: 776 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: thick_3d_mip_tail_respects_block_depth.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 777 passed, 0 failed, 41 ignored. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • heap_window_out_of_memory_falls_back_to_the_switch_form was skipped with --skip. It fails on main 9e3831e too, not because of this PR: under XCL_REQUIRE_GPU=mesh, runner::skip_test turns every skip except "no wave64" into a failure, including this test's opt-in "no heap windows" skip (XCL_HEAP_WINDOWS unset). Reported as #1651.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7141459532 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1614#issuecomment-7141459532). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T19:00:28Z. --- Full-suite run, since this PR has no test report yet. Tested exact head `f2ba8f4` (on its base `9e3831e`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed. - `cargo build --workspace`, then `XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form`: **776 passed, 0 failed, 41 ignored**. SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware`. - The new tests ran and passed: `thick_3d_mip_tail_respects_block_depth`. - Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, `XCL_ADAPTER=radeon`), `cargo test --workspace -- --test-threads=4`: **777 passed, 0 failed, 41 ignored**. SKIPPED: `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - `heap_window_out_of_memory_falls_back_to_the_switch_form` was skipped with `--skip`. It fails on main `9e3831e` too, not because of this PR: under `XCL_REQUIRE_GPU=mesh`, `runner::skip_test` turns every skip except "no wave64" into a failure, including this test's opt-in "no heap windows" skip (`XCL_HEAP_WINDOWS` unset). Reported as #1651. **Not tested** - a release build, a game (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
DavidM1911 commented 2026-11-24 21:09:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T20:30:24Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~22 ignored.

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7143649661 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1614#issuecomment-7143649661). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T20:30:24Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~22 ignored. Thanks!
throny commented 2026-11-25 01:10:37 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-25T00:15:31Z.


Two contributors checked independently and found that #1624 solves the same problem (for #1488) in a different way: #1607, group D50. You may want to compare them with the other author and agree on one, or say in the PR why both are needed.

This is a hint from the community triage in #1607, not a maintainer decision.

AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.

<!-- greyfinch-sync:ivall/xcl:comment:7148319565 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1614#issuecomment-7148319565). Originally posted by [throny](https://github.com/throny) on 2026-11-25T00:15:31Z. --- <!-- xcl-1607-hint:D50 --> Two contributors checked independently and found that #1624 solves the same problem (for #1488) in a different way: #1607, group D50. You may want to compare them with the other author and agree on one, or say in the PR why both are needed. This is a hint from the community triage in #1607, not a maintainer decision. AI use: Claude Code (Claude Opus 5.5), posted by a script from the #1607 table.
JJAutoCompare commented 2026-11-25 05:08:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T05:02:14Z.


Focused Windows verification of XCL PR #1614

Tested head f2ba8f443a022677f74632a4170e28c4079e8f2e on a clean, detached checkout. The PR changes only crates/xcl/src/gpu/tiling.rs.

Tested

  • STOR-WINLAB, AMD Ryzen 7 3800X, Intel Arc A770 (driver 32.0.101.9175), Windows 11 Enterprise Evaluation x64 (build 26200), DXC 1.9.2609.5, and rustc 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). Used unoptimized dev and test profiles with debug info and incremental compilation disabled.
  • cargo build --workspace succeeded. cargo test --workspace --no-run compiled all workspace test targets.
  • cargo test -p xcl --lib gpu::tiling::tests:: -- --nocapture — 15 passed, 0 failed, 0 ignored, 0 SKIPPED lines.
  • cargo test -p xcl --lib gpu::texture::tests:: -- --nocapture --skip gpu::texture::tests::gpu_ --skip gpu::texture::tests::one_dimensional_arrays_ignore_tsharp_height_for_linear_and_tiled_layouts --skip gpu::texture::tests::non_array_2d_ignores_tsharp_depth_for_linear_and_tiled_uploads --skip gpu::texture::tests::retail_ttpf_textures_detile_with_their_mip_chains — 7 passed, 0 failed, 0 ignored, 0 SKIPPED lines.
  • Both focused runs used XCL_ADAPTER=NONE_CPU_ONLY and ran outside the Arc mutex, as did workspace compilation. Parsed totals from pr1614-focused.log were 22 passed, 0 failed, 0 ignored, and 0 lines beginning with SKIPPED .

The new regression test used thick 3D chains with 64 KiB and 4 KiB tiles. In both cases, mips 0 and 1 exceeded the block depth and stayed outside the tail, while mips 2 and 3 entered it. After tiling all four mips into the same allocation, detiling each mip recovered its original bytes. Existing CPU tests also covered non-overlap for other volume layouts and mipped array subresources.

Not tested

Execution was limited to focused CPU texture and tiling tests, alongside full workspace compilation. The full workspace GPU suite, GPU texture uploads, retail texture data, and title smoke runs were omitted.

AI use

T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1614-focused.log and published.

<!-- greyfinch-sync:ivall/xcl:comment:7153390171 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1614#issuecomment-7153390171). Originally posted by [JJAutoCompare](https://github.com/JJAutoCompare) on 2026-11-25T05:02:14Z. --- ## Focused Windows verification of XCL PR #1614 Tested head `f2ba8f443a022677f74632a4170e28c4079e8f2e` on a clean, detached checkout. The PR changes only `crates/xcl/src/gpu/tiling.rs`. **Tested** - STOR-WINLAB, AMD Ryzen 7 3800X, Intel Arc A770 (driver 32.0.101.9175), Windows 11 Enterprise Evaluation x64 (build 26200), DXC 1.9.2609.5, and rustc 1.100.0 (0ef1bc386, x86_64-pc-windows-msvc). Used unoptimized dev and test profiles with debug info and incremental compilation disabled. - `cargo build --workspace` succeeded. `cargo test --workspace --no-run` compiled all workspace test targets. - `cargo test -p xcl --lib gpu::tiling::tests:: -- --nocapture` — 15 passed, 0 failed, 0 ignored, 0 `SKIPPED` lines. - `cargo test -p xcl --lib gpu::texture::tests:: -- --nocapture --skip gpu::texture::tests::gpu_ --skip gpu::texture::tests::one_dimensional_arrays_ignore_tsharp_height_for_linear_and_tiled_layouts --skip gpu::texture::tests::non_array_2d_ignores_tsharp_depth_for_linear_and_tiled_uploads --skip gpu::texture::tests::retail_ttpf_textures_detile_with_their_mip_chains` — 7 passed, 0 failed, 0 ignored, 0 `SKIPPED` lines. - Both focused runs used `XCL_ADAPTER=NONE_CPU_ONLY` and ran outside the Arc mutex, as did workspace compilation. Parsed totals from `pr1614-focused.log` were 22 passed, 0 failed, 0 ignored, and 0 lines beginning with `SKIPPED `. The new regression test used thick 3D chains with 64 KiB and 4 KiB tiles. In both cases, mips 0 and 1 exceeded the block depth and stayed outside the tail, while mips 2 and 3 entered it. After tiling all four mips into the same allocation, detiling each mip recovered its original bytes. Existing CPU tests also covered non-overlap for other volume layouts and mipped array subresources. **Not tested** Execution was limited to focused CPU texture and tiling tests, alongside full workspace compilation. The full workspace GPU suite, GPU texture uploads, retail texture data, and title smoke runs were omitted. **AI use** T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against `pr1614-focused.log` and published.
upstream-sync closed this pull request 2026-11-25 23:07:29 +00:00
CalvyPZ commented 2026-11-25 23:09:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by CalvyPZ on 2026-11-25T22:41:45Z.


This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.

<!-- greyfinch-sync:ivall/xcl:comment:7176678515 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1614#issuecomment-7176678515). Originally posted by [CalvyPZ](https://github.com/CalvyPZ) on 2026-11-25T22:41:45Z. --- This PR has been marked as a duplicate and closed after multiple agreeing checks in #1607. If you believe this is incorrect please re-open with why.
upstream-sync reopened this pull request 2026-11-26 00:04:28 +00:00
Foniass commented 2026-12-01 06:16:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T06:16:31Z.


Triage (#1607) – head f2ba8f4

#1624 makes the same thick-3D mip-tail fix in Chain::new_3d (tiling.rs): it limits the tail by depth, to block_d, or block_d/2 when log2(block) % 3 == 2. This PR was opened first and holds only that fix. #1624 adds unrelated hardening on top: base_xor masking, a linear-mode base_xor of 0, and bounds-safe copies. Neither is on main, which still checks only w/h. This PR conflicts with main and needs a rebase.
No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7302687138 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1614#issuecomment-7302687138). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T06:16:31Z. --- **Triage (#1607)** – head f2ba8f4 #1624 makes the same thick-3D mip-tail fix in `Chain::new_3d` (`tiling.rs`): it limits the tail by depth, to block_d, or block_d/2 when log2(block) % 3 == 2. This PR was opened first and holds only that fix. #1624 adds unrelated hardening on top: base_xor masking, a linear-mode base_xor of 0, and bounds-safe copies. Neither is on main, which still checks only w/h. This PR conflicts with main and needs a rebase. No problems found in the diff. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1614:upstream-pr/1614'
git switch 'upstream-pr/1614'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1614'
git switch 'upstream-pr/1614'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1614'
git switch 'upstream-pr/1614'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1614'
git switch 'main'
git merge --squash 'upstream-pr/1614'
git switch 'main'
git merge --ff-only 'upstream-pr/1614'
git switch 'main'
git merge 'upstream-pr/1614'
git push origin 'main'
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
xcl-dev/xcl!1604
No description provided.