tests: a reserved texture's tiles must agree with the driver's tile shape #484

Closed
Luislariosss wants to merge 1 commit from upstream-pr/489 into main
Luislariosss commented 2026-11-24 00:59:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Luislariosss on 2026-11-24T00:59:46Z.


Follows the proposal in #480. A test only: every added line is inside #[cfg(test)], no production line is touched.

Tested

cargo test --workspace -- --test-threads=4
677 passed, 0 failed, 41 ignored   (16 test binaries; the 41 are benchmarks, probes and
                                    retail-data tools, none environmental)

cargo test -p xcl --lib reserved_texture_tiles -- --nocapture
format 28 8x8: total 1, mip 1 tiles, shape 128x128x1
format 28 256x256: total 4, mip 4 tiles, shape 128x128x1
format 71 256x256: total 1, mip 1 tiles, shape 512x256x1
format 40 8x8: total 1, mip 1 tiles, shape 128x128x1
test result: ok. 1 passed; 0 failed

On: AMD Radeon RX 9060 XT (RDNA4, gfx1200), Adrenalin 26.10.1 (Windows driver 32.0.32015.7029), Windows 11 26200, MSVC 2022, e998fe9.

What it asserts: place rewrites the descriptor to the PC's 64 KiB layout and trusts GetResourceTiling for the page count it maps, so for four shapes of the title's GPU-owned textures (8x8 and 256x256 RGBA8, 256x256 BC1, 8x8 D32) the test checks that total_tiles agrees with WidthInTiles * HeightInTiles * DepthInTiles, that a texture inside one tile reports 1, and that the tiled-resources tier is at least 1. No absolute numbers are asserted: the tile shape is the driver's, so pinning them would fail on another vendor. They are printed, and the doc comment records this card's.

Not tested

No regression run: I do not have the game package, so scripts/smoke.ps1 cannot run here and pr_check.py will ask for xcl-smoke blocks. The file is under crates/xcl/src/, which the checker treats as runtime even though every added line is inside #[cfg(test)] - the case #452 describes.

AI use

Written by an AI agent: the diff was produced by DeepSeek V4.1 Flash, from a proposal worked out with Gemini 4 Neon (T3 Code), and reviewed line by line by the operator, who ran the suites above on the card named. CONTRIBUTING.md does not accept open-weight models for code and pr_check.py names deepseek, so this PR does not meet that rule as written; I am declaring it rather than leaving it out. Close it if the rule is firm - the test itself is short enough to retype, and the numbers above are the part worth keeping.

