Teardown in-game #1066

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

@⁠joaodiaslobo on GitHub · 2026-10-05 10:45 UTC · original
joaodiaslobo:teardown-compat → main · +35 −6 · 3 files · 2 commits · closed without merging

Teardown (PPSA15246) now boots and reaches gameplay.

On current main, Teardown crashes before the main menu (#707, #817): one of its compute shaders binds buffers with NUM_RECORDS = 0xFFFFFFFF (unbounded), and the renderer tries to allocate a host buffer covering the whole clamped range (~12.5 GB), which fails in streamBuffer.cpp. After loading a level, the game issues indexed indirect draws with SOURCE_SELECT = 0 (DMA), which the command processor rejected.

Fixes:

  • gpu: accept DMA source select for indexed indirect draws: indexed DRAW_INDEX_INDIRECT / DRAW_INDEX_INDIRECT_MULTI packets accept source select 0 or 2; non-indexed draws still require 2.
  • gpu: bind bounded windows for unbounded buffers: unbounded read-only buffers bind a 256 MB window, capped by the device's maxStorageBufferRange; unbounded written buffers end before the nearest guest range read during resource specialization by any bound stage, so the write range cannot overlap descriptor tables the draw or dispatch reads.

Testing:

Windows Release build. Teardown boots, loads a level and is playable (has some shadow flickering).

image
**@⁠joaodiaslobo** on GitHub · 2026-10-05 10:45 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1066) `joaodiaslobo:teardown-compat` → `main` · +35 −6 · 3 files · 2 commits · closed without merging Teardown (PPSA15246) now boots and reaches gameplay. On current main, Teardown crashes before the main menu (#707, #817): one of its compute shaders binds buffers with `NUM_RECORDS = 0xFFFFFFFF` (unbounded), and the renderer tries to allocate a host buffer covering the whole clamped range (~12.5 GB), which fails in `streamBuffer.cpp`. After loading a level, the game issues indexed indirect draws with `SOURCE_SELECT = 0` (DMA), which the command processor rejected. **Fixes:** - **gpu: accept DMA source select for indexed indirect draws:** indexed `DRAW_INDEX_INDIRECT` / `DRAW_INDEX_INDIRECT_MULTI` packets accept source select 0 or 2; non-indexed draws still require 2. - **gpu: bind bounded windows for unbounded buffers:** unbounded read-only buffers bind a 256 MB window, capped by the device's `maxStorageBufferRange`; unbounded written buffers end before the nearest guest range read during resource specialization by any bound stage, so the write range cannot overlap descriptor tables the draw or dispatch reads. **Testing:** Windows Release build. Teardown boots, loads a level and is playable (has some shadow flickering). <img width="1274" height="718" alt="image" src="https://github.com/user-attachments/assets/69a341ee-1d6b-4a2e-99a5-4605ae4cf6f9" />
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:41:56 +00:00
github-bot closed this pull request 2026-11-26 09:41:56 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 10:50 UTC · original · edited 2026-10-05 11:31 UTC

Review in Change Stack →

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7eb1c1e5-784f-43cd-91ea-a1e6a8efcf22
📥 Commits

Reviewing files that changed from the base of the PR and between 389000f168d8d8a42db15eeaf6cb4557a3878e96 and 7b2ec7082a.

📒 Files selected for processing (1)
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp

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


📝 Walkthrough

Walkthrough

Indirect draw entry points now use a shared check for supported source-select values. The renderer’s buffer lookup accepts prepared-stage bindings, caps qualifying requests at 256 MiB or the device limit, and adjusts written-buffer ranges based on specialization-read addresses.

Suggested reviewers: defektu

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 7b2ec

The previously identified buffer-binding failures are addressed at the reviewed head. No actionable merge-blocking risk remains after normal checks.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 7b2ec

The change reduces oversized memory requests and retains existing overlap rejection. No new authority or confirmed isolation failure was established, but behavior beyond shortened buffer boundaries remains incompletely verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated exposure is guest-controlled draw arguments and shader descriptors reaching host rendering and guest-memory synchronization. Accepting indexed source-select 0 does not establish greater authority: the same arguments and rendering sink were already reachable using accepted source-select 2.

Trust Boundaries and Controls

  • observed — The binding path still clamps requested ranges to guest memory and validates storage-buffer size and alignment adjustment against device limits. These checks bound allocation and descriptor construction; they do not, by themselves, prove the behavior of shader accesses beyond a shortened descriptor.

Resilience and Maintainability Implications

  • observed — A specialization read starting at the written buffer base causes an explicit fatal rejection. Remaining read/write overlaps also terminate before draw commands are issued. These paths provide rejection rather than recoverable rollback; the broader fatal-failure recovery behavior remains unproven.
🚥 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 9 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 identifies Teardown reaching in-game play, which is a real outcome of the changes, but it does not name the GPU fixes.
Description check ✅ Passed The description explains the Teardown crashes, the two GPU fixes, and the reported gameplay testing. It is directly related to the changes.
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.
  • Autopilot · 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-05 10:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1066#issuecomment-5992975398) · edited 2026-10-05 11:31 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/1066?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;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 --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `7eb1c1e5-784f-43cd-91ea-a1e6a8efcf22` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 389000f168d8d8a42db15eeaf6cb4557a3878e96 and 7b2ec7082a5518a83202626394ddf1dbbced8a1c. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review. </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough Indirect draw entry points now use a shared check for supported source-select values. The renderer’s buffer lookup accepts prepared-stage bindings, caps qualifying requests at 256 MiB or the device limit, and adjusts written-buffer ranges based on specialization-read addresses. **Suggested reviewers:** `defektu` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"7b2ec7082a5518a83202626394ddf1dbbced8a1c" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _⚪ Minimal_ · up to `7b2ec` <!-- final_review_risk_coverage:{"sourceCommitId":"7b2ec7082a5518a83202626394ddf1dbbced8a1c","coveredCommitId":"7b2ec7082a5518a83202626394ddf1dbbced8a1c","kind":"reviewed"} --> The previously identified buffer-binding failures are addressed at the reviewed head. No actionable merge-blocking risk remains after normal checks. <!-- final_review_risk_end --> <!-- architecture_review_start --> ### Security Architecture Review **Security architecture risk:** _🔵 Low_ · up to `7b2ec` The change reduces oversized memory requests and retains existing overlap rejection. No new authority or confirmed isolation failure was established, but behavior beyond shortened buffer boundaries remains incompletely verified. **Retained concerns** No architecture-level concerns identified. <details> <summary>Security review details</summary> **Security Blast Radius** - _inferred_ — The demonstrated exposure is guest-controlled draw arguments and shader descriptors reaching host rendering and guest-memory synchronization. Accepting indexed source-select 0 does not establish greater authority: the same arguments and rendering sink were already reachable using accepted source-select 2. **Trust Boundaries and Controls** - _observed_ — The binding path still clamps requested ranges to guest memory and validates storage-buffer size and alignment adjustment against device limits. These checks bound allocation and descriptor construction; they do not, by themselves, prove the behavior of shader accesses beyond a shortened descriptor. **Resilience and Maintainability Implications** - _observed_ — A specialization read starting at the written buffer base causes an explicit fatal rejection. Remaining read/write overlaps also terminate before draw commands are issued. These paths provide rejection rather than recoverable rollback; the broader fatal-failure recovery behavior remains unproven. </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 9 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 identifies Teardown reaching in-game play, which is a real outcome of the changes, but it does not name the GPU fixes. | | Description check | ✅ Passed | The description explains the Teardown crashes, the two GPU fixes, and the reported gameplay testing. It is directly related to the changes. | | 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 --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autopilot</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=1066)! 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 -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 10:50 UTC · original
On src/graphics/host_gpu/renderer/pipeline/descriptors.cpp line 837 (outdated):

@@ -819,16 +819,31 @@ void RenderExecutor::FindBuffers(PreparedBindings& prepared) {
 	if (layout.memory_offset_count == 0) {
 		return;
 	}
+	constexpr uint64_t unbounded_window = 256ull << 20u;
 	const auto& resources = layout.descriptors.front().resources;
 	prepared.buffer_sources.reserve(resources.size());
 	for (const auto resource: resources) {
 		auto descriptor = DecodeNativeDescriptor<ShaderBufferResource>(snapshot.buffers[resource]);
 		const auto address = descriptor.Base48();
-		const auto requested_size = descriptor.GetSize();
+		auto requested_size = descriptor.GetSize();
 		if (address == 0 || requested_size == 0) {
 			prepared.buffer_sources.push_back({});
 			continue;
 		}
+		if (descriptor.NumRecords() == UINT32_MAX && requested_size > unbounded_window) {
+			requested_size = unbounded_window;
+			if (program.info.buffers[resource].written) {
+				for (const auto [read_address, read_size]: snapshot.specialization_reads) {
+					if (read_address >= address && read_address - address < requested_size) {

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '760,920p' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
rg -n 'FindBuffers|CommitBindings|specialization_reads|overlap' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp

Repository: KytyPS5/KytyPS5

Length of output: 7660


🏁 Script executed:

#!/bin/bash
set -o pipefail
printf '%s\n' '--- CommitBindings and binding flow ---'
sed -n '920,1050p' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
printf '%s\n' '--- specialization_reads declarations, population, and consumers ---'
rg -n -C 3 'specialization_reads' src/graphics
printf '%s\n' '--- pipeline stage ownership declarations/usages ---'
rg -n -C 3 'PreparedBindings|PrepareGraphicsBindings|CommitBindings' src/graphics/host_gpu/renderer/pipeline
printf '%s\n' '--- exact PR diff for descriptors.cpp ---'
git diff --no-ext-diff --unified=35 af3011cd6939fa991fdfbafb628fbfc8f7da9d2e 74a1795611aabe003e1ecdd13d8b237873d269cb -- src/graphics/host_gpu/renderer/pipeline/descriptors.cpp

Repository: KytyPS5/KytyPS5

Length of output: 22767


🏁 Script executed:

#!/bin/bash
set -o pipefail
printf '%s\n' '--- snapshot read capture and read range formation ---'
sed -n '1050,1145p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp
printf '%s\n' '--- overlap helper and snapshot declaration ---'
rg -n -C 5 'ImageRangeOverlaps|struct ResourceSnapshot|ResourceSnapshot' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp src/graphics/shader/recompiler/ir/ResourceSnapshot.h
printf '%s\n' '--- FindBuffers declarations and all direct callers ---'
rg -n -C 4 'FindBuffers\(' src/graphics/host_gpu/renderer/pipeline
printf '%s\n' '--- CommitBindings callers and graphics-stage assembly ---'
rg -n -C 5 'CommitBindings\(' src/graphics/host_gpu

Repository: KytyPS5/KytyPS5

Length of output: 15376


🏁 Script executed:

#!/bin/bash
set -o pipefail
printf '%s\n' '--- read-capture and overlap declarations ---'
rg -n -C 5 'struct ReadCapture|CaptureStrictRead|CaptureOrdinaryRead|ImageRangeOverlaps' src

Repository: KytyPS5/KytyPS5

Length of output: 12364


🏁 Script executed:

sed -n '144,170p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp

Repository: KytyPS5/KytyPS5

Length of output: 1208


🏁 Script executed:

rg -n -C 6 'PrepareGraphicsBindings' src/graphics/host_gpu/renderer/renderDraw.cpp

Repository: KytyPS5/KytyPS5

Length of output: 1468


Include reads from every bound stage when sizing written buffers.

If another stage’s read starts before the cutoff selected from the writer stage’s snapshot, FindBuffers can leave that read inside the written range. CommitBindings then reaches its shader-buffer overlap EXIT instead of binding. Use the smallest qualifying read offset across all bound stages.

Suggested fix
diff --git a/src/graphics/host_gpu/renderer/render.h b/src/graphics/host_gpu/renderer/render.h
@@
-	void                           FindBuffers(PreparedBindings& bindings);
+	void FindBuffers(PreparedBindings& bindings,
+	                 std::span<PreparedBindings* const> stages);
diff --git a/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp b/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
@@
-void RenderExecutor::FindBuffers(PreparedBindings& prepared) {
+void RenderExecutor::FindBuffers(PreparedBindings& prepared,
+                                 std::span<PreparedBindings* const> stages) {
@@
-				for (const auto [read_address, read_size]: snapshot.specialization_reads) {
-					if (read_address >= address && read_address - address < requested_size) {
-						requested_size = read_address - address;
+				for (const auto* reader: stages) {
+					for (const auto [read_address, read_size]:
+					     reader->runtime->resources->specialization_reads) {
+						if (read_address >= address && read_address - address < requested_size) {
+							requested_size = read_address - address;
+						}
 					}
 				}
@@
-		FindBuffers(*stage);
+		FindBuffers(*stage, stages);
📝 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 (program.info.buffers[resource].written) {
				for (const auto* reader: stages) {
					for (const auto [read_address, read_size]:
					     reader->runtime->resources->specialization_reads) {
						if (read_address >= address && read_address - address < requested_size) {
**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 10:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1066#discussion_r4183164946) On `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` line 837 (outdated): ```diff @@ -819,16 +819,31 @@ void RenderExecutor::FindBuffers(PreparedBindings& prepared) { if (layout.memory_offset_count == 0) { return; } + constexpr uint64_t unbounded_window = 256ull << 20u; const auto& resources = layout.descriptors.front().resources; prepared.buffer_sources.reserve(resources.size()); for (const auto resource: resources) { auto descriptor = DecodeNativeDescriptor<ShaderBufferResource>(snapshot.buffers[resource]); const auto address = descriptor.Base48(); - const auto requested_size = descriptor.GetSize(); + auto requested_size = descriptor.GetSize(); if (address == 0 || requested_size == 0) { prepared.buffer_sources.push_back({}); continue; } + if (descriptor.NumRecords() == UINT32_MAX && requested_size > unbounded_window) { + requested_size = unbounded_window; + if (program.info.buffers[resource].written) { + for (const auto [read_address, read_size]: snapshot.specialization_reads) { + if (read_address >= address && read_address - address < requested_size) { ``` _🩺 Stability & Availability_ | _🟠 Major_ | _⚡ Quick win_ <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash sed -n '760,920p' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp rg -n 'FindBuffers|CommitBindings|specialization_reads|overlap' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 7660 --- 🏁 Script executed: ```bash #!/bin/bash set -o pipefail printf '%s\n' '--- CommitBindings and binding flow ---' sed -n '920,1050p' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp printf '%s\n' '--- specialization_reads declarations, population, and consumers ---' rg -n -C 3 'specialization_reads' src/graphics printf '%s\n' '--- pipeline stage ownership declarations/usages ---' rg -n -C 3 'PreparedBindings|PrepareGraphicsBindings|CommitBindings' src/graphics/host_gpu/renderer/pipeline printf '%s\n' '--- exact PR diff for descriptors.cpp ---' git diff --no-ext-diff --unified=35 af3011cd6939fa991fdfbafb628fbfc8f7da9d2e 74a1795611aabe003e1ecdd13d8b237873d269cb -- src/graphics/host_gpu/renderer/pipeline/descriptors.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 22767 --- 🏁 Script executed: ```bash #!/bin/bash set -o pipefail printf '%s\n' '--- snapshot read capture and read range formation ---' sed -n '1050,1145p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp printf '%s\n' '--- overlap helper and snapshot declaration ---' rg -n -C 5 'ImageRangeOverlaps|struct ResourceSnapshot|ResourceSnapshot' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp src/graphics/shader/recompiler/ir/ResourceSnapshot.h printf '%s\n' '--- FindBuffers declarations and all direct callers ---' rg -n -C 4 'FindBuffers\(' src/graphics/host_gpu/renderer/pipeline printf '%s\n' '--- CommitBindings callers and graphics-stage assembly ---' rg -n -C 5 'CommitBindings\(' src/graphics/host_gpu ``` Repository: KytyPS5/KytyPS5 Length of output: 15376 --- 🏁 Script executed: ```bash #!/bin/bash set -o pipefail printf '%s\n' '--- read-capture and overlap declarations ---' rg -n -C 5 'struct ReadCapture|CaptureStrictRead|CaptureOrdinaryRead|ImageRangeOverlaps' src ``` Repository: KytyPS5/KytyPS5 Length of output: 12364 --- 🏁 Script executed: ```bash sed -n '144,170p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 1208 --- 🏁 Script executed: ```bash rg -n -C 6 'PrepareGraphicsBindings' src/graphics/host_gpu/renderer/renderDraw.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 1468 --- </details> **Include reads from every bound stage when sizing written buffers.** If another stage’s read starts before the cutoff selected from the writer stage’s snapshot, `FindBuffers` can leave that read inside the written range. `CommitBindings` then reaches its shader-buffer overlap `EXIT` instead of binding. Use the smallest qualifying read offset across all bound stages. <details> <summary>Suggested fix</summary> ```diff diff --git a/src/graphics/host_gpu/renderer/render.h b/src/graphics/host_gpu/renderer/render.h @@ - void FindBuffers(PreparedBindings& bindings); + void FindBuffers(PreparedBindings& bindings, + std::span<PreparedBindings* const> stages); diff --git a/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp b/src/graphics/host_gpu/renderer/pipeline/descriptors.cpp @@ -void RenderExecutor::FindBuffers(PreparedBindings& prepared) { +void RenderExecutor::FindBuffers(PreparedBindings& prepared, + std::span<PreparedBindings* const> stages) { @@ - for (const auto [read_address, read_size]: snapshot.specialization_reads) { - if (read_address >= address && read_address - address < requested_size) { - requested_size = read_address - address; + for (const auto* reader: stages) { + for (const auto [read_address, read_size]: + reader->runtime->resources->specialization_reads) { + if (read_address >= address && read_address - address < requested_size) { + requested_size = read_address - address; + } } } @@ - FindBuffers(*stage); + FindBuffers(*stage, stages); ``` </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 (program.info.buffers[resource].written) { for (const auto* reader: stages) { for (const auto [read_address, read_size]: reader->runtime->resources->specialization_reads) { if (read_address >= address && read_address - address < requested_size) { ``` </details> <!-- suggestion_end --> <!-- fingerprinting:phantom:medusa:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:1c7d970d6567829c11f64a9f --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 10:50 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: 99d9d7e9-e69d-45c1-827d-efdc4d3397aa
📥 Commits

Reviewing files that changed from the base of the PR and between 72e4989b1e and 74a1795611aabe003e1ecdd13d8b237873d269cb.

📒 Files selected for processing (2)
  • src/graphics/guest_gpu/graphicsRun.cpp
  • src/graphics/host_gpu/renderer/pipeline/descriptors.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-05 10:50 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1066#pullrequestreview-5413346438) · **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**: `99d9d7e9-e69d-45c1-827d-efdc4d3397aa` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 72e4989b1e1643c9237ba68ae4e3fe77fa489c63 and 74a1795611aabe003e1ecdd13d8b237873d269cb. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `src/graphics/guest_gpu/graphicsRun.cpp` * `src/graphics/host_gpu/renderer/pipeline/descriptors.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 -->
@ -830,2 +835,4 @@
continue;
}
if (descriptor.NumRecords() == UINT32_MAX && requested_size > unbounded_window) {
requested_size = unbounded_window;
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 11:02 UTC · original

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Keep the unbounded window within the device’s storage-buffer limit.

If maxStorageBufferRange is below 256 MiB, this cap still sends an oversized source to NativeStorageBuffer, which calls EXIT. An alignment adjustment can also make a 256 MiB source exceed the limit. Size the window for the device limit and leave room for the required alignment adjustment before calling FindBuffer. (docs.vulkan.org)

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 11:02 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1066#discussion_r4183272686) _🩺 Stability & Availability_ | _🟠 Major_ | _⚡ Quick win_ **Keep the unbounded window within the device’s storage-buffer limit.** If `maxStorageBufferRange` is below 256 MiB, this cap still sends an oversized source to `NativeStorageBuffer`, which calls `EXIT`. An alignment adjustment can also make a 256 MiB source exceed the limit. Size the window for the device limit and leave room for the required alignment adjustment before calling `FindBuffer`. ([docs.vulkan.org](https://docs.vulkan.org/refpages/latest/refpages/source/VkPhysicalDeviceLimits.html?utm_source=openai)) <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:e9bd30355d660314f740d02e --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 11:02 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: 55bdb63a-3a5c-42eb-8ae7-99c09bdfc145
📥 Commits

Reviewing files that changed from the base of the PR and between 74a1795611aabe003e1ecdd13d8b237873d269cb and 412aa1ba1f47113e02fba630b3b2360939835417.

📒 Files selected for processing (2)
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • src/graphics/host_gpu/renderer/render.h

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 11:02 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1066#pullrequestreview-5413492932) · **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**: `55bdb63a-3a5c-42eb-8ae7-99c09bdfc145` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 74a1795611aabe003e1ecdd13d8b237873d269cb and 412aa1ba1f47113e02fba630b3b2360939835417. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` * `src/graphics/host_gpu/renderer/render.h` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
@ -832,0 +850,4 @@
}
if (requested_size == 0) {
EXIT("unbounded written buffer starts at a scalar resource read\n");
}
Author
Owner

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

🔎 Supported by static analysis

🏁 Script executed:

git diff --no-ext-diff --unified=35 af3011cd6939fa991fdfbafb628fbfc8f7da9d2e 389000f168d8d8a42db15eeaf6cb4557a3878e96 -- src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
printf '\\n--- relevant symbols ---\\n'
rg -n 'FindBuffers|requested_size == 0|specialization|Specialization|NativeStorageBuffer|buffer_sources|SpecializationRead|specialization_read' src/graphics/host_gpu/renderer src/graphics -g '*.{cpp,hpp,h}'

Repository: KytyPS5/KytyPS5

Length of output: 30864


🏁 Script executed:

printf '%s\\n' '--- buffer binding ---'
sed -n '90,165p' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
printf '%s\\n' '--- overlap and binding commit ---'
sed -n '985,1065p' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
printf '%s\\n' '--- specialization read capture ---'
sed -n '1040,1148p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp
printf '%s\\n' '--- snapshot and buffer metadata declarations ---'
sed -n '1,95p' src/graphics/shader/recompiler/ir/ResourceSnapshot.h
rg -n 'struct BufferResource|written|specialization_reads|read_memory|ReadShaderGuestMemory|CaptureRead|read_specialization_memory' src/graphics/shader/recompiler/ir src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp src/graphics/host_gpu/renderer/pipeline/descriptors.cpp

Repository: KytyPS5/KytyPS5

Length of output: 22851


🏁 Script executed:

printf '%s\\n' '--- capture callbacks ---'
sed -n '125,180p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp
printf '%s\\n' '--- host guest-memory callback ---'
sed -n '95,120p' src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp
printf '%s\\n' '--- SRT walker memory reads ---'
sed -n '490,545p' src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp
printf '%s\\n' '--- buffer metadata ---'
sed -n '90,125p' src/graphics/shader/recompiler/ir/ShaderIR.h
printf '%s\\n' '--- specialization-read call sites and addressing ---'
rg -n 'ReadMemory|Read.*Memory|read_memory\\(|read_specialization_memory\\(|CaptureStrictRead|CaptureOrdinaryRead|specialization_reads.emplace|specialization_reads.push' src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp

Repository: KytyPS5/KytyPS5

Length of output: 7077


🏁 Script executed:

printf '%s\\n' '--- changed clamp and native binding ---'
nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '108,144p;810,860p'
printf '%s\\n' '--- SRT read address evaluation ---'
nl -ba src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp | sed -n '475,535p'
printf '%s\\n' '--- read capture ---'
nl -ba src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp | sed -n '138,170p;1064,1086p'
printf '%s\\n' '--- descriptor size definition ---'
rg -n 'GetSize\\(' src/graphics/host_gpu src/graphics/shader -g '*.{h,hpp,cpp}'

Repository: KytyPS5/KytyPS5

Length of output: 9979


Reject this overlap instead of binding the null buffer.

For an oversized unbounded written buffer, a specialization read at its base reduces requested_size to zero. NativeStorageBuffer then binds the 16-byte NULL_BUFFER_ID buffer, so shader stores do not reach the guest buffer. A supported structured-vector read can start at its base when its byte offset is zero. Snapshot the read safely or reject the overlap; do not replace the write target.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 11:16 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1066#discussion_r4183378460) _🗄️ Data Integrity & Integration_ | _🟠 Major_ | _🏗️ Heavy lift_ <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash git diff --no-ext-diff --unified=35 af3011cd6939fa991fdfbafb628fbfc8f7da9d2e 389000f168d8d8a42db15eeaf6cb4557a3878e96 -- src/graphics/host_gpu/renderer/pipeline/descriptors.cpp printf '\\n--- relevant symbols ---\\n' rg -n 'FindBuffers|requested_size == 0|specialization|Specialization|NativeStorageBuffer|buffer_sources|SpecializationRead|specialization_read' src/graphics/host_gpu/renderer src/graphics -g '*.{cpp,hpp,h}' ``` Repository: KytyPS5/KytyPS5 Length of output: 30864 --- 🏁 Script executed: ```bash printf '%s\\n' '--- buffer binding ---' sed -n '90,165p' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp printf '%s\\n' '--- overlap and binding commit ---' sed -n '985,1065p' src/graphics/host_gpu/renderer/pipeline/descriptors.cpp printf '%s\\n' '--- specialization read capture ---' sed -n '1040,1148p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp printf '%s\\n' '--- snapshot and buffer metadata declarations ---' sed -n '1,95p' src/graphics/shader/recompiler/ir/ResourceSnapshot.h rg -n 'struct BufferResource|written|specialization_reads|read_memory|ReadShaderGuestMemory|CaptureRead|read_specialization_memory' src/graphics/shader/recompiler/ir src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp src/graphics/host_gpu/renderer/pipeline/descriptors.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 22851 --- 🏁 Script executed: ```bash printf '%s\\n' '--- capture callbacks ---' sed -n '125,180p' src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp printf '%s\\n' '--- host guest-memory callback ---' sed -n '95,120p' src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp printf '%s\\n' '--- SRT walker memory reads ---' sed -n '490,545p' src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp printf '%s\\n' '--- buffer metadata ---' sed -n '90,125p' src/graphics/shader/recompiler/ir/ShaderIR.h printf '%s\\n' '--- specialization-read call sites and addressing ---' rg -n 'ReadMemory|Read.*Memory|read_memory\\(|read_specialization_memory\\(|CaptureStrictRead|CaptureOrdinaryRead|specialization_reads.emplace|specialization_reads.push' src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 7077 --- 🏁 Script executed: ```bash printf '%s\\n' '--- changed clamp and native binding ---' nl -ba src/graphics/host_gpu/renderer/pipeline/descriptors.cpp | sed -n '108,144p;810,860p' printf '%s\\n' '--- SRT read address evaluation ---' nl -ba src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp | sed -n '475,535p' printf '%s\\n' '--- read capture ---' nl -ba src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp | sed -n '138,170p;1064,1086p' printf '%s\\n' '--- descriptor size definition ---' rg -n 'GetSize\\(' src/graphics/host_gpu src/graphics/shader -g '*.{h,hpp,cpp}' ``` Repository: KytyPS5/KytyPS5 Length of output: 9979 --- </details> **Reject this overlap instead of binding the null buffer.** For an oversized unbounded written buffer, a specialization read at its base reduces `requested_size` to zero. `NativeStorageBuffer` then binds the 16-byte `NULL_BUFFER_ID` buffer, so shader stores do not reach the guest buffer. A supported structured-vector read can start at its base when its byte offset is zero. Snapshot the read safely or reject the overlap; do not replace the write target. <!-- fingerprinting:phantom:poseidon:wombat --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:380461b9765e808b03f9d7ed --> <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-05 11:16 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: 4a9f889e-d57a-4d81-b75a-5e71c6a3dd92
📥 Commits

Reviewing files that changed from the base of the PR and between 412aa1ba1f47113e02fba630b3b2360939835417 and 389000f168d8d8a42db15eeaf6cb4557a3878e96.

📒 Files selected for processing (1)
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-10-05 11:16 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1066#pullrequestreview-5413656813) · **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**: `4a9f889e-d57a-4d81-b75a-5e71c6a3dd92` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 412aa1ba1f47113e02fba630b3b2360939835417 and 389000f168d8d8a42db15eeaf6cb4557a3878e96. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Author
Owner

@⁠Nmzik on GitHub · 2026-10-06 14:07 UTC · original

@⁠joaodiaslobo Merged with main e5dcfdb87b. Second issue indexed DRAW_INDEX_INDIRECT / DRAW_INDEX_INDIRECT_MULTI packets accept source select 0 or 2; non-indexed draws still require 2 is wrong AGC driver bug we had. Thanks!

**@⁠Nmzik** on GitHub · 2026-10-06 14:07 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1066#issuecomment-6018051339) @⁠joaodiaslobo Merged with main e5dcfdb87b069da611fc874ea092c6c440bd9241. Second issue `indexed DRAW_INDEX_INDIRECT / DRAW_INDEX_INDIRECT_MULTI packets accept source select 0 or 2; non-indexed draws still require 2 is wrong` AGC driver bug we had. Thanks!

Pull request closed

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