mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-18 12:08:38 +00:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
937 B
Diff
16 lines
937 B
Diff
--- a/src/Ryujinx.Graphics.Shader/StructuredIr/AstOptimizer.cs
|
|
+++ b/src/Ryujinx.Graphics.Shader/StructuredIr/AstOptimizer.cs
|
|
@@ -24,7 +24,11 @@
|
|
{
|
|
bool isWorthPropagating = propVar.Uses.Count == 1 || IsWorthPropagating(assignment.Source);
|
|
|
|
- if (propVar.Defs.Count == 1 && isWorthPropagating)
|
|
+ // TOTK: SPIR-V passes call arguments by pointer to a variable (StructuredProgram copies them
|
|
+ // into temporaries); folding an expression into a call argument breaks GenerateCall.
|
|
+ bool usedByCall = propVar.Uses.Any(u => u is AstOperation op && op.Inst == Instruction.Call);
|
|
+
|
|
+ if (propVar.Defs.Count == 1 && isWorthPropagating && !usedByCall)
|
|
{
|
|
PropagateExpression(propVar, assignment.Source);
|
|
}
|