graphics: give images dedicated allocations where the driver allows many #1394
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!1394
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1394"
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?
@msfvn on GitHub · 2026-10-11 02:01 UTC · original
msfvn:vma-dedicated-images→main· +7 −0 · 1 files · 1 commits · openProblem
Images share VMA's default 256 MiB blocks. As the texture cache creates and frees images of different sizes, those blocks fill with holes, and VMA only releases a block once it is completely empty. On Astro Bot with a 4 GB GPU,
vmaCalculateStatisticsshowed 634 MiB of device memory in 187 unused ranges (largest 77 MiB) at the point where new images started failing to allocate. Smaller blocks (64 MiB) did not help, ~500 MiB stayed unused.Change
Create images with
VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BITwhenmaxMemoryAllocationCount >= 65536, so freeing an image returns its memory to the driver. Linux drivers reportUINT32_MAX; Windows drivers commonly report 4096, so they keep the pooled path.Testing
Linux, RTX 3050 Laptop 4 GB, Astro Bot intro, same scene: unused memory inside VMA blocks went from ~700 MiB to ~48 MiB, and the frame rate in the VRAM-bound part of the intro went from 2-4 to 3-9 fps. Measured on a local build that also had other memory changes of mine; together with #1270 and #1271 on current
mainit runs the intro without failures.AI involvement: written with Claude Code (AI assistant) at my request and reviewed by a C++ developer I know; tested on my machine (RTX 3050 Laptop 4 GB, CachyOS) as described above, including playing Astro Bot on this build. Happy to adjust anything you point out.
@coderabbitai[bot] on GitHub · 2026-10-11 02:06 UTC · original
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
d520f3ad-d96c-4a92-acff-8eaa292bbb44📥 Commits
Reviewing files that changed from the base of the PR and between
730e1a3cf3and9b8fd69120.📒 Files selected for processing (1)
src/graphics/host_gpu/vma.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.
📝 Walkthrough
Walkthrough
CreateImagenow enables VMA dedicated-memory allocation when the physical device’smaxMemoryAllocationCountis at least 65,536. Below that threshold, it leaves the allocation flags unchanged.Suggested reviewers:
nmzikPriority: ⬆️ High
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
9b8fdImages now request dedicated memory on devices reporting a high allocation limit. Allocation-limit exhaustion could cause image creation to fail, but no available workload evidence establishes that this occurs, so no concrete merge blocker is demonstrated.
Pre-merge checks |
4 |
1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.