[Ready to merge] Fix automatic mip-drop fallback on E_OUTOFMEMORY (0x8007000E) #1302
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#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?
@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