gpu: EQAA colour targets without FMASK, and mixed colour/depth sample counts (My First Gran Turismo) #1035

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

@⁠defektu on GitHub · 2026-10-04 01:20 UTC · original
defektu:pr/mfgt-mixed-samples → main · +56 −23 · 3 files · 2 commits · closed without merging

My First Gran Turismo (PPSA24156) needs two render-target changes to get past the loading screen after "Start": EQAA colour targets without FMASK must be accepted, and a pass that mixes sample counts must not exit. The first is a real fix, the second is a stopgap with a known cost (below). Rebased on current main (9e41d832).

Commit 1: accept EQAA colour targets without FMASK, ignore the depth PARTIALLY_RESIDENT hint

The title stops earlier with unsupported render-target sample configuration: samples=2 fragments=1 (colorRenderTarget.cpp). A colour target with more coverage samples than fragments and no FMASK/CMASK/DCC metadata is plain EQAA and can be rendered as the fragment count. The depth path now also ignores the PARTIALLY_RESIDENT hint, and its fatal diagnostics say which condition failed. (This was part of the closed #1033.)

Commit 2: drop attachments whose sample count differs from the pass (stopgap)

Vulkan wants one sample count per pass. My First Gran Turismo mixes 1x colour with 2x depth. Without this change the session ends shortly after Start with

mixed color/depth sample counts are unsupported: 1 and 2

The highest sample count among the attachments wins, and an attachment with another count is dropped from the pass and logged.

Known cost of commit 2

  • This is a stopgap, not the final design. The dropped attachment is usually the colour attachment, so those passes write no colour (8 log lines in a run), and the picture can be missing content that the real hardware draws.
  • The proper fix is to keep both attachments and declare the counts per attachment (VK_NV_framebuffer_mixed_samples / VK_AMD_mixed_attachment_samples). I tried that on an NVIDIA GPU: enabling the extension and giving the pipeline its per-attachment sample counts ended in a device lost (masterSemaphore.cpp, waitSemaphores failing) about two minutes into the run in two out of two runs, while this branch ran for 8 minutes. I do not know why yet, so it is not included. Suggestions welcome.

Testing: both commits compile on current main; in the game they were run together with the tessellation PR (#1032), where the title gets past the loading screen after Start.

Independent of the other My First Gran Turismo PRs apart from that.

🤖 Generated with Claude Code

**@⁠defektu** on GitHub · 2026-10-04 01:20 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1035) `defektu:pr/mfgt-mixed-samples` → `main` · +56 −23 · 3 files · 2 commits · closed without merging My First Gran Turismo (PPSA24156) needs two render-target changes to get past the loading screen after "Start": EQAA colour targets without FMASK must be accepted, and a pass that mixes sample counts must not exit. The first is a real fix, the second is a stopgap with a known cost (below). Rebased on current `main` (9e41d832). **Commit 1: accept EQAA colour targets without FMASK, ignore the depth `PARTIALLY_RESIDENT` hint** The title stops earlier with `unsupported render-target sample configuration: samples=2 fragments=1` (`colorRenderTarget.cpp`). A colour target with more coverage samples than fragments and no FMASK/CMASK/DCC metadata is plain EQAA and can be rendered as the fragment count. The depth path now also ignores the `PARTIALLY_RESIDENT` hint, and its fatal diagnostics say which condition failed. (This was part of the closed #1033.) **Commit 2: drop attachments whose sample count differs from the pass (stopgap)** Vulkan wants one sample count per pass. My First Gran Turismo mixes 1x colour with 2x depth. Without this change the session ends shortly after Start with ``` mixed color/depth sample counts are unsupported: 1 and 2 ``` The highest sample count among the attachments wins, and an attachment with another count is dropped from the pass and logged. **Known cost of commit 2** - This is a stopgap, not the final design. The dropped attachment is usually the colour attachment, so those passes write no colour (8 log lines in a run), and the picture can be missing content that the real hardware draws. - The proper fix is to keep both attachments and declare the counts per attachment (`VK_NV_framebuffer_mixed_samples` / `VK_AMD_mixed_attachment_samples`). I tried that on an NVIDIA GPU: enabling the extension and giving the pipeline its per-attachment sample counts ended in a device lost (`masterSemaphore.cpp`, `waitSemaphores` failing) about two minutes into the run in two out of two runs, while this branch ran for 8 minutes. I do not know why yet, so it is not included. Suggestions welcome. **Testing:** both commits compile on current `main`; in the game they were run together with the tessellation PR (#1032), where the title gets past the loading screen after Start. Independent of the other My First Gran Turismo PRs apart from that. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Vulkan wants one sample count per pass and My First Gran Turismo mixes 1x colour with 2x depth (EQAA). The highest
count wins; an attachment with another count is dropped from the pass and logged.

This is a stopgap: the dropped attachment is usually the colour attachment, so those passes write no colour. The proper
fix is to keep both and declare the counts per attachment (VK_NV_framebuffer_mixed_samples /
VK_AMD_mixed_attachment_samples), which currently ends in a device lost on NVIDIA.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:41:16 +00:00
github-bot closed this pull request 2026-11-26 09:41:16 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-16 03:51 UTC · original · edited 2026-10-16 04:29 UTC

Review in Change Stack →

📝 Walkthrough

Color target validation now accepts specified configurations where the sample count exceeds the derived fragment count. Graphics pipeline creation selects the maximum sample count and omits mismatched color and depth attachments. Depth target validation now reports specific unsupported register states.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: 🟠 High · up to 1d143

Mixed-sample passes can still bind attachments that their pipelines omit, risking failed rendering in the targeted workload. Align render-time attachments with the pipeline and correct the depth guards before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description check Passed The description clearly explains both render-target changes, their stopgap behavior, known limitations, testing, and relationship to My First Gran Turismo.
Title check Passed The title accurately identifies the two main changes: EQAA color targets without FMASK and mixed color/depth sample counts for My First Gran Turismo.
Linked Issues check Passed No active directly linked issue remains. Issue #1033 is closed and supplies historical context only. No linked-issue coding requirement applies to this pull request.
Out of Scope Changes check Passed The changes stay within the current pull request intent. They address EQAA color-target handling and mixed attachment sample counts in the graphics renderer. The related diagnostics support the same r…
  • Autofix · 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-16 03:51 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1035#issuecomment-6207676033) · edited 2026-10-16 04:29 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/1035?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-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> Color target validation now accepts specified configurations where the sample count exceeds the derived fragment count. Graphics pipeline creation selects the maximum sample count and omits mismatched color and depth attachments. Depth target validation now reports specific unsupported register states. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"1d1430f44b502475a70adba1510bc9c67bdd5b8a" --> **Change:** Bug fix · **Severity of issue fixed:** Medium <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>🟠 High</strong> · up to <code>1d143</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **🟠 High** · up to `1d143` --> <!-- final_review_risk_coverage:{"sourceCommitId":"1d1430f44b502475a70adba1510bc9c67bdd5b8a","coveredCommitId":"1d1430f44b502475a70adba1510bc9c67bdd5b8a","kind":"reviewed"} --> Mixed-sample passes can still bind attachments that their pipelines omit, risking failed rendering in the targeted workload. Align render-time attachments with the pipeline and correct the depth guards before merging. <!-- 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-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> 1</strong></summary> <dl> <dd> <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 warning</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :----------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. | 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> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description clearly explains both render-target changes, their stopgap behavior, known limitations, testing, and relationship to My First Gran Turismo. | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title accurately identifies the two main changes: EQAA color targets without FMASK and mixed color/depth sample counts for My First Gran Turismo. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | No active directly linked issue remains. Issue `#1033` is closed and supplies historical context only. No linked-issue coding requirement applies to this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The changes stay within the current pull request intent. They address EQAA color-target handling and mixed attachment sample counts in the graphics renderer. The related diagnostics support the same r… | </dd> </dl> </details> </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">Autofix</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=1035)! 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) </dd> </dl> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
@ -802,0 +820,4 @@
}
static_params.color_mask[slot] = 0;
continue;
}
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-16 03:51 UTC · original

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Check how the render state is converted to rendering info, and whether mismatched samples are skipped.
rg -nP -C6 'color_attachments\[|num_color_attachments|colorAttachmentCount|pColorAttachments' src/graphics/host_gpu/renderer
rg -nP -C4 'samples\s*!=' src/graphics/host_gpu/renderer/renderDraw.cpp

