Console descriptor heaps take the shared heap a page at a time (Minecraft flicker on NVIDIA) #84
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!84
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/84/head"
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?
@Foniass on GitHub · 2026-11-23 02:02 UTC · original
Foniass:fix/descriptor-heap-pages→main· +153 −52 · 3 files · 2 commits · merged 2026-11-23 09:59 UTCMinecraft flickers on NVIDIA: about one frame in fourteen at the main menu is a flat dark-gray frame (#212121, the clear colour of its 4× MSAA scene target). Players report it as flicker. This PR fixes it.
Cause
All console view heaps share one shader-visible PC heap (
console_heap::Global). Each heap got a contiguous range there of 2 PC descriptors per slot, reserved when the heap was created. That heap's size is the GPU'sMaxViewDescriptorHeapSize, capped at 2 097 152: 1 000 000 on NVIDIA.Minecraft creates eight view heaps of 73 727 slots, 147 454 PC descriptors each, 1 179 632 in all. Six fit. The seventh logs "the shared heap (1000000) has no room for 147454 more – that heap keeps its own", and so does the eighth.
A heap that "keeps its own" is lost:
pc_heapsbinds only the shared heap for views, so a draw using descriptors from heap 7 or 8 reads another heap's slots. In Minecraft those draws (the panorama and the whole UI) come out transparent, and the resolved frame is just the clear colour. The game rotates its heaps with its frames, so the blank frames always land on the same one of its three back buffers (every gap between them is a multiple of 3). On AMD the cap is 2 097 152, so all eight heaps fit, which is why RDNA never showed it.The heaps are nearly empty: at the menu each holds 3 images.
Fix
A heap's place in the shared heap is now given a page of 256 slots at a time, when a slot of that page is first used (
console_heap::slot). It's no longer reserved whole at creation.Slotindices are per page (page first + 2·(k mod 256)). A T# still carries its own PC index, so copies between heaps behave as before.publish_rangecopies page by page, since a heap's pages are not adjacent in the shared heap.unregisterfrees the pages it got.reserve_global(dev, n)becomesshared_heap(dev)(make the shared heap) plus a privatereserve_global(n)per page.registertakesshared: boolinstead of a range.Related: the first item of #69 (binding the selected private heap for local indices) addresses the same lost heaps from the binding side. Binding a private heap still breaks draws that mix descriptors from several heaps (console descriptor tables may point into any heap). Here every heap stays in the one shared heap.
Measurements (RTX 5070 Ti, driver 32.0.16.2114, Minecraft Preview 1.18.30.64, menu)
Blank frames were counted inside XCL: the middle row of every presented frame was read back after the present copy, and a frame counts as blank when that whole row is a single colour. This was a local diagnostic, not part of this PR.
mainA screen capture of the window at 60–80 captures/s agrees: 5–27 flicker frames per 750 before, 0 per 750 after. Clean builds of
mainand of this branch, run one after the other, gave 27 and 0; themainrun logs the "no room" warning and this branch's doesn't.Ruled out along the way (no change in the blank count): reporting the flip only after XCL's present copy, uploading whole dirty pages instead of changed 64-byte chunks, a CPU wait for every sparse upload, early command-allocator resets (none happen). With every pixel shader forced to magenta the blank frames disappear, which pointed at what the shaders read rather than at geometry or ordering.
Tests
console_heap::tests::large_heaps_get_shared_pages_as_used: eight heaps of 73 727 slots. Every slot gets a place, pages are contiguous, indices are unique, and two heaps of 4 slots take 8 descriptors each. On a shared heap of 1 000 000 (NVIDIA) the old whole-heap reservation gives the seventh heap no range; on AMD's larger heap the test passes either way.cargo build --workspace --releasethencargo test --workspace --releaseon the RTX 5070 Ti: all pass, including the test title (e2e). 41 GPU tests print SKIPPED (no wave64 on NVIDIA), as onmain.🤖 Generated with Claude Code
github-bot referenced this pull request2026-11-26 04:19:41 +00:00
github-bot referenced this pull request2026-11-26 04:31:24 +00:00
@Lum7nt on GitHub · 2026-11-23 05:48 UTC · original
Tested this branch locally against
mainand alongside #43 — all 344 library tests pass (includinglarge_heaps_get_shared_pages_as_used) and it merges cleanly.Architecturally, this paging design is a clear improvement over capping/recycling monolithic heaps (#69):
MaxViewDescriptorHeapSize, even when titles allocate multiple large heaps (e.g. Minecraft's 8 × 73k view heaps).Solid work — resolves the allocation failures and flickering cleanly.
@certified-retart on GitHub · 2026-11-23 05:54 UTC · original
Tested head \
385dc5fc\ on a dual-GPU Windows 10 setup (NVIDIA RTX 5070 + AMD Radeon 9800X3D iGPU) with D3D12 Agility SDK 1.619.1 (#75) so SM 6.6 / wave64 GPU tests run live:(Minor note: \large_heaps_get_shared_pages_as_used\ calls \D3D12CreateDevice(None, ...), so on multi-GPU systems it always tests the default adapter — here the RTX 5070 with the 1M heap cap, which is the exact case that triggers the old overflow.)
@ivall on GitHub · 2026-11-23 09:59 UTC · original
Merged (
55df81b). Checked on an RX 9070 (RDNA4):cargo test --workspacewith the retail samples (shader pack, console DLLs, texture archive) – natively, and withXCL_SPLIT_WAVE64=1(new inba905cf: forces the split wave64 form on RDNA, which runs both wave sizes, so the NVIDIA path can be checked on AMD). XDefiant (title screen correct, 6 299 translated pipelines, 0 translation errors), Minecraft and Unicorn Overlord run. Minecraft on AMD no longer logs the shared-heap "no room" warning either. Thanks for the careful measurement!