graphics: no DCC metadata for block-compressed textures (Demon's Souls) #2006

Open
github-bot wants to merge 7 commits from github-bot/gh-2006 into main AGit
Owner

@⁠Nawid3333 on GitHub · 2026-10-30 21:44 UTC · original
Nawid3333:fix/des-bc-dcc → main · +60 −4 · 2 files · 7 commits · open

Demon's Souls (PPSA01341) stops at invalid color metadata (image.cpp:670 on 751fbd096) in character creation. The texture is a 128x128 BC3_SRGB image (Vulkan format 138).

Cause. Its T# has MetaCompress set (fields[6] bit 21, COMPRESSION_EN) and MetaAddr() << 8 is 0x00003f39c0003e00, which is not a guest address. ResolveTexture gives it DCC metadata at that address, and TextureCache::FindImage exits in ImageOps::Validate (through ValidateImageDesc) because the range is not a valid GuestRange.

The RDNA2 ISA describes COMPRESSION_EN only as "enable delta color compression (DCC)" and does not say what it does for block-compressed formats. AMD's drivers do not set up DCC for these formats: Mesa leaves DCC off for block-compressed formats (ac_surface.c), and PAL's gfx10.3 format table lists BC1–BC7 as read-only textures with no color target (gfx10_3.yaml). In KytyPS5, render targets and video out cannot use BC formats, so nothing writes DCC data for a block-compressed image (colorRenderTarget.cpp:170–173 and gpu_format.cpp:91–104 on 751fbd096).

Change. MetaCompress only counts when the format is not block-compressed (block_bytes == 0), for the metadata kind, the mip-view check and the metadata range. I merged upstream main (751fbd096).

Tests.

  • The test resolves the captured BC3_SRGB encoding and checks that it gets a sampled view without metadata. A second case resolves a 1024x1024 BC1 texture with COMPRESSION_EN whose view selects mip 1 past MAX_MIP 0 (the No Man's Sky layout of the existing mip-view test, in 8-byte blocks) and checks that it becomes its own 512x512 chain without metadata.
  • On my PC (RX 9070 XT), shader_recompiler_compute_tests --compute-meta-clear-only: with the new test alone on main (751fbd096) it exits with the game's invalid color metadata; with this change RenderExecutorColorMetadataClear and SampledDccClear pass. With only the mip-view argument put back to MetaCompress(), it exits at the BC1 case with unsupported texture mip view changes physical layout: base=1 last=1 max=0 extent=1024x1024x1 tile=5. RenderExecutorStencilBindingDiscovery, which runs after them, fails the same four checks on plain main; this host reports no depth attachment feedback loop support. These runs used #2038's harness change, because this GPU reports a robust storage buffer alignment of 4.
  • The full shader_recompiler_compute_tests run gives the same result with and without this change (186 cases ok, the same four failures, then this GPU's missing 2-sample support for format 129 stops the run).
  • In the game, with this fix and the depth counter id fix (#2005), a run reaches character creation without a stop. On my PC (Windows 11, Ryzen 5 7600X, RX 9070 XT) the game only gets this far with a lab build that also changes Windows thread priorities, which is not part of this PR.
  • Like the depth stop (#2005), this stop showed up with red-zone protection on (--redzone, the option GTA V needs, #829), which the game runs above used. With it off (the default), the same lab build without either fix reached character creation without a stop in 2 of 2 runs, which fits TheCamrew reaching gameplay on 4919fdb (#1660).

Written with Claude Code and OpenAI Codex (AI): it found the cause, wrote the change and the tests, and ran the tests and the game on my PC.

**@⁠Nawid3333** on GitHub · 2026-10-30 21:44 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2006) `Nawid3333:fix/des-bc-dcc` → `main` · +60 −4 · 2 files · 7 commits · open Demon's Souls (PPSA01341) stops at `invalid color metadata` (`image.cpp:670` on 751fbd096) in character creation. The texture is a 128x128 BC3_SRGB image (Vulkan format 138). **Cause.** Its T# has `MetaCompress` set (`fields[6]` bit 21, COMPRESSION_EN) and `MetaAddr() << 8` is `0x00003f39c0003e00`, which is not a guest address. `ResolveTexture` gives it DCC metadata at that address, and `TextureCache::FindImage` exits in `ImageOps::Validate` (through `ValidateImageDesc`) because the range is not a valid `GuestRange`. The RDNA2 ISA describes COMPRESSION_EN only as "enable delta color compression (DCC)" and does not say what it does for block-compressed formats. AMD's drivers do not set up DCC for these formats: Mesa leaves DCC off for block-compressed formats ([ac_surface.c](https://chromium.googlesource.com/external/gitlab.freedesktop.org/mesa/mesa/+/9f3af96552778e6acf3a4638cccdfc827601d21c/src/amd/common/ac_surface.c#2451)), and PAL's gfx10.3 format table lists BC1–BC7 as read-only textures with no color target ([gfx10_3.yaml](https://github.com/GPUOpen-Drivers/pal/blob/c5e800072a32f68b6ccc4422936d96167c6e0728/tools/generate/formats/data/gfx10_3.yaml#L1262-L1405)). In KytyPS5, render targets and video out cannot use BC formats, so nothing writes DCC data for a block-compressed image (`colorRenderTarget.cpp:170–173` and `gpu_format.cpp:91–104` on 751fbd096). **Change.** `MetaCompress` only counts when the format is not block-compressed (`block_bytes == 0`), for the metadata kind, the mip-view check and the metadata range. I merged upstream main (751fbd096). **Tests.** - The test resolves the captured BC3_SRGB encoding and checks that it gets a sampled view without metadata. A second case resolves a 1024x1024 BC1 texture with COMPRESSION_EN whose view selects mip 1 past MAX_MIP 0 (the No Man's Sky layout of the existing mip-view test, in 8-byte blocks) and checks that it becomes its own 512x512 chain without metadata. - On my PC (RX 9070 XT), `shader_recompiler_compute_tests --compute-meta-clear-only`: with the new test alone on main (751fbd096) it exits with the game's `invalid color metadata`; with this change `RenderExecutorColorMetadataClear` and `SampledDccClear` pass. With only the mip-view argument put back to `MetaCompress()`, it exits at the BC1 case with `unsupported texture mip view changes physical layout: base=1 last=1 max=0 extent=1024x1024x1 tile=5`. `RenderExecutorStencilBindingDiscovery`, which runs after them, fails the same four checks on plain main; this host reports no depth attachment feedback loop support. These runs used #2038's harness change, because this GPU reports a robust storage buffer alignment of 4. - The full `shader_recompiler_compute_tests` run gives the same result with and without this change (186 cases ok, the same four failures, then this GPU's missing 2-sample support for format 129 stops the run). - In the game, with this fix and the depth counter id fix (#2005), a run reaches character creation without a stop. On my PC (Windows 11, Ryzen 5 7600X, RX 9070 XT) the game only gets this far with a lab build that also changes Windows thread priorities, which is not part of this PR. - Like the depth stop (#2005), this stop showed up with red-zone protection on (`--redzone`, the option GTA V needs, #829), which the game runs above used. With it off (the default), the same lab build without either fix reached character creation without a stop in 2 of 2 runs, which fits TheCamrew reaching gameplay on 4919fdb (#1660). Written with Claude Code and OpenAI Codex (AI): it found the cause, wrote the change and the tests, and ran the tests and the game on my PC.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:11:13 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-30 21:48 UTC · original · edited 2026-11-09 14:55 UTC

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The texture resolver enables metadata compression only when the format has zero block-compressed bytes, the resource is not R128, and the descriptor enables metadata compression. A GPU-backed compute test checks resolved dimensions, metadata, mip levels, and texture views for block-compressed textures.

Suggested reviewers: nmzik

Change: Bug fix

Merge Risk: Minimal · up to bc958

No actionable issue is identified for this change. It appears mergeable after normal checks.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed

Check name Status Explanation
Title check Passed The title names the main change: block-compressed textures no longer receive DCC metadata when MetaCompress is set. It also names the affected game. The title matches the raw summary, the objectives, …
Description check Passed The description explains the cause of the Demon's Souls stop, the change to gate MetaCompress on block_bytes == 0, the supporting references, and the tests added and run. It directly describes the cha…
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: Title check

Explanation

The title names the main change: block-compressed textures no longer receive DCC metadata when MetaCompress is set. It also names the affected game. The title matches the raw summary, the objectives, and the description, which all describe the block_bytes == 0 gating of meta_compress in ResolveTexture.

Full details: Description check

Explanation

The description explains the cause of the Demon's Souls stop, the change to gate MetaCompress on block_bytes == 0, the supporting references, and the tests added and run. It directly describes the changeset in the descriptors.cpp and test files.

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 with cyclomatic complexity of at least 2. 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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 74df210d70 and bc958dc6bd.

Files selected for processing: 2

  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • 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-10-30 21:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2006#issuecomment-6534194151) · edited 2026-11-09 14:55 UTC <!-- 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/2006?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> The texture resolver enables metadata compression only when the format has zero block-compressed bytes, the resource is not R128, and the descriptor enables metadata compression. A GPU-backed compute test checks resolved dimensions, metadata, mip levels, and texture views for block-compressed textures. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"bc958dc6bd2383188f72af0db3ab57124038f715" --> <!-- change_assessment_priority:{"version":1,"urgency":"p2","manual":false} --> **Change:** Bug fix <!-- 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>bc958</code></summary> <dl> <dd> <br> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `bc958` --> <!-- final_review_risk_coverage:{"sourceCommitId":"bc958dc6bd2383188f72af0db3ab57124038f715","coveredCommitId":"bc958dc6bd2383188f72af0db3ab57124038f715","kind":"reviewed"} --> No actionable issue is identified for this change. It appears mergeable after normal checks. <!-- 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 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-inconclusive-14-v2.svg" width="14" height="14" align="middle" alt="Inconclusive" title="Inconclusive"></picture></sup> 1</strong></summary> <dl> <dd> <br> <strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks: 1 inconclusive</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :--------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Inconclusive](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-inconclusive.svg) | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong><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> Passed checks: 4 passed</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: block-compressed textures no longer receive DCC metadata when MetaCompress is set. It also names the affected game. The title matches the raw summary, the objectives, … | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description explains the cause of the Demon's Souls stop, the change to gate MetaCompress on block_bytes == 0, the supporting references, and the tests added and run. It directly describes the cha… | | 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. | <details> <summary><strong>Full details: Title check</strong></summary> <dl> <dd> <br> **Explanation** The title names the main change: block-compressed textures no longer receive DCC metadata when MetaCompress is set. It also names the affected game. The title matches the raw summary, the objectives, and the description, which all describe the block_bytes == 0 gating of meta_compress in ResolveTexture. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> <br> **Explanation** The description explains the cause of the Demon's Souls stop, the change to gate MetaCompress on block_bytes == 0, the supporting references, and the tests added and run. It directly describes the changeset in the descriptors.cpp and test files. </dd> </dl> </details> </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> <br> **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 with cyclomatic complexity of at least 2. 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. </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=2006)! 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/f399d481839722e6153d2ca190b7f669a7a40a6e/.coderabbit.yaml>) - **Commit**: [f399d48](<https://github.com/KytyPS5/KytyPS5/commit/f399d481839722e6153d2ca190b7f669a7a40a6e>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `bb3d622f-d158-427e-b8e2-d24f4e9e0592` </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 74df210d70092256149bea5d5d253c52db7ece61 and bc958dc6bd2383188f72af0db3ab57124038f715. </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: 2</strong></summary> <dl> <dd> <br> * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` * `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/2006/head:github-bot/gh-2006'
git switch 'github-bot/gh-2006'

Merge

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