graphics: ignore depth load clears when detecting attachment feedback loops #943

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

@⁠joaodiaslobo on GitHub · 2026-09-30 12:04 UTC · original
joaodiaslobo:graphics/depth-feedback-load-clear → main · +7 −5 · 3 files · 1 commits · closed without merging

Fixes the crash reported in #904. Demon's Souls does not boot on hosts without the attachment feedback loop extension.

The draw that fails samples the depth buffer while the depth attachment has a load clear pending. Feedback detection counts that clear as a write, so it looks like the shader is reading depth that the same draw is writing, and the emulator aborts. The game never writes depth in that draw. The clear comes from HTile metadata holding a fast clear that the emulator applies on load, and depth writes are disabled.

A load clear happens when rendering begins, before any fragment runs, so it cannot alias a sampled read the way a per-fragment write can. This change only counts per-fragment writes when deciding whether the extension is needed. Draws that genuinely write and sample the same aspect still abort as before.

Testing

Demon's Souls (PPSA01342) boots and plays normally. I do not have a GPU without the extension, so I tested by forcing the capability off, and confirmed a normal run with it enabled is unchanged. A check on the AMD card from the report would be useful.

**@⁠joaodiaslobo** on GitHub · 2026-09-30 12:04 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/943) `joaodiaslobo:graphics/depth-feedback-load-clear` → `main` · +7 −5 · 3 files · 1 commits · closed without merging Fixes the crash reported in #904. Demon's Souls does not boot on hosts without the attachment feedback loop extension. The draw that fails samples the depth buffer while the depth attachment has a load clear pending. Feedback detection counts that clear as a write, so it looks like the shader is reading depth that the same draw is writing, and the emulator aborts. The game never writes depth in that draw. The clear comes from HTile metadata holding a fast clear that the emulator applies on load, and depth writes are disabled. A load clear happens when rendering begins, before any fragment runs, so it cannot alias a sampled read the way a per-fragment write can. This change only counts per-fragment writes when deciding whether the extension is needed. Draws that genuinely write and sample the same aspect still abort as before. **Testing** Demon's Souls (PPSA01342) boots and plays normally. I do not have a GPU without the extension, so I tested by forcing the capability off, and confirmed a normal run with it enabled is unchanged. A check on the AMD card from the report would be useful.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:37:41 +00:00
github-bot closed this pull request 2026-11-26 09:37:41 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-30 12:22 UTC · original · edited 2026-09-30 12:28 UTC

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

AttachmentWriteAspects now accepts an option to exclude clear writes. AcquireRenderTargets checks feedback aspects against depth and stencil aspects written per fragment before rejecting feedback when attachment-feedback-loop support is unavailable.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: 🔵 Low · up to f67cc

The change avoids the reported unsupported-extension abort, but sampling outside covered samples can still race with attachment stores. Address this bounded rendering risk or explicitly accept it before merging.

Security Architecture Review

Security architecture risk: 🔵 Low · up to f67cc

The change preserves rejection of genuine per-fragment feedback writes. However, the safety of the newly allowed clear-only case has not been fully established when the required graphics extension is unavailable. The remaining risk is bounded to graphics execution; no privilege escalation or isolation breach was demonstrated.

Retained concerns

  • Low · architecture · inferred: Clear-only sampled overlap now passes the unsupported-host guard while the depth/stencil attachment retains STORE. The inspected path provides neither a covered-sample restriction nor a demonstrated Vulkan ordering guarantee for arbitrary sampled coordinates. If that configuration falls outside the supported API contract, guest draws could cause rendering failures beyond the previously fail-closed boundary. The exact API validity and failure outcome remain unresolved.
Security review details

Security Blast Radius

  • inferred — The directly affected execution scope is the emulator's host graphics path for guest draws on hosts lacking attachment-feedback-loop support. The inspected path reaches Vulkan depth/stencil attachment operations; it does not establish cross-tenant access, additional credentials, or increased administrative authority.

Security Findings and Attack Paths

  • inferred — A guest draw sampling an overlapping cleared depth/stencil aspect can now reach the host attachment STORE path where the base rejected it. This identifies increased reachability of an unresolved API-contract case, not a verified exploit or demonstrated host isolation failure.

