graphics: apply configured SPIR-V shader optimization #1015
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!1015
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1015/head"
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?
@nicolasabosch on GitHub · 2026-10-03 18:02 UTC · original
nicolasabosch:perf/shader-optimization→main· +514 −147 · 8 files · 1 commits · closed without mergingThe existing
None,Size, andPerformanceshader optimization setting does not reach guest shader compilation. This change passes the configured mode into the recompiler and applies a conservative SPIRV-Tools pipeline after SPIR-V emission.Nonepreserves the emitted binary. The other modes remove redundant instructions and dead code while preserving descriptor bindings, specialization constants, and stage outputs. The pipeline avoids inlining, loop unrolling, and fast-math changes. Input and output are validated for Vulkan 1.3; optimization failures retain the original module and log diagnostics. Optimization runs during shader compilation, with word counts and elapsed time logged.Validation
git diff --checkpassed. The hook also reformatted existing code in the touched source files.shader_optimizer,shader_cfg,shader_optimization_gpu).These measurements establish shader binary-size reduction and correctness for the selected cases. FPS and driver compilation-time improvements have not been measured. No game benchmark or Linux/macOS build was run; mesh and tessellation stages were not exercised by the new GPU selector.
After configuring a Windows Release build with testing enabled:
The GPU test requires the capabilities checked by the existing Vulkan harness.
AI involvement and review status
Codex researched the change, generated and reviewed the implementation and tests, prepared this description, and executed the build and automated tests above. The contributor explicitly requested this PR, approved reporting the measured results, and confirmed human review of the code. The build and automated tests were executed by Codex; no independent manual testing or game-performance measurements are claimed.
@coderabbitai[bot] on GitHub · 2026-10-03 18:12 UTC · original
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
21eadac9-9c4b-473c-a0ae-174d0ec092b6📥 Commits
Reviewing files that changed from the base of the PR and between
e7f6327068and71bf7e06a4.📒 Files selected for processing (8)
CMakeLists.txtsrc/graphics/host_gpu/renderer/pipeline/pipelineCache.cppsrc/graphics/shader/recompiler/ShaderRecompiler.cppsrc/graphics/shader/recompiler/ShaderRecompiler.hsrc/graphics/shader/recompiler/backend/spirv/SpirvOptimizer.cppsrc/graphics/shader/recompiler/backend/spirv/SpirvOptimizer.htests/ShaderOptimizerTests.cpptests/ShaderRecompilerComputeTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Walkthrough
Walkthrough
The change adds
None,Size, andPerformanceSPIR-V optimization modes to shader compilation. The optimizer validates optimized modules before replacing the original and reports diagnostics on failure. Compilation obtains the selected mode from configuration and retains the original shader if optimization fails. New unit and GPU tests cover optimizer behavior and selected compute and graphics cases.Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Bug fix
Merge Risk: ⚪ Minimal · up to
71bf7No actionable issue remains in the supplied review evidence. The PR is mergeable after normal checks.
Security Architecture Review
Security architecture risk: 🔵 Low · up to
71bf7The change adds processing of game-provided shader data without an observed increase in privileges. Optimized results are validated before use, and ordinary failures retain the original shader. Abnormal-failure behavior and changing settings during execution remain incompletely established; no introduced vulnerability was demonstrated.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❓ 1
❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
Full details: Docstring Coverage
Explanation
Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 6 files. (2 skipped: 1 unsupported, 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 helpto get the list of available commands.Pull request closed