Repository navigation
Conversation
The standard/packed split follows the AMD PC runtime (D3D-65), but it compared each mip's floor size with half a tile. AMD rounds the size up, ceil(size / 2^mip), so an NPOT chain such as 129x129 RGBA8 or a 33x33x33 volume keeps one more standard mip. AMD also never packs a texture with a single mip, and neither does WARP: a 1x1 RGBA8 or an 8x8x8 R8 volume reported 0 standard mips and 1 packed tile. Found by a random reserved-texture sweep against the AMD PC runtime on an RX 6750 XT. Adds the 12 measured layouts to resource_tiling_test (9 fail before this change). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015z45kp1NBhQ6foQjyWVFcJ
Verification & Review (
|
| Check | Result | Notes |
|---|---|---|
Negative control (resource_tiling_test with main's resource_tiling.h) |
FAIL (expected) | Fails at first new NPOT case: AMD layout 129x129 RGBA8: standard 1 packed 7 packed tiles 1 start 4, want 2 6 1 5 |
resource_tiling (with PR changes) |
PASS (0.01 s) | All 91 AMD layouts (79 existing + 12 new) and overflow checks pass |
d3d12_vulkan_device (default & LEONIDA_VK_VALIDATION=1) |
PASS (11.01 s / 10.85 s) | compare_tiling passes against the NVIDIA D3D12 host runtime with 0 validation errors |
d3d12_texture_tiles (default & LEONIDA_VK_VALIDATION=1) |
PASS (1.73 s / 2.05 s) | Sparse texture tile mapping and CopyTiles pass on RTX 3090 |
d3d12_sparse_queue_family (default & LEONIDA_VK_VALIDATION=1) |
PASS (2.36 s / 1.72 s) | Sparse binding queue family handoff passes |
d3d12_buffer_tiles (default & LEONIDA_VK_VALIDATION=1) |
PASS (2.62 s / 1.92 s) | Reserved buffer tile mappings pass |
d3d12_rgb96 & d3d12_r9g9b9e5_uav (default & LEONIDA_VK_VALIDATION=1) |
PASS | Format tiling and UAV checks pass |
d3d12_m2_textured, d3d12_m2_formats, d3d12_m3_frame |
PASS (0.92 s – 0.96 s) | All three pass on RTX 3090 |
python -I tests/test_docs_links.py & tests/test_docs_design_rows.py |
PASS (11/11) | Documentation links and tables clean |
git diff --check |
PASS | Clean formatting and LF line endings |
AI-assisted verification; synthetic test inputs only, no game data used.
|
Tested 60a9c1f on NVIDIA GeForce RTX 5070 Ti, driver 617.42, Windows 11 build 26300, VS 2022 Build Tools (MSVC 19.44), Windows SDK 10.0.26100, RelWithDebInfo: pass. Built AI-assisted (Claude Code). |
|
Tested 1. The rows against AMD's PC runtime on RDNA4. I used a throwaway probe (not committed). For each description it creates the reserved texture with
My sweep generator isn't yours, so these seeds won't reproduce your descriptions. The packed-slice quirk, refined. Per subresource, the only differences left on descriptions whose counts match are the quirk you noted. On RDNA4, though, a packed mip of slice s ≥ 1 reports the packed start of slice s − 1, not of slice 0. The two are the same on slice 1, so 2-slice arrays can't tell them apart. On slices ≥ 2, seed 2 has 1,986 such entries and seed 3 has 2,151. Every one is the previous slice's start and none is slice 0's. For example, in 1000x300 RGBA8 x3 (10 mips, 36 tiles a slice, packed start 35), slice 1's packed mips report 35 and slice 2's report 71. That looks like an off-by-one-slice in the driver, which is one more reason to keep 2. Tests on the card. This PR merged onto
3. Merge conflict with current AI-assisted (Claude Code). Synthetic descriptions only, no game files. |
|
Tested
Needs a rebase for the docs conflict. Ran with |
|
Tested 60a9c1f on AMD Radeon RX 7900 XTX (RDNA3), AMD proprietary 26.10.1, Windows 11, MSVC 19.44: fixes the failure on this card.
Targeted run: only this test was run on the PR, not the rest of ctest or the GPU suite. AI-assisted (Claude wrote the test script and read the logs); the runs are from my machine. |
…lved in favour of main)
|
Baseline on main here: AI-assisted (Claude Code). |
loyrox
left a comment
There was a problem hiding this comment.
Tested 60a9c1f merged onto main 867d922 on NVIDIA GeForce RTX 3060 (driver 621.14 / 32.0.16.2114, Vulkan 1.4.357), Windows 11 10.0.26200, MSVC 19.51.36260 (VS 2026), RelWithDebInfo, -DLEONIDA_VULKAN_HEADERS_FETCH=ON, with the docs/d3d12_vulkan.md conflict resolved to main (code unchanged): resource_tiling passes.
d3d12_vulkan_device still fails at line 6574 tiles == 1, the same as on main without this PR. That matches what #8426 saw on AMD after the merge. On this machine, #8496 and #7125 (test-side changes to how CreateReservedResource2 is reached) each make line 6574 pass. So this PR does not need to carry that fix, and it should not be counted as the one that clears #8426's tiles == 1 item.
Claimed in the coordination issue as: a new D3D item, claim.
Depends on: none. #5867 edits
runtime/src/resource_tiling.htoo (validation at the top ofresource_tiling()), not these lines; a textual conflict is possible, not a semantic one.What and why
resource_tiling()models the standard/packed mip split of the AMD PC runtime (D3D-65, #868, #2728): a mip stays standard while it is wider than half the tile or taller than the tile. The 79 AMD layouts inresource_tiling_testall fit that rule. I swept random reserved textures (2D, arrays, volumes, formats 1-115, 1 to 12 mips, MipLevels clamped to the full chain) throughGetResourceTilingon the layer and on the AMD PC runtime of the same machine. Two parts of AMD's rule are missing:The split uses mip sizes rounded up,
ceil(size / 2^mip), not the floor size the mip has. An NPOT chain keeps one more standard mip:mainThe total tile count and
GetResourceAllocationInfofor the reserved texture change with it.A single mip is never packed. Every single-mip texture smaller than half a tile, such as 1x1 RGBA8, 1x64 R16, 16x16 RGBA8 x4 or an 8x8x8 R8 volume, reported 0 standard mips and 1 packed tile. AMD and WARP both report 1 standard mip and no packed tail. This also lines the report up with the sparse RGBA8 image path, which maps subresource 0 by tile coordinates (
tile_gridinruntime/shims/d3d12_com.cpp).The standard mips' tile counts still come from the real (floor) sizes, as the host reports. Nothing else reads the split:
GetResourceTiling, the reserved size inGetResourceAllocationInfo(total_tiles), and the format check inCreateReservedResource. Reserved textures are otherwise backed fully, so this changes what the application reads and nothing it binds.For power-of-two tiles, "rounded up" is the same as computing the mips from the power-of-two-padded top level. That AMD pads like this is INFERRED from the numbers, not documented. The console-side texture tools use the same rounded-up block count for their mip tail (
compact_surface_layout, see #6802).Changes
runtime/src/resource_tiling.h: the split compares((size - 1) >> mip) + 1and treatsMipLevels == 1as standard. This form has no overflow; a texture of width near 2^64 still fails cleanly (newCHECK).runtime/test/resource_tiling_test.cpp: 12 AMD rows measured on this GPU. 9 of them fail onmain; the other 3 are controls that split the same way under both rules.docs/d3d12_vulkan.md: the rule and the measurement.Seen, not changed (host quirk, no third oracle): for packed mips of array slices after the first, the AMD runtime returns
StartTileIndexInOverallResource= the packed start of slice 0 (for example 6) instead ofD3D12_PACKED_TILE. The layer keepsD3D12_PACKED_TILE, as the D3D12 docs describe. WARP never packs, so there is nothing to compare it with. After this PR it is the onlyGetResourceTilingdifference the sweep finds against AMD (149 subresources over seeds 2 and 3).Tested
Windows 11 26300, AMD Radeon RX 6750 XT (RDNA2, gfx1031), driver 26.11.2, MSVC 14.44.35207, SDK 10.0.26100.0, Vulkan SDK 1.4.363.0.
main1cc6e3cresource_tiling(12 new AMD rows)Mutation checks: with the single-mip clause removed, 4 rows fail; with the rounding removed (floor sizes), 5 rows fail.
ctest -Rfor resource_tiling, d3d12_vulkan_device (compare_tiling), d3d12_texture_tiles, d3d12_sparse_queue_family, d3d12_rgb96, d3d12_r9g9b9e5_uav, d3d12_buffer_tilesLEONIDA_VK_VALIDATION=1, 0 VUIDs.d3d12_texture_tilesfails at line 240 (row-major alias), as on cleanmainon this GPU: the native AMD CopyTiles quirk (#5951)ctest -j 4vk_queue_query_sync(flaky under -j4),d3d12_texture_tiles,d3d12_indirect_dispatch_count(#6162),d3d12_pipeline_library_host(#6088), andd3d12_m2_textured,d3d12_m2_formats,d3d12_m3_frame. Those last three fail the same way withmain's rule built in (184 of 4096 pixels differ), so they are not from this change; I am looking at them separatelyrun_gpu_tests.py(default mode; the translator is untouched)ms_wave_info_s3, pre-existing onmain(#5741)tests/test_docs_*.pygit diff --checkNOT RUN: NVIDIA and Intel. Their split is the driver's own, and
d3d12_vulkan_device's tiling comparison accepts it. RDNA4 is not re-measured for the 12 new rows.The sweep itself is not committed. It is a throwaway program (layer vs
D3D12CreateDeviceon the AMD adapter). Two AMD driver traits it ran into, both host problems:CreateReservedResourcewith MipLevels past the full chain, or a color format withALLOW_DEPTH_STENCIL, removes the AMD device (DXGI_ERROR_DRIVER_INTERNAL_ERROR). The sweep clamps the mips and leaves that flag out.Checklist
docs/design.md, with how it was confirmed. (No translator change.)AI-assisted: yes (Claude Code). Synthetic descriptions only, no game files.
🤖 Generated with Claude Code
https://claude.ai/code/session_015z45kp1NBhQ6foQjyWVFcJ