VRAM: reflection probe resolution can OOM-crash -- pre-check setting-driven allocations, revert + notify on failure #226

Closed
opened 2026-10-01 19:01:46 +00:00 by sky_line · 2 comments
Owner

Problem

Raising RenderReflectionProbeResolution (and/or RenderReflectionProbeCount) can crash the viewer with a VRAM out-of-memory error on cards with less memory. Reproduced on an RTX 3060 (~12 GB): changing the probe texture size setting crashed the viewer.

Reflection probes are already the largest single VRAM consumer at max settings. Measured 2026-10-01 on a 5090 in a dense sim: probes 4,133 MB, against textures at 3,640 MB, out of 11.3 GB tracked by the renderer. Allocation happens in LLCleanRendererVK probe setup (vkgfx/llcleanrenderervk.cpp, around mProbeRes / mProbeSlotsN). The cost grows with res² × count × mip chain (radiance + capture arrays), so one step of resolution is ~4×.

Wanted behaviour

Allocations driven by user settings must never crash on failure:

  1. Pre-check before (re)allocating: estimate the bytes the new probe arrays need. Compare against the device heap budget (VK_EXT_memory_budget: budget − current usage, plus whatever the old arrays free).
  2. Fail gracefully if it won't fit, or if vkAllocateMemory / image creation still returns VK_ERROR_OUT_OF_DEVICE_MEMORY:
    • keep (or restore) the previous allocation;
    • set the setting back to its previous value;
    • post a system message to the user, e.g. "Your graphics card doesn't have enough video memory for reflection probe resolution N (needs ~X MB, Y MB available). The setting was reverted."
  3. Apply the same pattern to other large setting-driven allocations: shadow map / projector atlas sizes, RT buffers, render-target scale / resolution. A reusable "try-allocate-or-revert" helper is preferable to per-setting special cases.
  4. Optionally clamp what the preferences UI offers, based on the GPU tier / VRAM.

Notes

  • Related: the GPU tier classification in llappviewer.cpp (VRAM-based presets), the RAM/VRAM tickets #159–#164, and the RT VRAM-pressure ticket filed alongside this one.
  • Test on an 8 GB and a 12 GB card. Step the probe resolution up to the max and confirm the revert and the message appear instead of a crash.
## Problem Raising **RenderReflectionProbeResolution** (and/or **RenderReflectionProbeCount**) can crash the viewer with a VRAM out-of-memory error on cards with less memory. Reproduced on an RTX 3060 (~12 GB): changing the probe texture size setting crashed the viewer. Reflection probes are already the largest single VRAM consumer at max settings. Measured 2026-10-01 on a 5090 in a dense sim: **probes 4,133 MB**, against textures at 3,640 MB, out of 11.3 GB tracked by the renderer. Allocation happens in `LLCleanRendererVK` probe setup (`vkgfx/llcleanrenderervk.cpp`, around `mProbeRes` / `mProbeSlotsN`). The cost grows with res² × count × mip chain (radiance + capture arrays), so one step of resolution is ~4×. ## Wanted behaviour Allocations driven by user settings must **never crash** on failure: 1. **Pre-check** before (re)allocating: estimate the bytes the new probe arrays need. Compare against the device heap budget (VK_EXT_memory_budget: budget − current usage, plus whatever the old arrays free). 2. **Fail gracefully** if it won't fit, or if `vkAllocateMemory` / image creation still returns `VK_ERROR_OUT_OF_DEVICE_MEMORY`: - keep (or restore) the previous allocation; - **set the setting back** to its previous value; - post a **system message** to the user, e.g. "Your graphics card doesn't have enough video memory for reflection probe resolution N (needs ~X MB, Y MB available). The setting was reverted." 3. Apply the same pattern to other large setting-driven allocations: shadow map / projector atlas sizes, RT buffers, render-target scale / resolution. A reusable "try-allocate-or-revert" helper is preferable to per-setting special cases. 4. Optionally clamp what the preferences UI offers, based on the GPU tier / VRAM. ## Notes - Related: the GPU tier classification in `llappviewer.cpp` (VRAM-based presets), the RAM/VRAM tickets #159–#164, and the RT VRAM-pressure ticket filed alongside this one. - Test on an 8 GB and a 12 GB card. Step the probe resolution up to the max and confirm the revert and the message appear instead of a crash.
Author
Owner

Part of #405 (RAM/VRAM management epic).

Part of #405 (RAM/VRAM management epic).
sky_line added this to the Slipstream project 2026-10-06 15:04:15 +00:00
Author
Owner

Verified 2026-10-10 (1.2.0 Beta 8 line): under a 2000 MB fake budget the setting-driven allocations were pre-checked (vramPick) and reduced instead of failing -- reflection probes 'requested 64^2 x 256 ... does not fit; reducing', sun cascades likewise -- no crash. Closing.

Verified 2026-10-10 (1.2.0 Beta 8 line): under a 2000 MB fake budget the setting-driven allocations were pre-checked (vramPick) and reduced instead of failing -- reflection probes 'requested 64^2 x 256 ... does not fit; reducing', sun cascades likewise -- no crash. Closing.
sky_line 2026-10-10 04:53:18 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
sky_line/Slipstream#226
No description provided.