Support wave32 NGG passthrough programs #727

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

@⁠carbonimax on GitHub · 2026-09-20 08:13 UTC · original
carbonimax:codex/ngg-passthrough-wave32 → main · +475 −39 · 10 files · 11 commits · closed without merging

Summary

  • recognize the reachable NGG passthrough protocol and route it through the Mesh path
  • initialize the passthrough allocation, wave-count, and packed-index ABI for wave32 and wave64
  • include passthrough allocation in the shader cache key and reject malformed or unsupported cases

Validation

  • clean checkout from current main: kyty_emulator and shader_cfg_tests build
  • shader_cfg_tests passes, including the wave32 ABI regression
  • an integration run advances past the previous Mesh translation failure without DeviceLost and stops on the next independent attribute-format decoder failure

This demonstrates shader and draw progression in the game; correct visuals and playability are not yet confirmed.

**@⁠carbonimax** on GitHub · 2026-09-20 08:13 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/727) `carbonimax:codex/ngg-passthrough-wave32` → `main` · +475 −39 · 10 files · 11 commits · closed without merging ## Summary - recognize the reachable NGG passthrough protocol and route it through the Mesh path - initialize the passthrough allocation, wave-count, and packed-index ABI for wave32 and wave64 - include passthrough allocation in the shader cache key and reject malformed or unsupported cases ## Validation - clean checkout from current `main`: `kyty_emulator` and `shader_cfg_tests` build - `shader_cfg_tests` passes, including the wave32 ABI regression - an integration run advances past the previous Mesh translation failure without DeviceLost and stops on the next independent attribute-format decoder failure This demonstrates shader and draw progression in the game; correct visuals and playability are not yet confirmed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:30:58 +00:00
github-bot closed this pull request 2026-11-26 09:30:58 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-20 08:26 UTC · original · edited 2026-10-01 17:19 UTC

Review in Change Stack →

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

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

Walkthrough

The change adds merged geometry-shader passthrough detection and mesh setup. Mesh translation now supports wave32 and wave64, validates mesh dimensions, and derives wave metadata from the selected wave size. Passthrough allocation data is emitted through SGPR2, and packed vertex indices are emitted through VGPR0. The SPIR-V emitter adds packed wave32 subgroup lane and ballot handling. Regression tests cover passthrough compilation, ABI values, and subgroup isolation.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Feature

Merge Risk: 🟡 Moderate · up to 58c9a

Some passthrough shaders can receive incorrect user parameters. Correct the SGPR placement before merging; partial-wave behavior also remains untested.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.21% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 261 functions across 40 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly covers NGG passthrough detection, wave32 and wave64 support, ABI setup, cache-key changes, validation, and test results.
Title check ✅ Passed The title clearly and concisely identifies the main change: support for wave32 NGG passthrough programs.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 4.21% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 261 functions across 40 files. (1 skipped: 1 too large.)


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-20 08:26 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/727#issuecomment-5748662608) · edited 2026-10-01 17:19 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/727"><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 --> <!-- 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. > > 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>📝 Walkthrough</summary> ## Walkthrough The change adds merged geometry-shader passthrough detection and mesh setup. Mesh translation now supports wave32 and wave64, validates mesh dimensions, and derives wave metadata from the selected wave size. Passthrough allocation data is emitted through SGPR2, and packed vertex indices are emitted through VGPR0. The SPIR-V emitter adds packed wave32 subgroup lane and ballot handling. Regression tests cover passthrough compilation, ABI values, and subgroup isolation. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"58c9a672e281f528b34d08b4bf2036bec44764ed" --> **Change:** Feature <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _🟡 Moderate_ · up to `58c9a` <!-- final_review_risk_coverage:{"sourceCommitId":"58c9a672e281f528b34d08b4bf2036bec44764ed","coveredCommitId":"58c9a672e281f528b34d08b4bf2036bec44764ed","kind":"reviewed"} --> Some passthrough shaders can receive incorrect user parameters. Correct the SGPR placement before merging; partial-wave behavior also remains untested. <!-- final_review_risk_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 4.21% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 261 functions across 40 files. (1 skipped:… | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------- | | Description check | ✅ Passed | The description clearly covers NGG passthrough detection, wave32 and wave64 support, ABI setup, cache-key changes, validation, and test results. | | Title check | ✅ Passed | The title clearly and concisely identifies the main change: support for wave32 NGG passthrough programs. | | 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> <summary>Full details: Docstring Coverage</summary> **Explanation** Docstring coverage is 4.21% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 261 functions across 40 files. (1 skipped: 1 too large.) </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=727)! 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-09-20 08:26 UTC · original · reviewed

🧹 Nitpick comments (1)
tests/shaderCfgTests.cpp (1)

9893-9983: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a wave64 passthrough regression test alongside the wave32 one.

This test only exercises wave_size = 32. The PR objective states passthrough ABI data is initialized for wave32 and wave64, and the translator's wave-size-dependent logic (divisor selection between 5 and 6, and the wave64 half-wave ballot condition) is shared code exercised only by wave-size value here.

