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

Closed
github-bot wants to merge 1 commit from gh-pr/489/head into gh-pr/489/base
Owner

@⁠Luislariosss on GitHub · 2026-11-24 00:59 UTC · original
Luislariosss:test/reserved-tiling-parity → main · +121 −0 · 1 files · 1 commits · closed without merging

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.

**@⁠Luislariosss** on GitHub · 2026-11-24 00:59 UTC · [original](https://github.com/xcl-dev/xcl/pull/489) `Luislariosss:test/reserved-tiling-parity` → `main` · +121 −0 · 1 files · 1 commits · closed without merging 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.
place() rewrites a title's descriptor to the PC's 64 KiB layout and then trusts GetResourceTiling for the page count it maps, so that count has to agree with the shape the same call returns. This adds a GPU test over the four shapes the title's GPU-owned textures use, on both sides of one tile: it asserts total equals tiles-per-mip times subresources, that a texture smaller than a tile still gets one tile, and that the tiled-resources tier is at least 1 (otherwise it skips like the other GPU tests).

No absolute numbers in the assertions: the tile shape is the driver's, so pinning them would fail on another vendor. The numbers are printed and recorded in the comment for an RX 9060 XT (RDNA4, Adrenalin 26.10.1): 8x8 RGBA8 and D32 are one 128x128 tile, 256x256 RGBA8 is four, and 256x256 BC1 is one tile of 512x256 texels.

The change is a #[cfg(test)] addition with no production line touched.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:23:18 +00:00
github-bot closed this pull request 2026-11-26 04:23:18 +00:00
Author
Owner

@⁠CryingLaughing on GitHub · 2026-11-24 01:07 UTC · original

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.
**@⁠CryingLaughing** on GitHub · 2026-11-24 01:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/489#issuecomment-7118785332) 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.
Author
Owner

@⁠raylitebull on GitHub · 2026-11-24 10:41 UTC · original

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.

**@⁠raylitebull** on GitHub · 2026-11-24 10:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/489#issuecomment-7129126018) 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.
Author
Owner

@⁠towiice on GitHub · 2026-11-24 01:12 UTC · original · reviewed

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.

**@⁠towiice** on GitHub · 2026-11-24 01:12 UTC · [original](https://github.com/xcl-dev/xcl/pull/489#pullrequestreview-6032123107) · **reviewed** 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.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.