d3d12: give a large shader-visible heap no more slots than the heap bitmaps name #632
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/632"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-12-01T17:57:30Z.
What goes wrong (shown in a unit test, not in a game run)
Translated programs that index the resource heap record the host heap index of each image view they read, and of each store, in the heap bitmap (
tuxbox_dxbc::heap_writes). The bitmap names indices belowSLOTS(1,048,575).tb_note_heap_readrecords a higher index only as bit 0, unknown. Instamp_readsan unknown read only counts toward the "past" total and stamps no texture. Read residency, on by default sincee40d8052, keeps a texture only when a read names it, so a texture read only through such an index is never kept, backed or refreshed. An unknown store publishes every writable candidate, which is correct but costly.Such indices exist when the host's shader-visible heap is larger than the bitmap.
create_heapgives a title heap over 1,000,000 descriptors the driver'sMaxViewDescriptorHeapSize. vkd3d-proton reports 16,000,000 when it uses VK_EXT_descriptor_heap with a GPU upload heap (resizable BAR). ProjectScarlett asks for 1,245,184 descriptors, so its tables (or the heap itself, where no arena is made) can sit past 1,048,575. On an RX 9070 XT this heap was the 500,128 KiB BAR allocation traced in #292, which is 16,000,000 x 32 bytes plus 128 KiB. NVIDIA reports 1,000,000 and is not affected.Change
A shader-visible CBV/SRV/UAV heap over 1,000,000 descriptors gets
clamp(driver limit, 1,000,000, heap_writes::SLOTS)host slots. The title's tables are paged into them as on NVIDIA. On the hosts above the descriptor heap falls from about 488 MiB to about 32 MiB of BAR memory.TUXBOX_DESCRIPTOR_HEAP_LIMITstill lowers the count. One log line per such heap gives the title's count, the host slots and the driver's limit.Tests
heap_writes::tests::a_read_at_the_last_slot_of_the_largest_host_heap_names_its_viewencodes a read at the host heap's last slot the waytb_note_heap_readdoes, decodes it, and checks that it names that view.fb17e160) copies main's rule into the test. There it fails:a read at host index 15999999 is recorded only as unknown.resources::tests::*(3): the slot policy.python tuxbox.py check --no-gpuon50d2a389: 13 passed, 0 failed. The new d3d12 tests were run on their own under GE-Proton11-15's Wine on the commit before this rebase (ae724d44, same change): 4 of 4 heap_writes and 3 of 3 resources tests passed. Fullpython tuxbox.py checkof50d2a389(GE-Proton11-15): RTX 5090 (10de:2b85) 211 pass, AMD iGPU (1002:13c0) 210 pass; the one failure on each islanes-selftest-texture-publication(#625, fails on main too). Neither card here reports the large heap limit, so these show the change breaks nothing; they don't exercise it.Not run
ProjectScarlett on a card that reports the large limit. No card here does: our AMD iGPU's Mesa 26.0.8 has no VK_EXT_descriptor_heap, and NVIDIA reports 1,000,000. So the missing textures are inferred from the code and the unit test, not observed. On such a card the change should show in three places:
VKD3D_CONFIG=log_memory_budget);descriptor table evictionrate, which goes up because the tables are now paged.Refs #533.
🤖 Generated with Claude Code