Small leftovers -- add missing break and continue, remove unused properties, other improvements
This commit is contained in:
parent
baecbfb31a
commit
6f37aefd33
5 changed files with 8 additions and 10 deletions
|
@ -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);
|
||||
|
|
|
@ -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})";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,8 +2,6 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
|
|||
{
|
||||
interface INode
|
||||
{
|
||||
BasicBlock Parent { get; set; }
|
||||
|
||||
Operand Dest { get; set; }
|
||||
|
||||
int SourcesCount { get; }
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -4,8 +4,6 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
|
|||
{
|
||||
class PhiNode : INode
|
||||
{
|
||||
public BasicBlock Parent { get; set; }
|
||||
|
||||
private Operand _dest;
|
||||
|
||||
public Operand Dest
|
||||
|
|
Loading…
Add table
Reference in a new issue