diff --git a/AssetStudioUtility/AssetStudioUtility.csproj b/AssetStudioUtility/AssetStudioUtility.csproj index 0e1b2fc..91ca111 100644 --- a/AssetStudioUtility/AssetStudioUtility.csproj +++ b/AssetStudioUtility/AssetStudioUtility.csproj @@ -49,6 +49,16 @@ + + + + + + + + + + @@ -57,6 +67,10 @@ + + + + diff --git a/AssetStudioUtility/CSspv/Disassembler.cs b/AssetStudioUtility/CSspv/Disassembler.cs new file mode 100644 index 0000000..19b3cf6 --- /dev/null +++ b/AssetStudioUtility/CSspv/Disassembler.cs @@ -0,0 +1,221 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SpirV +{ + public struct ModuleHeader + { + public Version Version { get; set; } + public string GeneratorVendor { get; set; } + public string GeneratorName { get; set; } + public int GeneratorVersion { get; set; } + public uint Bound { get; set; } + public uint Reserved { get; set; } + } + + [Flags] + public enum DisassemblyOptions + { + None, + ShowTypes, + ShowNames, + Default = ShowTypes | ShowNames + } + + public class Disassembler + { + public string Disassemble (Module module) + { + return Disassemble(module, DisassemblyOptions.Default); + } + + public string Disassemble(Module module, DisassemblyOptions options) + { + m_sb.AppendLine("; SPIR-V"); + m_sb.Append("; Version: ").Append(module.Header.Version).AppendLine(); + if (module.Header.GeneratorName == null) + { + m_sb.Append("; Generator: unknown; ").Append(module.Header.GeneratorVersion).AppendLine(); + } + else + { + m_sb.Append("; Generator: ").Append(module.Header.GeneratorVendor).Append(' '). + Append(module.Header.GeneratorName).Append("; ").Append(module.Header.GeneratorVersion).AppendLine(); + } + m_sb.Append("; Bound: ").Append(module.Header.Bound).AppendLine(); + m_sb.Append("; Schema: ").Append(module.Header.Reserved).AppendLine(); + + string[] lines = new string[module.Instructions.Count + 1]; + lines[0] = m_sb.ToString(); + m_sb.Clear(); + + for (int i = 0; i < module.Instructions.Count; i++) + { + ParsedInstruction instruction = module.Instructions[i]; + PrintInstruction(m_sb, instruction, options); + lines[i + 1] = m_sb.ToString(); + m_sb.Clear(); + } + + int longestPrefix = 0; + for (int i = 0; i < lines.Length; i++) + { + string line = lines[i]; + longestPrefix = Math.Max(longestPrefix, line.IndexOf('=')); + if (longestPrefix > 50) + { + longestPrefix = 50; + break; + } + } + + m_sb.Append(lines[0]); + for (int i = 1; i < lines.Length; i++) + { + string line = lines[i]; + int index = line.IndexOf('='); + if (index == -1) + { + m_sb.Append(' ', longestPrefix + 4); + m_sb.Append(line); + } + else + { + int pad = Math.Max(0, longestPrefix - index); + m_sb.Append(' ', pad); + m_sb.Append(line, 0, index); + m_sb.Append('='); + m_sb.Append(line, index + 1, line.Length - index - 1); + } + m_sb.AppendLine(); + } + + string result = m_sb.ToString(); + m_sb.Clear(); + return result; + } + + private static void PrintInstruction(StringBuilder sb, ParsedInstruction instruction, DisassemblyOptions options) + { + if (instruction.Operands.Count == 0) + { + sb.Append(instruction.Instruction.Name); + return; + } + + int currentOperand = 0; + if (instruction.Instruction.Operands[currentOperand].Type is IdResultType) + { + if (options.HasFlag(DisassemblyOptions.ShowTypes)) + { + instruction.ResultType.ToString(sb).Append(' '); + } + ++currentOperand; + } + + if (currentOperand < instruction.Operands.Count && instruction.Instruction.Operands[currentOperand].Type is IdResult) + { + if (!options.HasFlag(DisassemblyOptions.ShowNames) || string.IsNullOrWhiteSpace(instruction.Name)) + { + PrintOperandValue(sb, instruction.Operands[currentOperand].Value, options); + } + else + { + sb.Append(instruction.Name); + } + sb.Append(" = "); + + ++currentOperand; + } + + sb.Append(instruction.Instruction.Name); + sb.Append(' '); + + for (; currentOperand < instruction.Operands.Count; ++currentOperand) + { + PrintOperandValue(sb, instruction.Operands[currentOperand].Value, options); + sb.Append(' '); + } + } + + private static void PrintOperandValue(StringBuilder sb, object value, DisassemblyOptions options) + { + switch (value) + { + case System.Type t: + sb.Append(t.Name); + break; + + case string s: + { + sb.Append('"'); + sb.Append(s); + sb.Append('"'); + } + break; + + case ObjectReference or: + { + if (options.HasFlag(DisassemblyOptions.ShowNames) && or.Reference != null && !string.IsNullOrWhiteSpace(or.Reference.Name)) + { + sb.Append(or.Reference.Name); + } + else + { + or.ToString(sb); + } + } + break; + + case IBitEnumOperandValue beov: + PrintBitEnumValue(sb, beov, options); + break; + + case IValueEnumOperandValue veov: + PrintValueEnumValue(sb, veov, options); + break; + + case VaryingOperandValue varOpVal: + varOpVal.ToString(sb); + break; + + default: + sb.Append(value); + break; + } + } + + private static void PrintBitEnumValue(StringBuilder sb, IBitEnumOperandValue enumOperandValue, DisassemblyOptions options) + { + foreach (uint key in enumOperandValue.Values.Keys) + { + sb.Append(enumOperandValue.EnumerationType.GetEnumName(key)); + IReadOnlyList value = enumOperandValue.Values[key]; + if (value.Count != 0) + { + sb.Append(' '); + foreach (object v in value) + { + PrintOperandValue(sb, v, options); + } + } + } + } + + private static void PrintValueEnumValue(StringBuilder sb, IValueEnumOperandValue valueOperandValue, DisassemblyOptions options) + { + sb.Append(valueOperandValue.Key); + if (valueOperandValue.Value is IList valueList && valueList.Count > 0) + { + sb.Append(' '); + foreach (object v in valueList) + { + PrintOperandValue(sb, v, options); + } + } + } + + private readonly StringBuilder m_sb = new StringBuilder(); + } +} diff --git a/AssetStudioUtility/CSspv/EnumValuesExtensions.cs b/AssetStudioUtility/CSspv/EnumValuesExtensions.cs new file mode 100644 index 0000000..5aeeded --- /dev/null +++ b/AssetStudioUtility/CSspv/EnumValuesExtensions.cs @@ -0,0 +1,42 @@ +#if NETSTANDARD1_0 || NETSTANDARD1_1 || NETSTANDARD1_2 || NETSTANDARD1_3 || NETSTANDARD1_4 || NETSTANDARD1_5 || NETSTANDARD1_6 +using System; +using System.Linq; +using System.Reflection; + +namespace SpirV +{ + public static class EnumValuesExtensions + { + public static Array GetEnumValues(this System.Type _this) + { + TypeInfo typeInfo = _this.GetTypeInfo (); + if (!typeInfo.IsEnum) { + throw new ArgumentException ("GetEnumValues: Type '" + _this.Name + "' is not an enum"); + } + + return + ( + from field in typeInfo.DeclaredFields + where field.IsLiteral + select field.GetValue (null) + ) + .ToArray(); + } + + public static string GetEnumName(this System.Type _this, object value) + { + TypeInfo typeInfo = _this.GetTypeInfo (); + if (!typeInfo.IsEnum) { + throw new ArgumentException ("GetEnumName: Type '" + _this.Name + "' is not an enum"); + } + return + ( + from field in typeInfo.DeclaredFields + where field.IsLiteral && (uint)field.GetValue(null) == (uint)value + select field.Name + ) + .First(); + } + } +} +#endif \ No newline at end of file diff --git a/AssetStudioUtility/CSspv/Instruction.cs b/AssetStudioUtility/CSspv/Instruction.cs new file mode 100644 index 0000000..34bcb89 --- /dev/null +++ b/AssetStudioUtility/CSspv/Instruction.cs @@ -0,0 +1,51 @@ +using System.Collections.Generic; + +namespace SpirV +{ + public enum OperandQuantifier + { + /// + /// 1 + /// + Default, + /// + /// 0 or 1 + /// + Optional, + /// + /// 0+ + /// + Varying + } + + public class Operand + { + public Operand(OperandType kind, string name, OperandQuantifier quantifier) + { + Name = name; + Type = kind; + Quantifier = quantifier; + } + + public string Name { get; } + public OperandType Type { get; } + public OperandQuantifier Quantifier { get; } + } + + public class Instruction + { + public Instruction (string name) + : this (name, new List ()) + { + } + + public Instruction (string name, IReadOnlyList operands) + { + Operands = operands; + Name = name; + } + + public string Name { get; } + public IReadOnlyList Operands { get; } + } +} diff --git a/AssetStudioUtility/CSspv/LICENSE b/AssetStudioUtility/CSspv/LICENSE new file mode 100644 index 0000000..76fb0d9 --- /dev/null +++ b/AssetStudioUtility/CSspv/LICENSE @@ -0,0 +1,25 @@ +BSD 2-Clause License + +Copyright (c) 2017, Matthäus G. Chajdas +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/AssetStudioUtility/CSspv/Module.cs b/AssetStudioUtility/CSspv/Module.cs new file mode 100644 index 0000000..9c24845 --- /dev/null +++ b/AssetStudioUtility/CSspv/Module.cs @@ -0,0 +1,426 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Runtime.InteropServices; + +namespace SpirV +{ + public class Module + { + [StructLayout(LayoutKind.Explicit)] + private struct FloatUIntUnion + { + [FieldOffset(0)] + public uint Int; + [FieldOffset(0)] + public float Float; + } + + [StructLayout(LayoutKind.Explicit)] + private struct DoubleULongUnion + { + [FieldOffset(0)] + public ulong Long; + [FieldOffset(0)] + public double Double; + } + + public Module(ModuleHeader header, IReadOnlyList instructions) + { + Header = header; + Instructions = instructions; + + Read(Instructions, objects_); + } + + public static bool IsDebugInstruction(ParsedInstruction instruction) + { + return debugInstructions_.Contains(instruction.Instruction.Name); + } + + private static void Read(IReadOnlyList instructions, Dictionary objects) + { + // Debug instructions can be only processed after everything + // else has been parsed, as they may reference types which haven't + // been seen in the file yet + List debugInstructions = new List(); + // Entry points contain forward references + // Those need to be resolved afterwards + List entryPoints = new List(); + + foreach (var instruction in instructions) + { + if (IsDebugInstruction(instruction)) + { + debugInstructions.Add(instruction); + continue; + } + if (instruction.Instruction is OpEntryPoint) + { + entryPoints.Add(instruction); + continue; + } + + if (instruction.Instruction.Name.StartsWith("OpType", StringComparison.Ordinal)) + { + ProcessTypeInstruction(instruction, objects); + } + + instruction.ResolveResultType(objects); + if (instruction.HasResult) + { + objects[instruction.ResultId] = instruction; + } + + switch (instruction.Instruction) + { + // Constants require that the result type has been resolved + case OpSpecConstant sc: + case OpConstant oc: + { + Type t = instruction.ResultType; + Debug.Assert (t != null); + Debug.Assert (t is ScalarType); + + object constant = ConvertConstant(instruction.ResultType as ScalarType, instruction.Words, 3); + instruction.Operands[2].Value = constant; + instruction.Value = constant; + } + break; + } + } + + foreach (ParsedInstruction instruction in debugInstructions) + { + switch (instruction.Instruction) + { + case OpMemberName mn: + { + StructType t = (StructType)objects[instruction.Words[1]].ResultType; + t.SetMemberName((uint)instruction.Operands[1].Value, (string)instruction.Operands[2].Value); + } + break; + + case OpName n: + { + // We skip naming objects we don't know about + ParsedInstruction t = objects[instruction.Words[1]]; + t.Name = (string)instruction.Operands[1].Value; + } + break; + } + } + + foreach (ParsedInstruction instruction in instructions) + { + instruction.ResolveReferences(objects); + } + } + + public static Module ReadFrom(Stream stream) + { + BinaryReader br = new BinaryReader(stream); + Reader reader = new Reader(br); + + uint versionNumber = reader.ReadDWord(); + int majorVersion = (int)(versionNumber >> 16); + int minorVersion = (int)((versionNumber >> 8) & 0xFF); + Version version = new Version(majorVersion, minorVersion); + + uint generatorMagicNumber = reader.ReadDWord(); + int generatorToolId = (int)(generatorMagicNumber >> 16); + string generatorVendor = "unknown"; + string generatorName = null; + + if (Meta.Tools.ContainsKey(generatorToolId)) + { + Meta.ToolInfo toolInfo = Meta.Tools[generatorToolId]; + generatorVendor = toolInfo.Vendor; + if (toolInfo.Name != null) + { + generatorName = toolInfo.Name; + } + } + + // Read header + ModuleHeader header = new ModuleHeader(); + header.Version = version; + header.GeneratorName = generatorName; + header.GeneratorVendor = generatorVendor; + header.GeneratorVersion = (int)(generatorMagicNumber & 0xFFFF); + header.Bound = reader.ReadDWord(); + header.Reserved = reader.ReadDWord(); + + List instructions = new List(); + while (!reader.EndOfStream) + { + uint instructionStart = reader.ReadDWord (); + ushort wordCount = (ushort)(instructionStart >> 16); + int opCode = (int)(instructionStart & 0xFFFF); + + uint[] words = new uint[wordCount]; + words[0] = instructionStart; + for (ushort i = 1; i < wordCount; ++i) + { + words[i] = reader.ReadDWord(); + } + + ParsedInstruction instruction = new ParsedInstruction(opCode, words); + instructions.Add(instruction); + } + + return new Module(header, instructions); + } + + /// + /// Collect types from OpType* instructions + /// + private static void ProcessTypeInstruction(ParsedInstruction i, IReadOnlyDictionary objects) + { + switch (i.Instruction) + { + case OpTypeInt t: + { + i.ResultType = new IntegerType((int)i.Words[2], i.Words[3] == 1u); + } + break; + + case OpTypeFloat t: + { + i.ResultType = new FloatingPointType((int)i.Words[2]); + } + break; + + case OpTypeVector t: + { + i.ResultType = new VectorType((ScalarType)objects[i.Words[2]].ResultType, (int)i.Words[3]); + } + break; + + case OpTypeMatrix t: + { + i.ResultType = new MatrixType((VectorType)objects[i.Words[2]].ResultType, (int)i.Words[3]); + } + break; + + case OpTypeArray t: + { + object constant = objects[i.Words[3]].Value; + int size = 0; + + switch (constant) + { + case ushort u16: + size = u16; + break; + + case uint u32: + size = (int)u32; + break; + + case ulong u64: + size = (int)u64; + break; + + case short i16: + size = i16; + break; + + case int i32: + size = i32; + break; + + case long i64: + size = (int)i64; + break; + } + + i.ResultType = new ArrayType(objects[i.Words[2]].ResultType, size); + } + break; + + case OpTypeRuntimeArray t: + { + i.ResultType = new RuntimeArrayType((Type)objects[i.Words[2]].ResultType); + } + break; + + case OpTypeBool t: + { + i.ResultType = new BoolType(); + } + break; + + case OpTypeOpaque t: + { + i.ResultType = new OpaqueType(); + } + break; + + case OpTypeVoid t: + { + i.ResultType = new VoidType(); + } + break; + + case OpTypeImage t: + { + Type sampledType = objects[i.Operands[1].GetId ()].ResultType; + Dim dim = i.Operands[2].GetSingleEnumValue(); + uint depth = (uint)i.Operands[3].Value; + bool isArray = (uint)i.Operands[4].Value != 0; + bool isMultiSampled = (uint)i.Operands[5].Value != 0; + uint sampled = (uint)i.Operands[6].Value; + ImageFormat imageFormat = i.Operands[7].GetSingleEnumValue(); + + i.ResultType = new ImageType(sampledType, + dim, + (int)depth, isArray, isMultiSampled, + (int)sampled, imageFormat, + i.Operands.Count > 8 ? i.Operands[8].GetSingleEnumValue() : AccessQualifier.ReadOnly); + } + break; + + case OpTypeSampler st: + { + i.ResultType = new SamplerType(); + break; + } + + case OpTypeSampledImage t: + { + i.ResultType = new SampledImageType((ImageType)objects[i.Words[2]].ResultType); + } + break; + + case OpTypeFunction t: + { + List parameterTypes = new List(); + for (int j = 3; j < i.Words.Count; ++j) + { + parameterTypes.Add(objects[i.Words[j]].ResultType); + } + i.ResultType = new FunctionType(objects[i.Words[2]].ResultType, parameterTypes); + } + break; + + case OpTypeForwardPointer t: + { + // We create a normal pointer, but with unspecified type + // This will get resolved later on + i.ResultType = new PointerType((StorageClass)i.Words[2]); + } + break; + + case OpTypePointer t: + { + if (objects.ContainsKey(i.Words[1])) + { + // If there is something present, it must have been + // a forward reference. The storage type must + // match + PointerType pt = (PointerType)i.ResultType; + Debug.Assert (pt != null); + Debug.Assert (pt.StorageClass == (StorageClass)i.Words[2]); + pt.ResolveForwardReference (objects[i.Words[3]].ResultType); + } + else + { + i.ResultType = new PointerType((StorageClass)i.Words[2], objects[i.Words[3]].ResultType); + } + } + break; + + case OpTypeStruct t: + { + List memberTypes = new List(); + for (int j = 2; j < i.Words.Count; ++j) + { + memberTypes.Add(objects[i.Words[j]].ResultType); + } + i.ResultType = new StructType(memberTypes); + } + break; + } + } + + private static object ConvertConstant(ScalarType type, IReadOnlyList words, int index) + { + switch (type) + { + case IntegerType i: + { + if (i.Signed) + { + if (i.Width == 16) + { + return unchecked((short)(words[index])); + } + else if (i.Width == 32) + { + return unchecked((int)(words[index])); + } + else if (i.Width == 64) + { + return unchecked((long)(words[index] | (ulong)(words[index + 1]) << 32)); + } + } + else + { + if (i.Width == 16) + { + return unchecked((ushort)(words[index])); + } + else if (i.Width == 32) + { + return words[index]; + } + else if (i.Width == 64) + { + return words[index] | (ulong)(words[index + 1]) << 32; + } + } + + throw new Exception ("Cannot construct integer literal."); + } + + case FloatingPointType f: + { + if (f.Width == 32) + { + return new FloatUIntUnion { Int = words[0] }.Float; + } + else if (f.Width == 64) + { + return new DoubleULongUnion { Long = (words[index] | (ulong)(words[index + 1]) << 32) }.Double; + } + else + { + throw new Exception("Cannot construct floating point literal."); + } + } + } + + return null; + } + + public ModuleHeader Header { get; } + public IReadOnlyList Instructions { get; } + + private static HashSet debugInstructions_ = new HashSet + { + "OpSourceContinued", + "OpSource", + "OpSourceExtension", + "OpName", + "OpMemberName", + "OpString", + "OpLine", + "OpNoLine", + "OpModuleProcessed" + }; + + private readonly Dictionary objects_ = new Dictionary(); + } +} diff --git a/AssetStudioUtility/CSspv/OperandType.cs b/AssetStudioUtility/CSspv/OperandType.cs new file mode 100644 index 0000000..e30a56c --- /dev/null +++ b/AssetStudioUtility/CSspv/OperandType.cs @@ -0,0 +1,302 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Linq; +using System.Reflection; + +namespace SpirV +{ + public class OperandType + { + public virtual bool ReadValue(IReadOnlyList words, int index, out object value, out int wordsUsed) + { + // This returns the dynamic type + value = GetType(); + wordsUsed = 1; + return true; + } + } + + public class Literal : OperandType + { + } + + public class LiteralNumber : Literal + { + } + + // The SPIR-V JSON file uses only literal integers + public class LiteralInteger : LiteralNumber + { + public override bool ReadValue(IReadOnlyList words, int index, out object value, out int wordsUsed) + { + value = words[index]; + wordsUsed = 1; + return true; + } + } + + public class LiteralString : Literal + { + public override bool ReadValue(IReadOnlyList words, int index, out object value, out int wordsUsed) + { + // This is just a fail-safe -- the loop below must terminate + wordsUsed = 1; + int bytesUsed = 0; + byte[] bytes = new byte[(words.Count - index) * 4]; + for (int i = index; i < words.Count; ++i) + { + uint word = words[i]; + byte b0 = (byte)(word & 0xFF); + if (b0 == 0) + { + break; + } + else + { + bytes[bytesUsed++] = b0; + } + + byte b1 = (byte)((word >> 8) & 0xFF); + if (b1 == 0) + { + break; + } + else + { + bytes[bytesUsed++] = b1; + } + + byte b2 = (byte)((word >> 16) & 0xFF); + if (b2 == 0) + { + break; + } + else + { + bytes[bytesUsed++] = b2; + } + + byte b3 = (byte)(word >> 24); + if (b3 == 0) + { + break; + } + else + { + bytes[bytesUsed++] = b3; + } + wordsUsed++; + } + + value = Encoding.UTF8.GetString(bytes, 0, bytesUsed); + return true; + } + } + + public class LiteralContextDependentNumber : Literal + { + // This is handled during parsing by ConvertConstant + } + + public class LiteralExtInstInteger : Literal + { + public override bool ReadValue(IReadOnlyList words, int index, out object value, out int wordsUsed) + { + value = words[index]; + wordsUsed = 1; + return true; + } + } + + public class LiteralSpecConstantOpInteger : Literal + { + public override bool ReadValue(IReadOnlyList words, int index, out object value, out int wordsUsed) + { + List result = new List(); + for (int i = index; i < words.Count; i++) + { + ObjectReference objRef = new ObjectReference(words[i]); + result.Add(objRef); + } + + value = result; + wordsUsed = words.Count - index; + return true; + } + } + + public class Parameter + { + public virtual IReadOnlyList OperandTypes { get; } + } + + public class ParameterFactory + { + public virtual Parameter CreateParameter(object value) + { + return null; + } + } + + public class EnumType : EnumType + where T : Enum + { + }; + + public class EnumType : OperandType + where T : Enum + where U : ParameterFactory, new () + { + public override bool ReadValue(IReadOnlyList words, int index, out object value, out int wordsUsed) + { + int wordsUsedForParameters = 0; + if (typeof(T).GetTypeInfo().GetCustomAttributes().Any()) + { + Dictionary> result = new Dictionary>(); + foreach (object enumValue in EnumerationType.GetEnumValues()) + { + uint bit = (uint)enumValue; + // bit == 0 and words[0] == 0 handles the 0x0 = None cases + if ((words[index] & bit) != 0 || (bit == 0 && words[index] == 0)) + { + Parameter p = parameterFactory_.CreateParameter(bit); + if (p == null) + { + result.Add(bit, Array.Empty()); + } + else + { + object[] resultItems = new object[p.OperandTypes.Count]; + for (int j = 0; j < p.OperandTypes.Count; ++j) + { + p.OperandTypes[j].ReadValue(words, 1 + wordsUsedForParameters, out object pValue, out int pWordsUsed); + wordsUsedForParameters += pWordsUsed; + resultItems[j] = pValue; + } + result.Add(bit, resultItems); + } + } + } + value = new BitEnumOperandValue(result); + } + else + { + object[] resultItems; + Parameter p = parameterFactory_.CreateParameter(words[index]); + if (p == null) + { + resultItems = Array.Empty(); + } + else + { + resultItems = new object[p.OperandTypes.Count]; + for (int j = 0; j < p.OperandTypes.Count; ++j) + { + p.OperandTypes[j].ReadValue(words, 1 + wordsUsedForParameters, out object pValue, out int pWordsUsed); + wordsUsedForParameters += pWordsUsed; + resultItems[j] = pValue; + } + } + value = new ValueEnumOperandValue((T)(object)words[index], resultItems); + } + + wordsUsed = wordsUsedForParameters + 1; + return true; + } + + public System.Type EnumerationType => typeof(T); + + private U parameterFactory_ = new U(); + } + + public class IdScope : OperandType + { + public override bool ReadValue(IReadOnlyList words, int index, out object value, out int wordsUsed) + { + value = (Scope)words[index]; + wordsUsed = 1; + return true; + } + } + + public class IdMemorySemantics : OperandType + { + public override bool ReadValue(IReadOnlyList words, int index, out object value, out int wordsUsed) + { + value = (MemorySemantics)words[index]; + wordsUsed = 1; + return true; + } + } + + public class IdType : OperandType + { + public override bool ReadValue(IReadOnlyList words, int index, out object value, out int wordsUsed) + { + value = words[index]; + wordsUsed = 1; + return true; + } + } + + public class IdResult : IdType + { + public override bool ReadValue(IReadOnlyList words, int index, out object value, out int wordsUsed) + { + value = new ObjectReference(words[index]); + wordsUsed = 1; + return true; + } + } + + public class IdResultType : IdType + { + } + + public class IdRef : IdType + { + public override bool ReadValue(IReadOnlyList words, int index, out object value, out int wordsUsed) + { + value = new ObjectReference(words[index]); + wordsUsed = 1; + return true; + } + } + + public class PairIdRefIdRef : OperandType + { + public override bool ReadValue(IReadOnlyList words, int index, out object value, out int wordsUsed) + { + ObjectReference variable = new ObjectReference(words[index]); + ObjectReference parent = new ObjectReference(words[index + 1]); + value = new { Variable = variable, Parent = parent }; + wordsUsed = 2; + return true; + } + } + + public class PairIdRefLiteralInteger : OperandType + { + public override bool ReadValue(IReadOnlyList words, int index, out object value, out int wordsUsed) + { + ObjectReference type = new ObjectReference(words[index]); + uint word = words[index + 1]; + value = new { Type = type, Member = word }; + wordsUsed = 2; + return true; + } + } + + public class PairLiteralIntegerIdRef : OperandType + { + public override bool ReadValue(IReadOnlyList words, int index, out object value, out int wordsUsed) + { + uint selector = words[index]; + ObjectReference label = new ObjectReference(words[index + 1]); + value = new { Selector = selector, Label = label }; + wordsUsed = 2; + return true; + } + } +} \ No newline at end of file diff --git a/AssetStudioUtility/CSspv/ParsedInstruction.cs b/AssetStudioUtility/CSspv/ParsedInstruction.cs new file mode 100644 index 0000000..225854c --- /dev/null +++ b/AssetStudioUtility/CSspv/ParsedInstruction.cs @@ -0,0 +1,265 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace SpirV +{ + public class ParsedOperand + { + public ParsedOperand(IReadOnlyList words, int index, int count, object value, Operand operand) + { + uint[] array = new uint[count]; + for (int i = 0; i < count; i++) + { + array[i] = words[index + i]; + } + + Words = array; + Value = value; + Operand = operand; + } + + public T GetSingleEnumValue() + where T : Enum + { + IValueEnumOperandValue v = (IValueEnumOperandValue)Value; + if (v.Value.Count == 0) + { + // If there's no value at all, the enum is probably something like ImageFormat. + // In which case we just return the enum value + return (T)v.Key; + } + else + { + // This means the enum has a value attached to it, so we return the attached value + return (T)((IValueEnumOperandValue)Value).Value[0]; + } + } + + public uint GetId() + { + return ((ObjectReference)Value).Id; + } + + public T GetBitEnumValue() + where T : Enum + { + var v = Value as IBitEnumOperandValue; + + uint result = 0; + foreach (var k in v.Values.Keys) + { + result |= k; + } + + return (T)(object)result; + } + + public IReadOnlyList Words { get; } + public object Value { get; set; } + public Operand Operand { get; } + } + + public class VaryingOperandValue + { + public VaryingOperandValue(IReadOnlyList values) + { + Values = values; + } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + ToString(sb); + return sb.ToString(); + } + + public StringBuilder ToString(StringBuilder sb) + { + for (int i = 0; i < Values.Count; ++i) + { + if (Values[i] is ObjectReference objRef) + { + objRef.ToString(sb); + } + else + { + sb.Append(Values[i]); + } + if (i < (Values.Count - 1)) + { + sb.Append(' '); + } + } + return sb; + } + + public IReadOnlyList Values { get; } + } + + public interface IEnumOperandValue + { + System.Type EnumerationType { get; } + } + + public interface IBitEnumOperandValue : IEnumOperandValue + { + IReadOnlyDictionary> Values { get; } + } + + public interface IValueEnumOperandValue : IEnumOperandValue + { + object Key { get; } + IReadOnlyList Value { get; } + } + + public class ValueEnumOperandValue : IValueEnumOperandValue + where T : Enum + { + public ValueEnumOperandValue(T key, IReadOnlyList value) + { + Key = key; + Value = value; + } + + public System.Type EnumerationType => typeof(T); + public object Key { get; } + public IReadOnlyList Value { get; } + } + + public class BitEnumOperandValue : IBitEnumOperandValue + where T : Enum + { + public BitEnumOperandValue(Dictionary> values) + { + Values = values; + } + + public IReadOnlyDictionary> Values { get; } + public System.Type EnumerationType => typeof(T); + } + + public class ObjectReference + { + public ObjectReference(uint id) + { + Id = id; + } + + public void Resolve(IReadOnlyDictionary objects) + { + Reference = objects[Id]; + } + + public override string ToString() + { + return $"%{Id}"; + } + + public StringBuilder ToString(StringBuilder sb) + { + return sb.Append('%').Append(Id); + } + + public uint Id { get; } + public ParsedInstruction Reference { get; private set; } + } + + public class ParsedInstruction + { + public ParsedInstruction(int opCode, IReadOnlyList words) + { + Words = words; + Instruction = Instructions.OpcodeToInstruction[opCode]; + ParseOperands(); + } + + private void ParseOperands() + { + if (Instruction.Operands.Count == 0) + { + return; + } + + // Word 0 describes this instruction so we can ignore it + int currentWord = 1; + int currentOperand = 0; + List varyingOperandValues = new List(); + int varyingWordStart = 0; + Operand varyingOperand = null; + + while (currentWord < Words.Count) + { + Operand operand = Instruction.Operands[currentOperand]; + operand.Type.ReadValue(Words, currentWord, out object value, out int wordsUsed); + if (operand.Quantifier == OperandQuantifier.Varying) + { + varyingOperandValues.Add(value); + varyingWordStart = currentWord; + varyingOperand = operand; + } + else + { + int wordCount = Math.Min(Words.Count - currentWord, wordsUsed); + ParsedOperand parsedOperand = new ParsedOperand(Words, currentWord, wordCount, value, operand); + Operands.Add(parsedOperand); + } + + currentWord += wordsUsed; + if (operand.Quantifier != OperandQuantifier.Varying) + { + ++currentOperand; + } + } + + if (varyingOperand != null) + { + VaryingOperandValue varOperantValue = new VaryingOperandValue(varyingOperandValues); + ParsedOperand parsedOperand = new ParsedOperand(Words, currentWord, Words.Count - currentWord, varOperantValue, varyingOperand); + Operands.Add(parsedOperand); + } + } + + public void ResolveResultType(IReadOnlyDictionary objects) + { + if (Instruction.Operands.Count > 0 && Instruction.Operands[0].Type is IdResultType) + { + ResultType = objects[(uint)Operands[0].Value].ResultType; + } + } + + public void ResolveReferences (IReadOnlyDictionary objects) + { + foreach (var operand in Operands) + { + if (operand.Value is ObjectReference objectReference) + { + objectReference.Resolve (objects); + } + } + } + + public Type ResultType { get; set; } + public uint ResultId + { + get + { + for (int i = 0; i < Instruction.Operands.Count; ++i) + { + if (Instruction.Operands[i].Type is IdResult) + { + return Operands[i].GetId(); + } + } + return 0; + } + } + public bool HasResult => ResultId != 0; + + public IReadOnlyList Words { get; } + public Instruction Instruction { get; } + public IList Operands { get; } = new List(); + public string Name { get; set; } + public object Value { get; set; } + } +} diff --git a/AssetStudioUtility/CSspv/Reader.cs b/AssetStudioUtility/CSspv/Reader.cs new file mode 100644 index 0000000..8b2aa7e --- /dev/null +++ b/AssetStudioUtility/CSspv/Reader.cs @@ -0,0 +1,50 @@ +using System; +using System.IO; +using System.Runtime.CompilerServices; + +namespace SpirV +{ + internal sealed class Reader + { + public Reader(BinaryReader reader) + { + reader_ = reader; + uint magicNumber = reader_.ReadUInt32(); + if (magicNumber == Meta.MagicNumber) + { + littleEndian_ = true; + } + else if (Reverse(magicNumber) == Meta.MagicNumber) + { + littleEndian_ = false; + } + else + { + throw new Exception("Invalid magic number"); + } + } + + public uint ReadDWord() + { + if (littleEndian_) + { + return reader_.ReadUInt32 (); + } + else + { + return Reverse(reader_.ReadUInt32()); + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static uint Reverse(uint u) + { + return (u << 24) | (u & 0xFF00U) << 8 | (u >> 8) & 0xFF00U | (u >> 24); + } + + public bool EndOfStream => reader_.BaseStream.Position == reader_.BaseStream.Length; + + private readonly BinaryReader reader_; + private readonly bool littleEndian_; + } +} diff --git a/AssetStudioUtility/CSspv/SpirV.Core.Grammar.cs b/AssetStudioUtility/CSspv/SpirV.Core.Grammar.cs new file mode 100644 index 0000000..2c00793 --- /dev/null +++ b/AssetStudioUtility/CSspv/SpirV.Core.Grammar.cs @@ -0,0 +1,3543 @@ +using System; +using System.Collections.Generic; + +namespace SpirV +{ + [Flags] + public enum ImageOperands : uint + { + None = 0, + Bias = 1, + Lod = 2, + Grad = 4, + ConstOffset = 8, + Offset = 16, + ConstOffsets = 32, + Sample = 64, + MinLod = 128, + } + public class ImageOperandsParameterFactory : ParameterFactory + { + public class BiasParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new IdRef(), }; + } + + public class LodParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new IdRef(), }; + } + + public class GradParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new IdRef(), new IdRef(), }; + } + + public class ConstOffsetParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new IdRef(), }; + } + + public class OffsetParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new IdRef(), }; + } + + public class ConstOffsetsParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new IdRef(), }; + } + + public class SampleParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new IdRef(), }; + } + + public class MinLodParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new IdRef(), }; + } + + public override Parameter CreateParameter(object value) + { + switch ((ImageOperands)value) + { + case ImageOperands.Bias: + return new BiasParameter(); + case ImageOperands.Lod: + return new LodParameter(); + case ImageOperands.Grad: + return new GradParameter(); + case ImageOperands.ConstOffset: + return new ConstOffsetParameter(); + case ImageOperands.Offset: + return new OffsetParameter(); + case ImageOperands.ConstOffsets: + return new ConstOffsetsParameter(); + case ImageOperands.Sample: + return new SampleParameter(); + case ImageOperands.MinLod: + return new MinLodParameter(); + } + + return null; + } + } + [Flags] + public enum FPFastMathMode : uint + { + None = 0, + NotNaN = 1, + NotInf = 2, + NSZ = 4, + AllowRecip = 8, + Fast = 16, + } + public class FPFastMathModeParameterFactory : ParameterFactory + { + } + [Flags] + public enum SelectionControl : uint + { + None = 0, + Flatten = 1, + DontFlatten = 2, + } + public class SelectionControlParameterFactory : ParameterFactory + { + } + [Flags] + public enum LoopControl : uint + { + None = 0, + Unroll = 1, + DontUnroll = 2, + DependencyInfinite = 4, + DependencyLength = 8, + } + public class LoopControlParameterFactory : ParameterFactory + { + public class DependencyLengthParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public override Parameter CreateParameter(object value) + { + switch ((LoopControl)value) + { + case LoopControl.DependencyLength: + return new DependencyLengthParameter(); + } + + return null; + } + } + [Flags] + public enum FunctionControl : uint + { + None = 0, + Inline = 1, + DontInline = 2, + Pure = 4, + Const = 8, + } + public class FunctionControlParameterFactory : ParameterFactory + { + } + [Flags] + public enum MemorySemantics : uint + { + Relaxed = 0, + None = 0, + Acquire = 2, + Release = 4, + AcquireRelease = 8, + SequentiallyConsistent = 16, + UniformMemory = 64, + SubgroupMemory = 128, + WorkgroupMemory = 256, + CrossWorkgroupMemory = 512, + AtomicCounterMemory = 1024, + ImageMemory = 2048, + } + public class MemorySemanticsParameterFactory : ParameterFactory + { + } + [Flags] + public enum MemoryAccess : uint + { + None = 0, + Volatile = 1, + Aligned = 2, + Nontemporal = 4, + } + public class MemoryAccessParameterFactory : ParameterFactory + { + public class AlignedParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public override Parameter CreateParameter(object value) + { + switch ((MemoryAccess)value) + { + case MemoryAccess.Aligned: + return new AlignedParameter(); + } + + return null; + } + } + [Flags] + public enum KernelProfilingInfo : uint + { + None = 0, + CmdExecTime = 1, + } + public class KernelProfilingInfoParameterFactory : ParameterFactory + { + } + public enum SourceLanguage : uint + { + Unknown = 0, + ESSL = 1, + GLSL = 2, + OpenCL_C = 3, + OpenCL_CPP = 4, + HLSL = 5, + } + public class SourceLanguageParameterFactory : ParameterFactory + { + } + public enum ExecutionModel : uint + { + Vertex = 0, + TessellationControl = 1, + TessellationEvaluation = 2, + Geometry = 3, + Fragment = 4, + GLCompute = 5, + Kernel = 6, + } + public class ExecutionModelParameterFactory : ParameterFactory + { + } + public enum AddressingModel : uint + { + Logical = 0, + Physical32 = 1, + Physical64 = 2, + } + public class AddressingModelParameterFactory : ParameterFactory + { + } + public enum MemoryModel : uint + { + Simple = 0, + GLSL450 = 1, + OpenCL = 2, + } + public class MemoryModelParameterFactory : ParameterFactory + { + } + public enum ExecutionMode : uint + { + Invocations = 0, + SpacingEqual = 1, + SpacingFractionalEven = 2, + SpacingFractionalOdd = 3, + VertexOrderCw = 4, + VertexOrderCcw = 5, + PixelCenterInteger = 6, + OriginUpperLeft = 7, + OriginLowerLeft = 8, + EarlyFragmentTests = 9, + PointMode = 10, + Xfb = 11, + DepthReplacing = 12, + DepthGreater = 14, + DepthLess = 15, + DepthUnchanged = 16, + LocalSize = 17, + LocalSizeHint = 18, + InputPoints = 19, + InputLines = 20, + InputLinesAdjacency = 21, + Triangles = 22, + InputTrianglesAdjacency = 23, + Quads = 24, + Isolines = 25, + OutputVertices = 26, + OutputPoints = 27, + OutputLineStrip = 28, + OutputTriangleStrip = 29, + VecTypeHint = 30, + ContractionOff = 31, + Initializer = 33, + Finalizer = 34, + SubgroupSize = 35, + SubgroupsPerWorkgroup = 36, + SubgroupsPerWorkgroupId = 37, + LocalSizeId = 38, + LocalSizeHintId = 39, + PostDepthCoverage = 4446, + StencilRefReplacingEXT = 5027, + } + public class ExecutionModeParameterFactory : ParameterFactory + { + public class InvocationsParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class LocalSizeParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), new LiteralInteger(), new LiteralInteger(), }; + } + + public class LocalSizeHintParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), new LiteralInteger(), new LiteralInteger(), }; + } + + public class OutputVerticesParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class VecTypeHintParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class SubgroupSizeParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class SubgroupsPerWorkgroupParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class SubgroupsPerWorkgroupIdParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new IdRef(), }; + } + + public class LocalSizeIdParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new IdRef(), new IdRef(), new IdRef(), }; + } + + public class LocalSizeHintIdParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new IdRef(), }; + } + + public override Parameter CreateParameter(object value) + { + switch ((ExecutionMode)value) + { + case ExecutionMode.Invocations: + return new InvocationsParameter(); + case ExecutionMode.LocalSize: + return new LocalSizeParameter(); + case ExecutionMode.LocalSizeHint: + return new LocalSizeHintParameter(); + case ExecutionMode.OutputVertices: + return new OutputVerticesParameter(); + case ExecutionMode.VecTypeHint: + return new VecTypeHintParameter(); + case ExecutionMode.SubgroupSize: + return new SubgroupSizeParameter(); + case ExecutionMode.SubgroupsPerWorkgroup: + return new SubgroupsPerWorkgroupParameter(); + case ExecutionMode.SubgroupsPerWorkgroupId: + return new SubgroupsPerWorkgroupIdParameter(); + case ExecutionMode.LocalSizeId: + return new LocalSizeIdParameter(); + case ExecutionMode.LocalSizeHintId: + return new LocalSizeHintIdParameter(); + } + + return null; + } + } + public enum StorageClass : uint + { + UniformConstant = 0, + Input = 1, + Uniform = 2, + Output = 3, + Workgroup = 4, + CrossWorkgroup = 5, + Private = 6, + Function = 7, + Generic = 8, + PushConstant = 9, + AtomicCounter = 10, + Image = 11, + StorageBuffer = 12, + } + public class StorageClassParameterFactory : ParameterFactory + { + } + public enum Dim : uint + { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + Cube = 3, + Rect = 4, + Buffer = 5, + SubpassData = 6, + } + public class DimParameterFactory : ParameterFactory + { + } + public enum SamplerAddressingMode : uint + { + None = 0, + ClampToEdge = 1, + Clamp = 2, + Repeat = 3, + RepeatMirrored = 4, + } + public class SamplerAddressingModeParameterFactory : ParameterFactory + { + } + public enum SamplerFilterMode : uint + { + Nearest = 0, + Linear = 1, + } + public class SamplerFilterModeParameterFactory : ParameterFactory + { + } + public enum ImageFormat : uint + { + Unknown = 0, + Rgba32f = 1, + Rgba16f = 2, + R32f = 3, + Rgba8 = 4, + Rgba8Snorm = 5, + Rg32f = 6, + Rg16f = 7, + R11fG11fB10f = 8, + R16f = 9, + Rgba16 = 10, + Rgb10A2 = 11, + Rg16 = 12, + Rg8 = 13, + R16 = 14, + R8 = 15, + Rgba16Snorm = 16, + Rg16Snorm = 17, + Rg8Snorm = 18, + R16Snorm = 19, + R8Snorm = 20, + Rgba32i = 21, + Rgba16i = 22, + Rgba8i = 23, + R32i = 24, + Rg32i = 25, + Rg16i = 26, + Rg8i = 27, + R16i = 28, + R8i = 29, + Rgba32ui = 30, + Rgba16ui = 31, + Rgba8ui = 32, + R32ui = 33, + Rgb10a2ui = 34, + Rg32ui = 35, + Rg16ui = 36, + Rg8ui = 37, + R16ui = 38, + R8ui = 39, + } + public class ImageFormatParameterFactory : ParameterFactory + { + } + public enum ImageChannelOrder : uint + { + R = 0, + A = 1, + RG = 2, + RA = 3, + RGB = 4, + RGBA = 5, + BGRA = 6, + ARGB = 7, + Intensity = 8, + Luminance = 9, + Rx = 10, + RGx = 11, + RGBx = 12, + Depth = 13, + DepthStencil = 14, + sRGB = 15, + sRGBx = 16, + sRGBA = 17, + sBGRA = 18, + ABGR = 19, + } + public class ImageChannelOrderParameterFactory : ParameterFactory + { + } + public enum ImageChannelDataType : uint + { + SnormInt8 = 0, + SnormInt16 = 1, + UnormInt8 = 2, + UnormInt16 = 3, + UnormShort565 = 4, + UnormShort555 = 5, + UnormInt101010 = 6, + SignedInt8 = 7, + SignedInt16 = 8, + SignedInt32 = 9, + UnsignedInt8 = 10, + UnsignedInt16 = 11, + UnsignedInt32 = 12, + HalfFloat = 13, + Float = 14, + UnormInt24 = 15, + UnormInt101010_2 = 16, + } + public class ImageChannelDataTypeParameterFactory : ParameterFactory + { + } + public enum FPRoundingMode : uint + { + RTE = 0, + RTZ = 1, + RTP = 2, + RTN = 3, + } + public class FPRoundingModeParameterFactory : ParameterFactory + { + } + public enum LinkageType : uint + { + Export = 0, + Import = 1, + } + public class LinkageTypeParameterFactory : ParameterFactory + { + } + public enum AccessQualifier : uint + { + ReadOnly = 0, + WriteOnly = 1, + ReadWrite = 2, + } + public class AccessQualifierParameterFactory : ParameterFactory + { + } + public enum FunctionParameterAttribute : uint + { + Zext = 0, + Sext = 1, + ByVal = 2, + Sret = 3, + NoAlias = 4, + NoCapture = 5, + NoWrite = 6, + NoReadWrite = 7, + } + public class FunctionParameterAttributeParameterFactory : ParameterFactory + { + } + public enum Decoration : uint + { + RelaxedPrecision = 0, + SpecId = 1, + Block = 2, + BufferBlock = 3, + RowMajor = 4, + ColMajor = 5, + ArrayStride = 6, + MatrixStride = 7, + GLSLShared = 8, + GLSLPacked = 9, + CPacked = 10, + BuiltIn = 11, + NoPerspective = 13, + Flat = 14, + Patch = 15, + Centroid = 16, + Sample = 17, + Invariant = 18, + Restrict = 19, + Aliased = 20, + Volatile = 21, + Constant = 22, + Coherent = 23, + NonWritable = 24, + NonReadable = 25, + Uniform = 26, + SaturatedConversion = 28, + Stream = 29, + Location = 30, + Component = 31, + Index = 32, + Binding = 33, + DescriptorSet = 34, + Offset = 35, + XfbBuffer = 36, + XfbStride = 37, + FuncParamAttr = 38, + FPRoundingMode = 39, + FPFastMathMode = 40, + LinkageAttributes = 41, + NoContraction = 42, + InputAttachmentIndex = 43, + Alignment = 44, + MaxByteOffset = 45, + AlignmentId = 46, + MaxByteOffsetId = 47, + ExplicitInterpAMD = 4999, + OverrideCoverageNV = 5248, + PassthroughNV = 5250, + ViewportRelativeNV = 5252, + SecondaryViewportRelativeNV = 5256, + } + public class DecorationParameterFactory : ParameterFactory + { + public class SpecIdParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class ArrayStrideParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class MatrixStrideParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class BuiltInParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new EnumType(), }; + } + + public class StreamParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class LocationParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class ComponentParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class IndexParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class BindingParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class DescriptorSetParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class OffsetParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class XfbBufferParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class XfbStrideParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class FuncParamAttrParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new EnumType(), }; + } + + public class FPRoundingModeParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new EnumType(), }; + } + + public class FPFastMathModeParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new EnumType(), }; + } + + public class LinkageAttributesParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralString(), new EnumType(), }; + } + + public class InputAttachmentIndexParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class AlignmentParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class MaxByteOffsetParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public class AlignmentIdParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new IdRef(), }; + } + + public class MaxByteOffsetIdParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new IdRef(), }; + } + + public class SecondaryViewportRelativeNVParameter : Parameter + { + public override IReadOnlyList OperandTypes + { + get => operandTypes_; + } + + private static readonly List operandTypes_ = new List() + {new LiteralInteger(), }; + } + + public override Parameter CreateParameter(object value) + { + switch ((Decoration)value) + { + case Decoration.SpecId: + return new SpecIdParameter(); + case Decoration.ArrayStride: + return new ArrayStrideParameter(); + case Decoration.MatrixStride: + return new MatrixStrideParameter(); + case Decoration.BuiltIn: + return new BuiltInParameter(); + case Decoration.Stream: + return new StreamParameter(); + case Decoration.Location: + return new LocationParameter(); + case Decoration.Component: + return new ComponentParameter(); + case Decoration.Index: + return new IndexParameter(); + case Decoration.Binding: + return new BindingParameter(); + case Decoration.DescriptorSet: + return new DescriptorSetParameter(); + case Decoration.Offset: + return new OffsetParameter(); + case Decoration.XfbBuffer: + return new XfbBufferParameter(); + case Decoration.XfbStride: + return new XfbStrideParameter(); + case Decoration.FuncParamAttr: + return new FuncParamAttrParameter(); + case Decoration.FPRoundingMode: + return new FPRoundingModeParameter(); + case Decoration.FPFastMathMode: + return new FPFastMathModeParameter(); + case Decoration.LinkageAttributes: + return new LinkageAttributesParameter(); + case Decoration.InputAttachmentIndex: + return new InputAttachmentIndexParameter(); + case Decoration.Alignment: + return new AlignmentParameter(); + case Decoration.MaxByteOffset: + return new MaxByteOffsetParameter(); + case Decoration.AlignmentId: + return new AlignmentIdParameter(); + case Decoration.MaxByteOffsetId: + return new MaxByteOffsetIdParameter(); + case Decoration.SecondaryViewportRelativeNV: + return new SecondaryViewportRelativeNVParameter(); + } + + return null; + } + } + public enum BuiltIn : uint + { + Position = 0, + PointSize = 1, + ClipDistance = 3, + CullDistance = 4, + VertexId = 5, + InstanceId = 6, + PrimitiveId = 7, + InvocationId = 8, + Layer = 9, + ViewportIndex = 10, + TessLevelOuter = 11, + TessLevelInner = 12, + TessCoord = 13, + PatchVertices = 14, + FragCoord = 15, + PointCoord = 16, + FrontFacing = 17, + SampleId = 18, + SamplePosition = 19, + SampleMask = 20, + FragDepth = 22, + HelperInvocation = 23, + NumWorkgroups = 24, + WorkgroupSize = 25, + WorkgroupId = 26, + LocalInvocationId = 27, + GlobalInvocationId = 28, + LocalInvocationIndex = 29, + WorkDim = 30, + GlobalSize = 31, + EnqueuedWorkgroupSize = 32, + GlobalOffset = 33, + GlobalLinearId = 34, + SubgroupSize = 36, + SubgroupMaxSize = 37, + NumSubgroups = 38, + NumEnqueuedSubgroups = 39, + SubgroupId = 40, + SubgroupLocalInvocationId = 41, + VertexIndex = 42, + InstanceIndex = 43, + SubgroupEqMaskKHR = 4416, + SubgroupGeMaskKHR = 4417, + SubgroupGtMaskKHR = 4418, + SubgroupLeMaskKHR = 4419, + SubgroupLtMaskKHR = 4420, + BaseVertex = 4424, + BaseInstance = 4425, + DrawIndex = 4426, + DeviceIndex = 4438, + ViewIndex = 4440, + BaryCoordNoPerspAMD = 4992, + BaryCoordNoPerspCentroidAMD = 4993, + BaryCoordNoPerspSampleAMD = 4994, + BaryCoordSmoothAMD = 4995, + BaryCoordSmoothCentroidAMD = 4996, + BaryCoordSmoothSampleAMD = 4997, + BaryCoordPullModelAMD = 4998, + FragStencilRefEXT = 5014, + ViewportMaskNV = 5253, + SecondaryPositionNV = 5257, + SecondaryViewportMaskNV = 5258, + PositionPerViewNV = 5261, + ViewportMaskPerViewNV = 5262, + } + public class BuiltInParameterFactory : ParameterFactory + { + } + public enum Scope : uint + { + CrossDevice = 0, + Device = 1, + Workgroup = 2, + Subgroup = 3, + Invocation = 4, + } + public class ScopeParameterFactory : ParameterFactory + { + } + public enum GroupOperation : uint + { + Reduce = 0, + InclusiveScan = 1, + ExclusiveScan = 2, + } + public class GroupOperationParameterFactory : ParameterFactory + { + } + public enum KernelEnqueueFlags : uint + { + NoWait = 0, + WaitKernel = 1, + WaitWorkGroup = 2, + } + public class KernelEnqueueFlagsParameterFactory : ParameterFactory + { + } + public enum Capability : uint + { + Matrix = 0, + Shader = 1, + Geometry = 2, + Tessellation = 3, + Addresses = 4, + Linkage = 5, + Kernel = 6, + Vector16 = 7, + Float16Buffer = 8, + Float16 = 9, + Float64 = 10, + Int64 = 11, + Int64Atomics = 12, + ImageBasic = 13, + ImageReadWrite = 14, + ImageMipmap = 15, + Pipes = 17, + Groups = 18, + DeviceEnqueue = 19, + LiteralSampler = 20, + AtomicStorage = 21, + Int16 = 22, + TessellationPointSize = 23, + GeometryPointSize = 24, + ImageGatherExtended = 25, + StorageImageMultisample = 27, + UniformBufferArrayDynamicIndexing = 28, + SampledImageArrayDynamicIndexing = 29, + StorageBufferArrayDynamicIndexing = 30, + StorageImageArrayDynamicIndexing = 31, + ClipDistance = 32, + CullDistance = 33, + ImageCubeArray = 34, + SampleRateShading = 35, + ImageRect = 36, + SampledRect = 37, + GenericPointer = 38, + Int8 = 39, + InputAttachment = 40, + SparseResidency = 41, + MinLod = 42, + Sampled1D = 43, + Image1D = 44, + SampledCubeArray = 45, + SampledBuffer = 46, + ImageBuffer = 47, + ImageMSArray = 48, + StorageImageExtendedFormats = 49, + ImageQuery = 50, + DerivativeControl = 51, + InterpolationFunction = 52, + TransformFeedback = 53, + GeometryStreams = 54, + StorageImageReadWithoutFormat = 55, + StorageImageWriteWithoutFormat = 56, + MultiViewport = 57, + SubgroupDispatch = 58, + NamedBarrier = 59, + PipeStorage = 60, + SubgroupBallotKHR = 4423, + DrawParameters = 4427, + SubgroupVoteKHR = 4431, + StorageBuffer16BitAccess = 4433, + StorageUniformBufferBlock16 = 4433, + UniformAndStorageBuffer16BitAccess = 4434, + StorageUniform16 = 4434, + StoragePushConstant16 = 4435, + StorageInputOutput16 = 4436, + DeviceGroup = 4437, + MultiView = 4439, + VariablePointersStorageBuffer = 4441, + VariablePointers = 4442, + AtomicStorageOps = 4445, + SampleMaskPostDepthCoverage = 4447, + ImageGatherBiasLodAMD = 5009, + FragmentMaskAMD = 5010, + StencilExportEXT = 5013, + ImageReadWriteLodAMD = 5015, + SampleMaskOverrideCoverageNV = 5249, + GeometryShaderPassthroughNV = 5251, + ShaderViewportIndexLayerEXT = 5254, + ShaderViewportIndexLayerNV = 5254, + ShaderViewportMaskNV = 5255, + ShaderStereoViewNV = 5259, + PerViewAttributesNV = 5260, + SubgroupShuffleINTEL = 5568, + SubgroupBufferBlockIOINTEL = 5569, + SubgroupImageBlockIOINTEL = 5570, + } + public class CapabilityParameterFactory : ParameterFactory + { + } + public class OpNop : Instruction + { + public OpNop() : base("OpNop") + { + } + } + public class OpUndef : Instruction + { + public OpUndef() : base("OpUndef", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpSourceContinued : Instruction + { + public OpSourceContinued() : base("OpSourceContinued", new List() + {new Operand(new LiteralString(), "Continued Source", OperandQuantifier.Default), }) + { + } + } + public class OpSource : Instruction + { + public OpSource() : base("OpSource", new List() + {new Operand(new EnumType(), null, OperandQuantifier.Default), new Operand(new LiteralInteger(), "Version", OperandQuantifier.Default), new Operand(new IdRef(), "File", OperandQuantifier.Optional), new Operand(new LiteralString(), "Source", OperandQuantifier.Optional), }) + { + } + } + public class OpSourceExtension : Instruction + { + public OpSourceExtension() : base("OpSourceExtension", new List() + {new Operand(new LiteralString(), "Extension", OperandQuantifier.Default), }) + { + } + } + public class OpName : Instruction + { + public OpName() : base("OpName", new List() + {new Operand(new IdRef(), "Target", OperandQuantifier.Default), new Operand(new LiteralString(), "Name", OperandQuantifier.Default), }) + { + } + } + public class OpMemberName : Instruction + { + public OpMemberName() : base("OpMemberName", new List() + {new Operand(new IdRef(), "Type", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Member", OperandQuantifier.Default), new Operand(new LiteralString(), "Name", OperandQuantifier.Default), }) + { + } + } + public class OpString : Instruction + { + public OpString() : base("OpString", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new LiteralString(), "String", OperandQuantifier.Default), }) + { + } + } + public class OpLine : Instruction + { + public OpLine() : base("OpLine", new List() + {new Operand(new IdRef(), "File", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Line", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Column", OperandQuantifier.Default), }) + { + } + } + public class OpExtension : Instruction + { + public OpExtension() : base("OpExtension", new List() + {new Operand(new LiteralString(), "Name", OperandQuantifier.Default), }) + { + } + } + public class OpExtInstImport : Instruction + { + public OpExtInstImport() : base("OpExtInstImport", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new LiteralString(), "Name", OperandQuantifier.Default), }) + { + } + } + public class OpExtInst : Instruction + { + public OpExtInst() : base("OpExtInst", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Set", OperandQuantifier.Default), new Operand(new LiteralExtInstInteger(), "Instruction", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1, +Operand 2, +...", OperandQuantifier.Varying), }) + { + } + } + public class OpMemoryModel : Instruction + { + public OpMemoryModel() : base("OpMemoryModel", new List() + {new Operand(new EnumType(), null, OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpEntryPoint : Instruction + { + public OpEntryPoint() : base("OpEntryPoint", new List() + {new Operand(new EnumType(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Entry Point", OperandQuantifier.Default), new Operand(new LiteralString(), "Name", OperandQuantifier.Default), new Operand(new IdRef(), "Interface", OperandQuantifier.Varying), }) + { + } + } + public class OpExecutionMode : Instruction + { + public OpExecutionMode() : base("OpExecutionMode", new List() + {new Operand(new IdRef(), "Entry Point", OperandQuantifier.Default), new Operand(new EnumType(), "Mode", OperandQuantifier.Default), }) + { + } + } + public class OpCapability : Instruction + { + public OpCapability() : base("OpCapability", new List() + {new Operand(new EnumType(), "Capability", OperandQuantifier.Default), }) + { + } + } + public class OpTypeVoid : Instruction + { + public OpTypeVoid() : base("OpTypeVoid", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpTypeBool : Instruction + { + public OpTypeBool() : base("OpTypeBool", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpTypeInt : Instruction + { + public OpTypeInt() : base("OpTypeInt", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new LiteralInteger(), "Width", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Signedness", OperandQuantifier.Default), }) + { + } + } + public class OpTypeFloat : Instruction + { + public OpTypeFloat() : base("OpTypeFloat", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new LiteralInteger(), "Width", OperandQuantifier.Default), }) + { + } + } + public class OpTypeVector : Instruction + { + public OpTypeVector() : base("OpTypeVector", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Component Type", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Component Count", OperandQuantifier.Default), }) + { + } + } + public class OpTypeMatrix : Instruction + { + public OpTypeMatrix() : base("OpTypeMatrix", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Column Type", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Column Count", OperandQuantifier.Default), }) + { + } + } + public class OpTypeImage : Instruction + { + public OpTypeImage() : base("OpTypeImage", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Type", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), new Operand(new LiteralInteger(), "Depth", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Arrayed", OperandQuantifier.Default), new Operand(new LiteralInteger(), "MS", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Sampled", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpTypeSampler : Instruction + { + public OpTypeSampler() : base("OpTypeSampler", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpTypeSampledImage : Instruction + { + public OpTypeSampledImage() : base("OpTypeSampledImage", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image Type", OperandQuantifier.Default), }) + { + } + } + public class OpTypeArray : Instruction + { + public OpTypeArray() : base("OpTypeArray", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Element Type", OperandQuantifier.Default), new Operand(new IdRef(), "Length", OperandQuantifier.Default), }) + { + } + } + public class OpTypeRuntimeArray : Instruction + { + public OpTypeRuntimeArray() : base("OpTypeRuntimeArray", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Element Type", OperandQuantifier.Default), }) + { + } + } + public class OpTypeStruct : Instruction + { + public OpTypeStruct() : base("OpTypeStruct", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Member 0 type, +member 1 type, +...", OperandQuantifier.Varying), }) + { + } + } + public class OpTypeOpaque : Instruction + { + public OpTypeOpaque() : base("OpTypeOpaque", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new LiteralString(), "The name of the opaque type.", OperandQuantifier.Default), }) + { + } + } + public class OpTypePointer : Instruction + { + public OpTypePointer() : base("OpTypePointer", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Type", OperandQuantifier.Default), }) + { + } + } + public class OpTypeFunction : Instruction + { + public OpTypeFunction() : base("OpTypeFunction", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Return Type", OperandQuantifier.Default), new Operand(new IdRef(), "Parameter 0 Type, +Parameter 1 Type, +...", OperandQuantifier.Varying), }) + { + } + } + public class OpTypeEvent : Instruction + { + public OpTypeEvent() : base("OpTypeEvent", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpTypeDeviceEvent : Instruction + { + public OpTypeDeviceEvent() : base("OpTypeDeviceEvent", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpTypeReserveId : Instruction + { + public OpTypeReserveId() : base("OpTypeReserveId", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpTypeQueue : Instruction + { + public OpTypeQueue() : base("OpTypeQueue", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpTypePipe : Instruction + { + public OpTypePipe() : base("OpTypePipe", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new EnumType(), "Qualifier", OperandQuantifier.Default), }) + { + } + } + public class OpTypeForwardPointer : Instruction + { + public OpTypeForwardPointer() : base("OpTypeForwardPointer", new List() + {new Operand(new IdRef(), "Pointer Type", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpConstantTrue : Instruction + { + public OpConstantTrue() : base("OpConstantTrue", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpConstantFalse : Instruction + { + public OpConstantFalse() : base("OpConstantFalse", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpConstant : Instruction + { + public OpConstant() : base("OpConstant", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new LiteralContextDependentNumber(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpConstantComposite : Instruction + { + public OpConstantComposite() : base("OpConstantComposite", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Constituents", OperandQuantifier.Varying), }) + { + } + } + public class OpConstantSampler : Instruction + { + public OpConstantSampler() : base("OpConstantSampler", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), new Operand(new LiteralInteger(), "Param", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpConstantNull : Instruction + { + public OpConstantNull() : base("OpConstantNull", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpSpecConstantTrue : Instruction + { + public OpSpecConstantTrue() : base("OpSpecConstantTrue", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpSpecConstantFalse : Instruction + { + public OpSpecConstantFalse() : base("OpSpecConstantFalse", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpSpecConstant : Instruction + { + public OpSpecConstant() : base("OpSpecConstant", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new LiteralContextDependentNumber(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpSpecConstantComposite : Instruction + { + public OpSpecConstantComposite() : base("OpSpecConstantComposite", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Constituents", OperandQuantifier.Varying), }) + { + } + } + public class OpSpecConstantOp : Instruction + { + public OpSpecConstantOp() : base("OpSpecConstantOp", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new LiteralSpecConstantOpInteger(), "Opcode", OperandQuantifier.Default), }) + { + } + } + public class OpFunction : Instruction + { + public OpFunction() : base("OpFunction", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Function Type", OperandQuantifier.Default), }) + { + } + } + public class OpFunctionParameter : Instruction + { + public OpFunctionParameter() : base("OpFunctionParameter", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpFunctionEnd : Instruction + { + public OpFunctionEnd() : base("OpFunctionEnd") + { + } + } + public class OpFunctionCall : Instruction + { + public OpFunctionCall() : base("OpFunctionCall", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Function", OperandQuantifier.Default), new Operand(new IdRef(), "Argument 0, +Argument 1, +...", OperandQuantifier.Varying), }) + { + } + } + public class OpVariable : Instruction + { + public OpVariable() : base("OpVariable", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Initializer", OperandQuantifier.Optional), }) + { + } + } + public class OpImageTexelPointer : Instruction + { + public OpImageTexelPointer() : base("OpImageTexelPointer", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "Sample", OperandQuantifier.Default), }) + { + } + } + public class OpLoad : Instruction + { + public OpLoad() : base("OpLoad", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpStore : Instruction + { + public OpStore() : base("OpStore", new List() + {new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdRef(), "Object", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpCopyMemory : Instruction + { + public OpCopyMemory() : base("OpCopyMemory", new List() + {new Operand(new IdRef(), "Target", OperandQuantifier.Default), new Operand(new IdRef(), "Source", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpCopyMemorySized : Instruction + { + public OpCopyMemorySized() : base("OpCopyMemorySized", new List() + {new Operand(new IdRef(), "Target", OperandQuantifier.Default), new Operand(new IdRef(), "Source", OperandQuantifier.Default), new Operand(new IdRef(), "Size", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpAccessChain : Instruction + { + public OpAccessChain() : base("OpAccessChain", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Base", OperandQuantifier.Default), new Operand(new IdRef(), "Indexes", OperandQuantifier.Varying), }) + { + } + } + public class OpInBoundsAccessChain : Instruction + { + public OpInBoundsAccessChain() : base("OpInBoundsAccessChain", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Base", OperandQuantifier.Default), new Operand(new IdRef(), "Indexes", OperandQuantifier.Varying), }) + { + } + } + public class OpPtrAccessChain : Instruction + { + public OpPtrAccessChain() : base("OpPtrAccessChain", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Base", OperandQuantifier.Default), new Operand(new IdRef(), "Element", OperandQuantifier.Default), new Operand(new IdRef(), "Indexes", OperandQuantifier.Varying), }) + { + } + } + public class OpArrayLength : Instruction + { + public OpArrayLength() : base("OpArrayLength", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Structure", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Array member", OperandQuantifier.Default), }) + { + } + } + public class OpGenericPtrMemSemantics : Instruction + { + public OpGenericPtrMemSemantics() : base("OpGenericPtrMemSemantics", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), }) + { + } + } + public class OpInBoundsPtrAccessChain : Instruction + { + public OpInBoundsPtrAccessChain() : base("OpInBoundsPtrAccessChain", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Base", OperandQuantifier.Default), new Operand(new IdRef(), "Element", OperandQuantifier.Default), new Operand(new IdRef(), "Indexes", OperandQuantifier.Varying), }) + { + } + } + public class OpDecorate : Instruction + { + public OpDecorate() : base("OpDecorate", new List() + {new Operand(new IdRef(), "Target", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpMemberDecorate : Instruction + { + public OpMemberDecorate() : base("OpMemberDecorate", new List() + {new Operand(new IdRef(), "Structure Type", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Member", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpDecorationGroup : Instruction + { + public OpDecorationGroup() : base("OpDecorationGroup", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpGroupDecorate : Instruction + { + public OpGroupDecorate() : base("OpGroupDecorate", new List() + {new Operand(new IdRef(), "Decoration Group", OperandQuantifier.Default), new Operand(new IdRef(), "Targets", OperandQuantifier.Varying), }) + { + } + } + public class OpGroupMemberDecorate : Instruction + { + public OpGroupMemberDecorate() : base("OpGroupMemberDecorate", new List() + {new Operand(new IdRef(), "Decoration Group", OperandQuantifier.Default), new Operand(new PairIdRefLiteralInteger(), "Targets", OperandQuantifier.Varying), }) + { + } + } + public class OpVectorExtractDynamic : Instruction + { + public OpVectorExtractDynamic() : base("OpVectorExtractDynamic", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Vector", OperandQuantifier.Default), new Operand(new IdRef(), "Index", OperandQuantifier.Default), }) + { + } + } + public class OpVectorInsertDynamic : Instruction + { + public OpVectorInsertDynamic() : base("OpVectorInsertDynamic", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Vector", OperandQuantifier.Default), new Operand(new IdRef(), "Component", OperandQuantifier.Default), new Operand(new IdRef(), "Index", OperandQuantifier.Default), }) + { + } + } + public class OpVectorShuffle : Instruction + { + public OpVectorShuffle() : base("OpVectorShuffle", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Vector 1", OperandQuantifier.Default), new Operand(new IdRef(), "Vector 2", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Components", OperandQuantifier.Varying), }) + { + } + } + public class OpCompositeConstruct : Instruction + { + public OpCompositeConstruct() : base("OpCompositeConstruct", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Constituents", OperandQuantifier.Varying), }) + { + } + } + public class OpCompositeExtract : Instruction + { + public OpCompositeExtract() : base("OpCompositeExtract", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Composite", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Indexes", OperandQuantifier.Varying), }) + { + } + } + public class OpCompositeInsert : Instruction + { + public OpCompositeInsert() : base("OpCompositeInsert", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Object", OperandQuantifier.Default), new Operand(new IdRef(), "Composite", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Indexes", OperandQuantifier.Varying), }) + { + } + } + public class OpCopyObject : Instruction + { + public OpCopyObject() : base("OpCopyObject", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand", OperandQuantifier.Default), }) + { + } + } + public class OpTranspose : Instruction + { + public OpTranspose() : base("OpTranspose", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Matrix", OperandQuantifier.Default), }) + { + } + } + public class OpSampledImage : Instruction + { + public OpSampledImage() : base("OpSampledImage", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image", OperandQuantifier.Default), new Operand(new IdRef(), "Sampler", OperandQuantifier.Default), }) + { + } + } + public class OpImageSampleImplicitLod : Instruction + { + public OpImageSampleImplicitLod() : base("OpImageSampleImplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImageSampleExplicitLod : Instruction + { + public OpImageSampleExplicitLod() : base("OpImageSampleExplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpImageSampleDrefImplicitLod : Instruction + { + public OpImageSampleDrefImplicitLod() : base("OpImageSampleDrefImplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "D~ref~", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImageSampleDrefExplicitLod : Instruction + { + public OpImageSampleDrefExplicitLod() : base("OpImageSampleDrefExplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "D~ref~", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpImageSampleProjImplicitLod : Instruction + { + public OpImageSampleProjImplicitLod() : base("OpImageSampleProjImplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImageSampleProjExplicitLod : Instruction + { + public OpImageSampleProjExplicitLod() : base("OpImageSampleProjExplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpImageSampleProjDrefImplicitLod : Instruction + { + public OpImageSampleProjDrefImplicitLod() : base("OpImageSampleProjDrefImplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "D~ref~", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImageSampleProjDrefExplicitLod : Instruction + { + public OpImageSampleProjDrefExplicitLod() : base("OpImageSampleProjDrefExplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "D~ref~", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpImageFetch : Instruction + { + public OpImageFetch() : base("OpImageFetch", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImageGather : Instruction + { + public OpImageGather() : base("OpImageGather", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "Component", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImageDrefGather : Instruction + { + public OpImageDrefGather() : base("OpImageDrefGather", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "D~ref~", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImageRead : Instruction + { + public OpImageRead() : base("OpImageRead", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImageWrite : Instruction + { + public OpImageWrite() : base("OpImageWrite", new List() + {new Operand(new IdRef(), "Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "Texel", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImage : Instruction + { + public OpImage() : base("OpImage", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), }) + { + } + } + public class OpImageQueryFormat : Instruction + { + public OpImageQueryFormat() : base("OpImageQueryFormat", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image", OperandQuantifier.Default), }) + { + } + } + public class OpImageQueryOrder : Instruction + { + public OpImageQueryOrder() : base("OpImageQueryOrder", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image", OperandQuantifier.Default), }) + { + } + } + public class OpImageQuerySizeLod : Instruction + { + public OpImageQuerySizeLod() : base("OpImageQuerySizeLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image", OperandQuantifier.Default), new Operand(new IdRef(), "Level of Detail", OperandQuantifier.Default), }) + { + } + } + public class OpImageQuerySize : Instruction + { + public OpImageQuerySize() : base("OpImageQuerySize", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image", OperandQuantifier.Default), }) + { + } + } + public class OpImageQueryLod : Instruction + { + public OpImageQueryLod() : base("OpImageQueryLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), }) + { + } + } + public class OpImageQueryLevels : Instruction + { + public OpImageQueryLevels() : base("OpImageQueryLevels", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image", OperandQuantifier.Default), }) + { + } + } + public class OpImageQuerySamples : Instruction + { + public OpImageQuerySamples() : base("OpImageQuerySamples", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image", OperandQuantifier.Default), }) + { + } + } + public class OpConvertFToU : Instruction + { + public OpConvertFToU() : base("OpConvertFToU", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Float Value", OperandQuantifier.Default), }) + { + } + } + public class OpConvertFToS : Instruction + { + public OpConvertFToS() : base("OpConvertFToS", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Float Value", OperandQuantifier.Default), }) + { + } + } + public class OpConvertSToF : Instruction + { + public OpConvertSToF() : base("OpConvertSToF", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Signed Value", OperandQuantifier.Default), }) + { + } + } + public class OpConvertUToF : Instruction + { + public OpConvertUToF() : base("OpConvertUToF", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Unsigned Value", OperandQuantifier.Default), }) + { + } + } + public class OpUConvert : Instruction + { + public OpUConvert() : base("OpUConvert", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Unsigned Value", OperandQuantifier.Default), }) + { + } + } + public class OpSConvert : Instruction + { + public OpSConvert() : base("OpSConvert", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Signed Value", OperandQuantifier.Default), }) + { + } + } + public class OpFConvert : Instruction + { + public OpFConvert() : base("OpFConvert", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Float Value", OperandQuantifier.Default), }) + { + } + } + public class OpQuantizeToF16 : Instruction + { + public OpQuantizeToF16() : base("OpQuantizeToF16", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpConvertPtrToU : Instruction + { + public OpConvertPtrToU() : base("OpConvertPtrToU", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), }) + { + } + } + public class OpSatConvertSToU : Instruction + { + public OpSatConvertSToU() : base("OpSatConvertSToU", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Signed Value", OperandQuantifier.Default), }) + { + } + } + public class OpSatConvertUToS : Instruction + { + public OpSatConvertUToS() : base("OpSatConvertUToS", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Unsigned Value", OperandQuantifier.Default), }) + { + } + } + public class OpConvertUToPtr : Instruction + { + public OpConvertUToPtr() : base("OpConvertUToPtr", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Integer Value", OperandQuantifier.Default), }) + { + } + } + public class OpPtrCastToGeneric : Instruction + { + public OpPtrCastToGeneric() : base("OpPtrCastToGeneric", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), }) + { + } + } + public class OpGenericCastToPtr : Instruction + { + public OpGenericCastToPtr() : base("OpGenericCastToPtr", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), }) + { + } + } + public class OpGenericCastToPtrExplicit : Instruction + { + public OpGenericCastToPtrExplicit() : base("OpGenericCastToPtrExplicit", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new EnumType(), "Storage", OperandQuantifier.Default), }) + { + } + } + public class OpBitcast : Instruction + { + public OpBitcast() : base("OpBitcast", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand", OperandQuantifier.Default), }) + { + } + } + public class OpSNegate : Instruction + { + public OpSNegate() : base("OpSNegate", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand", OperandQuantifier.Default), }) + { + } + } + public class OpFNegate : Instruction + { + public OpFNegate() : base("OpFNegate", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand", OperandQuantifier.Default), }) + { + } + } + public class OpIAdd : Instruction + { + public OpIAdd() : base("OpIAdd", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFAdd : Instruction + { + public OpFAdd() : base("OpFAdd", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpISub : Instruction + { + public OpISub() : base("OpISub", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFSub : Instruction + { + public OpFSub() : base("OpFSub", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpIMul : Instruction + { + public OpIMul() : base("OpIMul", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFMul : Instruction + { + public OpFMul() : base("OpFMul", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpUDiv : Instruction + { + public OpUDiv() : base("OpUDiv", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpSDiv : Instruction + { + public OpSDiv() : base("OpSDiv", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFDiv : Instruction + { + public OpFDiv() : base("OpFDiv", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpUMod : Instruction + { + public OpUMod() : base("OpUMod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpSRem : Instruction + { + public OpSRem() : base("OpSRem", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpSMod : Instruction + { + public OpSMod() : base("OpSMod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFRem : Instruction + { + public OpFRem() : base("OpFRem", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFMod : Instruction + { + public OpFMod() : base("OpFMod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpVectorTimesScalar : Instruction + { + public OpVectorTimesScalar() : base("OpVectorTimesScalar", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Vector", OperandQuantifier.Default), new Operand(new IdRef(), "Scalar", OperandQuantifier.Default), }) + { + } + } + public class OpMatrixTimesScalar : Instruction + { + public OpMatrixTimesScalar() : base("OpMatrixTimesScalar", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Matrix", OperandQuantifier.Default), new Operand(new IdRef(), "Scalar", OperandQuantifier.Default), }) + { + } + } + public class OpVectorTimesMatrix : Instruction + { + public OpVectorTimesMatrix() : base("OpVectorTimesMatrix", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Vector", OperandQuantifier.Default), new Operand(new IdRef(), "Matrix", OperandQuantifier.Default), }) + { + } + } + public class OpMatrixTimesVector : Instruction + { + public OpMatrixTimesVector() : base("OpMatrixTimesVector", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Matrix", OperandQuantifier.Default), new Operand(new IdRef(), "Vector", OperandQuantifier.Default), }) + { + } + } + public class OpMatrixTimesMatrix : Instruction + { + public OpMatrixTimesMatrix() : base("OpMatrixTimesMatrix", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "LeftMatrix", OperandQuantifier.Default), new Operand(new IdRef(), "RightMatrix", OperandQuantifier.Default), }) + { + } + } + public class OpOuterProduct : Instruction + { + public OpOuterProduct() : base("OpOuterProduct", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Vector 1", OperandQuantifier.Default), new Operand(new IdRef(), "Vector 2", OperandQuantifier.Default), }) + { + } + } + public class OpDot : Instruction + { + public OpDot() : base("OpDot", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Vector 1", OperandQuantifier.Default), new Operand(new IdRef(), "Vector 2", OperandQuantifier.Default), }) + { + } + } + public class OpIAddCarry : Instruction + { + public OpIAddCarry() : base("OpIAddCarry", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpISubBorrow : Instruction + { + public OpISubBorrow() : base("OpISubBorrow", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpUMulExtended : Instruction + { + public OpUMulExtended() : base("OpUMulExtended", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpSMulExtended : Instruction + { + public OpSMulExtended() : base("OpSMulExtended", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpAny : Instruction + { + public OpAny() : base("OpAny", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Vector", OperandQuantifier.Default), }) + { + } + } + public class OpAll : Instruction + { + public OpAll() : base("OpAll", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Vector", OperandQuantifier.Default), }) + { + } + } + public class OpIsNan : Instruction + { + public OpIsNan() : base("OpIsNan", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "x", OperandQuantifier.Default), }) + { + } + } + public class OpIsInf : Instruction + { + public OpIsInf() : base("OpIsInf", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "x", OperandQuantifier.Default), }) + { + } + } + public class OpIsFinite : Instruction + { + public OpIsFinite() : base("OpIsFinite", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "x", OperandQuantifier.Default), }) + { + } + } + public class OpIsNormal : Instruction + { + public OpIsNormal() : base("OpIsNormal", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "x", OperandQuantifier.Default), }) + { + } + } + public class OpSignBitSet : Instruction + { + public OpSignBitSet() : base("OpSignBitSet", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "x", OperandQuantifier.Default), }) + { + } + } + public class OpLessOrGreater : Instruction + { + public OpLessOrGreater() : base("OpLessOrGreater", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "x", OperandQuantifier.Default), new Operand(new IdRef(), "y", OperandQuantifier.Default), }) + { + } + } + public class OpOrdered : Instruction + { + public OpOrdered() : base("OpOrdered", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "x", OperandQuantifier.Default), new Operand(new IdRef(), "y", OperandQuantifier.Default), }) + { + } + } + public class OpUnordered : Instruction + { + public OpUnordered() : base("OpUnordered", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "x", OperandQuantifier.Default), new Operand(new IdRef(), "y", OperandQuantifier.Default), }) + { + } + } + public class OpLogicalEqual : Instruction + { + public OpLogicalEqual() : base("OpLogicalEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpLogicalNotEqual : Instruction + { + public OpLogicalNotEqual() : base("OpLogicalNotEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpLogicalOr : Instruction + { + public OpLogicalOr() : base("OpLogicalOr", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpLogicalAnd : Instruction + { + public OpLogicalAnd() : base("OpLogicalAnd", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpLogicalNot : Instruction + { + public OpLogicalNot() : base("OpLogicalNot", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand", OperandQuantifier.Default), }) + { + } + } + public class OpSelect : Instruction + { + public OpSelect() : base("OpSelect", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Condition", OperandQuantifier.Default), new Operand(new IdRef(), "Object 1", OperandQuantifier.Default), new Operand(new IdRef(), "Object 2", OperandQuantifier.Default), }) + { + } + } + public class OpIEqual : Instruction + { + public OpIEqual() : base("OpIEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpINotEqual : Instruction + { + public OpINotEqual() : base("OpINotEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpUGreaterThan : Instruction + { + public OpUGreaterThan() : base("OpUGreaterThan", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpSGreaterThan : Instruction + { + public OpSGreaterThan() : base("OpSGreaterThan", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpUGreaterThanEqual : Instruction + { + public OpUGreaterThanEqual() : base("OpUGreaterThanEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpSGreaterThanEqual : Instruction + { + public OpSGreaterThanEqual() : base("OpSGreaterThanEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpULessThan : Instruction + { + public OpULessThan() : base("OpULessThan", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpSLessThan : Instruction + { + public OpSLessThan() : base("OpSLessThan", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpULessThanEqual : Instruction + { + public OpULessThanEqual() : base("OpULessThanEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpSLessThanEqual : Instruction + { + public OpSLessThanEqual() : base("OpSLessThanEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFOrdEqual : Instruction + { + public OpFOrdEqual() : base("OpFOrdEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFUnordEqual : Instruction + { + public OpFUnordEqual() : base("OpFUnordEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFOrdNotEqual : Instruction + { + public OpFOrdNotEqual() : base("OpFOrdNotEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFUnordNotEqual : Instruction + { + public OpFUnordNotEqual() : base("OpFUnordNotEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFOrdLessThan : Instruction + { + public OpFOrdLessThan() : base("OpFOrdLessThan", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFUnordLessThan : Instruction + { + public OpFUnordLessThan() : base("OpFUnordLessThan", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFOrdGreaterThan : Instruction + { + public OpFOrdGreaterThan() : base("OpFOrdGreaterThan", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFUnordGreaterThan : Instruction + { + public OpFUnordGreaterThan() : base("OpFUnordGreaterThan", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFOrdLessThanEqual : Instruction + { + public OpFOrdLessThanEqual() : base("OpFOrdLessThanEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFUnordLessThanEqual : Instruction + { + public OpFUnordLessThanEqual() : base("OpFUnordLessThanEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFOrdGreaterThanEqual : Instruction + { + public OpFOrdGreaterThanEqual() : base("OpFOrdGreaterThanEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpFUnordGreaterThanEqual : Instruction + { + public OpFUnordGreaterThanEqual() : base("OpFUnordGreaterThanEqual", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpShiftRightLogical : Instruction + { + public OpShiftRightLogical() : base("OpShiftRightLogical", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Base", OperandQuantifier.Default), new Operand(new IdRef(), "Shift", OperandQuantifier.Default), }) + { + } + } + public class OpShiftRightArithmetic : Instruction + { + public OpShiftRightArithmetic() : base("OpShiftRightArithmetic", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Base", OperandQuantifier.Default), new Operand(new IdRef(), "Shift", OperandQuantifier.Default), }) + { + } + } + public class OpShiftLeftLogical : Instruction + { + public OpShiftLeftLogical() : base("OpShiftLeftLogical", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Base", OperandQuantifier.Default), new Operand(new IdRef(), "Shift", OperandQuantifier.Default), }) + { + } + } + public class OpBitwiseOr : Instruction + { + public OpBitwiseOr() : base("OpBitwiseOr", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpBitwiseXor : Instruction + { + public OpBitwiseXor() : base("OpBitwiseXor", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpBitwiseAnd : Instruction + { + public OpBitwiseAnd() : base("OpBitwiseAnd", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand 1", OperandQuantifier.Default), new Operand(new IdRef(), "Operand 2", OperandQuantifier.Default), }) + { + } + } + public class OpNot : Instruction + { + public OpNot() : base("OpNot", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Operand", OperandQuantifier.Default), }) + { + } + } + public class OpBitFieldInsert : Instruction + { + public OpBitFieldInsert() : base("OpBitFieldInsert", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Base", OperandQuantifier.Default), new Operand(new IdRef(), "Insert", OperandQuantifier.Default), new Operand(new IdRef(), "Offset", OperandQuantifier.Default), new Operand(new IdRef(), "Count", OperandQuantifier.Default), }) + { + } + } + public class OpBitFieldSExtract : Instruction + { + public OpBitFieldSExtract() : base("OpBitFieldSExtract", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Base", OperandQuantifier.Default), new Operand(new IdRef(), "Offset", OperandQuantifier.Default), new Operand(new IdRef(), "Count", OperandQuantifier.Default), }) + { + } + } + public class OpBitFieldUExtract : Instruction + { + public OpBitFieldUExtract() : base("OpBitFieldUExtract", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Base", OperandQuantifier.Default), new Operand(new IdRef(), "Offset", OperandQuantifier.Default), new Operand(new IdRef(), "Count", OperandQuantifier.Default), }) + { + } + } + public class OpBitReverse : Instruction + { + public OpBitReverse() : base("OpBitReverse", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Base", OperandQuantifier.Default), }) + { + } + } + public class OpBitCount : Instruction + { + public OpBitCount() : base("OpBitCount", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Base", OperandQuantifier.Default), }) + { + } + } + public class OpDPdx : Instruction + { + public OpDPdx() : base("OpDPdx", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "P", OperandQuantifier.Default), }) + { + } + } + public class OpDPdy : Instruction + { + public OpDPdy() : base("OpDPdy", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "P", OperandQuantifier.Default), }) + { + } + } + public class OpFwidth : Instruction + { + public OpFwidth() : base("OpFwidth", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "P", OperandQuantifier.Default), }) + { + } + } + public class OpDPdxFine : Instruction + { + public OpDPdxFine() : base("OpDPdxFine", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "P", OperandQuantifier.Default), }) + { + } + } + public class OpDPdyFine : Instruction + { + public OpDPdyFine() : base("OpDPdyFine", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "P", OperandQuantifier.Default), }) + { + } + } + public class OpFwidthFine : Instruction + { + public OpFwidthFine() : base("OpFwidthFine", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "P", OperandQuantifier.Default), }) + { + } + } + public class OpDPdxCoarse : Instruction + { + public OpDPdxCoarse() : base("OpDPdxCoarse", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "P", OperandQuantifier.Default), }) + { + } + } + public class OpDPdyCoarse : Instruction + { + public OpDPdyCoarse() : base("OpDPdyCoarse", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "P", OperandQuantifier.Default), }) + { + } + } + public class OpFwidthCoarse : Instruction + { + public OpFwidthCoarse() : base("OpFwidthCoarse", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "P", OperandQuantifier.Default), }) + { + } + } + public class OpEmitVertex : Instruction + { + public OpEmitVertex() : base("OpEmitVertex") + { + } + } + public class OpEndPrimitive : Instruction + { + public OpEndPrimitive() : base("OpEndPrimitive") + { + } + } + public class OpEmitStreamVertex : Instruction + { + public OpEmitStreamVertex() : base("OpEmitStreamVertex", new List() + {new Operand(new IdRef(), "Stream", OperandQuantifier.Default), }) + { + } + } + public class OpEndStreamPrimitive : Instruction + { + public OpEndStreamPrimitive() : base("OpEndStreamPrimitive", new List() + {new Operand(new IdRef(), "Stream", OperandQuantifier.Default), }) + { + } + } + public class OpControlBarrier : Instruction + { + public OpControlBarrier() : base("OpControlBarrier", new List() + {new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new IdScope(), "Memory", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), }) + { + } + } + public class OpMemoryBarrier : Instruction + { + public OpMemoryBarrier() : base("OpMemoryBarrier", new List() + {new Operand(new IdScope(), "Memory", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicLoad : Instruction + { + public OpAtomicLoad() : base("OpAtomicLoad", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicStore : Instruction + { + public OpAtomicStore() : base("OpAtomicStore", new List() + {new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicExchange : Instruction + { + public OpAtomicExchange() : base("OpAtomicExchange", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicCompareExchange : Instruction + { + public OpAtomicCompareExchange() : base("OpAtomicCompareExchange", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Equal", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Unequal", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), new Operand(new IdRef(), "Comparator", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicCompareExchangeWeak : Instruction + { + public OpAtomicCompareExchangeWeak() : base("OpAtomicCompareExchangeWeak", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Equal", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Unequal", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), new Operand(new IdRef(), "Comparator", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicIIncrement : Instruction + { + public OpAtomicIIncrement() : base("OpAtomicIIncrement", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicIDecrement : Instruction + { + public OpAtomicIDecrement() : base("OpAtomicIDecrement", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicIAdd : Instruction + { + public OpAtomicIAdd() : base("OpAtomicIAdd", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicISub : Instruction + { + public OpAtomicISub() : base("OpAtomicISub", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicSMin : Instruction + { + public OpAtomicSMin() : base("OpAtomicSMin", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicUMin : Instruction + { + public OpAtomicUMin() : base("OpAtomicUMin", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicSMax : Instruction + { + public OpAtomicSMax() : base("OpAtomicSMax", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicUMax : Instruction + { + public OpAtomicUMax() : base("OpAtomicUMax", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicAnd : Instruction + { + public OpAtomicAnd() : base("OpAtomicAnd", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicOr : Instruction + { + public OpAtomicOr() : base("OpAtomicOr", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicXor : Instruction + { + public OpAtomicXor() : base("OpAtomicXor", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpPhi : Instruction + { + public OpPhi() : base("OpPhi", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new PairIdRefIdRef(), "Variable, Parent, ...", OperandQuantifier.Varying), }) + { + } + } + public class OpLoopMerge : Instruction + { + public OpLoopMerge() : base("OpLoopMerge", new List() + {new Operand(new IdRef(), "Merge Block", OperandQuantifier.Default), new Operand(new IdRef(), "Continue Target", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpSelectionMerge : Instruction + { + public OpSelectionMerge() : base("OpSelectionMerge", new List() + {new Operand(new IdRef(), "Merge Block", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpLabel : Instruction + { + public OpLabel() : base("OpLabel", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpBranch : Instruction + { + public OpBranch() : base("OpBranch", new List() + {new Operand(new IdRef(), "Target Label", OperandQuantifier.Default), }) + { + } + } + public class OpBranchConditional : Instruction + { + public OpBranchConditional() : base("OpBranchConditional", new List() + {new Operand(new IdRef(), "Condition", OperandQuantifier.Default), new Operand(new IdRef(), "True Label", OperandQuantifier.Default), new Operand(new IdRef(), "False Label", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Branch weights", OperandQuantifier.Varying), }) + { + } + } + public class OpSwitch : Instruction + { + public OpSwitch() : base("OpSwitch", new List() + {new Operand(new IdRef(), "Selector", OperandQuantifier.Default), new Operand(new IdRef(), "Default", OperandQuantifier.Default), new Operand(new PairLiteralIntegerIdRef(), "Target", OperandQuantifier.Varying), }) + { + } + } + public class OpKill : Instruction + { + public OpKill() : base("OpKill") + { + } + } + public class OpReturn : Instruction + { + public OpReturn() : base("OpReturn") + { + } + } + public class OpReturnValue : Instruction + { + public OpReturnValue() : base("OpReturnValue", new List() + {new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpUnreachable : Instruction + { + public OpUnreachable() : base("OpUnreachable") + { + } + } + public class OpLifetimeStart : Instruction + { + public OpLifetimeStart() : base("OpLifetimeStart", new List() + {new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Size", OperandQuantifier.Default), }) + { + } + } + public class OpLifetimeStop : Instruction + { + public OpLifetimeStop() : base("OpLifetimeStop", new List() + {new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Size", OperandQuantifier.Default), }) + { + } + } + public class OpGroupAsyncCopy : Instruction + { + public OpGroupAsyncCopy() : base("OpGroupAsyncCopy", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new IdRef(), "Destination", OperandQuantifier.Default), new Operand(new IdRef(), "Source", OperandQuantifier.Default), new Operand(new IdRef(), "Num Elements", OperandQuantifier.Default), new Operand(new IdRef(), "Stride", OperandQuantifier.Default), new Operand(new IdRef(), "Event", OperandQuantifier.Default), }) + { + } + } + public class OpGroupWaitEvents : Instruction + { + public OpGroupWaitEvents() : base("OpGroupWaitEvents", new List() + {new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new IdRef(), "Num Events", OperandQuantifier.Default), new Operand(new IdRef(), "Events List", OperandQuantifier.Default), }) + { + } + } + public class OpGroupAll : Instruction + { + public OpGroupAll() : base("OpGroupAll", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new IdRef(), "Predicate", OperandQuantifier.Default), }) + { + } + } + public class OpGroupAny : Instruction + { + public OpGroupAny() : base("OpGroupAny", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new IdRef(), "Predicate", OperandQuantifier.Default), }) + { + } + } + public class OpGroupBroadcast : Instruction + { + public OpGroupBroadcast() : base("OpGroupBroadcast", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), new Operand(new IdRef(), "LocalId", OperandQuantifier.Default), }) + { + } + } + public class OpGroupIAdd : Instruction + { + public OpGroupIAdd() : base("OpGroupIAdd", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpGroupFAdd : Instruction + { + public OpGroupFAdd() : base("OpGroupFAdd", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpGroupFMin : Instruction + { + public OpGroupFMin() : base("OpGroupFMin", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpGroupUMin : Instruction + { + public OpGroupUMin() : base("OpGroupUMin", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpGroupSMin : Instruction + { + public OpGroupSMin() : base("OpGroupSMin", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpGroupFMax : Instruction + { + public OpGroupFMax() : base("OpGroupFMax", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpGroupUMax : Instruction + { + public OpGroupUMax() : base("OpGroupUMax", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpGroupSMax : Instruction + { + public OpGroupSMax() : base("OpGroupSMax", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpReadPipe : Instruction + { + public OpReadPipe() : base("OpReadPipe", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pipe", OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Size", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Alignment", OperandQuantifier.Default), }) + { + } + } + public class OpWritePipe : Instruction + { + public OpWritePipe() : base("OpWritePipe", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pipe", OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Size", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Alignment", OperandQuantifier.Default), }) + { + } + } + public class OpReservedReadPipe : Instruction + { + public OpReservedReadPipe() : base("OpReservedReadPipe", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pipe", OperandQuantifier.Default), new Operand(new IdRef(), "Reserve Id", OperandQuantifier.Default), new Operand(new IdRef(), "Index", OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Size", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Alignment", OperandQuantifier.Default), }) + { + } + } + public class OpReservedWritePipe : Instruction + { + public OpReservedWritePipe() : base("OpReservedWritePipe", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pipe", OperandQuantifier.Default), new Operand(new IdRef(), "Reserve Id", OperandQuantifier.Default), new Operand(new IdRef(), "Index", OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Size", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Alignment", OperandQuantifier.Default), }) + { + } + } + public class OpReserveReadPipePackets : Instruction + { + public OpReserveReadPipePackets() : base("OpReserveReadPipePackets", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pipe", OperandQuantifier.Default), new Operand(new IdRef(), "Num Packets", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Size", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Alignment", OperandQuantifier.Default), }) + { + } + } + public class OpReserveWritePipePackets : Instruction + { + public OpReserveWritePipePackets() : base("OpReserveWritePipePackets", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pipe", OperandQuantifier.Default), new Operand(new IdRef(), "Num Packets", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Size", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Alignment", OperandQuantifier.Default), }) + { + } + } + public class OpCommitReadPipe : Instruction + { + public OpCommitReadPipe() : base("OpCommitReadPipe", new List() + {new Operand(new IdRef(), "Pipe", OperandQuantifier.Default), new Operand(new IdRef(), "Reserve Id", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Size", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Alignment", OperandQuantifier.Default), }) + { + } + } + public class OpCommitWritePipe : Instruction + { + public OpCommitWritePipe() : base("OpCommitWritePipe", new List() + {new Operand(new IdRef(), "Pipe", OperandQuantifier.Default), new Operand(new IdRef(), "Reserve Id", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Size", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Alignment", OperandQuantifier.Default), }) + { + } + } + public class OpIsValidReserveId : Instruction + { + public OpIsValidReserveId() : base("OpIsValidReserveId", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Reserve Id", OperandQuantifier.Default), }) + { + } + } + public class OpGetNumPipePackets : Instruction + { + public OpGetNumPipePackets() : base("OpGetNumPipePackets", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pipe", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Size", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Alignment", OperandQuantifier.Default), }) + { + } + } + public class OpGetMaxPipePackets : Instruction + { + public OpGetMaxPipePackets() : base("OpGetMaxPipePackets", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pipe", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Size", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Alignment", OperandQuantifier.Default), }) + { + } + } + public class OpGroupReserveReadPipePackets : Instruction + { + public OpGroupReserveReadPipePackets() : base("OpGroupReserveReadPipePackets", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new IdRef(), "Pipe", OperandQuantifier.Default), new Operand(new IdRef(), "Num Packets", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Size", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Alignment", OperandQuantifier.Default), }) + { + } + } + public class OpGroupReserveWritePipePackets : Instruction + { + public OpGroupReserveWritePipePackets() : base("OpGroupReserveWritePipePackets", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new IdRef(), "Pipe", OperandQuantifier.Default), new Operand(new IdRef(), "Num Packets", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Size", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Alignment", OperandQuantifier.Default), }) + { + } + } + public class OpGroupCommitReadPipe : Instruction + { + public OpGroupCommitReadPipe() : base("OpGroupCommitReadPipe", new List() + {new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new IdRef(), "Pipe", OperandQuantifier.Default), new Operand(new IdRef(), "Reserve Id", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Size", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Alignment", OperandQuantifier.Default), }) + { + } + } + public class OpGroupCommitWritePipe : Instruction + { + public OpGroupCommitWritePipe() : base("OpGroupCommitWritePipe", new List() + {new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new IdRef(), "Pipe", OperandQuantifier.Default), new Operand(new IdRef(), "Reserve Id", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Size", OperandQuantifier.Default), new Operand(new IdRef(), "Packet Alignment", OperandQuantifier.Default), }) + { + } + } + public class OpEnqueueMarker : Instruction + { + public OpEnqueueMarker() : base("OpEnqueueMarker", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Queue", OperandQuantifier.Default), new Operand(new IdRef(), "Num Events", OperandQuantifier.Default), new Operand(new IdRef(), "Wait Events", OperandQuantifier.Default), new Operand(new IdRef(), "Ret Event", OperandQuantifier.Default), }) + { + } + } + public class OpEnqueueKernel : Instruction + { + public OpEnqueueKernel() : base("OpEnqueueKernel", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Queue", OperandQuantifier.Default), new Operand(new IdRef(), "Flags", OperandQuantifier.Default), new Operand(new IdRef(), "ND Range", OperandQuantifier.Default), new Operand(new IdRef(), "Num Events", OperandQuantifier.Default), new Operand(new IdRef(), "Wait Events", OperandQuantifier.Default), new Operand(new IdRef(), "Ret Event", OperandQuantifier.Default), new Operand(new IdRef(), "Invoke", OperandQuantifier.Default), new Operand(new IdRef(), "Param", OperandQuantifier.Default), new Operand(new IdRef(), "Param Size", OperandQuantifier.Default), new Operand(new IdRef(), "Param Align", OperandQuantifier.Default), new Operand(new IdRef(), "Local Size", OperandQuantifier.Varying), }) + { + } + } + public class OpGetKernelNDrangeSubGroupCount : Instruction + { + public OpGetKernelNDrangeSubGroupCount() : base("OpGetKernelNDrangeSubGroupCount", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "ND Range", OperandQuantifier.Default), new Operand(new IdRef(), "Invoke", OperandQuantifier.Default), new Operand(new IdRef(), "Param", OperandQuantifier.Default), new Operand(new IdRef(), "Param Size", OperandQuantifier.Default), new Operand(new IdRef(), "Param Align", OperandQuantifier.Default), }) + { + } + } + public class OpGetKernelNDrangeMaxSubGroupSize : Instruction + { + public OpGetKernelNDrangeMaxSubGroupSize() : base("OpGetKernelNDrangeMaxSubGroupSize", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "ND Range", OperandQuantifier.Default), new Operand(new IdRef(), "Invoke", OperandQuantifier.Default), new Operand(new IdRef(), "Param", OperandQuantifier.Default), new Operand(new IdRef(), "Param Size", OperandQuantifier.Default), new Operand(new IdRef(), "Param Align", OperandQuantifier.Default), }) + { + } + } + public class OpGetKernelWorkGroupSize : Instruction + { + public OpGetKernelWorkGroupSize() : base("OpGetKernelWorkGroupSize", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Invoke", OperandQuantifier.Default), new Operand(new IdRef(), "Param", OperandQuantifier.Default), new Operand(new IdRef(), "Param Size", OperandQuantifier.Default), new Operand(new IdRef(), "Param Align", OperandQuantifier.Default), }) + { + } + } + public class OpGetKernelPreferredWorkGroupSizeMultiple : Instruction + { + public OpGetKernelPreferredWorkGroupSizeMultiple() : base("OpGetKernelPreferredWorkGroupSizeMultiple", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Invoke", OperandQuantifier.Default), new Operand(new IdRef(), "Param", OperandQuantifier.Default), new Operand(new IdRef(), "Param Size", OperandQuantifier.Default), new Operand(new IdRef(), "Param Align", OperandQuantifier.Default), }) + { + } + } + public class OpRetainEvent : Instruction + { + public OpRetainEvent() : base("OpRetainEvent", new List() + {new Operand(new IdRef(), "Event", OperandQuantifier.Default), }) + { + } + } + public class OpReleaseEvent : Instruction + { + public OpReleaseEvent() : base("OpReleaseEvent", new List() + {new Operand(new IdRef(), "Event", OperandQuantifier.Default), }) + { + } + } + public class OpCreateUserEvent : Instruction + { + public OpCreateUserEvent() : base("OpCreateUserEvent", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpIsValidEvent : Instruction + { + public OpIsValidEvent() : base("OpIsValidEvent", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Event", OperandQuantifier.Default), }) + { + } + } + public class OpSetUserEventStatus : Instruction + { + public OpSetUserEventStatus() : base("OpSetUserEventStatus", new List() + {new Operand(new IdRef(), "Event", OperandQuantifier.Default), new Operand(new IdRef(), "Status", OperandQuantifier.Default), }) + { + } + } + public class OpCaptureEventProfilingInfo : Instruction + { + public OpCaptureEventProfilingInfo() : base("OpCaptureEventProfilingInfo", new List() + {new Operand(new IdRef(), "Event", OperandQuantifier.Default), new Operand(new IdRef(), "Profiling Info", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpGetDefaultQueue : Instruction + { + public OpGetDefaultQueue() : base("OpGetDefaultQueue", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpBuildNDRange : Instruction + { + public OpBuildNDRange() : base("OpBuildNDRange", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "GlobalWorkSize", OperandQuantifier.Default), new Operand(new IdRef(), "LocalWorkSize", OperandQuantifier.Default), new Operand(new IdRef(), "GlobalWorkOffset", OperandQuantifier.Default), }) + { + } + } + public class OpImageSparseSampleImplicitLod : Instruction + { + public OpImageSparseSampleImplicitLod() : base("OpImageSparseSampleImplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImageSparseSampleExplicitLod : Instruction + { + public OpImageSparseSampleExplicitLod() : base("OpImageSparseSampleExplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpImageSparseSampleDrefImplicitLod : Instruction + { + public OpImageSparseSampleDrefImplicitLod() : base("OpImageSparseSampleDrefImplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "D~ref~", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImageSparseSampleDrefExplicitLod : Instruction + { + public OpImageSparseSampleDrefExplicitLod() : base("OpImageSparseSampleDrefExplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "D~ref~", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpImageSparseSampleProjImplicitLod : Instruction + { + public OpImageSparseSampleProjImplicitLod() : base("OpImageSparseSampleProjImplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImageSparseSampleProjExplicitLod : Instruction + { + public OpImageSparseSampleProjExplicitLod() : base("OpImageSparseSampleProjExplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpImageSparseSampleProjDrefImplicitLod : Instruction + { + public OpImageSparseSampleProjDrefImplicitLod() : base("OpImageSparseSampleProjDrefImplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "D~ref~", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImageSparseSampleProjDrefExplicitLod : Instruction + { + public OpImageSparseSampleProjDrefExplicitLod() : base("OpImageSparseSampleProjDrefExplicitLod", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "D~ref~", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpImageSparseFetch : Instruction + { + public OpImageSparseFetch() : base("OpImageSparseFetch", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImageSparseGather : Instruction + { + public OpImageSparseGather() : base("OpImageSparseGather", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "Component", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImageSparseDrefGather : Instruction + { + public OpImageSparseDrefGather() : base("OpImageSparseDrefGather", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Sampled Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "D~ref~", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpImageSparseTexelsResident : Instruction + { + public OpImageSparseTexelsResident() : base("OpImageSparseTexelsResident", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Resident Code", OperandQuantifier.Default), }) + { + } + } + public class OpNoLine : Instruction + { + public OpNoLine() : base("OpNoLine") + { + } + } + public class OpAtomicFlagTestAndSet : Instruction + { + public OpAtomicFlagTestAndSet() : base("OpAtomicFlagTestAndSet", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), }) + { + } + } + public class OpAtomicFlagClear : Instruction + { + public OpAtomicFlagClear() : base("OpAtomicFlagClear", new List() + {new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), new Operand(new IdScope(), "Scope", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), }) + { + } + } + public class OpImageSparseRead : Instruction + { + public OpImageSparseRead() : base("OpImageSparseRead", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Optional), }) + { + } + } + public class OpSizeOf : Instruction + { + public OpSizeOf() : base("OpSizeOf", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pointer", OperandQuantifier.Default), }) + { + } + } + public class OpTypePipeStorage : Instruction + { + public OpTypePipeStorage() : base("OpTypePipeStorage", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpConstantPipeStorage : Instruction + { + public OpConstantPipeStorage() : base("OpConstantPipeStorage", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new LiteralInteger(), "Packet Size", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Packet Alignment", OperandQuantifier.Default), new Operand(new LiteralInteger(), "Capacity", OperandQuantifier.Default), }) + { + } + } + public class OpCreatePipeFromPipeStorage : Instruction + { + public OpCreatePipeFromPipeStorage() : base("OpCreatePipeFromPipeStorage", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Pipe Storage", OperandQuantifier.Default), }) + { + } + } + public class OpGetKernelLocalSizeForSubgroupCount : Instruction + { + public OpGetKernelLocalSizeForSubgroupCount() : base("OpGetKernelLocalSizeForSubgroupCount", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Subgroup Count", OperandQuantifier.Default), new Operand(new IdRef(), "Invoke", OperandQuantifier.Default), new Operand(new IdRef(), "Param", OperandQuantifier.Default), new Operand(new IdRef(), "Param Size", OperandQuantifier.Default), new Operand(new IdRef(), "Param Align", OperandQuantifier.Default), }) + { + } + } + public class OpGetKernelMaxNumSubgroups : Instruction + { + public OpGetKernelMaxNumSubgroups() : base("OpGetKernelMaxNumSubgroups", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Invoke", OperandQuantifier.Default), new Operand(new IdRef(), "Param", OperandQuantifier.Default), new Operand(new IdRef(), "Param Size", OperandQuantifier.Default), new Operand(new IdRef(), "Param Align", OperandQuantifier.Default), }) + { + } + } + public class OpTypeNamedBarrier : Instruction + { + public OpTypeNamedBarrier() : base("OpTypeNamedBarrier", new List() + {new Operand(new IdResult(), null, OperandQuantifier.Default), }) + { + } + } + public class OpNamedBarrierInitialize : Instruction + { + public OpNamedBarrierInitialize() : base("OpNamedBarrierInitialize", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Subgroup Count", OperandQuantifier.Default), }) + { + } + } + public class OpMemoryNamedBarrier : Instruction + { + public OpMemoryNamedBarrier() : base("OpMemoryNamedBarrier", new List() + {new Operand(new IdRef(), "Named Barrier", OperandQuantifier.Default), new Operand(new IdScope(), "Memory", OperandQuantifier.Default), new Operand(new IdMemorySemantics(), "Semantics", OperandQuantifier.Default), }) + { + } + } + public class OpModuleProcessed : Instruction + { + public OpModuleProcessed() : base("OpModuleProcessed", new List() + {new Operand(new LiteralString(), "Process", OperandQuantifier.Default), }) + { + } + } + public class OpExecutionModeId : Instruction + { + public OpExecutionModeId() : base("OpExecutionModeId", new List() + {new Operand(new IdRef(), "Entry Point", OperandQuantifier.Default), new Operand(new EnumType(), "Mode", OperandQuantifier.Default), }) + { + } + } + public class OpDecorateId : Instruction + { + public OpDecorateId() : base("OpDecorateId", new List() + {new Operand(new IdRef(), "Target", OperandQuantifier.Default), new Operand(new EnumType(), null, OperandQuantifier.Default), }) + { + } + } + public class OpSubgroupBallotKHR : Instruction + { + public OpSubgroupBallotKHR() : base("OpSubgroupBallotKHR", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Predicate", OperandQuantifier.Default), }) + { + } + } + public class OpSubgroupFirstInvocationKHR : Instruction + { + public OpSubgroupFirstInvocationKHR() : base("OpSubgroupFirstInvocationKHR", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpSubgroupAllKHR : Instruction + { + public OpSubgroupAllKHR() : base("OpSubgroupAllKHR", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Predicate", OperandQuantifier.Default), }) + { + } + } + public class OpSubgroupAnyKHR : Instruction + { + public OpSubgroupAnyKHR() : base("OpSubgroupAnyKHR", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Predicate", OperandQuantifier.Default), }) + { + } + } + public class OpSubgroupAllEqualKHR : Instruction + { + public OpSubgroupAllEqualKHR() : base("OpSubgroupAllEqualKHR", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Predicate", OperandQuantifier.Default), }) + { + } + } + public class OpSubgroupReadInvocationKHR : Instruction + { + public OpSubgroupReadInvocationKHR() : base("OpSubgroupReadInvocationKHR", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), new Operand(new IdRef(), "Index", OperandQuantifier.Default), }) + { + } + } + public class OpGroupIAddNonUniformAMD : Instruction + { + public OpGroupIAddNonUniformAMD() : base("OpGroupIAddNonUniformAMD", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpGroupFAddNonUniformAMD : Instruction + { + public OpGroupFAddNonUniformAMD() : base("OpGroupFAddNonUniformAMD", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpGroupFMinNonUniformAMD : Instruction + { + public OpGroupFMinNonUniformAMD() : base("OpGroupFMinNonUniformAMD", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpGroupUMinNonUniformAMD : Instruction + { + public OpGroupUMinNonUniformAMD() : base("OpGroupUMinNonUniformAMD", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpGroupSMinNonUniformAMD : Instruction + { + public OpGroupSMinNonUniformAMD() : base("OpGroupSMinNonUniformAMD", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpGroupFMaxNonUniformAMD : Instruction + { + public OpGroupFMaxNonUniformAMD() : base("OpGroupFMaxNonUniformAMD", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpGroupUMaxNonUniformAMD : Instruction + { + public OpGroupUMaxNonUniformAMD() : base("OpGroupUMaxNonUniformAMD", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpGroupSMaxNonUniformAMD : Instruction + { + public OpGroupSMaxNonUniformAMD() : base("OpGroupSMaxNonUniformAMD", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdScope(), "Execution", OperandQuantifier.Default), new Operand(new EnumType(), "Operation", OperandQuantifier.Default), new Operand(new IdRef(), "X", OperandQuantifier.Default), }) + { + } + } + public class OpFragmentMaskFetchAMD : Instruction + { + public OpFragmentMaskFetchAMD() : base("OpFragmentMaskFetchAMD", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), }) + { + } + } + public class OpFragmentFetchAMD : Instruction + { + public OpFragmentFetchAMD() : base("OpFragmentFetchAMD", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "Fragment Index", OperandQuantifier.Default), }) + { + } + } + public class OpSubgroupShuffleINTEL : Instruction + { + public OpSubgroupShuffleINTEL() : base("OpSubgroupShuffleINTEL", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Data", OperandQuantifier.Default), new Operand(new IdRef(), "InvocationId", OperandQuantifier.Default), }) + { + } + } + public class OpSubgroupShuffleDownINTEL : Instruction + { + public OpSubgroupShuffleDownINTEL() : base("OpSubgroupShuffleDownINTEL", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Current", OperandQuantifier.Default), new Operand(new IdRef(), "Next", OperandQuantifier.Default), new Operand(new IdRef(), "Delta", OperandQuantifier.Default), }) + { + } + } + public class OpSubgroupShuffleUpINTEL : Instruction + { + public OpSubgroupShuffleUpINTEL() : base("OpSubgroupShuffleUpINTEL", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Previous", OperandQuantifier.Default), new Operand(new IdRef(), "Current", OperandQuantifier.Default), new Operand(new IdRef(), "Delta", OperandQuantifier.Default), }) + { + } + } + public class OpSubgroupShuffleXorINTEL : Instruction + { + public OpSubgroupShuffleXorINTEL() : base("OpSubgroupShuffleXorINTEL", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Data", OperandQuantifier.Default), new Operand(new IdRef(), "Value", OperandQuantifier.Default), }) + { + } + } + public class OpSubgroupBlockReadINTEL : Instruction + { + public OpSubgroupBlockReadINTEL() : base("OpSubgroupBlockReadINTEL", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Ptr", OperandQuantifier.Default), }) + { + } + } + public class OpSubgroupBlockWriteINTEL : Instruction + { + public OpSubgroupBlockWriteINTEL() : base("OpSubgroupBlockWriteINTEL", new List() + {new Operand(new IdRef(), "Ptr", OperandQuantifier.Default), new Operand(new IdRef(), "Data", OperandQuantifier.Default), }) + { + } + } + public class OpSubgroupImageBlockReadINTEL : Instruction + { + public OpSubgroupImageBlockReadINTEL() : base("OpSubgroupImageBlockReadINTEL", new List() + {new Operand(new IdResultType(), null, OperandQuantifier.Default), new Operand(new IdResult(), null, OperandQuantifier.Default), new Operand(new IdRef(), "Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), }) + { + } + } + public class OpSubgroupImageBlockWriteINTEL : Instruction + { + public OpSubgroupImageBlockWriteINTEL() : base("OpSubgroupImageBlockWriteINTEL", new List() + {new Operand(new IdRef(), "Image", OperandQuantifier.Default), new Operand(new IdRef(), "Coordinate", OperandQuantifier.Default), new Operand(new IdRef(), "Data", OperandQuantifier.Default), }) + { + } + } + public static class Instructions + { + private static readonly Dictionary instructions_ = new Dictionary { { 0, new OpNop() }, { 1, new OpUndef() }, { 2, new OpSourceContinued() }, { 3, new OpSource() }, { 4, new OpSourceExtension() }, { 5, new OpName() }, { 6, new OpMemberName() }, { 7, new OpString() }, { 8, new OpLine() }, { 10, new OpExtension() }, { 11, new OpExtInstImport() }, { 12, new OpExtInst() }, { 14, new OpMemoryModel() }, { 15, new OpEntryPoint() }, { 16, new OpExecutionMode() }, { 17, new OpCapability() }, { 19, new OpTypeVoid() }, { 20, new OpTypeBool() }, { 21, new OpTypeInt() }, { 22, new OpTypeFloat() }, { 23, new OpTypeVector() }, { 24, new OpTypeMatrix() }, { 25, new OpTypeImage() }, { 26, new OpTypeSampler() }, { 27, new OpTypeSampledImage() }, { 28, new OpTypeArray() }, { 29, new OpTypeRuntimeArray() }, { 30, new OpTypeStruct() }, { 31, new OpTypeOpaque() }, { 32, new OpTypePointer() }, { 33, new OpTypeFunction() }, { 34, new OpTypeEvent() }, { 35, new OpTypeDeviceEvent() }, { 36, new OpTypeReserveId() }, { 37, new OpTypeQueue() }, { 38, new OpTypePipe() }, { 39, new OpTypeForwardPointer() }, { 41, new OpConstantTrue() }, { 42, new OpConstantFalse() }, { 43, new OpConstant() }, { 44, new OpConstantComposite() }, { 45, new OpConstantSampler() }, { 46, new OpConstantNull() }, { 48, new OpSpecConstantTrue() }, { 49, new OpSpecConstantFalse() }, { 50, new OpSpecConstant() }, { 51, new OpSpecConstantComposite() }, { 52, new OpSpecConstantOp() }, { 54, new OpFunction() }, { 55, new OpFunctionParameter() }, { 56, new OpFunctionEnd() }, { 57, new OpFunctionCall() }, { 59, new OpVariable() }, { 60, new OpImageTexelPointer() }, { 61, new OpLoad() }, { 62, new OpStore() }, { 63, new OpCopyMemory() }, { 64, new OpCopyMemorySized() }, { 65, new OpAccessChain() }, { 66, new OpInBoundsAccessChain() }, { 67, new OpPtrAccessChain() }, { 68, new OpArrayLength() }, { 69, new OpGenericPtrMemSemantics() }, { 70, new OpInBoundsPtrAccessChain() }, { 71, new OpDecorate() }, { 72, new OpMemberDecorate() }, { 73, new OpDecorationGroup() }, { 74, new OpGroupDecorate() }, { 75, new OpGroupMemberDecorate() }, { 77, new OpVectorExtractDynamic() }, { 78, new OpVectorInsertDynamic() }, { 79, new OpVectorShuffle() }, { 80, new OpCompositeConstruct() }, { 81, new OpCompositeExtract() }, { 82, new OpCompositeInsert() }, { 83, new OpCopyObject() }, { 84, new OpTranspose() }, { 86, new OpSampledImage() }, { 87, new OpImageSampleImplicitLod() }, { 88, new OpImageSampleExplicitLod() }, { 89, new OpImageSampleDrefImplicitLod() }, { 90, new OpImageSampleDrefExplicitLod() }, { 91, new OpImageSampleProjImplicitLod() }, { 92, new OpImageSampleProjExplicitLod() }, { 93, new OpImageSampleProjDrefImplicitLod() }, { 94, new OpImageSampleProjDrefExplicitLod() }, { 95, new OpImageFetch() }, { 96, new OpImageGather() }, { 97, new OpImageDrefGather() }, { 98, new OpImageRead() }, { 99, new OpImageWrite() }, { 100, new OpImage() }, { 101, new OpImageQueryFormat() }, { 102, new OpImageQueryOrder() }, { 103, new OpImageQuerySizeLod() }, { 104, new OpImageQuerySize() }, { 105, new OpImageQueryLod() }, { 106, new OpImageQueryLevels() }, { 107, new OpImageQuerySamples() }, { 109, new OpConvertFToU() }, { 110, new OpConvertFToS() }, { 111, new OpConvertSToF() }, { 112, new OpConvertUToF() }, { 113, new OpUConvert() }, { 114, new OpSConvert() }, { 115, new OpFConvert() }, { 116, new OpQuantizeToF16() }, { 117, new OpConvertPtrToU() }, { 118, new OpSatConvertSToU() }, { 119, new OpSatConvertUToS() }, { 120, new OpConvertUToPtr() }, { 121, new OpPtrCastToGeneric() }, { 122, new OpGenericCastToPtr() }, { 123, new OpGenericCastToPtrExplicit() }, { 124, new OpBitcast() }, { 126, new OpSNegate() }, { 127, new OpFNegate() }, { 128, new OpIAdd() }, { 129, new OpFAdd() }, { 130, new OpISub() }, { 131, new OpFSub() }, { 132, new OpIMul() }, { 133, new OpFMul() }, { 134, new OpUDiv() }, { 135, new OpSDiv() }, { 136, new OpFDiv() }, { 137, new OpUMod() }, { 138, new OpSRem() }, { 139, new OpSMod() }, { 140, new OpFRem() }, { 141, new OpFMod() }, { 142, new OpVectorTimesScalar() }, { 143, new OpMatrixTimesScalar() }, { 144, new OpVectorTimesMatrix() }, { 145, new OpMatrixTimesVector() }, { 146, new OpMatrixTimesMatrix() }, { 147, new OpOuterProduct() }, { 148, new OpDot() }, { 149, new OpIAddCarry() }, { 150, new OpISubBorrow() }, { 151, new OpUMulExtended() }, { 152, new OpSMulExtended() }, { 154, new OpAny() }, { 155, new OpAll() }, { 156, new OpIsNan() }, { 157, new OpIsInf() }, { 158, new OpIsFinite() }, { 159, new OpIsNormal() }, { 160, new OpSignBitSet() }, { 161, new OpLessOrGreater() }, { 162, new OpOrdered() }, { 163, new OpUnordered() }, { 164, new OpLogicalEqual() }, { 165, new OpLogicalNotEqual() }, { 166, new OpLogicalOr() }, { 167, new OpLogicalAnd() }, { 168, new OpLogicalNot() }, { 169, new OpSelect() }, { 170, new OpIEqual() }, { 171, new OpINotEqual() }, { 172, new OpUGreaterThan() }, { 173, new OpSGreaterThan() }, { 174, new OpUGreaterThanEqual() }, { 175, new OpSGreaterThanEqual() }, { 176, new OpULessThan() }, { 177, new OpSLessThan() }, { 178, new OpULessThanEqual() }, { 179, new OpSLessThanEqual() }, { 180, new OpFOrdEqual() }, { 181, new OpFUnordEqual() }, { 182, new OpFOrdNotEqual() }, { 183, new OpFUnordNotEqual() }, { 184, new OpFOrdLessThan() }, { 185, new OpFUnordLessThan() }, { 186, new OpFOrdGreaterThan() }, { 187, new OpFUnordGreaterThan() }, { 188, new OpFOrdLessThanEqual() }, { 189, new OpFUnordLessThanEqual() }, { 190, new OpFOrdGreaterThanEqual() }, { 191, new OpFUnordGreaterThanEqual() }, { 194, new OpShiftRightLogical() }, { 195, new OpShiftRightArithmetic() }, { 196, new OpShiftLeftLogical() }, { 197, new OpBitwiseOr() }, { 198, new OpBitwiseXor() }, { 199, new OpBitwiseAnd() }, { 200, new OpNot() }, { 201, new OpBitFieldInsert() }, { 202, new OpBitFieldSExtract() }, { 203, new OpBitFieldUExtract() }, { 204, new OpBitReverse() }, { 205, new OpBitCount() }, { 207, new OpDPdx() }, { 208, new OpDPdy() }, { 209, new OpFwidth() }, { 210, new OpDPdxFine() }, { 211, new OpDPdyFine() }, { 212, new OpFwidthFine() }, { 213, new OpDPdxCoarse() }, { 214, new OpDPdyCoarse() }, { 215, new OpFwidthCoarse() }, { 218, new OpEmitVertex() }, { 219, new OpEndPrimitive() }, { 220, new OpEmitStreamVertex() }, { 221, new OpEndStreamPrimitive() }, { 224, new OpControlBarrier() }, { 225, new OpMemoryBarrier() }, { 227, new OpAtomicLoad() }, { 228, new OpAtomicStore() }, { 229, new OpAtomicExchange() }, { 230, new OpAtomicCompareExchange() }, { 231, new OpAtomicCompareExchangeWeak() }, { 232, new OpAtomicIIncrement() }, { 233, new OpAtomicIDecrement() }, { 234, new OpAtomicIAdd() }, { 235, new OpAtomicISub() }, { 236, new OpAtomicSMin() }, { 237, new OpAtomicUMin() }, { 238, new OpAtomicSMax() }, { 239, new OpAtomicUMax() }, { 240, new OpAtomicAnd() }, { 241, new OpAtomicOr() }, { 242, new OpAtomicXor() }, { 245, new OpPhi() }, { 246, new OpLoopMerge() }, { 247, new OpSelectionMerge() }, { 248, new OpLabel() }, { 249, new OpBranch() }, { 250, new OpBranchConditional() }, { 251, new OpSwitch() }, { 252, new OpKill() }, { 253, new OpReturn() }, { 254, new OpReturnValue() }, { 255, new OpUnreachable() }, { 256, new OpLifetimeStart() }, { 257, new OpLifetimeStop() }, { 259, new OpGroupAsyncCopy() }, { 260, new OpGroupWaitEvents() }, { 261, new OpGroupAll() }, { 262, new OpGroupAny() }, { 263, new OpGroupBroadcast() }, { 264, new OpGroupIAdd() }, { 265, new OpGroupFAdd() }, { 266, new OpGroupFMin() }, { 267, new OpGroupUMin() }, { 268, new OpGroupSMin() }, { 269, new OpGroupFMax() }, { 270, new OpGroupUMax() }, { 271, new OpGroupSMax() }, { 274, new OpReadPipe() }, { 275, new OpWritePipe() }, { 276, new OpReservedReadPipe() }, { 277, new OpReservedWritePipe() }, { 278, new OpReserveReadPipePackets() }, { 279, new OpReserveWritePipePackets() }, { 280, new OpCommitReadPipe() }, { 281, new OpCommitWritePipe() }, { 282, new OpIsValidReserveId() }, { 283, new OpGetNumPipePackets() }, { 284, new OpGetMaxPipePackets() }, { 285, new OpGroupReserveReadPipePackets() }, { 286, new OpGroupReserveWritePipePackets() }, { 287, new OpGroupCommitReadPipe() }, { 288, new OpGroupCommitWritePipe() }, { 291, new OpEnqueueMarker() }, { 292, new OpEnqueueKernel() }, { 293, new OpGetKernelNDrangeSubGroupCount() }, { 294, new OpGetKernelNDrangeMaxSubGroupSize() }, { 295, new OpGetKernelWorkGroupSize() }, { 296, new OpGetKernelPreferredWorkGroupSizeMultiple() }, { 297, new OpRetainEvent() }, { 298, new OpReleaseEvent() }, { 299, new OpCreateUserEvent() }, { 300, new OpIsValidEvent() }, { 301, new OpSetUserEventStatus() }, { 302, new OpCaptureEventProfilingInfo() }, { 303, new OpGetDefaultQueue() }, { 304, new OpBuildNDRange() }, { 305, new OpImageSparseSampleImplicitLod() }, { 306, new OpImageSparseSampleExplicitLod() }, { 307, new OpImageSparseSampleDrefImplicitLod() }, { 308, new OpImageSparseSampleDrefExplicitLod() }, { 309, new OpImageSparseSampleProjImplicitLod() }, { 310, new OpImageSparseSampleProjExplicitLod() }, { 311, new OpImageSparseSampleProjDrefImplicitLod() }, { 312, new OpImageSparseSampleProjDrefExplicitLod() }, { 313, new OpImageSparseFetch() }, { 314, new OpImageSparseGather() }, { 315, new OpImageSparseDrefGather() }, { 316, new OpImageSparseTexelsResident() }, { 317, new OpNoLine() }, { 318, new OpAtomicFlagTestAndSet() }, { 319, new OpAtomicFlagClear() }, { 320, new OpImageSparseRead() }, { 321, new OpSizeOf() }, { 322, new OpTypePipeStorage() }, { 323, new OpConstantPipeStorage() }, { 324, new OpCreatePipeFromPipeStorage() }, { 325, new OpGetKernelLocalSizeForSubgroupCount() }, { 326, new OpGetKernelMaxNumSubgroups() }, { 327, new OpTypeNamedBarrier() }, { 328, new OpNamedBarrierInitialize() }, { 329, new OpMemoryNamedBarrier() }, { 330, new OpModuleProcessed() }, { 331, new OpExecutionModeId() }, { 332, new OpDecorateId() }, { 4421, new OpSubgroupBallotKHR() }, { 4422, new OpSubgroupFirstInvocationKHR() }, { 4428, new OpSubgroupAllKHR() }, { 4429, new OpSubgroupAnyKHR() }, { 4430, new OpSubgroupAllEqualKHR() }, { 4432, new OpSubgroupReadInvocationKHR() }, { 5000, new OpGroupIAddNonUniformAMD() }, { 5001, new OpGroupFAddNonUniformAMD() }, { 5002, new OpGroupFMinNonUniformAMD() }, { 5003, new OpGroupUMinNonUniformAMD() }, { 5004, new OpGroupSMinNonUniformAMD() }, { 5005, new OpGroupFMaxNonUniformAMD() }, { 5006, new OpGroupUMaxNonUniformAMD() }, { 5007, new OpGroupSMaxNonUniformAMD() }, { 5011, new OpFragmentMaskFetchAMD() }, { 5012, new OpFragmentFetchAMD() }, { 5571, new OpSubgroupShuffleINTEL() }, { 5572, new OpSubgroupShuffleDownINTEL() }, { 5573, new OpSubgroupShuffleUpINTEL() }, { 5574, new OpSubgroupShuffleXorINTEL() }, { 5575, new OpSubgroupBlockReadINTEL() }, { 5576, new OpSubgroupBlockWriteINTEL() }, { 5577, new OpSubgroupImageBlockReadINTEL() }, { 5578, new OpSubgroupImageBlockWriteINTEL() }, }; + public static IReadOnlyDictionary OpcodeToInstruction + { + get => instructions_; + } + } +} \ No newline at end of file diff --git a/AssetStudioUtility/CSspv/SpirV.Meta.cs b/AssetStudioUtility/CSspv/SpirV.Meta.cs new file mode 100644 index 0000000..78a77cb --- /dev/null +++ b/AssetStudioUtility/CSspv/SpirV.Meta.cs @@ -0,0 +1,54 @@ +using System.Collections.Generic; + +namespace SpirV +{ + internal class Meta + { + public class ToolInfo + { + public ToolInfo(string vendor) + { + Vendor = vendor; + } + + public ToolInfo(string vendor, string name) + { + Vendor = vendor; + Name = name; + } + + public string Name { get; } + public string Vendor { get; } + } + + public static uint MagicNumber => 119734787U; + public static uint Version => 66048U; + public static uint Revision => 2U; + public static uint OpCodeMask => 65535U; + public static uint WordCountShift => 16U; + + public static IReadOnlyDictionary Tools => toolInfos_; + + private readonly static Dictionary toolInfos_ = new Dictionary + { + { 0, new ToolInfo("Khronos") }, + { 1, new ToolInfo("LunarG") }, + { 2, new ToolInfo("Valve") }, + { 3, new ToolInfo("Codeplay") }, + { 4, new ToolInfo("NVIDIA") }, + { 5, new ToolInfo("ARM") }, + { 6, new ToolInfo("Khronos", "LLVM/SPIR-V Translator") }, + { 7, new ToolInfo("Khronos", "SPIR-V Tools Assembler") }, + { 8, new ToolInfo("Khronos", "Glslang Reference Front End") }, + { 9, new ToolInfo("Qualcomm") }, + { 10, new ToolInfo("AMD") }, + { 11, new ToolInfo("Intel") }, + { 12, new ToolInfo("Imagination") }, + { 13, new ToolInfo("Google", "Shaderc over Glslang") }, + { 14, new ToolInfo("Google", "spiregg") }, + { 15, new ToolInfo("Google", "rspirv") }, + { 16, new ToolInfo("X-LEGEND", "Mesa-IR/SPIR-V Translator") }, + { 17, new ToolInfo("Khronos", "SPIR-V Tools Linker") }, + }; + } +} \ No newline at end of file diff --git a/AssetStudioUtility/CSspv/Types.cs b/AssetStudioUtility/CSspv/Types.cs new file mode 100644 index 0000000..3746104 --- /dev/null +++ b/AssetStudioUtility/CSspv/Types.cs @@ -0,0 +1,428 @@ +using System.Collections.Generic; +using System.Text; + +namespace SpirV +{ + public class Type + { + public virtual StringBuilder ToString(StringBuilder sb) + { + return sb; + } + } + + public class VoidType : Type + { + public override string ToString() + { + return "void"; + } + + public override StringBuilder ToString(StringBuilder sb) + { + return sb.Append("void"); + } + } + + public class ScalarType : Type + { + } + + public class BoolType : ScalarType + { + public override string ToString() + { + return "bool"; + } + + public override StringBuilder ToString(StringBuilder sb) + { + return sb.Append("bool"); + } + } + + public class IntegerType : ScalarType + { + public IntegerType (int width, bool signed) + { + Width = width; + Signed = signed; + } + + public override string ToString() + { + if (Signed) + { + return $"i{Width}"; + } + else + { + return $"u{Width}"; + } + } + + public override StringBuilder ToString(StringBuilder sb) + { + if (Signed) + { + sb.Append('i').Append(Width); + } + else + { + sb.Append('u').Append(Width); + } + return sb; + } + + public int Width { get; } + public bool Signed { get; } + } + + public class FloatingPointType : ScalarType + { + public FloatingPointType (int width) + { + Width = width; + } + + public override string ToString() + { + return $"f{Width}"; + } + + public override StringBuilder ToString(StringBuilder sb) + { + return sb.Append('f').Append(Width); + } + + public int Width { get; } + } + + public class VectorType : Type + { + public VectorType (ScalarType scalarType, int componentCount) + { + ComponentType = scalarType; + ComponentCount = componentCount; + } + + public override string ToString() + { + return $"{ComponentType}_{ComponentCount}"; + } + + public override StringBuilder ToString(StringBuilder sb) + { + return ComponentType.ToString(sb).Append('_').Append(ComponentCount); + } + + public ScalarType ComponentType { get; } + public int ComponentCount { get; } + } + + public class MatrixType : Type + { + public MatrixType (VectorType vectorType, int columnCount) + { + ColumnType = vectorType; + ColumnCount = columnCount; + } + + public override string ToString () + { + return $"{ColumnType}x{ColumnCount}"; + } + + public override StringBuilder ToString(StringBuilder sb) + { + return sb.Append(ColumnType).Append('x').Append(ColumnCount); + } + + public VectorType ColumnType { get; } + public int ColumnCount { get; } + public int RowCount => ColumnType.ComponentCount; + } + + public class ImageType : Type + { + public ImageType (Type sampledType, Dim dim, int depth, bool isArray, bool isMultisampled, int sampleCount, + ImageFormat imageFormat, AccessQualifier accessQualifier) + { + SampledType = sampledType; + Dim = dim; + Depth = depth; + IsArray = isArray; + IsMultisampled = isMultisampled; + SampleCount = sampleCount; + Format = imageFormat; + AccessQualifier = accessQualifier; + } + + public override string ToString () + { + StringBuilder sb = new StringBuilder (); + ToString(sb); + return sb.ToString(); + } + + public override StringBuilder ToString(StringBuilder sb) + { + switch (AccessQualifier) + { + case AccessQualifier.ReadWrite: + sb.Append("read_write "); + break; + case AccessQualifier.WriteOnly: + sb.Append("write_only "); + break; + case AccessQualifier.ReadOnly: + sb.Append("read_only "); + break; + } + + sb.Append("Texture"); + switch (Dim) + { + case Dim.Dim1D: + sb.Append("1D"); + break; + case Dim.Dim2D: + sb.Append("2D"); + break; + case Dim.Dim3D: + sb.Append("3D"); + break; + case Dim.Cube: + sb.Append("Cube"); + break; + } + + if (IsMultisampled) + { + sb.Append("MS"); + } + if (IsArray) + { + sb.Append("Array"); + } + return sb; + } + + public Type SampledType { get; } + public Dim Dim { get; } + public int Depth { get; } + public bool IsArray { get; } + public bool IsMultisampled { get; } + public int SampleCount { get; } + public ImageFormat Format { get; } + public AccessQualifier AccessQualifier { get; } + } + + public class SamplerType : Type + { + public override string ToString() + { + return "sampler"; + } + + public override StringBuilder ToString(StringBuilder sb) + { + return sb.Append("sampler"); + } + } + + public class SampledImageType : Type + { + public SampledImageType (ImageType imageType) + { + ImageType = imageType; + } + + public override string ToString() + { + return $"{ImageType}Sampled"; + } + + public override StringBuilder ToString(StringBuilder sb) + { + return ImageType.ToString(sb).Append("Sampled"); + } + + public ImageType ImageType { get; } + } + + public class ArrayType : Type + { + public ArrayType (Type elementType, int elementCount) + { + ElementType = elementType; + ElementCount = elementCount; + } + + public override string ToString() + { + return $"{ElementType}[{ElementCount}]"; + } + + public override StringBuilder ToString(StringBuilder sb) + { + return ElementType.ToString(sb).Append('[').Append(ElementCount).Append(']'); + } + + public int ElementCount { get; } + public Type ElementType { get; } + } + + public class RuntimeArrayType : Type + { + public RuntimeArrayType(Type elementType) + { + ElementType = elementType; + } + + public Type ElementType { get; } + } + + public class StructType : Type + { + public StructType(IReadOnlyList memberTypes) + { + MemberTypes = memberTypes; + memberNames_ = new List(); + + for (int i = 0; i < memberTypes.Count; ++i) + { + memberNames_.Add(string.Empty); + } + } + + public void SetMemberName(uint member, string name) + { + memberNames_[(int)member] = name; + } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + ToString(sb); + return sb.ToString(); + } + + public override StringBuilder ToString(StringBuilder sb) + { + sb.Append("struct {"); + for (int i = 0; i < MemberTypes.Count; ++i) + { + Type memberType = MemberTypes[i]; + memberType.ToString(sb); + if (!string.IsNullOrEmpty(memberNames_[i])) + { + sb.Append(' '); + sb.Append(MemberNames[i]); + } + + sb.Append(';'); + if (i < (MemberTypes.Count - 1)) + { + sb.Append(' '); + } + } + sb.Append('}'); + return sb; + } + + public IReadOnlyList MemberTypes { get; } + public IReadOnlyList MemberNames => memberNames_; + + private List memberNames_; + } + + public class OpaqueType : Type + { + } + + public class PointerType : Type + { + public PointerType(StorageClass storageClass, Type type) + { + StorageClass = storageClass; + Type = type; + } + + public PointerType(StorageClass storageClass) + { + StorageClass = storageClass; + } + + public void ResolveForwardReference(Type t) + { + Type = t; + } + + public override string ToString() + { + if (Type == null) + { + return $"{StorageClass} *"; + } + else + { + return $"{StorageClass} {Type}*"; + } + } + + public override StringBuilder ToString(StringBuilder sb) + { + sb.Append(StorageClass.ToString()).Append(' '); + if (Type != null) + { + Type.ToString(sb); + } + sb.Append('*'); + return sb; + } + + public StorageClass StorageClass { get; } + public Type Type { get; private set; } + } + + public class FunctionType : Type + { + public FunctionType(Type returnType, IReadOnlyList parameterTypes) + { + ReturnType = returnType; + ParameterTypes = parameterTypes; + } + + public Type ReturnType { get; } + public IReadOnlyList ParameterTypes { get; } + } + + public class EventType : Type + { + } + + public class DeviceEventType : Type + { + } + + public class ReserveIdType : Type + { + } + + public class QueueType : Type + { + } + + public class PipeType : Type + { + } + + public class PipeStorage : Type + { + } + + public class NamedBarrier : Type + { + } +} diff --git a/AssetStudioUtility/ShaderConverter.cs b/AssetStudioUtility/ShaderConverter.cs index 80ad441..e2ed8aa 100644 --- a/AssetStudioUtility/ShaderConverter.cs +++ b/AssetStudioUtility/ShaderConverter.cs @@ -21,13 +21,13 @@ namespace AssetStudio using (var blobReader = new BinaryReader(new MemoryStream(decompressedBytes))) { var program = new ShaderProgram(blobReader, shader.version); - return program.Export(Encoding.UTF8.GetString(shader.m_Script)); + return header + program.Export(Encoding.UTF8.GetString(shader.m_Script)); } } if (shader.compressedBlob != null) //5.5 and up { - return ConvertSerializedShader(shader); + return header + ConvertSerializedShader(shader); } return header + Encoding.UTF8.GetString(shader.m_Script); @@ -727,14 +727,14 @@ namespace AssetStudio case ShaderGpuProgramType.kShaderGpuProgramDX11HullSM50: case ShaderGpuProgramType.kShaderGpuProgramDX11DomainSM50: { - int start = 6; + /*int start = 6; if (m_Version == 201509030) // 5.3 { start = 5; } var buff = new byte[m_ProgramCode.Length - start]; Buffer.BlockCopy(m_ProgramCode, start, buff, 0, buff.Length); - /*var shaderBytecode = new ShaderBytecode(buff); + var shaderBytecode = new ShaderBytecode(buff); sb.Append(shaderBytecode.Disassemble());*/ sb.Append("// shader disassembly not supported on DXBC"); break; @@ -755,7 +755,14 @@ namespace AssetStudio } break; case ShaderGpuProgramType.kShaderGpuProgramSPIRV: - sb.Append("// shader disassembly not supported on SPIR-V\n"); + try + { + sb.Append(SpirVShaderConverter.Convert(m_ProgramCode)); + } + catch (Exception e) + { + sb.Append($"// disassembly error {e.Message}\n"); + } break; case ShaderGpuProgramType.kShaderGpuProgramConsoleVS: case ShaderGpuProgramType.kShaderGpuProgramConsoleFS: diff --git a/AssetStudioUtility/Smolv/OpData.cs b/AssetStudioUtility/Smolv/OpData.cs new file mode 100644 index 0000000..3a62fec --- /dev/null +++ b/AssetStudioUtility/Smolv/OpData.cs @@ -0,0 +1,365 @@ +namespace Smolv +{ + public struct OpData + { + public OpData(byte hasResult, byte hasType, sbyte deltaFromResult, byte varrest) + { + this.hasResult = hasResult; + this.hasType = hasType; + this.deltaFromResult = deltaFromResult; + this.varrest = varrest; + } + + /// + /// Does it have result ID? + /// + public byte hasResult; + /// + /// Does it have type ID? + /// + public byte hasType; + /// + /// How many words after (optional) type+result to write out as deltas from result? + /// + public sbyte deltaFromResult; + /// + /// Should the rest of words be written in varint encoding? + /// + public byte varrest; + + public static readonly OpData[] SpirvOpData = + { + new OpData(0, 0, 0, 0), // Nop + new OpData(1, 1, 0, 0), // Undef + new OpData(0, 0, 0, 0), // SourceContinued + new OpData(0, 0, 0, 1), // Source + new OpData(0, 0, 0, 0), // SourceExtension + new OpData(0, 0, 0, 0), // Name + new OpData(0, 0, 0, 0), // MemberName + new OpData(0, 0, 0, 0), // String + new OpData(0, 0, 0, 1), // Line + new OpData(1, 1, 0, 0), // #9 + new OpData(0, 0, 0, 0), // Extension + new OpData(1, 0, 0, 0), // ExtInstImport + new OpData(1, 1, 0, 1), // ExtInst + new OpData(1, 1, 2, 1), // VectorShuffleCompact - new in SMOLV + new OpData(0, 0, 0, 1), // MemoryModel + new OpData(0, 0, 0, 1), // EntryPoint + new OpData(0, 0, 0, 1), // ExecutionMode + new OpData(0, 0, 0, 1), // Capability + new OpData(1, 1, 0, 0), // #18 + new OpData(1, 0, 0, 1), // TypeVoid + new OpData(1, 0, 0, 1), // TypeBool + new OpData(1, 0, 0, 1), // TypeInt + new OpData(1, 0, 0, 1), // TypeFloat + new OpData(1, 0, 0, 1), // TypeVector + new OpData(1, 0, 0, 1), // TypeMatrix + new OpData(1, 0, 0, 1), // TypeImage + new OpData(1, 0, 0, 1), // TypeSampler + new OpData(1, 0, 0, 1), // TypeSampledImage + new OpData(1, 0, 0, 1), // TypeArray + new OpData(1, 0, 0, 1), // TypeRuntimeArray + new OpData(1, 0, 0, 1), // TypeStruct + new OpData(1, 0, 0, 1), // TypeOpaque + new OpData(1, 0, 0, 1), // TypePointer + new OpData(1, 0, 0, 1), // TypeFunction + new OpData(1, 0, 0, 1), // TypeEvent + new OpData(1, 0, 0, 1), // TypeDeviceEvent + new OpData(1, 0, 0, 1), // TypeReserveId + new OpData(1, 0, 0, 1), // TypeQueue + new OpData(1, 0, 0, 1), // TypePipe + new OpData(0, 0, 0, 1), // TypeForwardPointer + new OpData(1, 1, 0, 0), // #40 + new OpData(1, 1, 0, 0), // ConstantTrue + new OpData(1, 1, 0, 0), // ConstantFalse + new OpData(1, 1, 0, 0), // Constant + new OpData(1, 1, 9, 0), // ConstantComposite + new OpData(1, 1, 0, 1), // ConstantSampler + new OpData(1, 1, 0, 0), // ConstantNull + new OpData(1, 1, 0, 0), // #47 + new OpData(1, 1, 0, 0), // SpecConstantTrue + new OpData(1, 1, 0, 0), // SpecConstantFalse + new OpData(1, 1, 0, 0), // SpecConstant + new OpData(1, 1, 9, 0), // SpecConstantComposite + new OpData(1, 1, 0, 0), // SpecConstantOp + new OpData(1, 1, 0, 0), // #53 + new OpData(1, 1, 0, 1), // Function + new OpData(1, 1, 0, 0), // FunctionParameter + new OpData(0, 0, 0, 0), // FunctionEnd + new OpData(1, 1, 9, 0), // FunctionCall + new OpData(1, 1, 0, 0), // #58 + new OpData(1, 1, 0, 1), // Variable + new OpData(1, 1, 0, 0), // ImageTexelPointer + new OpData(1, 1, 1, 1), // Load + new OpData(0, 0, 2, 1), // Store + new OpData(0, 0, 0, 0), // CopyMemory + new OpData(0, 0, 0, 0), // CopyMemorySized + new OpData(1, 1, 0, 1), // AccessChain + new OpData(1, 1, 0, 0), // InBoundsAccessChain + new OpData(1, 1, 0, 0), // PtrAccessChain + new OpData(1, 1, 0, 0), // ArrayLength + new OpData(1, 1, 0, 0), // GenericPtrMemSemantics + new OpData(1, 1, 0, 0), // InBoundsPtrAccessChain + new OpData(0, 0, 0, 1), // Decorate + new OpData(0, 0, 0, 1), // MemberDecorate + new OpData(1, 0, 0, 0), // DecorationGroup + new OpData(0, 0, 0, 0), // GroupDecorate + new OpData(0, 0, 0, 0), // GroupMemberDecorate + new OpData(1, 1, 0, 0), // #76 + new OpData(1, 1, 1, 1), // VectorExtractDynamic + new OpData(1, 1, 2, 1), // VectorInsertDynamic + new OpData(1, 1, 2, 1), // VectorShuffle + new OpData(1, 1, 9, 0), // CompositeConstruct + new OpData(1, 1, 1, 1), // CompositeExtract + new OpData(1, 1, 2, 1), // CompositeInsert + new OpData(1, 1, 1, 0), // CopyObject + new OpData(1, 1, 0, 0), // Transpose + new OpData(1, 1, 0, 0), // #85 + new OpData(1, 1, 0, 0), // SampledImage + new OpData(1, 1, 2, 1), // ImageSampleImplicitLod + new OpData(1, 1, 2, 1), // ImageSampleExplicitLod + new OpData(1, 1, 3, 1), // ImageSampleDrefImplicitLod + new OpData(1, 1, 3, 1), // ImageSampleDrefExplicitLod + new OpData(1, 1, 2, 1), // ImageSampleProjImplicitLod + new OpData(1, 1, 2, 1), // ImageSampleProjExplicitLod + new OpData(1, 1, 3, 1), // ImageSampleProjDrefImplicitLod + new OpData(1, 1, 3, 1), // ImageSampleProjDrefExplicitLod + new OpData(1, 1, 2, 1), // ImageFetch + new OpData(1, 1, 3, 1), // ImageGather + new OpData(1, 1, 3, 1), // ImageDrefGather + new OpData(1, 1, 2, 1), // ImageRead + new OpData(0, 0, 3, 1), // ImageWrite + new OpData(1, 1, 1, 0), // Image + new OpData(1, 1, 1, 0), // ImageQueryFormat + new OpData(1, 1, 1, 0), // ImageQueryOrder + new OpData(1, 1, 2, 0), // ImageQuerySizeLod + new OpData(1, 1, 1, 0), // ImageQuerySize + new OpData(1, 1, 2, 0), // ImageQueryLod + new OpData(1, 1, 1, 0), // ImageQueryLevels + new OpData(1, 1, 1, 0), // ImageQuerySamples + new OpData(1, 1, 0, 0), // #108 + new OpData(1, 1, 1, 0), // ConvertFToU + new OpData(1, 1, 1, 0), // ConvertFToS + new OpData(1, 1, 1, 0), // ConvertSToF + new OpData(1, 1, 1, 0), // ConvertUToF + new OpData(1, 1, 1, 0), // UConvert + new OpData(1, 1, 1, 0), // SConvert + new OpData(1, 1, 1, 0), // FConvert + new OpData(1, 1, 1, 0), // QuantizeToF16 + new OpData(1, 1, 1, 0), // ConvertPtrToU + new OpData(1, 1, 1, 0), // SatConvertSToU + new OpData(1, 1, 1, 0), // SatConvertUToS + new OpData(1, 1, 1, 0), // ConvertUToPtr + new OpData(1, 1, 1, 0), // PtrCastToGeneric + new OpData(1, 1, 1, 0), // GenericCastToPtr + new OpData(1, 1, 1, 1), // GenericCastToPtrExplicit + new OpData(1, 1, 1, 0), // Bitcast + new OpData(1, 1, 0, 0), // #125 + new OpData(1, 1, 1, 0), // SNegate + new OpData(1, 1, 1, 0), // FNegate + new OpData(1, 1, 2, 0), // IAdd + new OpData(1, 1, 2, 0), // FAdd + new OpData(1, 1, 2, 0), // ISub + new OpData(1, 1, 2, 0), // FSub + new OpData(1, 1, 2, 0), // IMul + new OpData(1, 1, 2, 0), // FMul + new OpData(1, 1, 2, 0), // UDiv + new OpData(1, 1, 2, 0), // SDiv + new OpData(1, 1, 2, 0), // FDiv + new OpData(1, 1, 2, 0), // UMod + new OpData(1, 1, 2, 0), // SRem + new OpData(1, 1, 2, 0), // SMod + new OpData(1, 1, 2, 0), // FRem + new OpData(1, 1, 2, 0), // FMod + new OpData(1, 1, 2, 0), // VectorTimesScalar + new OpData(1, 1, 2, 0), // MatrixTimesScalar + new OpData(1, 1, 2, 0), // VectorTimesMatrix + new OpData(1, 1, 2, 0), // MatrixTimesVector + new OpData(1, 1, 2, 0), // MatrixTimesMatrix + new OpData(1, 1, 2, 0), // OuterProduct + new OpData(1, 1, 2, 0), // Dot + new OpData(1, 1, 2, 0), // IAddCarry + new OpData(1, 1, 2, 0), // ISubBorrow + new OpData(1, 1, 2, 0), // UMulExtended + new OpData(1, 1, 2, 0), // SMulExtended + new OpData(1, 1, 0, 0), // #153 + new OpData(1, 1, 1, 0), // Any + new OpData(1, 1, 1, 0), // All + new OpData(1, 1, 1, 0), // IsNan + new OpData(1, 1, 1, 0), // IsInf + new OpData(1, 1, 1, 0), // IsFinite + new OpData(1, 1, 1, 0), // IsNormal + new OpData(1, 1, 1, 0), // SignBitSet + new OpData(1, 1, 2, 0), // LessOrGreater + new OpData(1, 1, 2, 0), // Ordered + new OpData(1, 1, 2, 0), // Unordered + new OpData(1, 1, 2, 0), // LogicalEqual + new OpData(1, 1, 2, 0), // LogicalNotEqual + new OpData(1, 1, 2, 0), // LogicalOr + new OpData(1, 1, 2, 0), // LogicalAnd + new OpData(1, 1, 1, 0), // LogicalNot + new OpData(1, 1, 3, 0), // Select + new OpData(1, 1, 2, 0), // IEqual + new OpData(1, 1, 2, 0), // INotEqual + new OpData(1, 1, 2, 0), // UGreaterThan + new OpData(1, 1, 2, 0), // SGreaterThan + new OpData(1, 1, 2, 0), // UGreaterThanEqual + new OpData(1, 1, 2, 0), // SGreaterThanEqual + new OpData(1, 1, 2, 0), // ULessThan + new OpData(1, 1, 2, 0), // SLessThan + new OpData(1, 1, 2, 0), // ULessThanEqual + new OpData(1, 1, 2, 0), // SLessThanEqual + new OpData(1, 1, 2, 0), // FOrdEqual + new OpData(1, 1, 2, 0), // FUnordEqual + new OpData(1, 1, 2, 0), // FOrdNotEqual + new OpData(1, 1, 2, 0), // FUnordNotEqual + new OpData(1, 1, 2, 0), // FOrdLessThan + new OpData(1, 1, 2, 0), // FUnordLessThan + new OpData(1, 1, 2, 0), // FOrdGreaterThan + new OpData(1, 1, 2, 0), // FUnordGreaterThan + new OpData(1, 1, 2, 0), // FOrdLessThanEqual + new OpData(1, 1, 2, 0), // FUnordLessThanEqual + new OpData(1, 1, 2, 0), // FOrdGreaterThanEqual + new OpData(1, 1, 2, 0), // FUnordGreaterThanEqual + new OpData(1, 1, 0, 0), // #192 + new OpData(1, 1, 0, 0), // #193 + new OpData(1, 1, 2, 0), // ShiftRightLogical + new OpData(1, 1, 2, 0), // ShiftRightArithmetic + new OpData(1, 1, 2, 0), // ShiftLeftLogical + new OpData(1, 1, 2, 0), // BitwiseOr + new OpData(1, 1, 2, 0), // BitwiseXor + new OpData(1, 1, 2, 0), // BitwiseAnd + new OpData(1, 1, 1, 0), // Not + new OpData(1, 1, 4, 0), // BitFieldInsert + new OpData(1, 1, 3, 0), // BitFieldSExtract + new OpData(1, 1, 3, 0), // BitFieldUExtract + new OpData(1, 1, 1, 0), // BitReverse + new OpData(1, 1, 1, 0), // BitCount + new OpData(1, 1, 0, 0), // #206 + new OpData(1, 1, 0, 0), // DPdx + new OpData(1, 1, 0, 0), // DPdy + new OpData(1, 1, 0, 0), // Fwidth + new OpData(1, 1, 0, 0), // DPdxFine + new OpData(1, 1, 0, 0), // DPdyFine + new OpData(1, 1, 0, 0), // FwidthFine + new OpData(1, 1, 0, 0), // DPdxCoarse + new OpData(1, 1, 0, 0), // DPdyCoarse + new OpData(1, 1, 0, 0), // FwidthCoarse + new OpData(1, 1, 0, 0), // #216 + new OpData(1, 1, 0, 0), // #217 + new OpData(0, 0, 0, 0), // EmitVertex + new OpData(0, 0, 0, 0), // EndPrimitive + new OpData(0, 0, 0, 0), // EmitStreamVertex + new OpData(0, 0, 0, 0), // EndStreamPrimitive + new OpData(1, 1, 0, 0), // #222 + new OpData(1, 1, 0, 0), // #223 + new OpData(0, 0, -3, 0), // ControlBarrier + new OpData(0, 0, -2, 0), // MemoryBarrier + new OpData(1, 1, 0, 0), // #226 + new OpData(1, 1, 0, 0), // AtomicLoad + new OpData(0, 0, 0, 0), // AtomicStore + new OpData(1, 1, 0, 0), // AtomicExchange + new OpData(1, 1, 0, 0), // AtomicCompareExchange + new OpData(1, 1, 0, 0), // AtomicCompareExchangeWeak + new OpData(1, 1, 0, 0), // AtomicIIncrement + new OpData(1, 1, 0, 0), // AtomicIDecrement + new OpData(1, 1, 0, 0), // AtomicIAdd + new OpData(1, 1, 0, 0), // AtomicISub + new OpData(1, 1, 0, 0), // AtomicSMin + new OpData(1, 1, 0, 0), // AtomicUMin + new OpData(1, 1, 0, 0), // AtomicSMax + new OpData(1, 1, 0, 0), // AtomicUMax + new OpData(1, 1, 0, 0), // AtomicAnd + new OpData(1, 1, 0, 0), // AtomicOr + new OpData(1, 1, 0, 0), // AtomicXor + new OpData(1, 1, 0, 0), // #243 + new OpData(1, 1, 0, 0), // #244 + new OpData(1, 1, 0, 0), // Phi + new OpData(0, 0, -2, 1), // LoopMerge + new OpData(0, 0, -1, 1), // SelectionMerge + new OpData(1, 0, 0, 0), // Label + new OpData(0, 0, -1, 0), // Branch + new OpData(0, 0, -3, 1), // BranchConditional + new OpData(0, 0, 0, 0), // Switch + new OpData(0, 0, 0, 0), // Kill + new OpData(0, 0, 0, 0), // Return + new OpData(0, 0, 0, 0), // ReturnValue + new OpData(0, 0, 0, 0), // Unreachable + new OpData(0, 0, 0, 0), // LifetimeStart + new OpData(0, 0, 0, 0), // LifetimeStop + new OpData(1, 1, 0, 0), // #258 + new OpData(1, 1, 0, 0), // GroupAsyncCopy + new OpData(0, 0, 0, 0), // GroupWaitEvents + new OpData(1, 1, 0, 0), // GroupAll + new OpData(1, 1, 0, 0), // GroupAny + new OpData(1, 1, 0, 0), // GroupBroadcast + new OpData(1, 1, 0, 0), // GroupIAdd + new OpData(1, 1, 0, 0), // GroupFAdd + new OpData(1, 1, 0, 0), // GroupFMin + new OpData(1, 1, 0, 0), // GroupUMin + new OpData(1, 1, 0, 0), // GroupSMin + new OpData(1, 1, 0, 0), // GroupFMax + new OpData(1, 1, 0, 0), // GroupUMax + new OpData(1, 1, 0, 0), // GroupSMax + new OpData(1, 1, 0, 0), // #272 + new OpData(1, 1, 0, 0), // #273 + new OpData(1, 1, 0, 0), // ReadPipe + new OpData(1, 1, 0, 0), // WritePipe + new OpData(1, 1, 0, 0), // ReservedReadPipe + new OpData(1, 1, 0, 0), // ReservedWritePipe + new OpData(1, 1, 0, 0), // ReserveReadPipePackets + new OpData(1, 1, 0, 0), // ReserveWritePipePackets + new OpData(0, 0, 0, 0), // CommitReadPipe + new OpData(0, 0, 0, 0), // CommitWritePipe + new OpData(1, 1, 0, 0), // IsValidReserveId + new OpData(1, 1, 0, 0), // GetNumPipePackets + new OpData(1, 1, 0, 0), // GetMaxPipePackets + new OpData(1, 1, 0, 0), // GroupReserveReadPipePackets + new OpData(1, 1, 0, 0), // GroupReserveWritePipePackets + new OpData(0, 0, 0, 0), // GroupCommitReadPipe + new OpData(0, 0, 0, 0), // GroupCommitWritePipe + new OpData(1, 1, 0, 0), // #289 + new OpData(1, 1, 0, 0), // #290 + new OpData(1, 1, 0, 0), // EnqueueMarker + new OpData(1, 1, 0, 0), // EnqueueKernel + new OpData(1, 1, 0, 0), // GetKernelNDrangeSubGroupCount + new OpData(1, 1, 0, 0), // GetKernelNDrangeMaxSubGroupSize + new OpData(1, 1, 0, 0), // GetKernelWorkGroupSize + new OpData(1, 1, 0, 0), // GetKernelPreferredWorkGroupSizeMultiple + new OpData(0, 0, 0, 0), // RetainEvent + new OpData(0, 0, 0, 0), // ReleaseEvent + new OpData(1, 1, 0, 0), // CreateUserEvent + new OpData(1, 1, 0, 0), // IsValidEvent + new OpData(0, 0, 0, 0), // SetUserEventStatus + new OpData(0, 0, 0, 0), // CaptureEventProfilingInfo + new OpData(1, 1, 0, 0), // GetDefaultQueue + new OpData(1, 1, 0, 0), // BuildNDRange + new OpData(1, 1, 2, 1), // ImageSparseSampleImplicitLod + new OpData(1, 1, 2, 1), // ImageSparseSampleExplicitLod + new OpData(1, 1, 3, 1), // ImageSparseSampleDrefImplicitLod + new OpData(1, 1, 3, 1), // ImageSparseSampleDrefExplicitLod + new OpData(1, 1, 2, 1), // ImageSparseSampleProjImplicitLod + new OpData(1, 1, 2, 1), // ImageSparseSampleProjExplicitLod + new OpData(1, 1, 3, 1), // ImageSparseSampleProjDrefImplicitLod + new OpData(1, 1, 3, 1), // ImageSparseSampleProjDrefExplicitLod + new OpData(1, 1, 2, 1), // ImageSparseFetch + new OpData(1, 1, 3, 1), // ImageSparseGather + new OpData(1, 1, 3, 1), // ImageSparseDrefGather + new OpData(1, 1, 1, 0), // ImageSparseTexelsResident + new OpData(0, 0, 0, 0), // NoLine + new OpData(1, 1, 0, 0), // AtomicFlagTestAndSet + new OpData(0, 0, 0, 0), // AtomicFlagClear + new OpData(1, 1, 0, 0), // ImageSparseRead + new OpData(1, 1, 0, 0), // SizeOf + new OpData(1, 1, 0, 0), // TypePipeStorage + new OpData(1, 1, 0, 0), // ConstantPipeStorage + new OpData(1, 1, 0, 0), // CreatePipeFromPipeStorage + new OpData(1, 1, 0, 0), // GetKernelLocalSizeForSubgroupCount + new OpData(1, 1, 0, 0), // GetKernelMaxNumSubgroups + new OpData(1, 1, 0, 0), // TypeNamedBarrier + new OpData(1, 1, 0, 1), // NamedBarrierInitialize + new OpData(0, 0, -2, 1), // MemoryNamedBarrier + new OpData(1, 1, 0, 0), // ModuleProcessed + }; + }; +} diff --git a/AssetStudioUtility/Smolv/SmolvDecoder.cs b/AssetStudioUtility/Smolv/SmolvDecoder.cs new file mode 100644 index 0000000..c0ea8bd --- /dev/null +++ b/AssetStudioUtility/Smolv/SmolvDecoder.cs @@ -0,0 +1,479 @@ +using System; +using System.IO; +using System.Text; + +namespace Smolv +{ + public static class SmolvDecoder + { + public static int GetDecodedBufferSize(byte[] data) + { + if (data == null) + { + throw new ArgumentNullException(nameof(data)); + } + + if (!CheckSmolHeader(data)) + { + return 0; + } + + int size = BitConverter.ToInt32(data, 5 * sizeof(uint)); + return size; + } + + public static int GetDecodedBufferSize(Stream stream) + { + if (stream == null) + { + throw new ArgumentNullException(nameof(stream)); + } + if (!stream.CanSeek) + { + throw new ArgumentException(nameof(stream)); + } + if (stream.Position + HeaderSize > stream.Length) + { + return 0; + } + + long initPosition = stream.Position; + stream.Position += HeaderSize - sizeof(uint); + int size = stream.ReadByte() | stream.ReadByte() << 8 | stream.ReadByte() << 16 | stream.ReadByte() << 24; + stream.Position = initPosition; + return size; + } + + public static byte[] Decode(byte[] data) + { + if (data == null) + { + throw new ArgumentNullException(nameof(data)); + } + + int bufferSize = GetDecodedBufferSize(data); + if (bufferSize == 0) + { + // invalid SMOL-V + return null; + } + + byte[] output = new byte[bufferSize]; + if (Decode(data, output)) + { + return output; + } + + return null; + } + + public static bool Decode(byte[] data, byte[] output) + { + if (data == null) + { + throw new ArgumentNullException(nameof(data)); + } + if (output == null) + { + throw new ArgumentNullException(nameof(output)); + } + + int bufferSize = GetDecodedBufferSize(data); + if (bufferSize > output.Length) + { + return false; + } + + using (MemoryStream outputStream = new MemoryStream(output)) + { + return Decode(data, outputStream); + } + } + + public static bool Decode(byte[] data, Stream outputStream) + { + if (data == null) + { + throw new ArgumentNullException(nameof(data)); + } + using (MemoryStream inputStream = new MemoryStream(data)) + { + return Decode(inputStream, data.Length, outputStream); + } + } + + public static bool Decode(Stream inputStream, int inputSize, Stream outputStream) + { + if (inputStream == null) + { + throw new ArgumentNullException(nameof(inputStream)); + } + if (outputStream == null) + { + throw new ArgumentNullException(nameof(outputStream)); + } + if (inputStream.Length < HeaderSize) + { + return false; + } + + using (BinaryReader input = new BinaryReader(inputStream, Encoding.UTF8, true)) + { + using (BinaryWriter output = new BinaryWriter(outputStream, Encoding.UTF8, true)) + { + long inputEndPosition = input.BaseStream.Position + inputSize; + long outputStartPosition = output.BaseStream.Position; + + // Header + output.Write(SpirVHeaderMagic); + input.BaseStream.Position += sizeof(uint); + uint version = input.ReadUInt32(); + output.Write(version); + uint generator = input.ReadUInt32(); + output.Write(generator); + int bound = input.ReadInt32(); + output.Write(bound); + uint schema = input.ReadUInt32(); + output.Write(schema); + int decodedSize = input.ReadInt32(); + + // Body + int prevResult = 0; + int prevDecorate = 0; + while (input.BaseStream.Position < inputEndPosition) + { + // read length + opcode + if (!ReadLengthOp(input, out uint instrLen, out SpvOp op)) + { + return false; + } + + bool wasSwizzle = op == SpvOp.VectorShuffleCompact; + if (wasSwizzle) + { + op = SpvOp.VectorShuffle; + } + output.Write((instrLen << 16) | (uint)op); + + uint ioffs = 1; + // read type as varint, if we have it + if (op.OpHasType()) + { + if (!ReadVarint(input, out uint value)) + { + return false; + } + + output.Write(value); + ioffs++; + } + + // read result as delta+varint, if we have it + if (op.OpHasResult()) + { + if (!ReadVarint(input, out uint value)) + { + return false; + } + + int zds = prevResult + ZigDecode(value); + output.Write(zds); + prevResult = zds; + ioffs++; + } + + // Decorate: IDs relative to previous decorate + if (op == SpvOp.Decorate || op == SpvOp.MemberDecorate) + { + if (!ReadVarint(input, out uint value)) + { + return false; + } + + int zds = prevDecorate + unchecked((int)value); + output.Write(zds); + prevDecorate = zds; + ioffs++; + } + + // Read this many IDs, that are relative to result ID + int relativeCount = op.OpDeltaFromResult(); + bool inverted = false; + if (relativeCount < 0) + { + inverted = true; + relativeCount = -relativeCount; + } + for (int i = 0; i < relativeCount && ioffs < instrLen; ++i, ++ioffs) + { + if (!ReadVarint(input, out uint value)) + { + return false; + } + + int zd = inverted ? ZigDecode(value) : unchecked((int)value); + output.Write(prevResult - zd); + } + + if (wasSwizzle && instrLen <= 9) + { + uint swizzle = input.ReadByte(); + if (instrLen > 5) output.Write(swizzle >> 6); + if (instrLen > 6) output.Write((swizzle >> 4) & 3); + if (instrLen > 7) output.Write((swizzle >> 2) & 3); + if (instrLen > 8) output.Write(swizzle & 3); + } + else if (op.OpVarRest()) + { + // read rest of words with variable encoding + for (; ioffs < instrLen; ++ioffs) + { + if (!ReadVarint(input, out uint value)) + { + return false; + } + output.Write(value); + } + } + else + { + // read rest of words without any encoding + for (; ioffs < instrLen; ++ioffs) + { + if (input.BaseStream.Position + 4 > input.BaseStream.Length) + { + return false; + } + uint val = input.ReadUInt32(); + output.Write(val); + } + } + } + + if (output.BaseStream.Position != outputStartPosition + decodedSize) + { + // something went wrong during decoding? we should have decoded to exact output size + return false; + } + + return true; + } + } + } + + private static bool CheckSmolHeader(byte[] data) + { + if (!CheckGenericHeader(data, SmolHeaderMagic)) + { + return false; + } + + return true; + } + + private static bool CheckGenericHeader(byte[] data, uint expectedMagic) + { + if (data == null) + { + return false; + } + if (data.Length < HeaderSize) + { + return false; + } + + uint headerMagic = BitConverter.ToUInt32(data, 0 * sizeof(uint)); + if (headerMagic != expectedMagic) + { + return false; + } + + uint headerVersion = BitConverter.ToUInt32(data, 1 * sizeof(uint)); + if (headerVersion < 0x00010000 || headerVersion > 0x00010300) + { + // only support 1.0 through 1.3 + return false; + } + + return true; + } + + private static bool ReadVarint(BinaryReader input, out uint value) + { + uint v = 0; + int shift = 0; + while (input.BaseStream.Position < input.BaseStream.Length) + { + byte b = input.ReadByte(); + v |= unchecked((uint)(b & 127) << shift); + shift += 7; + if ((b & 128) == 0) + { + break; + } + } + + value = v; + // @TODO: report failures + return true; + } + + private static bool ReadLengthOp(BinaryReader input, out uint len, out SpvOp op) + { + len = default; + op = default; + if (!ReadVarint(input, out uint value)) + { + return false; + } + len = ((value >> 20) << 4) | ((value >> 4) & 0xF); + op = (SpvOp) (((value >> 4) & 0xFFF0) | (value & 0xF)); + + op = RemapOp(op); + len = DecodeLen(op, len); + return true; + } + + /// + /// Remap most common Op codes (Load, Store, Decorate, VectorShuffle etc.) to be in < 16 range, for + /// more compact varint encoding. This basically swaps rarely used op values that are < 16 with the + /// ones that are common. + /// + private static SpvOp RemapOp(SpvOp op) + { + switch (op) + { + // 0: 24% + case SpvOp.Decorate: + return SpvOp.Nop; + case SpvOp.Nop: + return SpvOp.Decorate; + + // 1: 17% + case SpvOp.Load: + return SpvOp.Undef; + case SpvOp.Undef: + return SpvOp.Load; + + // 2: 9% + case SpvOp.Store: + return SpvOp.SourceContinued; + case SpvOp.SourceContinued: + return SpvOp.Store; + + // 3: 7.2% + case SpvOp.AccessChain: + return SpvOp.Source; + case SpvOp.Source: + return SpvOp.AccessChain; + + // 4: 5.0% + // Name - already small enum value - 5: 4.4% + // MemberName - already small enum value - 6: 2.9% + case SpvOp.VectorShuffle: + return SpvOp.SourceExtension; + case SpvOp.SourceExtension: + return SpvOp.VectorShuffle; + + // 7: 4.0% + case SpvOp.MemberDecorate: + return SpvOp.String; + case SpvOp.String: + return SpvOp.MemberDecorate; + + // 8: 0.9% + case SpvOp.Label: + return SpvOp.Line; + case SpvOp.Line: + return SpvOp.Label; + + // 9: 3.9% + case SpvOp.Variable: + return (SpvOp)9; + case (SpvOp)9: + return SpvOp.Variable; + + // 10: 3.9% + case SpvOp.FMul: + return SpvOp.Extension; + case SpvOp.Extension: + return SpvOp.FMul; + + // 11: 2.5% + // ExtInst - already small enum value - 12: 1.2% + // VectorShuffleCompact - already small enum value - used for compact shuffle encoding + case SpvOp.FAdd: + return SpvOp.ExtInstImport; + case SpvOp.ExtInstImport: + return SpvOp.FAdd; + + // 14: 2.2% + case SpvOp.TypePointer: + return SpvOp.MemoryModel; + case SpvOp.MemoryModel: + return SpvOp.TypePointer; + + // 15: 1.1% + case SpvOp.FNegate: + return SpvOp.EntryPoint; + case SpvOp.EntryPoint: + return SpvOp.FNegate; + } + return op; + } + + private static uint DecodeLen(SpvOp op, uint len) + { + len++; + switch (op) + { + case SpvOp.VectorShuffle: + len += 4; + break; + case SpvOp.VectorShuffleCompact: + len += 4; + break; + case SpvOp.Decorate: + len += 2; + break; + case SpvOp.Load: + len += 3; + break; + case SpvOp.AccessChain: + len += 3; + break; + } + return len; + } + + private static int DecorationExtraOps(int dec) + { + // RelaxedPrecision, Block..ColMajor + if (dec == 0 || (dec >= 2 && dec <= 5)) + { + return 0; + } + // Stream..XfbStride + if (dec >= 29 && dec <= 37) + { + return 1; + } + + // unknown, encode length + return -1; + } + + private static int ZigDecode(uint u) + { + return (u & 1) != 0 ? unchecked((int)(~(u >> 1))) : unchecked((int)(u >> 1)); + } + + public const uint SpirVHeaderMagic = 0x07230203; + /// + /// 'SMOL' ascii + /// + public const uint SmolHeaderMagic = 0x534D4F4C; + + private const int HeaderSize = 6 * sizeof(uint); + } +} diff --git a/AssetStudioUtility/Smolv/SpvOp.cs b/AssetStudioUtility/Smolv/SpvOp.cs new file mode 100644 index 0000000..b45effe --- /dev/null +++ b/AssetStudioUtility/Smolv/SpvOp.cs @@ -0,0 +1,369 @@ +namespace Smolv +{ + public enum SpvOp + { + Nop = 0, + Undef = 1, + SourceContinued = 2, + Source = 3, + SourceExtension = 4, + Name = 5, + MemberName = 6, + String = 7, + Line = 8, + Extension = 10, + ExtInstImport = 11, + ExtInst = 12, + /// + /// Not in SPIR-V, added for SMOL-V! + /// + VectorShuffleCompact = 13, + MemoryModel = 14, + EntryPoint = 15, + ExecutionMode = 16, + Capability = 17, + TypeVoid = 19, + TypeBool = 20, + TypeInt = 21, + TypeFloat = 22, + TypeVector = 23, + TypeMatrix = 24, + TypeImage = 25, + TypeSampler = 26, + TypeSampledImage = 27, + TypeArray = 28, + TypeRuntimeArray = 29, + TypeStruct = 30, + TypeOpaque = 31, + TypePointer = 32, + TypeFunction = 33, + TypeEvent = 34, + TypeDeviceEvent = 35, + TypeReserveId = 36, + TypeQueue = 37, + TypePipe = 38, + TypeForwardPointer = 39, + ConstantTrue = 41, + ConstantFalse = 42, + Constant = 43, + ConstantComposite = 44, + ConstantSampler = 45, + ConstantNull = 46, + SpecConstantTrue = 48, + SpecConstantFalse = 49, + SpecConstant = 50, + SpecConstantComposite = 51, + SpecConstantOp = 52, + Function = 54, + FunctionParameter = 55, + FunctionEnd = 56, + FunctionCall = 57, + Variable = 59, + ImageTexelPointer = 60, + Load = 61, + Store = 62, + CopyMemory = 63, + CopyMemorySized = 64, + AccessChain = 65, + InBoundsAccessChain = 66, + PtrAccessChain = 67, + ArrayLength = 68, + GenericPtrMemSemantics = 69, + InBoundsPtrAccessChain = 70, + Decorate = 71, + MemberDecorate = 72, + DecorationGroup = 73, + GroupDecorate = 74, + GroupMemberDecorate = 75, + VectorExtractDynamic = 77, + VectorInsertDynamic = 78, + VectorShuffle = 79, + CompositeConstruct = 80, + CompositeExtract = 81, + CompositeInsert = 82, + CopyObject = 83, + Transpose = 84, + SampledImage = 86, + ImageSampleImplicitLod = 87, + ImageSampleExplicitLod = 88, + ImageSampleDrefImplicitLod = 89, + ImageSampleDrefExplicitLod = 90, + ImageSampleProjImplicitLod = 91, + ImageSampleProjExplicitLod = 92, + ImageSampleProjDrefImplicitLod = 93, + ImageSampleProjDrefExplicitLod = 94, + ImageFetch = 95, + ImageGather = 96, + ImageDrefGather = 97, + ImageRead = 98, + ImageWrite = 99, + Image = 100, + ImageQueryFormat = 101, + ImageQueryOrder = 102, + ImageQuerySizeLod = 103, + ImageQuerySize = 104, + ImageQueryLod = 105, + ImageQueryLevels = 106, + ImageQuerySamples = 107, + ConvertFToU = 109, + ConvertFToS = 110, + ConvertSToF = 111, + ConvertUToF = 112, + UConvert = 113, + SConvert = 114, + FConvert = 115, + QuantizeToF16 = 116, + ConvertPtrToU = 117, + SatConvertSToU = 118, + SatConvertUToS = 119, + ConvertUToPtr = 120, + PtrCastToGeneric = 121, + GenericCastToPtr = 122, + GenericCastToPtrExplicit = 123, + Bitcast = 124, + SNegate = 126, + FNegate = 127, + IAdd = 128, + FAdd = 129, + ISub = 130, + FSub = 131, + IMul = 132, + FMul = 133, + UDiv = 134, + SDiv = 135, + FDiv = 136, + UMod = 137, + SRem = 138, + SMod = 139, + FRem = 140, + FMod = 141, + VectorTimesScalar = 142, + MatrixTimesScalar = 143, + VectorTimesMatrix = 144, + MatrixTimesVector = 145, + MatrixTimesMatrix = 146, + OuterProduct = 147, + Dot = 148, + IAddCarry = 149, + ISubBorrow = 150, + UMulExtended = 151, + SMulExtended = 152, + Any = 154, + All = 155, + IsNan = 156, + IsInf = 157, + IsFinite = 158, + IsNormal = 159, + SignBitSet = 160, + LessOrGreater = 161, + Ordered = 162, + Unordered = 163, + LogicalEqual = 164, + LogicalNotEqual = 165, + LogicalOr = 166, + LogicalAnd = 167, + LogicalNot = 168, + Select = 169, + IEqual = 170, + INotEqual = 171, + UGreaterThan = 172, + SGreaterThan = 173, + UGreaterThanEqual = 174, + SGreaterThanEqual = 175, + ULessThan = 176, + SLessThan = 177, + ULessThanEqual = 178, + SLessThanEqual = 179, + FOrdEqual = 180, + FUnordEqual = 181, + FOrdNotEqual = 182, + FUnordNotEqual = 183, + FOrdLessThan = 184, + FUnordLessThan = 185, + FOrdGreaterThan = 186, + FUnordGreaterThan = 187, + FOrdLessThanEqual = 188, + FUnordLessThanEqual = 189, + FOrdGreaterThanEqual = 190, + FUnordGreaterThanEqual = 191, + ShiftRightLogical = 194, + ShiftRightArithmetic = 195, + ShiftLeftLogical = 196, + BitwiseOr = 197, + BitwiseXor = 198, + BitwiseAnd = 199, + Not = 200, + BitFieldInsert = 201, + BitFieldSExtract = 202, + BitFieldUExtract = 203, + BitReverse = 204, + BitCount = 205, + DPdx = 207, + DPdy = 208, + Fwidth = 209, + DPdxFine = 210, + DPdyFine = 211, + FwidthFine = 212, + DPdxCoarse = 213, + DPdyCoarse = 214, + FwidthCoarse = 215, + EmitVertex = 218, + EndPrimitive = 219, + EmitStreamVertex = 220, + EndStreamPrimitive = 221, + ControlBarrier = 224, + MemoryBarrier = 225, + AtomicLoad = 227, + AtomicStore = 228, + AtomicExchange = 229, + AtomicCompareExchange = 230, + AtomicCompareExchangeWeak = 231, + AtomicIIncrement = 232, + AtomicIDecrement = 233, + AtomicIAdd = 234, + AtomicISub = 235, + AtomicSMin = 236, + AtomicUMin = 237, + AtomicSMax = 238, + AtomicUMax = 239, + AtomicAnd = 240, + AtomicOr = 241, + AtomicXor = 242, + Phi = 245, + LoopMerge = 246, + SelectionMerge = 247, + Label = 248, + Branch = 249, + BranchConditional = 250, + Switch = 251, + Kill = 252, + Return = 253, + ReturnValue = 254, + Unreachable = 255, + LifetimeStart = 256, + LifetimeStop = 257, + GroupAsyncCopy = 259, + GroupWaitEvents = 260, + GroupAll = 261, + GroupAny = 262, + GroupBroadcast = 263, + GroupIAdd = 264, + GroupFAdd = 265, + GroupFMin = 266, + GroupUMin = 267, + GroupSMin = 268, + GroupFMax = 269, + GroupUMax = 270, + GroupSMax = 271, + ReadPipe = 274, + WritePipe = 275, + ReservedReadPipe = 276, + ReservedWritePipe = 277, + ReserveReadPipePackets = 278, + ReserveWritePipePackets = 279, + CommitReadPipe = 280, + CommitWritePipe = 281, + IsValidReserveId = 282, + GetNumPipePackets = 283, + GetMaxPipePackets = 284, + GroupReserveReadPipePackets = 285, + GroupReserveWritePipePackets = 286, + GroupCommitReadPipe = 287, + GroupCommitWritePipe = 288, + EnqueueMarker = 291, + EnqueueKernel = 292, + GetKernelNDrangeSubGroupCount = 293, + GetKernelNDrangeMaxSubGroupSize = 294, + GetKernelWorkGroupSize = 295, + GetKernelPreferredWorkGroupSizeMultiple = 296, + RetainEvent = 297, + ReleaseEvent = 298, + CreateUserEvent = 299, + IsValidEvent = 300, + SetUserEventStatus = 301, + CaptureEventProfilingInfo = 302, + GetDefaultQueue = 303, + BuildNDRange = 304, + ImageSparseSampleImplicitLod = 305, + ImageSparseSampleExplicitLod = 306, + ImageSparseSampleDrefImplicitLod = 307, + ImageSparseSampleDrefExplicitLod = 308, + ImageSparseSampleProjImplicitLod = 309, + ImageSparseSampleProjExplicitLod = 310, + ImageSparseSampleProjDrefImplicitLod = 311, + ImageSparseSampleProjDrefExplicitLod = 312, + ImageSparseFetch = 313, + ImageSparseGather = 314, + ImageSparseDrefGather = 315, + ImageSparseTexelsResident = 316, + NoLine = 317, + AtomicFlagTestAndSet = 318, + AtomicFlagClear = 319, + ImageSparseRead = 320, + SizeOf = 321, + TypePipeStorage = 322, + ConstantPipeStorage = 323, + CreatePipeFromPipeStorage = 324, + GetKernelLocalSizeForSubgroupCount = 325, + GetKernelMaxNumSubgroups = 326, + TypeNamedBarrier = 327, + NamedBarrierInitialize = 328, + MemoryNamedBarrier = 329, + ModuleProcessed = 330, + + KnownOpsCount, + } + + public static class SpvOpExtensions + { + public static bool OpHasResult(this SpvOp _this) + { + if (_this < 0 || _this >= SpvOp.KnownOpsCount) + { + return false; + } + return OpData.SpirvOpData[(int)_this].hasResult != 0; + } + + public static bool OpHasType(this SpvOp _this) + { + if (_this < 0 || _this >= SpvOp.KnownOpsCount) + { + return false; + } + return OpData.SpirvOpData[(int)_this].hasType != 0; + } + + public static int OpDeltaFromResult(this SpvOp _this) + { + if (_this < 0 || _this >= SpvOp.KnownOpsCount) + { + return 0; + } + return OpData.SpirvOpData[(int)_this].deltaFromResult; + } + + public static bool OpVarRest(this SpvOp _this) + { + if (_this < 0 || _this >= SpvOp.KnownOpsCount) + { + return false; + } + return OpData.SpirvOpData[(int)_this].varrest != 0; + } + + public static bool OpDebugInfo(this SpvOp _this) + { + return + _this == SpvOp.SourceContinued || + _this == SpvOp.Source || + _this == SpvOp.SourceExtension || + _this == SpvOp.Name || + _this == SpvOp.MemberName || + _this == SpvOp.String || + _this == SpvOp.Line || + _this == SpvOp.NoLine || + _this == SpvOp.ModuleProcessed; + } + } +} diff --git a/AssetStudioUtility/SpirVShaderConverter.cs b/AssetStudioUtility/SpirVShaderConverter.cs new file mode 100644 index 0000000..6c846d4 --- /dev/null +++ b/AssetStudioUtility/SpirVShaderConverter.cs @@ -0,0 +1,74 @@ +using Smolv; +using SpirV; +using System; +using System.IO; +using System.Text; + +namespace AssetStudio +{ + public static class SpirVShaderConverter + { + public static string Convert(byte[] m_ProgramCode) + { + var sb = new StringBuilder(); + using (var ms = new MemoryStream(m_ProgramCode)) + { + using (var reader = new BinaryReader(ms)) + { + int requirements = reader.ReadInt32(); + int minOffset = m_ProgramCode.Length; + int snippetCount = 5; + /*if (version[0] > 2019 || (version[0] == 2019 && version[1] >= 3)) //2019.3 and up + { + snippetCount = 6; + }*/ + for (int i = 0; i < snippetCount; i++) + { + if (reader.BaseStream.Position >= minOffset) + { + break; + } + + int offset = reader.ReadInt32(); + int size = reader.ReadInt32(); + if (size > 0) + { + if (offset < minOffset) + { + minOffset = offset; + } + var pos = ms.Position; + sb.Append(ExportSnippet(ms, offset, size)); + ms.Position = pos; + } + } + } + } + return sb.ToString(); + } + + private static string ExportSnippet(Stream stream, int offset, int size) + { + stream.Position = offset; + int decodedSize = SmolvDecoder.GetDecodedBufferSize(stream); + if (decodedSize == 0) + { + throw new Exception("Invalid SMOL-V shader header"); + } + using (var decodedStream = new MemoryStream(new byte[decodedSize])) + { + if (SmolvDecoder.Decode(stream, size, decodedStream)) + { + decodedStream.Position = 0; + var module = Module.ReadFrom(decodedStream); + var disassembler = new Disassembler(); + return disassembler.Disassemble(module, DisassemblyOptions.Default).Replace("\r\n", "\n"); + } + else + { + throw new Exception("Unable to decode SMOL-V shader"); + } + } + } + } +}