d3d12: keep texture-upload staging out of vkd3d's ReBAR budget #595
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/595"
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 Kayotic1337 on 2026-11-30T19:03:35Z.
vkd3d-proton gives
UPLOADheaps a fixed ReBAR budget: 1/16 of VRAM, 1019 MiB on a 16 GB card. In ProjectScarlett, the texture-upload staging buffers inplacement/upload.rs(Transfer::begin) are committedUPLOADbuffers of up to 528 MiB. They fill that budget, and the next one falls back to system memory. That is thevkd3d_allocate_device_memory: Memory allocation failed, falling back to system memoryline discussed on #292. The attribution with logs is in https://github.com/brcly/TuxBox/issues/292#issuecomment-7286748306: every refused request was a staging create of exactly that size.This change creates staging in a
CUSTOMheap withWRITE_COMBINEonL0instead ofUPLOAD. That is the same memoryUPLOADuses without ReBAR (write-combined system memory). For anL0custom heap, vkd3d asks only forHOST_VISIBLE | HOST_COHERENTand drops the device-local types, so these buffers stay out of the BAR. The CPU writes them the same way, the copy queue reads them the same way, and the ledger still counts them as system memory.committedinplacement.rsgets acommitted_insibling that takes heap properties. The other callers are unchanged.Game runs
RX 9070 XT (
1002:7550), RADV, Mesa 26.3.1, GE-Proton11-14, vkd3d-proton 71cae091, Linux 7.3.6. Same settings in every run:TUXBOX_VRAM_RESERVE_MIB=4096,TUXBOX_SPILL_WRITE_BACK=0,TUXBOX_XMEM_PRIVATE_VIEWS=1,VKD3D_CONFIG=log_memory_budget, nono_upload_hvv, warm shader cache.Without this change, every comparable run I have had fallbacks (2 to 5, see #292). With it, none of the four runs had any, including H with 27 staging buffers of 32 MiB or more. F and H got further into the game than E (4,096 placed textures spilled vs 1,024), and their peaks are higher for that reason. In F, 488 MiB of that peak is one internal vkd3d allocation made at device creation, and the rest is 16 MiB
UPLOADchunks. So with this change the title's ownUPLOADheaps still have only about 136 MiB of headroom there. This change removes TuxBox's staging from the budget. It doesn't make the budget larger.These runs were on #575's head (
be15fac8) with this diff applied, not on this branch's head.placement.rsandupload.rsare identical onbe15fac8and onbbc26254, so the diff is the same. I didn't run the game onbbc26254: its launcher now prepares first after a translator change (e9147f2a), and that preparation ran at about 100 shaders per minute here, roughly 4 hours for 25,889 shaders. I'll look at that separately.Every run still ends in a crash. That is the separate problem I've reported before, and this change doesn't affect it: D and E ended on the compute-queue TCP write fault (
0x641041), F and G on a gfx-ring fault (0x70113A,0x50113A), and H on the title watchdog with no kernel fault logged. I didn't measure frame times, because the game doesn't get far enough to have a stable stretch.Checks
On this branch's head, RX 9070 XT, GE-Proton11-14:
That covers 113 of 113 Lanes and fixture gates, including the placement ones (
d3d12-placement,lanes-selftest-texture-publication). I haven't traced which gates create a staging buffer throughTransfer::begin. Also 22 of 22 D3D12 regression controls. Not run on NVIDIA. I don't have one.No Lanes scenario: the bug only shows once staging buffers fill vkd3d's ReBAR budget, which takes hundreds of MiB of texture uploads in flight. Lanes doesn't upload that much, and the fallback only shows up as a vkd3d log line, not as a result a scenario could check.
🤖 Generated with Claude Code