[Ready to merge] Fix automatic mip-drop fallback on E_OUTOFMEMORY (0x8007000E) #1302

Closed
opened 2026-11-26 04:26:54 +00:00 by github-bot · 0 comments
Owner

@⁠Xvania7 on GitHub · 2026-11-24 17:17 UTC · original

Thanks for the report @⁠Logan-Gaillard!

Root Cause

When loading large worlds, VRAM allocations on 8 GB cards exceed host adapter capacity during CreateCommittedResource. Instead of dropping high-resolution mip levels or falling back gracefully, Direct3D returns E_OUTOFMEMORY (0x8007000E), which caused the host texture creation to abort and triggered device removal (DXGI_ERROR_DEVICE_REMOVED).

Changes
Integrated texture mip-drop scaling infrastructure for eligible pure-sampled textures.
Added create_texture_with_auto_mip_drop wrapper around host CreateCommittedResource:
Intercepts E_OUTOFMEMORY (0x8007000E).
Dynamically escalates an atomic process-wide PRESSURE level (PRESSURE.fetch_max).
Retries allocation with downscaled mips (up to 3 levels, saving ~75% to ~93% VRAM per texture) before giving up.
Subsequent texture allocations automatically inherit the escalated pressure level to avoid repeated allocation failures.
Updated hand_out_resource to read the surviving mip count directly from the created resource descriptor (texture.GetDesc().MipLevels).
Added synthetic unit test auto_mip_drop_on_oom_escalates_pressure_and_drops_mips verifying the full recovery loop, pressure escalation, and RT/UAV preservation.

Tested on crates/victory-gpu:

cargo test -p victory-gpu (54 passed)
cargo clippy -p victory-gpu --all-targets -- -D warnings (clean)
cargo xtask policy (passed)

Branch: fix/issue-1226-auto-mip-drop

**@⁠Xvania7** on GitHub · 2026-11-24 17:17 UTC · [original](https://github.com/Marvisak/VIctory/issues/1302) Thanks for the report @⁠Logan-Gaillard! Root Cause When loading large worlds, VRAM allocations on 8 GB cards exceed host adapter capacity during CreateCommittedResource. Instead of dropping high-resolution mip levels or falling back gracefully, Direct3D returns E_OUTOFMEMORY (0x8007000E), which caused the host texture creation to abort and triggered device removal (DXGI_ERROR_DEVICE_REMOVED). Changes Integrated texture mip-drop scaling infrastructure for eligible pure-sampled textures. Added create_texture_with_auto_mip_drop wrapper around host CreateCommittedResource: Intercepts E_OUTOFMEMORY (0x8007000E). Dynamically escalates an atomic process-wide PRESSURE level (PRESSURE.fetch_max). Retries allocation with downscaled mips (up to 3 levels, saving ~75% to ~93% VRAM per texture) before giving up. Subsequent texture allocations automatically inherit the escalated pressure level to avoid repeated allocation failures. Updated hand_out_resource to read the surviving mip count directly from the created resource descriptor (texture.GetDesc().MipLevels). Added synthetic unit test auto_mip_drop_on_oom_escalates_pressure_and_drops_mips verifying the full recovery loop, pressure escalation, and RT/UAV preservation. Tested on crates/victory-gpu: cargo test -p victory-gpu (54 passed) cargo clippy -p victory-gpu --all-targets -- -D warnings (clean) cargo xtask policy (passed) Branch: [fix/issue-1226-auto-mip-drop](https://github.com/Xvania7/VIctory/tree/fix/issue-1226-auto-mip-drop)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:26:54 +00:00
This discussion has been locked. Commenting is limited to contributors.
No milestone
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory#1302
No description provided.