shader: fold branch-proven vertex selects #1071
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1071
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1071"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Abhi011999 on GitHub · 2026-10-05 15:37 UTC · original
Abhi011999:fix/vertex-branch-selects→main· +150 −0 · 4 files · 1 commits · openI have tested out Stray (the game) with these additional changes besides what mentioned in below PRs, and its going in-game successfully.
Stray's native vertex shader
0x79ef5bf7d0ca9452retained inactiveWriteLanechains after uniform lane-read elimination. Those chains introduced vertex subgroup builtins that MoltenVK could not translate.Fold
SelectU32andSelectF32when a vertex block has one predecessor and that predecessor's conditional edge proves the select predicate. NormalizeConditionRefand logical negation, then run identity removal and dead-code elimination. Preserve observable lane writes. Refuse workgroup stages, dispatcher fallback, reconverged blocks, wave exchanges, lane queries, and shared-memory operations.This patch contains only the new branch-select pass, its pipeline call, and regression tests. It does not duplicate #637 or #735. The Stray integration test used those PRs to remove independent constant-mask and uniform-read dependencies before this pass could apply. #985 changes wave-wide zero-branch emission, and #1012 changes identical-target SPIR-V branch emission; neither supplies this pass.
Validation:
77d772217310dc734ce53289110c9be0885a0577.git diff --checkpassed.Limits: the isolated patch was not used to rebuild and replay the full game on current upstream main. Full-game integration used a custom PR stack and an experimental MoltenVK mesh-shader fork. Windows and Linux were not tested. This change does not establish correct rendering, stable gameplay, or a completed playthrough.
AI involvement: Codex prepared the implementation, tests, comparison, and this draft, and ran the automated checks. The human tester confirmed gameplay in the earlier integration build.
I have tested the changes & they look fine.
Stray macOS compatibility report
Status: In game, custom experimental build. PPSA02100, game version 01.005.000. Tested on macOS 15.7.4, Apple M4 Pro, 24 GB unified memory, with an x86_64 Release emulator through Rosetta 2.
The rainy opening scene plays and cat control is confirmed. Typical presentation rates were about 5–8 FPS. A later blue-gray rendering fault remains unresolved, and a capture-enabled run exited under memory pressure. A complete playthrough was not tested. Gameplay after the later #977 cache patch is still unverified.
This result requires the documented PR stack and experimental MoltenVK mesh-shader fork; this PR alone does not establish stock-release compatibility.
Website publication is deferred. The maintainer closed website PR #629 and requires a clean/official-build result submitted through the main repository's game-status issue form. The website bot processes those reports; direct website PRs are not accepted. Issue #1073 records only the earlier custom-build evidence and does not establish official-build compatibility. The tester has removed the game dump, so a clean-build retest is currently unavailable. Complete log upload remains pending separate approval.
@coderabbitai[bot] on GitHub · 2026-10-05 15:48 UTC · original · edited 2026-10-12 17:10 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
e8969af0-794b-4b54-87e0-2d0350277bf8📥 Commits
Reviewing files that changed from the base of the PR and between
77d7722173and2555146281.📒 Files selected for processing (4)
src/graphics/shader/recompiler/ShaderRecompiler.cppsrc/graphics/shader/recompiler/ir/passes/ConstantPropagation.cppsrc/graphics/shader/recompiler/ir/passes/ConstantPropagation.htests/ScalarProvenanceTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
Walkthrough
Adds a pass that folds vertex branch selects when a block has a uniquely targeted conditional-branch predecessor and the program meets the pass guards.
TranslatePrograminvokes the pass after read-lane elimination, then reruns control-flow identity resolution and cleanup. Tests cover folding, preserved select values, andWriteLanebehavior.Suggested reviewers:
nmzikPriority: ⬇️ Low
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
25551The proposed self-loop guard is unnecessary; no actionable issue remains before merging after normal checks.
Pre-merge checks |
4 |
1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.