Back to where we were
This commit is contained in:
parent
5bddbdf791
commit
f4c17aa526
2 changed files with 29 additions and 24 deletions
|
@ -3,6 +3,7 @@ using Ryujinx.Graphics.Shader.StructuredIr;
|
|||
using Ryujinx.Graphics.Shader.Translation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
|
@ -23,7 +24,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
|
|||
|
||||
}
|
||||
|
||||
// DeclareInputAttributes(context, info.IoDefinitions.Where(x => IsUserDefined(x, StorageKind.Input)));
|
||||
DeclareInputAttributes(context, info.IoDefinitions.Where(x => IsUserDefined(x, StorageKind.Input)));
|
||||
}
|
||||
|
||||
static bool IsUserDefined(IoDefinition ioDefinition, StorageKind storageKind)
|
||||
|
@ -66,28 +67,30 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl
|
|||
};
|
||||
}
|
||||
|
||||
// TODO: Redo for new Shader IR rep
|
||||
// private static void DeclareInputAttributes(CodeGenContext context, IEnumerable<IoDefinition> inputs)
|
||||
// {
|
||||
// if (context.AttributeUsage.UsedInputAttributes != 0)
|
||||
// {
|
||||
// context.AppendLine("struct VertexIn");
|
||||
// context.EnterScope();
|
||||
//
|
||||
// int usedAttributes = context.AttributeUsage.UsedInputAttributes | context.AttributeUsage.PassthroughAttributes;
|
||||
// while (usedAttributes != 0)
|
||||
// {
|
||||
// int index = BitOperations.TrailingZeroCount(usedAttributes);
|
||||
//
|
||||
// string name = $"{DefaultNames.IAttributePrefix}{index}";
|
||||
// var type = context.AttributeUsage.get .QueryAttributeType(index).ToVec4Type(TargetLanguage.Msl);
|
||||
// context.AppendLine($"{type} {name} [[attribute({index})]];");
|
||||
//
|
||||
// usedAttributes &= ~(1 << index);
|
||||
// }
|
||||
//
|
||||
// context.LeaveScope(";");
|
||||
// }
|
||||
// }
|
||||
private static void DeclareInputAttributes(CodeGenContext context, IEnumerable<IoDefinition> inputs)
|
||||
{
|
||||
if (context.Definitions.IaIndexing)
|
||||
{
|
||||
// Not handled
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inputs.Any())
|
||||
{
|
||||
context.AppendLine("struct VertexIn");
|
||||
context.EnterScope();
|
||||
|
||||
foreach (var ioDefinition in inputs.OrderBy(x => x.Location))
|
||||
{
|
||||
string type = GetVarTypeName(context, context.Definitions.GetUserDefinedType(ioDefinition.Location, isOutput: false));
|
||||
string name = $"{DefaultNames.IAttributePrefix}{ioDefinition.Location}";
|
||||
|
||||
context.AppendLine($"{type} {name} [[attribute({ioDefinition.Location})]];");
|
||||
}
|
||||
|
||||
context.LeaveScope(";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
using Ryujinx.Graphics.Shader.CodeGen;
|
||||
using Ryujinx.Graphics.Shader.CodeGen.Glsl;
|
||||
using Ryujinx.Graphics.Shader.CodeGen.Msl;
|
||||
using Ryujinx.Graphics.Shader.CodeGen.Spirv;
|
||||
using Ryujinx.Graphics.Shader.Decoders;
|
||||
using Ryujinx.Graphics.Shader.IntermediateRepresentation;
|
||||
|
@ -372,6 +373,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||
{
|
||||
TargetLanguage.Glsl => new ShaderProgram(info, TargetLanguage.Glsl, GlslGenerator.Generate(sInfo, parameters)),
|
||||
TargetLanguage.Spirv => new ShaderProgram(info, TargetLanguage.Spirv, SpirvGenerator.Generate(sInfo, parameters)),
|
||||
TargetLanguage.Msl => new ShaderProgram(info, TargetLanguage.Msl, MslGenerator.Generate(sInfo, parameters)),
|
||||
_ => throw new NotImplementedException(Options.TargetLanguage.ToString()),
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue