Compare commits

..

1 commit

Author SHA1 Message Date
Marco Carvalho
c1e5fe8098
Merge a382c86632 into 8e00cb5232 2024-12-16 11:01:45 -03:00
15 changed files with 91 additions and 105 deletions

View file

@ -1,5 +1,4 @@
using ARMeilleure.Common; using ARMeilleure.Common;
using System;
namespace ARMeilleure.Decoders namespace ARMeilleure.Decoders
{ {
@ -150,7 +149,7 @@ namespace ARMeilleure.Decoders
return (((long)opCode << 45) >> 48) & ~3; return (((long)opCode << 45) >> 48) & ~3;
} }
public static bool VectorArgumentsInvalid(bool q, params ReadOnlySpan<int> args) public static bool VectorArgumentsInvalid(bool q, params int[] args)
{ {
if (q) if (q)
{ {

View file

@ -264,7 +264,7 @@ namespace ARMeilleure.Instructions
return TblOrTbx(dest, vector, bytes, tb0, tb1, tb2, tb3); return TblOrTbx(dest, vector, bytes, tb0, tb1, tb2, tb3);
} }
private static V128 TblOrTbx(V128 dest, V128 vector, int bytes, params ReadOnlySpan<V128> tb) private static V128 TblOrTbx(V128 dest, V128 vector, int bytes, params V128[] tb)
{ {
byte[] res = new byte[16]; byte[] res = new byte[16];

View file

@ -337,7 +337,7 @@ namespace ARMeilleure.IntermediateRepresentation
return result; return result;
} }
public static Operation Operation(Intrinsic intrin, Operand dest, params ReadOnlySpan<Operand> srcs) public static Operation Operation(Intrinsic intrin, Operand dest, params Operand[] srcs)
{ {
Operation result = Make(Instruction.Extended, 0, srcs.Length); Operation result = Make(Instruction.Extended, 0, srcs.Length);

View file

@ -559,27 +559,27 @@ namespace ARMeilleure.Translation
return dest; return dest;
} }
public Operand AddIntrinsic(Intrinsic intrin, params ReadOnlySpan<Operand> args) public Operand AddIntrinsic(Intrinsic intrin, params Operand[] args)
{ {
return Add(intrin, Local(OperandType.V128), args); return Add(intrin, Local(OperandType.V128), args);
} }
public Operand AddIntrinsicInt(Intrinsic intrin, params ReadOnlySpan<Operand> args) public Operand AddIntrinsicInt(Intrinsic intrin, params Operand[] args)
{ {
return Add(intrin, Local(OperandType.I32), args); return Add(intrin, Local(OperandType.I32), args);
} }
public Operand AddIntrinsicLong(Intrinsic intrin, params ReadOnlySpan<Operand> args) public Operand AddIntrinsicLong(Intrinsic intrin, params Operand[] args)
{ {
return Add(intrin, Local(OperandType.I64), args); return Add(intrin, Local(OperandType.I64), args);
} }
public void AddIntrinsicNoRet(Intrinsic intrin, params ReadOnlySpan<Operand> args) public void AddIntrinsicNoRet(Intrinsic intrin, params Operand[] args)
{ {
Add(intrin, default, args); Add(intrin, default, args);
} }
private Operand Add(Intrinsic intrin, Operand dest, params ReadOnlySpan<Operand> sources) private Operand Add(Intrinsic intrin, Operand dest, params Operand[] sources)
{ {
NewNextBlockIfNeeded(); NewNextBlockIfNeeded();

View file

@ -478,7 +478,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
bool skipContext, bool skipContext,
int spillBaseOffset, int spillBaseOffset,
int? resultRegister, int? resultRegister,
params ReadOnlySpan<ulong> callArgs) params ulong[] callArgs)
{ {
uint resultMask = 0u; uint resultMask = 0u;

View file

@ -417,7 +417,7 @@ namespace Ryujinx.Cpu.LightningJit.Arm64.Target.Arm64
nint funcPtr, nint funcPtr,
int spillBaseOffset, int spillBaseOffset,
int? resultRegister, int? resultRegister,
params ReadOnlySpan<ulong> callArgs) params ulong[] callArgs)
{ {
uint resultMask = 0u; uint resultMask = 0u;

View file

@ -721,7 +721,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <param name="format">The format of the texture</param> /// <param name="format">The format of the texture</param>
/// <param name="components">The texture swizzle components</param> /// <param name="components">The texture swizzle components</param>
/// <returns>The depth-stencil mode</returns> /// <returns>The depth-stencil mode</returns>
private static DepthStencilMode GetDepthStencilMode(Format format, params ReadOnlySpan<SwizzleComponent> components) private static DepthStencilMode GetDepthStencilMode(Format format, params SwizzleComponent[] components)
{ {
// R = Depth, G = Stencil. // R = Depth, G = Stencil.
// On 24-bits depth formats, this is inverted (Stencil is R etc). // On 24-bits depth formats, this is inverted (Stencil is R etc).

View file

@ -68,7 +68,7 @@ namespace Ryujinx.Graphics.Vulkan
_optimalTable = new FormatFeatureFlags[totalFormats]; _optimalTable = new FormatFeatureFlags[totalFormats];
} }
public bool BufferFormatsSupport(FormatFeatureFlags flags, params ReadOnlySpan<Format> formats) public bool BufferFormatsSupport(FormatFeatureFlags flags, params Format[] formats)
{ {
foreach (Format format in formats) foreach (Format format in formats)
{ {
@ -81,7 +81,7 @@ namespace Ryujinx.Graphics.Vulkan
return true; return true;
} }
public bool OptimalFormatsSupport(FormatFeatureFlags flags, params ReadOnlySpan<Format> formats) public bool OptimalFormatsSupport(FormatFeatureFlags flags, params Format[] formats)
{ {
foreach (Format format in formats) foreach (Format format in formats)
{ {

View file

@ -403,7 +403,7 @@ namespace Ryujinx.HLE.HOS
} }
// Assumes searchDirPaths don't overlap // Assumes searchDirPaths don't overlap
private static void CollectMods(Dictionary<ulong, ModCache> modCaches, PatchCache patches, params ReadOnlySpan<string> searchDirPaths) private static void CollectMods(Dictionary<ulong, ModCache> modCaches, PatchCache patches, params string[] searchDirPaths)
{ {
static bool IsPatchesDir(string name) => StrEquals(AmsNsoPatchDir, name) || static bool IsPatchesDir(string name) => StrEquals(AmsNsoPatchDir, name) ||
StrEquals(AmsNroPatchDir, name) || StrEquals(AmsNroPatchDir, name) ||
@ -453,7 +453,7 @@ namespace Ryujinx.HLE.HOS
patches.Initialized = true; patches.Initialized = true;
} }
public void CollectMods(IEnumerable<ulong> applications, params ReadOnlySpan<string> searchDirPaths) public void CollectMods(IEnumerable<ulong> applications, params string[] searchDirPaths)
{ {
Clear(); Clear();
@ -680,7 +680,7 @@ namespace Ryujinx.HLE.HOS
ApplyProgramPatches(nroPatches, 0, nro); ApplyProgramPatches(nroPatches, 0, nro);
} }
internal bool ApplyNsoPatches(ulong applicationId, params ReadOnlySpan<IExecutable> programs) internal bool ApplyNsoPatches(ulong applicationId, params IExecutable[] programs)
{ {
IEnumerable<Mod<DirectoryInfo>> nsoMods = _patches.NsoPatches; IEnumerable<Mod<DirectoryInfo>> nsoMods = _patches.NsoPatches;
@ -744,7 +744,7 @@ namespace Ryujinx.HLE.HOS
} }
} }
private static bool ApplyProgramPatches(IEnumerable<Mod<DirectoryInfo>> mods, int protectedOffset, params ReadOnlySpan<IExecutable> programs) private static bool ApplyProgramPatches(IEnumerable<Mod<DirectoryInfo>> mods, int protectedOffset, params IExecutable[] programs)
{ {
int count = 0; int count = 0;
@ -755,18 +755,12 @@ namespace Ryujinx.HLE.HOS
patches[i] = new MemPatch(); patches[i] = new MemPatch();
} }
var buildIds = new List<string>(programs.Length); var buildIds = programs.Select(p => p switch
foreach (IExecutable p in programs)
{ {
var buildId = p switch NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()).TrimEnd('0'),
{ NroExecutable nro => Convert.ToHexString(nro.Header.BuildId).TrimEnd('0'),
NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()).TrimEnd('0'), _ => string.Empty,
NroExecutable nro => Convert.ToHexString(nro.Header.BuildId).TrimEnd('0'), }).ToList();
_ => string.Empty,
};
buildIds.Add(buildId);
}
int GetIndex(string buildId) => buildIds.FindIndex(id => id == buildId); // O(n) but list is small int GetIndex(string buildId) => buildIds.FindIndex(id => id == buildId); // O(n) but list is small

View file

@ -123,7 +123,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
return true; return true;
} }
public void Configure(params ReadOnlySpan<ControllerConfig> configs) public void Configure(params ControllerConfig[] configs)
{ {
_configuredTypes = new ControllerType[MaxControllers]; _configuredTypes = new ControllerType[MaxControllers];

View file

@ -8,7 +8,7 @@ namespace Ryujinx.HLE.HOS.Services.Hid
{ {
public TouchDevice(Switch device, bool active) : base(device, active) { } public TouchDevice(Switch device, bool active) : base(device, active) { }
public void Update(params ReadOnlySpan<TouchPoint> points) public void Update(params TouchPoint[] points)
{ {
ref RingLifo<TouchScreenState> lifo = ref _device.Hid.SharedMemory.TouchScreen; ref RingLifo<TouchScreenState> lifo = ref _device.Hid.SharedMemory.TouchScreen;

View file

@ -231,7 +231,7 @@ namespace Ryujinx.HLE.Loaders.Processes
ulong programId, ulong programId,
byte programIndex, byte programIndex,
byte[] arguments = null, byte[] arguments = null,
params ReadOnlySpan<IExecutable> executables) params IExecutable[] executables)
{ {
context.Device.System.ServiceTable.WaitServicesReady(); context.Device.System.ServiceTable.WaitServicesReady();
@ -251,17 +251,12 @@ namespace Ryujinx.HLE.Loaders.Processes
ulong codeStart = ((meta.Flags & 1) != 0 ? 0x8000000UL : 0x200000UL) + CodeStartOffset; ulong codeStart = ((meta.Flags & 1) != 0 ? 0x8000000UL : 0x200000UL) + CodeStartOffset;
uint codeSize = 0; uint codeSize = 0;
var buildIds = new string[executables.Length]; var buildIds = executables.Select(e => (e switch
for (int i = 0; i < executables.Length; i++)
{ {
buildIds[i] = (executables[i] switch NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()),
{ NroExecutable nro => Convert.ToHexString(nro.Header.BuildId),
NsoExecutable nso => Convert.ToHexString(nso.BuildId.ItemsRo.ToArray()), _ => string.Empty
NroExecutable nro => Convert.ToHexString(nro.Header.BuildId), }).ToUpper());
_ => string.Empty
}).ToUpper();
}
ulong[] nsoBase = new ulong[executables.Length]; ulong[] nsoBase = new ulong[executables.Length];

View file

@ -26,7 +26,6 @@
// IN THE MATERIALS. // IN THE MATERIALS.
#endregion #endregion
using System;
using static Spv.Specification; using static Spv.Specification;
namespace Spv.Generator namespace Spv.Generator
@ -193,7 +192,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction Decorate(Instruction target, Decoration decoration, params ReadOnlySpan<IOperand> parameters) public Instruction Decorate(Instruction target, Decoration decoration, params IOperand[] parameters)
{ {
Instruction result = NewInstruction(Op.OpDecorate); Instruction result = NewInstruction(Op.OpDecorate);
@ -230,7 +229,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction MemberDecorate(Instruction structureType, LiteralInteger member, Decoration decoration, params ReadOnlySpan<IOperand> parameters) public Instruction MemberDecorate(Instruction structureType, LiteralInteger member, Decoration decoration, params IOperand[] parameters)
{ {
Instruction result = NewInstruction(Op.OpMemberDecorate); Instruction result = NewInstruction(Op.OpMemberDecorate);
@ -252,7 +251,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction GroupDecorate(Instruction decorationGroup, params ReadOnlySpan<Instruction> targets) public Instruction GroupDecorate(Instruction decorationGroup, params Instruction[] targets)
{ {
Instruction result = NewInstruction(Op.OpGroupDecorate); Instruction result = NewInstruction(Op.OpGroupDecorate);
@ -263,7 +262,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction GroupMemberDecorate(Instruction decorationGroup, params ReadOnlySpan<IOperand> targets) public Instruction GroupMemberDecorate(Instruction decorationGroup, params IOperand[] targets)
{ {
Instruction result = NewInstruction(Op.OpGroupMemberDecorate); Instruction result = NewInstruction(Op.OpGroupMemberDecorate);
@ -274,7 +273,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction DecorateId(Instruction target, Decoration decoration, params ReadOnlySpan<IOperand> parameters) public Instruction DecorateId(Instruction target, Decoration decoration, params IOperand[] parameters)
{ {
Instruction result = NewInstruction(Op.OpDecorateId); Instruction result = NewInstruction(Op.OpDecorateId);
@ -286,7 +285,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction DecorateString(Instruction target, Decoration decoration, params ReadOnlySpan<IOperand> parameters) public Instruction DecorateString(Instruction target, Decoration decoration, params IOperand[] parameters)
{ {
Instruction result = NewInstruction(Op.OpDecorateString); Instruction result = NewInstruction(Op.OpDecorateString);
@ -298,7 +297,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction DecorateStringGOOGLE(Instruction target, Decoration decoration, params ReadOnlySpan<IOperand> parameters) public Instruction DecorateStringGOOGLE(Instruction target, Decoration decoration, params IOperand[] parameters)
{ {
Instruction result = NewInstruction(Op.OpDecorateStringGOOGLE); Instruction result = NewInstruction(Op.OpDecorateStringGOOGLE);
@ -310,7 +309,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction MemberDecorateString(Instruction structType, LiteralInteger member, Decoration decoration, params ReadOnlySpan<IOperand> parameters) public Instruction MemberDecorateString(Instruction structType, LiteralInteger member, Decoration decoration, params IOperand[] parameters)
{ {
Instruction result = NewInstruction(Op.OpMemberDecorateString); Instruction result = NewInstruction(Op.OpMemberDecorateString);
@ -323,7 +322,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction MemberDecorateStringGOOGLE(Instruction structType, LiteralInteger member, Decoration decoration, params ReadOnlySpan<IOperand> parameters) public Instruction MemberDecorateStringGOOGLE(Instruction structType, LiteralInteger member, Decoration decoration, params IOperand[] parameters)
{ {
Instruction result = NewInstruction(Op.OpMemberDecorateStringGOOGLE); Instruction result = NewInstruction(Op.OpMemberDecorateStringGOOGLE);
@ -459,7 +458,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction TypeStruct(bool forceIdAllocation, params ReadOnlySpan<Instruction> parameters) public Instruction TypeStruct(bool forceIdAllocation, params Instruction[] parameters)
{ {
Instruction result = NewInstruction(Op.OpTypeStruct); Instruction result = NewInstruction(Op.OpTypeStruct);
@ -490,7 +489,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction TypeFunction(Instruction returnType, bool forceIdAllocation, params ReadOnlySpan<Instruction> parameters) public Instruction TypeFunction(Instruction returnType, bool forceIdAllocation, params Instruction[] parameters)
{ {
Instruction result = NewInstruction(Op.OpTypeFunction); Instruction result = NewInstruction(Op.OpTypeFunction);
@ -606,7 +605,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ConstantComposite(Instruction resultType, params ReadOnlySpan<Instruction> constituents) public Instruction ConstantComposite(Instruction resultType, params Instruction[] constituents)
{ {
Instruction result = NewInstruction(Op.OpConstantComposite, Instruction.InvalidId, resultType); Instruction result = NewInstruction(Op.OpConstantComposite, Instruction.InvalidId, resultType);
@ -665,7 +664,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction SpecConstantComposite(Instruction resultType, params ReadOnlySpan<Instruction> constituents) public Instruction SpecConstantComposite(Instruction resultType, params Instruction[] constituents)
{ {
Instruction result = NewInstruction(Op.OpSpecConstantComposite, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpSpecConstantComposite, GetNewId(), resultType);
@ -815,7 +814,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction AccessChain(Instruction resultType, Instruction baseObj, params ReadOnlySpan<Instruction> indexes) public Instruction AccessChain(Instruction resultType, Instruction baseObj, params Instruction[] indexes)
{ {
Instruction result = NewInstruction(Op.OpAccessChain, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpAccessChain, GetNewId(), resultType);
@ -826,7 +825,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction InBoundsAccessChain(Instruction resultType, Instruction baseObj, params ReadOnlySpan<Instruction> indexes) public Instruction InBoundsAccessChain(Instruction resultType, Instruction baseObj, params Instruction[] indexes)
{ {
Instruction result = NewInstruction(Op.OpInBoundsAccessChain, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpInBoundsAccessChain, GetNewId(), resultType);
@ -837,7 +836,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction PtrAccessChain(Instruction resultType, Instruction baseObj, Instruction element, params ReadOnlySpan<Instruction> indexes) public Instruction PtrAccessChain(Instruction resultType, Instruction baseObj, Instruction element, params Instruction[] indexes)
{ {
Instruction result = NewInstruction(Op.OpPtrAccessChain, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpPtrAccessChain, GetNewId(), resultType);
@ -870,7 +869,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction InBoundsPtrAccessChain(Instruction resultType, Instruction baseObj, Instruction element, params ReadOnlySpan<Instruction> indexes) public Instruction InBoundsPtrAccessChain(Instruction resultType, Instruction baseObj, Instruction element, params Instruction[] indexes)
{ {
Instruction result = NewInstruction(Op.OpInBoundsPtrAccessChain, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpInBoundsPtrAccessChain, GetNewId(), resultType);
@ -950,7 +949,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction FunctionCall(Instruction resultType, Instruction function, params ReadOnlySpan<Instruction> parameters) public Instruction FunctionCall(Instruction resultType, Instruction function, params Instruction[] parameters)
{ {
Instruction result = NewInstruction(Op.OpFunctionCall, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpFunctionCall, GetNewId(), resultType);
@ -974,7 +973,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSampleImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSampleImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSampleImplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSampleImplicitLod, GetNewId(), resultType);
@ -993,7 +992,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSampleExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSampleExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSampleExplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSampleExplicitLod, GetNewId(), resultType);
@ -1009,7 +1008,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSampleDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSampleDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSampleDrefImplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSampleDrefImplicitLod, GetNewId(), resultType);
@ -1029,7 +1028,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSampleDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSampleDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSampleDrefExplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSampleDrefExplicitLod, GetNewId(), resultType);
@ -1046,7 +1045,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSampleProjImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSampleProjImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSampleProjImplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSampleProjImplicitLod, GetNewId(), resultType);
@ -1065,7 +1064,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSampleProjExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSampleProjExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSampleProjExplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSampleProjExplicitLod, GetNewId(), resultType);
@ -1081,7 +1080,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSampleProjDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSampleProjDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSampleProjDrefImplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSampleProjDrefImplicitLod, GetNewId(), resultType);
@ -1101,7 +1100,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSampleProjDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSampleProjDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSampleProjDrefExplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSampleProjDrefExplicitLod, GetNewId(), resultType);
@ -1118,7 +1117,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageFetch(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageFetch(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageFetch, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageFetch, GetNewId(), resultType);
@ -1137,7 +1136,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction component, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction component, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageGather, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageGather, GetNewId(), resultType);
@ -1157,7 +1156,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageDrefGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageDrefGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageDrefGather, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageDrefGather, GetNewId(), resultType);
@ -1177,7 +1176,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageRead(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageRead(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageRead, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageRead, GetNewId(), resultType);
@ -1196,7 +1195,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageWrite(Instruction image, Instruction coordinate, Instruction texel, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageWrite(Instruction image, Instruction coordinate, Instruction texel, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageWrite); Instruction result = NewInstruction(Op.OpImageWrite);
@ -1298,7 +1297,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSparseSampleImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSparseSampleImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSparseSampleImplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSparseSampleImplicitLod, GetNewId(), resultType);
@ -1317,7 +1316,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSparseSampleExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSparseSampleExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSparseSampleExplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSparseSampleExplicitLod, GetNewId(), resultType);
@ -1333,7 +1332,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSparseSampleDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSparseSampleDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSparseSampleDrefImplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSparseSampleDrefImplicitLod, GetNewId(), resultType);
@ -1353,7 +1352,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSparseSampleDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSparseSampleDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSparseSampleDrefExplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSparseSampleDrefExplicitLod, GetNewId(), resultType);
@ -1370,7 +1369,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSparseSampleProjImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSparseSampleProjImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSparseSampleProjImplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSparseSampleProjImplicitLod, GetNewId(), resultType);
@ -1389,7 +1388,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSparseSampleProjExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSparseSampleProjExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSparseSampleProjExplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSparseSampleProjExplicitLod, GetNewId(), resultType);
@ -1405,7 +1404,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSparseSampleProjDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSparseSampleProjDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSparseSampleProjDrefImplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSparseSampleProjDrefImplicitLod, GetNewId(), resultType);
@ -1425,7 +1424,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSparseSampleProjDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSparseSampleProjDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSparseSampleProjDrefExplicitLod, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSparseSampleProjDrefExplicitLod, GetNewId(), resultType);
@ -1442,7 +1441,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSparseFetch(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSparseFetch(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSparseFetch, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSparseFetch, GetNewId(), resultType);
@ -1461,7 +1460,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSparseGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction component, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSparseGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction component, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSparseGather, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSparseGather, GetNewId(), resultType);
@ -1481,7 +1480,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSparseDrefGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSparseDrefGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSparseDrefGather, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSparseDrefGather, GetNewId(), resultType);
@ -1511,7 +1510,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSparseRead(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSparseRead(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSparseRead, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSparseRead, GetNewId(), resultType);
@ -1530,7 +1529,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSampleFootprintNV(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction granularity, Instruction coarse, ImageOperandsMask imageOperands, params ReadOnlySpan<Instruction> imageOperandIds) public Instruction ImageSampleFootprintNV(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction granularity, Instruction coarse, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = NewInstruction(Op.OpImageSampleFootprintNV, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpImageSampleFootprintNV, GetNewId(), resultType);
@ -1739,7 +1738,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction VectorShuffle(Instruction resultType, Instruction vector1, Instruction vector2, params ReadOnlySpan<LiteralInteger> components) public Instruction VectorShuffle(Instruction resultType, Instruction vector1, Instruction vector2, params LiteralInteger[] components)
{ {
Instruction result = NewInstruction(Op.OpVectorShuffle, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpVectorShuffle, GetNewId(), resultType);
@ -1751,7 +1750,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction CompositeConstruct(Instruction resultType, params ReadOnlySpan<Instruction> constituents) public Instruction CompositeConstruct(Instruction resultType, params Instruction[] constituents)
{ {
Instruction result = NewInstruction(Op.OpCompositeConstruct, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpCompositeConstruct, GetNewId(), resultType);
@ -1761,7 +1760,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction CompositeExtract(Instruction resultType, Instruction composite, params ReadOnlySpan<LiteralInteger> indexes) public Instruction CompositeExtract(Instruction resultType, Instruction composite, params LiteralInteger[] indexes)
{ {
Instruction result = NewInstruction(Op.OpCompositeExtract, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpCompositeExtract, GetNewId(), resultType);
@ -1772,7 +1771,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction CompositeInsert(Instruction resultType, Instruction obj, Instruction composite, params ReadOnlySpan<LiteralInteger> indexes) public Instruction CompositeInsert(Instruction resultType, Instruction obj, Instruction composite, params LiteralInteger[] indexes)
{ {
Instruction result = NewInstruction(Op.OpCompositeInsert, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpCompositeInsert, GetNewId(), resultType);
@ -2753,7 +2752,7 @@ namespace Spv.Generator
// Control-Flow // Control-Flow
public Instruction Phi(Instruction resultType, params ReadOnlySpan<Instruction> parameters) public Instruction Phi(Instruction resultType, params Instruction[] parameters)
{ {
Instruction result = NewInstruction(Op.OpPhi, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpPhi, GetNewId(), resultType);
@ -2803,7 +2802,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction BranchConditional(Instruction condition, Instruction trueLabel, Instruction falseLabel, params ReadOnlySpan<LiteralInteger> branchweights) public Instruction BranchConditional(Instruction condition, Instruction trueLabel, Instruction falseLabel, params LiteralInteger[] branchweights)
{ {
Instruction result = NewInstruction(Op.OpBranchConditional); Instruction result = NewInstruction(Op.OpBranchConditional);
@ -2816,7 +2815,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction Switch(Instruction selector, Instruction defaultObj, params ReadOnlySpan<IOperand> target) public Instruction Switch(Instruction selector, Instruction defaultObj, params IOperand[] target)
{ {
Instruction result = NewInstruction(Op.OpSwitch); Instruction result = NewInstruction(Op.OpSwitch);
@ -3679,7 +3678,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction EnqueueKernel(Instruction resultType, Instruction queue, Instruction flags, Instruction nDRange, Instruction numEvents, Instruction waitEvents, Instruction retEvent, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign, params ReadOnlySpan<Instruction> localSize) public Instruction EnqueueKernel(Instruction resultType, Instruction queue, Instruction flags, Instruction nDRange, Instruction numEvents, Instruction waitEvents, Instruction retEvent, Instruction invoke, Instruction param, Instruction paramSize, Instruction paramAlign, params Instruction[] localSize)
{ {
Instruction result = NewInstruction(Op.OpEnqueueKernel, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpEnqueueKernel, GetNewId(), resultType);
@ -5109,7 +5108,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction LoopControlINTEL(params ReadOnlySpan<LiteralInteger> loopControlParameters) public Instruction LoopControlINTEL(params LiteralInteger[] loopControlParameters)
{ {
Instruction result = NewInstruction(Op.OpLoopControlINTEL); Instruction result = NewInstruction(Op.OpLoopControlINTEL);

View file

@ -64,7 +64,7 @@ namespace Spv.Generator
_operands.Add(value); _operands.Add(value);
} }
public void AddOperand(ReadOnlySpan<IOperand> value) public void AddOperand(IOperand[] value)
{ {
foreach (IOperand instruction in value) foreach (IOperand instruction in value)
{ {
@ -72,7 +72,7 @@ namespace Spv.Generator
} }
} }
public void AddOperand(ReadOnlySpan<LiteralInteger> value) public void AddOperand(LiteralInteger[] value)
{ {
foreach (LiteralInteger instruction in value) foreach (LiteralInteger instruction in value)
{ {
@ -85,7 +85,7 @@ namespace Spv.Generator
AddOperand((IOperand)value); AddOperand((IOperand)value);
} }
public void AddOperand(ReadOnlySpan<Instruction> value) public void AddOperand(Instruction[] value)
{ {
foreach (Instruction instruction in value) foreach (Instruction instruction in value)
{ {

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
@ -133,7 +132,7 @@ namespace Spv.Generator
_typeDeclarationsList.Add(instruction); _typeDeclarationsList.Add(instruction);
} }
public void AddEntryPoint(ExecutionModel executionModel, Instruction function, string name, params ReadOnlySpan<Instruction> interfaces) public void AddEntryPoint(ExecutionModel executionModel, Instruction function, string name, params Instruction[] interfaces)
{ {
Debug.Assert(function.Opcode == Op.OpFunction); Debug.Assert(function.Opcode == Op.OpFunction);
@ -147,7 +146,7 @@ namespace Spv.Generator
_entrypoints.Add(entryPoint); _entrypoints.Add(entryPoint);
} }
public void AddExecutionMode(Instruction function, ExecutionMode mode, params ReadOnlySpan<IOperand> parameters) public void AddExecutionMode(Instruction function, ExecutionMode mode, params IOperand[] parameters)
{ {
Debug.Assert(function.Opcode == Op.OpFunction); Debug.Assert(function.Opcode == Op.OpFunction);
@ -229,7 +228,7 @@ namespace Spv.Generator
_constants.Add(key, constant); _constants.Add(key, constant);
} }
public Instruction ExtInst(Instruction resultType, Instruction set, LiteralInteger instruction, params ReadOnlySpan<IOperand> parameters) public Instruction ExtInst(Instruction resultType, Instruction set, LiteralInteger instruction, params IOperand[] parameters)
{ {
Instruction result = NewInstruction(Op.OpExtInst, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpExtInst, GetNewId(), resultType);
@ -248,7 +247,7 @@ namespace Spv.Generator
} }
// TODO: Find a way to make the auto generate one used. // TODO: Find a way to make the auto generate one used.
public Instruction OpenClPrintf(Instruction resultType, Instruction format, params ReadOnlySpan<Instruction> additionalarguments) public Instruction OpenClPrintf(Instruction resultType, Instruction format, params Instruction[] additionalarguments)
{ {
Instruction result = NewInstruction(Op.OpExtInst, GetNewId(), resultType); Instruction result = NewInstruction(Op.OpExtInst, GetNewId(), resultType);