graphics: honour PS5 0x10 DCC register clears (GTA V black smoke) #2394

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

@⁠oguzhanozfe on GitHub · 2026-11-18 22:22 UTC · original
oguzhanozfe:fix/gta5-dcc-0x10-register-clear → main · +12 −4 · 4 files · 1 commits · open

Summary

Fixes black smoke and particles in Grand Theft Auto V (PPSA04263 / PPSA04264). In the Father/Son cutscene, Michael's exhaled cigar smoke, and small particles over the sky, render as opaque black blobs instead of translucent smoke (#979: "Smoke renders black in some areas").

This picks up TheCruZ's closed #1234 and finishes it for current main.

Problem

The particle pixel shader also writes its view depth to an R16_FLOAT MRT blended with MIN. GTA V clears that target to 65504 (CB_COLOR_CLEAR_WORD0 = 0x7bff7bff) with a DCC fast clear whose metadata keys are 0x10.

Two places only accepted the GFX10 0x20 key as a clear-to-register:

  1. DecodeColorClear (textureCache.cpp). This is the CPU decode #1234 fixed.
  2. The native metadata check in gpu_tiler_color_clear.comp, which was added after #1234. It requires (key & 0x1f) == 0 and picks a slot with key >> 5, so a 0x10 key never matched.

Because of that the clear is dropped and the target keeps zeros. MIN(0, depth) then stays 0, and depth of field treats the smoke as touching the camera, so it blends in the dark near-field blur.

Change

  • DecodeColorClear: 0x10 DCC keys decode as a register clear, like 0x20.
  • gpu_tiler_color_clear.comp: a 0x10 key is checked in 0x20's slot. Both keys mean "clear to CB_COLOR_CLEAR_WORD", so the existing per-slot decode (DecodeColorClear(key << 5)) and the metadata expansion work unchanged.
  • tiler.h: the slot comment mentions the shared slot.
  • Test: RenderExecutorColorMetadataClear gets a case that fills an R16_FLOAT target's metadata with 0x10 keys and clear word 0x7bff7bff.

Testing

