graphics: ignore the mip statistics counter id of sampled depth textures (Demon's Souls) #2005

Closed
github-bot wants to merge 7 commits from gh-pr/2005/head into gh-pr/2005/base
Owner

@⁠Nawid3333 on GitHub · 2026-10-30 21:43 UTC · original
Nawid3333:fix/des-depth-counter-id → main · +36 −1 · 2 files · 7 commits · closed without merging

Demon's Souls (PPSA01341) stops at unsupported sampled depth image (the EXIT at descriptors.cpp:205 on 751fbd096). The captured descriptor has fields[6] = 0x00000002.

Cause. IsSupportedDepthTextureEncoding includes bits 0–7 of fields[6] in its metadata control check. Those bits (T# bits 199:192) hold MipStatsCntId(), the bank of the LOD statistics counter (COUNTER_BANK_ID in AMD's gfx10 register header); it selects a statistics counter, not metadata, whether or not fields[5] bit 25 enables counting. Since upstream 259186917 accepted descriptors may enable that counting, so the id can also be live. Upstream c1d1003d8 accepts the pipe-aligned bit (19) alone, and #1297 masks bits 15–18; 0x2 still fails with either.

Change. The mask is 0x00ffff00 instead of 0x00ffffff; I merged upstream main (751fbd096, with c1d1003d8 and 259186917) and kept its pipe-aligned handling, so compressed HTILE still requires bit 19 with bit 21. The test checks the captured descriptor, an HTILE descriptor and an MSAA descriptor with a counter id (including bit 7), a pipe-aligned descriptor with a counter id (fields[6] = 0x00080002), the same four with counting enabled (fields[5] bit 25), and that a DCC-only control with a counter id is still rejected, with and without counting.

Tests.

  • On the merge with the new cases (7e4f8a6d3), --sampled-depth-resource-only on the RX 9070 XT: DepthTextureEncoding passes. With the new test alone on main (751fbd096), it fails at the captured descriptor, at the HTILE/MSAA/pipe-aligned cases and at the counted cases. DepthAttachmentFeedback then fails the same way with and without this change; this host reports no depth attachment feedback loop support. Both 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, the fix gets past this stop and reaches character creation. 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.
  • The stop needs red-zone protection on (--redzone, the option GTA V needs, #829); the game runs above used it. With it off (the default), the same lab build without this fix reached character creation without this stop in 2 of 2 runs, which fits TheCamrew reaching gameplay on 4919fdb (#1660). With it on, the check rejects the descriptor for bits that do not control metadata (see Cause).

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

**@⁠Nawid3333** on GitHub · 2026-10-30 21:43 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2005) `Nawid3333:fix/des-depth-counter-id` → `main` · +36 −1 · 2 files · 7 commits · closed without merging Demon's Souls (PPSA01341) stops at `unsupported sampled depth image` (the `EXIT` at `descriptors.cpp:205` on 751fbd096). The captured descriptor has `fields[6] = 0x00000002`. **Cause.** `IsSupportedDepthTextureEncoding` includes bits 0–7 of `fields[6]` in its metadata control check. Those bits (T# bits 199:192) hold `MipStatsCntId()`, the bank of the LOD statistics counter (`COUNTER_BANK_ID` in [AMD's gfx10 register header](https://github.com/GPUOpen-Drivers/pal/blob/c5e800072a32f68b6ccc4422936d96167c6e0728/src/core/hw/gfxip/gfx9/chip/gfx10_sq_ko_reg.h#L336-L339)); it selects a statistics counter, not metadata, whether or not `fields[5]` bit 25 enables counting. Since upstream 259186917 accepted descriptors may enable that counting, so the id can also be live. Upstream c1d1003d8 accepts the pipe-aligned bit (19) alone, and #1297 masks bits 15–18; `0x2` still fails with either. **Change.** The mask is `0x00ffff00` instead of `0x00ffffff`; I merged upstream main (751fbd096, with c1d1003d8 and 259186917) and kept its pipe-aligned handling, so compressed HTILE still requires bit 19 with bit 21. The test checks the captured descriptor, an HTILE descriptor and an MSAA descriptor with a counter id (including bit 7), a pipe-aligned descriptor with a counter id (`fields[6] = 0x00080002`), the same four with counting enabled (`fields[5]` bit 25), and that a DCC-only control with a counter id is still rejected, with and without counting. **Tests.** - On the merge with the new cases (7e4f8a6d3), `--sampled-depth-resource-only` on the RX 9070 XT: `DepthTextureEncoding` passes. With the new test alone on main (751fbd096), it fails at the captured descriptor, at the HTILE/MSAA/pipe-aligned cases and at the counted cases. `DepthAttachmentFeedback` then fails the same way with and without this change; this host reports no depth attachment feedback loop support. Both 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, the fix gets past this stop and reaches character creation. 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. - The stop needs red-zone protection on (`--redzone`, the option GTA V needs, #829); the game runs above used it. With it off (the default), the same lab build without this fix reached character creation without this stop in 2 of 2 runs, which fits TheCamrew reaching gameplay on 4919fdb (#1660). With it on, the check rejects the descriptor for bits that do not control metadata (see Cause). Written with Claude Code and OpenAI Codex (AI): it found the cause, wrote the change and the test, 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:09 +00:00
github-bot closed this pull request 2026-11-26 10:11:09 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-30 21:46 UTC · original · edited 2026-11-08 00:09 UTC

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

IsSupportedDepthTextureEncoding now excludes bits 0–7 of fields[6] from metadata-control validation. Tests cover depth, compressed, MSAA, pipe-aligned, and DCC-control descriptors with counter IDs, both with and without mip statistics enabled.

Suggested reviewers: nmzik

Change: Bug fix

Merge Risk: Minimal · up to 7e4f8

The descriptor change and its tests identify no actionable merge-blocking issue. Merge 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 change (ignoring the mip statistics counter id in the sampled depth texture check) and the affected title (Demon's Souls). It matches the one-line mask change from 0x00ffffff to 0x…
Description check Passed The description states the failing game stop, the root cause (bits 0-7 of fields[6] hold MipStatsCntId() and are included in the metadata control check), the mask change, the retained pipe-aligned han…
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 change (ignoring the mip statistics counter id in the sampled depth texture check) and the affected title (Demon's Souls). It matches the one-line mask change from 0x00ffffff to 0x00ffff00 in descriptors.cpp and the added DepthTextureEncoding test cases. It is specific and clearly describes the primary change.

Full details: Description check

Explanation

The description states the failing game stop, the root cause (bits 0-7 of fields[6] hold MipStatsCntId() and are included in the metadata control check), the mask change, the retained pipe-aligned handling, the added test cases, and the test runs. It relates directly to the changeset.

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 616c009f93 and 7e4f8a6d3c.

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; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-30 21:46 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2005#issuecomment-6534162201) · edited 2026-11-08 00:09 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/2005?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> `IsSupportedDepthTextureEncoding` now excludes bits 0–7 of `fields[6]` from metadata-control validation. Tests cover depth, compressed, MSAA, pipe-aligned, and DCC-control descriptors with counter IDs, both with and without mip statistics enabled. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"7e4f8a6d3ce6e17d06d41b47be6a3aa90f7836c7" --> <!-- 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>7e4f8</code></summary> <dl> <dd> <br> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `7e4f8` --> <!-- final_review_risk_coverage:{"sourceCommitId":"7e4f8a6d3ce6e17d06d41b47be6a3aa90f7836c7","coveredCommitId":"7e4f8a6d3ce6e17d06d41b47be6a3aa90f7836c7","kind":"reviewed"} --> The descriptor change and its tests identify no actionable merge-blocking issue. Merge 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 change (ignoring the mip statistics counter id in the sampled depth texture check) and the affected title (Demon's Souls). It matches the one-line mask change from 0x00ffffff to 0x… | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description states the failing game stop, the root cause (bits 0-7 of fields[6] hold MipStatsCntId() and are included in the metadata control check), the mask change, the retained pipe-aligned han… | | 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 change (ignoring the mip statistics counter id in the sampled depth texture check) and the affected title (Demon's Souls). It matches the one-line mask change from 0x00ffffff to 0x00ffff00 in descriptors.cpp and the added DepthTextureEncoding test cases. It is specific and clearly describes the primary change. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> <br> **Explanation** The description states the failing game stop, the root cause (bits 0-7 of fields[6] hold MipStatsCntId() and are included in the metadata control check), the mask change, the retained pipe-aligned handling, the added test cases, and the test runs. It relates directly to the changeset. </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=2005)! 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/751fbd0965bdfe504335cb3577bd32d2ff8a1a15/.coderabbit.yaml>) - **Commit**: [751fbd0](<https://github.com/KytyPS5/KytyPS5/commit/751fbd0965bdfe504335cb3577bd32d2ff8a1a15>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `e001ef98-6a86-4fa4-95e5-7f69c83fc926` </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 616c009f93e33cc63b8dbf0b3a796136ce8813f3 and 7e4f8a6d3ce6e17d06d41b47be6a3aa90f7836c7. </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; 7 remain after this review. </dd> </dl> </details> </h6> <!-- recent_review_end -->
Author
Owner

@⁠Nawid3333 on GitHub · 2026-11-09 14:40 UTC · original

Superseded by 4fa10abbf in main, which ignores the same counter id bits, and 2e152f699, which ignores the metadata settings of uncompressed sampled depth textures altogether. Closing this one.

**@⁠Nawid3333** on GitHub · 2026-11-09 14:40 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2005#issuecomment-6742798260) Superseded by 4fa10abbf in main, which ignores the same counter id bits, and 2e152f699, which ignores the metadata settings of uncompressed sampled depth textures altogether. Closing this one.

Pull request closed

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