graphics: keep HTile clear state while its depth surface is bound (PPSA23566) #1743
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!1743
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1743"
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?
@0xcrstn on GitHub · 2026-10-20 01:28 UTC · original
0xcrstn:fix/ufc6-htile-clear-recreate→main· +104 −4 · 3 files · 2 commits · openGame and problem
EA SPORTS UFC 6 (PPSA23566, 01.004.000), Windows 11, RTX 5090 (driver 617.42). At fighter select (and some fight and menu scenes) the fighters render with black blocks and torn silhouettes, and the screen flashes.
A RenderDoc capture of fighter select shows why. The fighter depth pass begins (
vkCmdBeginRendering) on a 3200x1800 D32S8 image with depth and stencilloadOp = LOAD. Kyty created that image in the same frame and filled it from guest memory (vkCmdCopyBufferToImage). Before the first draw it holds a repeating stripe pattern, not a cleared value. The draws useGreaterEqual(reverse Z), so fighter fragments only land where they beat that garbage, and the depth-tested lighting fails wherever the silhouette is missing.Cause
I logged the HTile state on every depth-target bind, every guest HTile clear (
TextureCache::ClearMeta), and every depth image recreate and delete:ResolveDepthOverlaprecreate the native image (stencil mismatch), about 200 times each way in one session.DeleteImageerases the old image'sm_surface_metasentry. When the game then clears that HTile,ClearMetafinds no entry and drops the clear (known=false).htile_initial_clear = false, finds no pending clear, andAcquireRenderTargetsloads stale memory instead of clearing. 423 of 430 binds of this surface had no clear.The bug is on
main; nothing else is needed to reach fighter select.Change
MetaDataInfo::depth_addressrecords the depth surface (the native image base) each HTile was last bound with.FindDepthTargetsets it. When an HTile moves to another surface, its clear state restarts from that surface'shtile_initial_clear.DeleteImagekeeps a surface's HTile state while another registered HTile depth image of the same surface remains. Otherwise it erases every entry that surface owns, and only those. An HTile another surface has rebound stays with that surface.All the erase points stay tied to the guest depth surface: the last HTile depth image of the surface is deleted, a non-depth replacement, unmap, or color metadata reuse.
Relation to
d8c4a9af/c3e7ec82/2c730e58d8c4a9afmade HTile state belong to guest memory and never erased it on image deletion.c3e7ec82fixed a Jusant regression from it, and2c730e58reverted both together with opt-in ZMask. I found no stated reason for the revert. Two things I took from them:renderCompute.cpptreats a compute dispatch writing a known metadata address as a clear and skips it, andFillBufferrecords a clear too. That is why this change never keeps an entry without a live HTile depth image of its surface.main. There, depth is replaced by an R32 storage image, the HTile is cleared, and depth is recreated. A non-depth replacement drops the state, so a clear recorded while the surface was storage does not apply.Please check whether this also fits whatever prompted the revert.
Testing
New checks in
CheckUnifiedTextureCacheFlow(--htile-clear-only):The first check fails on
main("the D32 HTile was forgotten when its depth surface switched to D32S8"). The surface-change and rebinding checks fail without their parts of the change.shader_recompiler_compute_tests: all cases pass (Windows, clang-cl, RTX 5090).UFC 6 on my integration build (this change plus my open topics): fighter select and other screens render correctly. A RenderDoc capture shows the 3200x1800 depth passes begin with
CLEAR, and that surface's binds that applied a clear went from 7 of 430 to 41 of 69.AI use
Claude Code did the investigation:
It wrote the change and the tests, ran the test suite, and ran the Claude, Codex and CodeRabbit reviews. The reviews found the owner-key, surface-change and rebinding cases, now fixed and tested.
I reviewed the evidence and the change, captured the frames in RenderDoc, and played the game on the integration build to confirm the rendering.
🤖 Generated with Claude Code
@coderabbitai[bot] on GitHub · 2026-10-20 01:32 UTC · original
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
f838e6c6-9a60-4f3d-9c0b-7a21728c6f57📥 Commits
Reviewing files that changed from the base of the PR and between
f186b35706and6d60824c6b.📒 Files selected for processing: 3
src/graphics/host_gpu/renderer/cache/textureCache.cppsrc/graphics/host_gpu/renderer/cache/textureCache.htests/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.
📝 Walkthrough
The change adds a depth address to HTile metadata.
FindDepthTargetresets and reapplies initial clear state when the native depth image address changes.DeleteImageretains metadata while another registered primary depth image remains for the same surface address. A new test covers clear-state retention, metadata reuse, and retirement during rebinding and unmapping.Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
6d608The reviewed HTile lifecycle changes are ready to merge after normal checks.
Pre-merge checks:
4 ·
1
Full details: Docstring Coverage
Explanation
Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 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.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.