<!-- greyfinch-sync:ivall/xcl:issue:6572164484 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/489). Originally posted by [Luislariosss](https://github.com/Luislariosss) on 2026-11-24T00:59:46Z. --- Follows the proposal in #480. A test only: every added line is inside `#[cfg(test)]`, no production line is touched. **Tested** ``` cargo test --workspace -- --test-threads=4 677 passed, 0 failed, 41 ignored (16 test binaries; the 41 are benchmarks, probes and retail-data tools, none environmental) cargo test -p xcl --lib reserved_texture_tiles -- --nocapture format 28 8x8: total 1, mip 1 tiles, shape 128x128x1 format 28 256x256: total 4, mip 4 tiles, shape 128x128x1 format 71 256x256: total 1, mip 1 tiles, shape 512x256x1 format 40 8x8: total 1, mip 1 tiles, shape 128x128x1 test result: ok. 1 passed; 0 failed ``` On: AMD Radeon RX 9060 XT (RDNA4, gfx1200), Adrenalin 26.10.1 (Windows driver 32.0.32015.7029), Windows 11 26200, MSVC 2022, `e998fe9`. What it asserts: `place` rewrites the descriptor to the PC's 64 KiB layout and trusts `GetResourceTiling` for the page count it maps, so for four shapes of the title's GPU-owned textures (8x8 and 256x256 RGBA8, 256x256 BC1, 8x8 D32) the test checks that `total_tiles` agrees with `WidthInTiles * HeightInTiles * DepthInTiles`, that a texture inside one tile reports 1, and that the tiled-resources tier is at least 1. No absolute numbers are asserted: the tile shape is the driver's, so pinning them would fail on another vendor. They are printed, and the doc comment records this card's. **Not tested** No regression run: I do not have the game package, so `scripts/smoke.ps1` cannot run here and `pr_check.py` will ask for `xcl-smoke` blocks. The file is under `crates/xcl/src/`, which the checker treats as runtime even though every added line is inside `#[cfg(test)]` - the case #452 describes. **AI use** Written by an AI agent: the diff was produced by DeepSeek V4.1 Flash, from a proposal worked out with Gemini 4 Neon (T3 Code), and reviewed line by line by the operator, who ran the suites above on the card named. `CONTRIBUTING.md` does not accept open-weight models for code and `pr_check.py` names `deepseek`, so this PR does not meet that rule as written; I am declaring it rather than leaving it out. Close it if the rule is firm - the test itself is short enough to retype, and the numbers above are the part worth keeping.
towiice commented 2026-11-24 06:58:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by towiice on 2026-11-24T01:12:31Z.

Review: COMMENTED


Tested PR head e998fe9 on NVIDIA GeForce GTX 1650 SUPER (Turing / TU116, driver 610.88), Windows 11 build 10.0.26300 (26H2), Rust 1.100.0 (stable-x86_64-pc-windows-gnullvm), DXC v1.9.2609:

  • cargo test -p xcl --lib hle::d3d12x::vram -- --test-threads=4: 6 passed, 1 failed.
  • The new test hle::d3d12x::vram::tests::reserved_texture_tiles_agree_with_the_shape fails on NVIDIA:
format 28 8x8: total 1, mip 0 tiles, shape 128x128x1
thread 'hle::d3d12x::vram::tests::reserved_texture_tiles_agree_with_the_shape' panicked at
crates\xcl\src\hle\d3d12x\vram.rs:766:13:
assertion `left == right` failed: format 28 8x8: the count disagrees with the tile shape
  left: 1
 right: 0

On NVIDIA D3D12, an 8x8 R8G8B8A8_UNORM reserved texture (smaller than the 128x128 tile shape) is packed into the mip tail (total = 1, mip 0 standard tile count = 0, whereas AMD reports it as 1 standard tile). The assertion at vram.rs:766 needs to account for packed mips (packed_mip_info.NumPackedMips / NumTilesForPackedMips) so it doesn't break cargo test on NVIDIA adapters.

<!-- greyfinch-sync:ivall/xcl:review:6032123107 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/489#pullrequestreview-6032123107). Originally posted by [towiice](https://github.com/towiice) on 2026-11-24T01:12:31Z. **Review:** COMMENTED --- Tested PR head `e998fe9` on **NVIDIA GeForce GTX 1650 SUPER** (Turing / TU116, driver 610.88), Windows 11 build 10.0.26300 (26H2), Rust 1.100.0 (`stable-x86_64-pc-windows-gnullvm`), DXC `v1.9.2609`: - `cargo test -p xcl --lib hle::d3d12x::vram -- --test-threads=4`: **6 passed, 1 failed**. - The new test `hle::d3d12x::vram::tests::reserved_texture_tiles_agree_with_the_shape` **fails on NVIDIA**: ```text format 28 8x8: total 1, mip 0 tiles, shape 128x128x1 thread 'hle::d3d12x::vram::tests::reserved_texture_tiles_agree_with_the_shape' panicked at crates\xcl\src\hle\d3d12x\vram.rs:766:13: assertion `left == right` failed: format 28 8x8: the count disagrees with the tile shape left: 1 right: 0 ``` On NVIDIA D3D12, an `8x8` `R8G8B8A8_UNORM` reserved texture (smaller than the `128x128` tile shape) is packed into the mip tail (`total = 1`, `mip 0` standard tile count = `0`, whereas AMD reports it as 1 standard tile). The assertion at `vram.rs:766` needs to account for packed mips (`packed_mip_info.NumPackedMips` / `NumTilesForPackedMips`) so it doesn't break `cargo test` on NVIDIA adapters.
CryingLaughing commented 2026-11-24 07:05:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by CryingLaughing on 2026-11-24T01:07:51Z.


The focused fixture fails on the RTX 4080 at exact head e998fe9ad10862c804b16e3fa53f45de1fef9693. The first case, 8×8 RGBA8, reported one total tile and zero tiles in D3D12_SUBRESOURCE_TILING. The assertion compared those values and failed in both runs.

Tested

  • RTX 4080, NVIDIA driver 621.01, Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC x64, debug. Synthetic textures, all XCL_SAMPLE_* variables unset.
  • cargo test -p xcl --lib --locked -j 4 reserved_texture_tiles_agree_with_the_shape -- --show-output at the clean head, twice. Each run had 0 passed, 1 failed, 0 ignored. The first assertion stopped the run before the other three cases.
  • A local diagnostic on the same head resolved the fixture's device LUID through DXGI to confirm the default adapter was the RTX 4080. It also requested D3D12_PACKED_MIP_INFO from the existing call. With the appropriate count used for each case, the same command passed 1/1 and checked all four textures without skips or refusals.
Format and size Total tiles Subresource tiles Subresource start Packed mips / tiles
RGBA8 8×8 1 0 0xffffffff 1 / 1
RGBA8 256×256 4 4 0x00000000 0 / 0
BC1 256×256 1 0 0xffffffff 1 / 1
D32 8×8 1 0 0xffffffff 1 / 1

0xffffffff is D3D12_PACKED_TILE. For a packed subresource, Microsoft's API contract specifies zero tile dimensions and directs callers to the packed-mip info. These are single-mip, single-slice textures, so the diagnostic compared total with NumTilesForPackedMips for a packed case and with the subresource dimensions' product for a standard case. The one-tile expectations still held. GetResourceTiling

Not tested

  • The full workspace suite for this PR, other adapters, release builds, or retail titles. These runs exercise the native tiling query used by the fixture.

AI use

  • OpenAI Codex (GPT-6 family, exact variant unavailable) ran the commands, wrote the local diagnostic, and drafted this report.
<!-- greyfinch-sync:ivall/xcl:comment:7118785332 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/489#issuecomment-7118785332). Originally posted by [CryingLaughing](https://github.com/CryingLaughing) on 2026-11-24T01:07:51Z. --- The focused fixture fails on the RTX 4080 at exact head `e998fe9ad10862c804b16e3fa53f45de1fef9693`. The first case, 8×8 RGBA8, reported one total tile and zero tiles in `D3D12_SUBRESOURCE_TILING`. The assertion compared those values and failed in both runs. **Tested** - RTX 4080, NVIDIA driver 621.01, Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC x64, debug. Synthetic textures, all `XCL_SAMPLE_*` variables unset. - `cargo test -p xcl --lib --locked -j 4 reserved_texture_tiles_agree_with_the_shape -- --show-output` at the clean head, twice. Each run had 0 passed, 1 failed, 0 ignored. The first assertion stopped the run before the other three cases. - A local diagnostic on the same head resolved the fixture's device LUID through DXGI to confirm the default adapter was the RTX 4080. It also requested `D3D12_PACKED_MIP_INFO` from the existing call. With the appropriate count used for each case, the same command passed 1/1 and checked all four textures without skips or refusals. | Format and size | Total tiles | Subresource tiles | Subresource start | Packed mips / tiles | | --- | ---: | ---: | --- | ---: | | RGBA8 8×8 | 1 | 0 | `0xffffffff` | 1 / 1 | | RGBA8 256×256 | 4 | 4 | `0x00000000` | 0 / 0 | | BC1 256×256 | 1 | 0 | `0xffffffff` | 1 / 1 | | D32 8×8 | 1 | 0 | `0xffffffff` | 1 / 1 | `0xffffffff` is `D3D12_PACKED_TILE`. For a packed subresource, Microsoft's API contract specifies zero tile dimensions and directs callers to the packed-mip info. These are single-mip, single-slice textures, so the diagnostic compared `total` with `NumTilesForPackedMips` for a packed case and with the subresource dimensions' product for a standard case. The one-tile expectations still held. [GetResourceTiling](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12device-getresourcetiling) **Not tested** - The full workspace suite for this PR, other adapters, release builds, or retail titles. These runs exercise the native tiling query used by the fixture. **AI use** - OpenAI Codex (GPT-6 family, exact variant unavailable) ran the commands, wrote the local diagnostic, and drafted this report.
upstream-sync closed this pull request 2026-11-24 11:04:46 +00:00
raylitebull commented 2026-11-24 11:05:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-24T10:41:57Z.


Closing per CONTRIBUTING.md / pr_check.py, which does not accept open-weight models (DeepSeek) for code contributions. Thank you for declaring AI use transparently — the measurements on #480 remain useful for a compliant follow-up.

<!-- greyfinch-sync:ivall/xcl:comment:7129126018 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/489#issuecomment-7129126018). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-24T10:41:57Z. --- Closing per `CONTRIBUTING.md` / `pr_check.py`, which does not accept open-weight models (`DeepSeek`) for code contributions. Thank you for declaring AI use transparently — the measurements on #480 remain useful for a compliant follow-up.

Pull request closed

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!484
No description provided.