renderer: decode 64-bit color register clears #1188

Closed
github-bot wants to merge 1 commit from gh-pr/1188/head into gh-pr/1188/base
Owner

@⁠NeySlim on GitHub · 2026-10-08 05:15 UTC · original
NeySlim:fix/color-clear-64bit → main · +46 −1 · 4 files · 1 commits · closed without merging

Problem

When a render target is bound with a fully cleared CMASK or DCC (CMASK key 0, DCC key 0x20), MaterializeColorClear rebuilds the clear from CB_COLORn_CLEAR_WORD0. For 64-bit targets the clear color spans both CLEAR_WORD0 and CLEAR_WORD1. DecodePackedColorClear only gets the first word and does not handle R16G16B16A16_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_SFLOAT post-processing targets this way (clear words 0x00000000/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

  • ImageMetadataInfo carries clear_word_hi from CB_COLORn_CLEAR_WORD1.
  • New DecodeRegisterColorClear decodes two-word clears for R16G16B16A16_SFLOAT, R16G16B16A16_UNORM, R32G32_SFLOAT and R32G32_UINT, and falls back to DecodePackedColorClear for 32-bit formats.
  • DecodeColorClear uses it for register clears.

Test

RenderExecutorColorMetadataClear gains a case for an R16G16B16A16_SFLOAT clear (1, -1, 0.5, 2) and an R32G32_SFLOAT clear (1, -2). Both channels from CLEAR_WORD1 must be decoded. The check is plain host code and runs on every platform.

Validation

Linux, AMD Radeon 8060S, Mesa RADV 26.2.3.

  • RenderExecutorColorMetadataClear passes. With the decoder reverted to the first word only, it fails with 64-bit register clear ignored CB_COLOR_CLEAR_WORD1.
  • God of War Ragnarök: in a new RenderDoc capture, the half-resolution target is cleared to (0, 0, 0, 1) before its draws instead of being uploaded from guest memory, and the blocky garbage is gone from the post-processing chain. Other rendering issues remain in the game and are unrelated to this change.

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.

**@⁠NeySlim** on GitHub · 2026-10-08 05:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1188) `NeySlim:fix/color-clear-64bit` → `main` · +46 −1 · 4 files · 1 commits · closed without merging ## Problem When a render target is bound with a fully cleared CMASK or DCC (CMASK key 0, DCC key 0x20), `MaterializeColorClear` rebuilds the clear from `CB_COLORn_CLEAR_WORD0`. For 64-bit targets the clear color spans both `CLEAR_WORD0` and `CLEAR_WORD1`. `DecodePackedColorClear` only gets the first word and does not handle `R16G16B16A16_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_SFLOAT` post-processing targets this way (clear words `0x00000000/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 - `ImageMetadataInfo` carries `clear_word_hi` from `CB_COLORn_CLEAR_WORD1`. - New `DecodeRegisterColorClear` decodes two-word clears for `R16G16B16A16_SFLOAT`, `R16G16B16A16_UNORM`, `R32G32_SFLOAT` and `R32G32_UINT`, and falls back to `DecodePackedColorClear` for 32-bit formats. - `DecodeColorClear` uses it for register clears. ## Test `RenderExecutorColorMetadataClear` gains a case for an `R16G16B16A16_SFLOAT` clear (1, -1, 0.5, 2) and an `R32G32_SFLOAT` clear (1, -2). Both channels from `CLEAR_WORD1` must be decoded. The check is plain host code and runs on every platform. ## Validation Linux, AMD Radeon 8060S, Mesa RADV 26.2.3. - `RenderExecutorColorMetadataClear` passes. With the decoder reverted to the first word only, it fails with `64-bit register clear ignored CB_COLOR_CLEAR_WORD1`. - God of War Ragnarök: in a new RenderDoc capture, the half-resolution target is cleared to (0, 0, 0, 1) before its draws instead of being uploaded from guest memory, and the blocky garbage is gone from the post-processing chain. Other rendering issues remain in the game and are unrelated to this change. 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:47:07 +00:00
github-bot closed this pull request 2026-11-26 09:47:08 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-08 05:19 UTC · original · edited 2026-10-12 16:02 UTC

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 14 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a47be15c-423d-4455-91c6-3e080431608b

📥 Commits

Reviewing files that changed from the base of the PR and between e58cc3dd3940a99f478e05bdbf4a902a39fcf511 and f48b889599.


📒 Files selected for processing (4)
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/colorRenderTarget.cpp
  • src/graphics/host_gpu/renderer/image/imageInfo.h
  • tests/ShaderRecompilerComputeTests.cpp

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 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.cpp

Included 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: nmzik


Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to e58cc

