Shader Gen Fixes
Fixes Luigi’s Mansion 2 HD
This commit is contained in:
committed by
Evan Husted
parent
40ea153616
commit
ffb9040b3b
@@ -10,10 +10,18 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
||||
{
|
||||
AstOperand funcId = (AstOperand)operation.GetSource(0);
|
||||
|
||||
var functon = context.GetFunction(funcId.Value);
|
||||
var function = context.GetFunction(funcId.Value);
|
||||
|
||||
int argCount = operation.SourcesCount - 1;
|
||||
int additionalArgCount = CodeGenContext.AdditionalArgCount + (context.Definitions.Stage != ShaderStage.Compute ? 1 : 0);
|
||||
bool needsThreadIndex = false;
|
||||
|
||||
// TODO: Replace this with a proper flag
|
||||
if (function.Name.Contains("Shuffle"))
|
||||
{
|
||||
needsThreadIndex = true;
|
||||
additionalArgCount++;
|
||||
}
|
||||
|
||||
string[] args = new string[argCount + additionalArgCount];
|
||||
|
||||
@@ -23,20 +31,30 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
|
||||
args[0] = "in";
|
||||
args[1] = "constant_buffers";
|
||||
args[2] = "storage_buffers";
|
||||
|
||||
if (needsThreadIndex)
|
||||
{
|
||||
args[3] = "thread_index_in_simdgroup";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
args[0] = "constant_buffers";
|
||||
args[1] = "storage_buffers";
|
||||
|
||||
if (needsThreadIndex)
|
||||
{
|
||||
args[2] = "thread_index_in_simdgroup";
|
||||
}
|
||||
}
|
||||
|
||||
int argIndex = additionalArgCount;
|
||||
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), function.GetArgumentType(i));
|
||||
}
|
||||
|
||||
return $"{functon.Name}({string.Join(", ", args)})";
|
||||
return $"{function.Name}({string.Join(", ", args)})";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user