Repository navigation
fix(w3d): Fix crashes, leaks and memory exhaustion on device reset - #639
Open
tintinhamans wants to merge 6 commits into
Open
tintinhamans wants to merge 6 commits into
tintinhamans wants to merge 6 commits into
Conversation
…heSuperHackers#3449) (cherry picked from commit dd161b0)
…heSuperHackers#3479) (cherry picked from commit 4f71d37)
tintinhamans
force-pushed
the
arctic/go/fix/upstream-device-reset
branch
from
October 22, 2026 21:14
cf5f8e9 to
4341f19
Compare
…th CopyRects (TheSuperHackers#3440) (cherry picked from commit 08ce896)
TheSuperHackers#3440) (cherry picked from commit 8b0430b)
…kers#3543) (cherry picked from commit 78ba6ea)
This was referenced Oct 22, 2026
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.
Combines the device reset fixes from #632, #634 and the previous version of this PR. A device reset happens on alt-tab in fullscreen, a lock screen, a UAC prompt or a resolution change, and each of these fixes covers a different way it went wrong. All commits except the last are
cherry-pick -xof merged upstream commits.Shroud: the shroud was uploaded with
CopyRectsevery frame. On NVIDIA the driver reserves memory for each call and allocates it all at the next reset, so after a long match one reset could take hundreds of MB and the 32-bit process ran out of address space (CLIENT-55X). On the upstream build a 10 minute skirmish followed by a forced reset lost 316 MB onmainand nothing with this change, andW3DShroud::renderwent from 0.032 ms to 0.006 ms per frame.Reset:
Reset_Devicecould crash in the driver (DestroyResourceduringReset) while the device still had a vertex buffer, index buffer, texture or render target bound. Buffers are now unbound once the device can be reset, render states are invalidated and the render target is reset beforeReset(), and the device is left alone until aReset()succeeds. Reproduced on the upstream retail build on an Intel UHD 770 and an RTX 4070 Ti: a bound render target plus a forced device loss failedReseton every frame forever, with this change both reset cleanly.Both
GeneralsMDandGeneralsare changed where the code exists twice. The code of every commit is identical to the separate PRs it replaces.Tested: Zero Hour (
z_generals) builds here. The shroud and reset measurements above were made on the upstream build.