Repository navigation
fix(vk): texture noise when system RAM runs low: a staging arena of the size needed when 64 MB can't be pinned - #1514
Merged
NotRexed merged 1 commit intoNov 10, 2026
Conversation
rakefire-impala
marked this pull request as ready for review
November 10, 2026 06:13
This was referenced Nov 10, 2026
rakefire-impala
force-pushed
the
fix/texture-noise-low-ram-staging-fallback
branch
from
November 10, 2026 10:50
7d1e7eb to
1b26544
Compare
…asked for
Without resizable BAR a staging arena is new system memory the driver
pins. On a 16 GB laptop (RX 5500M, 4 GB) with the game's pools imported
and 2.9 GB of RAM available, Windows paging, no 64 MB arena could be made
even for a 36 KB upload: texture_frame had given the idle arenas back,
and every texture upload failed until one was free again. BC3 textures
were drawn as noise meanwhile (a failed upload marks the texture
uploaded).
staging() now tries an arena of the size the upload asks for (rounded to
1 MB) when a 64 MB one cannot be made, and logs it ("vk: staging: no 64 MB
arena could be made"). A buffer made but not mapped is destroyed, not
leaked. texture_frame gives the small arenas back as it does the others.
tests/test_staging_arena_fallback.py checks the order, the cleanup and the
log line.
rakefire-impala
force-pushed
the
fix/texture-noise-low-ram-staging-fallback
branch
from
November 10, 2026 11:31
1b26544 to
cf878f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Without resizable BAR, a texture staging arena is 64 MB of system memory the driver must pin. On a 16 GB laptop with RAM nearly gone, no 64 MB arena could be made, even for a 36 KB upload, so texture uploads failed and drew as noise. This falls back to an arena of the size the upload needs.
Related: #993. Part of splitting up #1023.
Problem
On an RX 5500M laptop (4 GB VRAM, 16 GB RAM), the game's pools were imported (about 2 GB pinned), only 2.9 GB of RAM was available, and Windows was paging.
texture_framehad given the idle arenas back, as it does after 30 s on a card of 6 GB or less, and making a new 64 MB one failed:The system heap's budget had room, but pinning a new 64 MB block failed under RAM pressure. Every upload failed until an arena came free.
Change
staging()tries one of the size the upload needs, rounded up to 1 MB. Both outcomes are logged once in a while:vk: staging: no 64 MB arena could be made (N kept); one of the size asked for instead, or...; the upload waits.texture_framegives the small arenas back as it does the others. Upstream's arena timing log is kept.Who it affects
Only a machine where a 64 MB staging arena can't be pinned: low free RAM, no resizable BAR. Everywhere else
staging()makes the same 64 MB arenas as before, and the new path never runs.Tests
tests/test_staging_arena_fallback.py(new) checks the order of the attempts, the cleanup and the log line. It fails on main without this change.Tested on
no 64 MB arena could be made ...; one of the size asked for instead8 times, 0 failed texture uploads, no noise