graphics: survive host-rejected pipelines and retired cache slots #1621

Open
github-bot wants to merge 3 commits from github-bot/gh-1621 into main AGit
Owner

@⁠theantipopau on GitHub · 2026-10-17 21:25 UTC · original
theantipopau:fix/crash-hardening-1618-1586 → main · +209 −29 · 7 files · 3 commits · open

Two 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'.

  • Graphics CreatePipelineInternal now returns bool. On layout/pipeline creation failure it logs the full rejected configuration (result code, VS/PS ids, topology, color/depth/stencil formats, sample count, stage and dynamic-state counts) to the console log, destroys any partially created handles, and returns false.
  • GetGraphicsPipeline returns a nullable Pipeline pointer and remembers rejected keys (capped failed-set) so later draws skip re-creation instead of stalling on it every frame.
  • ExecutePreparedDraw skips draws with a rejected pipeline (throttled log) instead of aborting. A game with one bad configuration keeps running; a game where everything fails gets an actionable log instead of an exit.

#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:

  • textureCache: FreeImage is now idempotent (throttled log + return on dead ids, matching DeleteImage's existing tolerance); DeleteImage's depth-owner detach and AssociateStencil's previous-depth detach only unlink when the owner is still alive.
  • bufferCache: RunGarbageCollector (both the LRU walk and the deferred-download retire loop) and SynchronizeBuffersInRange skip already-retired buffers instead of aborting.

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.

**@⁠theantipopau** on GitHub · 2026-10-17 21:25 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1621) `theantipopau:fix/crash-hardening-1618-1586` → `main` · +209 −29 · 7 files · 3 commits · open Two 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'. - Graphics CreatePipelineInternal now returns bool. On layout/pipeline creation failure it logs the full rejected configuration (result code, VS/PS ids, topology, color/depth/stencil formats, sample count, stage and dynamic-state counts) to the console log, destroys any partially created handles, and returns false. - GetGraphicsPipeline returns a nullable Pipeline pointer and remembers rejected keys (capped failed-set) so later draws skip re-creation instead of stalling on it every frame. - ExecutePreparedDraw skips draws with a rejected pipeline (throttled log) instead of aborting. A game with one bad configuration keeps running; a game where everything fails gets an actionable log instead of an exit. **#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: - textureCache: FreeImage is now idempotent (throttled log + return on dead ids, matching DeleteImage's existing tolerance); DeleteImage's depth-owner detach and AssociateStencil's previous-depth detach only unlink when the owner is still alive. - bufferCache: RunGarbageCollector (both the LRU walk and the deferred-download retire loop) and SynchronizeBuffersInRange skip already-retired buffers instead of aborting. 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.
Two user-reported hard crashes, both abort the whole emulator where
recovery is possible.

Issue #1586 (game fails at start, vkCreateGraphicsPipelines error):
a host can reject a specific pipeline configuration. That hit
EXIT_NOT_IMPLEMENTED and killed the game with 'Unhandled host
exception'. Graphics CreatePipelineInternal now reports failure
instead: it logs the rejected configuration (result code, shader
ids, topology, formats, sample count, stage/dynamic-state counts),
destroys partially created handles and returns false.
GetGraphicsPipeline returns null for rejected keys (remembered in a
capped failed-set so later draws skip re-creation), and
ExecutePreparedDraw skips such draws with a throttled log.

Issue #1618 (SlotVector !is_allocated abort): 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. FreeImage is now idempotent;
depth/stencil link fixups only unlink live owners; the buffer GC
walks and SynchronizeBuffersInRange skip retired buffers.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <[email protected]>
- tests: null-check GetGraphicsPipeline() before deref (fixes Win/macOS builds)
- shaders: destroy tess modules on pipeline-layout failure path
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:01:50 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-17 21:31 UTC · original · edited 2026-10-18 22:45 UTC

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 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: nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: 🔵 Low · up to 2a70b