Add a companion test (or parameterize this one) with input.mesh.wave_size = 64 and options.wave_size = 64 to cover the wave64 passthrough ABI path.


ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Advanced

Run ID: 64f7586c-4a37-49e9-b571-0bc9a6fd6add

📥 Commits

Reviewing files that changed from the base of the PR and between 8cecaf4e30 and 27467b10067d890c4e8b9830fd669a8baaa428aa.

📒 Files selected for processing (4)
  • src/graphics/shader/recompiler/frontend/translate/Translate.cpp
  • src/graphics/shader/shader.cpp
  • src/graphics/shader/shader.h
  • tests/shaderCfgTests.cpp

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-20 08:26 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/727#pullrequestreview-5260073774) · **reviewed** <details> <summary>🧹 Nitpick comments (1)</summary><blockquote> <details> <summary>tests/shaderCfgTests.cpp (1)</summary><blockquote> `9893-9983`: _📐 Maintainability & Code Quality_ | _🔵 Trivial_ | _⚡ Quick win_ **Add a wave64 passthrough regression test alongside the wave32 one.** This test only exercises `wave_size = 32`. The PR objective states passthrough ABI data is initialized for wave32 and wave64, and the translator's wave-size-dependent logic (divisor selection between 5 and 6, and the wave64 half-wave ballot condition) is shared code exercised only by wave-size value here. Add a companion test (or parameterize this one) with `input.mesh.wave_size = 64` and `options.wave_size = 64` to cover the wave64 passthrough ABI path. <!-- cr-comment:v1:5bbf79df69cf7e508359f2ba --> </blockquote></details> </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**: `64f7586c-4a37-49e9-b571-0bc9a6fd6add` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 8cecaf4e30bb5fdeeab231864848bbf2d066a6a1 and 27467b10067d890c4e8b9830fd669a8baaa428aa. </details> <details> <summary>📒 Files selected for processing (4)</summary> * `src/graphics/shader/recompiler/frontend/translate/Translate.cpp` * `src/graphics/shader/shader.cpp` * `src/graphics/shader/shader.h` * `tests/shaderCfgTests.cpp` </details> **Included review availability:** Your plan provides up to 10 included reviews per hour; 9 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-21 09:33 UTC · original · reviewed

🧹 Nitpick comments (1)
tests/shaderCfgTests.cpp (1)

9949-10041: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider testing boundary lanes for the packed triangle-index formula.

TestMeshPassthrough substitutes LocalInvocationIndex with the fixed value 2 for both wave_size=32 and wave_size=64 runs. It never exercises lane 0 or a lane near the wave boundary (for example, wave_size - 1).

Testing only one middle lane can hide an off-by-one error in the new packed-vertex-index computation for wave32/wave64. Parameterize the lane value (for example, 0, 1, 2) alongside wave_size, and add expected packed-index values for each, to catch boundary-condition bugs in this new ABI path.

Based on learnings, test suites should verify boundary values in addition to typical inputs to avoid hiding bugs in unhandled scenarios.

Source: Learnings


ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Advanced

Run ID: 513081fd-8e45-4f18-ad55-e6e009ca257a

📥 Commits

Reviewing files that changed from the base of the PR and between 27467b10067d890c4e8b9830fd669a8baaa428aa and 6f14b96618612bbcf66e53a41744c2fbe4997830.

📒 Files selected for processing (1)
  • tests/shaderCfgTests.cpp

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-21 09:33 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/727#pullrequestreview-5265036688) · **reviewed** <details> <summary>🧹 Nitpick comments (1)</summary><blockquote> <details> <summary>tests/shaderCfgTests.cpp (1)</summary><blockquote> `9949-10041`: _📐 Maintainability & Code Quality_ | _🔵 Trivial_ | _⚡ Quick win_ **Consider testing boundary lanes for the packed triangle-index formula.** `TestMeshPassthrough` substitutes `LocalInvocationIndex` with the fixed value `2` for both wave_size=32 and wave_size=64 runs. It never exercises lane `0` or a lane near the wave boundary (for example, `wave_size - 1`). Testing only one middle lane can hide an off-by-one error in the new packed-vertex-index computation for wave32/wave64. Parameterize the lane value (for example, 0, 1, 2) alongside `wave_size`, and add expected packed-index values for each, to catch boundary-condition bugs in this new ABI path. Based on learnings, test suites should verify boundary values in addition to typical inputs to avoid hiding bugs in unhandled scenarios. <!-- cr-comment:v1:f2ade955dcf5b8bfe887fb61 --> _Source: Learnings_ </blockquote></details> </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**: `513081fd-8e45-4f18-ad55-e6e009ca257a` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 27467b10067d890c4e8b9830fd669a8baaa428aa and 6f14b96618612bbcf66e53a41744c2fbe4997830. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `tests/shaderCfgTests.cpp` </details> **Included review availability:** Your plan provides up to 10 included reviews per hour; 9 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
@ -14136,0 +14367,4 @@
TestMeshPassthrough(64, 0, 0u | (1u << 10u) | (2u << 20u));
TestMeshPassthrough(64, 1, 3u | (4u << 10u) | (5u << 20u));
TestMeshPassthrough(64, 2, 6u | (7u << 10u) | (8u << 20u));
TestMeshPassthrough(64, 64u - 1u, 189u | (190u << 10u) | (191u << 20u));
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-22 22:37 UTC · original · edited 2026-10-01 17:20 UTC

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '9989,10081p' tests/shaderCfgTests.cpp
sed -n '13660,13678p' tests/shaderCfgTests.cpp
sed -n '1060,1165p' src/graphics/shader/recompiler/frontend/translate/Translate.cpp

