graphics: handle in-place depth-to-color copies (BO2 Monsoon crash) #2455
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!2455
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2455"
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?
@HarrySpruce on GitHub · 2026-11-20 13:23 UTC · original
HarrySpruce:bo2-inplace-depth-to-color→main· +9 −0 · 1 files · 1 commits · draftBug: Call of Duty: Black Ops II (PPSA34502) crashes while loading the campaign mission Monsoon, on build
a1fc5ae:Cause: The draw that crashes is a
copy_depth_to_colordraw. Its color target and its depth target are the same memory. I logged the targets while rediscovering them:Finding the color target as a RenderTarget recreates the depth image as a color image, and finding the depth target recreates it back again. So by the time
AcquireRenderTargetsruns, one of the two is always stale. I tried rediscovering both until they settled first: they swapped on every pass and never settled.Change: in
CopyDepthToColor, when the color and depth targets start at the same address, the guest is converting its depth buffer into a color view of the same memory. Finding the color image already replaces the depth image with a copy of its data (TextureCacherecreates a depth image found as a RenderTarget and copies it through a buffer), so the draw does that and returns without the image copy. Copies between different images are unchanged.Tested: Windows 11, i5-13600KF, RTX 4070, PPSA34502 v01.010.000. Monsoon loads and plays with this handling. The tested build also carried an extra target-rediscovery loop that this PR leaves out. The in-place check returns before that loop runs, so the loop did not affect the result. I have not yet looked closely for visual problems in the effects that read this target.
AI-assisted: yes (diagnosis, code and description).
🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.