Windows 11, Ryzen 9 5950X, RTX 3090, clang-cl (LLVM 23), Release.

  • shader_recompiler_compute_tests --dcc-clear-only
    • without this change: RenderExecutorColorMetadataClear failed at GPU color clear value: native metadata did not materialize the expected color
    • with this change: RenderExecutorColorMetadataClear ok
    • The CPU-decode change alone, as in #1234, still fails this test. The shader change is needed on current main.
  • --compute-meta-clear-only, --image-overlap-only and the default full run all pass (exit 0).
  • In-game: TheCruZ verified the CPU-side change in GTA V on his fork (#1234). I have not yet run GTA V on this exact branch. A before/after screenshot of the Father/Son cutscene will follow here. Reports from #979 / #810 testers are welcome.

AI usage

AI (Claude Opus 5.5) was used to:

  • find the second, GPU-side 0x20-only check
  • implement the change
  • run the tests above
  • draft this description

The 0x10 finding and the original fix are TheCruZ's (#1234), credited with Co-authored-by.

🤖 Generated with Claude Code

**@⁠oguzhanozfe** on GitHub · 2026-11-18 22:22 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2394) `oguzhanozfe:fix/gta5-dcc-0x10-register-clear` → `main` · +12 −4 · 4 files · 1 commits · open ## Summary Fixes black smoke and particles in **Grand Theft Auto V** (PPSA04263 / PPSA04264). In the Father/Son cutscene, Michael's exhaled cigar smoke, and small particles over the sky, render as opaque black blobs instead of translucent smoke (#979: "Smoke renders black in some areas"). This picks up TheCruZ's closed #1234 and finishes it for current `main`. ## Problem The particle pixel shader also writes its view depth to an `R16_FLOAT` MRT blended with `MIN`. GTA V clears that target to 65504 (`CB_COLOR_CLEAR_WORD0 = 0x7bff7bff`) with a DCC fast clear whose metadata keys are `0x10`. Two places only accepted the GFX10 `0x20` key as a clear-to-register: 1. `DecodeColorClear` (`textureCache.cpp`). This is the CPU decode #1234 fixed. 2. The native metadata check in `gpu_tiler_color_clear.comp`, which was added after #1234. It requires `(key & 0x1f) == 0` and picks a slot with `key >> 5`, so a `0x10` key never matched. Because of that the clear is dropped and the target keeps zeros. `MIN(0, depth)` then stays 0, and depth of field treats the smoke as touching the camera, so it blends in the dark near-field blur. ## Change - `DecodeColorClear`: `0x10` DCC keys decode as a register clear, like `0x20`. - `gpu_tiler_color_clear.comp`: a `0x10` key is checked in `0x20`'s slot. Both keys mean "clear to `CB_COLOR_CLEAR_WORD`", so the existing per-slot decode (`DecodeColorClear(key << 5)`) and the metadata expansion work unchanged. - `tiler.h`: the slot comment mentions the shared slot. - Test: `RenderExecutorColorMetadataClear` gets a case that fills an `R16_FLOAT` target's metadata with `0x10` keys and clear word `0x7bff7bff`. ## Testing Windows 11, Ryzen 9 5950X, RTX 3090, clang-cl (LLVM 23), Release. - `shader_recompiler_compute_tests --dcc-clear-only` - without this change: `RenderExecutorColorMetadataClear failed at GPU color clear value: native metadata did not materialize the expected color` - with this change: `RenderExecutorColorMetadataClear ok` - The CPU-decode change alone, as in #1234, still fails this test. The shader change is needed on current `main`. - `--compute-meta-clear-only`, `--image-overlap-only` and the default full run all pass (exit 0). - **In-game:** TheCruZ verified the CPU-side change in GTA V on his fork (#1234). I have not yet run GTA V on this exact branch. A before/after screenshot of the Father/Son cutscene will follow here. Reports from #979 / #810 testers are welcome. ## AI usage AI (Claude Opus 5.5) was used to: - find the second, GPU-side `0x20`-only check - implement the change - run the tests above - draft this description The `0x10` finding and the original fix are TheCruZ's (#1234), credited with `Co-authored-by`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Grand Theft Auto V (PPSA04263/PPSA04264) clears its R16_FLOAT particle
depth MRT to 65504 (CB_COLOR_CLEAR_WORD0 = 0x7bff7bff) with a DCC fast
clear whose metadata keys are 0x10. Only the GFX10 0x20 key was treated
as a clear-to-register, so the clear was dropped, the target kept zeros,
MIN blending kept 0, and depth of field drew cigar smoke and sky
particles as opaque black blobs (#979).

Treat 0x10 as a register clear in DecodeColorClear, and fold it into
0x20's slot in the native metadata check (gpu_tiler_color_clear.comp),
which required keys to be multiples of 0x20 and so never matched it.

Ported from TheCruZ's closed #1234, which only covered the CPU decode;
main has since gained the native GPU check, which needed the same key.

Co-authored-by: TheCruZ <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:19:32 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-18 22:27 UTC · original

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

For non-Cmask metadata, DecodeColorClear now treats keys 0x10 and 0x20 as register clears. The shader maps key 0x10 to 0x20 for slot selection and key-mask matching. The tiler comment documents that both keys share a slot. A compute test case adds a 16-bit clear with value 0x7bff7bff.

Suggested reviewers: mrbigbritches, nmzik

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Minimal · up to 041fb

This change makes the renderer treat PS5 DCC key 0x10 as a register clear, which should fix the black smoke and particles in GTA V. No concrete merge-blocking risk was found. The author has not tested GTA V on this exact branch.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: PS5 0x10 DCC register clears are now honoured, which matches the changes to DecodeColorClear, the GPU color clear shader, and the test case. It also names the user-vis…
Description check Passed The description explains the problem (black smoke and particles in GTA V), the root cause (0x10 DCC keys rejected by DecodeColorClear and the native metadata check in gpu_tiler_color_clear.comp), the …
Linked Issues check Passed The only linked issue, #1234, is closed and completed. The linked-issue context marks it as historical background only. No active directly linked targets remain, so no linked-issue coding requirements…
Out of Scope Changes check Passed Every changed file serves the stated objective of treating DCC key 0x10 as a clear to CB_COLOR_CLEAR_WORD. textureCache.cpp (DecodeColorClear) accepts 0x10 alongside 0x20 for non-Cmask metadata. gpu_t…
Full details: Title check

Explanation

The title names the main change: PS5 0x10 DCC register clears are now honoured, which matches the changes to DecodeColorClear, the GPU color clear shader, and the test case. It also names the user-visible symptom (GTA V black smoke). The title is fairly long, but it is specific and related to the changeset.

Full details: Description check

Explanation

The description explains the problem (black smoke and particles in GTA V), the root cause (0x10 DCC keys rejected by DecodeColorClear and the native metadata check in gpu_tiler_color_clear.comp), the planned change, and the test results. It matches the changeset closely.

Full details: Linked Issues check

Explanation

The only linked issue, #1234, is closed and completed. The linked-issue context marks it as historical background only. No active directly linked targets remain, so no linked-issue coding requirements apply to this pull request. The pull request states its own intent: handle PS5 DCC metadata key 0x10 as a register clear, in both DecodeColorClear and the native metadata check in gpu_tiler_color_clear.comp. The #1234 acceptance criteria are not treated as requirements.

Full details: Out of Scope Changes check

Explanation

Every changed file serves the stated objective of treating DCC key 0x10 as a clear to CB_COLOR_CLEAR_WORD. textureCache.cpp (DecodeColorClear) accepts 0x10 alongside 0x20 for non-Cmask metadata. gpu_tiler_color_clear.comp maps 0x10 to the 0x20 slot before the mask test. tiler.h updates the slot comment to match. ShaderRecompilerComputeTests.cpp adds a 0x10 test case that covers the same behavior. No change falls outside this objective. The GTA V in-game result is not verified on this branch, but that uncertainty concerns verification, not scope.

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a90be8dd73 and 041fbb830f.

Files selected for processing: 4

  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/image/tiler.h
  • src/graphics/host_gpu/shaders/gpu_tiler_color_clear.comp
  • tests/ShaderRecompilerComputeTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-11-18 22:27 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2394#issuecomment-6993463504) <!-- coderabbit-ai-generated:v1 --> <!-- 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/2394?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_status_start --> No actionable comments were generated in the recent review. <!-- recent_review_status_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> <br> For non-Cmask metadata, `DecodeColorClear` now treats keys `0x10` and `0x20` as register clears. The shader maps key `0x10` to `0x20` for slot selection and key-mask matching. The tiler comment documents that both keys share a slot. A compute test case adds a 16-bit clear with value `0x7bff7bff`. **Suggested reviewers:** `mrbigbritches`, `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"041fbb830f7206c216299b75c08b60461f1a62b0" --> <!-- change_assessment_priority:{"version":1,"urgency":"p2","manual":false} --> **Change:** Bug fix · **Severity of issue fixed:** Medium <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>041fb</code></summary> <dl> <dd> <br> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `041fb` --> <!-- final_review_risk_coverage:{"sourceCommitId":"041fbb830f7206c216299b75c08b60461f1a62b0","coveredCommitId":"041fbb830f7206c216299b75c08b60461f1a62b0","kind":"reviewed"} --> This change makes the renderer treat PS5 DCC key 0x10 as a register clear, which should fix the black smoke and particles in GTA V. No concrete merge-blocking risk was found. The author has not tested GTA V on this exact branch. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- 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-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4</strong></summary> <dl> <dd> <br> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title names the main change: PS5 0x10 DCC register clears are now honoured, which matches the changes to DecodeColorClear, the GPU color clear shader, and the test case. It also names the user-vis… | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description explains the problem (black smoke and particles in GTA V), the root cause (0x10 DCC keys rejected by DecodeColorClear and the native metadata check in gpu_tiler_color_clear.comp), the … | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The only linked issue, `#1234`, is closed and completed. The linked-issue context marks it as historical background only. No active directly linked targets remain, so no linked-issue coding requirements… | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Every changed file serves the stated objective of treating DCC key 0x10 as a clear to CB_COLOR_CLEAR_WORD. textureCache.cpp (DecodeColorClear) accepts 0x10 alongside 0x20 for non-Cmask metadata. gpu_t… | <details> <summary><strong>Full details: Title check</strong></summary> <dl> <dd> <br> **Explanation** The title names the main change: PS5 0x10 DCC register clears are now honoured, which matches the changes to DecodeColorClear, the GPU color clear shader, and the test case. It also names the user-visible symptom (GTA V black smoke). The title is fairly long, but it is specific and related to the changeset. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> <br> **Explanation** The description explains the problem (black smoke and particles in GTA V), the root cause (0x10 DCC keys rejected by DecodeColorClear and the native metadata check in gpu_tiler_color_clear.comp), the planned change, and the test results. It matches the changeset closely. </dd> </dl> </details> <details> <summary><strong>Full details: Linked Issues check</strong></summary> <dl> <dd> <br> **Explanation** The only linked issue, `#1234`, is closed and completed. The linked-issue context marks it as historical background only. No active directly linked targets remain, so no linked-issue coding requirements apply to this pull request. The pull request states its own intent: handle PS5 DCC metadata key 0x10 as a register clear, in both DecodeColorClear and the native metadata check in gpu_tiler_color_clear.comp. The `#1234` acceptance criteria are not treated as requirements. </dd> </dl> </details> <details> <summary><strong>Full details: Out of Scope Changes check</strong></summary> <dl> <dd> <br> **Explanation** Every changed file serves the stated objective of treating DCC key 0x10 as a clear to CB_COLOR_CLEAR_WORD. textureCache.cpp (DecodeColorClear) accepts 0x10 alongside 0x20 for non-Cmask metadata. gpu_tiler_color_clear.comp maps 0x10 to the 0x20 slot before the mask test. tiler.h updates the slot comment to match. ShaderRecompilerComputeTests.cpp adds a 0x10 test case that covers the same behavior. No change falls outside this objective. The GTA V in-game result is not verified on this branch, but that uncertainty concerns verification, not scope. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2394)! 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> <br> - [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) </dd> </dl> </details> <!-- tips_end --> <!-- recent_review_start --> <h6> <details> <summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Recent review info</strong></summary> <dl> <dd> <br> <!-- review_info_content --> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary> <dl> <dd> <br> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/a90be8dd7304640cf4176a975871d51443710292/.coderabbit.yaml>) - **Commit**: [a90be8d](<https://github.com/KytyPS5/KytyPS5/commit/a90be8dd7304640cf4176a975871d51443710292>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `6d277e0b-d4a8-4df6-a375-dd08e2fb16f8` </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary> <dl> <dd> <br> Reviewing files that changed from the base of the PR and between a90be8dd7304640cf4176a975871d51443710292 and 041fbb830f7206c216299b75c08b60461f1a62b0. </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 4</strong></summary> <dl> <dd> <br> * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` * `src/graphics/host_gpu/renderer/image/tiler.h` * `src/graphics/host_gpu/shaders/gpu_tiler_color_clear.comp` * `tests/ShaderRecompilerComputeTests.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. </dd> </dl> </details> </h6> <!-- recent_review_end -->
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/2394/head:github-bot/gh-2394'
git switch 'github-bot/gh-2394'

Merge

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