graphics: use static feedback loop pipelines without the dynamic-state extension #1187
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1187
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1187"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@overlordxrz-source on GitHub · 2026-10-08 02:31 UTC · original
overlordxrz-source:graphics/feedback-loop-static-pipelines→main· +72 −26 · 8 files · 1 commits · openDepth feedback loops (a draw that samples the depth target it is also writing) only work when the device has both
VK_EXT_attachment_feedback_loop_layoutandVK_EXT_attachment_feedback_loop_dynamic_state. If either one is missing, the emulator enables neither, and the first such draw exits withdepth attachment feedback loop is not supported by the host(renderDraw.cpp:536).Some drivers have the layout extension but not the dynamic-state one. In #904, @joaodiaslobo read the reporter's vulkaninfo for an RX 9070 XT on Windows and found exactly that. As he pointed out there, the layout extension alone is enough if the pipeline carries the feedback loop flag itself instead of setting it per draw. This PR does that.
vulkanWindow.cpp: enableVK_EXT_attachment_feedback_loop_layouton its own, and the dynamic-state extension only when the device also has it. Each feature struct is chained only when its extension is enabled. The log line now readsVulkan depth feedback support: <layout> (dynamic state: <dynamic>).GraphicContext:attachment_feedback_loop_enablednow means the layout feature is on. The newattachment_feedback_loop_dynamic_state_enabledgateseAttachmentFeedbackLoopEnableEXTandvkCmdSetAttachmentFeedbackLoopEnableEXT.PipelineRenderingStatehas a newdepth_stencil_feedback_loopbit, which is part of the key's equality and hash. When it is set, the pipeline is created withVK_PIPELINE_CREATE_DEPTH_STENCIL_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT. It is only set on hosts without the dynamic-state extension, so hosts with both extensions keep one pipeline per state as before.ExecutePreparedDraw: the render targets are now acquired before the pipeline lookup, so the draw's feedback state is known when the pipeline is chosen. A draw counts as a feedback loop whenAcquireRenderTargetsreports feedback aspects or puts the depth attachment inATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT.GetGraphicsPipelineonly creates pipelines and doesn't record commands, so the barriers thatAcquireRenderTargetsrecords end up in the same command buffer as before.Draws that don't sample their own depth target are unchanged on every host. Nothing changes on a host that has neither extension: the exit stays.
Evidence
VK_EXT_attachment_feedback_loop_layoutbut notVK_EXT_attachment_feedback_loop_dynamic_state, and suggests baking the setting into the pipeline as a fallback.Vulkan depth feedback support: false, then the same exit in cutscenes. I don't know which of the two extensions that driver is missing. If it lacks the layout extension too, this PR won't help there.Testing
vulkanWindow.cpp,pipelineCache.cpp,shaders.cpp,renderDraw.cpp, plusimage.cppandtests/ShaderRecompilerComputeTests.cpp, forx86_64-linux-gnuwith clang (zig c++). No errors.attachment_feedback_loop_dynamic_state_enabledalong withattachment_feedback_loop_enabled, because its device enables both extensions. That keeps the existing per-draw feedback test on the dynamic path.VK_EXT_attachment_feedback_loop_layout. It creates a dynamic-rendering pipeline withVK_PIPELINE_CREATE_DEPTH_STENCIL_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT, with depth usageDEPTH_STENCIL_ATTACHMENT | SAMPLED | ATTACHMENT_FEEDBACK_LOOP, asimage.cppsets it. The draw writes depth while sampling it, with the attachment inATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT. The validation layer reported 0 errors, and the output matches the same draw on a device with both extensions usingvkCmdSetAttachmentFeedbackLoopEnableEXT. Caveat: the same layer version also reports nothing when the flag is left out, so this shows the new path is valid, not that the layer enforces the flag. The requirement comes from the spec's feedback loop rules in the render pass chapter.src/lines are clean undersrc/.clang-format(clang-format 23.1.3).AI assistance
An AI assistant helped me trace the exit to the extension check, write the change and the Vulkan check, and run the builds above. I reviewed the code and the results.
@coderabbitai[bot] on GitHub · 2026-10-08 02:33 UTC · original · edited 2026-10-16 02:38 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
79365744-82c1-49a1-a4dc-5c4ba52e99fc📥 Commits
Reviewing files that changed from the base of the PR and between ef7251d85989edf46cbc4a5dcf89f8228f464092 and
633696f09f.📒 Files selected for processing: 7
src/graphics/host_gpu/graphicContext.hsrc/graphics/host_gpu/renderer/pipeline/pipelineCache.cppsrc/graphics/host_gpu/renderer/pipeline/pipelineCache.hsrc/graphics/host_gpu/renderer/pipeline/shaders.cppsrc/graphics/host_gpu/renderer/renderDraw.cppsrc/graphics/presentation/window/vulkanWindow.cpptests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
The change separates attachment feedback-loop layout support from dynamic-state support. Device setup queries and enables each capability according to extension and feature availability. Graphics pipeline creation uses static depth/stencil feedback-loop state when dynamic state is unavailable. Draw execution passes depth feedback-loop information to pipeline creation and updates per-draw feedback-loop state only when dynamic state is supported.
Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: 🔵 Low · up to
63369The change remains mergeable with awareness that the layout-only fallback has not been covered by the test harness; hardware retesting would improve confidence.
Pre-merge checks:
4 ·
1
Full details: Docstring Coverage
Explanation
Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 7 files. (1 skipped: 1 too large.)
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 helpto get the list of available commands.@RobertBruno454 on GitHub · 2026-10-09 16:35 UTC · original
Tested this PR on real hardware: AMD Radeon RX 9070 XT, Windows 11, latest Adrenalin, Intel i7-11700.
Build: fork build of e51027a (built with the repo's own workflow).
Game: EA SPORTS UFC 6 (PPSA23566, v01.004.000).
Result: the fix works.
4c8fc53logsVulkan depth feedback support: falseand exits withdepth attachment feedback loop is not supported by the host(renderDraw.cpp:542).Vulkan depth feedback support: true (dynamic state: false)and the gamegets past that point (shaders went from VS 4 | PS 3 | CS 11 to VS 9 | PS 7 | CS 30).
New, separate crash further in (deterministic, same address on every run):
mov [rcx], rdxwith rcx=0 inside a doubly-linked-list unlink(
mov rcx,[r8+8]; mov rdx,[r8]; mov [rcx],rdx), and all return addresses on the stack are in0x7ffd... DLLs, so it looks like a crash inside the AMD Vulkan driver during pipeline handling.
Happy to test further builds or provide full logs.
@overlordxrz-source on GitHub · 2026-10-10 02:02 UTC · original
Rebased onto current main. The only conflict was with the new cached dynamic state (
93452b24e). I kept main's DynamicState path and changed its gate in dynamicState.cpp: vkCmdSetAttachmentFeedbackLoopEnableEXT is now emitted only when VK_EXT_attachment_feedback_loop_dynamic_state is present. Without that, a driver with only the layout extension (the case this PR fixes) would call a command it doesn't support.This also covers the GTA V prologue-cutscene exit reported in #829 ("depth attachment feedback loop is not supported by the host" on RX 9070). @TotoWood, could you retest GTA V with this build? It complements #1241, with no file overlap.
AI-assisted: yes.
@overlordxrz-source on GitHub · 2026-10-12 02:26 UTC · original
Rebased onto current main (
16a7fe689). Still one commit, author unchanged, new headef7251d85.The only conflict was in
VulkanCreateDevice(vulkanWindow.cpp) with1029511bb("add depth to color copy"). Both commits rewrote the lines that setattachment_feedback_loop_enabledand print the device log. I kept all of1029511bbas it is: theVK_KHR_maintenance8query, enable and pNext chaining,depth_color_copy_enabled, and its "Vulkan depth/color copy support" log line. Then I put this PR's layout and dynamic-state split back around it. The log now prints both lines:How the two interact: they are separate paths, and neither replaces the other.
1029511bbhandlescopy_depth_to_colordraws.CopyDepthToColorruns first inExecutePreparedDraw, does avkCmdCopyImageand returns before a pipeline is looked up. So the static feedback-loop pipeline key added here never affects that path.VK_EXT_attachment_feedback_loop_dynamic_state, the loop is baked into the pipeline. That part is unchanged from the 10-09 rebase, including thedynamicState.cppgate onattachment_feedback_loop_dynamic_state_enabled.Checks: x86_64 cross-compile of the touched files, clang-format clean on the changed lines, and test merges with #1388, #1389, #1421 and #1241 (no conflicts). Nothing was run on a GPU.
@RobertBruno454 @TotoWood: since main now also has the maintenance8 depth-to-color copy, could you retest on the RX 9070 / 9070 XT with this head? Please include the two log lines above, and say whether UFC 6 / GTA V still get past the feedback-loop exit and whether the later driver crash changed.
@coderabbitai[bot] on GitHub · 2026-10-12 02:30 UTC · original · reviewed
🧹 Nitpick comments (1)
ℹ️ Review info
⚙️ Run configuration
b83fa0f8-e778-4d57-9049-526b01759084📥 Commits
Reviewing files that changed from the base of the PR and between 4c21706e63bc53d35f76f3e9d16f3fae6447cf87 and ef7251d85989edf46cbc4a5dcf89f8228f464092.
📒 Files selected for processing (4)
src/graphics/host_gpu/graphicContext.hsrc/graphics/host_gpu/renderer/renderDraw.cppsrc/graphics/presentation/window/vulkanWindow.cpptests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@theantipopau on GitHub · 2026-11-13 20:40 UTC · original
Superseded by #2213, which is the rebased replacement targeting current
mainwith the full Windows/macOS/Linux CI green and the static depth-feedback selector passing locally. This PR should be closed once #2213 merges; leaving it open for now.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.