renderer: decode 64-bit color register clears #1188
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!1188
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1188/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?
@NeySlim on GitHub · 2026-10-08 05:15 UTC · original
NeySlim:fix/color-clear-64bit→main· +46 −1 · 4 files · 1 commits · closed without mergingProblem
When a render target is bound with a fully cleared CMASK or DCC (CMASK key 0, DCC key 0x20),
MaterializeColorClearrebuilds the clear fromCB_COLORn_CLEAR_WORD0. For 64-bit targets the clear color spans bothCLEAR_WORD0andCLEAR_WORD1.DecodePackedColorClearonly gets the first word and does not handleR16G16B16A16_SFLOAT, so the clear is skipped. The image keeps whatever bytes were last in guest memory.God of War Ragnarök (PPSA08332, 05.005) fast-clears its half-resolution
R16G16B16A16_SFLOATpost-processing targets this way (clear words0x00000000/0x3c000000, so (0, 0, 0, 1)). A RenderDoc capture shows the frame correct up to lighting and transparency. Then the half-resolution target is uploaded from stale guest memory, and the blocky purple/green garbage reaches the final image through the post-processing chain.Change
ImageMetadataInfocarriesclear_word_hifromCB_COLORn_CLEAR_WORD1.DecodeRegisterColorCleardecodes two-word clears forR16G16B16A16_SFLOAT,R16G16B16A16_UNORM,R32G32_SFLOATandR32G32_UINT, and falls back toDecodePackedColorClearfor 32-bit formats.DecodeColorClearuses it for register clears.Test
RenderExecutorColorMetadataCleargains a case for anR16G16B16A16_SFLOATclear (1, -1, 0.5, 2) and anR32G32_SFLOATclear (1, -2). Both channels fromCLEAR_WORD1must be decoded. The check is plain host code and runs on every platform.Validation
Linux, AMD Radeon 8060S, Mesa RADV 26.2.3.
RenderExecutorColorMetadataClearpasses. With the decoder reverted to the first word only, it fails with64-bit register clear ignored CB_COLOR_CLEAR_WORD1.Not tested on Windows. The change is platform-independent renderer code.
AI use
I used Claude Code (AI agent) to capture and analyze the frame in RenderDoc, find the dropped clear, write the change and the test, and run the tests above on my machine. I reviewed the diff and the results before opening this PR.
@coderabbitai[bot] on GitHub · 2026-10-08 05:19 UTC · original · edited 2026-10-12 16:02 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
53058584-bffb-41d6-bf7b-23833f2968ab📥 Commits
Reviewing files that changed from the base of the PR and between 7ced1f6ccfcb2b4d5ba539d05da63d2833bb87f8 and e58cc3dd3940a99f478e05bdbf4a902a39fcf511.
📒 Files selected for processing (1)
tests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.
📝 Walkthrough
Walkthrough
Register-based color clears now decode from both clear words for supported formats. Image metadata stores the high clear word, and render-target metadata setup copies it into that field. Tests check decoded channel values for half-float and two-component float formats.
Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
e58ccSupported wide-format register clears now preserve both words through decoding. No concrete rendering risk remains, so the change is ready for normal validation and merge.
Pre-merge checks |
4 |
1
❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
Full details: Docstring Coverage
Explanation
Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 3 files. (1 skipped: 1 too large.)
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.@NeySlim on GitHub · 2026-10-09 19:53 UTC · original
Rebased on main (
59183dbf), no conflicts; #1200 is rebased on top of it.RenderExecutorColorMetadataClearstill fails with the decoder reduced to the first word (64-bit register clear ignored CB_COLOR_CLEAR_WORD1). Full GPU suite with #1200 on top, one case per process: 602/612, same as main.@NeySlim on GitHub · 2026-10-14 07:04 UTC · original
Folded what is left (R16G16B16A16_UNORM and R32G32_UINT register clears) into #1200, the rest landed in
31b7be9fand3c9da9c3. Closing.Pull request closed