Trust Boundaries and Controls

  • observed — Render-target acquisition checks cached image ownership, registration and rebind state before attachment use. The PR preserves those checks and the per-fragment feedback guard, while narrowing the capability control for clear-only overlap.

Hardening Proposals

  • proposed — Establish the Vulkan contract for sampled coordinates, load clears and attachment STORE on unsupported hosts. If that contract cannot support the admitted case, consider a separately ordered clear followed by a supported read-only or copied-image path rather than relying solely on per-fragment write detection.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: excluding depth load clears when detecting attachment feedback loops.
Description check ✅ Passed The description directly explains the crash, the cause, the intended behavior, and the testing performed for the changeset.
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.

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-09-30 12:22 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/943#issuecomment-5911218954) · edited 2026-09-30 12:28 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/943?cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> Navigate logical layers of code changes, visualize relationships, and explore their blast radius. <!-- review_stack_entry_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough `AttachmentWriteAspects` now accepts an option to exclude clear writes. `AcquireRenderTargets` checks feedback aspects against depth and stencil aspects written per fragment before rejecting feedback when attachment-feedback-loop support is unavailable. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"f67cc8441f3421f69bb3af99ba2ac2f7835f92cd" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _🔵 Low_ · up to `f67cc` <!-- final_review_risk_coverage:{"sourceCommitId":"f67cc8441f3421f69bb3af99ba2ac2f7835f92cd","coveredCommitId":"f67cc8441f3421f69bb3af99ba2ac2f7835f92cd","kind":"reviewed"} --> The change avoids the reported unsupported-extension abort, but sampling outside covered samples can still race with attachment stores. Address this bounded rendering risk or explicitly accept it before merging. <!-- final_review_risk_end --> <!-- architecture_review_start --> ### Security Architecture Review **Security architecture risk:** _🔵 Low_ · up to `f67cc` The change preserves rejection of genuine per-fragment feedback writes. However, the safety of the newly allowed clear-only case has not been fully established when the required graphics extension is unavailable. The remaining risk is bounded to graphics execution; no privilege escalation or isolation breach was demonstrated. **Retained concerns** - **Low · architecture · inferred:** Clear-only sampled overlap now passes the unsupported-host guard while the depth/stencil attachment retains STORE. The inspected path provides neither a covered-sample restriction nor a demonstrated Vulkan ordering guarantee for arbitrary sampled coordinates. If that configuration falls outside the supported API contract, guest draws could cause rendering failures beyond the previously fail-closed boundary. The exact API validity and failure outcome remain unresolved. <details> <summary>Security review details</summary> **Security Blast Radius** - _inferred_ — The directly affected execution scope is the emulator's host graphics path for guest draws on hosts lacking attachment-feedback-loop support. The inspected path reaches Vulkan depth/stencil attachment operations; it does not establish cross-tenant access, additional credentials, or increased administrative authority. **Security Findings and Attack Paths** - _inferred_ — A guest draw sampling an overlapping cleared depth/stencil aspect can now reach the host attachment STORE path where the base rejected it. This identifies increased reachability of an unresolved API-contract case, not a verified exploit or demonstrated host isolation failure. **Trust Boundaries and Controls** - _observed_ — Render-target acquisition checks cached image ownership, registration and rebind state before attachment use. The PR preserves those checks and the per-fragment feedback guard, while narrowing the capability control for clear-only overlap. **Hardening Proposals** - _proposed_ — Establish the Vulkan contract for sampled coordinates, load clears and attachment STORE on unsupported hosts. If that contract cannot support the admitted case, consider a separately ordered clear followed by a supported read-only or copied-image path rather than relying solely on per-fragment write detection. </details> <!-- architecture_review_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :----------------: | :--------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 3 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly and concisely describes the main change: excluding depth load clears when detecting attachment feedback loops. | | Description check | ✅ Passed | The description directly explains the crash, the cause, the intended behavior, and the testing performed for the changeset. | | 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. | </details> </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=943)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [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) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
@ -535,1 +535,3 @@
if (feedback_aspects && !m_context.GetGraphics().attachment_feedback_loop_enabled) {
const auto per_fragment_writes = depth.AttachmentWriteAspects(false);
if ((feedback_aspects & per_fragment_writes) &&
!m_context.GetGraphics().attachment_feedback_loop_enabled) {
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-30 12:23 UTC · original · edited 2026-09-30 13:18 UTC

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '500,565p' src/graphics/host_gpu/renderer/renderDraw.cpp
sed -n '60,120p' src/graphics/host_gpu/renderer/context.cpp
sed -n '410,480p' src/graphics/host_gpu/renderer/depthRenderTarget.cpp

Repository: KytyPS5/KytyPS5

Length of output: 8328


🏁 Script executed:

#!/bin/bash
rg -n -C 8 "DepthFeedbackAspects|feedback_aspects|BindingType::Texture|sampled_aspects|AttachmentFeedback" src/graphics/host_gpu/renderer src/graphics/host_gpu -g '*.cpp' -g '*.h' | head -240

Repository: KytyPS5/KytyPS5

Length of output: 22916


🌐 Web query:

official Vulkan specification attachment feedback loop sampled depth stencil attachment load store covered samples non-covered samples

💡 Result:

The official Vulkan specification covers this under **“Common Render Pass Data Races → Sampling From a Read-Only Attachment”**—not specifically as an attachment-feedback-loop rule.

- Sampling a read-only depth/stencil attachment is safe with `STORE` or `DONT_CARE` only when a fragment shader reads **the same samples covered by that fragment**. The spec guarantees the store operation happens after fragment execution for those samples.
- Reading other samples, or sampling in another shader stage, can cause a data race. For this case, the spec recommends `VK_ATTACHMENT_STORE_OP_NONE`, paired with a load operation that also performs no writes.
- For an actual **feedback-loop attachment**, the spec separately says overlap is per-pixel and implementations must not access pixels outside the render area. ([docs.vulkan.org](https://docs.vulkan.org/spec/latest/chapters/renderpass.html))

For depth/stencil attachments, `loadOp`/`storeOp` apply to depth; `stencilLoadOp`/`stencilStoreOp` apply to stencil. ([docs.vulkan.org](https://docs.vulkan.org/spec/latest/chapters/renderpass.html))

Sources: [Vulkan specification: Render Pass chapter](https://docs.vulkan.org/spec/latest/chapters/renderpass.html) ([docs.vulkan.org](https://docs.vulkan.org/spec/latest/chapters/renderpass.html)); [Khronos feedback-loop extension description](https://docs.vulkan.org/features/latest/features/proposals/VK_EXT_attachment_feedback_loop_layout.html) ([docs.vulkan.org](https://docs.vulkan.org/features/latest/features/proposals/VK_EXT_attachment_feedback_loop_layout.html))

Citations:

- 1: https://docs.vulkan.org/spec/latest/chapters/renderpass.html
- 2: https://docs.vulkan.org/spec/latest/chapters/renderpass.html
- 3: https://docs.vulkan.org/spec/latest/chapters/renderpass.html
- 4: https://docs.vulkan.org/features/latest/features/proposals/VK_EXT_attachment_feedback_loop_layout.html

🏁 Script executed:

#!/bin/bash
sed -n '40,82p' src/graphics/host_gpu/renderer/depthRenderTarget.h
rg -n -C 6 "struct PreparedBindings|class PreparedBindings|struct.*Binding|stage->images|Shader.*Image|TextureCache::BindingType|BindingType::Texture" src/graphics/host_gpu -g '*.h' -g '*.cpp' | head -320

Repository: KytyPS5/KytyPS5

Length of output: 32025


🌐 Web query:

site:docs.vulkan.org/spec/latest/chapters/renderpass.html "Sampling From a Read-Only Attachment" "covered"

💡 Result:

The Vulkan specification’s **“Sampling From a Read-Only Attachment”** section says that sampling from an attachment with `STORE` or `DONT_CARE` can race with store operations. In a fragment shader, reading samples covered by that fragment is safe; reading other samples—or sampling from another shader stage—can cause a data race and unexpected behavior. The spec recommends `VK_ATTACHMENT_STORE_OP_NONE` when reading an image both as an attachment and as a non-attachment. ([docs.vulkan.org](https://docs.vulkan.org/spec/latest/chapters/renderpass.html?utm_source=openai))

Citations:

- 1: https://docs.vulkan.org/spec/latest/chapters/renderpass.html?utm_source=openai

🏁 Script executed:

#!/bin/bash
sed -n '73,115p' src/graphics/host_gpu/renderer/depthRenderTarget.h
sed -n '1040,1145p' src/graphics/host_gpu/renderer/renderDraw.cpp
sed -n '88,110p' src/graphics/host_gpu/renderer/image/imageView.h

Repository: KytyPS5/KytyPS5

Length of output: 7218


Account for load and store accesses in the feedback-loop guard.

AttachmentWriteAspects(false) excludes clear loads, while BeginRendering uses eClear when requested and always uses eStore. Vulkan permits covered-sample reads from a read-only attachment with eStore, but non-covered sample reads can race with the store. The sampled-depth binding contract does not enforce covered-sample access.

When feedback-loop support is disabled, include the effective load/store accesses in this guard, or prove that the shader reads only covered samples. Do not gate the decision only on per-fragment writes.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-30 12:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/943#discussion_r4144502463) · edited 2026-09-30 13:18 UTC _🩺 Stability & Availability_ | _🟡 Minor_ | _⚡ Quick win_ <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash sed -n '500,565p' src/graphics/host_gpu/renderer/renderDraw.cpp sed -n '60,120p' src/graphics/host_gpu/renderer/context.cpp sed -n '410,480p' src/graphics/host_gpu/renderer/depthRenderTarget.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 8328 --- 🏁 Script executed: ```bash #!/bin/bash rg -n -C 8 "DepthFeedbackAspects|feedback_aspects|BindingType::Texture|sampled_aspects|AttachmentFeedback" src/graphics/host_gpu/renderer src/graphics/host_gpu -g '*.cpp' -g '*.h' | head -240 ``` Repository: KytyPS5/KytyPS5 Length of output: 22916 --- 🌐 Web query: `official Vulkan specification attachment feedback loop sampled depth stencil attachment load store covered samples non-covered samples` 💡 Result: ``` The official Vulkan specification covers this under **“Common Render Pass Data Races → Sampling From a Read-Only Attachment”**—not specifically as an attachment-feedback-loop rule. - Sampling a read-only depth/stencil attachment is safe with `STORE` or `DONT_CARE` only when a fragment shader reads **the same samples covered by that fragment**. The spec guarantees the store operation happens after fragment execution for those samples. - Reading other samples, or sampling in another shader stage, can cause a data race. For this case, the spec recommends `VK_ATTACHMENT_STORE_OP_NONE`, paired with a load operation that also performs no writes. - For an actual **feedback-loop attachment**, the spec separately says overlap is per-pixel and implementations must not access pixels outside the render area. ([docs.vulkan.org](https://docs.vulkan.org/spec/latest/chapters/renderpass.html)) For depth/stencil attachments, `loadOp`/`storeOp` apply to depth; `stencilLoadOp`/`stencilStoreOp` apply to stencil. ([docs.vulkan.org](https://docs.vulkan.org/spec/latest/chapters/renderpass.html)) Sources: [Vulkan specification: Render Pass chapter](https://docs.vulkan.org/spec/latest/chapters/renderpass.html) ([docs.vulkan.org](https://docs.vulkan.org/spec/latest/chapters/renderpass.html)); [Khronos feedback-loop extension description](https://docs.vulkan.org/features/latest/features/proposals/VK_EXT_attachment_feedback_loop_layout.html) ([docs.vulkan.org](https://docs.vulkan.org/features/latest/features/proposals/VK_EXT_attachment_feedback_loop_layout.html)) Citations: - 1: https://docs.vulkan.org/spec/latest/chapters/renderpass.html - 2: https://docs.vulkan.org/spec/latest/chapters/renderpass.html - 3: https://docs.vulkan.org/spec/latest/chapters/renderpass.html - 4: https://docs.vulkan.org/features/latest/features/proposals/VK_EXT_attachment_feedback_loop_layout.html ``` --- 🏁 Script executed: ```bash #!/bin/bash sed -n '40,82p' src/graphics/host_gpu/renderer/depthRenderTarget.h rg -n -C 6 "struct PreparedBindings|class PreparedBindings|struct.*Binding|stage->images|Shader.*Image|TextureCache::BindingType|BindingType::Texture" src/graphics/host_gpu -g '*.h' -g '*.cpp' | head -320 ``` Repository: KytyPS5/KytyPS5 Length of output: 32025 --- 🌐 Web query: `site:docs.vulkan.org/spec/latest/chapters/renderpass.html "Sampling From a Read-Only Attachment" "covered"` 💡 Result: ``` The Vulkan specification’s **“Sampling From a Read-Only Attachment”** section says that sampling from an attachment with `STORE` or `DONT_CARE` can race with store operations. In a fragment shader, reading samples covered by that fragment is safe; reading other samples—or sampling from another shader stage—can cause a data race and unexpected behavior. The spec recommends `VK_ATTACHMENT_STORE_OP_NONE` when reading an image both as an attachment and as a non-attachment. ([docs.vulkan.org](https://docs.vulkan.org/spec/latest/chapters/renderpass.html?utm_source=openai)) Citations: - 1: https://docs.vulkan.org/spec/latest/chapters/renderpass.html?utm_source=openai ``` --- 🏁 Script executed: ```bash #!/bin/bash sed -n '73,115p' src/graphics/host_gpu/renderer/depthRenderTarget.h sed -n '1040,1145p' src/graphics/host_gpu/renderer/renderDraw.cpp sed -n '88,110p' src/graphics/host_gpu/renderer/image/imageView.h ``` Repository: KytyPS5/KytyPS5 Length of output: 7218 --- </details> **Account for load and store accesses in the feedback-loop guard.** `AttachmentWriteAspects(false)` excludes clear loads, while `BeginRendering` uses `eClear` when requested and always uses `eStore`. Vulkan permits covered-sample reads from a read-only attachment with `eStore`, but non-covered sample reads can race with the store. The sampled-depth binding contract does not enforce covered-sample access. When feedback-loop support is disabled, include the effective load/store accesses in this guard, or prove that the shader reads only covered samples. Do not gate the decision only on per-fragment writes. <!-- fingerprinting:phantom:medusa:wombat61 --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:ad714fec2b2e8e579816eb6c --> <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-30 12:23 UTC · original · reviewed

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 1324ff71-16e1-48ec-ba7b-e5884ac874b9

📥 Commits

Reviewing files that changed from the base of the PR and between 05057c9441 and f67cc8441f.

📒 Files selected for processing (3)
  • src/graphics/host_gpu/renderer/depthRenderTarget.cpp
  • src/graphics/host_gpu/renderer/depthRenderTarget.h
  • src/graphics/host_gpu/renderer/renderDraw.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-09-30 12:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/943#pullrequestreview-5366094850) · **reviewed** **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml **Review profile**: CHILL **Plan**: Advanced **Run ID**: `1324ff71-16e1-48ec-ba7b-e5884ac874b9` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 05057c9441dbf3972d49f9143b90213a43a01a00 and f67cc8441f3421f69bb3af99ba2ac2f7835f92cd. </details> <details> <summary>📒 Files selected for processing (3)</summary> * `src/graphics/host_gpu/renderer/depthRenderTarget.cpp` * `src/graphics/host_gpu/renderer/depthRenderTarget.h` * `src/graphics/host_gpu/renderer/renderDraw.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 -->
@ -535,1 +535,3 @@
if (feedback_aspects && !m_context.GetGraphics().attachment_feedback_loop_enabled) {
const auto per_fragment_writes = depth.AttachmentWriteAspects(false);
if ((feedback_aspects & per_fragment_writes) &&
!m_context.GetGraphics().attachment_feedback_loop_enabled) {
Author
Owner

@⁠joaodiaslobo on GitHub · 2026-09-30 13:18 UTC · original

The store op is always eStore for depth, so including it in the guard would make it fire on every draw that samples its own depth attachment and would bring the crash back.
In this case nothing modifies the depth values, depth_write_enable is 0 and the only load write is the HTile clear, so the store writes back what is read.

**@⁠joaodiaslobo** on GitHub · 2026-09-30 13:18 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/943#discussion_r4145005279) The store op is always `eStore` for depth, so including it in the guard would make it fire on every draw that samples its own depth attachment and would bring the crash back. In this case nothing modifies the depth values, `depth_write_enable` is 0 and the only load write is the HTile clear, so the store writes back what is read.
@ -535,1 +535,3 @@
if (feedback_aspects && !m_context.GetGraphics().attachment_feedback_loop_enabled) {
const auto per_fragment_writes = depth.AttachmentWriteAspects(false);
if ((feedback_aspects & per_fragment_writes) &&
!m_context.GetGraphics().attachment_feedback_loop_enabled) {
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-30 13:19 UTC · original

🧩 Analysis chain

🤖 web_search executed:

In the official Vulkan specification section "Sampling From a Read-Only Attachment", do depth attachment STORE operations potentially race with shader sampling of non-covered samples even if depthWriteEnable is false and the stored depth values are unchanged? Quote the relevant normative text and load CLEAR ordering requirements. Is STORE_OP_NONE with LOAD_OP_CLEAR sufficient or must a clear be performed separately before rendering?

Length of output: 2585


@joaodiaslobo, you are right that counting every eStore in the abort guard would bring the crash back. My recommendation was too broad.

However, unchanged depth values do not remove the Vulkan data-race concern. The specification states that STORE may write even when no recorded command writes the attachment. It guarantees safe fragment-shader reads for covered samples, but not for other samples or other shader stages.

The concern therefore remains, but the remedy should not be a blanket abort. For sampled aspects with no per-fragment writes, a safe path is to materialize the HTile clear before rendering, synchronize that clear with shader reads, and use a non-writing load operation with STORE_OP_NONE during rendering.

Thanks for clarifying the depth store behavior.


✏️ Learnings added
Learnt from: joaodiaslobo
Repo: KytyPS5/KytyPS5 PR: 943
File: src/graphics/host_gpu/renderer/renderDraw.cpp:536-537
Timestamp: 2026-09-30T13:19:21.454Z
Learning: In KytyPS5's depth rendering path, depth attachments always use vk::AttachmentStoreOp::eStore. Counting every depth store as unsupported attachment feedback would reject all draws that sample their own depth attachment, including the read-only-depth case that PR #943 addresses. Distinguish Vulkan load/store synchronization concerns from per-fragment write feedback; do not recommend a blanket store-based abort as the fix.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-30 13:19 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/943#discussion_r4145013248) <details> <summary>🧩 Analysis chain</summary> 🤖 web_search executed: `In the official Vulkan specification section "Sampling From a Read-Only Attachment", do depth attachment STORE operations potentially race with shader sampling of non-covered samples even if depthWriteEnable is false and the stored depth values are unchanged? Quote the relevant normative text and load CLEAR ordering requirements. Is STORE_OP_NONE with LOAD_OP_CLEAR sufficient or must a clear be performed separately before rendering?` Length of output: 2585 --- </details> `@joaodiaslobo`, you are right that counting every `eStore` in the abort guard would bring the crash back. My recommendation was too broad. However, unchanged depth values do not remove the Vulkan data-race concern. The [specification](https://docs.vulkan.org/spec/latest/chapters/renderpass.html) states that `STORE` may write even when no recorded command writes the attachment. It guarantees safe fragment-shader reads for covered samples, but not for other samples or other shader stages. The concern therefore remains, but the remedy should not be a blanket abort. For sampled aspects with no per-fragment writes, a safe path is to materialize the HTile clear before rendering, synchronize that clear with shader reads, and use a non-writing load operation with `STORE_OP_NONE` during rendering. Thanks for clarifying the depth store behavior. --- <details> <summary>✏️ Learnings added</summary> ``` Learnt from: joaodiaslobo Repo: KytyPS5/KytyPS5 PR: 943 File: src/graphics/host_gpu/renderer/renderDraw.cpp:536-537 Timestamp: 2026-09-30T13:19:21.454Z Learning: In KytyPS5's depth rendering path, depth attachments always use vk::AttachmentStoreOp::eStore. Counting every depth store as unsupported attachment feedback would reject all draws that sample their own depth attachment, including the read-only-depth case that PR #943 addresses. Distinguish Vulkan load/store synchronization concerns from per-fragment write feedback; do not recommend a blanket store-based abort as the fix. ``` > Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure [review instructions](https://docs.coderabbit.ai/guides/review-instructions). You can manage existing learnings in the [app](https://app.coderabbit.ai/learnings). </details> _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

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

Superseded by b89971790.

**@⁠Nmzik** on GitHub · 2026-10-21 19:41 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/943#issuecomment-6324933056) Superseded by b89971790.

Pull request closed

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