If 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: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 35.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly summarizes the two main changes: handling host-rejected graphics pipelines and retired cache slots.
Description check Passed The description directly explains both crash fixes, the implementation changes, and the reported verification results.
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.
  • 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-17 21:31 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1621#issuecomment-6241409468) · edited 2026-10-18 22:45 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/1621?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 --> <!-- This is an auto-generated comment: review paused by coderabbit.ai --> > [!NOTE] > ## Reviews paused > > It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the `reviews.auto_review.auto_pause_after_reviewed_commits` setting. > > - Last reviewed commit: 2a70b3e7851cf73767a68befff1ace863149ff15 > > Use the following commands to manage reviews: > - `@coderabbitai resume` to resume automatic reviews. > - `@coderabbitai review` to trigger a single review. > > Use the checkboxes below for quick actions: > - [ ] <!-- {"checkboxId":"7f6cc2e2-2e4e-497a-8c31-c9e4573e93d1"} --> ▶️ Resume reviews > - [ ] <!-- {"checkboxId":"e9bb8d72-00e8-4f67-9cb2-caf3b22574fe"} --> 🔍 Trigger review <!-- end of auto-generated comment: review paused by coderabbit.ai --> <!-- walkthrough_start --> <details> <summary><strong>📝 Walkthrough</strong></summary> <dl> <dd> 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:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"2a70b3e7851cf73767a68befff1ace863149ff15" --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong>🔵 Low</strong> · up to <code>2a70b</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **🔵 Low** · up to `2a70b` --> <!-- final_review_risk_coverage:{"sourceCommitId":"2a70b3e7851cf73767a68befff1ace863149ff15","coveredCommitId":"2a70b3e7851cf73767a68befff1ace863149ff15","kind":"reviewed"} --> If 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. <!-- 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 35.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 17 functions across 6 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 | | :------------------------ | :--------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly summarizes the two main changes: handling host-rejected graphics pipelines and retired cache slots. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description directly explains both crash fixes, the implementation changes, and the reported verification results. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | </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=1621)! 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 -->
@ -497,0 +556,4 @@
graphics.device.destroyShaderModule(tess_eval_shader_module, nullptr);
}
return PipelineCreateResult::ResourceFailure;
}
Author
Owner

@⁠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 createPipelineLayout fails, the function returns false. At that point tess_control_shader_module and tess_eval_shader_module may already exist for a rect-list draw. Neither module is destroyed on this path. Each rejected configuration leaks up to two VkShaderModule handles.

The createGraphicsPipelines failure path at Lines 625-630 already destroys them. Apply the same cleanup here.

Proposed fix
 		DestroyPartialPipeline(graphics, pipeline);
+		if (tess_control_shader_module != nullptr) {
+			graphics.device.destroyShaderModule(tess_control_shader_module, nullptr);
+		}
+		if (tess_eval_shader_module != nullptr) {
+			graphics.device.destroyShaderModule(tess_eval_shader_module, nullptr);
+		}
 		return false;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

	if (result != vk::Result::eSuccess || pipeline.pipeline_layout == nullptr) {
		LogSkippedPipelineConfig(fmt::format("vkCreatePipelineLayout result={} VS={} PS={}",
		                                     vk::to_string(result), vertex_program.id,
		                                     ps_active ? pixel_program.id : 0));
		DestroyPartialPipeline(graphics, pipeline);
		if (tess_control_shader_module != nullptr) {
			graphics.device.destroyShaderModule(tess_control_shader_module, nullptr);
		}
		if (tess_eval_shader_module != nullptr) {
			graphics.device.destroyShaderModule(tess_eval_shader_module, nullptr);
		}
		return false;
	}

✅ Addressed in commit 503ada8

