First special instruction
This commit is contained in:
parent
f4c17aa526
commit
058dcda18d
3 changed files with 30 additions and 4 deletions
|
@ -3,6 +3,7 @@ using Ryujinx.Graphics.Shader.StructuredIr;
|
||||||
using Ryujinx.Graphics.Shader.Translation;
|
using Ryujinx.Graphics.Shader.Translation;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
using static Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions.InstGenCall;
|
||||||
using static Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions.InstGenHelper;
|
using static Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions.InstGenHelper;
|
||||||
using static Ryujinx.Graphics.Shader.StructuredIr.InstructionInfo;
|
using static Ryujinx.Graphics.Shader.StructuredIr.InstructionInfo;
|
||||||
|
|
||||||
|
@ -105,7 +106,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
||||||
case Instruction.Barrier:
|
case Instruction.Barrier:
|
||||||
return "|| BARRIER ||";
|
return "|| BARRIER ||";
|
||||||
case Instruction.Call:
|
case Instruction.Call:
|
||||||
return "|| CALL ||";
|
return Call(context, operation);
|
||||||
case Instruction.FSIBegin:
|
case Instruction.FSIBegin:
|
||||||
return "|| FSI BEGIN ||";
|
return "|| FSI BEGIN ||";
|
||||||
case Instruction.FSIEnd:
|
case Instruction.FSIEnd:
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
using Ryujinx.Graphics.Shader.StructuredIr;
|
||||||
|
|
||||||
|
using static Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions.InstGenHelper;
|
||||||
|
|
||||||
|
namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
||||||
|
{
|
||||||
|
static class InstGenCall
|
||||||
|
{
|
||||||
|
public static string Call(CodeGenContext context, AstOperation operation)
|
||||||
|
{
|
||||||
|
AstOperand funcId = (AstOperand)operation.GetSource(0);
|
||||||
|
|
||||||
|
var functon = context.GetFunction(funcId.Value);
|
||||||
|
|
||||||
|
string[] args = new string[operation.SourcesCount - 1];
|
||||||
|
|
||||||
|
for (int i = 0; i < args.Length; i++)
|
||||||
|
{
|
||||||
|
args[i] = GetSourceExpr(context, operation.GetSource(i + 1), functon.GetArgumentType(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $"{functon.Name}({string.Join(", ", args)})";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,8 @@ using Ryujinx.Graphics.Shader.IntermediateRepresentation;
|
||||||
using Ryujinx.Graphics.Shader.StructuredIr;
|
using Ryujinx.Graphics.Shader.StructuredIr;
|
||||||
using Ryujinx.Graphics.Shader.Translation;
|
using Ryujinx.Graphics.Shader.Translation;
|
||||||
|
|
||||||
|
using static Ryujinx.Graphics.Shader.CodeGen.Msl.TypeConversion;
|
||||||
|
|
||||||
namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
||||||
{
|
{
|
||||||
static class InstGenHelper
|
static class InstGenHelper
|
||||||
|
@ -140,9 +142,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
||||||
|
|
||||||
public static string GetSourceExpr(CodeGenContext context, IAstNode node, AggregateType dstType)
|
public static string GetSourceExpr(CodeGenContext context, IAstNode node, AggregateType dstType)
|
||||||
{
|
{
|
||||||
// TODO: Implement this
|
return ReinterpretCast(context, node, OperandManager.GetNodeDestType(context, node), dstType);
|
||||||
// return ReinterpretCast(context, node, OperandManager.GetNodeDestType(context, node), dstType);
|
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string Enclose(string expr, IAstNode node, Instruction pInst, bool isLhs)
|
public static string Enclose(string expr, IAstNode node, Instruction pInst, bool isLhs)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue