graphics: survive host-rejected pipelines and retired cache slots #1621
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!1621
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1621"
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?
@theantipopau on GitHub · 2026-10-17 21:25 UTC · original
theantipopau:fix/crash-hardening-1618-1586→main· +209 −29 · 7 files · 3 commits · openTwo user-reported hard crashes, both abort the whole emulator where recovery is possible.
#1586 (PPSA04987 fails at start, shaders.cpp result != eSuccess)
vkCreateGraphicsPipelines can fail on a host that rejects a specific configuration. That used to hit EXIT_NOT_IMPLEMENTED and kill the game with 'Unhandled host exception'.
#1618 (crash in SlotVector::operator[] on !is_allocated(id))
Cache ids are weak references, but several consumption sites used strict operator[] where the referent can already be retired by GC/eviction or a deferred scheduler erase:
Verification: git diff --check clean; g++ -fsyntax-only over all six touched TUs (stub cmake_config.h + TRACY_ENABLE, matching upstream config) is clean except vk::Offset2D/Extent2D brace-assignment errors that reproduce identically on pristine upstream files under this MinGW host toolchain (pre-existing, untouched lines). No full local build (needs network FFmpeg fetch); leaving that to CI.
@coderabbitai[bot] on GitHub · 2026-10-17 21:31 UTC · original · edited 2026-10-18 22:45 UTC
📝 Walkthrough
Buffer and texture cache operations now check for retired slots before accessing or unlinking entries. Graphics pipeline creation reports failures and cleans up partial objects. The pipeline cache records rejected configurations and returns a nullable pipeline pointer. Draw execution skips the draw when the cache returns null. The test helper checks that the returned pipeline pointer is non-null.
Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: 🔵 Low · up to
2a70bIf a driver reports VK_ERROR_UNKNOWN for a recoverable pipeline-creation failure, later draws using that configuration may continue to be skipped. This is a narrow, driver-dependent risk; the PR is low risk to merge with owner awareness.
Pre-merge checks:
4 ·
1
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.@ -497,0 +556,4 @@graphics.device.destroyShaderModule(tess_eval_shader_module, nullptr);}return PipelineCreateResult::ResourceFailure;}@coderabbitai[bot] on GitHub · 2026-10-17 21:31 UTC · original · edited 2026-10-17 22:42 UTC
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Destroy the tessellation modules on the pipeline-layout failure path.
When
createPipelineLayoutfails, the function returnsfalse. At that pointtess_control_shader_moduleandtess_eval_shader_modulemay already exist for a rect-list draw. Neither module is destroyed on this path. Each rejected configuration leaks up to twoVkShaderModulehandles.The
createGraphicsPipelinesfailure path at Lines 625-630 already destroys them. Apply the same cleanup here.Proposed fix
📝 Committable suggestion
✅ Addressed in commit 503ada8
@coderabbitai[bot] on GitHub · 2026-10-17 21:31 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
dc3bce20-2ed0-4308-9b07-8eaca3c69e94📥 Commits
Reviewing files that changed from the base of the PR and between
763d3be3a9and 5ad3564ae1678f12ffa5a7df0e8007ed77569615.📒 Files selected for processing: 6
src/graphics/host_gpu/renderer/cache/bufferCache.cppsrc/graphics/host_gpu/renderer/cache/textureCache.cppsrc/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.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
@Nawid3333 on GitHub · 2026-10-17 21:53 UTC · original
Do you Mind if i help? @theantipopau
@Nawid3333 on GitHub · 2026-10-17 21:58 UTC · original
Hi @theantipopau, the Windows and macOS builds fail only because of one test that still uses the old return type:
tests/ShaderRecompilerComputeTests.cpp(thepipelinelambda inCheckRasterization, around line 17356) binds the result ofGetGraphicsPipeline()to a reference, and it now returns a pointer. Changing thatreturnto this fixes it:I tried it on top of your branch: it builds, and
PolygonModeRasterizationpasses on my RX 9070 XT and Ryzen 7600X iGPU. Hope that helps!One more thing, just as a heads-up: nmzik has closed changes before that let the emulator carry on past a broken state, for example #1119 ("tolerate stale descriptor-table slots"), which he called a hack. Skipping a rejected pipeline or a retired cache slot keeps the game running, but the real bug stays: something still uses a slot after it was freed (#1618), and Kyty asks the driver for a pipeline it can't create (#1586). A fix for one of those causes would probably have a better chance of being merged.
@theantipopau on GitHub · 2026-10-17 22:42 UTC · original
Thanks @Nawid3333 and @coderabbitai - fixed in 503ada84: test lambda now null-checks GetGraphicsPipeline() before deref, plus tess modules are destroyed on the pipeline-layout failure path. CI rerunning.
@coderabbitai[bot] on GitHub · 2026-10-17 22:54 UTC · original
🧩 Analysis chain
🏁 Script executed:
Length of output: 1127
🏁 Script executed:
Length of output: 15726
@theantipopauThanks. I verified both changes in503ada8:GetGraphicsPipeline()for null before dereferencing.Build and runtime validation remain pending CI.
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
You are interacting with an AI system.
@coderabbitai[bot] on GitHub · 2026-10-18 22:15 UTC · original · edited 2026-10-18 22:48 UTC
On
src/graphics/host_gpu/renderer/pipeline/pipelineCache.cppline 1020 (outdated):🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Do not permanently cache resource failures.
If
vkCreatePipelineLayoutfails because of temporary host or device memory exhaustion,CreatePipelineInternalreturnsfalseand this branch records the key. Later draws returnnullptrfor that key, even after memory becomes available. The affected geometry remains absent until the cache is replaced. Preserve the failure reason and cache only failures that establish a persistently rejected configuration. Retry resource failures under a bounded policy. Vulkan permits both out-of-memory results from pipeline-layout creation. (docs.vulkan.org)✅ Confirmed as addressed by @theantipopau
@coderabbitai[bot] on GitHub · 2026-10-18 22:15 UTC · original · reviewed
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
90e54df7-5e93-4472-ab17-3bee8c16d487📥 Commits
Reviewing files that changed from the base of the PR and between 503ada84313bfb289c850c53cfe735b17a47b951 and
e457c7bf18.📒 Files selected for processing: 3
src/graphics/host_gpu/renderer/cache/textureCache.cppsrc/graphics/host_gpu/renderer/pipeline/pipelineCache.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-10-18 22:30 UTC · original
On
src/graphics/host_gpu/renderer/pipeline/pipelineCache.cppline 1020 (outdated):Fixed in f6567d7a: graphics pipeline creation now returns a PipelineCreateResult (Created/Rejected/ResourceFailure). Only deterministic rejections enter the negative cache; vkCreatePipelineLayout failures and vkCreateGraphicsPipelines OOM results (eOutOfHostMemory/eOutOfDeviceMemory) log throttled and retry on later draws.
@coderabbitai[bot] on GitHub · 2026-10-18 22:45 UTC · original · reviewed
ℹ️ Review info
⚙️ Run configuration
336ecc0c-37e7-4e82-8c90-22aa2703018d📥 Commits
Reviewing files that changed from the base of the PR and between f6567d7a8d19c20a698aa7fb278a9c4b9ab706d7 and
2a70b3e785.📒 Files selected for processing: 1
src/graphics/host_gpu/renderer/pipeline/shaders.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.
@coderabbitai[bot] on GitHub · 2026-10-18 22:48 UTC · original
On
src/graphics/host_gpu/renderer/pipeline/pipelineCache.cppline 1020 (outdated):@theantipopau Thanks for the fix.
PipelineCreateResultseparates resource failures from deterministic rejections. OnlyRejectedresults enter the negative cache, so resource failures remain eligible for retry on later draws. This addresses the finding.If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
✅ Review thread resolved.
You are interacting with an AI system.
@theantipopau on GitHub · 2026-10-18 23:04 UTC · original
Maintainer summary — this PR is ready to merge_unlock when you are:
2a70b3e7: only deterministic rejections enter the negative pipeline cache; transient OOM (layout creation, eErrorOutOfHostMemory/eErrorOutOfDeviceMemory) logs throttled and retries on later draws.CI green on Linux/Windows/macOS + CodeRabbit, MERGEABLE/CLEAN, rebased to current main. Nawid3333's test-lambda finding and both CodeRabbit Majors (nullable test result, tess leak, OOM negative-cache) are addressed in-thread.
@theantipopau on GitHub · 2026-10-18 23:05 UTC · original
Small correction to my summary above: 'ready to merge_unlock' was a typo — should read 'ready to merge'. (I can't edit the original comment without repo admin rights.)
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.