graphics: retry required buffer allocations beyond the advisory budget #1802
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1802
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1802"
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?
@kewalker on GitHub · 2026-10-21 21:10 UTC · original
kewalker:codex/buffer-budget-retry→main· +24 −11 · 1 files · 1 commits · openRequired renderer buffers currently exit immediately when budget-constrained creation fails. This adds one retry without
VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BITfor the eligible Vulkan failure, allowing the driver to attempt the required allocation. The initial attempt still enforces the reported budget. If creation still fails, the fatal message now includes the Vulkan result, requested size, memory usage, and buffer flags; heap budgets are logged as well.I reviewed the code and launched and played Demon's Souls (PPSA01342) with this change in my local integration build, after merging main through
28648188. This is a targeted startup retry and diagnostics change, not a general compatibility or stability claim. The gameplay test included other local changes and was not an isolated A/B test on clean main.Validation:
streamBuffer.cpp; unrelated local renderer and shader changes are excluded.Related: #1801
@coderabbitai[bot] on GitHub · 2026-10-21 21:26 UTC · original
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
7f4da43f-77e2-4f77-8773-8c2ac1a9dab4📥 Commits
Reviewing files that changed from the base of the PR and between
286481889fandd6ad3c2be6.📒 Files selected for processing: 1
src/graphics/host_gpu/renderer/cache/streamBuffer.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
When allocation with the within-budget flag returns
eErrorOutOfDeviceMemory,Bufferlogs the condition and memory budget, then retries once without the flag. If allocation still fails, it logs allocation details and exits with the Vulkan result. ThevmaFlushAllocationcall was reformatted without a behavior change.Suggested reviewers:
nmzikPriority: ⬇️ Low
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
d6ad3No specific issue remains that would block merging after normal checks.
Pre-merge checks:
4 ·
1
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@theantipopau on GitHub · 2026-10-22 05:44 UTC · original
Approach is right:
VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BITis advisory, VMA may returnVK_ERROR_OUT_OF_DEVICE_MEMORYpurely because the reported budget is tight, and a required renderer buffer should get one driver attempt without it. Keeping the first attempt budget-enforced and only retrying oneErrorOutOfDeviceMemoryis the minimal version.Three things before this merges:
vmaCreateBuffershould leave them untouched on failure, butnative_buffer/m_allocationare the output of a call that just failed; assigningVK_NULL_HANDLE/nullptrbefore the second attempt costs nothing and rules out a partially-written allocation handle being treated as valid if VMA ever changes that.buffer_info.size,with_bda,Flush). It makes the diff look like a formatting pass and buries the four real hunks.EXITrepeatsstatic_cast<unsigned>(usage)andgraphics.LogMemoryBudget()is now called twice on the failure path (once in the retry branch, once beforeEXIT). OneLogMemoryBudget()before the fatal is enough, and loggingallocation_result(orsizeplus the buffer usage flags only) keeps the message readable.One semantic point worth a note in the commit message: the retry also covers a genuine driver OOM, not just a budget rejection, since both surface as
eErrorOutOfDeviceMemory; the difference only shows up inLogMemoryBudget(). #1797 hit that case (a 2048x2048 chain falling back to system memory, then an allocation failing with-2), so it may be worth mentioning that required buffers still fail hard when the device is truly full.Not blocking: this is verified by the reporter's local run only, and the failure it addresses is device/budget dependent, so a maintainer with a small-VRAM GPU reproducing Demon's Souls is still the useful confirmation.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.