Repository navigation
d3d12: GetResourceAllocationInfo follows the PC runtime's 4 KiB, totals and flag rules - #1204
Conversation
…ls and flag rules
4 KiB alignment now counts the 4 KiB tiles covering the top mip of one
slice (at most 16; a volume's depth counts), instead of fitting the whole
image in 64 KiB. Multi-resource totals round up to the largest alignment,
saturate instead of wrapping, and an empty query is {0, 1}. Simultaneous
access with depth-stencil or MSAA, and a depth-stencil volume, are refused.
All measured against the host runtime on an RTX 5070 and WARP.
|
Tested
No game files were used. |
|
Tested 15aa49c on Windows 11 with two GPUs on one machine (MSVC 14.51): pass.
|
|
Tested 15aa49c on NVIDIA GeForce RTX 5070, driver 621.24 (32.0.16.2124), Windows 11 26H2 (26300), MSVC 14.52 (VS Build Tools 18), Ninja, RelWithDebInfo, under validation (
|
|
Tested 15aa49c on NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11 Home 25H2 (26200.9974), VS 2022 Build Tools, Vulkan SDK 1.4.363.1: pass.
AI-assisted. No game files. |
|
Tested 15aa49c on AMD Radeon RX 9070 (RDNA4), AMD 26.11.2 + WARP, Windows 11 Pro 26300, MSVC 14.44: pass. The allocation rules now have an AMD host behind them as well.
One difference between the vendors, for the record: AMD's runtime sizes AI-assisted (Claude Code). |
… 2^64; ours stays saturated compare_allocation_info required the host's answer for two totals that overflow 2^64 (two 2^63 buffers; the largest buffer plus one). WARP and the hosts of #1204 saturate at 0xFFFFFFFFFFFF0000, but the Intel Raptor Lake-S (101.7092) and RTX 5060 Laptop (621.24) hosts on Windows 26300.9974 (D3D12Core 10.0.26100.9818) wrap, to 0 and 65536, while WARP on the same PC saturates. d3d12_vulkan_device_test failed there on both GPUs. Ours is now pinned to the saturated answer, which can't make a caller allocate less than one of its resources. A host whose total is below its largest resource has wrapped and is reported, not compared. Any other host answer is still a mismatch.
GetResourceAllocationInfodisagreed with the PC runtime in three ways. Each one is measured against the host D3D12 runtime on an RTX 5070 (621.24) and on WARP incompare_allocation_info(d3d12_vulkan_device_test), and the two hosts agree on every case.D3D12_SMALL_RESOURCE_PLACEMENT_ALIGNMENT). The host allows it when at most 16 tiles of 4 KiB cover the top mip of one array slice. Mips and array slices don't count, but a volume's depth does. We tested whether the whole resource fit in 64 KiB, so we wrongly refused full mip chains, arrays, 1D 16384 and small volumes, and accepted a 100x100 volume (49 tiles) that the host refuses. A byte rule doesn't match either: 33x480 RGBA8 (63,360 bytes, 30 tiles) is refused by the host.leonida::small_tile_shape()inruntime/src/resource_tiling.h, pinned with exactly-16-tile and one-more-texel cases.shortcut:.place()):{0, 1}instead of alignment 0, which would make a caller's align-up divide by zero.ALLOW_SIMULTANEOUS_ACCESSwith depth-stencil or MSAA, and a depth-stencil volume.mainTest:
compare_allocation_infogets these cases plus the exact-16-tile/one-more boundaries for every element size. Withmain'sd3d12_vulkan_device.cppandresource_tiling.h: 17 mismatches against the host, on both the default adapter andLEONIDA_HOST_ADAPTER=warp. With this change: 0 on both. FullctestwithLEONIDA_VK_VALIDATION=1andLEONIDA_D3D12=vulkan: 56/56.Resource creation is unchanged:
CreateCommittedResourcedoesn't use this path, andCreatePlacedResourceisn't implemented onmain. A follow-up could makeCreateCommittedResourcerefuse the three flag combinations too; #558 (D3D-49) is adding the creation-side rules.AI-assisted.