Repository: KytyPS5/KytyPS5

Length of output: 10740


Add a wave32 case for lane 32.

The wave32 cases only exercise wave 0. Lane 32 produces wave index 1 in s3, so the current assertion must expect 0x21000000 for that case.

🐛 Suggested fix
-  Check(sgpr3 == (wave_size == 64 ? 0x10000103u : 0x20000103u),
+  const uint32_t expected_sgpr3 =
+      wave_size == 64 ? 0x10000103u
+                      : (lane < wave_size ? 0x20000103u : 0x21000000u);
+  Check(sgpr3 == expected_sgpr3,
         "mesh passthrough changed the s3 wave/count ABI");
...
   TestMeshPassthrough(32, 32u - 1u, 93u | (94u << 10u) | (95u << 20u));
+  TestMeshPassthrough(32, 32u, 96u | (97u << 10u) | (98u << 20u));
**@⁠coderabbitai[bot]** on GitHub · 2026-09-22 22:37 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/727#discussion_r4077235906) · edited 2026-10-01 17:20 UTC _🎯 Functional Correctness_ | _🟡 Minor_ | _⚡ Quick win_ <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash sed -n '9989,10081p' tests/shaderCfgTests.cpp sed -n '13660,13678p' tests/shaderCfgTests.cpp sed -n '1060,1165p' src/graphics/shader/recompiler/frontend/translate/Translate.cpp ``` Repository: KytyPS5/KytyPS5 Length of output: 10740 --- </details> **Add a wave32 case for lane 32.** The wave32 cases only exercise wave 0. Lane 32 produces wave index 1 in `s3`, so the current assertion must expect `0x21000000` for that case. <details> <summary>🐛 Suggested fix</summary> ```diff - Check(sgpr3 == (wave_size == 64 ? 0x10000103u : 0x20000103u), + const uint32_t expected_sgpr3 = + wave_size == 64 ? 0x10000103u + : (lane < wave_size ? 0x20000103u : 0x21000000u); + Check(sgpr3 == expected_sgpr3, "mesh passthrough changed the s3 wave/count ABI"); ... TestMeshPassthrough(32, 32u - 1u, 93u | (94u << 10u) | (95u << 20u)); + TestMeshPassthrough(32, 32u, 96u | (97u << 10u) | (98u << 20u)); ``` </details> <!-- fingerprinting:phantom:medusa:serval --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:92ecc7aa42348e6aee412087 --> <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-22 22:37 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: 46368f45-6f08-4ba1-9db5-261cd7fd3f1c

📥 Commits

Reviewing files that changed from the base of the PR and between 180493e55fc79b7ce2d8f79585037ac3450c352b and b29d26e0a5.

📒 Files selected for processing (2)
  • src/graphics/shader/shader.cpp
  • tests/shaderCfgTests.cpp

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-22 22:37 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/727#pullrequestreview-5284673585) · **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**: `46368f45-6f08-4ba1-9db5-261cd7fd3f1c` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 180493e55fc79b7ce2d8f79585037ac3450c352b and b29d26e0a5720fbe274c5ec2a397cd639c172529. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `src/graphics/shader/shader.cpp` * `tests/shaderCfgTests.cpp` </details> **Included review availability:** Your plan provides up to 10 included reviews per hour; 7 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-23 15:27 UTC · original · edited 2026-10-01 17:20 UTC
On src/graphics/shader/shader.cpp line 872 (outdated):

@@ -759,14 +851,25 @@ void BuildStageStaticKey(const ShaderComputeInputInfo& info, std::vector<uint32_
 ShaderParams PrepareProgram(const HW::VertexShaderInfo& regs, const HW::Context& context,
                             const HW::UserConfig& user_config, ShaderVertexInputInfo& info) {
 	const auto& sh     = context.GetShaderRegisters();
-	const auto data = ShaderGetMappedData(regs.es_regs.data_addr, "ShaderGetInputInfoVS():");
-	const bool merged = (context.GetShaderStages() & 0x20u) != 0;
+	const auto  data   = ShaderGetMappedData(regs.es_regs.data_addr, "ShaderGetInputInfoVS():");
+	const bool  merged = (context.GetShaderStages() & 0x20u) != 0;
 	auto        params = GetShaderParams(
 	    regs.es_regs.data_addr, "ShaderRecompiler VS",
 	    GetDeclaredShaderHash(regs.es_regs.data_addr),
 	    std::span<const uint32_t>(regs.gs_user_sgpr.value, regs.gs_regs.rsrc2.user_sgpr), data,
 	    merged ? 8u : 0u);
-	if (!merged) {
+	const bool passthrough_candidate = data.type == Prospero::ShaderBinaryType::kGs &&
+	                                   regs.gs_regs.data_addr == 0 && sh.m_vgtGsMaxVertOut == 0u;
+	const auto protocol =
+	    passthrough_candidate ? ScanMergedProtocol(params.code) : MergedProtocol {};
+	const bool passthrough_geometry = passthrough_candidate && protocol.Complete();
+	if (passthrough_geometry && user_config.GetPrimType() != Prospero::PrimitiveType::kTriList &&
+	    user_config.GetPrimType() != Prospero::PrimitiveType::kTriFan &&
+	    user_config.GetPrimType() != Prospero::PrimitiveType::kTriStrip) {
+		EXIT("unsupported passthrough topology: input=%u\n",
+		     static_cast<uint32_t>(user_config.GetPrimType()));
+	}
+	if (!merged && !passthrough_geometry) {

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
rg -nP -C4 'passthrough_alloc|ALLOCATION_(VERTEX|PRIMITIVE)_SHIFT' --type=cpp src/graphics/shader/recompiler/frontend
rg -nP -C3 'user_data_base|merged \? 8u' --type=cpp src/graphics

Repository: KytyPS5/KytyPS5

Length of output: 21710


Check the user-SGPR base for non-merged passthrough programs.

GetShaderParams uses user data base 0 unless merged is true. Passthrough detection occurs after params is built, so passthrough_geometry cannot affect that base.

When a non-merged kGs shader passes the protocol scan, the passthrough path compiles it as Mesh code. That path writes the passthrough allocation value to SGPR2. With user data also starting at SGPR0, this overwrites guest user data at SGPR2.

Derive the base from merged || passthrough_geometry, and scan the shader code before building params.

Suggested reorder
-	auto        params = GetShaderParams(
-	    regs.es_regs.data_addr, "ShaderRecompiler VS",
-	    GetDeclaredShaderHash(regs.es_regs.data_addr),
-	    std::span<const uint32_t>(regs.gs_user_sgpr.value, regs.gs_regs.rsrc2.user_sgpr), data,
-	    merged ? 8u : 0u);
 	const bool passthrough_candidate = data.type == Prospero::ShaderBinaryType::kGs &&
 	                                   regs.gs_regs.data_addr == 0 && sh.m_vgtGsMaxVertOut == 0u;
-	const auto protocol =
-	    passthrough_candidate ? ScanMergedProtocol(params.code) : MergedProtocol {};
+	const auto code_words = data.code_size_bytes / sizeof(uint32_t);
+	const auto protocol   = passthrough_candidate
+	    ? ScanMergedProtocol({reinterpret_cast<const uint32_t*>(regs.es_regs.data_addr), code_words})
+	    : MergedProtocol {};
 	const bool passthrough_geometry = passthrough_candidate && protocol.Complete();
+	auto       params = GetShaderParams(
+	    regs.es_regs.data_addr, "ShaderRecompiler VS",
+	    GetDeclaredShaderHash(regs.es_regs.data_addr),
+	    std::span<const uint32_t>(regs.gs_user_sgpr.value, regs.gs_regs.rsrc2.user_sgpr), data,
+	    merged || passthrough_geometry ? 8u : 0u);

✅ Confirmed as addressed by @⁠carbonimax

**@⁠coderabbitai[bot]** on GitHub · 2026-09-23 15:27 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/727#discussion_r4084185426) · edited 2026-10-01 17:20 UTC On `src/graphics/shader/shader.cpp` line 872 (outdated): ```diff @@ -759,14 +851,25 @@ void BuildStageStaticKey(const ShaderComputeInputInfo& info, std::vector<uint32_ ShaderParams PrepareProgram(const HW::VertexShaderInfo& regs, const HW::Context& context, const HW::UserConfig& user_config, ShaderVertexInputInfo& info) { const auto& sh = context.GetShaderRegisters(); - const auto data = ShaderGetMappedData(regs.es_regs.data_addr, "ShaderGetInputInfoVS():"); - const bool merged = (context.GetShaderStages() & 0x20u) != 0; + const auto data = ShaderGetMappedData(regs.es_regs.data_addr, "ShaderGetInputInfoVS():"); + const bool merged = (context.GetShaderStages() & 0x20u) != 0; auto params = GetShaderParams( regs.es_regs.data_addr, "ShaderRecompiler VS", GetDeclaredShaderHash(regs.es_regs.data_addr), std::span<const uint32_t>(regs.gs_user_sgpr.value, regs.gs_regs.rsrc2.user_sgpr), data, merged ? 8u : 0u); - if (!merged) { + const bool passthrough_candidate = data.type == Prospero::ShaderBinaryType::kGs && + regs.gs_regs.data_addr == 0 && sh.m_vgtGsMaxVertOut == 0u; + const auto protocol = + passthrough_candidate ? ScanMergedProtocol(params.code) : MergedProtocol {}; + const bool passthrough_geometry = passthrough_candidate && protocol.Complete(); + if (passthrough_geometry && user_config.GetPrimType() != Prospero::PrimitiveType::kTriList && + user_config.GetPrimType() != Prospero::PrimitiveType::kTriFan && + user_config.GetPrimType() != Prospero::PrimitiveType::kTriStrip) { + EXIT("unsupported passthrough topology: input=%u\n", + static_cast<uint32_t>(user_config.GetPrimType())); + } + if (!merged && !passthrough_geometry) { ``` _🎯 Functional Correctness_ | _🟠 Major_ | _⚡ Quick win_ <details> <summary>🔎 Supported by static analysis</summary> 🏁 Script executed: ```bash #!/bin/bash rg -nP -C4 'passthrough_alloc|ALLOCATION_(VERTEX|PRIMITIVE)_SHIFT' --type=cpp src/graphics/shader/recompiler/frontend rg -nP -C3 'user_data_base|merged \? 8u' --type=cpp src/graphics ``` Repository: KytyPS5/KytyPS5 Length of output: 21710 --- </details> **Check the user-SGPR base for non-merged passthrough programs.** `GetShaderParams` uses user data base `0` unless `merged` is true. Passthrough detection occurs after `params` is built, so `passthrough_geometry` cannot affect that base. When a non-merged `kGs` shader passes the protocol scan, the passthrough path compiles it as Mesh code. That path writes the passthrough allocation value to SGPR2. With user data also starting at SGPR0, this overwrites guest user data at SGPR2. Derive the base from `merged || passthrough_geometry`, and scan the shader code before building `params`. <details> <summary>Suggested reorder</summary> ```diff - auto params = GetShaderParams( - regs.es_regs.data_addr, "ShaderRecompiler VS", - GetDeclaredShaderHash(regs.es_regs.data_addr), - std::span<const uint32_t>(regs.gs_user_sgpr.value, regs.gs_regs.rsrc2.user_sgpr), data, - merged ? 8u : 0u); const bool passthrough_candidate = data.type == Prospero::ShaderBinaryType::kGs && regs.gs_regs.data_addr == 0 && sh.m_vgtGsMaxVertOut == 0u; - const auto protocol = - passthrough_candidate ? ScanMergedProtocol(params.code) : MergedProtocol {}; + const auto code_words = data.code_size_bytes / sizeof(uint32_t); + const auto protocol = passthrough_candidate + ? ScanMergedProtocol({reinterpret_cast<const uint32_t*>(regs.es_regs.data_addr), code_words}) + : MergedProtocol {}; const bool passthrough_geometry = passthrough_candidate && protocol.Complete(); + auto params = GetShaderParams( + regs.es_regs.data_addr, "ShaderRecompiler VS", + GetDeclaredShaderHash(regs.es_regs.data_addr), + std::span<const uint32_t>(regs.gs_user_sgpr.value, regs.gs_regs.rsrc2.user_sgpr), data, + merged || passthrough_geometry ? 8u : 0u); ``` </details> <!-- fingerprinting:phantom:medusa:pangolin --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:f3c9d967c9dedafc9317bce2 --> <!-- This is an auto-generated reply by CodeRabbit --> ✅ Confirmed as addressed by @⁠carbonimax <!-- This is an auto-generated comment by CodeRabbit -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-23 15:27 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: f5939d3a-ced3-406f-be50-a770d3525cd4

📥 Commits

Reviewing files that changed from the base of the PR and between b29d26e0a5 and 58c9a672e2.

📒 Files selected for processing (40)
  • src/graphics/guest_gpu/command_processor/commandProcessor.h
  • src/graphics/guest_gpu/command_processor/pm4Handlers.cpp
  • src/graphics/guest_gpu/graphicsRun.cpp
  • src/graphics/guest_gpu/pm4.h
  • src/graphics/host_gpu/renderer/cache/bufferCache.cpp
  • src/graphics/host_gpu/renderer/cache/textureCache.cpp
  • src/graphics/host_gpu/renderer/cache/textureCache.h
  • src/graphics/host_gpu/renderer/pipeline/descriptors.cpp
  • src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp
  • src/graphics/host_gpu/renderer/render.h
  • src/graphics/host_gpu/renderer/renderCompute.cpp
  • src/graphics/host_gpu/renderer/renderDraw.cpp
  • src/graphics/presentation/systemOverlay.cpp
  • src/graphics/presentation/window/hostInput.cpp
  • src/graphics/presentation/window/swapchain.cpp
  • src/graphics/presentation/window/vulkanWindow.cpp
  • src/graphics/presentation/window/window.cpp
  • src/graphics/presentation/window/windowInternal.h
  • src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterHelpers.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.h
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp
  • src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp
  • src/graphics/shader/recompiler/ir/ShaderIR.h
  • src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp
  • src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp
  • src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp
  • src/graphics/shader/recompiler/ir/passes/SrtWalker.h
  • src/graphics/shader/shader.cpp
  • src/graphics/shader/shader.h
  • src/graphics/shader/shaderCompiler.h
  • src/kernel/fileSystem.cpp
  • src/launcher/src/configurationEditDialog.cpp
  • src/libs/audio.cpp
  • src/libs/controller.cpp
  • src/libs/libKernel.cpp
  • src/libs/libNet.cpp
  • tests/shaderCfgTests.cpp

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-23 15:27 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/727#pullrequestreview-5293055193) · **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**: `f5939d3a-ced3-406f-be50-a770d3525cd4` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between b29d26e0a5720fbe274c5ec2a397cd639c172529 and 58c9a672e281f528b34d08b4bf2036bec44764ed. </details> <details> <summary>📒 Files selected for processing (40)</summary> * `src/graphics/guest_gpu/command_processor/commandProcessor.h` * `src/graphics/guest_gpu/command_processor/pm4Handlers.cpp` * `src/graphics/guest_gpu/graphicsRun.cpp` * `src/graphics/guest_gpu/pm4.h` * `src/graphics/host_gpu/renderer/cache/bufferCache.cpp` * `src/graphics/host_gpu/renderer/cache/textureCache.cpp` * `src/graphics/host_gpu/renderer/cache/textureCache.h` * `src/graphics/host_gpu/renderer/pipeline/descriptors.cpp` * `src/graphics/host_gpu/renderer/pipeline/pipelineCache.cpp` * `src/graphics/host_gpu/renderer/render.h` * `src/graphics/host_gpu/renderer/renderCompute.cpp` * `src/graphics/host_gpu/renderer/renderDraw.cpp` * `src/graphics/presentation/systemOverlay.cpp` * `src/graphics/presentation/window/hostInput.cpp` * `src/graphics/presentation/window/swapchain.cpp` * `src/graphics/presentation/window/vulkanWindow.cpp` * `src/graphics/presentation/window/window.cpp` * `src/graphics/presentation/window/windowInternal.h` * `src/graphics/shader/recompiler/backend/spirv/SpirvEmitter.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterHelpers.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterImage.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterInternal.h` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterMemory.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterModule.cpp` * `src/graphics/shader/recompiler/backend/spirv/spirvEmitterProgram.cpp` * `src/graphics/shader/recompiler/ir/ShaderIR.h` * `src/graphics/shader/recompiler/ir/passes/ResourceMaterialization.cpp` * `src/graphics/shader/recompiler/ir/passes/ResourceTracking.cpp` * `src/graphics/shader/recompiler/ir/passes/SrtWalker.cpp` * `src/graphics/shader/recompiler/ir/passes/SrtWalker.h` * `src/graphics/shader/shader.cpp` * `src/graphics/shader/shader.h` * `src/graphics/shader/shaderCompiler.h` * `src/kernel/fileSystem.cpp` * `src/launcher/src/configurationEditDialog.cpp` * `src/libs/audio.cpp` * `src/libs/controller.cpp` * `src/libs/libKernel.cpp` * `src/libs/libNet.cpp` * `tests/shaderCfgTests.cpp` </details> **Included review availability:** Your plan provides up to 10 included reviews per hour; 8 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
Author
Owner

@⁠carbonimax on GitHub · 2026-10-01 17:20 UTC · original
On src/graphics/shader/shader.cpp line 872 (outdated):

@@ -759,14 +851,25 @@ void BuildStageStaticKey(const ShaderComputeInputInfo& info, std::vector<uint32_
 ShaderParams PrepareProgram(const HW::VertexShaderInfo& regs, const HW::Context& context,
                             const HW::UserConfig& user_config, ShaderVertexInputInfo& info) {
 	const auto& sh     = context.GetShaderRegisters();
-	const auto data = ShaderGetMappedData(regs.es_regs.data_addr, "ShaderGetInputInfoVS():");
-	const bool merged = (context.GetShaderStages() & 0x20u) != 0;
+	const auto  data   = ShaderGetMappedData(regs.es_regs.data_addr, "ShaderGetInputInfoVS():");
+	const bool  merged = (context.GetShaderStages() & 0x20u) != 0;
 	auto        params = GetShaderParams(
 	    regs.es_regs.data_addr, "ShaderRecompiler VS",
 	    GetDeclaredShaderHash(regs.es_regs.data_addr),
 	    std::span<const uint32_t>(regs.gs_user_sgpr.value, regs.gs_regs.rsrc2.user_sgpr), data,
 	    merged ? 8u : 0u);
-	if (!merged) {
+	const bool passthrough_candidate = data.type == Prospero::ShaderBinaryType::kGs &&
+	                                   regs.gs_regs.data_addr == 0 && sh.m_vgtGsMaxVertOut == 0u;
+	const auto protocol =
+	    passthrough_candidate ? ScanMergedProtocol(params.code) : MergedProtocol {};
+	const bool passthrough_geometry = passthrough_candidate && protocol.Complete();
+	if (passthrough_geometry && user_config.GetPrimType() != Prospero::PrimitiveType::kTriList &&
+	    user_config.GetPrimType() != Prospero::PrimitiveType::kTriFan &&
+	    user_config.GetPrimType() != Prospero::PrimitiveType::kTriStrip) {
+		EXIT("unsupported passthrough topology: input=%u\n",
+		     static_cast<uint32_t>(user_config.GetPrimType()));
+	}
+	if (!merged && !passthrough_geometry) {

Already addressed by 895cd62f and retained in the main update: the merged passthrough protocol is detected before GetShaderParams, and merged || passthrough_geometry reserves the first eight SGPRs. TestPassthroughShaderUserDataBase checks both wave64 and wave32, including the zero prefix and the captured user data starting at s8.

**@⁠carbonimax** on GitHub · 2026-10-01 17:20 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/727#discussion_r4158349492) On `src/graphics/shader/shader.cpp` line 872 (outdated): ```diff @@ -759,14 +851,25 @@ void BuildStageStaticKey(const ShaderComputeInputInfo& info, std::vector<uint32_ ShaderParams PrepareProgram(const HW::VertexShaderInfo& regs, const HW::Context& context, const HW::UserConfig& user_config, ShaderVertexInputInfo& info) { const auto& sh = context.GetShaderRegisters(); - const auto data = ShaderGetMappedData(regs.es_regs.data_addr, "ShaderGetInputInfoVS():"); - const bool merged = (context.GetShaderStages() & 0x20u) != 0; + const auto data = ShaderGetMappedData(regs.es_regs.data_addr, "ShaderGetInputInfoVS():"); + const bool merged = (context.GetShaderStages() & 0x20u) != 0; auto params = GetShaderParams( regs.es_regs.data_addr, "ShaderRecompiler VS", GetDeclaredShaderHash(regs.es_regs.data_addr), std::span<const uint32_t>(regs.gs_user_sgpr.value, regs.gs_regs.rsrc2.user_sgpr), data, merged ? 8u : 0u); - if (!merged) { + const bool passthrough_candidate = data.type == Prospero::ShaderBinaryType::kGs && + regs.gs_regs.data_addr == 0 && sh.m_vgtGsMaxVertOut == 0u; + const auto protocol = + passthrough_candidate ? ScanMergedProtocol(params.code) : MergedProtocol {}; + const bool passthrough_geometry = passthrough_candidate && protocol.Complete(); + if (passthrough_geometry && user_config.GetPrimType() != Prospero::PrimitiveType::kTriList && + user_config.GetPrimType() != Prospero::PrimitiveType::kTriFan && + user_config.GetPrimType() != Prospero::PrimitiveType::kTriStrip) { + EXIT("unsupported passthrough topology: input=%u\n", + static_cast<uint32_t>(user_config.GetPrimType())); + } + if (!merged && !passthrough_geometry) { ``` Already addressed by 895cd62f and retained in the main update: the merged passthrough protocol is detected before GetShaderParams, and merged || passthrough_geometry reserves the first eight SGPRs. TestPassthroughShaderUserDataBase checks both wave64 and wave32, including the zero prefix and the captured user data starting at s8.
@ -14136,0 +14367,4 @@
TestMeshPassthrough(64, 0, 0u | (1u << 10u) | (2u << 20u));
TestMeshPassthrough(64, 1, 3u | (4u << 10u) | (5u << 20u));
TestMeshPassthrough(64, 2, 6u | (7u << 10u) | (8u << 20u));
TestMeshPassthrough(64, 64u - 1u, 189u | (190u << 10u) | (191u << 20u));
Author
Owner

@⁠carbonimax on GitHub · 2026-10-01 17:20 UTC · original

Covered by TestMeshPassthrough(32, 32u, 96u | (97u << 10u) | (98u << 20u)), alongside lane 31 and both wave sizes. The lane-32 case checks the second guest wave has zero allocation counts while retaining the packed-index ABI. The updated branch also retains TestMeshWave32PackedSubgroupIsolation for two guest wave32 waves in a physical subgroup64.

**@⁠carbonimax** on GitHub · 2026-10-01 17:20 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/727#discussion_r4158349995) Covered by TestMeshPassthrough(32, 32u, 96u | (97u << 10u) | (98u << 20u)), alongside lane 31 and both wave sizes. The lane-32 case checks the second guest wave has zero allocation counts while retaining the packed-index ABI. The updated branch also retains TestMeshWave32PackedSubgroupIsolation for two guest wave32 waves in a physical subgroup64.
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-01 17:20 UTC · original
On src/graphics/shader/shader.cpp line 872 (outdated):

@@ -759,14 +851,25 @@ void BuildStageStaticKey(const ShaderComputeInputInfo& info, std::vector<uint32_
 ShaderParams PrepareProgram(const HW::VertexShaderInfo& regs, const HW::Context& context,
                             const HW::UserConfig& user_config, ShaderVertexInputInfo& info) {
 	const auto& sh     = context.GetShaderRegisters();
-	const auto data = ShaderGetMappedData(regs.es_regs.data_addr, "ShaderGetInputInfoVS():");
-	const bool merged = (context.GetShaderStages() & 0x20u) != 0;
+	const auto  data   = ShaderGetMappedData(regs.es_regs.data_addr, "ShaderGetInputInfoVS():");
+	const bool  merged = (context.GetShaderStages() & 0x20u) != 0;
 	auto        params = GetShaderParams(
 	    regs.es_regs.data_addr, "ShaderRecompiler VS",
 	    GetDeclaredShaderHash(regs.es_regs.data_addr),
 	    std::span<const uint32_t>(regs.gs_user_sgpr.value, regs.gs_regs.rsrc2.user_sgpr), data,
 	    merged ? 8u : 0u);
-	if (!merged) {
+	const bool passthrough_candidate = data.type == Prospero::ShaderBinaryType::kGs &&
+	                                   regs.gs_regs.data_addr == 0 && sh.m_vgtGsMaxVertOut == 0u;
+	const auto protocol =
+	    passthrough_candidate ? ScanMergedProtocol(params.code) : MergedProtocol {};
+	const bool passthrough_geometry = passthrough_candidate && protocol.Complete();
+	if (passthrough_geometry && user_config.GetPrimType() != Prospero::PrimitiveType::kTriList &&
+	    user_config.GetPrimType() != Prospero::PrimitiveType::kTriFan &&
+	    user_config.GetPrimType() != Prospero::PrimitiveType::kTriStrip) {
+		EXIT("unsupported passthrough topology: input=%u\n",
+		     static_cast<uint32_t>(user_config.GetPrimType()));
+	}
+	if (!merged && !passthrough_geometry) {

@carbonimax, confirmed in the supplied code. Passthrough detection now runs before GetShaderParams. The condition merged || passthrough_geometry places user data at s8, which prevents the SGPR2 allocation value from overwriting user data.


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-01 17:20 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/727#discussion_r4158352781) On `src/graphics/shader/shader.cpp` line 872 (outdated): ```diff @@ -759,14 +851,25 @@ void BuildStageStaticKey(const ShaderComputeInputInfo& info, std::vector<uint32_ ShaderParams PrepareProgram(const HW::VertexShaderInfo& regs, const HW::Context& context, const HW::UserConfig& user_config, ShaderVertexInputInfo& info) { const auto& sh = context.GetShaderRegisters(); - const auto data = ShaderGetMappedData(regs.es_regs.data_addr, "ShaderGetInputInfoVS():"); - const bool merged = (context.GetShaderStages() & 0x20u) != 0; + const auto data = ShaderGetMappedData(regs.es_regs.data_addr, "ShaderGetInputInfoVS():"); + const bool merged = (context.GetShaderStages() & 0x20u) != 0; auto params = GetShaderParams( regs.es_regs.data_addr, "ShaderRecompiler VS", GetDeclaredShaderHash(regs.es_regs.data_addr), std::span<const uint32_t>(regs.gs_user_sgpr.value, regs.gs_regs.rsrc2.user_sgpr), data, merged ? 8u : 0u); - if (!merged) { + const bool passthrough_candidate = data.type == Prospero::ShaderBinaryType::kGs && + regs.gs_regs.data_addr == 0 && sh.m_vgtGsMaxVertOut == 0u; + const auto protocol = + passthrough_candidate ? ScanMergedProtocol(params.code) : MergedProtocol {}; + const bool passthrough_geometry = passthrough_candidate && protocol.Complete(); + if (passthrough_geometry && user_config.GetPrimType() != Prospero::PrimitiveType::kTriList && + user_config.GetPrimType() != Prospero::PrimitiveType::kTriFan && + user_config.GetPrimType() != Prospero::PrimitiveType::kTriStrip) { + EXIT("unsupported passthrough topology: input=%u\n", + static_cast<uint32_t>(user_config.GetPrimType())); + } + if (!merged && !passthrough_geometry) { ``` `@carbonimax`, confirmed in the supplied code. Passthrough detection now runs before `GetShaderParams`. The condition `merged || passthrough_geometry` places user data at s8, which prevents the SGPR2 allocation value from overwriting user data. --- <!-- 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=Catch%20SGPR%20clobbers%20early%3A%20detect%20passthrough%20before%20building%20params%2C%20reserve%20s0%E2%80%93s7%2C%20and%20test%20wave32%2F64%20user%20data%20at%20s8.%20Try%20%40coderabbitai%20%F0%9F%9B%A0%EF%B8%8F&url=https%3A%2F%2Fgithub.com%2FKytyPS5%2FKytyPS5%2Fpull%2F727%23discussion_r4084185426)? 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 -->
@ -14136,0 +14367,4 @@
TestMeshPassthrough(64, 0, 0u | (1u << 10u) | (2u << 20u));
TestMeshPassthrough(64, 1, 3u | (4u << 10u) | (5u << 20u));
TestMeshPassthrough(64, 2, 6u | (7u << 10u) | (8u << 20u));
TestMeshPassthrough(64, 64u - 1u, 189u | (190u << 10u) | (191u << 20u));
Author
Owner

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

Oops, something went wrong! Please try again later. 🐰 💔

**@⁠coderabbitai[bot]** on GitHub · 2026-10-01 17:20 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/727#discussion_r4158353527) Oops, something went wrong! Please try again later. 🐰 💔 <!-- This is an auto-generated reply by CodeRabbit -->
Author
Owner

@⁠Nmzik on GitHub · 2026-10-08 14:48 UTC · original

Stale

**@⁠Nmzik** on GitHub · 2026-10-08 14:48 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/727#issuecomment-6062478717) Stale

Pull request closed

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