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