├── .github └── workflows │ └── dotnet-core.yml ├── .gitignore ├── LICENSE ├── README.md ├── SPIRV ├── Disassembler.cs ├── Instruction.cs ├── Module.cs ├── OperandType.cs ├── ParsedInstruction.cs ├── Reader.cs ├── SpirV.Core.Grammar.cs ├── SpirV.Meta.cs ├── SpirV.csproj └── Types.cs ├── csspv.sln ├── spirv-dis ├── CSPVDis.csproj ├── Program.cs ├── Properties │ └── launchSettings.json └── vs.spv └── spirv-gen ├── CSPVGen.csproj ├── Program.cs ├── extinst.glsl.std.450.grammar.json ├── extinst.opencl.std.100.grammar.json ├── spir-v.xml ├── spirv.core.grammar.json └── spirv.json /.github/workflows/dotnet-core.yml: -------------------------------------------------------------------------------- 1 | name: .NET Core 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | runs-on: windows-latest 12 | strategy: 13 | matrix: 14 | dotnet: [ '5.0.x' ] 15 | name: Build C# SPV with .NET ${{ matrix.dotnet }} 16 | steps: 17 | - uses: actions/checkout@v2 18 | - name: Setup dotnet 19 | uses: actions/setup-dotnet@v1 20 | with: 21 | dotnet-version: ${{ matrix.dotnet }} 22 | - run: dotnet restore 23 | - run: dotnet build csspv.sln 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/bin/* 2 | **/obj/* -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2017, Matthäus G. Chajdas 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | C# SPIR-V disassembler 2 | ====================== 3 | 4 | Overview 5 | -------- 6 | 7 | This project contains a re-implementation of the ``spirv-dis`` tool written in C#. It consists of three projects: 8 | 9 | * ``CSPVGen``, parses the SPIR-V JSON descriptions and produces C# code from there 10 | * ``SpirV``, the core library providing the code model 11 | * ``CSPVDis``, the disassembler executable 12 | 13 | System requirements 14 | ------------------- 15 | 16 | This application is built for .NET 5.0 and should run on any platform supporting that. 17 | 18 | It requires C# 7.3 due to `System.Enum` constraints. Please make sure you're using the latest .NET Core SDK to have access to this feature. 19 | 20 | Features & limitations 21 | ---------------------- 22 | 23 | * Generates C# code from SPIR-V JSON files 24 | * Pretty-prints names, types, etc. 25 | 26 | Build 27 | ----- 28 | 29 | Build `CSPVDis`, this will in turn build `SpirV` and the project will be ready to use. 30 | 31 | If you want to re-generate the generate files, build and run `CSPVGen`. -------------------------------------------------------------------------------- /SPIRV/Disassembler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Linq; 5 | 6 | namespace SpirV 7 | { 8 | public struct ModuleHeader 9 | { 10 | public Version Version { get; set; } 11 | public string GeneratorVendor { get; set; } 12 | public string GeneratorName { get; set; } 13 | public int GeneratorVersion { get; set; } 14 | public uint Bound { get; set; } 15 | public uint Reserved { get; set; } 16 | } 17 | 18 | [Flags] 19 | public enum DisassemblyOptions 20 | { 21 | None, 22 | ShowTypes, 23 | ShowNames, 24 | Default = ShowTypes | ShowNames 25 | } 26 | 27 | public class Disassembler 28 | { 29 | public string Disassemble (Module module) 30 | { 31 | return Disassemble (module, DisassemblyOptions.Default); 32 | } 33 | 34 | public string Disassemble (Module module, DisassemblyOptions options) 35 | { 36 | StringBuilder sb = new StringBuilder (); 37 | 38 | sb.AppendFormat ("; SPIR-V\n"); 39 | sb.AppendFormat ("; Version: {0}\n", module.Header.Version); 40 | if (module.Header.GeneratorName == null) { 41 | sb.AppendFormat ("; Generator: {0}; {1}\n", 42 | module.Header.GeneratorName, 43 | module.Header.GeneratorVersion); 44 | } else { 45 | sb.AppendFormat ("; Generator: {0} {1}; {2}\n", 46 | module.Header.GeneratorVendor, 47 | module.Header.GeneratorName, 48 | module.Header.GeneratorVersion); 49 | } 50 | sb.AppendFormat ("; Bound: {0}\n", module.Header.Bound); 51 | sb.AppendFormat ("; Schema: {0}\n", module.Header.Reserved); 52 | 53 | List lines = new List (); 54 | foreach (var i in module.Instructions) { 55 | PrintInstruction (sb, i, options); 56 | lines.Add (sb.ToString ()); 57 | sb.Clear (); 58 | } 59 | 60 | int longestPrefix = 0; 61 | foreach (var line in lines) { 62 | longestPrefix = Math.Max (longestPrefix, line.IndexOf ('=')); 63 | } 64 | 65 | foreach (var line in lines) { 66 | if (line.StartsWith (";")) { 67 | sb.AppendLine (line); 68 | } else { 69 | if (line.Contains ('=')) { 70 | var parts = line.Split ('='); 71 | System.Diagnostics.Debug.Assert (parts.Length == 2); 72 | sb.Append (parts[0].PadLeft (longestPrefix)); 73 | sb.Append (" = "); 74 | sb.Append (parts[1]); 75 | } else { 76 | sb.Append ("".PadLeft (longestPrefix + 4)); 77 | sb.Append (line); 78 | } 79 | 80 | sb.AppendLine (); 81 | } 82 | } 83 | 84 | return sb.ToString (); 85 | } 86 | 87 | private static void PrintInstruction (StringBuilder sb, ParsedInstruction instruction, DisassemblyOptions options) 88 | { 89 | if (instruction.Operands.Count == 0) { 90 | sb.Append (instruction.Instruction.Name); 91 | return; 92 | } 93 | 94 | int currentOperand = 0; 95 | if (instruction.Instruction.Operands[currentOperand].Type is IdResultType) { 96 | if (options.HasFlag (DisassemblyOptions.ShowTypes)) { 97 | sb.Append (instruction.ResultType.ToString ()); 98 | sb.Append (" "); 99 | } 100 | 101 | ++currentOperand; 102 | } 103 | 104 | if (currentOperand < instruction.Operands.Count && 105 | instruction.Instruction.Operands[currentOperand].Type is IdResult) { 106 | if (!options.HasFlag (DisassemblyOptions.ShowNames) || string.IsNullOrWhiteSpace (instruction.Name)) { 107 | PrintOperandValue (sb, instruction.Operands[currentOperand].Value, options); 108 | } else { 109 | sb.Append (instruction.Name); 110 | } 111 | sb.Append (" = "); 112 | 113 | ++currentOperand; 114 | } 115 | 116 | sb.Append (instruction.Instruction.Name); 117 | sb.Append (" "); 118 | 119 | for (; currentOperand < instruction.Operands.Count; ++currentOperand) { 120 | PrintOperandValue (sb, instruction.Operands[currentOperand].Value, options); 121 | sb.Append (" "); 122 | } 123 | } 124 | 125 | private static void PrintOperandValue (StringBuilder sb, object value, DisassemblyOptions options) 126 | { 127 | if (value is System.Type t) { 128 | sb.Append (t.Name); 129 | } else if (value is string s) { 130 | sb.Append ($"\"{s}\""); 131 | } else if (value is ObjectReference or) { 132 | if (options.HasFlag (DisassemblyOptions.ShowNames) && or.Reference != null && !string.IsNullOrWhiteSpace (or.Reference.Name)) { 133 | sb.Append (or.Reference.Name); 134 | } else { 135 | sb.Append (or); 136 | } 137 | } else if (value is IBitEnumOperandValue beov) { 138 | PrintBitEnumValue (sb, beov, options); 139 | } else if (value is IValueEnumOperandValue veov) { 140 | PrintValueEnumValue (sb, veov, options); 141 | } else { 142 | sb.Append (value); 143 | } 144 | } 145 | 146 | private static void PrintBitEnumValue (StringBuilder sb, IBitEnumOperandValue enumOperandValue, DisassemblyOptions options) 147 | { 148 | foreach (var key in enumOperandValue.Values.Keys) { 149 | sb.Append (enumOperandValue.EnumerationType.GetEnumName (key)); 150 | 151 | var value = enumOperandValue.Values[key] as IList; 152 | 153 | if (value.Count != 0) { 154 | sb.Append (" "); 155 | foreach (var v in value) { 156 | PrintOperandValue (sb, v, options); 157 | } 158 | } 159 | } 160 | } 161 | 162 | private static void PrintValueEnumValue (StringBuilder sb, IValueEnumOperandValue valueOperandValue, DisassemblyOptions options) 163 | { 164 | sb.Append (valueOperandValue.Key); 165 | if (valueOperandValue.Value is IList valueList && valueList.Count > 0) { 166 | sb.Append (" "); 167 | foreach (var v in valueList) { 168 | PrintOperandValue (sb, v, options); 169 | } 170 | } 171 | } 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /SPIRV/Instruction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace SpirV 6 | { 7 | public enum OperandQuantifier 8 | { 9 | // 1 10 | Default, 11 | // 0 or 1 12 | Optional, 13 | // 0+ 14 | Varying 15 | } 16 | 17 | public class Operand 18 | { 19 | public string Name { get; } 20 | public OperandType Type { get; } 21 | public OperandQuantifier Quantifier { get; } 22 | 23 | public Operand(OperandType kind, string name, OperandQuantifier quantifier) 24 | { 25 | Name = name; 26 | Type = kind; 27 | Quantifier = quantifier; 28 | } 29 | } 30 | 31 | public class Instruction 32 | { 33 | public string Name { get; } 34 | 35 | public IList Operands 36 | { 37 | get; 38 | } 39 | 40 | public Instruction (string name) 41 | : this (name, new List ()) 42 | { 43 | } 44 | 45 | public Instruction (string name, IList operands) 46 | { 47 | Operands = operands; 48 | Name = name; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /SPIRV/Module.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Text; 5 | using System.Linq; 6 | 7 | namespace SpirV 8 | { 9 | public class Module 10 | { 11 | public Module (ModuleHeader header, List instructions) 12 | { 13 | Header = header; 14 | instructions_ = instructions; 15 | 16 | Read (instructions_, objects_); 17 | } 18 | 19 | private static HashSet debugInstructions_ = new HashSet 20 | { 21 | "OpSourceContinued", 22 | "OpSource", 23 | "OpSourceExtension", 24 | "OpName", 25 | "OpMemberName", 26 | "OpString", 27 | "OpLine", 28 | "OpNoLine", 29 | "OpModuleProcessed" 30 | }; 31 | 32 | public static bool IsDebugInstruction (ParsedInstruction instruction) 33 | { 34 | return debugInstructions_.Contains (instruction.Instruction.Name); 35 | } 36 | 37 | private static void Read (IList instructions, 38 | Dictionary objects) 39 | { 40 | // Debug instructions can be only processed after everything 41 | // else has been parsed, as they may reference types which haven't 42 | // been seen in the file yet 43 | var debugInstructions = new List (); 44 | 45 | // Entry points contain forward references 46 | // Those need to be resolved afterwards 47 | var entryPoints = new List (); 48 | 49 | foreach (var instruction in instructions) { 50 | if (IsDebugInstruction (instruction)) { 51 | debugInstructions.Add (instruction); 52 | continue; 53 | } 54 | 55 | if (instruction.Instruction is OpEntryPoint) { 56 | entryPoints.Add (instruction); 57 | continue; 58 | } 59 | 60 | if (instruction.Instruction.Name.StartsWith ("OpType")) { 61 | ProcessTypeInstruction (instruction, objects); 62 | } 63 | 64 | instruction.ResolveResultType (objects); 65 | 66 | if (instruction.HasResult) { 67 | objects[instruction.ResultId] = instruction; 68 | } 69 | 70 | switch (instruction.Instruction) { 71 | // Constants require that the result type has been resolved 72 | case OpSpecConstant sc: 73 | case OpConstant oc: { 74 | var t = instruction.ResultType; 75 | System.Diagnostics.Debug.Assert (t != null); 76 | System.Diagnostics.Debug.Assert (t is ScalarType); 77 | 78 | var constant = ConvertConstant ( 79 | instruction.ResultType as ScalarType, 80 | instruction.Words.Skip (3).ToList ()); 81 | instruction.Operands[2].Value = constant; 82 | instruction.Value = constant; 83 | 84 | break; 85 | } 86 | } 87 | } 88 | 89 | foreach (var instruction in debugInstructions) { 90 | switch (instruction.Instruction) { 91 | case OpMemberName mn: { 92 | var t = objects[instruction.Words[1]].ResultType as StructType; 93 | 94 | System.Diagnostics.Debug.Assert (t != null); 95 | 96 | t.SetMemberName ((uint)instruction.Operands[1].Value, 97 | instruction.Operands[2].Value as string); 98 | break; 99 | } 100 | case OpName n: { 101 | // We skip naming objects we don't know about 102 | var t = objects[instruction.Words[1]]; 103 | 104 | t.Name = instruction.Operands[1].Value as string; 105 | 106 | break; 107 | } 108 | } 109 | } 110 | 111 | foreach (var instruction in instructions) { 112 | instruction.ResolveReferences (objects); 113 | } 114 | } 115 | 116 | public static Module ReadFrom (System.IO.Stream stream) 117 | { 118 | var br = new System.IO.BinaryReader (stream); 119 | var reader = new Reader (br); 120 | 121 | var versionNumber = reader.ReadWord (); 122 | var version = new Version ( 123 | (int)(versionNumber >> 16), 124 | (int)((versionNumber >> 8) & 0xFF)); 125 | 126 | var generatorMagicNumber = reader.ReadWord (); 127 | var generatorToolId = (int)(generatorMagicNumber >> 16); 128 | 129 | string generatorVendor = "unknown"; 130 | string generatorName = null; 131 | 132 | if (SpirV.Meta.Tools.ContainsKey (generatorToolId)) { 133 | var toolInfo = SpirV.Meta.Tools[generatorToolId]; 134 | 135 | generatorVendor = toolInfo.Vendor; 136 | 137 | if (toolInfo.Name != null) { 138 | generatorName = toolInfo.Name; 139 | } 140 | } 141 | 142 | // Read header 143 | var header = new ModuleHeader 144 | { 145 | Version = version, 146 | GeneratorName = generatorName, 147 | GeneratorVendor = generatorVendor, 148 | GeneratorVersion = (int)(generatorMagicNumber & 0xFFFF), 149 | Bound = reader.ReadWord (), 150 | Reserved = reader.ReadWord () 151 | }; 152 | 153 | var instructions = new List (); 154 | 155 | try { 156 | while (true) { 157 | var instructionStart = reader.ReadWord (); 158 | var wordCount = (ushort)(instructionStart >> 16); 159 | var opCode = (int)(instructionStart & 0xFFFF); 160 | 161 | List words = new List () 162 | { 163 | instructionStart 164 | }; 165 | 166 | for (ushort i = 0; i < wordCount - 1; ++i) { 167 | words.Add (reader.ReadWord ()); 168 | } 169 | 170 | instructions.Add (new ParsedInstruction (opCode, words)); 171 | } 172 | } catch (System.IO.EndOfStreamException) { 173 | } 174 | 175 | return new Module (header, instructions); 176 | } 177 | 178 | /// 179 | /// Collect types from OpType* instructions 180 | /// 181 | private static void ProcessTypeInstruction (ParsedInstruction i, 182 | Dictionary objects) 183 | { 184 | switch (i.Instruction) { 185 | case OpTypeInt t: { 186 | i.ResultType = new IntegerType ( 187 | (int)i.Words[2], 188 | i.Words[3] == 1u); 189 | } 190 | break; 191 | case OpTypeFloat t: { 192 | i.ResultType = new FloatingPointType ( 193 | (int)i.Words[2]); 194 | } 195 | break; 196 | case OpTypeVector t: { 197 | i.ResultType = new VectorType ( 198 | objects[i.Words[2]].ResultType as ScalarType, 199 | (int)i.Words[3]); 200 | } 201 | break; 202 | case OpTypeMatrix t: { 203 | i.ResultType = new MatrixType ( 204 | objects[i.Words[2]].ResultType as VectorType, 205 | (int)i.Words[3]); 206 | } 207 | break; 208 | case OpTypeArray t: { 209 | var constant = objects[i.Words[3]].Value; 210 | int size = 0; 211 | 212 | switch (constant) { 213 | case UInt16 u16: size = u16; break; 214 | case UInt32 u32: size = (int)u32; break; 215 | case UInt64 u64: size = (int)u64; break; 216 | case Int16 i16: size = i16; break; 217 | case Int32 i32: size = i32; break; 218 | case Int64 i64: size = (int)i64; break; 219 | } 220 | 221 | i.ResultType = new ArrayType ( 222 | objects[i.Words[2]].ResultType, 223 | size); 224 | } 225 | break; 226 | case OpTypeRuntimeArray t: { 227 | i.ResultType = new RuntimeArrayType ( 228 | objects[i.Words[2]].ResultType as Type); 229 | } 230 | break; 231 | case OpTypeBool t: { 232 | i.ResultType = new BoolType (); 233 | } 234 | break; 235 | case OpTypeOpaque t: { 236 | i.ResultType = new OpaqueType (); 237 | } 238 | break; 239 | case OpTypeVoid t: { 240 | i.ResultType = new VoidType (); 241 | } 242 | break; 243 | case OpTypeImage t: { 244 | var sampledType = objects[i.Operands[1].GetId ()].ResultType; 245 | var dim = i.Operands[2].GetSingleEnumValue (); 246 | var depth = (uint)i.Operands[3].Value; 247 | var isArray = (uint)i.Operands[4].Value != 0; 248 | var isMultiSampled = (uint)i.Operands[5].Value != 0; 249 | var sampled = (uint)i.Operands[6].Value; 250 | 251 | var imageFormat = i.Operands[7].GetSingleEnumValue (); 252 | 253 | i.ResultType = new ImageType (sampledType, 254 | dim, 255 | (int)depth, isArray, isMultiSampled, 256 | (int)sampled, imageFormat, 257 | i.Operands.Count > 8 ? 258 | i.Operands[8].GetSingleEnumValue () : AccessQualifier.ReadOnly); 259 | } 260 | break; 261 | case OpTypeSampler st: { 262 | i.ResultType = new SamplerType (); 263 | break; 264 | } 265 | case OpTypeSampledImage t: { 266 | i.ResultType = new SampledImageType ( 267 | objects[i.Words[2]].ResultType as ImageType 268 | ); 269 | } 270 | break; 271 | case OpTypeFunction t: { 272 | var parameterTypes = new List (); 273 | for (int j = 3; j < i.Words.Count; ++j) { 274 | parameterTypes.Add (objects[i.Words[j]].ResultType); 275 | } 276 | i.ResultType = new FunctionType (objects[i.Words[2]].ResultType, 277 | parameterTypes); 278 | } 279 | break; 280 | case OpTypeForwardPointer t: { 281 | // We create a normal pointer, but with unspecified type 282 | // This will get resolved later on 283 | i.ResultType = new PointerType ((StorageClass)i.Words[2]); 284 | } 285 | break; 286 | case OpTypePointer t: { 287 | if (objects.ContainsKey (i.Words[1])) { 288 | // If there is something present, it must have been 289 | // a forward reference. The storage type must 290 | // match 291 | var pt = i.ResultType as PointerType; 292 | Debug.Assert (pt != null); 293 | Debug.Assert (pt.StorageClass == (StorageClass)i.Words[2]); 294 | 295 | pt.ResolveForwardReference (objects[i.Words[3]].ResultType); 296 | } else { 297 | i.ResultType = new PointerType ( 298 | (StorageClass)i.Words[2], 299 | objects[i.Words[3]].ResultType 300 | ); 301 | } 302 | } 303 | break; 304 | case OpTypeStruct t: { 305 | var memberTypes = new List (); 306 | for (int j = 2; j < i.Words.Count; ++j) { 307 | memberTypes.Add (objects[i.Words[j]].ResultType); 308 | } 309 | 310 | i.ResultType = new StructType (memberTypes); 311 | } 312 | break; 313 | } 314 | } 315 | 316 | private static object ConvertConstant (ScalarType type, 317 | IReadOnlyList words) 318 | { 319 | byte[] bytes = new byte[words.Count * 4]; 320 | 321 | for (int i = 0; i < words.Count; ++i) { 322 | BitConverter.GetBytes (words[i]).CopyTo (bytes, i * 4); 323 | } 324 | 325 | switch (type) { 326 | case IntegerType i: { 327 | if (i.Signed) { 328 | if (i.Width == 16) { 329 | ///TODO ToInt16? 330 | return (short)BitConverter.ToInt32 (bytes, 0); 331 | } else if (i.Width == 32) { 332 | return BitConverter.ToInt32 (bytes, 0); 333 | } else if (i.Width == 64) { 334 | return BitConverter.ToInt64 (bytes, 0); 335 | } 336 | } else { 337 | if (i.Width == 16) { 338 | return (ushort)words[0]; 339 | } else if (i.Width == 32) { 340 | return words[0]; 341 | } else if (i.Width == 64) { 342 | return BitConverter.ToUInt64 (bytes, 0); 343 | } 344 | } 345 | 346 | throw new Exception ("Cannot construct integer literal."); 347 | } 348 | 349 | case FloatingPointType f: { 350 | if (f.Width == 32) { 351 | return BitConverter.ToSingle (bytes, 0); 352 | } else if (f.Width == 64) { 353 | return BitConverter.ToDouble (bytes, 0); 354 | } else { 355 | throw new Exception ("Cannot construct floating point literal."); 356 | } 357 | } 358 | } 359 | 360 | return null; 361 | } 362 | 363 | public ModuleHeader Header { get; } 364 | public IReadOnlyList Instructions { get { return instructions_; } } 365 | 366 | private readonly List instructions_; 367 | 368 | private readonly Dictionary objects_ = new Dictionary (); 369 | } 370 | } 371 | -------------------------------------------------------------------------------- /SPIRV/OperandType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Linq; 5 | using System.Reflection; 6 | 7 | namespace SpirV 8 | { 9 | public class OperandType 10 | { 11 | public virtual bool ReadValue (IList words, 12 | out object value, out int wordsUsed) 13 | { 14 | // This returns the dynamic type 15 | value = GetType (); 16 | wordsUsed = 1; 17 | 18 | return true; 19 | } 20 | } 21 | 22 | public class Literal : OperandType 23 | { 24 | 25 | } 26 | 27 | public class LiteralNumber : Literal 28 | { 29 | } 30 | 31 | // The SPIR-V JSON file uses only literal integers 32 | public class LiteralInteger : LiteralNumber 33 | { 34 | public override bool ReadValue (IList words, out object value, out int wordsUsed) 35 | { 36 | value = words [0]; 37 | wordsUsed = 1; 38 | 39 | return true; 40 | } 41 | } 42 | 43 | public class LiteralString : Literal 44 | { 45 | public override bool ReadValue (IList words, out object value, out int wordsUsed) 46 | { 47 | StringBuilder sb = new StringBuilder (); 48 | // This is just a fail-safe -- the loop below must terminate 49 | wordsUsed = 1; 50 | 51 | List bytes = new List (); 52 | for (int i = 0; i < words.Count; ++i) { 53 | var wordBytes = BitConverter.GetBytes (words [i]); 54 | 55 | int zeroOffset = -1; 56 | for (int j = 0; j < wordBytes.Length; ++j) { 57 | if (wordBytes [j] == 0) { 58 | zeroOffset = j; 59 | break; 60 | } else { 61 | bytes.Add (wordBytes [j]); 62 | } 63 | } 64 | 65 | if (zeroOffset != -1) { 66 | wordsUsed = i + 1; 67 | break; 68 | } 69 | } 70 | 71 | var decoder = new UTF8Encoding (); 72 | value = decoder.GetString (bytes.ToArray ()); 73 | 74 | return true; 75 | } 76 | } 77 | 78 | public class LiteralContextDependentNumber : Literal 79 | { 80 | // This is handled during parsing by ConvertConstant 81 | } 82 | 83 | public class LiteralExtInstInteger : Literal 84 | { 85 | public override bool ReadValue (IList words, out object value, out int wordsUsed) 86 | { 87 | value = words[0]; 88 | wordsUsed = 1; 89 | 90 | return true; 91 | } 92 | } 93 | 94 | public class LiteralSpecConstantOpInteger : Literal 95 | { 96 | public override bool ReadValue (IList words, out object value, out int wordsUsed) 97 | { 98 | List result = new List (); 99 | foreach (var w in words) { 100 | result.Add (new ObjectReference (w)); 101 | } 102 | 103 | value = result; 104 | wordsUsed = words.Count; 105 | 106 | return true; 107 | } 108 | } 109 | 110 | public class Parameter 111 | { 112 | public virtual IReadOnlyList OperandTypes { get; } 113 | } 114 | 115 | public class ParameterFactory 116 | { 117 | public virtual Parameter CreateParameter(object value) => null; 118 | } 119 | 120 | public class EnumType : EnumType where T : System.Enum { }; 121 | 122 | public class EnumType : OperandType where T : System.Enum where U : ParameterFactory, new () 123 | { 124 | private U parameterFactory_ = new U(); 125 | public System.Type EnumerationType { get { return typeof(T); } } 126 | 127 | public override bool ReadValue (IList words, out object value, out int wordsUsed) 128 | { 129 | var wordsUsedForParameters = 0; 130 | 131 | if (typeof(T).GetCustomAttributes ().Any ()) { 132 | var result = new Dictionary> (); 133 | foreach (var enumValue in EnumerationType.GetEnumValues()) { 134 | var bit = (uint)enumValue; 135 | 136 | // bit == 0 and words [0] == 0 handles the 0x0 = None cases 137 | if ((words [0] & bit) != 0 || (bit == 0 && words[0] == 0)) { 138 | var p = parameterFactory_.CreateParameter (bit); 139 | 140 | var resultItems = new List (); 141 | 142 | if (p != null) { 143 | for (int j = 0; j < p.OperandTypes.Count; ++j) { 144 | p.OperandTypes [j].ReadValue ( 145 | words.Skip (1 + wordsUsedForParameters).ToList (), 146 | out object pValue, out int pWordsUsed); 147 | wordsUsedForParameters += pWordsUsed; 148 | resultItems.Add (pValue); 149 | } 150 | } 151 | 152 | result [bit] = resultItems; 153 | } 154 | } 155 | 156 | value = new BitEnumOperandValue (result); 157 | } else { 158 | var resultItems = new List (); 159 | var p = parameterFactory_.CreateParameter(words [0]); 160 | if (p != null) { 161 | for (int j = 0; j < p.OperandTypes.Count; ++j) { 162 | p.OperandTypes [j].ReadValue ( 163 | words.Skip (1 + wordsUsedForParameters).ToList (), 164 | out object pValue, out int pWordsUsed); 165 | wordsUsedForParameters += pWordsUsed; 166 | resultItems.Add (pValue); 167 | } 168 | } 169 | 170 | value = new ValueEnumOperandValue ((T)(object)words [0], resultItems); 171 | } 172 | 173 | wordsUsed = wordsUsedForParameters + 1; 174 | 175 | return true; 176 | } 177 | } 178 | 179 | public class IdScope : OperandType 180 | { 181 | public override bool ReadValue (IList words, out object value, out int wordsUsed) 182 | { 183 | value = (Scope)words [0]; 184 | wordsUsed = 1; 185 | 186 | return true; 187 | } 188 | } 189 | 190 | public class IdMemorySemantics : OperandType 191 | { 192 | public override bool ReadValue (IList words, out object value, out int wordsUsed) 193 | { 194 | value = (MemorySemantics)words [0]; 195 | wordsUsed = 1; 196 | 197 | return true; 198 | } 199 | } 200 | 201 | public class IdType : OperandType 202 | { 203 | public override bool ReadValue (IList words, out object value, out int wordsUsed) 204 | { 205 | value = words [0]; 206 | wordsUsed = 1; 207 | 208 | return true; 209 | } 210 | } 211 | 212 | public class IdResult : IdType 213 | { 214 | public override bool ReadValue (IList words, out object value, out int wordsUsed) 215 | { 216 | value = new ObjectReference (words [0]); 217 | wordsUsed = 1; 218 | 219 | return true; 220 | } 221 | } 222 | 223 | public class IdResultType : IdType 224 | { 225 | } 226 | 227 | public class IdRef : IdType 228 | { 229 | public override bool ReadValue (IList words, out object value, out int wordsUsed) 230 | { 231 | value = new ObjectReference (words [0]); 232 | wordsUsed = 1; 233 | 234 | return true; 235 | } 236 | } 237 | 238 | public class PairIdRefIdRef : OperandType 239 | { 240 | public override bool ReadValue (IList words, out object value, out int wordsUsed) 241 | { 242 | value = new { Variable = new ObjectReference (words [0]), Parent = new ObjectReference (words [1]) }; 243 | wordsUsed = 2; 244 | return true; 245 | } 246 | } 247 | 248 | public class PairIdRefLiteralInteger : OperandType 249 | { 250 | public override bool ReadValue (IList words, out object value, out int wordsUsed) 251 | { 252 | value = new { Type = new ObjectReference (words [0]), Member = words [1] }; 253 | wordsUsed = 2; 254 | return true; 255 | } 256 | } 257 | 258 | public class PairLiteralIntegerIdRef : OperandType 259 | { 260 | public override bool ReadValue (IList words, out object value, out int wordsUsed) 261 | { 262 | value = new { Selector = words [0], Label = new ObjectReference (words [1]) }; 263 | wordsUsed = 2; 264 | return true; 265 | } 266 | } 267 | } -------------------------------------------------------------------------------- /SPIRV/ParsedInstruction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Linq; 5 | 6 | namespace SpirV 7 | { 8 | public class ParsedOperand 9 | { 10 | public IList Words { get; } 11 | public object Value { get; set; } 12 | 13 | public Operand Operand { get; } 14 | 15 | public ParsedOperand (IList words, object value, Operand operand) 16 | { 17 | Words = words; 18 | Value = value; 19 | Operand = operand; 20 | } 21 | 22 | public T GetSingleEnumValue () where T : System.Enum 23 | { 24 | var v = Value as IValueEnumOperandValue; 25 | 26 | if (v.Value.Count == 0) { 27 | // If there's no value at all, the enum is probably something 28 | // like ImageFormat. In which case we just return the enum value 29 | return (T)(object)v.Key; 30 | } else { 31 | // This means the enum has a value attached to it, so we return 32 | // the attached value 33 | return (T)((IValueEnumOperandValue)Value).Value.First(); 34 | } 35 | } 36 | 37 | public uint GetId () 38 | { 39 | return (Value as ObjectReference).Id; 40 | } 41 | 42 | public T GetBitEnumValue () where T : System.Enum 43 | { 44 | var v = Value as IBitEnumOperandValue; 45 | 46 | uint result = 0; 47 | foreach (var k in v.Values.Keys) 48 | { 49 | result |= k; 50 | } 51 | 52 | return (T)(object)result; 53 | } 54 | } 55 | 56 | public class VaryingOperandValue 57 | { 58 | public VaryingOperandValue (List values) 59 | { 60 | Values = values; 61 | } 62 | 63 | public override string ToString() 64 | { 65 | var sb = new StringBuilder (); 66 | 67 | for (int i = 0; i < Values.Count; ++i) { 68 | sb.Append (Values[i]); 69 | 70 | if (i < (Values.Count - 1)) { 71 | sb.Append (" "); 72 | } 73 | } 74 | 75 | return sb.ToString (); 76 | } 77 | 78 | public IReadOnlyList Values {get;} 79 | } 80 | 81 | public interface IEnumOperandValue 82 | { 83 | System.Type EnumerationType { get; } 84 | } 85 | 86 | public interface IBitEnumOperandValue : IEnumOperandValue 87 | { 88 | IReadOnlyDictionary> Values { get; } 89 | } 90 | 91 | public interface IValueEnumOperandValue : IEnumOperandValue 92 | { 93 | object Key { get; } 94 | List Value { get; } 95 | } 96 | 97 | public class ValueEnumOperandValue : IValueEnumOperandValue where T : System.Enum 98 | { 99 | public System.Type EnumerationType { get { return typeof(T); } } 100 | 101 | public object Key { get { return key_; } } 102 | public List Value { get; } 103 | 104 | private readonly T key_ = default; 105 | 106 | public ValueEnumOperandValue (T key, List value) 107 | { 108 | key_ = key; 109 | Value = value; 110 | } 111 | } 112 | 113 | public class BitEnumOperandValue : IBitEnumOperandValue where T : System.Enum 114 | { 115 | public IReadOnlyDictionary> Values { get; } 116 | public System.Type EnumerationType { get { return typeof(T); } } 117 | 118 | public BitEnumOperandValue (Dictionary> values) 119 | { 120 | Values = values; 121 | } 122 | } 123 | 124 | public class ObjectReference 125 | { 126 | public ObjectReference (uint id) 127 | { 128 | Id = id; 129 | } 130 | 131 | public void Resolve (IReadOnlyDictionary objects) 132 | { 133 | object_ = objects [Id]; 134 | } 135 | 136 | public uint Id { get; } 137 | public ParsedInstruction Reference { get => object_; } 138 | 139 | private ParsedInstruction object_; 140 | 141 | public override string ToString () 142 | { 143 | return $"%{Id}"; 144 | } 145 | } 146 | 147 | public class ParsedInstruction 148 | { 149 | public IList Words { get; } 150 | 151 | public Instruction Instruction { get; } 152 | public IList Operands { get; } = new List (); 153 | 154 | public string Name { get; set; } 155 | 156 | public object Value { get; set; } 157 | 158 | public ParsedInstruction (int opCode, IList words) 159 | { 160 | Words = words; 161 | 162 | Instruction = Instructions.OpcodeToInstruction [opCode]; 163 | 164 | ParseOperands (); 165 | } 166 | 167 | private void ParseOperands () 168 | { 169 | if (Instruction.Operands.Count == 0) { 170 | return; 171 | } 172 | 173 | // Word 0 describes this instruction so we can ignore it 174 | int currentWord = 1; 175 | int currentOperand = 0; 176 | 177 | var varyingOperandValues = new List (); 178 | var varyingWordStart = 0; 179 | Operand varyingOperand = null; 180 | 181 | for (; currentWord < Words.Count;) { 182 | var operand = Instruction.Operands [currentOperand]; 183 | 184 | operand.Type.ReadValue (Words.Skip (currentWord).ToList (), 185 | out object value, out int wordsUsed); 186 | 187 | if (operand.Quantifier == OperandQuantifier.Varying) { 188 | varyingOperandValues.Add (value); 189 | varyingWordStart = currentWord; 190 | varyingOperand = operand; 191 | } else { 192 | Operands.Add (new ParsedOperand (Words.Skip (currentWord).Take (wordsUsed).ToList (), 193 | value, operand)); 194 | } 195 | 196 | currentWord += wordsUsed; 197 | 198 | if (operand.Quantifier != OperandQuantifier.Varying) { 199 | ++currentOperand; 200 | } 201 | } 202 | 203 | if (varyingOperand != null) { 204 | Operands.Add (new ParsedOperand (Words.Skip (currentWord).ToList (), 205 | new VaryingOperandValue (varyingOperandValues), varyingOperand)); 206 | } 207 | } 208 | 209 | public Type ResultType { get; set; } 210 | public uint ResultId { get 211 | { 212 | for (int i = 0; i < Instruction.Operands.Count; ++i) { 213 | if (Instruction.Operands[i].Type is IdResult) { 214 | return Operands[i].GetId (); 215 | } 216 | } 217 | 218 | return 0; 219 | } 220 | } 221 | 222 | public bool HasResult { get => ResultId != 0; } 223 | 224 | public void ResolveResultType (IReadOnlyDictionary objects) 225 | { 226 | if (Instruction.Operands.Count > 0 && Instruction.Operands [0].Type is IdResultType) { 227 | ResultType = objects[(uint)Operands[0].Value].ResultType; 228 | } 229 | } 230 | 231 | public void ResolveReferences (IReadOnlyDictionary objects) 232 | { 233 | foreach (var operand in Operands) { 234 | if (operand.Value is ObjectReference objectReference) { 235 | objectReference.Resolve (objects); 236 | } 237 | } 238 | } 239 | } 240 | } 241 | -------------------------------------------------------------------------------- /SPIRV/Reader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace SpirV 6 | { 7 | class Reader 8 | { 9 | public Reader (System.IO.BinaryReader reader) 10 | { 11 | reader_ = reader; 12 | 13 | uint magicNumber = reader_.ReadUInt32 (); 14 | 15 | if (magicNumber == SpirV.Meta.MagicNumber) { 16 | littleEndian_ = true; 17 | } else if (Reverse (magicNumber) == SpirV.Meta.MagicNumber) { 18 | littleEndian_ = false; 19 | } else { 20 | throw new Exception ("Invalid magic number"); 21 | } 22 | } 23 | 24 | public uint ReadWord () 25 | { 26 | if (littleEndian_) { 27 | return reader_.ReadUInt32 (); 28 | } else { 29 | return Reverse (reader_.ReadUInt32 ()); 30 | } 31 | } 32 | 33 | private static uint Reverse (uint u) 34 | { 35 | return (u & 0xFFU) << 24 | 36 | (u & 0xFF00U) << 8 | 37 | (u >> 8) & 0xFF00U | 38 | (u >> 24); 39 | } 40 | 41 | private System.IO.BinaryReader reader_; 42 | readonly bool littleEndian_; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /SPIRV/SpirV.Meta.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SpirV 5 | { 6 | class Meta 7 | { 8 | public static uint MagicNumber 9 | { 10 | get 11 | { 12 | return 119734787U; 13 | } 14 | } 15 | 16 | public static uint Version 17 | { 18 | get 19 | { 20 | return 66048U; 21 | } 22 | } 23 | 24 | public static uint Revision 25 | { 26 | get 27 | { 28 | return 2U; 29 | } 30 | } 31 | 32 | public static uint OpCodeMask 33 | { 34 | get 35 | { 36 | return 65535U; 37 | } 38 | } 39 | 40 | public static uint WordCountShift 41 | { 42 | get 43 | { 44 | return 16U; 45 | } 46 | } 47 | 48 | public class ToolInfo 49 | { 50 | public ToolInfo(string vendor) 51 | { 52 | Vendor = vendor; 53 | } 54 | 55 | public ToolInfo(string vendor, string name) 56 | { 57 | Vendor = vendor; 58 | Name = name; 59 | } 60 | 61 | public String Name { get; } 62 | 63 | public String Vendor { get; } 64 | } 65 | 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") }, }; public static IReadOnlyDictionary Tools { get => toolInfos_; } 66 | } 67 | } -------------------------------------------------------------------------------- /SPIRV/SpirV.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | 7.3 6 | false 7 | Matthäus G. Chajdas 8 | CSSPV 9 | https://bitbucket.org/Anteru/csspv/src/default/ 10 | https://sh13.net/projects/csspv/ 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /SPIRV/Types.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace SpirV 6 | { 7 | public class Type 8 | { 9 | } 10 | 11 | public class VoidType : Type 12 | { 13 | public override string ToString () 14 | { 15 | return "void"; 16 | } 17 | } 18 | 19 | public class ScalarType : Type 20 | { 21 | 22 | } 23 | 24 | public class BoolType : ScalarType 25 | { 26 | public override string ToString () 27 | { 28 | return "bool"; 29 | } 30 | } 31 | 32 | public class IntegerType : ScalarType 33 | { 34 | public IntegerType (int width, bool signed) 35 | { 36 | Width = width; 37 | Signed = signed; 38 | } 39 | 40 | public int Width { get; } 41 | public bool Signed { get; } 42 | 43 | public override string ToString () 44 | { 45 | if (Signed) { 46 | return $"i{Width}"; 47 | } else { 48 | return $"u{Width}"; 49 | } 50 | } 51 | } 52 | 53 | public class FloatingPointType : ScalarType 54 | { 55 | public FloatingPointType (int width) 56 | { 57 | Width = width; 58 | } 59 | 60 | public int Width { get; } 61 | 62 | public override string ToString () 63 | { 64 | return $"f{Width}"; 65 | } 66 | } 67 | 68 | public class VectorType : Type 69 | { 70 | public VectorType (ScalarType scalarType, int componentCount) 71 | { 72 | ComponentType = scalarType; 73 | ComponentCount = componentCount; 74 | } 75 | 76 | public ScalarType ComponentType { get; } 77 | public int ComponentCount { get; } 78 | 79 | public override string ToString () 80 | { 81 | return $"{ComponentType}_{ComponentCount}"; 82 | } 83 | } 84 | 85 | public class MatrixType : Type 86 | { 87 | public MatrixType (VectorType vectorType, int columnCount) 88 | { 89 | ColumnType = vectorType; 90 | ColumnCount = columnCount; 91 | } 92 | 93 | public VectorType ColumnType { get; } 94 | public int ColumnCount { get; } 95 | public int RowCount { get { return ColumnType.ComponentCount; } } 96 | 97 | public override string ToString () 98 | { 99 | return $"{ColumnType}x{ColumnCount}"; 100 | } 101 | } 102 | 103 | public class ImageType : Type 104 | { 105 | public ImageType (Type sampledType, Dim dim, int depth, 106 | bool isArray, bool isMultisampled, int sampleCount, 107 | ImageFormat imageFormat, AccessQualifier accessQualifier) 108 | { 109 | SampledType = sampledType; 110 | Dim = dim; 111 | Depth = depth; 112 | IsArray = isArray; 113 | IsMultisampled = isMultisampled; 114 | SampleCount = sampleCount; 115 | Format = imageFormat; 116 | AccessQualifier = accessQualifier; 117 | } 118 | 119 | public Type SampledType { get; } 120 | public Dim Dim { get; } 121 | public int Depth { get; } 122 | public bool IsArray { get; } 123 | public bool IsMultisampled { get; } 124 | public int SampleCount { get; } 125 | public ImageFormat Format { get; } 126 | public AccessQualifier AccessQualifier { get; } 127 | 128 | public override string ToString () 129 | { 130 | var sb = new StringBuilder (); 131 | switch (AccessQualifier) { 132 | case AccessQualifier.ReadWrite: 133 | sb.Append ("read_write "); break; 134 | case AccessQualifier.WriteOnly: 135 | sb.Append ("write_only "); break; 136 | case AccessQualifier.ReadOnly: 137 | sb.Append ("read_only "); break; 138 | } 139 | 140 | sb.Append ("Texture"); 141 | switch (Dim) { 142 | case Dim.Dim1D: sb.Append ("1D"); break; 143 | case Dim.Dim2D: sb.Append ("2D"); break; 144 | case Dim.Dim3D: sb.Append ("3D"); break; 145 | case Dim.Cube: sb.Append ("Cube"); break; 146 | } 147 | 148 | if (IsMultisampled) { 149 | sb.Append ("MS"); 150 | } 151 | 152 | if (IsArray) { 153 | sb.Append ("Array"); 154 | } 155 | 156 | return sb.ToString (); 157 | } 158 | } 159 | 160 | public class SamplerType : Type 161 | { 162 | public override string ToString () 163 | { 164 | return "sampler"; 165 | } 166 | } 167 | 168 | public class SampledImageType : Type 169 | { 170 | public SampledImageType (ImageType imageType) 171 | { 172 | ImageType = imageType; 173 | } 174 | 175 | public ImageType ImageType { get; } 176 | 177 | public override string ToString () 178 | { 179 | return $"{ImageType}Sampled"; 180 | } 181 | } 182 | 183 | public class ArrayType : Type 184 | { 185 | public ArrayType (Type elementType, int elementCount) 186 | { 187 | ElementType = elementType; 188 | ElementCount = elementCount; 189 | } 190 | 191 | public int ElementCount { get; } 192 | public Type ElementType { get; } 193 | 194 | public override string ToString () 195 | { 196 | return $"{ElementType}[{ElementCount}]"; 197 | } 198 | } 199 | 200 | public class RuntimeArrayType : Type 201 | { 202 | public RuntimeArrayType (Type elementType) 203 | { 204 | ElementType = elementType; 205 | } 206 | 207 | public Type ElementType { get; } 208 | } 209 | 210 | public class StructType : Type 211 | { 212 | public StructType (IReadOnlyList memberTypes) 213 | { 214 | MemberTypes = memberTypes; 215 | memberNames_ = new List (); 216 | 217 | for (int i = 0; i < memberTypes.Count; ++i) { 218 | memberNames_.Add (String.Empty); 219 | } 220 | } 221 | 222 | private List memberNames_; 223 | 224 | public IReadOnlyList MemberTypes { get; } 225 | public IReadOnlyList MemberNames { get { return memberNames_; } } 226 | 227 | public void SetMemberName (uint member, string name) 228 | { 229 | memberNames_ [(int)member] = name; 230 | } 231 | 232 | public override string ToString () 233 | { 234 | var sb = new StringBuilder (); 235 | 236 | sb.Append ("struct {"); 237 | for(int i = 0; i < MemberTypes.Count; ++i) { 238 | var memberType = MemberTypes [i]; 239 | sb.Append (memberType.ToString ()); 240 | 241 | if (! string.IsNullOrEmpty (memberNames_ [i])) { 242 | sb.Append (" "); 243 | sb.Append (MemberNames [i]); 244 | } 245 | 246 | sb.Append (";"); 247 | if (i < (MemberTypes.Count - 1)) { 248 | sb.Append (" "); 249 | } 250 | } 251 | sb.Append ("}"); 252 | 253 | return sb.ToString (); 254 | } 255 | } 256 | 257 | public class OpaqueType : Type 258 | { 259 | } 260 | 261 | public class PointerType : Type 262 | { 263 | public StorageClass StorageClass { get; } 264 | public Type Type { get; private set; } 265 | 266 | public PointerType (StorageClass storageClass, Type type) 267 | { 268 | StorageClass = storageClass; 269 | Type = type; 270 | } 271 | 272 | public PointerType (StorageClass storageClass) 273 | { 274 | StorageClass = storageClass; 275 | } 276 | 277 | public void ResolveForwardReference (Type t) 278 | { 279 | Type = t; 280 | } 281 | 282 | public override string ToString () 283 | { 284 | if (Type == null) { 285 | return $"{StorageClass} *"; 286 | } else { 287 | return $"{StorageClass} {Type}*"; 288 | } 289 | } 290 | } 291 | 292 | public class FunctionType : Type 293 | { 294 | public Type ReturnType { get; } 295 | public IReadOnlyList ParameterTypes { get { return parameterTypes_; } } 296 | 297 | private readonly List parameterTypes_ = new List (); 298 | 299 | public FunctionType (Type returnType, List parameterTypes) 300 | { 301 | ReturnType = returnType; 302 | parameterTypes_ = parameterTypes; 303 | } 304 | } 305 | 306 | public class EventType : Type 307 | { 308 | } 309 | 310 | public class DeviceEventType : Type 311 | { 312 | } 313 | 314 | public class ReserveIdType : Type 315 | { 316 | } 317 | 318 | public class QueueType : Type 319 | { 320 | } 321 | 322 | public class PipeType : Type 323 | { 324 | } 325 | 326 | public class PipeStorage : Type 327 | { 328 | } 329 | 330 | public class NamedBarrier : Type 331 | { 332 | } 333 | } 334 | -------------------------------------------------------------------------------- /csspv.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27004.2008 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SpirV", "SPIRV\SpirV.csproj", "{B498C064-1566-4123-A828-BE35FBCF5F2C}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSPVDis", "spirv-dis\CSPVDis.csproj", "{F37E5152-3746-4E09-8E26-FE96EEA03DF0}" 9 | ProjectSection(ProjectDependencies) = postProject 10 | {B498C064-1566-4123-A828-BE35FBCF5F2C} = {B498C064-1566-4123-A828-BE35FBCF5F2C} 11 | EndProjectSection 12 | EndProject 13 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CSPVGen", "spirv-gen\CSPVGen.csproj", "{400E239D-F4FD-4557-AD5E-15B34F81898D}" 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Any CPU = Debug|Any CPU 18 | Release|Any CPU = Release|Any CPU 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {B498C064-1566-4123-A828-BE35FBCF5F2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {B498C064-1566-4123-A828-BE35FBCF5F2C}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {B498C064-1566-4123-A828-BE35FBCF5F2C}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {B498C064-1566-4123-A828-BE35FBCF5F2C}.Release|Any CPU.Build.0 = Release|Any CPU 25 | {F37E5152-3746-4E09-8E26-FE96EEA03DF0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 26 | {F37E5152-3746-4E09-8E26-FE96EEA03DF0}.Debug|Any CPU.Build.0 = Debug|Any CPU 27 | {F37E5152-3746-4E09-8E26-FE96EEA03DF0}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {F37E5152-3746-4E09-8E26-FE96EEA03DF0}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {400E239D-F4FD-4557-AD5E-15B34F81898D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 30 | {400E239D-F4FD-4557-AD5E-15B34F81898D}.Debug|Any CPU.Build.0 = Debug|Any CPU 31 | {400E239D-F4FD-4557-AD5E-15B34F81898D}.Release|Any CPU.ActiveCfg = Release|Any CPU 32 | {400E239D-F4FD-4557-AD5E-15B34F81898D}.Release|Any CPU.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | GlobalSection(SolutionProperties) = preSolution 35 | HideSolutionNode = FALSE 36 | EndGlobalSection 37 | GlobalSection(ExtensibilityGlobals) = postSolution 38 | SolutionGuid = {A0B2238F-4799-4349-9DF9-633CCC35811E} 39 | EndGlobalSection 40 | EndGlobal 41 | -------------------------------------------------------------------------------- /spirv-dis/CSPVDis.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | cspvdis 7 | SpirV 8 | 9 | Matthäus G. Chajdas 10 | Matthäus G. Chajdas 11 | CSSPV 12 | https://sh13.net/projects/csspv/ 13 | https://bitbucket.org/Anteru/csspv/src/default/ 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | PreserveNewest 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /spirv-dis/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using CommandLine; 4 | 5 | namespace SpirV 6 | { 7 | class Options 8 | { 9 | [Option('t', HelpText="Show types")] 10 | public bool ShowTypes { get; set; } = false; 11 | 12 | [Option ('n', HelpText = "Show object names if possible")] 13 | public bool ShowNames { get; set; } = false; 14 | 15 | [Value(0, MetaName="Input", HelpText ="Binary SPIR-V file to disassemble", Required = true)] 16 | public string InputFile { get; set; } 17 | } 18 | 19 | class Program 20 | { 21 | static int Run (Options options) 22 | { 23 | var module = Module.ReadFrom (System.IO.File.OpenRead (options.InputFile)); 24 | var ds = new Disassembler (); 25 | 26 | var settings = DisassemblyOptions.None; 27 | 28 | if (options.ShowNames) { 29 | settings |= DisassemblyOptions.ShowNames; 30 | } 31 | 32 | if (options.ShowTypes) { 33 | settings |= DisassemblyOptions.ShowTypes; 34 | } 35 | 36 | Console.Write (ds.Disassemble (module, settings)); 37 | 38 | return 0; 39 | } 40 | 41 | private static int HandleError (IEnumerable errs) 42 | { 43 | return 1; 44 | } 45 | 46 | static void Main(string[] args) 47 | { 48 | CommandLine.Parser.Default.ParseArguments (args) 49 | .WithParsed (opts => Run (opts)) 50 | .WithNotParsed ((errs) => HandleError (errs)); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /spirv-dis/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "spirv-dis": { 4 | "commandName": "Project", 5 | "commandLineArgs": "vs.spv" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /spirv-dis/vs.spv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Anteru/csspv/baf432d95de344f033cad39c98c6eece77bcebeb/spirv-dis/vs.spv -------------------------------------------------------------------------------- /spirv-gen/CSPVGen.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | SpirV 7 | cspvgen 8 | Matthäus G. Chajdas 9 | CSSPV 10 | https://sh13.net/projects/csspv/ 11 | https://bitbucket.org/Anteru/csspv/src/default/ 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | PreserveNewest 23 | 24 | 25 | PreserveNewest 26 | 27 | 28 | PreserveNewest 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /spirv-gen/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.CodeAnalysis; 2 | using Microsoft.CodeAnalysis.CSharp; 3 | using Microsoft.CodeAnalysis.Editing; 4 | using Microsoft.CodeAnalysis.Formatting; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | using System.Xml; 9 | 10 | namespace SpirV 11 | { 12 | enum EnumType 13 | { 14 | Value, 15 | Bit 16 | } 17 | 18 | class Meta 19 | { 20 | public Meta (System.Text.Json.JsonElement meta, 21 | XmlElement ids) 22 | { 23 | MagicNumber = meta.GetProperty ("MagicNumber").GetUInt32(); 24 | Version = meta.GetProperty("Version").GetUInt32(); 25 | Revision = meta.GetProperty("Revision").GetUInt32(); 26 | OpCodeMask = meta.GetProperty("OpCodeMask").GetUInt32(); 27 | WordCountShift = meta.GetProperty("WordCountShift").GetUInt32(); 28 | 29 | foreach (XmlElement toolId in ids.SelectNodes ("id")) { 30 | var ti = new ToolInfo 31 | { 32 | vendor = toolId.GetAttribute ("vendor") 33 | }; 34 | 35 | if (toolId.HasAttribute ("tool")) { 36 | ti.name = toolId.GetAttribute ("tool"); 37 | } 38 | 39 | toolInfos_.Add (Int32.Parse (toolId.GetAttribute ("value")), ti); 40 | } 41 | } 42 | 43 | public SyntaxNode ToSourceFragment (SyntaxGenerator generator) 44 | { 45 | IList members = new List 46 | { 47 | CreateProperty(generator, "MagicNumber", MagicNumber), 48 | CreateProperty(generator, "Version", Version), 49 | CreateProperty(generator, "Revision", Revision), 50 | CreateProperty(generator, "OpCodeMask", OpCodeMask), 51 | CreateProperty(generator, "WordCountShift", WordCountShift) 52 | }; 53 | 54 | StringBuilder sb = new StringBuilder (); 55 | 56 | sb.Append (@"public class ToolInfo { 57 | public ToolInfo (string vendor) 58 | { 59 | Vendor = vendor; 60 | } 61 | 62 | public ToolInfo (string vendor, string name) 63 | { 64 | Vendor = vendor; 65 | Name = name; 66 | } 67 | 68 | public String Name {get;} 69 | public String Vendor {get;} 70 | }"); 71 | sb.Append ("private readonly static Dictionary toolInfos_ = new Dictionary {"); 72 | 73 | foreach (var kv in toolInfos_) { 74 | if (kv.Value.name == null) { 75 | sb.Append ($"{{ {kv.Key}, new ToolInfo (\"{kv.Value.vendor}\") }},"); 76 | } else { 77 | 78 | sb.Append ($"{{ {kv.Key}, new ToolInfo (\"{kv.Value.vendor}\", \"{kv.Value.name}\") }},"); 79 | } 80 | } 81 | 82 | sb.Append ("};\n"); 83 | sb.Append ("public static IReadOnlyDictionary Tools {get => toolInfos_;}\n"); 84 | 85 | var tree = CSharpSyntaxTree.ParseText (sb.ToString ()); 86 | foreach (var node in tree.GetRoot ().ChildNodes ()) { 87 | members.Add (node.NormalizeWhitespace ()); 88 | } 89 | 90 | var n = generator.ClassDeclaration ("Meta", members: members); 91 | 92 | return n; 93 | } 94 | 95 | private SyntaxNode CreateProperty (SyntaxGenerator generator, 96 | string name, object value) 97 | { 98 | return generator.PropertyDeclaration (name, 99 | generator.TypeExpression (SpecialType.System_UInt32), 100 | Accessibility.Public, 101 | DeclarationModifiers.Static | DeclarationModifiers.ReadOnly, 102 | getAccessorStatements: new SyntaxNode[] { 103 | generator.ReturnStatement ( 104 | generator.LiteralExpression (value)) 105 | }); 106 | } 107 | 108 | public uint MagicNumber { get; } 109 | public uint Version { get; } 110 | public uint Revision { get; } 111 | public uint OpCodeMask { get; } 112 | public uint WordCountShift { get; } 113 | 114 | class ToolInfo 115 | { 116 | public string vendor; 117 | public string name; 118 | } 119 | 120 | Dictionary toolInfos_ = new Dictionary (); 121 | } 122 | 123 | class Program 124 | { 125 | static void Main (string[] args) 126 | { 127 | var workspace = new AdhocWorkspace (); 128 | var generator = SyntaxGenerator.GetGenerator (workspace, 129 | LanguageNames.CSharp); 130 | 131 | ProcessSpirv (generator, workspace); 132 | ProcessGrammars (generator, workspace); 133 | } 134 | 135 | class OperandItem 136 | { 137 | public string Kind; 138 | public string Quantifier; 139 | public string Name; 140 | } 141 | 142 | class InstructionItem 143 | { 144 | public string Name; 145 | public int Id; 146 | public IList Operands; 147 | } 148 | 149 | private static void ProcessInstructions (System.Text.Json.JsonElement instructions, 150 | IReadOnlyDictionary knownEnumerands, 151 | SyntaxGenerator generator, IList nodes) 152 | { 153 | var ins = new List (); 154 | 155 | foreach (var instruction in instructions.EnumerateArray()) { 156 | var i = new InstructionItem () 157 | { 158 | Name = instruction.GetProperty ("opname").GetString(), 159 | Id = instruction.GetProperty("opcode").GetInt32() 160 | }; 161 | 162 | if (instruction.TryGetProperty("operands", out System.Text.Json.JsonElement operands)) { 163 | i.Operands = new List (); 164 | foreach (var operand in operands.EnumerateArray()) { 165 | var oe = new OperandItem () 166 | { 167 | Kind = operand.GetProperty ("kind").GetString() 168 | }; 169 | 170 | if (operand.TryGetProperty("quantifier", out System.Text.Json.JsonElement quantifier)) { 171 | switch (quantifier.GetString()) { 172 | case "*": oe.Quantifier = "Varying"; break; 173 | case "?": oe.Quantifier = "Optional"; break; 174 | } 175 | } else { 176 | oe.Quantifier = "Default"; 177 | } 178 | 179 | if (operand.TryGetProperty("name", out System.Text.Json.JsonElement name)) { 180 | var operandName = name.GetString(); 181 | 182 | if (operandName.StartsWith ('\'')) { 183 | operandName = operandName.Replace ("\'", ""); 184 | } 185 | 186 | operandName = operandName.Replace ("\n", ""); 187 | 188 | oe.Name = operandName; 189 | } 190 | 191 | i.Operands.Add (oe); 192 | } 193 | } 194 | 195 | ins.Add (i); 196 | } 197 | 198 | var sb = new StringBuilder (); 199 | 200 | foreach (var instruction in ins) { 201 | CreateInstructionClass (sb, instruction, knownEnumerands); 202 | } 203 | 204 | sb.AppendLine ("public static class Instructions {"); 205 | sb.Append ("private static readonly Dictionary instructions_ = new Dictionary {"); 206 | 207 | foreach (var instruction in ins) { 208 | sb.AppendLine ($"{{ {instruction.Id}, new {instruction.Name}() }},"); 209 | } 210 | 211 | sb.Append (@"}; 212 | 213 | public static IReadOnlyDictionary OpcodeToInstruction { get => instructions_; } 214 | }"); 215 | 216 | var s = sb.ToString (); 217 | 218 | var tree = CSharpSyntaxTree.ParseText (s); 219 | var tn = tree.GetRoot ().ChildNodes (); 220 | foreach (var n in tn) { 221 | nodes.Add (n.NormalizeWhitespace ()); 222 | } 223 | } 224 | 225 | private static void CreateInstructionClass (StringBuilder sb, InstructionItem instruction, IReadOnlyDictionary knownEnumerands) 226 | { 227 | sb.AppendLine ($"public class {instruction.Name} : Instruction"); 228 | sb.AppendLine ("{"); 229 | 230 | sb.AppendLine ($"public {instruction.Name} ()"); 231 | 232 | if (instruction.Operands == null) { 233 | sb.AppendLine ($" : base (\"{instruction.Name}\")"); 234 | } else { 235 | sb.AppendLine ($" : base (\"{instruction.Name}\", new List () {{"); 236 | foreach (var operand in instruction.Operands) { 237 | string constructorParameter = null; 238 | if (knownEnumerands.ContainsKey (operand.Kind)) { 239 | constructorParameter = $"new EnumType<{operand.Kind}, {operand.Kind}ParameterFactory> ()"; 240 | } else { 241 | constructorParameter = $"new {operand.Kind} ()"; 242 | } 243 | if (operand.Name == null) { 244 | sb.AppendLine ($"new Operand ({constructorParameter}, null, OperandQuantifier.{operand.Quantifier}),"); 245 | } else { 246 | sb.AppendLine ($"new Operand ({constructorParameter}, \"{operand.Name}\", OperandQuantifier.{operand.Quantifier}),"); 247 | } 248 | } 249 | sb.AppendLine ("} )"); 250 | } 251 | 252 | sb.AppendLine ("{}"); 253 | 254 | sb.AppendLine ("}"); 255 | } 256 | 257 | class OperatorKindEnumerant 258 | { 259 | public string Name; 260 | public uint Value; 261 | 262 | public IList Parameters; 263 | } 264 | 265 | private static IReadOnlyDictionary ProcessOperandTypes (System.Text.Json.JsonElement OperandTypes, 266 | SyntaxGenerator generator, IList nodes) 267 | { 268 | var result = new Dictionary (); 269 | 270 | // We gather all of the types up-front as we need them in the loop 271 | foreach (var n in OperandTypes.EnumerateArray()) { 272 | // We only handle the Enums here, the others are handled 273 | // manually 274 | if (n.GetProperty ("category").GetString() != "ValueEnum" 275 | && n.GetProperty ("category").GetString() != "BitEnum") continue; 276 | 277 | var kind = n.GetProperty ("kind").GetString(); 278 | 279 | bool hasParameters = false; 280 | 281 | foreach (var enumerant in n.GetProperty("enumerants").EnumerateArray()) { 282 | if (enumerant.TryGetProperty("parameters", out _)) 283 | { 284 | hasParameters = true; 285 | break; 286 | } 287 | } 288 | 289 | result.Add (kind, hasParameters); 290 | } 291 | 292 | foreach (var n in OperandTypes.EnumerateArray()) { 293 | // We only handle the Enums here, the others are handled 294 | // manually 295 | if (n.GetProperty ("category").GetString() != "ValueEnum" 296 | && n.GetProperty("category").GetString() != "BitEnum") continue; 297 | 298 | var kind = n.GetProperty("kind").GetString(); 299 | 300 | var enumType = n.GetProperty("category").GetString() == "ValueEnum" 301 | ? EnumType.Value : EnumType.Bit; 302 | 303 | IList enumerants = new List (); 304 | 305 | foreach (var enumerant in n.GetProperty("enumerants").EnumerateArray()) { 306 | var oke = new OperatorKindEnumerant 307 | { 308 | Name = enumerant.GetProperty ("enumerant").GetString(), 309 | Value = ParseEnumValue (enumerant.GetProperty("value")) 310 | }; 311 | 312 | if (Char.IsDigit (oke.Name[0])) { 313 | oke.Name = kind + oke.Name; 314 | } 315 | 316 | if (enumerant.TryGetProperty("parameters", out System.Text.Json.JsonElement parameters)) { 317 | 318 | oke.Parameters = new List(); 319 | 320 | foreach (var parameter in parameters.EnumerateArray()) 321 | { 322 | oke.Parameters.Add(parameter.GetProperty("kind").GetString()); 323 | } 324 | } 325 | 326 | enumerants.Add (oke); 327 | } 328 | 329 | StringBuilder sb = new StringBuilder (); 330 | 331 | if (enumType == EnumType.Bit) { 332 | sb.AppendLine ("[Flags]"); 333 | } 334 | sb.AppendLine ($"public enum {kind} : uint"); 335 | sb.AppendLine ("{"); 336 | foreach (var e in enumerants) { 337 | sb.Append ($"{e.Name} = {e.Value},\n"); 338 | } 339 | sb.AppendLine ("}"); 340 | 341 | sb.AppendLine ($"public class {kind}ParameterFactory : ParameterFactory"); 342 | sb.AppendLine ("{"); 343 | foreach (var e in enumerants) { 344 | if (e.Parameters == null) continue; 345 | sb.AppendLine ($"public class {e.Name}Parameter : Parameter"); 346 | sb.AppendLine ("{"); 347 | sb.AppendLine ("public override IReadOnlyList OperandTypes { get => operandTypes_; }"); 348 | sb.AppendLine ("private static readonly List operandTypes_ = new List () {"); 349 | 350 | foreach (var p in e.Parameters) { 351 | if (result.ContainsKey (p)) { 352 | if (result[p]) { 353 | sb.AppendLine ($"new EnumType<{p},{p}Parameters> (),"); 354 | } else { 355 | sb.AppendLine ($"new EnumType<{p}> (),"); 356 | } 357 | } else { 358 | sb.AppendLine ($"new {p} (),"); 359 | } 360 | } 361 | 362 | sb.AppendLine ("};"); 363 | sb.AppendLine ("}"); 364 | } 365 | 366 | if (result[kind]) { 367 | OperandTypeCreateParameterMethod (kind, enumerants, sb); 368 | } 369 | 370 | sb.AppendLine ("}"); 371 | 372 | var tree = CSharpSyntaxTree.ParseText (sb.ToString ()); 373 | foreach (var node in tree.GetRoot ().ChildNodes ()) { 374 | nodes.Add (node.NormalizeWhitespace ()); 375 | } 376 | } 377 | 378 | return result; 379 | } 380 | 381 | private static void OperandTypeCreateParameterMethod (string enumName, 382 | IList enumerants, StringBuilder sb) 383 | { 384 | sb.AppendLine ($"public override Parameter CreateParameter (object value)"); 385 | sb.AppendLine ("{"); 386 | sb.AppendLine ($"switch (({enumName})value) {{"); 387 | foreach (var e in enumerants) { 388 | if (e.Parameters == null) continue; 389 | 390 | sb.AppendLine ($"case {enumName}.{e.Name}: return new {e.Name}Parameter ();"); 391 | } 392 | sb.AppendLine ("}"); 393 | sb.AppendLine ("return null;"); 394 | sb.AppendLine ("}"); 395 | } 396 | 397 | private static uint ParseEnumValue (System.Text.Json.JsonElement value) 398 | { 399 | if (value.ValueKind == System.Text.Json.JsonValueKind.String) { 400 | var s = value.ToString (); 401 | 402 | if (s.StartsWith ("0x")) { 403 | return uint.Parse (s[2..], System.Globalization.NumberStyles.HexNumber); 404 | } else { 405 | return uint.Parse (s); 406 | } 407 | } else { 408 | return value.GetUInt32(); 409 | } 410 | } 411 | 412 | private static void ProcessGrammars ( 413 | SyntaxGenerator generator, 414 | Workspace workspace) 415 | { 416 | var doc = System.Text.Json.JsonDocument.Parse(System.IO.File.ReadAllText( 417 | "spirv.core.grammar.json")); 418 | 419 | var nodes = new List (); 420 | 421 | var knownEnumerands = ProcessOperandTypes (doc.RootElement.GetProperty("operand_kinds"), generator, nodes); 422 | ProcessInstructions (doc.RootElement.GetProperty("instructions"), knownEnumerands, generator, nodes); 423 | 424 | var cu = generator.CompilationUnit ( 425 | generator.NamespaceImportDeclaration ("System"), 426 | generator.NamespaceImportDeclaration ("System.Collections.Generic"), 427 | generator.NamespaceDeclaration ("SpirV", nodes)); 428 | 429 | GenerateCode (cu, workspace, "../../../../SPIRV/SpirV.Core.Grammar.cs"); 430 | } 431 | 432 | private static void ProcessSpirv (SyntaxGenerator generator, Workspace workspace) 433 | { 434 | var doc = System.Text.Json.JsonDocument.Parse (System.IO.File.ReadAllText ( 435 | "spirv.json")); 436 | 437 | var xmlDoc = new XmlDocument (); 438 | xmlDoc.Load ("spir-v.xml"); 439 | 440 | var nodes = new List (); 441 | 442 | CreateSpirvMeta (doc.RootElement, xmlDoc, generator, nodes); 443 | 444 | var cu = generator.CompilationUnit ( 445 | generator.NamespaceImportDeclaration ("System"), 446 | generator.NamespaceImportDeclaration ("System.Collections.Generic"), 447 | generator.NamespaceDeclaration ("SpirV", nodes)); 448 | 449 | GenerateCode (cu, workspace, "../../../../SPIRV/SpirV.Meta.cs"); 450 | } 451 | 452 | private static void GenerateCode (SyntaxNode node, Workspace workspace, 453 | string path) 454 | { 455 | node = Formatter.Format (node, workspace); 456 | 457 | System.IO.File.WriteAllText (path, 458 | node.ToFullString ()); 459 | } 460 | 461 | private static void CreateSpirvMeta (System.Text.Json.JsonElement jr, 462 | XmlDocument doc, SyntaxGenerator generator, IList nodes) 463 | { 464 | var meta = new Meta (jr.GetProperty("spv").GetProperty("meta"), doc.SelectSingleNode ("/registry/ids") as XmlElement); 465 | 466 | nodes.Add (meta.ToSourceFragment (generator)); 467 | } 468 | } 469 | } 470 | -------------------------------------------------------------------------------- /spirv-gen/extinst.glsl.std.450.grammar.json: -------------------------------------------------------------------------------- 1 | { 2 | "copyright" : [ 3 | "Copyright (c) 2014-2016 The Khronos Group Inc.", 4 | "", 5 | "Permission is hereby granted, free of charge, to any person obtaining a copy", 6 | "of this software and/or associated documentation files (the \"Materials\"),", 7 | "to deal in the Materials without restriction, including without limitation", 8 | "the rights to use, copy, modify, merge, publish, distribute, sublicense,", 9 | "and/or sell copies of the Materials, and to permit persons to whom the", 10 | "Materials are furnished to do so, subject to the following conditions:", 11 | "", 12 | "The above copyright notice and this permission notice shall be included in", 13 | "all copies or substantial portions of the Materials.", 14 | "", 15 | "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", 16 | "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", 17 | "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", 18 | "", 19 | "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", 20 | "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", 21 | "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", 22 | "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", 23 | "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", 24 | "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", 25 | "IN THE MATERIALS." 26 | ], 27 | "version" : 100, 28 | "revision" : 2, 29 | "instructions" : [ 30 | { 31 | "opname" : "Round", 32 | "opcode" : 1, 33 | "operands" : [ 34 | { "kind" : "IdRef", "name" : "'x'" } 35 | ] 36 | }, 37 | { 38 | "opname" : "RoundEven", 39 | "opcode" : 2, 40 | "operands" : [ 41 | { "kind" : "IdRef", "name" : "'x'" } 42 | ] 43 | }, 44 | { 45 | "opname" : "Trunc", 46 | "opcode" : 3, 47 | "operands" : [ 48 | { "kind" : "IdRef", "name" : "'x'" } 49 | ] 50 | }, 51 | { 52 | "opname" : "FAbs", 53 | "opcode" : 4, 54 | "operands" : [ 55 | { "kind" : "IdRef", "name" : "'x'" } 56 | ] 57 | }, 58 | { 59 | "opname" : "SAbs", 60 | "opcode" : 5, 61 | "operands" : [ 62 | { "kind" : "IdRef", "name" : "'x'" } 63 | ] 64 | }, 65 | { 66 | "opname" : "FSign", 67 | "opcode" : 6, 68 | "operands" : [ 69 | { "kind" : "IdRef", "name" : "'x'" } 70 | ] 71 | }, 72 | { 73 | "opname" : "SSign", 74 | "opcode" : 7, 75 | "operands" : [ 76 | { "kind" : "IdRef", "name" : "'x'" } 77 | ] 78 | }, 79 | { 80 | "opname" : "Floor", 81 | "opcode" : 8, 82 | "operands" : [ 83 | { "kind" : "IdRef", "name" : "'x'" } 84 | ] 85 | }, 86 | { 87 | "opname" : "Ceil", 88 | "opcode" : 9, 89 | "operands" : [ 90 | { "kind" : "IdRef", "name" : "'x'" } 91 | ] 92 | }, 93 | { 94 | "opname" : "Fract", 95 | "opcode" : 10, 96 | "operands" : [ 97 | { "kind" : "IdRef", "name" : "'x'" } 98 | ] 99 | }, 100 | { 101 | "opname" : "Radians", 102 | "opcode" : 11, 103 | "operands" : [ 104 | { "kind" : "IdRef", "name" : "'degrees'" } 105 | ] 106 | }, 107 | { 108 | "opname" : "Degrees", 109 | "opcode" : 12, 110 | "operands" : [ 111 | { "kind" : "IdRef", "name" : "'radians'" } 112 | ] 113 | }, 114 | { 115 | "opname" : "Sin", 116 | "opcode" : 13, 117 | "operands" : [ 118 | { "kind" : "IdRef", "name" : "'x'" } 119 | ] 120 | }, 121 | { 122 | "opname" : "Cos", 123 | "opcode" : 14, 124 | "operands" : [ 125 | { "kind" : "IdRef", "name" : "'x'" } 126 | ] 127 | }, 128 | { 129 | "opname" : "Tan", 130 | "opcode" : 15, 131 | "operands" : [ 132 | { "kind" : "IdRef", "name" : "'x'" } 133 | ] 134 | }, 135 | { 136 | "opname" : "Asin", 137 | "opcode" : 16, 138 | "operands" : [ 139 | { "kind" : "IdRef", "name" : "'x'" } 140 | ] 141 | }, 142 | { 143 | "opname" : "Acos", 144 | "opcode" : 17, 145 | "operands" : [ 146 | { "kind" : "IdRef", "name" : "'x'" } 147 | ] 148 | }, 149 | { 150 | "opname" : "Atan", 151 | "opcode" : 18, 152 | "operands" : [ 153 | { "kind" : "IdRef", "name" : "'y_over_x'" } 154 | ] 155 | }, 156 | { 157 | "opname" : "Sinh", 158 | "opcode" : 19, 159 | "operands" : [ 160 | { "kind" : "IdRef", "name" : "'x'" } 161 | ] 162 | }, 163 | { 164 | "opname" : "Cosh", 165 | "opcode" : 20, 166 | "operands" : [ 167 | { "kind" : "IdRef", "name" : "'x'" } 168 | ] 169 | }, 170 | { 171 | "opname" : "Tanh", 172 | "opcode" : 21, 173 | "operands" : [ 174 | { "kind" : "IdRef", "name" : "'x'" } 175 | ] 176 | }, 177 | { 178 | "opname" : "Asinh", 179 | "opcode" : 22, 180 | "operands" : [ 181 | { "kind" : "IdRef", "name" : "'x'" } 182 | ] 183 | }, 184 | { 185 | "opname" : "Acosh", 186 | "opcode" : 23, 187 | "operands" : [ 188 | { "kind" : "IdRef", "name" : "'x'" } 189 | ] 190 | }, 191 | { 192 | "opname" : "Atanh", 193 | "opcode" : 24, 194 | "operands" : [ 195 | { "kind" : "IdRef", "name" : "'x'" } 196 | ] 197 | }, 198 | { 199 | "opname" : "Atan2", 200 | "opcode" : 25, 201 | "operands" : [ 202 | { "kind" : "IdRef", "name" : "'y'" }, 203 | { "kind" : "IdRef", "name" : "'x'" } 204 | ] 205 | }, 206 | { 207 | "opname" : "Pow", 208 | "opcode" : 26, 209 | "operands" : [ 210 | { "kind" : "IdRef", "name" : "'x'" }, 211 | { "kind" : "IdRef", "name" : "'y'" } 212 | ] 213 | }, 214 | { 215 | "opname" : "Exp", 216 | "opcode" : 27, 217 | "operands" : [ 218 | { "kind" : "IdRef", "name" : "'x'" } 219 | ] 220 | }, 221 | { 222 | "opname" : "Log", 223 | "opcode" : 28, 224 | "operands" : [ 225 | { "kind" : "IdRef", "name" : "'x'" } 226 | ] 227 | }, 228 | { 229 | "opname" : "Exp2", 230 | "opcode" : 29, 231 | "operands" : [ 232 | { "kind" : "IdRef", "name" : "'x'" } 233 | ] 234 | }, 235 | { 236 | "opname" : "Log2", 237 | "opcode" : 30, 238 | "operands" : [ 239 | { "kind" : "IdRef", "name" : "'x'" } 240 | ] 241 | }, 242 | { 243 | "opname" : "Sqrt", 244 | "opcode" : 31, 245 | "operands" : [ 246 | { "kind" : "IdRef", "name" : "'x'" } 247 | ] 248 | }, 249 | { 250 | "opname" : "InverseSqrt", 251 | "opcode" : 32, 252 | "operands" : [ 253 | { "kind" : "IdRef", "name" : "'x'" } 254 | ] 255 | }, 256 | { 257 | "opname" : "Determinant", 258 | "opcode" : 33, 259 | "operands" : [ 260 | { "kind" : "IdRef", "name" : "'x'" } 261 | ] 262 | }, 263 | { 264 | "opname" : "MatrixInverse", 265 | "opcode" : 34, 266 | "operands" : [ 267 | { "kind" : "IdRef", "name" : "'x'" } 268 | ] 269 | }, 270 | { 271 | "opname" : "Modf", 272 | "opcode" : 35, 273 | "operands" : [ 274 | { "kind" : "IdRef", "name" : "'x'" }, 275 | { "kind" : "IdRef", "name" : "'i'" } 276 | ] 277 | }, 278 | { 279 | "opname" : "ModfStruct", 280 | "opcode" : 36, 281 | "operands" : [ 282 | { "kind" : "IdRef", "name" : "'x'" } 283 | ] 284 | }, 285 | { 286 | "opname" : "FMin", 287 | "opcode" : 37, 288 | "operands" : [ 289 | { "kind" : "IdRef", "name" : "'x'" }, 290 | { "kind" : "IdRef", "name" : "'y'" } 291 | ] 292 | }, 293 | { 294 | "opname" : "UMin", 295 | "opcode" : 38, 296 | "operands" : [ 297 | { "kind" : "IdRef", "name" : "'x'" }, 298 | { "kind" : "IdRef", "name" : "'y'" } 299 | ] 300 | }, 301 | { 302 | "opname" : "SMin", 303 | "opcode" : 39, 304 | "operands" : [ 305 | { "kind" : "IdRef", "name" : "'x'" }, 306 | { "kind" : "IdRef", "name" : "'y'" } 307 | ] 308 | }, 309 | { 310 | "opname" : "FMax", 311 | "opcode" : 40, 312 | "operands" : [ 313 | { "kind" : "IdRef", "name" : "'x'" }, 314 | { "kind" : "IdRef", "name" : "'y'" } 315 | ] 316 | }, 317 | { 318 | "opname" : "UMax", 319 | "opcode" : 41, 320 | "operands" : [ 321 | { "kind" : "IdRef", "name" : "'x'" }, 322 | { "kind" : "IdRef", "name" : "'y'" } 323 | ] 324 | }, 325 | { 326 | "opname" : "SMax", 327 | "opcode" : 42, 328 | "operands" : [ 329 | { "kind" : "IdRef", "name" : "'x'" }, 330 | { "kind" : "IdRef", "name" : "'y'" } 331 | ] 332 | }, 333 | { 334 | "opname" : "FClamp", 335 | "opcode" : 43, 336 | "operands" : [ 337 | { "kind" : "IdRef", "name" : "'x'" }, 338 | { "kind" : "IdRef", "name" : "'minVal'" }, 339 | { "kind" : "IdRef", "name" : "'maxVal'" } 340 | ] 341 | }, 342 | { 343 | "opname" : "UClamp", 344 | "opcode" : 44, 345 | "operands" : [ 346 | { "kind" : "IdRef", "name" : "'x'" }, 347 | { "kind" : "IdRef", "name" : "'minVal'" }, 348 | { "kind" : "IdRef", "name" : "'maxVal'" } 349 | ] 350 | }, 351 | { 352 | "opname" : "SClamp", 353 | "opcode" : 45, 354 | "operands" : [ 355 | { "kind" : "IdRef", "name" : "'x'" }, 356 | { "kind" : "IdRef", "name" : "'minVal'" }, 357 | { "kind" : "IdRef", "name" : "'maxVal'" } 358 | ] 359 | }, 360 | { 361 | "opname" : "FMix", 362 | "opcode" : 46, 363 | "operands" : [ 364 | { "kind" : "IdRef", "name" : "'x'" }, 365 | { "kind" : "IdRef", "name" : "'y'" }, 366 | { "kind" : "IdRef", "name" : "'a'" } 367 | ] 368 | }, 369 | { 370 | "opname" : "IMix", 371 | "opcode" : 47, 372 | "operands" : [ 373 | { "kind" : "IdRef", "name" : "'x'" }, 374 | { "kind" : "IdRef", "name" : "'y'" }, 375 | { "kind" : "IdRef", "name" : "'a'" } 376 | ] 377 | }, 378 | { 379 | "opname" : "Step", 380 | "opcode" : 48, 381 | "operands" : [ 382 | { "kind" : "IdRef", "name" : "'edge'" }, 383 | { "kind" : "IdRef", "name" : "'x'" } 384 | ] 385 | }, 386 | { 387 | "opname" : "SmoothStep", 388 | "opcode" : 49, 389 | "operands" : [ 390 | { "kind" : "IdRef", "name" : "'edge0'" }, 391 | { "kind" : "IdRef", "name" : "'edge1'" }, 392 | { "kind" : "IdRef", "name" : "'x'" } 393 | ] 394 | }, 395 | { 396 | "opname" : "Fma", 397 | "opcode" : 50, 398 | "operands" : [ 399 | { "kind" : "IdRef", "name" : "'a'" }, 400 | { "kind" : "IdRef", "name" : "'b'" }, 401 | { "kind" : "IdRef", "name" : "'c'" } 402 | ] 403 | }, 404 | { 405 | "opname" : "Frexp", 406 | "opcode" : 51, 407 | "operands" : [ 408 | { "kind" : "IdRef", "name" : "'x'" }, 409 | { "kind" : "IdRef", "name" : "'exp'" } 410 | ] 411 | }, 412 | { 413 | "opname" : "FrexpStruct", 414 | "opcode" : 52, 415 | "operands" : [ 416 | { "kind" : "IdRef", "name" : "'x'" } 417 | ] 418 | }, 419 | { 420 | "opname" : "Ldexp", 421 | "opcode" : 53, 422 | "operands" : [ 423 | { "kind" : "IdRef", "name" : "'x'" }, 424 | { "kind" : "IdRef", "name" : "'exp'" } 425 | ] 426 | }, 427 | { 428 | "opname" : "PackSnorm4x8", 429 | "opcode" : 54, 430 | "operands" : [ 431 | { "kind" : "IdRef", "name" : "'v'" } 432 | ] 433 | }, 434 | { 435 | "opname" : "PackUnorm4x8", 436 | "opcode" : 55, 437 | "operands" : [ 438 | { "kind" : "IdRef", "name" : "'v'" } 439 | ] 440 | }, 441 | { 442 | "opname" : "PackSnorm2x16", 443 | "opcode" : 56, 444 | "operands" : [ 445 | { "kind" : "IdRef", "name" : "'v'" } 446 | ] 447 | }, 448 | { 449 | "opname" : "PackUnorm2x16", 450 | "opcode" : 57, 451 | "operands" : [ 452 | { "kind" : "IdRef", "name" : "'v'" } 453 | ] 454 | }, 455 | { 456 | "opname" : "PackHalf2x16", 457 | "opcode" : 58, 458 | "operands" : [ 459 | { "kind" : "IdRef", "name" : "'v'" } 460 | ] 461 | }, 462 | { 463 | "opname" : "PackDouble2x32", 464 | "opcode" : 59, 465 | "operands" : [ 466 | { "kind" : "IdRef", "name" : "'v'" } 467 | ], 468 | "capabilities" : [ "Float64" ] 469 | }, 470 | { 471 | "opname" : "UnpackSnorm2x16", 472 | "opcode" : 60, 473 | "operands" : [ 474 | { "kind" : "IdRef", "name" : "'p'" } 475 | ] 476 | }, 477 | { 478 | "opname" : "UnpackUnorm2x16", 479 | "opcode" : 61, 480 | "operands" : [ 481 | { "kind" : "IdRef", "name" : "'p'" } 482 | ] 483 | }, 484 | { 485 | "opname" : "UnpackHalf2x16", 486 | "opcode" : 62, 487 | "operands" : [ 488 | { "kind" : "IdRef", "name" : "'v'" } 489 | ] 490 | }, 491 | { 492 | "opname" : "UnpackSnorm4x8", 493 | "opcode" : 63, 494 | "operands" : [ 495 | { "kind" : "IdRef", "name" : "'p'" } 496 | ] 497 | }, 498 | { 499 | "opname" : "UnpackUnorm4x8", 500 | "opcode" : 64, 501 | "operands" : [ 502 | { "kind" : "IdRef", "name" : "'p'" } 503 | ] 504 | }, 505 | { 506 | "opname" : "UnpackDouble2x32", 507 | "opcode" : 65, 508 | "operands" : [ 509 | { "kind" : "IdRef", "name" : "'v'" } 510 | ], 511 | "capabilities" : [ "Float64" ] 512 | }, 513 | { 514 | "opname" : "Length", 515 | "opcode" : 66, 516 | "operands" : [ 517 | { "kind" : "IdRef", "name" : "'x'" } 518 | ] 519 | }, 520 | { 521 | "opname" : "Distance", 522 | "opcode" : 67, 523 | "operands" : [ 524 | { "kind" : "IdRef", "name" : "'p0'" }, 525 | { "kind" : "IdRef", "name" : "'p1'" } 526 | ] 527 | }, 528 | { 529 | "opname" : "Cross", 530 | "opcode" : 68, 531 | "operands" : [ 532 | { "kind" : "IdRef", "name" : "'x'" }, 533 | { "kind" : "IdRef", "name" : "'y'" } 534 | ] 535 | }, 536 | { 537 | "opname" : "Normalize", 538 | "opcode" : 69, 539 | "operands" : [ 540 | { "kind" : "IdRef", "name" : "'x'" } 541 | ] 542 | }, 543 | { 544 | "opname" : "FaceForward", 545 | "opcode" : 70, 546 | "operands" : [ 547 | { "kind" : "IdRef", "name" : "'N'" }, 548 | { "kind" : "IdRef", "name" : "'I'" }, 549 | { "kind" : "IdRef", "name" : "'Nref'" } 550 | ] 551 | }, 552 | { 553 | "opname" : "Reflect", 554 | "opcode" : 71, 555 | "operands" : [ 556 | { "kind" : "IdRef", "name" : "'I'" }, 557 | { "kind" : "IdRef", "name" : "'N'" } 558 | ] 559 | }, 560 | { 561 | "opname" : "Refract", 562 | "opcode" : 72, 563 | "operands" : [ 564 | { "kind" : "IdRef", "name" : "'I'" }, 565 | { "kind" : "IdRef", "name" : "'N'" }, 566 | { "kind" : "IdRef", "name" : "'eta'" } 567 | ] 568 | }, 569 | { 570 | "opname" : "FindILsb", 571 | "opcode" : 73, 572 | "operands" : [ 573 | { "kind" : "IdRef", "name" : "'Value'" } 574 | ] 575 | }, 576 | { 577 | "opname" : "FindSMsb", 578 | "opcode" : 74, 579 | "operands" : [ 580 | { "kind" : "IdRef", "name" : "'Value'" } 581 | ] 582 | }, 583 | { 584 | "opname" : "FindUMsb", 585 | "opcode" : 75, 586 | "operands" : [ 587 | { "kind" : "IdRef", "name" : "'Value'" } 588 | ] 589 | }, 590 | { 591 | "opname" : "InterpolateAtCentroid", 592 | "opcode" : 76, 593 | "operands" : [ 594 | { "kind" : "IdRef", "name" : "'interpolant'" } 595 | ], 596 | "capabilities" : [ "InterpolationFunction" ] 597 | }, 598 | { 599 | "opname" : "InterpolateAtSample", 600 | "opcode" : 77, 601 | "operands" : [ 602 | { "kind" : "IdRef", "name" : "'interpolant'" }, 603 | { "kind" : "IdRef", "name" : "'sample'" } 604 | ], 605 | "capabilities" : [ "InterpolationFunction" ] 606 | }, 607 | { 608 | "opname" : "InterpolateAtOffset", 609 | "opcode" : 78, 610 | "operands" : [ 611 | { "kind" : "IdRef", "name" : "'interpolant'" }, 612 | { "kind" : "IdRef", "name" : "'offset'" } 613 | ], 614 | "capabilities" : [ "InterpolationFunction" ] 615 | }, 616 | { 617 | "opname" : "NMin", 618 | "opcode" : 79, 619 | "operands" : [ 620 | { "kind" : "IdRef", "name" : "'x'" }, 621 | { "kind" : "IdRef", "name" : "'y'" } 622 | ] 623 | }, 624 | { 625 | "opname" : "NMax", 626 | "opcode" : 80, 627 | "operands" : [ 628 | { "kind" : "IdRef", "name" : "'x'" }, 629 | { "kind" : "IdRef", "name" : "'y'" } 630 | ] 631 | }, 632 | { 633 | "opname" : "NClamp", 634 | "opcode" : 81, 635 | "operands" : [ 636 | { "kind" : "IdRef", "name" : "'x'" }, 637 | { "kind" : "IdRef", "name" : "'minVal'" }, 638 | { "kind" : "IdRef", "name" : "'maxVal'" } 639 | ] 640 | } 641 | ] 642 | } 643 | -------------------------------------------------------------------------------- /spirv-gen/extinst.opencl.std.100.grammar.json: -------------------------------------------------------------------------------- 1 | { 2 | "copyright" : [ 3 | "Copyright (c) 2014-2016 The Khronos Group Inc.", 4 | "", 5 | "Permission is hereby granted, free of charge, to any person obtaining a copy", 6 | "of this software and/or associated documentation files (the \"Materials\"),", 7 | "to deal in the Materials without restriction, including without limitation", 8 | "the rights to use, copy, modify, merge, publish, distribute, sublicense,", 9 | "and/or sell copies of the Materials, and to permit persons to whom the", 10 | "Materials are furnished to do so, subject to the following conditions:", 11 | "", 12 | "The above copyright notice and this permission notice shall be included in", 13 | "all copies or substantial portions of the Materials.", 14 | "", 15 | "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", 16 | "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", 17 | "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", 18 | "", 19 | "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", 20 | "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", 21 | "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", 22 | "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", 23 | "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", 24 | "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", 25 | "IN THE MATERIALS." 26 | ], 27 | "version" : 100, 28 | "revision" : 2, 29 | "instructions" : [ 30 | { 31 | "opname" : "acos", 32 | "opcode" : 0, 33 | "operands" : [ 34 | { "kind" : "IdRef", "name" : "'x'" } 35 | ] 36 | }, 37 | { 38 | "opname" : "acosh", 39 | "opcode" : 1, 40 | "operands" : [ 41 | { "kind" : "IdRef", "name" : "'x'" } 42 | ] 43 | }, 44 | { 45 | "opname" : "acospi", 46 | "opcode" : 2, 47 | "operands" : [ 48 | { "kind" : "IdRef", "name" : "'x'" } 49 | ] 50 | }, 51 | { 52 | "opname" : "asin", 53 | "opcode" : 3, 54 | "operands" : [ 55 | { "kind" : "IdRef", "name" : "'x'" } 56 | ] 57 | }, 58 | { 59 | "opname" : "asinh", 60 | "opcode" : 4, 61 | "operands" : [ 62 | { "kind" : "IdRef", "name" : "'x'" } 63 | ] 64 | }, 65 | { 66 | "opname" : "asinpi", 67 | "opcode" : 5, 68 | "operands" : [ 69 | { "kind" : "IdRef", "name" : "'x'" } 70 | ] 71 | }, 72 | { 73 | "opname" : "atan", 74 | "opcode" : 6, 75 | "operands" : [ 76 | { "kind" : "IdRef", "name" : "'x'" } 77 | ] 78 | }, 79 | { 80 | "opname" : "atan2", 81 | "opcode" : 7, 82 | "operands" : [ 83 | { "kind" : "IdRef", "name" : "'y'" }, 84 | { "kind" : "IdRef", "name" : "'x'" } 85 | ] 86 | }, 87 | { 88 | "opname" : "atanh", 89 | "opcode" : 8, 90 | "operands" : [ 91 | { "kind" : "IdRef", "name" : "'x'" } 92 | ] 93 | }, 94 | { 95 | "opname" : "atanpi", 96 | "opcode" : 9, 97 | "operands" : [ 98 | { "kind" : "IdRef", "name" : "'x'" } 99 | ] 100 | }, 101 | { 102 | "opname" : "atan2pi", 103 | "opcode" : 10, 104 | "operands" : [ 105 | { "kind" : "IdRef", "name" : "'y'" }, 106 | { "kind" : "IdRef", "name" : "'x'" } 107 | ] 108 | }, 109 | { 110 | "opname" : "cbrt", 111 | "opcode" : 11, 112 | "operands" : [ 113 | { "kind" : "IdRef", "name" : "'x'" } 114 | ] 115 | }, 116 | { 117 | "opname" : "ceil", 118 | "opcode" : 12, 119 | "operands" : [ 120 | { "kind" : "IdRef", "name" : "'x'" } 121 | ] 122 | }, 123 | { 124 | "opname" : "copysign", 125 | "opcode" : 13, 126 | "operands" : [ 127 | { "kind" : "IdRef", "name" : "'x'" }, 128 | { "kind" : "IdRef", "name" : "'y'" } 129 | ] 130 | }, 131 | { 132 | "opname" : "cos", 133 | "opcode" : 14, 134 | "operands" : [ 135 | { "kind" : "IdRef", "name" : "'x'" } 136 | ] 137 | }, 138 | { 139 | "opname" : "cosh", 140 | "opcode" : 15, 141 | "operands" : [ 142 | { "kind" : "IdRef", "name" : "'x'" } 143 | ] 144 | }, 145 | { 146 | "opname" : "cospi", 147 | "opcode" : 16, 148 | "operands" : [ 149 | { "kind" : "IdRef", "name" : "'x'" } 150 | ] 151 | }, 152 | { 153 | "opname" : "erfc", 154 | "opcode" : 17, 155 | "operands" : [ 156 | { "kind" : "IdRef", "name" : "'x'" } 157 | ] 158 | }, 159 | { 160 | "opname" : "erf", 161 | "opcode" : 18, 162 | "operands" : [ 163 | { "kind" : "IdRef", "name" : "'x'" } 164 | ] 165 | }, 166 | { 167 | "opname" : "exp", 168 | "opcode" : 19, 169 | "operands" : [ 170 | { "kind" : "IdRef", "name" : "'x'" } 171 | ] 172 | }, 173 | { 174 | "opname" : "exp2", 175 | "opcode" : 20, 176 | "operands" : [ 177 | { "kind" : "IdRef", "name" : "'x'" } 178 | ] 179 | }, 180 | { 181 | "opname" : "exp10", 182 | "opcode" : 21, 183 | "operands" : [ 184 | { "kind" : "IdRef", "name" : "'x'" } 185 | ] 186 | }, 187 | { 188 | "opname" : "expm1", 189 | "opcode" : 22, 190 | "operands" : [ 191 | { "kind" : "IdRef", "name" : "'x'" } 192 | ] 193 | }, 194 | { 195 | "opname" : "fabs", 196 | "opcode" : 23, 197 | "operands" : [ 198 | { "kind" : "IdRef", "name" : "'x'" } 199 | ] 200 | }, 201 | { 202 | "opname" : "fdim", 203 | "opcode" : 24, 204 | "operands" : [ 205 | { "kind" : "IdRef", "name" : "'x'" }, 206 | { "kind" : "IdRef", "name" : "'y'" } 207 | ] 208 | }, 209 | { 210 | "opname" : "floor", 211 | "opcode" : 25, 212 | "operands" : [ 213 | { "kind" : "IdRef", "name" : "'x'" } 214 | ] 215 | }, 216 | { 217 | "opname" : "fma", 218 | "opcode" : 26, 219 | "operands" : [ 220 | { "kind" : "IdRef", "name" : "'a'" }, 221 | { "kind" : "IdRef", "name" : "'b'" }, 222 | { "kind" : "IdRef", "name" : "'c'" } 223 | ] 224 | }, 225 | { 226 | "opname" : "fmax", 227 | "opcode" : 27, 228 | "operands" : [ 229 | { "kind" : "IdRef", "name" : "'x'" }, 230 | { "kind" : "IdRef", "name" : "'y'" } 231 | ] 232 | }, 233 | { 234 | "opname" : "fmin", 235 | "opcode" : 28, 236 | "operands" : [ 237 | { "kind" : "IdRef", "name" : "'x'" }, 238 | { "kind" : "IdRef", "name" : "'y'" } 239 | ] 240 | }, 241 | { 242 | "opname" : "fmod", 243 | "opcode" : 29, 244 | "operands" : [ 245 | { "kind" : "IdRef", "name" : "'x'" }, 246 | { "kind" : "IdRef", "name" : "'y'" } 247 | ] 248 | }, 249 | { 250 | "opname" : "fract", 251 | "opcode" : 30, 252 | "operands" : [ 253 | { "kind" : "IdRef", "name" : "'x'" }, 254 | { "kind" : "IdRef", "name" : "'ptr'" } 255 | ] 256 | }, 257 | { 258 | "opname" : "frexp", 259 | "opcode" : 31, 260 | "operands" : [ 261 | { "kind" : "IdRef", "name" : "'x'" }, 262 | { "kind" : "IdRef", "name" : "'exp'" } 263 | ] 264 | }, 265 | { 266 | "opname" : "hypot", 267 | "opcode" : 32, 268 | "operands" : [ 269 | { "kind" : "IdRef", "name" : "'x'" }, 270 | { "kind" : "IdRef", "name" : "'y'" } 271 | ] 272 | }, 273 | { 274 | "opname" : "ilogb", 275 | "opcode" : 33, 276 | "operands" : [ 277 | { "kind" : "IdRef", "name" : "'x'" } 278 | ] 279 | }, 280 | { 281 | "opname" : "ldexp", 282 | "opcode" : 34, 283 | "operands" : [ 284 | { "kind" : "IdRef", "name" : "'x'" }, 285 | { "kind" : "IdRef", "name" : "'k'" } 286 | ] 287 | }, 288 | { 289 | "opname" : "lgamma", 290 | "opcode" : 35, 291 | "operands" : [ 292 | { "kind" : "IdRef", "name" : "'x'" } 293 | ] 294 | }, 295 | { 296 | "opname" : "lgamma_r", 297 | "opcode" : 36, 298 | "operands" : [ 299 | { "kind" : "IdRef", "name" : "'x'" }, 300 | { "kind" : "IdRef", "name" : "'signp'" } 301 | ] 302 | }, 303 | { 304 | "opname" : "log", 305 | "opcode" : 37, 306 | "operands" : [ 307 | { "kind" : "IdRef", "name" : "'x'" } 308 | ] 309 | }, 310 | { 311 | "opname" : "log2", 312 | "opcode" : 38, 313 | "operands" : [ 314 | { "kind" : "IdRef", "name" : "'x'" } 315 | ] 316 | }, 317 | { 318 | "opname" : "log10", 319 | "opcode" : 39, 320 | "operands" : [ 321 | { "kind" : "IdRef", "name" : "'x'" } 322 | ] 323 | }, 324 | { 325 | "opname" : "log1p", 326 | "opcode" : 40, 327 | "operands" : [ 328 | { "kind" : "IdRef", "name" : "'x'" } 329 | ] 330 | }, 331 | { 332 | "opname" : "logb", 333 | "opcode" : 41, 334 | "operands" : [ 335 | { "kind" : "IdRef", "name" : "'x'" } 336 | ] 337 | }, 338 | { 339 | "opname" : "mad", 340 | "opcode" : 42, 341 | "operands" : [ 342 | { "kind" : "IdRef", "name" : "'a'" }, 343 | { "kind" : "IdRef", "name" : "'b'" }, 344 | { "kind" : "IdRef", "name" : "'c'" } 345 | ] 346 | }, 347 | { 348 | "opname" : "maxmag", 349 | "opcode" : 43, 350 | "operands" : [ 351 | { "kind" : "IdRef", "name" : "'x'" }, 352 | { "kind" : "IdRef", "name" : "'y'" } 353 | ] 354 | }, 355 | { 356 | "opname" : "minmag", 357 | "opcode" : 44, 358 | "operands" : [ 359 | { "kind" : "IdRef", "name" : "'x'" }, 360 | { "kind" : "IdRef", "name" : "'y'" } 361 | ] 362 | }, 363 | { 364 | "opname" : "modf", 365 | "opcode" : 45, 366 | "operands" : [ 367 | { "kind" : "IdRef", "name" : "'x'" }, 368 | { "kind" : "IdRef", "name" : "'iptr'" } 369 | ] 370 | }, 371 | { 372 | "opname" : "nan", 373 | "opcode" : 46, 374 | "operands" : [ 375 | { "kind" : "IdRef", "name" : "'nancode'" } 376 | ] 377 | }, 378 | { 379 | "opname" : "nextafter", 380 | "opcode" : 47, 381 | "operands" : [ 382 | { "kind" : "IdRef", "name" : "'x'" }, 383 | { "kind" : "IdRef", "name" : "'y'" } 384 | ] 385 | }, 386 | { 387 | "opname" : "pow", 388 | "opcode" : 48, 389 | "operands" : [ 390 | { "kind" : "IdRef", "name" : "'x'" }, 391 | { "kind" : "IdRef", "name" : "'y" } 392 | ] 393 | }, 394 | { 395 | "opname" : "pown", 396 | "opcode" : 49, 397 | "operands" : [ 398 | { "kind" : "IdRef", "name" : "'x'" }, 399 | { "kind" : "IdRef", "name" : "'y'" } 400 | ] 401 | }, 402 | { 403 | "opname" : "powr", 404 | "opcode" : 50, 405 | "operands" : [ 406 | { "kind" : "IdRef", "name" : "'x'" }, 407 | { "kind" : "IdRef", "name" : "'y'" } 408 | ] 409 | }, 410 | { 411 | "opname" : "remainder", 412 | "opcode" : 51, 413 | "operands" : [ 414 | { "kind" : "IdRef", "name" : "'x'" }, 415 | { "kind" : "IdRef", "name" : "'y'" } 416 | ] 417 | }, 418 | { 419 | "opname" : "remquo", 420 | "opcode" : 52, 421 | "operands" : [ 422 | { "kind" : "IdRef", "name" : "'x'" }, 423 | { "kind" : "IdRef", "name" : "'y'" }, 424 | { "kind" : "IdRef", "name" : "'quo'" } 425 | ] 426 | }, 427 | { 428 | "opname" : "rint", 429 | "opcode" : 53, 430 | "operands" : [ 431 | { "kind" : "IdRef", "name" : "'x'" } 432 | ] 433 | }, 434 | { 435 | "opname" : "rootn", 436 | "opcode" : 54, 437 | "operands" : [ 438 | { "kind" : "IdRef", "name" : "'x'" }, 439 | { "kind" : "IdRef", "name" : "'y'" } 440 | ] 441 | }, 442 | { 443 | "opname" : "round", 444 | "opcode" : 55, 445 | "operands" : [ 446 | { "kind" : "IdRef", "name" : "'x'" } 447 | ] 448 | }, 449 | { 450 | "opname" : "rsqrt", 451 | "opcode" : 56, 452 | "operands" : [ 453 | { "kind" : "IdRef", "name" : "'x'" } 454 | ] 455 | }, 456 | { 457 | "opname" : "sin", 458 | "opcode" : 57, 459 | "operands" : [ 460 | { "kind" : "IdRef", "name" : "'x'" } 461 | ] 462 | }, 463 | { 464 | "opname" : "sincos", 465 | "opcode" : 58, 466 | "operands" : [ 467 | { "kind" : "IdRef", "name" : "'x'" }, 468 | { "kind" : "IdRef", "name" : "'cosval'" } 469 | ] 470 | }, 471 | { 472 | "opname" : "sinh", 473 | "opcode" : 59, 474 | "operands" : [ 475 | { "kind" : "IdRef", "name" : "'x'" } 476 | ] 477 | }, 478 | { 479 | "opname" : "sinpi", 480 | "opcode" : 60, 481 | "operands" : [ 482 | { "kind" : "IdRef", "name" : "'x'" } 483 | ] 484 | }, 485 | { 486 | "opname" : "sqrt", 487 | "opcode" : 61, 488 | "operands" : [ 489 | { "kind" : "IdRef", "name" : "'x'" } 490 | ] 491 | }, 492 | { 493 | "opname" : "tan", 494 | "opcode" : 62, 495 | "operands" : [ 496 | { "kind" : "IdRef", "name" : "'x'" } 497 | ] 498 | }, 499 | { 500 | "opname" : "tanh", 501 | "opcode" : 63, 502 | "operands" : [ 503 | { "kind" : "IdRef", "name" : "'x'" } 504 | ] 505 | }, 506 | { 507 | "opname" : "tanpi", 508 | "opcode" : 64, 509 | "operands" : [ 510 | { "kind" : "IdRef", "name" : "'x'" } 511 | ] 512 | }, 513 | { 514 | "opname" : "tgamma", 515 | "opcode" : 65, 516 | "operands" : [ 517 | { "kind" : "IdRef", "name" : "'x'" } 518 | ] 519 | }, 520 | { 521 | "opname" : "trunc", 522 | "opcode" : 66, 523 | "operands" : [ 524 | { "kind" : "IdRef", "name" : "'x'" } 525 | ] 526 | }, 527 | { 528 | "opname" : "half_cos", 529 | "opcode" : 67, 530 | "operands" : [ 531 | { "kind" : "IdRef", "name" : "'x'" } 532 | ] 533 | }, 534 | { 535 | "opname" : "half_divide", 536 | "opcode" : 68, 537 | "operands" : [ 538 | { "kind" : "IdRef", "name" : "'x'" }, 539 | { "kind" : "IdRef", "name" : "'y'" } 540 | ] 541 | }, 542 | { 543 | "opname" : "half_exp", 544 | "opcode" : 69, 545 | "operands" : [ 546 | { "kind" : "IdRef", "name" : "'x'" } 547 | ] 548 | }, 549 | { 550 | "opname" : "half_exp2", 551 | "opcode" : 70, 552 | "operands" : [ 553 | { "kind" : "IdRef", "name" : "'x'" } 554 | ] 555 | }, 556 | { 557 | "opname" : "half_exp10", 558 | "opcode" : 71, 559 | "operands" : [ 560 | { "kind" : "IdRef", "name" : "'x'" } 561 | ] 562 | }, 563 | { 564 | "opname" : "half_log", 565 | "opcode" : 72, 566 | "operands" : [ 567 | { "kind" : "IdRef", "name" : "'x'" } 568 | ] 569 | }, 570 | { 571 | "opname" : "half_log2", 572 | "opcode" : 73, 573 | "operands" : [ 574 | { "kind" : "IdRef", "name" : "'x'" } 575 | ] 576 | }, 577 | { 578 | "opname" : "half_log10", 579 | "opcode" : 74, 580 | "operands" : [ 581 | { "kind" : "IdRef", "name" : "'x'" } 582 | ] 583 | }, 584 | { 585 | "opname" : "half_powr", 586 | "opcode" : 75, 587 | "operands" : [ 588 | { "kind" : "IdRef", "name" : "'x'" }, 589 | { "kind" : "IdRef", "name" : "'y'" } 590 | ] 591 | }, 592 | { 593 | "opname" : "half_recip", 594 | "opcode" : 76, 595 | "operands" : [ 596 | { "kind" : "IdRef", "name" : "'x'" } 597 | ] 598 | }, 599 | { 600 | "opname" : "half_rsqrt", 601 | "opcode" : 77, 602 | "operands" : [ 603 | { "kind" : "IdRef", "name" : "'x'" } 604 | ] 605 | }, 606 | { 607 | "opname" : "half_sin", 608 | "opcode" : 78, 609 | "operands" : [ 610 | { "kind" : "IdRef", "name" : "'x'" } 611 | ] 612 | }, 613 | { 614 | "opname" : "half_sqrt", 615 | "opcode" : 79, 616 | "operands" : [ 617 | { "kind" : "IdRef", "name" : "'x'" } 618 | ] 619 | }, 620 | { 621 | "opname" : "half_tan", 622 | "opcode" : 80, 623 | "operands" : [ 624 | { "kind" : "IdRef", "name" : "'x'" } 625 | ] 626 | }, 627 | { 628 | "opname" : "native_cos", 629 | "opcode" : 81, 630 | "operands" : [ 631 | { "kind" : "IdRef", "name" : "'x'" } 632 | ] 633 | }, 634 | { 635 | "opname" : "native_divide", 636 | "opcode" : 82, 637 | "operands" : [ 638 | { "kind" : "IdRef", "name" : "'x'" }, 639 | { "kind" : "IdRef", "name" : "'y'" } 640 | ] 641 | }, 642 | { 643 | "opname" : "native_exp", 644 | "opcode" : 83, 645 | "operands" : [ 646 | { "kind" : "IdRef", "name" : "'x'" } 647 | ] 648 | }, 649 | { 650 | "opname" : "native_exp2", 651 | "opcode" : 84, 652 | "operands" : [ 653 | { "kind" : "IdRef", "name" : "'x'" } 654 | ] 655 | }, 656 | { 657 | "opname" : "native_exp10", 658 | "opcode" : 85, 659 | "operands" : [ 660 | { "kind" : "IdRef", "name" : "'x'" } 661 | ] 662 | }, 663 | { 664 | "opname" : "native_log", 665 | "opcode" : 86, 666 | "operands" : [ 667 | { "kind" : "IdRef", "name" : "'x'" } 668 | ] 669 | }, 670 | { 671 | "opname" : "native_log2", 672 | "opcode" : 87, 673 | "operands" : [ 674 | { "kind" : "IdRef", "name" : "'x'" } 675 | ] 676 | }, 677 | { 678 | "opname" : "native_log10", 679 | "opcode" : 88, 680 | "operands" : [ 681 | { "kind" : "IdRef", "name" : "'x'" } 682 | ] 683 | }, 684 | { 685 | "opname" : "native_powr", 686 | "opcode" : 89, 687 | "operands" : [ 688 | { "kind" : "IdRef", "name" : "'x'" }, 689 | { "kind" : "IdRef", "name" : "'y'" } 690 | ] 691 | }, 692 | { 693 | "opname" : "native_recip", 694 | "opcode" : 90, 695 | "operands" : [ 696 | { "kind" : "IdRef", "name" : "'x'" } 697 | ] 698 | }, 699 | { 700 | "opname" : "native_rsqrt", 701 | "opcode" : 91, 702 | "operands" : [ 703 | { "kind" : "IdRef", "name" : "'x'" } 704 | ] 705 | }, 706 | { 707 | "opname" : "native_sin", 708 | "opcode" : 92, 709 | "operands" : [ 710 | { "kind" : "IdRef", "name" : "'x'" } 711 | ] 712 | }, 713 | { 714 | "opname" : "native_sqrt", 715 | "opcode" : 93, 716 | "operands" : [ 717 | { "kind" : "IdRef", "name" : "'x'" } 718 | ] 719 | }, 720 | { 721 | "opname" : "native_tan", 722 | "opcode" : 94, 723 | "operands" : [ 724 | { "kind" : "IdRef", "name" : "'x'" } 725 | ] 726 | }, 727 | { 728 | "opname" : "s_abs", 729 | "opcode" : 141, 730 | "operands" : [ 731 | { "kind" : "IdRef", "name" : "'x'" } 732 | ] 733 | }, 734 | { 735 | "opname" : "s_abs_diff", 736 | "opcode" : 142, 737 | "operands" : [ 738 | { "kind" : "IdRef", "name" : "'x'" }, 739 | { "kind" : "IdRef", "name" : "'y'" } 740 | ] 741 | }, 742 | { 743 | "opname" : "s_add_sat", 744 | "opcode" : 143, 745 | "operands" : [ 746 | { "kind" : "IdRef", "name" : "'x'" }, 747 | { "kind" : "IdRef", "name" : "'y'" } 748 | ] 749 | }, 750 | { 751 | "opname" : "u_add_sat", 752 | "opcode" : 144, 753 | "operands" : [ 754 | { "kind" : "IdRef", "name" : "'x'" }, 755 | { "kind" : "IdRef", "name" : "'y'" } 756 | ] 757 | }, 758 | { 759 | "opname" : "s_hadd", 760 | "opcode" : 145, 761 | "operands" : [ 762 | { "kind" : "IdRef", "name" : "'x'" }, 763 | { "kind" : "IdRef", "name" : "'y'" } 764 | ] 765 | }, 766 | { 767 | "opname" : "u_hadd", 768 | "opcode" : 146, 769 | "operands" : [ 770 | { "kind" : "IdRef", "name" : "'x'" }, 771 | { "kind" : "IdRef", "name" : "'y'" } 772 | ] 773 | }, 774 | { 775 | "opname" : "s_rhadd", 776 | "opcode" : 147, 777 | "operands" : [ 778 | { "kind" : "IdRef", "name" : "'x'" }, 779 | { "kind" : "IdRef", "name" : "'y'" } 780 | ] 781 | }, 782 | { 783 | "opname" : "u_rhadd", 784 | "opcode" : 148, 785 | "operands" : [ 786 | { "kind" : "IdRef", "name" : "'x'" }, 787 | { "kind" : "IdRef", "name" : "'y'" } 788 | ] 789 | }, 790 | { 791 | "opname" : "s_clamp", 792 | "opcode" : 149, 793 | "operands" : [ 794 | { "kind" : "IdRef", "name" : "'x'" }, 795 | { "kind" : "IdRef", "name" : "'minval'" }, 796 | { "kind" : "IdRef", "name" : "'maxval'" } 797 | ] 798 | }, 799 | { 800 | "opname" : "u_clamp", 801 | "opcode" : 150, 802 | "operands" : [ 803 | { "kind" : "IdRef", "name" : "'x'" }, 804 | { "kind" : "IdRef", "name" : "'minval'" }, 805 | { "kind" : "IdRef", "name" : "'maxval'" } 806 | ] 807 | }, 808 | { 809 | "opname" : "clz", 810 | "opcode" : 151, 811 | "operands" : [ 812 | { "kind" : "IdRef", "name" : "'x'" } 813 | ] 814 | }, 815 | { 816 | "opname" : "ctz", 817 | "opcode" : 152, 818 | "operands" : [ 819 | { "kind" : "IdRef", "name" : "'x'" } 820 | ] 821 | }, 822 | { 823 | "opname" : "s_mad_hi", 824 | "opcode" : 153, 825 | "operands" : [ 826 | { "kind" : "IdRef", "name" : "'a'" }, 827 | { "kind" : "IdRef", "name" : "'b'" }, 828 | { "kind" : "IdRef", "name" : "'c'" } 829 | ] 830 | }, 831 | { 832 | "opname" : "u_mad_sat", 833 | "opcode" : 154, 834 | "operands" : [ 835 | { "kind" : "IdRef", "name" : "'x'" }, 836 | { "kind" : "IdRef", "name" : "'y'" }, 837 | { "kind" : "IdRef", "name" : "'z'" } 838 | ] 839 | }, 840 | { 841 | "opname" : "s_mad_sat", 842 | "opcode" : 155, 843 | "operands" : [ 844 | { "kind" : "IdRef", "name" : "'x'" }, 845 | { "kind" : "IdRef", "name" : "'y'" }, 846 | { "kind" : "IdRef", "name" : "'z'" } 847 | ] 848 | }, 849 | { 850 | "opname" : "s_max", 851 | "opcode" : 156, 852 | "operands" : [ 853 | { "kind" : "IdRef", "name" : "'x'" }, 854 | { "kind" : "IdRef", "name" : "'y'" } 855 | ] 856 | }, 857 | { 858 | "opname" : "u_max", 859 | "opcode" : 157, 860 | "operands" : [ 861 | { "kind" : "IdRef", "name" : "'x'" }, 862 | { "kind" : "IdRef", "name" : "'y'" } 863 | ] 864 | }, 865 | { 866 | "opname" : "s_min", 867 | "opcode" : 158, 868 | "operands" : [ 869 | { "kind" : "IdRef", "name" : "'x'" }, 870 | { "kind" : "IdRef", "name" : "'y'" } 871 | ] 872 | }, 873 | { 874 | "opname" : "u_min", 875 | "opcode" : 159, 876 | "operands" : [ 877 | { "kind" : "IdRef", "name" : "'x'" }, 878 | { "kind" : "IdRef", "name" : "'y'" } 879 | ] 880 | }, 881 | { 882 | "opname" : "s_mul_hi", 883 | "opcode" : 160, 884 | "operands" : [ 885 | { "kind" : "IdRef", "name" : "'x'" }, 886 | { "kind" : "IdRef", "name" : "'y'" } 887 | ] 888 | }, 889 | { 890 | "opname" : "rotate", 891 | "opcode" : 161, 892 | "operands" : [ 893 | { "kind" : "IdRef", "name" : "'v'" }, 894 | { "kind" : "IdRef", "name" : "'i'" } 895 | ] 896 | }, 897 | { 898 | "opname" : "s_sub_sat", 899 | "opcode" : 162, 900 | "operands" : [ 901 | { "kind" : "IdRef", "name" : "'x'" }, 902 | { "kind" : "IdRef", "name" : "'y'" } 903 | ] 904 | }, 905 | { 906 | "opname" : "u_sub_sat", 907 | "opcode" : 163, 908 | "operands" : [ 909 | { "kind" : "IdRef", "name" : "'x'" }, 910 | { "kind" : "IdRef", "name" : "'y'" } 911 | ] 912 | }, 913 | { 914 | "opname" : "u_upsample", 915 | "opcode" : 164, 916 | "operands" : [ 917 | { "kind" : "IdRef", "name" : "'hi'" }, 918 | { "kind" : "IdRef", "name" : "'lo'" } 919 | ] 920 | }, 921 | { 922 | "opname" : "s_upsample", 923 | "opcode" : 165, 924 | "operands" : [ 925 | { "kind" : "IdRef", "name" : "'hi'" }, 926 | { "kind" : "IdRef", "name" : "'lo'" } 927 | ] 928 | }, 929 | { 930 | "opname" : "popcount", 931 | "opcode" : 166, 932 | "operands" : [ 933 | { "kind" : "IdRef", "name" : "'x'" } 934 | ] 935 | }, 936 | { 937 | "opname" : "s_mad24", 938 | "opcode" : 167, 939 | "operands" : [ 940 | { "kind" : "IdRef", "name" : "'x'" }, 941 | { "kind" : "IdRef", "name" : "'y'" }, 942 | { "kind" : "IdRef", "name" : "'z'" } 943 | ] 944 | }, 945 | { 946 | "opname" : "u_mad24", 947 | "opcode" : 168, 948 | "operands" : [ 949 | { "kind" : "IdRef", "name" : "'x'" }, 950 | { "kind" : "IdRef", "name" : "'y'" }, 951 | { "kind" : "IdRef", "name" : "'z'" } 952 | ] 953 | }, 954 | { 955 | "opname" : "s_mul24", 956 | "opcode" : 169, 957 | "operands" : [ 958 | { "kind" : "IdRef", "name" : "'x'" }, 959 | { "kind" : "IdRef", "name" : "'y'" } 960 | ] 961 | }, 962 | { 963 | "opname" : "u_mul24", 964 | "opcode" : 170, 965 | "operands" : [ 966 | { "kind" : "IdRef", "name" : "'x'" }, 967 | { "kind" : "IdRef", "name" : "'y'" } 968 | ] 969 | }, 970 | { 971 | "opname" : "u_abs", 972 | "opcode" : 201, 973 | "operands" : [ 974 | { "kind" : "IdRef", "name" : "'x'" } 975 | ] 976 | }, 977 | { 978 | "opname" : "u_abs_diff", 979 | "opcode" : 202, 980 | "operands" : [ 981 | { "kind" : "IdRef", "name" : "'x'" }, 982 | { "kind" : "IdRef", "name" : "'y'" } 983 | ] 984 | }, 985 | { 986 | "opname" : "u_mul_hi", 987 | "opcode" : 203, 988 | "operands" : [ 989 | { "kind" : "IdRef", "name" : "'x'" }, 990 | { "kind" : "IdRef", "name" : "'y'" } 991 | ] 992 | }, 993 | { 994 | "opname" : "u_mad_hi", 995 | "opcode" : 204, 996 | "operands" : [ 997 | { "kind" : "IdRef", "name" : "'a'" }, 998 | { "kind" : "IdRef", "name" : "'b'" }, 999 | { "kind" : "IdRef", "name" : "'c'" } 1000 | ] 1001 | }, 1002 | { 1003 | "opname" : "fclamp", 1004 | "opcode" : 95, 1005 | "operands" : [ 1006 | { "kind" : "IdRef", "name" : "'x'" }, 1007 | { "kind" : "IdRef", "name" : "'minval'" }, 1008 | { "kind" : "IdRef", "name" : "'maxval'" } 1009 | ] 1010 | }, 1011 | { 1012 | "opname" : "degrees", 1013 | "opcode" :96, 1014 | "operands" : [ 1015 | { "kind" : "IdRef", "name" : "'radians'" } 1016 | ] 1017 | }, 1018 | { 1019 | "opname" : "fmax_common", 1020 | "opcode" : 97, 1021 | "operands" : [ 1022 | { "kind" : "IdRef", "name" : "'x'" }, 1023 | { "kind" : "IdRef", "name" : "'y'" } 1024 | ] 1025 | }, 1026 | { 1027 | "opname" : "fmin_common", 1028 | "opcode" : 98, 1029 | "operands" : [ 1030 | { "kind" : "IdRef", "name" : "'x'" }, 1031 | { "kind" : "IdRef", "name" : "'y'" } 1032 | ] 1033 | }, 1034 | { 1035 | "opname" : "mix", 1036 | "opcode" : 99, 1037 | "operands" : [ 1038 | { "kind" : "IdRef", "name" : "'x'" }, 1039 | { "kind" : "IdRef", "name" : "'y'" }, 1040 | { "kind" : "IdRef", "name" : "'a'" } 1041 | ] 1042 | }, 1043 | { 1044 | "opname" : "radians", 1045 | "opcode" : 100, 1046 | "operands" : [ 1047 | { "kind" : "IdRef", "name" : "'degrees'" } 1048 | ] 1049 | }, 1050 | { 1051 | "opname" : "step", 1052 | "opcode" : 101, 1053 | "operands" : [ 1054 | { "kind" : "IdRef", "name" : "'edge'" }, 1055 | { "kind" : "IdRef", "name" : "'x'" } 1056 | ] 1057 | }, 1058 | { 1059 | "opname" : "smoothstep", 1060 | "opcode" : 102, 1061 | "operands" : [ 1062 | { "kind" : "IdRef", "name" : "'edge0'" }, 1063 | { "kind" : "IdRef", "name" : "'edge1'" }, 1064 | { "kind" : "IdRef", "name" : "'x'" } 1065 | ] 1066 | }, 1067 | { 1068 | "opname" : "sign", 1069 | "opcode" : 103, 1070 | "operands" : [ 1071 | { "kind" : "IdRef", "name" : "'x'" } 1072 | ] 1073 | }, 1074 | { 1075 | "opname" : "cross", 1076 | "opcode" : 104, 1077 | "operands" : [ 1078 | { "kind" : "IdRef", "name" : "'p0'" }, 1079 | { "kind" : "IdRef", "name" : "'p1'" } 1080 | ] 1081 | }, 1082 | { 1083 | "opname" : "distance", 1084 | "opcode" : 105, 1085 | "operands" : [ 1086 | { "kind" : "IdRef", "name" : "'p0'" }, 1087 | { "kind" : "IdRef", "name" : "'p1'" } 1088 | ] 1089 | }, 1090 | { 1091 | "opname" : "length", 1092 | "opcode" : 106, 1093 | "operands" : [ 1094 | { "kind" : "IdRef", "name" : "'p'" } 1095 | ] 1096 | }, 1097 | { 1098 | "opname" : "normalize", 1099 | "opcode" : 107, 1100 | "operands" : [ 1101 | { "kind" : "IdRef", "name" : "'p'" } 1102 | ] 1103 | }, 1104 | { 1105 | "opname" : "fast_distance", 1106 | "opcode" : 108, 1107 | "operands" : [ 1108 | { "kind" : "IdRef", "name" : "'p0'" }, 1109 | { "kind" : "IdRef", "name" : "'p1'" } 1110 | ] 1111 | }, 1112 | { 1113 | "opname" : "fast_length", 1114 | "opcode" : 109, 1115 | "operands" : [ 1116 | { "kind" : "IdRef", "name" : "'p'" } 1117 | ] 1118 | }, 1119 | { 1120 | "opname" : "fast_normalize", 1121 | "opcode" : 110, 1122 | "operands" : [ 1123 | { "kind" : "IdRef", "name" : "'p'" } 1124 | ] 1125 | }, 1126 | { 1127 | "opname" : "bitselect", 1128 | "opcode" : 186, 1129 | "operands" : [ 1130 | { "kind" : "IdRef", "name" : "'a'" }, 1131 | { "kind" : "IdRef", "name" : "'b'" }, 1132 | { "kind" : "IdRef", "name" : "'c'" } 1133 | ] 1134 | }, 1135 | { 1136 | "opname" : "select", 1137 | "opcode" : 187, 1138 | "operands" : [ 1139 | { "kind" : "IdRef", "name" : "'a'" }, 1140 | { "kind" : "IdRef", "name" : "'b'" }, 1141 | { "kind" : "IdRef", "name" : "'c'" } 1142 | ] 1143 | }, 1144 | { 1145 | "opname" : "vloadn", 1146 | "opcode" : 171, 1147 | "operands" : [ 1148 | { "kind" : "IdRef", "name" : "'offset'" }, 1149 | { "kind" : "IdRef", "name" : "'p'" }, 1150 | { "kind" : "LiteralInteger", "name" : "'n'" } 1151 | ] 1152 | }, 1153 | { 1154 | "opname" : "vstoren", 1155 | "opcode" : 172, 1156 | "operands" : [ 1157 | { "kind" : "IdRef", "name" : "'data'" }, 1158 | { "kind" : "IdRef", "name" : "'offset'" }, 1159 | { "kind" : "IdRef", "name" : "'p'" } 1160 | ] 1161 | }, 1162 | { 1163 | "opname" : "vload_half", 1164 | "opcode" : 173, 1165 | "operands" : [ 1166 | { "kind" : "IdRef", "name" : "'offset'" }, 1167 | { "kind" : "IdRef", "name" : "'p'" } 1168 | ] 1169 | }, 1170 | { 1171 | "opname" : "vload_halfn", 1172 | "opcode" : 174, 1173 | "operands" : [ 1174 | { "kind" : "IdRef", "name" : "'offset'" }, 1175 | { "kind" : "IdRef", "name" : "'p'" }, 1176 | { "kind" : "LiteralInteger", "name" : "'n'" } 1177 | ] 1178 | }, 1179 | { 1180 | "opname" : "vstore_half", 1181 | "opcode" : 175, 1182 | "operands" : [ 1183 | { "kind" : "IdRef", "name" : "'data'" }, 1184 | { "kind" : "IdRef", "name" : "'offset'" }, 1185 | { "kind" : "IdRef", "name" : "'p'" } 1186 | ] 1187 | }, 1188 | { 1189 | "opname" : "vstore_half_r", 1190 | "opcode" : 176, 1191 | "operands" : [ 1192 | { "kind" : "IdRef", "name" : "'data'" }, 1193 | { "kind" : "IdRef", "name" : "'offset'" }, 1194 | { "kind" : "IdRef", "name" : "'p'" }, 1195 | { "kind" : "FPRoundingMode", "name" : "'mode'" } 1196 | ] 1197 | }, 1198 | { 1199 | "opname" : "vstore_halfn", 1200 | "opcode" : 177, 1201 | "operands" : [ 1202 | { "kind" : "IdRef", "name" : "'data'" }, 1203 | { "kind" : "IdRef", "name" : "'offset'" }, 1204 | { "kind" : "IdRef", "name" : "'p'" } 1205 | ] 1206 | }, 1207 | { 1208 | "opname" : "vstore_halfn_r", 1209 | "opcode" : 178, 1210 | "operands" : [ 1211 | { "kind" : "IdRef", "name" : "'data'" }, 1212 | { "kind" : "IdRef", "name" : "'offset'" }, 1213 | { "kind" : "IdRef", "name" : "'p'" }, 1214 | { "kind" : "FPRoundingMode", "name" : "'mode'" } 1215 | ] 1216 | }, 1217 | { 1218 | "opname" : "vloada_halfn", 1219 | "opcode" : 179, 1220 | "operands" : [ 1221 | { "kind" : "IdRef", "name" : "'offset'" }, 1222 | { "kind" : "IdRef", "name" : "'p'" }, 1223 | { "kind" : "LiteralInteger", "name" : "'n'" } 1224 | ] 1225 | }, 1226 | { 1227 | "opname" : "vstorea_halfn", 1228 | "opcode" : 180, 1229 | "operands" : [ 1230 | { "kind" : "IdRef", "name" : "'data'" }, 1231 | { "kind" : "IdRef", "name" : "'offset'" }, 1232 | { "kind" : "IdRef", "name" : "'p'" } 1233 | ] 1234 | }, 1235 | { 1236 | "opname" : "vstorea_halfn_r", 1237 | "opcode" : 181, 1238 | "operands" : [ 1239 | { "kind" : "IdRef", "name" : "'data'" }, 1240 | { "kind" : "IdRef", "name" : "'offset'" }, 1241 | { "kind" : "IdRef", "name" : "'p'" }, 1242 | { "kind" : "FPRoundingMode", "name" : "'mode'" } 1243 | ] 1244 | }, 1245 | { 1246 | "opname" : "shuffle", 1247 | "opcode" : 182, 1248 | "operands" : [ 1249 | { "kind" : "IdRef", "name" : "'x'" }, 1250 | { "kind" : "IdRef", "name" : "'shuffle mask'" } 1251 | ] 1252 | }, 1253 | { 1254 | "opname" : "shuffle2", 1255 | "opcode" : 183, 1256 | "operands" : [ 1257 | { "kind" : "IdRef", "name" : "'x'" }, 1258 | { "kind" : "IdRef", "name" : "'y'" }, 1259 | { "kind" : "IdRef", "name" : "'shuffle mask'" } 1260 | ] 1261 | }, 1262 | { 1263 | "opname" : "printf", 1264 | "opcode" : 184, 1265 | "operands" : [ 1266 | { "kind" : "IdRef", "name" : "'format'" }, 1267 | { "kind" : "IdRef", "name" : "'additional arguments'", "quantifier" : "*" } 1268 | ] 1269 | }, 1270 | { 1271 | "opname" : "prefetch", 1272 | "opcode" : 185, 1273 | "operands" : [ 1274 | { "kind" : "IdRef", "name" : "'ptr'" }, 1275 | { "kind" : "IdRef", "name" : "'num elements'" } 1276 | ] 1277 | } 1278 | ] 1279 | } 1280 | -------------------------------------------------------------------------------- /spirv-gen/spir-v.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 25 | 31 | 32 | 33 | 34 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /spirv-gen/spirv.json: -------------------------------------------------------------------------------- 1 | { 2 | "spv": 3 | { 4 | "meta": 5 | { 6 | "Comment": 7 | [ 8 | [ 9 | "Copyright (c) 2014-2017 The Khronos Group Inc.", 10 | "", 11 | "Permission is hereby granted, free of charge, to any person obtaining a copy", 12 | "of this software and/or associated documentation files (the \"Materials\"),", 13 | "to deal in the Materials without restriction, including without limitation", 14 | "the rights to use, copy, modify, merge, publish, distribute, sublicense,", 15 | "and/or sell copies of the Materials, and to permit persons to whom the", 16 | "Materials are furnished to do so, subject to the following conditions:", 17 | "", 18 | "The above copyright notice and this permission notice shall be included in", 19 | "all copies or substantial portions of the Materials.", 20 | "", 21 | "MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS", 22 | "STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND", 23 | "HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ ", 24 | "", 25 | "THE MATERIALS ARE PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS", 26 | "OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,", 27 | "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL", 28 | "THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER", 29 | "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING", 30 | "FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS", 31 | "IN THE MATERIALS." 32 | ], 33 | [ 34 | "This header is automatically generated by the same tool that creates", 35 | "the Binary Section of the SPIR-V specification." 36 | ], 37 | [ 38 | "Enumeration tokens for SPIR-V, in various styles:", 39 | " C, C++, C++11, JSON, Lua, Python", 40 | "", 41 | "- C will have tokens with a \"Spv\" prefix, e.g.: SpvSourceLanguageGLSL", 42 | "- C++ will have tokens in the \"spv\" name space, e.g.: spv::SourceLanguageGLSL", 43 | "- C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL", 44 | "- Lua will use tables, e.g.: spv.SourceLanguage.GLSL", 45 | "- Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL']", 46 | "", 47 | "Some tokens act like mask values, which can be OR'd together,", 48 | "while others are mutually exclusive. The mask-like ones have", 49 | "\"Mask\" in their name, and a parallel enum that has the shift", 50 | "amount (1 << x) for each corresponding enumerant." 51 | ] 52 | ], 53 | "MagicNumber": 119734787, 54 | "Version": 66048, 55 | "Revision": 2, 56 | "OpCodeMask": 65535, 57 | "WordCountShift": 16 58 | }, 59 | "enum": 60 | [ 61 | { 62 | "Name": "SourceLanguage", 63 | "Type": "Value", 64 | "Values": 65 | { 66 | "Unknown": 0, 67 | "ESSL": 1, 68 | "GLSL": 2, 69 | "OpenCL_C": 3, 70 | "OpenCL_CPP": 4, 71 | "HLSL": 5 72 | } 73 | }, 74 | { 75 | "Name": "ExecutionModel", 76 | "Type": "Value", 77 | "Values": 78 | { 79 | "Vertex": 0, 80 | "TessellationControl": 1, 81 | "TessellationEvaluation": 2, 82 | "Geometry": 3, 83 | "Fragment": 4, 84 | "GLCompute": 5, 85 | "Kernel": 6 86 | } 87 | }, 88 | { 89 | "Name": "AddressingModel", 90 | "Type": "Value", 91 | "Values": 92 | { 93 | "Logical": 0, 94 | "Physical32": 1, 95 | "Physical64": 2 96 | } 97 | }, 98 | { 99 | "Name": "MemoryModel", 100 | "Type": "Value", 101 | "Values": 102 | { 103 | "Simple": 0, 104 | "GLSL450": 1, 105 | "OpenCL": 2 106 | } 107 | }, 108 | { 109 | "Name": "ExecutionMode", 110 | "Type": "Value", 111 | "Values": 112 | { 113 | "Invocations": 0, 114 | "SpacingEqual": 1, 115 | "SpacingFractionalEven": 2, 116 | "SpacingFractionalOdd": 3, 117 | "VertexOrderCw": 4, 118 | "VertexOrderCcw": 5, 119 | "PixelCenterInteger": 6, 120 | "OriginUpperLeft": 7, 121 | "OriginLowerLeft": 8, 122 | "EarlyFragmentTests": 9, 123 | "PointMode": 10, 124 | "Xfb": 11, 125 | "DepthReplacing": 12, 126 | "DepthGreater": 14, 127 | "DepthLess": 15, 128 | "DepthUnchanged": 16, 129 | "LocalSize": 17, 130 | "LocalSizeHint": 18, 131 | "InputPoints": 19, 132 | "InputLines": 20, 133 | "InputLinesAdjacency": 21, 134 | "Triangles": 22, 135 | "InputTrianglesAdjacency": 23, 136 | "Quads": 24, 137 | "Isolines": 25, 138 | "OutputVertices": 26, 139 | "OutputPoints": 27, 140 | "OutputLineStrip": 28, 141 | "OutputTriangleStrip": 29, 142 | "VecTypeHint": 30, 143 | "ContractionOff": 31, 144 | "Initializer": 33, 145 | "Finalizer": 34, 146 | "SubgroupSize": 35, 147 | "SubgroupsPerWorkgroup": 36, 148 | "SubgroupsPerWorkgroupId": 37, 149 | "LocalSizeId": 38, 150 | "LocalSizeHintId": 39, 151 | "PostDepthCoverage": 4446, 152 | "StencilRefReplacingEXT": 5027 153 | } 154 | }, 155 | { 156 | "Name": "StorageClass", 157 | "Type": "Value", 158 | "Values": 159 | { 160 | "UniformConstant": 0, 161 | "Input": 1, 162 | "Uniform": 2, 163 | "Output": 3, 164 | "Workgroup": 4, 165 | "CrossWorkgroup": 5, 166 | "Private": 6, 167 | "Function": 7, 168 | "Generic": 8, 169 | "PushConstant": 9, 170 | "AtomicCounter": 10, 171 | "Image": 11, 172 | "StorageBuffer": 12 173 | } 174 | }, 175 | { 176 | "Name": "Dim", 177 | "Type": "Value", 178 | "Values": 179 | { 180 | "Dim1D": 0, 181 | "Dim2D": 1, 182 | "Dim3D": 2, 183 | "Cube": 3, 184 | "Rect": 4, 185 | "Buffer": 5, 186 | "SubpassData": 6 187 | } 188 | }, 189 | { 190 | "Name": "SamplerAddressingMode", 191 | "Type": "Value", 192 | "Values": 193 | { 194 | "None": 0, 195 | "ClampToEdge": 1, 196 | "Clamp": 2, 197 | "Repeat": 3, 198 | "RepeatMirrored": 4 199 | } 200 | }, 201 | { 202 | "Name": "SamplerFilterMode", 203 | "Type": "Value", 204 | "Values": 205 | { 206 | "Nearest": 0, 207 | "Linear": 1 208 | } 209 | }, 210 | { 211 | "Name": "ImageFormat", 212 | "Type": "Value", 213 | "Values": 214 | { 215 | "Unknown": 0, 216 | "Rgba32f": 1, 217 | "Rgba16f": 2, 218 | "R32f": 3, 219 | "Rgba8": 4, 220 | "Rgba8Snorm": 5, 221 | "Rg32f": 6, 222 | "Rg16f": 7, 223 | "R11fG11fB10f": 8, 224 | "R16f": 9, 225 | "Rgba16": 10, 226 | "Rgb10A2": 11, 227 | "Rg16": 12, 228 | "Rg8": 13, 229 | "R16": 14, 230 | "R8": 15, 231 | "Rgba16Snorm": 16, 232 | "Rg16Snorm": 17, 233 | "Rg8Snorm": 18, 234 | "R16Snorm": 19, 235 | "R8Snorm": 20, 236 | "Rgba32i": 21, 237 | "Rgba16i": 22, 238 | "Rgba8i": 23, 239 | "R32i": 24, 240 | "Rg32i": 25, 241 | "Rg16i": 26, 242 | "Rg8i": 27, 243 | "R16i": 28, 244 | "R8i": 29, 245 | "Rgba32ui": 30, 246 | "Rgba16ui": 31, 247 | "Rgba8ui": 32, 248 | "R32ui": 33, 249 | "Rgb10a2ui": 34, 250 | "Rg32ui": 35, 251 | "Rg16ui": 36, 252 | "Rg8ui": 37, 253 | "R16ui": 38, 254 | "R8ui": 39 255 | } 256 | }, 257 | { 258 | "Name": "ImageChannelOrder", 259 | "Type": "Value", 260 | "Values": 261 | { 262 | "R": 0, 263 | "A": 1, 264 | "RG": 2, 265 | "RA": 3, 266 | "RGB": 4, 267 | "RGBA": 5, 268 | "BGRA": 6, 269 | "ARGB": 7, 270 | "Intensity": 8, 271 | "Luminance": 9, 272 | "Rx": 10, 273 | "RGx": 11, 274 | "RGBx": 12, 275 | "Depth": 13, 276 | "DepthStencil": 14, 277 | "sRGB": 15, 278 | "sRGBx": 16, 279 | "sRGBA": 17, 280 | "sBGRA": 18, 281 | "ABGR": 19 282 | } 283 | }, 284 | { 285 | "Name": "ImageChannelDataType", 286 | "Type": "Value", 287 | "Values": 288 | { 289 | "SnormInt8": 0, 290 | "SnormInt16": 1, 291 | "UnormInt8": 2, 292 | "UnormInt16": 3, 293 | "UnormShort565": 4, 294 | "UnormShort555": 5, 295 | "UnormInt101010": 6, 296 | "SignedInt8": 7, 297 | "SignedInt16": 8, 298 | "SignedInt32": 9, 299 | "UnsignedInt8": 10, 300 | "UnsignedInt16": 11, 301 | "UnsignedInt32": 12, 302 | "HalfFloat": 13, 303 | "Float": 14, 304 | "UnormInt24": 15, 305 | "UnormInt101010_2": 16 306 | } 307 | }, 308 | { 309 | "Name": "ImageOperands", 310 | "Type": "Bit", 311 | "Values": 312 | { 313 | "Bias": 0, 314 | "Lod": 1, 315 | "Grad": 2, 316 | "ConstOffset": 3, 317 | "Offset": 4, 318 | "ConstOffsets": 5, 319 | "Sample": 6, 320 | "MinLod": 7 321 | } 322 | }, 323 | { 324 | "Name": "FPFastMathMode", 325 | "Type": "Bit", 326 | "Values": 327 | { 328 | "NotNaN": 0, 329 | "NotInf": 1, 330 | "NSZ": 2, 331 | "AllowRecip": 3, 332 | "Fast": 4 333 | } 334 | }, 335 | { 336 | "Name": "FPRoundingMode", 337 | "Type": "Value", 338 | "Values": 339 | { 340 | "RTE": 0, 341 | "RTZ": 1, 342 | "RTP": 2, 343 | "RTN": 3 344 | } 345 | }, 346 | { 347 | "Name": "LinkageType", 348 | "Type": "Value", 349 | "Values": 350 | { 351 | "Export": 0, 352 | "Import": 1 353 | } 354 | }, 355 | { 356 | "Name": "AccessQualifier", 357 | "Type": "Value", 358 | "Values": 359 | { 360 | "ReadOnly": 0, 361 | "WriteOnly": 1, 362 | "ReadWrite": 2 363 | } 364 | }, 365 | { 366 | "Name": "FunctionParameterAttribute", 367 | "Type": "Value", 368 | "Values": 369 | { 370 | "Zext": 0, 371 | "Sext": 1, 372 | "ByVal": 2, 373 | "Sret": 3, 374 | "NoAlias": 4, 375 | "NoCapture": 5, 376 | "NoWrite": 6, 377 | "NoReadWrite": 7 378 | } 379 | }, 380 | { 381 | "Name": "Decoration", 382 | "Type": "Value", 383 | "Values": 384 | { 385 | "RelaxedPrecision": 0, 386 | "SpecId": 1, 387 | "Block": 2, 388 | "BufferBlock": 3, 389 | "RowMajor": 4, 390 | "ColMajor": 5, 391 | "ArrayStride": 6, 392 | "MatrixStride": 7, 393 | "GLSLShared": 8, 394 | "GLSLPacked": 9, 395 | "CPacked": 10, 396 | "BuiltIn": 11, 397 | "NoPerspective": 13, 398 | "Flat": 14, 399 | "Patch": 15, 400 | "Centroid": 16, 401 | "Sample": 17, 402 | "Invariant": 18, 403 | "Restrict": 19, 404 | "Aliased": 20, 405 | "Volatile": 21, 406 | "Constant": 22, 407 | "Coherent": 23, 408 | "NonWritable": 24, 409 | "NonReadable": 25, 410 | "Uniform": 26, 411 | "SaturatedConversion": 28, 412 | "Stream": 29, 413 | "Location": 30, 414 | "Component": 31, 415 | "Index": 32, 416 | "Binding": 33, 417 | "DescriptorSet": 34, 418 | "Offset": 35, 419 | "XfbBuffer": 36, 420 | "XfbStride": 37, 421 | "FuncParamAttr": 38, 422 | "FPRoundingMode": 39, 423 | "FPFastMathMode": 40, 424 | "LinkageAttributes": 41, 425 | "NoContraction": 42, 426 | "InputAttachmentIndex": 43, 427 | "Alignment": 44, 428 | "MaxByteOffset": 45, 429 | "AlignmentId": 46, 430 | "MaxByteOffsetId": 47, 431 | "ExplicitInterpAMD": 4999, 432 | "OverrideCoverageNV": 5248, 433 | "PassthroughNV": 5250, 434 | "ViewportRelativeNV": 5252, 435 | "SecondaryViewportRelativeNV": 5256 436 | } 437 | }, 438 | { 439 | "Name": "BuiltIn", 440 | "Type": "Value", 441 | "Values": 442 | { 443 | "Position": 0, 444 | "PointSize": 1, 445 | "ClipDistance": 3, 446 | "CullDistance": 4, 447 | "VertexId": 5, 448 | "InstanceId": 6, 449 | "PrimitiveId": 7, 450 | "InvocationId": 8, 451 | "Layer": 9, 452 | "ViewportIndex": 10, 453 | "TessLevelOuter": 11, 454 | "TessLevelInner": 12, 455 | "TessCoord": 13, 456 | "PatchVertices": 14, 457 | "FragCoord": 15, 458 | "PointCoord": 16, 459 | "FrontFacing": 17, 460 | "SampleId": 18, 461 | "SamplePosition": 19, 462 | "SampleMask": 20, 463 | "FragDepth": 22, 464 | "HelperInvocation": 23, 465 | "NumWorkgroups": 24, 466 | "WorkgroupSize": 25, 467 | "WorkgroupId": 26, 468 | "LocalInvocationId": 27, 469 | "GlobalInvocationId": 28, 470 | "LocalInvocationIndex": 29, 471 | "WorkDim": 30, 472 | "GlobalSize": 31, 473 | "EnqueuedWorkgroupSize": 32, 474 | "GlobalOffset": 33, 475 | "GlobalLinearId": 34, 476 | "SubgroupSize": 36, 477 | "SubgroupMaxSize": 37, 478 | "NumSubgroups": 38, 479 | "NumEnqueuedSubgroups": 39, 480 | "SubgroupId": 40, 481 | "SubgroupLocalInvocationId": 41, 482 | "VertexIndex": 42, 483 | "InstanceIndex": 43, 484 | "SubgroupEqMaskKHR": 4416, 485 | "SubgroupGeMaskKHR": 4417, 486 | "SubgroupGtMaskKHR": 4418, 487 | "SubgroupLeMaskKHR": 4419, 488 | "SubgroupLtMaskKHR": 4420, 489 | "BaseVertex": 4424, 490 | "BaseInstance": 4425, 491 | "DrawIndex": 4426, 492 | "DeviceIndex": 4438, 493 | "ViewIndex": 4440, 494 | "BaryCoordNoPerspAMD": 4992, 495 | "BaryCoordNoPerspCentroidAMD": 4993, 496 | "BaryCoordNoPerspSampleAMD": 4994, 497 | "BaryCoordSmoothAMD": 4995, 498 | "BaryCoordSmoothCentroidAMD": 4996, 499 | "BaryCoordSmoothSampleAMD": 4997, 500 | "BaryCoordPullModelAMD": 4998, 501 | "FragStencilRefEXT": 5014, 502 | "ViewportMaskNV": 5253, 503 | "SecondaryPositionNV": 5257, 504 | "SecondaryViewportMaskNV": 5258, 505 | "PositionPerViewNV": 5261, 506 | "ViewportMaskPerViewNV": 5262 507 | } 508 | }, 509 | { 510 | "Name": "SelectionControl", 511 | "Type": "Bit", 512 | "Values": 513 | { 514 | "Flatten": 0, 515 | "DontFlatten": 1 516 | } 517 | }, 518 | { 519 | "Name": "LoopControl", 520 | "Type": "Bit", 521 | "Values": 522 | { 523 | "Unroll": 0, 524 | "DontUnroll": 1, 525 | "DependencyInfinite": 2, 526 | "DependencyLength": 3 527 | } 528 | }, 529 | { 530 | "Name": "FunctionControl", 531 | "Type": "Bit", 532 | "Values": 533 | { 534 | "Inline": 0, 535 | "DontInline": 1, 536 | "Pure": 2, 537 | "Const": 3 538 | } 539 | }, 540 | { 541 | "Name": "MemorySemantics", 542 | "Type": "Bit", 543 | "Values": 544 | { 545 | "Acquire": 1, 546 | "Release": 2, 547 | "AcquireRelease": 3, 548 | "SequentiallyConsistent": 4, 549 | "UniformMemory": 6, 550 | "SubgroupMemory": 7, 551 | "WorkgroupMemory": 8, 552 | "CrossWorkgroupMemory": 9, 553 | "AtomicCounterMemory": 10, 554 | "ImageMemory": 11 555 | } 556 | }, 557 | { 558 | "Name": "MemoryAccess", 559 | "Type": "Bit", 560 | "Values": 561 | { 562 | "Volatile": 0, 563 | "Aligned": 1, 564 | "Nontemporal": 2 565 | } 566 | }, 567 | { 568 | "Name": "Scope", 569 | "Type": "Value", 570 | "Values": 571 | { 572 | "CrossDevice": 0, 573 | "Device": 1, 574 | "Workgroup": 2, 575 | "Subgroup": 3, 576 | "Invocation": 4 577 | } 578 | }, 579 | { 580 | "Name": "GroupOperation", 581 | "Type": "Value", 582 | "Values": 583 | { 584 | "Reduce": 0, 585 | "InclusiveScan": 1, 586 | "ExclusiveScan": 2 587 | } 588 | }, 589 | { 590 | "Name": "KernelEnqueueFlags", 591 | "Type": "Value", 592 | "Values": 593 | { 594 | "NoWait": 0, 595 | "WaitKernel": 1, 596 | "WaitWorkGroup": 2 597 | } 598 | }, 599 | { 600 | "Name": "KernelProfilingInfo", 601 | "Type": "Bit", 602 | "Values": 603 | { 604 | "CmdExecTime": 0 605 | } 606 | }, 607 | { 608 | "Name": "Capability", 609 | "Type": "Value", 610 | "Values": 611 | { 612 | "Matrix": 0, 613 | "Shader": 1, 614 | "Geometry": 2, 615 | "Tessellation": 3, 616 | "Addresses": 4, 617 | "Linkage": 5, 618 | "Kernel": 6, 619 | "Vector16": 7, 620 | "Float16Buffer": 8, 621 | "Float16": 9, 622 | "Float64": 10, 623 | "Int64": 11, 624 | "Int64Atomics": 12, 625 | "ImageBasic": 13, 626 | "ImageReadWrite": 14, 627 | "ImageMipmap": 15, 628 | "Pipes": 17, 629 | "Groups": 18, 630 | "DeviceEnqueue": 19, 631 | "LiteralSampler": 20, 632 | "AtomicStorage": 21, 633 | "Int16": 22, 634 | "TessellationPointSize": 23, 635 | "GeometryPointSize": 24, 636 | "ImageGatherExtended": 25, 637 | "StorageImageMultisample": 27, 638 | "UniformBufferArrayDynamicIndexing": 28, 639 | "SampledImageArrayDynamicIndexing": 29, 640 | "StorageBufferArrayDynamicIndexing": 30, 641 | "StorageImageArrayDynamicIndexing": 31, 642 | "ClipDistance": 32, 643 | "CullDistance": 33, 644 | "ImageCubeArray": 34, 645 | "SampleRateShading": 35, 646 | "ImageRect": 36, 647 | "SampledRect": 37, 648 | "GenericPointer": 38, 649 | "Int8": 39, 650 | "InputAttachment": 40, 651 | "SparseResidency": 41, 652 | "MinLod": 42, 653 | "Sampled1D": 43, 654 | "Image1D": 44, 655 | "SampledCubeArray": 45, 656 | "SampledBuffer": 46, 657 | "ImageBuffer": 47, 658 | "ImageMSArray": 48, 659 | "StorageImageExtendedFormats": 49, 660 | "ImageQuery": 50, 661 | "DerivativeControl": 51, 662 | "InterpolationFunction": 52, 663 | "TransformFeedback": 53, 664 | "GeometryStreams": 54, 665 | "StorageImageReadWithoutFormat": 55, 666 | "StorageImageWriteWithoutFormat": 56, 667 | "MultiViewport": 57, 668 | "SubgroupDispatch": 58, 669 | "NamedBarrier": 59, 670 | "PipeStorage": 60, 671 | "SubgroupBallotKHR": 4423, 672 | "DrawParameters": 4427, 673 | "SubgroupVoteKHR": 4431, 674 | "StorageBuffer16BitAccess": 4433, 675 | "StorageUniformBufferBlock16": 4433, 676 | "StorageUniform16": 4434, 677 | "UniformAndStorageBuffer16BitAccess": 4434, 678 | "StoragePushConstant16": 4435, 679 | "StorageInputOutput16": 4436, 680 | "DeviceGroup": 4437, 681 | "MultiView": 4439, 682 | "VariablePointersStorageBuffer": 4441, 683 | "VariablePointers": 4442, 684 | "AtomicStorageOps": 4445, 685 | "SampleMaskPostDepthCoverage": 4447, 686 | "ImageGatherBiasLodAMD": 5009, 687 | "FragmentMaskAMD": 5010, 688 | "StencilExportEXT": 5013, 689 | "ImageReadWriteLodAMD": 5015, 690 | "SampleMaskOverrideCoverageNV": 5249, 691 | "GeometryShaderPassthroughNV": 5251, 692 | "ShaderViewportIndexLayerEXT": 5254, 693 | "ShaderViewportIndexLayerNV": 5254, 694 | "ShaderViewportMaskNV": 5255, 695 | "ShaderStereoViewNV": 5259, 696 | "PerViewAttributesNV": 5260, 697 | "SubgroupShuffleINTEL": 5568, 698 | "SubgroupBufferBlockIOINTEL": 5569, 699 | "SubgroupImageBlockIOINTEL": 5570 700 | } 701 | }, 702 | { 703 | "Name": "Op", 704 | "Type": "Value", 705 | "Values": 706 | { 707 | "OpNop": 0, 708 | "OpUndef": 1, 709 | "OpSourceContinued": 2, 710 | "OpSource": 3, 711 | "OpSourceExtension": 4, 712 | "OpName": 5, 713 | "OpMemberName": 6, 714 | "OpString": 7, 715 | "OpLine": 8, 716 | "OpExtension": 10, 717 | "OpExtInstImport": 11, 718 | "OpExtInst": 12, 719 | "OpMemoryModel": 14, 720 | "OpEntryPoint": 15, 721 | "OpExecutionMode": 16, 722 | "OpCapability": 17, 723 | "OpTypeVoid": 19, 724 | "OpTypeBool": 20, 725 | "OpTypeInt": 21, 726 | "OpTypeFloat": 22, 727 | "OpTypeVector": 23, 728 | "OpTypeMatrix": 24, 729 | "OpTypeImage": 25, 730 | "OpTypeSampler": 26, 731 | "OpTypeSampledImage": 27, 732 | "OpTypeArray": 28, 733 | "OpTypeRuntimeArray": 29, 734 | "OpTypeStruct": 30, 735 | "OpTypeOpaque": 31, 736 | "OpTypePointer": 32, 737 | "OpTypeFunction": 33, 738 | "OpTypeEvent": 34, 739 | "OpTypeDeviceEvent": 35, 740 | "OpTypeReserveId": 36, 741 | "OpTypeQueue": 37, 742 | "OpTypePipe": 38, 743 | "OpTypeForwardPointer": 39, 744 | "OpConstantTrue": 41, 745 | "OpConstantFalse": 42, 746 | "OpConstant": 43, 747 | "OpConstantComposite": 44, 748 | "OpConstantSampler": 45, 749 | "OpConstantNull": 46, 750 | "OpSpecConstantTrue": 48, 751 | "OpSpecConstantFalse": 49, 752 | "OpSpecConstant": 50, 753 | "OpSpecConstantComposite": 51, 754 | "OpSpecConstantOp": 52, 755 | "OpFunction": 54, 756 | "OpFunctionParameter": 55, 757 | "OpFunctionEnd": 56, 758 | "OpFunctionCall": 57, 759 | "OpVariable": 59, 760 | "OpImageTexelPointer": 60, 761 | "OpLoad": 61, 762 | "OpStore": 62, 763 | "OpCopyMemory": 63, 764 | "OpCopyMemorySized": 64, 765 | "OpAccessChain": 65, 766 | "OpInBoundsAccessChain": 66, 767 | "OpPtrAccessChain": 67, 768 | "OpArrayLength": 68, 769 | "OpGenericPtrMemSemantics": 69, 770 | "OpInBoundsPtrAccessChain": 70, 771 | "OpDecorate": 71, 772 | "OpMemberDecorate": 72, 773 | "OpDecorationGroup": 73, 774 | "OpGroupDecorate": 74, 775 | "OpGroupMemberDecorate": 75, 776 | "OpVectorExtractDynamic": 77, 777 | "OpVectorInsertDynamic": 78, 778 | "OpVectorShuffle": 79, 779 | "OpCompositeConstruct": 80, 780 | "OpCompositeExtract": 81, 781 | "OpCompositeInsert": 82, 782 | "OpCopyObject": 83, 783 | "OpTranspose": 84, 784 | "OpSampledImage": 86, 785 | "OpImageSampleImplicitLod": 87, 786 | "OpImageSampleExplicitLod": 88, 787 | "OpImageSampleDrefImplicitLod": 89, 788 | "OpImageSampleDrefExplicitLod": 90, 789 | "OpImageSampleProjImplicitLod": 91, 790 | "OpImageSampleProjExplicitLod": 92, 791 | "OpImageSampleProjDrefImplicitLod": 93, 792 | "OpImageSampleProjDrefExplicitLod": 94, 793 | "OpImageFetch": 95, 794 | "OpImageGather": 96, 795 | "OpImageDrefGather": 97, 796 | "OpImageRead": 98, 797 | "OpImageWrite": 99, 798 | "OpImage": 100, 799 | "OpImageQueryFormat": 101, 800 | "OpImageQueryOrder": 102, 801 | "OpImageQuerySizeLod": 103, 802 | "OpImageQuerySize": 104, 803 | "OpImageQueryLod": 105, 804 | "OpImageQueryLevels": 106, 805 | "OpImageQuerySamples": 107, 806 | "OpConvertFToU": 109, 807 | "OpConvertFToS": 110, 808 | "OpConvertSToF": 111, 809 | "OpConvertUToF": 112, 810 | "OpUConvert": 113, 811 | "OpSConvert": 114, 812 | "OpFConvert": 115, 813 | "OpQuantizeToF16": 116, 814 | "OpConvertPtrToU": 117, 815 | "OpSatConvertSToU": 118, 816 | "OpSatConvertUToS": 119, 817 | "OpConvertUToPtr": 120, 818 | "OpPtrCastToGeneric": 121, 819 | "OpGenericCastToPtr": 122, 820 | "OpGenericCastToPtrExplicit": 123, 821 | "OpBitcast": 124, 822 | "OpSNegate": 126, 823 | "OpFNegate": 127, 824 | "OpIAdd": 128, 825 | "OpFAdd": 129, 826 | "OpISub": 130, 827 | "OpFSub": 131, 828 | "OpIMul": 132, 829 | "OpFMul": 133, 830 | "OpUDiv": 134, 831 | "OpSDiv": 135, 832 | "OpFDiv": 136, 833 | "OpUMod": 137, 834 | "OpSRem": 138, 835 | "OpSMod": 139, 836 | "OpFRem": 140, 837 | "OpFMod": 141, 838 | "OpVectorTimesScalar": 142, 839 | "OpMatrixTimesScalar": 143, 840 | "OpVectorTimesMatrix": 144, 841 | "OpMatrixTimesVector": 145, 842 | "OpMatrixTimesMatrix": 146, 843 | "OpOuterProduct": 147, 844 | "OpDot": 148, 845 | "OpIAddCarry": 149, 846 | "OpISubBorrow": 150, 847 | "OpUMulExtended": 151, 848 | "OpSMulExtended": 152, 849 | "OpAny": 154, 850 | "OpAll": 155, 851 | "OpIsNan": 156, 852 | "OpIsInf": 157, 853 | "OpIsFinite": 158, 854 | "OpIsNormal": 159, 855 | "OpSignBitSet": 160, 856 | "OpLessOrGreater": 161, 857 | "OpOrdered": 162, 858 | "OpUnordered": 163, 859 | "OpLogicalEqual": 164, 860 | "OpLogicalNotEqual": 165, 861 | "OpLogicalOr": 166, 862 | "OpLogicalAnd": 167, 863 | "OpLogicalNot": 168, 864 | "OpSelect": 169, 865 | "OpIEqual": 170, 866 | "OpINotEqual": 171, 867 | "OpUGreaterThan": 172, 868 | "OpSGreaterThan": 173, 869 | "OpUGreaterThanEqual": 174, 870 | "OpSGreaterThanEqual": 175, 871 | "OpULessThan": 176, 872 | "OpSLessThan": 177, 873 | "OpULessThanEqual": 178, 874 | "OpSLessThanEqual": 179, 875 | "OpFOrdEqual": 180, 876 | "OpFUnordEqual": 181, 877 | "OpFOrdNotEqual": 182, 878 | "OpFUnordNotEqual": 183, 879 | "OpFOrdLessThan": 184, 880 | "OpFUnordLessThan": 185, 881 | "OpFOrdGreaterThan": 186, 882 | "OpFUnordGreaterThan": 187, 883 | "OpFOrdLessThanEqual": 188, 884 | "OpFUnordLessThanEqual": 189, 885 | "OpFOrdGreaterThanEqual": 190, 886 | "OpFUnordGreaterThanEqual": 191, 887 | "OpShiftRightLogical": 194, 888 | "OpShiftRightArithmetic": 195, 889 | "OpShiftLeftLogical": 196, 890 | "OpBitwiseOr": 197, 891 | "OpBitwiseXor": 198, 892 | "OpBitwiseAnd": 199, 893 | "OpNot": 200, 894 | "OpBitFieldInsert": 201, 895 | "OpBitFieldSExtract": 202, 896 | "OpBitFieldUExtract": 203, 897 | "OpBitReverse": 204, 898 | "OpBitCount": 205, 899 | "OpDPdx": 207, 900 | "OpDPdy": 208, 901 | "OpFwidth": 209, 902 | "OpDPdxFine": 210, 903 | "OpDPdyFine": 211, 904 | "OpFwidthFine": 212, 905 | "OpDPdxCoarse": 213, 906 | "OpDPdyCoarse": 214, 907 | "OpFwidthCoarse": 215, 908 | "OpEmitVertex": 218, 909 | "OpEndPrimitive": 219, 910 | "OpEmitStreamVertex": 220, 911 | "OpEndStreamPrimitive": 221, 912 | "OpControlBarrier": 224, 913 | "OpMemoryBarrier": 225, 914 | "OpAtomicLoad": 227, 915 | "OpAtomicStore": 228, 916 | "OpAtomicExchange": 229, 917 | "OpAtomicCompareExchange": 230, 918 | "OpAtomicCompareExchangeWeak": 231, 919 | "OpAtomicIIncrement": 232, 920 | "OpAtomicIDecrement": 233, 921 | "OpAtomicIAdd": 234, 922 | "OpAtomicISub": 235, 923 | "OpAtomicSMin": 236, 924 | "OpAtomicUMin": 237, 925 | "OpAtomicSMax": 238, 926 | "OpAtomicUMax": 239, 927 | "OpAtomicAnd": 240, 928 | "OpAtomicOr": 241, 929 | "OpAtomicXor": 242, 930 | "OpPhi": 245, 931 | "OpLoopMerge": 246, 932 | "OpSelectionMerge": 247, 933 | "OpLabel": 248, 934 | "OpBranch": 249, 935 | "OpBranchConditional": 250, 936 | "OpSwitch": 251, 937 | "OpKill": 252, 938 | "OpReturn": 253, 939 | "OpReturnValue": 254, 940 | "OpUnreachable": 255, 941 | "OpLifetimeStart": 256, 942 | "OpLifetimeStop": 257, 943 | "OpGroupAsyncCopy": 259, 944 | "OpGroupWaitEvents": 260, 945 | "OpGroupAll": 261, 946 | "OpGroupAny": 262, 947 | "OpGroupBroadcast": 263, 948 | "OpGroupIAdd": 264, 949 | "OpGroupFAdd": 265, 950 | "OpGroupFMin": 266, 951 | "OpGroupUMin": 267, 952 | "OpGroupSMin": 268, 953 | "OpGroupFMax": 269, 954 | "OpGroupUMax": 270, 955 | "OpGroupSMax": 271, 956 | "OpReadPipe": 274, 957 | "OpWritePipe": 275, 958 | "OpReservedReadPipe": 276, 959 | "OpReservedWritePipe": 277, 960 | "OpReserveReadPipePackets": 278, 961 | "OpReserveWritePipePackets": 279, 962 | "OpCommitReadPipe": 280, 963 | "OpCommitWritePipe": 281, 964 | "OpIsValidReserveId": 282, 965 | "OpGetNumPipePackets": 283, 966 | "OpGetMaxPipePackets": 284, 967 | "OpGroupReserveReadPipePackets": 285, 968 | "OpGroupReserveWritePipePackets": 286, 969 | "OpGroupCommitReadPipe": 287, 970 | "OpGroupCommitWritePipe": 288, 971 | "OpEnqueueMarker": 291, 972 | "OpEnqueueKernel": 292, 973 | "OpGetKernelNDrangeSubGroupCount": 293, 974 | "OpGetKernelNDrangeMaxSubGroupSize": 294, 975 | "OpGetKernelWorkGroupSize": 295, 976 | "OpGetKernelPreferredWorkGroupSizeMultiple": 296, 977 | "OpRetainEvent": 297, 978 | "OpReleaseEvent": 298, 979 | "OpCreateUserEvent": 299, 980 | "OpIsValidEvent": 300, 981 | "OpSetUserEventStatus": 301, 982 | "OpCaptureEventProfilingInfo": 302, 983 | "OpGetDefaultQueue": 303, 984 | "OpBuildNDRange": 304, 985 | "OpImageSparseSampleImplicitLod": 305, 986 | "OpImageSparseSampleExplicitLod": 306, 987 | "OpImageSparseSampleDrefImplicitLod": 307, 988 | "OpImageSparseSampleDrefExplicitLod": 308, 989 | "OpImageSparseSampleProjImplicitLod": 309, 990 | "OpImageSparseSampleProjExplicitLod": 310, 991 | "OpImageSparseSampleProjDrefImplicitLod": 311, 992 | "OpImageSparseSampleProjDrefExplicitLod": 312, 993 | "OpImageSparseFetch": 313, 994 | "OpImageSparseGather": 314, 995 | "OpImageSparseDrefGather": 315, 996 | "OpImageSparseTexelsResident": 316, 997 | "OpNoLine": 317, 998 | "OpAtomicFlagTestAndSet": 318, 999 | "OpAtomicFlagClear": 319, 1000 | "OpImageSparseRead": 320, 1001 | "OpSizeOf": 321, 1002 | "OpTypePipeStorage": 322, 1003 | "OpConstantPipeStorage": 323, 1004 | "OpCreatePipeFromPipeStorage": 324, 1005 | "OpGetKernelLocalSizeForSubgroupCount": 325, 1006 | "OpGetKernelMaxNumSubgroups": 326, 1007 | "OpTypeNamedBarrier": 327, 1008 | "OpNamedBarrierInitialize": 328, 1009 | "OpMemoryNamedBarrier": 329, 1010 | "OpModuleProcessed": 330, 1011 | "OpExecutionModeId": 331, 1012 | "OpDecorateId": 332, 1013 | "OpSubgroupBallotKHR": 4421, 1014 | "OpSubgroupFirstInvocationKHR": 4422, 1015 | "OpSubgroupAllKHR": 4428, 1016 | "OpSubgroupAnyKHR": 4429, 1017 | "OpSubgroupAllEqualKHR": 4430, 1018 | "OpSubgroupReadInvocationKHR": 4432, 1019 | "OpGroupIAddNonUniformAMD": 5000, 1020 | "OpGroupFAddNonUniformAMD": 5001, 1021 | "OpGroupFMinNonUniformAMD": 5002, 1022 | "OpGroupUMinNonUniformAMD": 5003, 1023 | "OpGroupSMinNonUniformAMD": 5004, 1024 | "OpGroupFMaxNonUniformAMD": 5005, 1025 | "OpGroupUMaxNonUniformAMD": 5006, 1026 | "OpGroupSMaxNonUniformAMD": 5007, 1027 | "OpFragmentMaskFetchAMD": 5011, 1028 | "OpFragmentFetchAMD": 5012, 1029 | "OpSubgroupShuffleINTEL": 5571, 1030 | "OpSubgroupShuffleDownINTEL": 5572, 1031 | "OpSubgroupShuffleUpINTEL": 5573, 1032 | "OpSubgroupShuffleXorINTEL": 5574, 1033 | "OpSubgroupBlockReadINTEL": 5575, 1034 | "OpSubgroupBlockWriteINTEL": 5576, 1035 | "OpSubgroupImageBlockReadINTEL": 5577, 1036 | "OpSubgroupImageBlockWriteINTEL": 5578 1037 | } 1038 | } 1039 | ] 1040 | } 1041 | } 1042 | 1043 | --------------------------------------------------------------------------------