texture cache: convert D16<->D24/D32 depth copies instead of crashing #1873
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!1873
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1873/head"
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?
@bigjjmoneyman on GitHub · 2026-10-24 03:02 UTC · original
bigjjmoneyman:fix-mlb26-depth-crash→main· +97 −56 · 2 files · 1 commits · merged 2026-10-27 09:41 UTCProblem
MLB The Show 26 (PPSA30630) crashed in Image::CopyImageWithBuffer during
the pitcher intro cutscene, with:
condition (levels == 0 || source_bytes == 0 || source_bytes != destination_bytes
|| source_block != destination_block) is true in image.cpp:491
The game's shadow map (a 1024x1024 depth target) switches between
D16Unorm and D24UnormS8Uint at the same address during the cutscene.
TextureCache::CopyD16 already converts a D16 depth plane to/from a
16-bit color view via the GPU tiler, but explicitly declines when both
images are depth (source_depth == destination_depth), so this case
fell through to CopyImageWithBuffer's plain buffer copy, which
requires equal bytes-per-texel between source and destination and hit
the assertion above.
Changes
images at different precisions (D16Unorm <-> D24UnormS8Uint or
D32Sfloat), reusing the existing TileManager::ConvertD16 GPU
conversion pipeline (the same one CopyD16 already uses) instead of
the byte-copy path.
TextureCache::CopyImage, so anything still genuinely unsupported
keeps hitting the original assertion rather than being silently
skipped.
Testing
KytyPS5-2026-10-23-9dcff95, Windows 11, RTX 5070 Ti.
(source_depth == destination_depth for both images here).
longer crashes, the shadow map renders normally, and no new errors
or warnings appear in the log where the crash previously occurred.
of the correct depth output to compare against, only that the
rendered scene looks correct and matches the non-crashing frames
around it.
Notes
Investigated and drafted with AI assistance; I reviewed, built, and
tested the change myself before submitting.
@coderabbitai[bot] on GitHub · 2026-10-24 03:11 UTC · original · edited 2026-10-27 09:06 UTC
Walkthrough
CopyD16now selects promotion or demotion based on the depth-aspect transfer widths and uses the narrow image’s type to select its copy aspect. The test reads image aspects into four 32-bit words and checks fallback depth values when stencil is removed and restored.Suggested reviewers:
nmzikPriority:
Normal
Change: Bug fix
Merge Risk:
Low · up to
efa6bDepth conversion may leave stale stencil values in the replacement image. Preserve the stencil plane before merging, or explicitly accept this bounded risk.
Pre-merge checks:
4 ·
1
Full details: Title check
Explanation
The title names the main change: converting D16 to and from D24/D32 depth copies in the texture cache, as an alternative to crashing. It matches the PR objectives and the description of the new CopyDepthPrecision fallback. The title is 69 characters, which is within a reasonable length for a commit title.
Full details: Description check
Explanation
The description states the problem, the code changes, the testing done, and the limits of that testing. It relates directly to the texture cache change. It explains the CopyD16 and CopyImageWithBuffer fallback path and the new CopyDepthPrecision function. It also notes that the author added no automated test coverage.
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files. (1 skipped: 1 too large.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.@ -528,2 +526,3 @@0, 0, layers},{},color.info.extent}};narrow.info.extent}};@coderabbitai[bot] on GitHub · 2026-10-27 09:06 UTC · original
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 12890
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 28941
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 30221
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 21603
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 14425
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 9073
Script executed:
Repository: KytyPS5/KytyPS5
Length of output: 3978
Copy the stencil aspect during D16 conversion.
ExpandImageinitializes the replacement, copies the source, and then frees the source. For stenciled D16-to-D24/D32 images with both guestbytes_per_blockvalues equal to two,CopyImagereachesCopyD16, which transfers onlyeDepth. It does not transfereStencil.RefreshImagedoes not download GPU-modified contents. Therefore, a source with current GPU stencil data can leave the replacement with stale or undefined stencil values. Transfer the stencil aspect explicitly at this conversion boundary, using the stencil plane's one-byte layout and existing stencil association ranges.@coderabbitai[bot] on GitHub · 2026-10-27 09:06 UTC · original · reviewed
Actionable comments posted: 1
c2c9b98f-3a76-452e-9337-0ce20a170bdeReviewing files that changed from the base of the PR and between 11491620a9a49d98af143fbccd99ac95158ab273 and
efa6b0e610.src/graphics/host_gpu/renderer/cache/textureCache.cpptests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.