graphics: handle in-place depth-to-color copies (BO2 Monsoon crash) #2455

Open
github-bot wants to merge 1 commit from github-bot/gh-2455 into main AGit
Owner

@⁠HarrySpruce on GitHub · 2026-11-20 13:23 UTC · original
HarrySpruce:bo2-inplace-depth-to-color → main · +9 −0 · 1 files · 1 commits · draft

Bug: Call of Duty: Black Ops II (PPSA34502) crashes while loading the campaign mission Monsoon, on build a1fc5ae:

TextureCache: color target requires rediscovery before final acquisition
 in src\graphics\host_gpu\renderer\cache\textureCache.cpp:1419

Cause: The draw that crashes is a copy_depth_to_color draw. Its color target and its depth target are the same memory. I logged the targets while rediscovering them:

color addr=0xc062200000 size=0x280000 fmt=100 (R32_SFLOAT)
depth addr=0xc062200000 size=0x280000 fmt=126 (D32_SFLOAT)

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 AcquireRenderTargets runs, 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 (TextureCache recreates 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

**@⁠HarrySpruce** on GitHub · 2026-11-20 13:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2455) `HarrySpruce:bo2-inplace-depth-to-color` → `main` · +9 −0 · 1 files · 1 commits · draft **Bug:** Call of Duty: Black Ops II (PPSA34502) crashes while loading the campaign mission Monsoon, on build a1fc5ae: ``` TextureCache: color target requires rediscovery before final acquisition in src\graphics\host_gpu\renderer\cache\textureCache.cpp:1419 ``` **Cause:** The draw that crashes is a `copy_depth_to_color` draw. Its color target and its depth target are the same memory. I logged the targets while rediscovering them: ``` color addr=0xc062200000 size=0x280000 fmt=100 (R32_SFLOAT) depth addr=0xc062200000 size=0x280000 fmt=126 (D32_SFLOAT) ``` 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 `AcquireRenderTargets` runs, 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 (`TextureCache` recreates 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](https://claude.com/claude-code)
Black Ops II (PPSA34502) on Monsoon issues a copy_depth_to_color draw
whose R32_FLOAT color target and D32_FLOAT depth target are the same
memory (both 0xc062200000, 0x280000 bytes). Finding the color target
replaces the depth image and finding the depth target replaces the
color image, so acquisition always found one of them stale and hit
"TextureCache: color target requires rediscovery before final
acquisition" on mission load.

When the two share an address, the guest is converting its depth
buffer into a color view in place. Finding the color image already
replaces the depth image with a copy of its data, so do that and skip
the copy.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:20:41 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2455/head:github-bot/gh-2455'
git switch 'github-bot/gh-2455'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2455'
git switch 'github-bot/gh-2455'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2455'
git switch 'github-bot/gh-2455'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2455'
git switch 'main'
git merge --squash 'github-bot/gh-2455'
git switch 'main'
git merge --ff-only 'github-bot/gh-2455'
git switch 'main'
git merge 'github-bot/gh-2455'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.