mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-03-22 14:40:18 +00:00
* Stuff * More arg buffer stuff * Fixes * Rebase * Pass storage buffers to inline functions * Fix binding * Fix typo + Fix a couple shaders * Enforce ids * Dispose * Mark used buffers as resident * Update depth clear shader * Fix non-contiguous struct defs * Update ChangeBufferStride * Fix StorageBuffer assignments * Fix odyssey crash * Retain buffer bindings * Pad Std140 * Set texture data with safe buffers * Clone buffers * Always declare vert in * Stop clears from breaking OpenGL games * Fix depth clear * Use invariant position * Horribly inefficient texture & sampler arg buffers * Fix missing struct access * Minimise rebinds as much as possible * Build arg buffers on staging buffer
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
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);
|
|
|
|
int argCount = operation.SourcesCount - 1;
|
|
int additionalArgCount = CodeGenContext.AdditionalArgCount + (context.Definitions.Stage != ShaderStage.Compute ? 1 : 0);
|
|
|
|
string[] args = new string[argCount + additionalArgCount];
|
|
|
|
// Additional arguments
|
|
if (context.Definitions.Stage != ShaderStage.Compute)
|
|
{
|
|
args[0] = "in";
|
|
args[1] = "constant_buffers";
|
|
args[2] = "storage_buffers";
|
|
}
|
|
else
|
|
{
|
|
args[0] = "constant_buffers";
|
|
args[1] = "storage_buffers";
|
|
}
|
|
|
|
int argIndex = additionalArgCount;
|
|
for (int i = 0; i < argCount; i++)
|
|
{
|
|
args[argIndex++] = GetSourceExpr(context, operation.GetSource(i + 1), functon.GetArgumentType(i));
|
|
}
|
|
|
|
return $"{functon.Name}({string.Join(", ", args)})";
|
|
}
|
|
}
|
|
}
|