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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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