Repository: KytyPS5/KytyPS5

Length of output: 13364


Pipeline drops attachments, but the render-target acquisition path still binds them. Verify that both paths use the same attachment set.

GetGraphicsPipeline can omit a colour attachment when its sample count differs from the selected pass sample count. The render state still stores that attachment, and CommandBuffer::BeginRendering passes every slot below state.num_color_attachments to vk::RenderingInfo.

If the pipeline rendering info omits a slot but the begin-rendering info contains its view, the pipeline and render state can disagree. A mismatched-sample attachment can also reach vk::RenderingInfo. Make the begin-rendering path apply the same filtering, and keep color_count, color_formats, and the colour attachment array consistent, including any VK_FORMAT_UNDEFINED holes.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-16 03:51 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1035#discussion_r4290750620) **🩺 Stability & Availability** | **🟠 Major** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash # Check how the render state is converted to rendering info, and whether mismatched samples are skipped. rg -nP -C6 'color_attachments\[|num_color_attachments|colorAttachmentCount|pColorAttachments' src/graphics/host_gpu/renderer rg -nP -C4 'samples\s*!=' src/graphics/host_gpu/renderer/renderDraw.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 13364 --- </details> **Pipeline drops attachments, but the render-target acquisition path still binds them. Verify that both paths use the same attachment set.** `GetGraphicsPipeline` can omit a colour attachment when its sample count differs from the selected pass sample count. The render state still stores that attachment, and `CommandBuffer::BeginRendering` passes every slot below `state.num_color_attachments` to `vk::RenderingInfo`. If the pipeline rendering info omits a slot but the begin-rendering info contains its view, the pipeline and render state can disagree. A mismatched-sample attachment can also reach `vk::RenderingInfo`. Make the begin-rendering path apply the same filtering, and keep `color_count`, `color_formats`, and the colour attachment array consistent, including any `VK_FORMAT_UNDEFINED` holes. <!-- fingerprinting:phantom:poseidon:beignet55 --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:156cf3c9cc97afc1e602fc94 --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-16 03:51 UTC · original · reviewed

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2baaa059-edaf-4434-a2b5-f9d4dde4ae26
📥 Commits