Supported 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 | Passed 4 | Inconclusive 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage Inconclusive 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… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check Passed The description clearly explains the 64-bit color register clear problem, the decoder changes, affected formats, tests, and validation results.
Title check Passed The title clearly and concisely identifies the main change: decoding 64-bit color register clears in the renderer.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

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.)


  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-08 05:19 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1188#issuecomment-6052900412) · edited 2026-10-12 16:02 UTC <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1188?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> <!-- review_stack_entry_end --> <!-- This is an auto-generated comment: rate limited by coderabbit.ai --> > [!WARNING] > ## Review limit reached > > You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. > > **Next included review available in 14 minutes.** > > [Check out review usage here](https://app.coderabbit.ai/dashboard/review-capacity?orgId=d7cf2749-f181-4119-ba0c-ad79606afdfe). > > <details> > <summary><strong>View limit details</strong></summary> > <dl> > <dd> > > **Limit details:** You’ve used all 8 included reviews currently available. > > [Learn how review limits work](https://docs.coderabbit.ai/management/plans#rate-limits). > > **Review configuration:** > > <details> > <summary><strong>⚙️ Run configuration</strong></summary> > <dl> > <dd> > > - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml > - **Review profile**: CHILL > - **Plan**: Advanced > - **Run ID**: `a47be15c-423d-4455-91c6-3e080431608b` > > > <hr> > > </dd> > </dl> > </details> > > <details> > <summary><strong>📥 Commits</strong></summary> > <dl> > <dd> > > Reviewing files that changed from the base of the PR and between e58cc3dd3940a99f478e05bdbf4a902a39fcf511 and f48b889599bf34048662ff365ac7e7f004e213ee. > > > <hr> > > </dd> > </dl> > </details> > > <details> > <summary><strong>📒 Files selected for processing (4)</strong></summary> > <dl> > <dd> > > * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` > * `src/graphics/host_gpu/renderer/colorRenderTarget.cpp` > * `src/graphics/host_gpu/renderer/image/imageInfo.h` > * `tests/ShaderRecompilerComputeTests.cpp` > > </dd> > </dl> > </details> > > > <hr> > > </dd> > </dl> > </details> <!-- end of auto-generated comment: rate limited by coderabbit.ai --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary><strong>ℹ️ Recent review info</strong></summary> <dl> <dd> <details> <summary><strong>⚙️ Run configuration</strong></summary> <dl> <dd> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `53058584-bffb-41d6-bf7b-23833f2968ab` <hr> </dd> </dl> </details> <details> <summary><strong>📥 Commits</strong></summary> <dl> <dd> Reviewing files that changed from the base of the PR and between 7ced1f6ccfcb2b4d5ba539d05da63d2833bb87f8 and e58cc3dd3940a99f478e05bdbf4a902a39fcf511. <hr> </dd> </dl> </details> <details> <summary><strong>📒 Files selected for processing (1)</strong></summary> <dl> <dd> * `tests/ShaderRecompilerComputeTests.cpp` <hr> </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review. <hr> </dd> </dl> </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> ## 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:** `nmzik` <hr> </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"e58cc3dd3940a99f478e05bdbf4a902a39fcf511" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** **⚪ Minimal** · up to `e58cc` <!-- final_review_risk_coverage:{"sourceCommitId":"e58cc3dd3940a99f478e05bdbf4a902a39fcf511","coveredCommitId":"e58cc3dd3940a99f478e05bdbf4a902a39fcf511","kind":"reviewed"} --> Supported 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. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks | <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v1.svg" width="14" height="17" align="middle" alt="Passed" title="Passed"></picture></sup> 4 | <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-inconclusive-14-v1.svg" width="14" height="17" align="middle" alt="Inconclusive" title="Inconclusive"></picture></sup> 1</strong></summary> <dl> <dd> ### ❌ Failed checks (1 inconclusive) | Check name | Status | Explanation | Resolution | | :---------------- | :--------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Inconclusive](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-inconclusive.svg) | 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… | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong>✅ Passed checks (4 passed)</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------- | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description clearly explains the 64-bit color register clear problem, the decoder changes, affected formats, tests, and validation results. | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly and concisely identifies the main change: decoding 64-bit color register clears in the renderer. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | <hr> </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> **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.) </dd> </dl> </details> <hr> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autopilot</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1188)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>❤️ Share</strong></summary> <dl> <dd> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) <hr> </dd> </dl> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠NeySlim on GitHub · 2026-10-09 19:53 UTC · original

Rebased on main (59183dbf), no conflicts; #1200 is rebased on top of it. RenderExecutorColorMetadataClear still 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-09 19:53 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1188#issuecomment-6088195643) Rebased on main (59183dbf), no conflicts; #1200 is rebased on top of it. `RenderExecutorColorMetadataClear` still 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.
Author
Owner

@⁠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 31b7be9f and 3c9da9c3. Closing.

**@⁠NeySlim** on GitHub · 2026-10-14 07:04 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1188#issuecomment-6162859898) Folded what is left (R16G16B16A16_UNORM and R32G32_UINT register clears) into #1200, the rest landed in 31b7be9f and 3c9da9c3. Closing.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.