Repository navigation
fix(w3d): Fix crashes, leaks and memory exhaustion on device reset - #639
Open
tintinhamans wants to merge 10 commits into
Open
tintinhamans wants to merge 10 commits into
tintinhamans wants to merge 10 commits into
Conversation
tintinhamans
force-pushed
the
arctic/go/fix/upstream-device-reset
branch
from
October 22, 2026 21:14
cf5f8e9 to
4341f19
Compare
This was referenced Oct 22, 2026
tintinhamans
force-pushed
the
arctic/go/fix/upstream-device-reset
branch
from
October 28, 2026 01:47
5dd96f8 to
eae7225
Compare
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.
Fixes crashes, leaks and memory exhaustion on device reset (alt-tab, lock screen, UAC, resolution change). Folds #632 and #634. All but two commits are ports of merged upstream fixes, with the upstream number in the title: TheSuperHackers#3449 (refill the tree buffers), TheSuperHackers#3479 (flat terrain tile leak), TheSuperHackers#3440 (copy the shroud manually instead of
CopyRects, plus its follow-up), TheSuperHackers#3543 (release the cached textures at shutdown), TheSuperHackers#3045 (texture access bounds inW3DShroud::getShroudLevel()), TheSuperHackers#3475 (release the D3D8 library and interface whenDX8Wrapper::Init()fails) and TheSuperHackers#3566 (fill everyMissingTexturemip level directly, including the last row). One of the other two commits unbinds device resources beforeReset, the same as TheSuperHackers#3450 (approved, not merged yet).The
CopyRectsshroud upload made one reset take hundreds of MB on NVIDIA (CLIENT-55X); a 10 minute skirmish lost 316 MB onmain, none with this. A bound render target plus a device loss failedResetforever on an Intel UHD 770 and RTX 4070 Ti, now it recovers.The other commit falls back to the missing texture when
_Create_DX8_Texture(or its cube and volume variants) returns null, e.g. out of video memory after a failed reset. The loader returned success anyway andLock_Surfacescrashed on the null texture (CLIENT-19P, 3908 crashes, still 14 in the last 30 days).Tested:
z_generalsbuilds, measurements on the upstream build.