Reviewing files that changed from the base of the PR and between 9e41d8320a and 3cc0eb148cda9651bc5473a826fd3f172abb456d.

📒 Files selected for processing: 1
  • src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-16 03:51 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1035#pullrequestreview-5542867921) · **reviewed** **Actionable comments posted: 2** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `2baaa059-edaf-4434-a2b5-f9d4dde4ae26` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 9e41d8320a2774b303fbad344c2347e8d0292e83 and 3cc0eb148cda9651bc5473a826fd3f172abb456d. </details> <details> <summary>📒 Files selected for processing: 1</summary> * `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=e1253de9-dfd1-4b12-9981-3ef1ed08bd4f attempt=9af50b9c-f819-4113-8b3a-27c883c4bc84 batch=1/1 -->
@ -861,0 +881,4 @@
depth.desc.info.samples, attachment_samples);
}
}
const bool with_depth = depth_in_use && !depth_mismatched;
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-16 03:51 UTC · original

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

sed -n '855,910p' src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp
rg -n 'GetGraphicsPipeline|AcquireRenderTargets|BeginRendering|depth_attachment|depth_format' src/graphics/host_gpu/renderer/renderDraw.cpp src/graphics/host_gpu/renderer/context.cpp

Repository: KytyPS5/KytyPS5

