Include FragmentIn as additional arg

This commit is contained in:
Isaac Marovitz 2024-05-30 16:30:02 +01:00 committed by Isaac Marovitz
parent 817baf527c
commit 7afda0a289
3 changed files with 8 additions and 6 deletions

View file

@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
public const string Tab = " ";
// The number of additional arguments that every function (except for the main one) must have (for instance support_buffer)
public const int additionalArgCount = 1;
public const int AdditionalArgCount = 2;
public StructuredFunction CurrentFunction { get; set; }

View file

@ -13,12 +13,13 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
var functon = context.GetFunction(funcId.Value);
int argCount = operation.SourcesCount - 1;
string[] args = new string[argCount + CodeGenContext.additionalArgCount];
string[] args = new string[argCount + CodeGenContext.AdditionalArgCount];
// Additional arguments
args[0] = "support_buffer";
args[0] = "in";
args[1] = "support_buffer";
int argIndex = CodeGenContext.additionalArgCount;
int argIndex = CodeGenContext.AdditionalArgCount;
for (int i = 0; i < argCount; i++)
{
args[argIndex++] = GetSourceExpr(context, operation.GetSource(i + 1), functon.GetArgumentType(i));

View file

@ -63,14 +63,15 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
ShaderStage stage,
bool isMainFunc = false)
{
int additionalArgCount = isMainFunc ? 0 : CodeGenContext.additionalArgCount;
int additionalArgCount = isMainFunc ? 0 : CodeGenContext.AdditionalArgCount;
string[] args = new string[additionalArgCount + function.InArguments.Length + function.OutArguments.Length];
// All non-main functions need to be able to access the support_buffer as well
if (!isMainFunc)
{
args[0] = "constant Struct_support_buffer* support_buffer";
args[0] = "FragmentIn in";
args[1] = "constant Struct_support_buffer* support_buffer";
}
int argIndex = additionalArgCount;