Repository navigation
fix(shroud): Stop the shroud upload from exhausting memory on device reset - #632
Open
tintinhamans wants to merge 2 commits into
Conversation
tintinhamans
force-pushed
the
arctic/go/fix/shroud-upload-reset-memory
branch
from
October 8, 2026 23:05
d5fe570 to
cb9956c
Compare
|
git init |
elopezgomez567-stack
approved these changes
Oct 9, 2026
tintinhamans
force-pushed
the
arctic/go/fix/shroud-upload-reset-memory
branch
from
October 9, 2026 21:31
cb9956c to
8744d24
Compare
elopezgomez567-stack
suggested changes
Oct 9, 2026
| #include "WW3D2/camera.h" | ||
| #include "WWLib/simplevec.h" | ||
| #include "WW3D2/dx8wrapper.h" | ||
| #include "WWMath/vector2i.h" |
tintinhamans
force-pushed
the
arctic/go/fix/shroud-upload-reset-memory
branch
from
October 10, 2026 14:08
8744d24 to
95170bb
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.

The shroud was uploaded to the GPU with
CopyRectson every frame. On NVIDIA the driver keeps a little memory for each of those calls and only allocates it when the device is reset. After a long match a single reset (lock screen, UAC prompt, alt-tab in fullscreen) allocates hundreds of MB in one go, and the 32-bit process runs out of address space.Resetthen fails with out of memory, which is where crashes like CLIENT-55X come from.The shroud now lives in a plain buffer,
m_shroudData, and is copied into a managed texture through a lock.CopyRects, the system-memory surface it copied from and the pitch member are gone. This is the same change as upstream TheSuperHackers#3440 (issue TheSuperHackers#3439), and the same design BFME ended up with.Measured on the upstream build, same skirmish at 120 fps for 10 minutes and then a forced device reset:
mainlost 316 MB of address space in that one reset, with this change it lost nothing. The upload is also cheaper,W3DShroud::renderwent from 0.032 ms to 0.006 ms per frame. On our own test setup an earlier version of this fix went through a 20 minute match and a screen lock without losing memory.The second commit fixes the
m_finalFogDatafill infillShroudData, which advanced the wrong pointer and only filled the first row. That code is behindDO_FOG_INTERPOLATION, so nothing changes in current builds.Both
GeneralsMDandGeneralsare changed. Zero Hour builds here; theGeneralshalf could not be compiled in this tree, it is the same code that builds upstream.