Length of output: 4288


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- diff for affected pipeline logic ---'
git diff --unified=35 9e41d8320a2774b303fbad344c2347e8d0292e83 3cc0eb148cda9651bc5473a826fd3f172abb456d -- src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp
printf '%s\n' '--- GetGraphicsPipeline declaration and surrounding implementation ---'
rg -n -F -- 'GetGraphicsPipeline' src/graphics/host_gpu/renderer
sed -n '430,570p' src/graphics/host_gpu/renderer/renderDraw.cpp
sed -n '1130,1230p' src/graphics/host_gpu/renderer/renderDraw.cpp
printf '%s\n' '--- CommandBuffer BeginRendering and render-state types ---'
sed -n '1,105p' src/graphics/host_gpu/renderer/context.cpp
rg -n -F -e 'struct RenderState' -e 'class RenderState' -e 'struct RenderDepthInfo' -e 'depth_info' src/graphics/host_gpu/renderer src/graphics/host_gpu
printf '%s\n' '--- pipeline block before and after the excerpt ---'
sed -n '700,900p' src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp

Repository: KytyPS5/KytyPS5

Length of output: 38665


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- pipeline rendering format consumers ---'
rg -n -F -e 'depth_format' -e 'stencil_format' -e 'PipelineRenderingCreateInfo' -e 'color_formats' src/graphics/host_gpu/renderer src/graphics/host_gpu
printf '%s\n' '--- complete draw setup and render-target acquisition ---'
sed -n '900,1075p' src/graphics/host_gpu/renderer/renderDraw.cpp
sed -n '455,565p' src/graphics/host_gpu/renderer/renderDraw.cpp
printf '%s\n' '--- complete BeginRendering tail and RenderState definition ---'
sed -n '55,125p' src/graphics/host_gpu/renderer/context.cpp
sed -n '1,95p' src/graphics/host_gpu/renderer/renderTarget.h

Repository: KytyPS5/KytyPS5

Length of output: 26687


🌐 Web query:

Vulkan dynamic rendering pipeline depthAttachmentFormat VK_FORMAT_UNDEFINED depth attachment compatibility validation

💡 Result:

