Fix inline functions in compute stage
Fix regression
This commit is contained in:
parent
bfef240d22
commit
bd686b626c
3 changed files with 24 additions and 8 deletions
|
@ -9,7 +9,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
|
||||||
public const string Tab = " ";
|
public const string Tab = " ";
|
||||||
|
|
||||||
// The number of additional arguments that every function (except for the main one) must have (for instance support_buffer)
|
// The number of additional arguments that every function (except for the main one) must have (for instance support_buffer)
|
||||||
public const int AdditionalArgCount = 2;
|
public const int AdditionalArgCount = 1;
|
||||||
|
|
||||||
public StructuredFunction CurrentFunction { get; set; }
|
public StructuredFunction CurrentFunction { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -13,13 +13,22 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
||||||
var functon = context.GetFunction(funcId.Value);
|
var functon = context.GetFunction(funcId.Value);
|
||||||
|
|
||||||
int argCount = operation.SourcesCount - 1;
|
int argCount = operation.SourcesCount - 1;
|
||||||
string[] args = new string[argCount + CodeGenContext.AdditionalArgCount];
|
int additionalArgCount = CodeGenContext.AdditionalArgCount + (context.Definitions.Stage != ShaderStage.Compute ? 1 : 0);
|
||||||
|
|
||||||
|
string[] args = new string[argCount + additionalArgCount];
|
||||||
|
|
||||||
// Additional arguments
|
// Additional arguments
|
||||||
args[0] = "in";
|
if (context.Definitions.Stage != ShaderStage.Compute)
|
||||||
args[1] = "support_buffer";
|
{
|
||||||
|
args[0] = "in";
|
||||||
|
args[1] = "support_buffer";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
args[0] = "support_buffer";
|
||||||
|
}
|
||||||
|
|
||||||
int argIndex = CodeGenContext.AdditionalArgCount;
|
int argIndex = additionalArgCount;
|
||||||
for (int i = 0; i < argCount; i++)
|
for (int i = 0; i < argCount; i++)
|
||||||
{
|
{
|
||||||
args[argIndex++] = GetSourceExpr(context, operation.GetSource(i + 1), functon.GetArgumentType(i));
|
args[argIndex++] = GetSourceExpr(context, operation.GetSource(i + 1), functon.GetArgumentType(i));
|
||||||
|
|
|
@ -63,15 +63,22 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
|
||||||
ShaderStage stage,
|
ShaderStage stage,
|
||||||
bool isMainFunc = false)
|
bool isMainFunc = false)
|
||||||
{
|
{
|
||||||
int additionalArgCount = isMainFunc ? 0 : CodeGenContext.AdditionalArgCount;
|
int additionalArgCount = isMainFunc ? 0 : CodeGenContext.AdditionalArgCount + (context.Definitions.Stage != ShaderStage.Compute ? 1 : 0);
|
||||||
|
|
||||||
string[] args = new string[additionalArgCount + function.InArguments.Length + function.OutArguments.Length];
|
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
|
// All non-main functions need to be able to access the support_buffer as well
|
||||||
if (!isMainFunc)
|
if (!isMainFunc)
|
||||||
{
|
{
|
||||||
args[0] = "FragmentIn in";
|
if (stage != ShaderStage.Compute)
|
||||||
args[1] = "constant Struct_support_buffer* support_buffer";
|
{
|
||||||
|
args[0] = stage == ShaderStage.Vertex ? "VertexIn in" : "FragmentIn in";
|
||||||
|
args[1] = "constant Struct_support_buffer* support_buffer";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
args[0] = "constant Struct_support_buffer* support_buffer";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int argIndex = additionalArgCount;
|
int argIndex = additionalArgCount;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue