Repository navigation
bugfix(w3d): Fix leaked surface copy in screenshot and movie capture - #3477
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThree screenshot and movie-capture paths now construct copied surfaces directly with ChangesScreenshot and movie-capture surfaces
Priority: ➖ Normal Estimated code review effort: 1 (Trivial) | ~4 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to This update only changes a file header comment and has no runtime effect. The screenshot surface-leak fix described in the PR was not examined here beyond its description. No merge-blocking risk is evident. Pre-merge checks |
|
|
Caball009
left a comment
There was a problem hiding this comment.
This might seem like an odd request, but could you update these 3 files? #3387
Otherwise it might be a while before there's another somewhat related change.
This is desired copyright text (note Zero Hour & 2026):
** Command & Conquer Generals Zero Hour(tm)
** Copyright 2026 TheSuperHackers
36bd02c to
43a4a16
Compare
43a4a16 to
b2696d5
Compare
There was a problem hiding this comment.
I can reproduce the leak with the main branch, and can confirm that these changes fix the leak. The resulting screenshots look as I'd expect at a quick glance. I did not check if the leak is indicative of a larger issue that requires more changes.
Looks ok to me.
|
Retail doesn't have this bug, so we must have introduced it, presumably in #1785. |
|
Retail has the bug in unused functionality I think. Not in the removed BMP screenshot however. It's part retail, part our. |
_Create_DX8_Surfacereturns a surface that already holds one reference. The screenshot code wraps it with theSurfaceClass(IDirect3DSurface8*)constructor, which goes throughAttachand takes a second one.~SurfaceClassreleases one, so the image surface is never freed.That is one back buffer sized system memory surface per screenshot, about 8 MB at 1080p and 33 MB at 4K.
Update_Movie_Capturedoes it once per captured frame.The copy is now built with
SurfaceClass(width, height, format), which creates the surface itself and owns the only reference. SameCreateImageSurface, same blit from the back buffer, same lock on the system memory copy, so the GPU side is still never locked._Get_DX8_Back_Bufferalready does the equivalent by releasing the raw pointer right after wrapping it.Applies to
W3D_TakeCompressedScreenshot,WW3D::Make_Screen_ShotandWW3D::Update_Movie_Capture.Found while auditing for memory leaks with the debug memory pool report.