**If the pipeline declares `depthAttachmentFormat = VK_FORMAT_UNDEFINED`, it is not compatible with a draw that has a real depth attachment** under the dynamic-rendering unused-attachments rules. For `vkCmdDraw`, when `VkRenderingInfo::pDepthAttachment->imageView` is non-null, the pipeline’s depth format must match that image view’s format; when the image view is null, the pipeline format must be `VK_FORMAT_UNDEFINED`. ([docs.vulkan.org](https://docs.vulkan.org/features/latest/features/proposals/VK_EXT_dynamic_rendering_unused_attachments.html?utm_source=openai))

So, set `depthAttachmentFormat` to the actual depth format (for example, the format used to create the depth image view) if you attach depth. `VK_FORMAT_UNDEFINED` means the pipeline does not use a depth attachment; it is not a wildcard. The pipeline-creation rules also require any non-undefined depth format to include a depth component. ([docs.vulkan.org](https://docs.vulkan.org/refpages/latest/refpages/source/VkPipelineRenderingCreateInfo.html?utm_source=openai))

This is a **draw-time compatibility validation**, not necessarily a pipeline-creation error: a pipeline may validly be created with `VK_FORMAT_UNDEFINED`, then fail compatibility validation when bound for rendering with a non-null depth attachment.

Citations:

- 1: https://docs.vulkan.org/features/latest/features/proposals/VK_EXT_dynamic_rendering_unused_attachments.html?utm_source=openai
- 2: https://docs.vulkan.org/refpages/latest/refpages/source/VkPipelineRenderingCreateInfo.html?utm_source=openai

🏁 Script executed:

set -o pipefail
printf '%s\n' '--- dynamic-rendering compatibility extensions and filters ---'
rg -n -i -F -e 'dynamic_rendering_unused' -e 'unused_attachments' -e 'dynamicRenderingUnused' -e 'VK_EXT_dynamic_rendering' -e 'color_mask' src/graphics/host_gpu
printf '%s\n' '--- numbered affected source ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp | sed -n '780,900p'
nl -ba src/graphics/host_gpu/renderer/pipeline/shaders.cpp | sed -n '500,520p'
nl -ba src/graphics/host_gpu/renderer/renderDraw.cpp | sed -n '915,940p;1155,1218p'
nl -ba src/graphics/host_gpu/renderer/renderDraw.cpp | sed -n '461,565p'
nl -ba src/graphics/host_gpu/renderer/context.cpp | sed -n '60,112p'

Repository: KytyPS5/KytyPS5

Length of output: 22956


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- all AcquireRenderTargets call sites and declarations ---'
rg -n -F -e 'AcquireRenderTargets' -e 'CopyDepthToColor' src/graphics/host_gpu/renderer
printf '%s\n' '--- depth type and dynamic-state consumer ---'
sed -n '1,130p' src/graphics/host_gpu/renderer/depthRenderTarget.h
rg -n -F -e 'UpdateGraphicsDynamicState' -e 'depth_test_enable' src/graphics/host_gpu/renderer/renderDraw.cpp src/graphics/host_gpu/renderer
sed -n '300,430p' src/graphics/host_gpu/renderer/renderDraw.cpp

Repository: KytyPS5/KytyPS5

Length of output: 14282


Remove the mismatched depth attachment from the render state.

When the depth sample count differs from the selected pass sample count, GetGraphicsPipeline creates a pipeline with undefined depth and stencil formats. The draw path still passes the original depth state to AcquireRenderTargets, which creates a depth attachment. BeginRendering then submits that view.

A pipeline with an undefined depth format is not compatible with a rendering instance that supplies a depth attachment. Derive one effective depth state and use it consistently for pipeline creation, AcquireRenderTargets, and UpdateGraphicsDynamicState. Disable depth and stencil tests when the depth attachment is dropped. Keep the separate CopyDepthToColor path on its existing state.

Color-output masking does not remove the depth view, so color filtering does not fix this path.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-16 03:51 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1035#discussion_r4290750626) **🩺 Stability & Availability** | **🟠 Major** | **🏗️ Heavy lift** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash sed -n '855,910p' src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp rg -n 'GetGraphicsPipeline|AcquireRenderTargets|BeginRendering|depth_attachment|depth_format' src/graphics/host_gpu/renderer/renderDraw.cpp src/graphics/host_gpu/renderer/context.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 4288 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- diff for affected pipeline logic ---' git diff --unified=35 9e41d8320a2774b303fbad344c2347e8d0292e83 3cc0eb148cda9651bc5473a826fd3f172abb456d -- src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp printf '%s\n' '--- GetGraphicsPipeline declaration and surrounding implementation ---' rg -n -F -- 'GetGraphicsPipeline' src/graphics/host_gpu/renderer sed -n '430,570p' src/graphics/host_gpu/renderer/renderDraw.cpp sed -n '1130,1230p' src/graphics/host_gpu/renderer/renderDraw.cpp printf '%s\n' '--- CommandBuffer BeginRendering and render-state types ---' sed -n '1,105p' src/graphics/host_gpu/renderer/context.cpp rg -n -F -e 'struct RenderState' -e 'class RenderState' -e 'struct RenderDepthInfo' -e 'depth_info' src/graphics/host_gpu/renderer src/graphics/host_gpu printf '%s\n' '--- pipeline block before and after the excerpt ---' sed -n '700,900p' src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 38665 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- pipeline rendering format consumers ---' rg -n -F -e 'depth_format' -e 'stencil_format' -e 'PipelineRenderingCreateInfo' -e 'color_formats' src/graphics/host_gpu/renderer src/graphics/host_gpu printf '%s\n' '--- complete draw setup and render-target acquisition ---' sed -n '900,1075p' src/graphics/host_gpu/renderer/renderDraw.cpp sed -n '455,565p' src/graphics/host_gpu/renderer/renderDraw.cpp printf '%s\n' '--- complete BeginRendering tail and RenderState definition ---' sed -n '55,125p' src/graphics/host_gpu/renderer/context.cpp sed -n '1,95p' src/graphics/host_gpu/renderer/renderTarget.h ``` Repository: KytyPS5/KytyPS5 Length of output: 26687 --- 🌐 Web query: `Vulkan dynamic rendering pipeline depthAttachmentFormat VK_FORMAT_UNDEFINED depth attachment compatibility validation` 💡 Result: ``` **If the pipeline declares `depthAttachmentFormat = VK_FORMAT_UNDEFINED`, it is not compatible with a draw that has a real depth attachment** under the dynamic-rendering unused-attachments rules. For `vkCmdDraw`, when `VkRenderingInfo::pDepthAttachment->imageView` is non-null, the pipeline’s depth format must match that image view’s format; when the image view is null, the pipeline format must be `VK_FORMAT_UNDEFINED`. ([docs.vulkan.org](https://docs.vulkan.org/features/latest/features/proposals/VK_EXT_dynamic_rendering_unused_attachments.html?utm_source=openai)) So, set `depthAttachmentFormat` to the actual depth format (for example, the format used to create the depth image view) if you attach depth. `VK_FORMAT_UNDEFINED` means the pipeline does not use a depth attachment; it is not a wildcard. The pipeline-creation rules also require any non-undefined depth format to include a depth component. ([docs.vulkan.org](https://docs.vulkan.org/refpages/latest/refpages/source/VkPipelineRenderingCreateInfo.html?utm_source=openai)) This is a **draw-time compatibility validation**, not necessarily a pipeline-creation error: a pipeline may validly be created with `VK_FORMAT_UNDEFINED`, then fail compatibility validation when bound for rendering with a non-null depth attachment. Citations: - 1: https://docs.vulkan.org/features/latest/features/proposals/VK_EXT_dynamic_rendering_unused_attachments.html?utm_source=openai - 2: https://docs.vulkan.org/refpages/latest/refpages/source/VkPipelineRenderingCreateInfo.html?utm_source=openai ``` --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- dynamic-rendering compatibility extensions and filters ---' rg -n -i -F -e 'dynamic_rendering_unused' -e 'unused_attachments' -e 'dynamicRenderingUnused' -e 'VK_EXT_dynamic_rendering' -e 'color_mask' src/graphics/host_gpu printf '%s\n' '--- numbered affected source ---' nl -ba src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp | sed -n '780,900p' nl -ba src/graphics/host_gpu/renderer/pipeline/shaders.cpp | sed -n '500,520p' nl -ba src/graphics/host_gpu/renderer/renderDraw.cpp | sed -n '915,940p;1155,1218p' nl -ba src/graphics/host_gpu/renderer/renderDraw.cpp | sed -n '461,565p' nl -ba src/graphics/host_gpu/renderer/context.cpp | sed -n '60,112p' ``` Repository: KytyPS5/KytyPS5 Length of output: 22956 --- 🏁 Script executed: ```bash set -o pipefail printf '%s\n' '--- all AcquireRenderTargets call sites and declarations ---' rg -n -F -e 'AcquireRenderTargets' -e 'CopyDepthToColor' src/graphics/host_gpu/renderer printf '%s\n' '--- depth type and dynamic-state consumer ---' sed -n '1,130p' src/graphics/host_gpu/renderer/depthRenderTarget.h rg -n -F -e 'UpdateGraphicsDynamicState' -e 'depth_test_enable' src/graphics/host_gpu/renderer/renderDraw.cpp src/graphics/host_gpu/renderer sed -n '300,430p' src/graphics/host_gpu/renderer/renderDraw.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 14282 --- </details> **Remove the mismatched depth attachment from the render state.** When the depth sample count differs from the selected pass sample count, `GetGraphicsPipeline` creates a pipeline with undefined depth and stencil formats. The draw path still passes the original depth state to `AcquireRenderTargets`, which creates a depth attachment. `BeginRendering` then submits that view. A pipeline with an undefined depth format is not compatible with a rendering instance that supplies a depth attachment. Derive one effective depth state and use it consistently for pipeline creation, `AcquireRenderTargets`, and `UpdateGraphicsDynamicState`. Disable depth and stencil tests when the depth attachment is dropped. Keep the separate `CopyDepthToColor` path on its existing state. Color-output masking does not remove the depth view, so color filtering does not fix this path. <!-- fingerprinting:phantom:medusa:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:99b512f6d129ebac6443ef62 --> <!-- This is an auto-generated comment by CodeRabbit -->
@ -307,0 +310,4 @@
z.z_read_base_addr);
}
if (has_stencil && !z.depth_view.stencil_write_disable &&
z.stencil_write_base_addr != z.stencil_read_base_addr) {
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-16 04:29 UTC · original

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n -C 4 'z_write_base_addr|stencil_write_base_addr|z_write_enable|stencil_enable|depth_clear_enable|stencil_clear_enable' \
  src/graphics/guest_gpu src/graphics/host_gpu/renderer

Repository: KytyPS5/KytyPS5

Length of output: 33149


🏁 Script executed:

set -euo pipefail
printf '%s\n' '--- diff against merge base ---'
git diff --unified=30 9e41d8320a2774b303fbad344c2347e8d0292e83 -- src/graphics/host_gpu/renderer/depthRenderTarget.cpp
printf '%s\n' '--- complete ResolveRenderDepthTarget block ---'
nl -ba src/graphics/host_gpu/renderer/depthRenderTarget.cpp | sed -n '250,365p'
printf '%s\n' '--- depth state declarations and setters ---'
nl -ba src/graphics/guest_gpu/hardwareContext.h | sed -n '165,270p;680,715p'
printf '%s\n' '--- local references to depth base validation and write-disable semantics ---'
rg -n -C 5 --glob '*.{cpp,h,hpp,md,txt}' -e 'depth_write_disable|stencil_write_disable|read_base_addr|write_base_addr|DB_Z_READ_BASE|DB_Z_WRITE_BASE|DB_STENCIL_READ_BASE|DB_STENCIL_WRITE_BASE' src docs README* 2>/dev/null || test "$?" -eq 1

Repository: KytyPS5/KytyPS5

Length of output: 44752


🏁 Script executed:

set -euo pipefail
git diff --unified=12 9e41d8320a2774b303fbad344c2347e8d0292e83 -- src/graphics/host_gpu/renderer/depthRenderTarget.cpp
nl -ba src/graphics/host_gpu/renderer/depthRenderTarget.cpp | sed -n '258,355p;430,490p'

Repository: KytyPS5/KytyPS5

Length of output: 10947


Gate base-mismatch checks on effective writes.

When dc.z_enable is true and dc.z_write_enable is false, r.depth_write_enable is false and the normal attachment uses z_read_base_addr. The check still calls DepthFatal when the bases differ. The PM4 handlers accept read and write bases independently.

Apply the same rule to stencil. dc.stencil_enable alone does not prove a write because write masks and stencil operations can disable all writes. Check the effective write result, not only stencil_write_disable.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-16 04:29 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1035#discussion_r4290933759) **🩺 Stability & Availability** | **🟠 Major** | **⚡ Quick win** <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash set -euo pipefail rg -n -C 4 'z_write_base_addr|stencil_write_base_addr|z_write_enable|stencil_enable|depth_clear_enable|stencil_clear_enable' \ src/graphics/guest_gpu src/graphics/host_gpu/renderer ``` Repository: KytyPS5/KytyPS5 Length of output: 33149 --- 🏁 Script executed: ```bash set -euo pipefail printf '%s\n' '--- diff against merge base ---' git diff --unified=30 9e41d8320a2774b303fbad344c2347e8d0292e83 -- src/graphics/host_gpu/renderer/depthRenderTarget.cpp printf '%s\n' '--- complete ResolveRenderDepthTarget block ---' nl -ba src/graphics/host_gpu/renderer/depthRenderTarget.cpp | sed -n '250,365p' printf '%s\n' '--- depth state declarations and setters ---' nl -ba src/graphics/guest_gpu/hardwareContext.h | sed -n '165,270p;680,715p' printf '%s\n' '--- local references to depth base validation and write-disable semantics ---' rg -n -C 5 --glob '*.{cpp,h,hpp,md,txt}' -e 'depth_write_disable|stencil_write_disable|read_base_addr|write_base_addr|DB_Z_READ_BASE|DB_Z_WRITE_BASE|DB_STENCIL_READ_BASE|DB_STENCIL_WRITE_BASE' src docs README* 2>/dev/null || test "$?" -eq 1 ``` Repository: KytyPS5/KytyPS5 Length of output: 44752 --- 🏁 Script executed: ```bash set -euo pipefail git diff --unified=12 9e41d8320a2774b303fbad344c2347e8d0292e83 -- src/graphics/host_gpu/renderer/depthRenderTarget.cpp nl -ba src/graphics/host_gpu/renderer/depthRenderTarget.cpp | sed -n '258,355p;430,490p' ``` Repository: KytyPS5/KytyPS5 Length of output: 10947 --- </details> **Gate base-mismatch checks on effective writes.** When `dc.z_enable` is true and `dc.z_write_enable` is false, `r.depth_write_enable` is false and the normal attachment uses `z_read_base_addr`. The check still calls `DepthFatal` when the bases differ. The PM4 handlers accept read and write bases independently. Apply the same rule to stencil. `dc.stencil_enable` alone does not prove a write because write masks and stencil operations can disable all writes. Check the effective write result, not only `stencil_write_disable`. <!-- fingerprinting:phantom:triton:serval --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:ab4a2241c43311f7d4343ae8 --> <!-- This is an auto-generated comment by CodeRabbit -->
@ -307,0 +307,4 @@
}
if (!z.depth_view.depth_write_disable && z.z_write_base_addr != z.z_read_base_addr) {
DepthFatal("depth write base 0x%08x differs from read base 0x%08x", z.z_write_base_addr,
z.z_read_base_addr);
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-16 04:29 UTC · original

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use a 64-bit format for both base-address diagnostics.

The address fields are uint64_t, but %x expects unsigned int. Passing these arguments through DepthFatal to vfprintf has undefined behavior and can truncate the logged addresses. Use PRIx64 for both messages.

Also applies to: 314-315

**@⁠coderabbitai[bot]** on GitHub · 2026-10-16 04:29 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1035#discussion_r4290933763) **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** **Use a 64-bit format for both base-address diagnostics.** The address fields are `uint64_t`, but `%x` expects `unsigned int`. Passing these arguments through `DepthFatal` to `vfprintf` has undefined behavior and can truncate the logged addresses. Use `PRIx64` for both messages. Also applies to: 314-315 <!-- fingerprinting:phantom:triton:serval --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:140d089c7c7526a844941cc7 --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-16 04:29 UTC · original · reviewed

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 38264277-d88b-480d-bdac-cbc872b717dd
📥 Commits

Reviewing files that changed from the base of the PR and between a9525e8192 and 1d1430f44b.

📒 Files selected for processing: 2
  • src/graphics/host_gpu/renderer/colorRenderTarget.cpp
  • src/graphics/host_gpu/renderer/depthRenderTarget.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-16 04:29 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1035#pullrequestreview-5543084226) · **reviewed** **Actionable comments posted: 2** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `38264277-d88b-480d-bdac-cbc872b717dd` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between a9525e8192e9ef3c9200f03a52a8352403a16295 and 1d1430f44b502475a70adba1510bc9c67bdd5b8a. </details> <details> <summary>📒 Files selected for processing: 2</summary> * `src/graphics/host_gpu/renderer/colorRenderTarget.cpp` * `src/graphics/host_gpu/renderer/depthRenderTarget.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=80b03724-d844-4e79-8ca1-92399c3c40e2 attempt=8f2d2cfe-c848-4ea3-baf1-c471202ce81d batch=1/1 -->
Author
Owner

@⁠Nmzik on GitHub · 2026-10-21 19:42 UTC · original

Superseded by 5f29374d5 and 7b7294aa0.

**@⁠Nmzik** on GitHub · 2026-10-21 19:42 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1035#issuecomment-6324937334) Superseded by 5f29374d5 and 7b7294aa0.

Pull request closed

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