mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-12-23 18:45:44 +00:00
49f970d5bd
* Add support for CAL and RET shader instructions * Remove unused stuff * Fix a bug that could cause the wrong values to be passed to a function * Avoid repopulating function id dictionary every time * PR feedback * Fix vertex shader A/B merge
29 lines
No EOL
930 B
C#
29 lines
No EOL
930 B
C#
using Ryujinx.Graphics.Shader.IntermediateRepresentation;
|
|
using Ryujinx.Graphics.Shader.StructuredIr;
|
|
using System.Diagnostics;
|
|
|
|
using static Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions.InstGenHelper;
|
|
|
|
namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
|
|
{
|
|
static class InstGenCall
|
|
{
|
|
public static string Call(CodeGenContext context, AstOperation operation)
|
|
{
|
|
AstOperand funcId = (AstOperand)operation.GetSource(0);
|
|
|
|
Debug.Assert(funcId.Type == OperandType.Constant);
|
|
|
|
var function = context.GetFunction(funcId.Value);
|
|
|
|
string[] args = new string[operation.SourcesCount - 1];
|
|
|
|
for (int i = 0; i < args.Length; i++)
|
|
{
|
|
args[i] = GetSoureExpr(context, operation.GetSource(i + 1), function.GetArgumentType(i));
|
|
}
|
|
|
|
return $"{function.Name}({string.Join(", ", args)})";
|
|
}
|
|
}
|
|
} |