**@⁠coderabbitai[bot]** on GitHub · 2026-10-17 21:31 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1621#discussion_r4304592073) · edited 2026-10-17 22:42 UTC **🩺 Stability & Availability** | **🟡 Minor** | **⚡ Quick win** **Destroy the tessellation modules on the pipeline-layout failure path.** When `createPipelineLayout` fails, the function returns `false`. At that point `tess_control_shader_module` and `tess_eval_shader_module` may already exist for a rect-list draw. Neither module is destroyed on this path. Each rejected configuration leaks up to two `VkShaderModule` handles. The `createGraphicsPipelines` failure path at Lines 625-630 already destroys them. Apply the same cleanup here. <details> <summary>Proposed fix</summary> ```diff DestroyPartialPipeline(graphics, pipeline); + if (tess_control_shader_module != nullptr) { + graphics.device.destroyShaderModule(tess_control_shader_module, nullptr); + } + if (tess_eval_shader_module != nullptr) { + graphics.device.destroyShaderModule(tess_eval_shader_module, nullptr); + } return false; ``` </details> <!-- suggestion_start --> <details> <summary>📝 Committable suggestion</summary> > ‼️ **IMPORTANT** > Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements. ```suggestion if (result != vk::Result::eSuccess || pipeline.pipeline_layout == nullptr) { LogSkippedPipelineConfig(fmt::format("vkCreatePipelineLayout result={} VS={} PS={}", vk::to_string(result), vertex_program.id, ps_active ? pixel_program.id : 0)); DestroyPartialPipeline(graphics, pipeline); if (tess_control_shader_module != nullptr) { graphics.device.destroyShaderModule(tess_control_shader_module, nullptr); } if (tess_eval_shader_module != nullptr) { graphics.device.destroyShaderModule(tess_eval_shader_module, nullptr); } return false; } ``` </details> <!-- suggestion_end --> <!-- fingerprinting:phantom:poseidon:beignet55 --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:3b36e72a16b1070405b67840 --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commit 503ada8
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-17 21:31 UTC · original · reviewed

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟠 Major · Handle the nullable graphics pipeline result in… · ShaderRecompilerComputeTests.cpp:17340-17358

tests/ShaderRecompilerComputeTests.cpp:17340-17358
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Handle the nullable graphics pipeline result in the test

GetGraphicsPipeline(...) returns Pipeline* and can return nullptr when the host rejects the configuration. The lambda currently returns that pointer as Pipeline&, so shader_recompiler_compute_tests fails to compile. After fixing the return type mismatch, dereferencing the result without a check can abort the test.

Require aborts on failure, so validate the pointer before returning the reference:

Suggested fix
-      return context.GetPipelineCache().GetGraphicsPipeline(
+      auto *selected = context.GetPipelineCache().GetGraphicsPipeline(
           std::span{&color, 1u}, depth, std::span{&vertex, 1u}, scheduler.Current(), &pixel,
           topology, false,
           PipelineCache::GraphicsPrograms{{vertex_shader}, pixel_shader});
+      Require(name, "graphics pipeline", selected != nullptr,
+              "the host rejected the graphics pipeline configuration");
+      return *selected;

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dc3bce20-2ed0-4308-9b07-8eaca3c69e94
📥 Commits

Reviewing files that changed from the base of the PR and between 763d3be3a9 and 5ad3564ae1678f12ffa5a7df0e8007ed77569615.

📒 Files selected for processing: 6
  • src/graphics/host_gpu/renderer/cache/bufferCache.cpp
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp
  • src/graphics/host_gpu/renderer/pipeline/pipelineCache.h
  • src/graphics/host_gpu/renderer/pipeline/shaders.cpp
  • 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-10-17 21:31 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1621#pullrequestreview-5560188408) · **reviewed** **Actionable comments posted: 1** > [!CAUTION] > Some comments are outside the diff and can’t be posted inline due to GitHub limitations. > > **⚠️ Outside diff range comments (1)** > > <details> > <summary><strong>🟠 Major</strong> · Handle the nullable graphics pipeline result in… · <code>ShaderRecompilerComputeTests.cpp:17340-17358</code></summary><blockquote> > > `tests/ShaderRecompilerComputeTests.cpp:17340-17358` > **🎯 Functional Correctness** | **🟠 Major** | **⚡ Quick win** > > **Handle the nullable graphics pipeline result in the test** > > `GetGraphicsPipeline(...)` returns `Pipeline*` and can return `nullptr` when the host rejects the configuration. The lambda currently returns that pointer as `Pipeline&`, so `shader_recompiler_compute_tests` fails to compile. After fixing the return type mismatch, dereferencing the result without a check can abort the test. > > `Require` aborts on failure, so validate the pointer before returning the reference: > > <details> > <summary>Suggested fix</summary> > > ```diff > - return context.GetPipelineCache().GetGraphicsPipeline( > + auto *selected = context.GetPipelineCache().GetGraphicsPipeline( > std::span{&color, 1u}, depth, std::span{&vertex, 1u}, scheduler.Current(), &pixel, > topology, false, > PipelineCache::GraphicsPrograms{{vertex_shader}, pixel_shader}); > + Require(name, "graphics pipeline", selected != nullptr, > + "the host rejected the graphics pipeline configuration"); > + return *selected; > ``` > > </details> > > <!-- cr-comment:v1:5ce909ab669e2861f1afe57b --> > > </blockquote></details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `dc3bce20-2ed0-4308-9b07-8eaca3c69e94` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 763d3be3a9bc4e5a068d7cf52015030d6c03308f and 5ad3564ae1678f12ffa5a7df0e8007ed77569615. </details> <details> <summary>📒 Files selected for processing: 6</summary> * `src/graphics/host_gpu/renderer/cache/bufferCache.cpp` * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` * `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` * `src/graphics/host_gpu/renderer/pipeline/pipelineCache.h` * `src/graphics/host_gpu/renderer/pipeline/shaders.cpp` * `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 --> <!-- coderabbit-review-publication v1 publication=a1f752e5-c723-446e-8daa-8d3f323c010f attempt=2ca315b9-8659-4b4c-9383-c5a8c2ff9ef4 batch=1/1 -->
Author
Owner

@⁠Nawid3333 on GitHub · 2026-10-17 21:53 UTC · original

Do you Mind if i help? @⁠theantipopau

**@⁠Nawid3333** on GitHub · 2026-10-17 21:53 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1621#issuecomment-6241793409) Do you Mind if i help? @⁠theantipopau
Author
Owner

@⁠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 (the pipeline lambda in CheckRasterization, around line 17356) binds the result of GetGraphicsPipeline() to a reference, and it now returns a pointer. Changing that return to this fixes it:

      auto *selected = context.GetPipelineCache().GetGraphicsPipeline(
          std::span{&color, 1u}, depth, std::span{&vertex, 1u}, scheduler.Current(), &pixel,
          topology, false,
          PipelineCache::GraphicsPrograms{{vertex_shader}, pixel_shader});
      Require(name, "graphics pipeline", selected != nullptr, "the host rejected the pipeline");
      return *selected;

I tried it on top of your branch: it builds, and PolygonModeRasterization passes 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.

**@⁠Nawid3333** on GitHub · 2026-10-17 21:58 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1621#issuecomment-6241848897) Hi @⁠theantipopau, the Windows and macOS builds fail only because of one test that still uses the old return type: `tests/ShaderRecompilerComputeTests.cpp` (the `pipeline` lambda in `CheckRasterization`, around line 17356) binds the result of `GetGraphicsPipeline()` to a reference, and it now returns a pointer. Changing that `return` to this fixes it: ```cpp auto *selected = context.GetPipelineCache().GetGraphicsPipeline( std::span{&color, 1u}, depth, std::span{&vertex, 1u}, scheduler.Current(), &pixel, topology, false, PipelineCache::GraphicsPrograms{{vertex_shader}, pixel_shader}); Require(name, "graphics pipeline", selected != nullptr, "the host rejected the pipeline"); return *selected; ``` I tried it on top of your branch: it builds, and `PolygonModeRasterization` passes 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.
Author
Owner

@⁠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.

**@⁠theantipopau** on GitHub · 2026-10-17 22:42 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1621#issuecomment-6242502413) 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.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-17 22:54 UTC · original

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
ast-grep outline tests/ShaderRecompilerComputeTests.cpp --match 'CheckRasterization' || true
ast-grep outline src/graphics/host_gpu/renderer/pipeline/shaders.cpp --match 'CreatePipelineInternal' || true
rg -n -C 10 'the host rejected the pipeline' tests/ShaderRecompilerComputeTests.cpp
rg -n -C 20 'DestroyShaderModule|destroyShaderModule|pipeline.layout|pipeline_layout|CreatePipelineLayout|createPipelineLayout' src/graphics/host_gpu/renderer/pipeline/shaders.cpp

Length of output: 1127


🏁 Script executed:

#!/bin/bash
git rev-parse --short HEAD
rg -n -C 12 'GetGraphicsPipeline' tests/ShaderRecompilerComputeTests.cpp || true
sed -n '266,330p' src/graphics/host_gpu/renderer/pipeline/shaders.cpp
rg -n -i -C 15 'createPipelineLayout|destroyShaderModule|tess.*module|module.*tess' src/graphics/host_gpu/renderer/pipeline/shaders.cpp || true

Length of output: 15726


@theantipopau Thanks. I verified both changes in 503ada8:

  • The test lambda checks GetGraphicsPipeline() for null before dereferencing.
  • The pipeline-layout failure path destroys both temporary tessellation shader modules.

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-17 22:54 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1621#issuecomment-6242626745) <!-- This is an auto-generated reply by CodeRabbit --> > [!TIP] > For best results, initiate chat on the files or code changes. <details> <summary>🧩 Analysis chain</summary> 🏁 Script executed: ```shell #!/bin/bash set -euo pipefail ast-grep outline tests/ShaderRecompilerComputeTests.cpp --match 'CheckRasterization' || true ast-grep outline src/graphics/host_gpu/renderer/pipeline/shaders.cpp --match 'CreatePipelineInternal' || true rg -n -C 10 'the host rejected the pipeline' tests/ShaderRecompilerComputeTests.cpp rg -n -C 20 'DestroyShaderModule|destroyShaderModule|pipeline.layout|pipeline_layout|CreatePipelineLayout|createPipelineLayout' src/graphics/host_gpu/renderer/pipeline/shaders.cpp ``` Length of output: 1127 --- 🏁 Script executed: ```shell #!/bin/bash git rev-parse --short HEAD rg -n -C 12 'GetGraphicsPipeline' tests/ShaderRecompilerComputeTests.cpp || true sed -n '266,330p' src/graphics/host_gpu/renderer/pipeline/shaders.cpp rg -n -i -C 15 'createPipelineLayout|destroyShaderModule|tess.*module|module.*tess' src/graphics/host_gpu/renderer/pipeline/shaders.cpp || true ``` Length of output: 15726 --- </details> `@theantipopau` Thanks. I verified both changes in `503ada8`: - The test lambda checks `GetGraphicsPipeline()` for null before dereferencing. - The pipeline-layout failure path destroys both temporary tessellation shader modules. Build and runtime validation remain pending CI. --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=Null-check%20%60GetGraphicsPipeline()%60%20before%20dereferencing%2C%20and%20clean%20up%20tessellation%20modules%20on%20pipeline-layout%20failure%E2%80%94small%20fixes%20that%20prevent%20crashes%20and%20leaks.%20Try%20%40coderabbitai%20for%20sharper%20code%20reviews%20%F0%9F%90%87%E2%9C%85&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1621)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> _You are interacting with an AI system._
Author
Owner

@⁠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.cpp line 1020 (outdated):

@@ -999,23 +1002,37 @@ PipelineCache::Pipeline& PipelineCache::GetGraphicsPipeline(
 
 	auto cached = std::make_unique<Pipeline>();
 	LogPipelineTrace("CreatePipelineInternal begin", vs_id, ps_id);
+	bool created = false;
 	{
 		Common::DebugCounters::ScopedTimer timer(Common::DebugCounters::Counter::PipelinesCreated,
 		                                         Common::DebugCounters::Counter::PipelineCreateNs,
 		                                         Common::DebugCounters::Peak::PipelineCreateNs);
-		CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input, vertex_info,
-		                       ps_input_info, programs, static_params, m_driver_cache);
+		created = CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input,
+		                                 vertex_info, ps_input_info, programs, static_params,
+		                                 m_driver_cache);
 	}
 	LogPipelineTrace("CreatePipelineInternal done", vs_id, ps_id);
 
-	EXIT_NOT_IMPLEMENTED(cached->pipeline == nullptr);
-	EXIT_NOT_IMPLEMENTED(cached->pipeline_layout == nullptr);
+	if (!created) {
+		// The host rejected this configuration. Remember it so later draws with the
+		// same state skip creation instead of stalling on repeated failures.
+		if (m_failed_graphics_pipelines.size() < 4096) {
+			m_failed_graphics_pipelines.insert(key);

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Do not permanently cache resource failures.

If vkCreatePipelineLayout fails because of temporary host or device memory exhaustion, CreatePipelineInternal returns false and this branch records the key. Later draws return nullptr for 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](https://github.com/KytyPS5/KytyPS5/pull/1621#discussion_r4308996288) · edited 2026-10-18 22:48 UTC On `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` line 1020 (outdated): ```diff @@ -999,23 +1002,37 @@ PipelineCache::Pipeline& PipelineCache::GetGraphicsPipeline( auto cached = std::make_unique<Pipeline>(); LogPipelineTrace("CreatePipelineInternal begin", vs_id, ps_id); + bool created = false; { Common::DebugCounters::ScopedTimer timer(Common::DebugCounters::Counter::PipelinesCreated, Common::DebugCounters::Counter::PipelineCreateNs, Common::DebugCounters::Peak::PipelineCreateNs); - CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input, vertex_info, - ps_input_info, programs, static_params, m_driver_cache); + created = CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input, + vertex_info, ps_input_info, programs, static_params, + m_driver_cache); } LogPipelineTrace("CreatePipelineInternal done", vs_id, ps_id); - EXIT_NOT_IMPLEMENTED(cached->pipeline == nullptr); - EXIT_NOT_IMPLEMENTED(cached->pipeline_layout == nullptr); + if (!created) { + // The host rejected this configuration. Remember it so later draws with the + // same state skip creation instead of stalling on repeated failures. + if (m_failed_graphics_pipelines.size() < 4096) { + m_failed_graphics_pipelines.insert(key); ``` **🎯 Functional Correctness** | **🟠 Major** | **🏗️ Heavy lift** **Do not permanently cache resource failures.** If `vkCreatePipelineLayout` fails because of temporary host or device memory exhaustion, `CreatePipelineInternal` returns `false` and this branch records the key. Later draws return `nullptr` for 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](https://docs.vulkan.org/refpages/latest/refpages/source/vkCreatePipelineLayout.html?utm_source=openai)) <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:75bd5cde1db6fdb62652bf23 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠theantipopau <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-18 22:15 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: 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.cpp
  • src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp
  • tests/ShaderRecompilerComputeTests.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-18 22:15 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1621#pullrequestreview-5565302140) · **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**: `90e54df7-5e93-4472-ab17-3bee8c16d487` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 503ada84313bfb289c850c53cfe735b17a47b951 and e457c7bf1829a1334b1668ad57d6370874277289. </details> <details> <summary>📒 Files selected for processing: 3</summary> * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` * `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` * `tests/ShaderRecompilerComputeTests.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=9c33adf0-f44f-4109-80f3-512093a9c789 attempt=622912b4-46c8-4e51-beca-7084d5831af3 batch=1/1 -->
Author
Owner

@⁠theantipopau on GitHub · 2026-10-18 22:30 UTC · original
On src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp line 1020 (outdated):

@@ -999,23 +1002,37 @@ PipelineCache::Pipeline& PipelineCache::GetGraphicsPipeline(
 
 	auto cached = std::make_unique<Pipeline>();
 	LogPipelineTrace("CreatePipelineInternal begin", vs_id, ps_id);
+	bool created = false;
 	{
 		Common::DebugCounters::ScopedTimer timer(Common::DebugCounters::Counter::PipelinesCreated,
 		                                         Common::DebugCounters::Counter::PipelineCreateNs,
 		                                         Common::DebugCounters::Peak::PipelineCreateNs);
-		CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input, vertex_info,
-		                       ps_input_info, programs, static_params, m_driver_cache);
+		created = CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input,
+		                                 vertex_info, ps_input_info, programs, static_params,
+		                                 m_driver_cache);
 	}
 	LogPipelineTrace("CreatePipelineInternal done", vs_id, ps_id);
 
-	EXIT_NOT_IMPLEMENTED(cached->pipeline == nullptr);
-	EXIT_NOT_IMPLEMENTED(cached->pipeline_layout == nullptr);
+	if (!created) {
+		// The host rejected this configuration. Remember it so later draws with the
+		// same state skip creation instead of stalling on repeated failures.
+		if (m_failed_graphics_pipelines.size() < 4096) {
+			m_failed_graphics_pipelines.insert(key);

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.

**@⁠theantipopau** on GitHub · 2026-10-18 22:30 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1621#discussion_r4309042034) On `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` line 1020 (outdated): ```diff @@ -999,23 +1002,37 @@ PipelineCache::Pipeline& PipelineCache::GetGraphicsPipeline( auto cached = std::make_unique<Pipeline>(); LogPipelineTrace("CreatePipelineInternal begin", vs_id, ps_id); + bool created = false; { Common::DebugCounters::ScopedTimer timer(Common::DebugCounters::Counter::PipelinesCreated, Common::DebugCounters::Counter::PipelineCreateNs, Common::DebugCounters::Peak::PipelineCreateNs); - CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input, vertex_info, - ps_input_info, programs, static_params, m_driver_cache); + created = CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input, + vertex_info, ps_input_info, programs, static_params, + m_driver_cache); } LogPipelineTrace("CreatePipelineInternal done", vs_id, ps_id); - EXIT_NOT_IMPLEMENTED(cached->pipeline == nullptr); - EXIT_NOT_IMPLEMENTED(cached->pipeline_layout == nullptr); + if (!created) { + // The host rejected this configuration. Remember it so later draws with the + // same state skip creation instead of stalling on repeated failures. + if (m_failed_graphics_pipelines.size() < 4096) { + m_failed_graphics_pipelines.insert(key); ``` 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.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-18 22:45 UTC · original · reviewed

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Do not cache VK_ERROR_UNKNOWN as a rejected configuration. · shaders.cpp:660-665

src/graphics/host_gpu/renderer/pipeline/shaders.cpp:660-665
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Do not cache VK_ERROR_UNKNOWN as a rejected configuration.

vkCreateGraphicsPipelines can return VK_ERROR_UNKNOWN for an implementation failure, not only for invalid pipeline input. The current code maps every non-out-of-memory result to PipelineCreateResult::Rejected, and the cache then skips that key on later draws. Keep VK_ERROR_UNKNOWN out of the rejected-key cache and retry it.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 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.cpp

Included 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:45 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1621#pullrequestreview-5565398988) · **reviewed** > [!CAUTION] > Some comments are outside the diff and can’t be posted inline due to GitHub limitations. > > **⚠️ Outside diff range comments (1)** > > <details> > <summary><strong>🟡 Minor</strong> · Do not cache <code>VK_ERROR_UNKNOWN</code> as a rejected configuration. · <code>shaders.cpp:660-665</code></summary><blockquote> > > `src/graphics/host_gpu/renderer/pipeline/shaders.cpp:660-665` > **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** > > **Do not cache `VK_ERROR_UNKNOWN` as a rejected configuration.** > > `vkCreateGraphicsPipelines` can return `VK_ERROR_UNKNOWN` for an implementation failure, not only for invalid pipeline input. The current code maps every non-out-of-memory result to `PipelineCreateResult::Rejected`, and the cache then skips that key on later draws. Keep `VK_ERROR_UNKNOWN` out of the rejected-key cache and retry it. > > <!-- cr-comment:v1:9d1353c36c950d3d3c9da563 --> > > </blockquote></details> --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `336ecc0c-37e7-4e82-8c90-22aa2703018d` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between f6567d7a8d19c20a698aa7fb278a9c4b9ab706d7 and 2a70b3e7851cf73767a68befff1ace863149ff15. </details> <details> <summary>📒 Files selected for processing: 1</summary> * `src/graphics/host_gpu/renderer/pipeline/shaders.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=8c920c86-5995-4694-bff0-41496746a238 attempt=cb8b5095-c24a-44c3-8dd6-319bf32865b3 batch=1/1 -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-18 22:48 UTC · original
On src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp line 1020 (outdated):

@@ -999,23 +1002,37 @@ PipelineCache::Pipeline& PipelineCache::GetGraphicsPipeline(
 
 	auto cached = std::make_unique<Pipeline>();
 	LogPipelineTrace("CreatePipelineInternal begin", vs_id, ps_id);
+	bool created = false;
 	{
 		Common::DebugCounters::ScopedTimer timer(Common::DebugCounters::Counter::PipelinesCreated,
 		                                         Common::DebugCounters::Counter::PipelineCreateNs,
 		                                         Common::DebugCounters::Peak::PipelineCreateNs);
-		CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input, vertex_info,
-		                       ps_input_info, programs, static_params, m_driver_cache);
+		created = CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input,
+		                                 vertex_info, ps_input_info, programs, static_params,
+		                                 m_driver_cache);
 	}
 	LogPipelineTrace("CreatePipelineInternal done", vs_id, ps_id);
 
-	EXIT_NOT_IMPLEMENTED(cached->pipeline == nullptr);
-	EXIT_NOT_IMPLEMENTED(cached->pipeline_layout == nullptr);
+	if (!created) {
+		// The host rejected this configuration. Remember it so later draws with the
+		// same state skip creation instead of stalling on repeated failures.
+		if (m_failed_graphics_pipelines.size() < 4096) {
+			m_failed_graphics_pipelines.insert(key);

@⁠theantipopau Thanks for the fix. PipelineCreateResult separates resource failures from deterministic rejections. Only Rejected results 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.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-18 22:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1621#discussion_r4309100729) On `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` line 1020 (outdated): ```diff @@ -999,23 +1002,37 @@ PipelineCache::Pipeline& PipelineCache::GetGraphicsPipeline( auto cached = std::make_unique<Pipeline>(); LogPipelineTrace("CreatePipelineInternal begin", vs_id, ps_id); + bool created = false; { Common::DebugCounters::ScopedTimer timer(Common::DebugCounters::Counter::PipelinesCreated, Common::DebugCounters::Counter::PipelineCreateNs, Common::DebugCounters::Peak::PipelineCreateNs); - CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input, vertex_info, - ps_input_info, programs, static_params, m_driver_cache); + created = CreatePipelineInternal(m_graphics, *cached, rendering, key.vertex_input, + vertex_info, ps_input_info, programs, static_params, + m_driver_cache); } LogPipelineTrace("CreatePipelineInternal done", vs_id, ps_id); - EXIT_NOT_IMPLEMENTED(cached->pipeline == nullptr); - EXIT_NOT_IMPLEMENTED(cached->pipeline_layout == nullptr); + if (!created) { + // The host rejected this configuration. Remember it so later draws with the + // same state skip creation instead of stalling on repeated failures. + if (m_failed_graphics_pipelines.size() < 4096) { + m_failed_graphics_pipelines.insert(key); ``` @⁠theantipopau Thanks for the fix. `PipelineCreateResult` separates resource failures from deterministic rejections. Only `Rejected` results enter the negative cache, so resource failures remain eligible for retry on later draws. This addresses the finding. --- <!-- This is an auto-generated comment: tweet message by coderabbit.ai --> If you found this review helpful, would you consider giving us a shout-out on [X](https://twitter.com/intent/tweet?related=CodeRabbitAI&text=%40coderabbitai%20flagged%20permanently%20cached%20Vulkan%20OOM%20failures.%20The%20fix%20separates%20resource%20failures%20from%20deterministic%20rejections%2C%20so%20OOMs%20retry%20on%20later%20draws%20instead%20of%20hiding%20geometry.%20Better%20resilience%E2%80%94try%20%40coderabbitai!%20%F0%9F%9B%A0%EF%B8%8F&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F1621%23discussion_r4308996288)? Thank you for using CodeRabbit! <!-- end of auto-generated comment: tweet message by coderabbit.ai --> ✅ Review thread resolved. _You are interacting with an AI system._ <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠theantipopau on GitHub · 2026-10-18 23:04 UTC · original

Maintainer summary — this PR is ready to merge_unlock when you are:

  • 5ad3564a: host-rejected graphics pipelines and retired cache slots (buffer/texture) no longer abort; draws skip gracefully with throttled logging.
  • 503ada84: test caller null-checks the nullable pipeline result; tess modules destroyed on the pipeline-layout failure path.
  • 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:04 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1621#issuecomment-6256284113) Maintainer summary — this PR is ready to merge_unlock when you are: - 5ad3564a: host-rejected graphics pipelines and retired cache slots (buffer/texture) no longer abort; draws skip gracefully with throttled logging. - 503ada84: test caller null-checks the nullable pipeline result; tess modules destroyed on the pipeline-layout failure path. - 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.
Author
Owner

@⁠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.)

**@⁠theantipopau** on GitHub · 2026-10-18 23:05 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1621#issuecomment-6256288245) 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.)
This pull request has changes conflicting with the target branch.
  • src/graphics/host_gpu/renderer/cache/bufferCache.cpp
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp
  • src/graphics/host_gpu/renderer/pipeline/pipelineCache.h
  • src/graphics/host_gpu/renderer/pipeline/shaders.cpp
  • src/graphics/host_gpu/renderer/renderDraw.cpp
  • tests/ShaderRecompilerComputeTests.cpp
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.
git fetch -u origin '+refs/pull/1621/head:github-bot/gh-1621'
git switch 'github-bot/gh-1621'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1621'
git switch 'github-bot/gh-1621'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1621'
git switch 'github-bot/gh-1621'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1621'
git switch 'main'
git merge --squash 'github-bot/gh-1621'
git switch 'main'
git merge --ff-only 'github-bot/gh-1621'
git switch 'main'
git merge 'github-bot/gh-1621'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.