diff --git a/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions.cs b/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions.cs index fe6d2e0ce0..78dd25b9f6 100644 --- a/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions.cs +++ b/Ryujinx.Graphics/Shader/CodeGen/Glsl/Instructions.cs @@ -92,6 +92,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl Add(Instruction.LogicalExclusiveOr, InstFlags.OpBinary, "^^", 10); Add(Instruction.LogicalNot, InstFlags.OpUnary, "!", 0); Add(Instruction.LogicalOr, InstFlags.OpBinary, "||", 11); + Add(Instruction.LoopBreak, InstFlags.OpNullary, "break"); + Add(Instruction.LoopContinue, InstFlags.OpNullary, "continue"); Add(Instruction.ShiftLeft, InstFlags.OpBinary, "<<", 3); Add(Instruction.ShiftRightS32, InstFlags.OpBinary, ">>", 3); Add(Instruction.ShiftRightU32, InstFlags.OpBinary, ">>", 3); diff --git a/Ryujinx.Graphics/Shader/CodeGen/Glsl/TypeConversion.cs b/Ryujinx.Graphics/Shader/CodeGen/Glsl/TypeConversion.cs index 7642869f3b..a86556bd5b 100644 --- a/Ryujinx.Graphics/Shader/CodeGen/Glsl/TypeConversion.cs +++ b/Ryujinx.Graphics/Shader/CodeGen/Glsl/TypeConversion.cs @@ -44,14 +44,14 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl { switch (srcType) { - case VariableType.Bool: return $"intBitsToFloat({ReinterpretBoolToInt(expr, VariableType.S32)})"; + case VariableType.Bool: return $"intBitsToFloat({ReinterpretBoolToInt(expr, node, VariableType.S32)})"; case VariableType.S32: return $"intBitsToFloat({expr})"; case VariableType.U32: return $"uintBitsToFloat({expr})"; } } else if (srcType == VariableType.Bool) { - return ReinterpretBoolToInt(expr, dstType); + return ReinterpretBoolToInt(expr, node, dstType); } else if (dstType == VariableType.Bool) { @@ -71,12 +71,14 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl throw new ArgumentException($"Invalid reinterpret cast from \"{srcType}\" to \"{dstType}\"."); } - private static string ReinterpretBoolToInt(string expr, VariableType dstType) + private static string ReinterpretBoolToInt(string expr, IAstNode node, VariableType dstType) { string trueExpr = NumberFormatter.FormatInt(IrConsts.True, dstType); string falseExpr = NumberFormatter.FormatInt(IrConsts.False, dstType); - return $"(({expr}) ? {trueExpr} : {falseExpr})"; + expr = Instructions.Enclose(expr, node, Instruction.ConditionalSelect, isLhs: false); + + return $"({expr} ? {trueExpr} : {falseExpr})"; } } } \ No newline at end of file diff --git a/Ryujinx.Graphics/Shader/IntermediateRepresentation/INode.cs b/Ryujinx.Graphics/Shader/IntermediateRepresentation/INode.cs index e1a312cc7d..48dda24b1e 100644 --- a/Ryujinx.Graphics/Shader/IntermediateRepresentation/INode.cs +++ b/Ryujinx.Graphics/Shader/IntermediateRepresentation/INode.cs @@ -2,8 +2,6 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation { interface INode { - BasicBlock Parent { get; set; } - Operand Dest { get; set; } int SourcesCount { get; } diff --git a/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs b/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs index f3c44f73ac..96c210a084 100644 --- a/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs +++ b/Ryujinx.Graphics/Shader/IntermediateRepresentation/Operation.cs @@ -2,8 +2,6 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation { class Operation : INode { - public BasicBlock Parent { get; set; } - public Instruction Inst { get; private set; } private Operand _dest; diff --git a/Ryujinx.Graphics/Shader/IntermediateRepresentation/PhiNode.cs b/Ryujinx.Graphics/Shader/IntermediateRepresentation/PhiNode.cs index ea1cfa1850..81609ea9f1 100644 --- a/Ryujinx.Graphics/Shader/IntermediateRepresentation/PhiNode.cs +++ b/Ryujinx.Graphics/Shader/IntermediateRepresentation/PhiNode.cs @@ -4,8 +4,6 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation { class PhiNode : INode { - public BasicBlock Parent { get; set; } - private Operand _dest; public Operand Dest