[Ready to merge] Fix automatic mip-drop fallback on E_OUTOFMEMORY (0x8007000E) #1302
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-24T17:17:15Z.
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