From b40d6ac9e720d08ca1d6811d9cce3fd9cb46ff38 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Mon, 30 Mar 2015 17:41:16 +0000 Subject: [PATCH] glslang AST -> SPIR-V: Move to new auto-generated official headers, and for the disassembler, mirror the split done between the auto-generation header database and the specification. git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@30434 e7fa87d3-cd2b-0410-9028-fcbf551c1848 --- SPIRV/GLSL450Lib.h | 2 +- SPIRV/GlslangToSpv.cpp | 217 +-- SPIRV/SpvBuilder.cpp | 84 +- SPIRV/SpvBuilder.h | 32 +- SPIRV/disassemble.cpp | 114 +- SPIRV/doc.cpp | 3430 ++++++++++++++++++++++++---------------- SPIRV/doc.h | 108 +- SPIRV/spirv.h | 1835 +++++++++++++-------- SPIRV/spvIR.h | 17 +- 9 files changed, 3537 insertions(+), 2302 deletions(-) diff --git a/SPIRV/GLSL450Lib.h b/SPIRV/GLSL450Lib.h index f32f143f..aa923756 100644 --- a/SPIRV/GLSL450Lib.h +++ b/SPIRV/GLSL450Lib.h @@ -124,7 +124,7 @@ enum Entrypoints { inline void GetDebugNames(const char** names) { for (int i = 0; i < Count; ++i) - names[i] = "unknown"; + names[i] = "Unknown"; names[Round] = "round"; names[RoundEven] = "roundEven"; diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 332c5ec5..8cba9217 100644 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -134,15 +134,15 @@ protected: spv::ExecutionModel TranslateExecutionModel(EShLanguage stage) { switch (stage) { - case EShLangVertex: return spv::ModelVertex; - case EShLangTessControl: return spv::ModelTessellationControl; - case EShLangTessEvaluation: return spv::ModelTessellationEvaluation; - case EShLangGeometry: return spv::ModelGeometry; - case EShLangFragment: return spv::ModelFragment; - case EShLangCompute: return spv::ModelGLCompute; + case EShLangVertex: return spv::ExecutionModelVertex; + case EShLangTessControl: return spv::ExecutionModelTessellationControl; + case EShLangTessEvaluation: return spv::ExecutionModelTessellationEvaluation; + case EShLangGeometry: return spv::ExecutionModelGeometry; + case EShLangFragment: return spv::ExecutionModelFragment; + case EShLangCompute: return spv::ExecutionModelGLCompute; default: spv::MissingFunctionality("GLSL stage"); - return spv::ModelFragment; + return spv::ExecutionModelFragment; } } @@ -150,30 +150,30 @@ spv::ExecutionModel TranslateExecutionModel(EShLanguage stage) spv::StorageClass TranslateStorageClass(const glslang::TType& type) { if (type.getQualifier().isPipeInput()) - return spv::StorageInput; + return spv::StorageClassInput; else if (type.getQualifier().isPipeOutput()) - return spv::StorageOutput; + return spv::StorageClassOutput; else if (type.getQualifier().isUniformOrBuffer()) { if (type.getBasicType() == glslang::EbtBlock) - return spv::StorageUniform; + return spv::StorageClassUniform; else - return spv::StorageConstantUniform; + return spv::StorageClassUniformConstant; // TODO: how are we distuingishing between default and non-default non-writable uniforms? Do default uniforms even exist? } else { switch (type.getQualifier().storage) { - case glslang::EvqShared: return spv::StorageWorkgroupLocal; break; - case glslang::EvqGlobal: return spv::StoragePrivateGlobal; - case glslang::EvqConstReadOnly: return spv::StorageFunction; - case glslang::EvqTemporary: return spv::StorageFunction; + case glslang::EvqShared: return spv::StorageClassWorkgroupLocal; break; + case glslang::EvqGlobal: return spv::StorageClassPrivateGlobal; + case glslang::EvqConstReadOnly: return spv::StorageClassFunction; + case glslang::EvqTemporary: return spv::StorageClassFunction; default: spv::MissingFunctionality("unknown glslang storage class"); - return spv::StorageCount; + return spv::StorageClassFunction; } } } // Translate glslang sampler type to SPIR-V dimensionality. -spv::Dimensionality TranslateDimensionality(const glslang::TSampler& sampler) +spv::Dim TranslateDimensionality(const glslang::TSampler& sampler) { switch (sampler.dim) { case glslang::Esd1D: return spv::Dim1D; @@ -192,10 +192,11 @@ spv::Dimensionality TranslateDimensionality(const glslang::TSampler& sampler) spv::Decoration TranslatePrecisionDecoration(const glslang::TType& type) { switch (type.getQualifier().precision) { - case glslang::EpqLow: return spv::DecPrecisionLow; - case glslang::EpqMedium: return spv::DecPrecisionMedium; - case glslang::EpqHigh: return spv::DecPrecisionHigh; - default: return spv::DecCount; + case glslang::EpqLow: return spv::DecorationPrecisionLow; + case glslang::EpqMedium: return spv::DecorationPrecisionMedium; + case glslang::EpqHigh: return spv::DecorationPrecisionHigh; + default: + return spv::NoPrecision; } } @@ -204,17 +205,17 @@ spv::Decoration TranslateBlockDecoration(const glslang::TType& type) { if (type.getBasicType() == glslang::EbtBlock) { switch (type.getQualifier().storage) { - case glslang::EvqUniform: return spv::DecBlock; - case glslang::EvqBuffer: return spv::DecBufferBlock; - case glslang::EvqVaryingIn: return spv::DecBlock; - case glslang::EvqVaryingOut: return spv::DecBlock; + case glslang::EvqUniform: return spv::DecorationBlock; + case glslang::EvqBuffer: return spv::DecorationBufferBlock; + case glslang::EvqVaryingIn: return spv::DecorationBlock; + case glslang::EvqVaryingOut: return spv::DecorationBlock; default: spv::MissingFunctionality("kind of block"); break; } } - return spv::DecCount; + return (spv::Decoration)spv::BadValue; } // Translate glslang type to SPIR-V layout decorations. @@ -223,36 +224,36 @@ spv::Decoration TranslateLayoutDecoration(const glslang::TType& type) if (type.isMatrix()) { switch (type.getQualifier().layoutMatrix) { case glslang::ElmRowMajor: - return spv::DecRowMajor; + return spv::DecorationRowMajor; default: - return spv::DecColMajor; + return spv::DecorationColMajor; } } else { switch (type.getBasicType()) { default: - return spv::DecCount; + return (spv::Decoration)spv::BadValue; break; case glslang::EbtBlock: switch (type.getQualifier().storage) { case glslang::EvqUniform: case glslang::EvqBuffer: switch (type.getQualifier().layoutPacking) { - case glslang::ElpShared: return spv::DecGLSLShared; - case glslang::ElpStd140: return spv::DecGLSLStd140; - case glslang::ElpStd430: return spv::DecGLSLStd430; - case glslang::ElpPacked: return spv::DecGLSLPacked; + case glslang::ElpShared: return spv::DecorationGLSLShared; + case glslang::ElpStd140: return spv::DecorationGLSLStd140; + case glslang::ElpStd430: return spv::DecorationGLSLStd430; + case glslang::ElpPacked: return spv::DecorationGLSLPacked; default: spv::MissingFunctionality("uniform block layout"); - return spv::DecGLSLShared; + return spv::DecorationGLSLShared; } case glslang::EvqVaryingIn: case glslang::EvqVaryingOut: if (type.getQualifier().layoutPacking != glslang::ElpNone) spv::MissingFunctionality("in/out block layout"); - return spv::DecCount; + return (spv::Decoration)spv::BadValue; default: spv::MissingFunctionality("block storage qualification"); - return spv::DecCount; + return (spv::Decoration)spv::BadValue; } } } @@ -262,28 +263,28 @@ spv::Decoration TranslateLayoutDecoration(const glslang::TType& type) spv::Decoration TranslateInterpolationDecoration(const glslang::TType& type) { if (type.getQualifier().smooth) - return spv::DecSmooth; + return spv::DecorationSmooth; if (type.getQualifier().nopersp) - return spv::DecNoperspective; + return spv::DecorationNoperspective; else if (type.getQualifier().patch) - return spv::DecPatch; + return spv::DecorationPatch; else if (type.getQualifier().flat) - return spv::DecFlat; + return spv::DecorationFlat; else if (type.getQualifier().centroid) - return spv::DecCentroid; + return spv::DecorationCentroid; else if (type.getQualifier().sample) - return spv::DecSample; + return spv::DecorationSample; else - return spv::DecCount; + return (spv::Decoration)spv::BadValue; } // If glslang type is invaraiant, return SPIR-V invariant decoration. spv::Decoration TranslateInvariantDecoration(const glslang::TType& type) { if (type.getQualifier().invariant) - return spv::DecInvariant; + return spv::DecorationInvariant; else - return spv::DecCount; + return (spv::Decoration)spv::BadValue; } // Identify what SPIR-V built-in variable a symbol is. @@ -312,7 +313,7 @@ spv::BuiltIn TranslateBuiltIn(const glslang::TIntermSymbol* node) { const glslang::TString& name = node->getName(); if (name.compare(0, 3, "gl_") != 0) - return spv::BuiltInCount; + return (spv::BuiltIn)spv::BadValue; switch (node->getQualifier().storage) { case glslang::EvqPosition: return spv::BuiltInPosition; @@ -325,7 +326,7 @@ spv::BuiltIn TranslateBuiltIn(const glslang::TIntermSymbol* node) case glslang::EvqFace: return spv::BuiltInFrontFacing; case glslang::EvqFragColor: return spv::BuiltInFragColor; case glslang::EvqFragDepth: return spv::BuiltInFragDepth; - default: return spv::BuiltInCount; + default: return (spv::BuiltIn)spv::BadValue; if (name == "gl_ClipDistance") return spv::BuiltInClipDistance; else if (name == "gl_PrimitiveID" || name == "gl_PrimitiveIDIn") @@ -380,9 +381,9 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls spv::ExecutionModel executionModel = TranslateExecutionModel(glslangIntermediate->getStage()); builder.clearAccessChain(); - builder.setSource(spv::LangGLSL, glslangIntermediate->getVersion()); + builder.setSource(spv::SourceLanguageGLSL, glslangIntermediate->getVersion()); stdBuiltins = builder.import("GLSL.std.450"); - builder.setMemoryModel(spv::AddressingLogical, spv::MemoryGLSL450); + builder.setMemoryModel(spv::AddressingModelLogical, spv::MemoryModelGLSL450); shaderEntry = builder.makeMain(); builder.addEntryPoint(executionModel, shaderEntry); @@ -394,7 +395,7 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls // Add the top-level modes for this shader. if (glslangIntermediate->getXfbMode()) - builder.addExecutionMode(shaderEntry, spv::ExecutionXfb); + builder.addExecutionMode(shaderEntry, spv::ExecutionModeXfb); spv::ExecutionMode mode; switch (glslangIntermediate->getStage()) { @@ -402,17 +403,17 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls break; case EShLangTessControl: - builder.addExecutionMode(shaderEntry, spv::ExecutionOutputVertices, glslangIntermediate->getVertices()); + builder.addExecutionMode(shaderEntry, spv::ExecutionModeOutputVertices, glslangIntermediate->getVertices()); break; case EShLangTessEvaluation: switch (glslangIntermediate->getInputPrimitive()) { - case glslang::ElgTriangles: mode = spv::ExecutionInputTriangles; break; - case glslang::ElgQuads: mode = spv::ExecutionInputQuads; break; - case glslang::ElgIsolines: mode = spv::ExecutionInputIsolines; break; - default: mode = spv::ExecutionModeCount; break; + case glslang::ElgTriangles: mode = spv::ExecutionModeInputTriangles; break; + case glslang::ElgQuads: mode = spv::ExecutionModeInputQuads; break; + case glslang::ElgIsolines: mode = spv::ExecutionModeInputIsolines; break; + default: mode = (spv::ExecutionMode)spv::BadValue; break; } - if (mode != spv::ExecutionModeCount) + if (mode != spv::BadValue) builder.addExecutionMode(shaderEntry, mode); // TODO @@ -423,33 +424,33 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls case EShLangGeometry: switch (glslangIntermediate->getInputPrimitive()) { - case glslang::ElgPoints: mode = spv::ExecutionInputPoints; break; - case glslang::ElgLines: mode = spv::ExecutionInputLines; break; - case glslang::ElgLinesAdjacency: mode = spv::ExecutionInputLinesAdjacency; break; - case glslang::ElgTriangles: mode = spv::ExecutionInputTriangles; break; - case glslang::ElgTrianglesAdjacency: mode = spv::ExecutionInputTrianglesAdjacency; break; - default: mode = spv::ExecutionModeCount; break; + case glslang::ElgPoints: mode = spv::ExecutionModeInputPoints; break; + case glslang::ElgLines: mode = spv::ExecutionModeInputLines; break; + case glslang::ElgLinesAdjacency: mode = spv::ExecutionModeInputLinesAdjacency; break; + case glslang::ElgTriangles: mode = spv::ExecutionModeInputTriangles; break; + case glslang::ElgTrianglesAdjacency: mode = spv::ExecutionModeInputTrianglesAdjacency; break; + default: mode = (spv::ExecutionMode)spv::BadValue; break; } - if (mode != spv::ExecutionModeCount) + if (mode != spv::BadValue) builder.addExecutionMode(shaderEntry, mode); - builder.addExecutionMode(shaderEntry, spv::ExecutionInvocations, glslangIntermediate->getInvocations()); + builder.addExecutionMode(shaderEntry, spv::ExecutionModeInvocations, glslangIntermediate->getInvocations()); switch (glslangIntermediate->getOutputPrimitive()) { - case glslang::ElgPoints: mode = spv::ExecutionOutputPoints; break; - case glslang::ElgLineStrip: mode = spv::ExecutionOutputLineStrip; break; - case glslang::ElgTriangleStrip: mode = spv::ExecutionOutputTriangleStrip; break; - default: mode = spv::ExecutionModeCount; break; + case glslang::ElgPoints: mode = spv::ExecutionModeOutputPoints; break; + case glslang::ElgLineStrip: mode = spv::ExecutionModeOutputLineStrip; break; + case glslang::ElgTriangleStrip: mode = spv::ExecutionModeOutputTriangleStrip; break; + default: mode = (spv::ExecutionMode)spv::BadValue; break; } - if (mode != spv::ExecutionModeCount) + if (mode != spv::BadValue) builder.addExecutionMode(shaderEntry, mode); - builder.addExecutionMode(shaderEntry, spv::ExecutionOutputVertices, glslangIntermediate->getVertices()); + builder.addExecutionMode(shaderEntry, spv::ExecutionModeOutputVertices, glslangIntermediate->getVertices()); break; case EShLangFragment: if (glslangIntermediate->getPixelCenterInteger()) - builder.addExecutionMode(shaderEntry, spv::ExecutionPixelCenterInteger); + builder.addExecutionMode(shaderEntry, spv::ExecutionModePixelCenterInteger); if (glslangIntermediate->getOriginUpperLeft()) - builder.addExecutionMode(shaderEntry, spv::ExecutionOriginUpperLeft); + builder.addExecutionMode(shaderEntry, spv::ExecutionModeOriginUpperLeft); break; case EShLangCompute: @@ -1075,14 +1076,14 @@ bool TGlslangToSpvTraverser::visitSelection(glslang::TVisit /* visit */, glslang if (node->getBasicType() != glslang::EbtVoid) { // don't handle this as just on-the-fly temporaries, because there will be two names // and better to leave SSA to later passes - result = builder.createVariable(spv::StorageFunction, convertGlslangToSpvType(node->getType())); + result = builder.createVariable(spv::StorageClassFunction, convertGlslangToSpvType(node->getType())); } // emit the condition before doing anything with selection node->getCondition()->traverse(this); // make an "if" based on the value created by the condition - spv::Builder::If ifBuilder(builder.accessChainLoad(spv::DecCount), builder); + spv::Builder::If ifBuilder(builder.accessChainLoad(spv::NoPrecision), builder); if (node->getTrueBlock()) { // emit the "then" statement @@ -1266,8 +1267,8 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol* if (glslang::IsAnonymous(name)) name = ""; - if (storageClass == spv::StorageCount) - return builder.createVariable(spv::StorageFunction, spvType, name); + if (storageClass == spv::BadValue) + return builder.createVariable(spv::StorageClassFunction, spvType, name); else return builder.createVariable(storageClass, spvType, name); } @@ -1366,11 +1367,11 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty addMemberDecoration(spvType, member, TranslateInterpolationDecoration(glslangType)); addMemberDecoration(spvType, member, TranslateInvariantDecoration(glslangType)); if (glslangType.getQualifier().hasLocation()) - builder.addMemberDecoration(spvType, member, spv::DecLocation, glslangType.getQualifier().layoutLocation); + builder.addMemberDecoration(spvType, member, spv::DecorationLocation, glslangType.getQualifier().layoutLocation); if (glslangType.getQualifier().hasComponent()) - builder.addMemberDecoration(spvType, member, spv::DecComponent, glslangType.getQualifier().layoutComponent); + builder.addMemberDecoration(spvType, member, spv::DecorationComponent, glslangType.getQualifier().layoutComponent); if (glslangType.getQualifier().hasXfbOffset()) - builder.addMemberDecoration(spvType, member, spv::DecOffset, glslangType.getQualifier().layoutXfbOffset); + builder.addMemberDecoration(spvType, member, spv::DecorationOffset, glslangType.getQualifier().layoutXfbOffset); } } @@ -1378,12 +1379,12 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty addDecoration(spvType, TranslateLayoutDecoration(type)); addDecoration(spvType, TranslateBlockDecoration(type)); if (type.getQualifier().hasStream()) - builder.addDecoration(spvType, spv::DecStream, type.getQualifier().layoutStream); + builder.addDecoration(spvType, spv::DecorationStream, type.getQualifier().layoutStream); if (glslangIntermediate->getXfbMode()) { if (type.getQualifier().hasXfbStride()) - builder.addDecoration(spvType, spv::DecStride, type.getQualifier().layoutXfbStride); + builder.addDecoration(spvType, spv::DecorationStride, type.getQualifier().layoutXfbStride); if (type.getQualifier().hasXfbBuffer()) - builder.addDecoration(spvType, spv::DecXfbBuffer, type.getQualifier().layoutXfbBuffer); + builder.addDecoration(spvType, spv::DecorationXfbBuffer, type.getQualifier().layoutXfbBuffer); } } break; @@ -1448,7 +1449,7 @@ void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslF const glslang::TType& paramType = parameters[p]->getAsTyped()->getType(); spv::Id typeId = convertGlslangToSpvType(paramType); if (paramType.getQualifier().storage != glslang::EvqConstReadOnly) - typeId = builder.makePointer(spv::StorageFunction, typeId); + typeId = builder.makePointer(spv::StorageClassFunction, typeId); else constReadOnlyParameters.insert(parameters[p]->getAsSymbolNode()->getId()); paramTypes.push_back(typeId); @@ -1674,11 +1675,11 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg if (qualifiers[a] != glslang::EvqConstReadOnly) { // need space to hold the copy const glslang::TType& paramType = glslangArgs[a]->getAsTyped()->getType(); - arg = builder.createVariable(spv::StorageFunction, convertGlslangToSpvType(paramType), "param"); + arg = builder.createVariable(spv::StorageClassFunction, convertGlslangToSpvType(paramType), "param"); if (qualifiers[a] == glslang::EvqIn || qualifiers[a] == glslang::EvqInOut) { // need to copy the input into output space builder.setAccessChain(lValues[lValueCount]); - spv::Id copy = builder.accessChainLoad(spv::DecCount); // TODO: get precision + spv::Id copy = builder.accessChainLoad(spv::NoPrecision); // TODO: get precision builder.createStore(copy, arg); } ++lValueCount; @@ -1715,7 +1716,7 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv bool isUnsigned = typeProxy == glslang::EbtUint; bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble; - spv::OpCode binOp = spv::OpNop; + spv::Op binOp = spv::OpNop; bool needsPromotion = true; bool comparison = false; @@ -1943,7 +1944,7 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, spv::Id operand, bool isFloat) { - spv::OpCode unaryOp = spv::OpNop; + spv::Op unaryOp = spv::OpNop; int libCall = -1; switch (op) { @@ -2158,7 +2159,7 @@ spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv: spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Decoration precision, spv::Id destType, spv::Id operand) { - spv::OpCode convOp = spv::OpNop; + spv::Op convOp = spv::OpNop; spv::Id zero; spv::Id one; @@ -2265,7 +2266,7 @@ spv::Id TGlslangToSpvTraverser::makeSmearedConstant(spv::Id constant, int vector spv::Id TGlslangToSpvTraverser::createMiscOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, std::vector& operands, bool isUnsigned) { - spv::OpCode opCode = spv::OpNop; + spv::Op opCode = spv::OpNop; int libCall = -1; switch (op) { @@ -2371,19 +2372,19 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op) builder.createMemoryBarrier(spv::ExecutionScopeDevice, spv::MemorySemanticsAllMemory); return 0; case glslang::EOpMemoryBarrierAtomicCounter: - builder.createMemoryBarrier(spv::ExecutionScopeDevice, spv::MemorySemanticsAtomicCounter); + builder.createMemoryBarrier(spv::ExecutionScopeDevice, spv::MemorySemanticsAtomicCounterMemoryMask); return 0; case glslang::EOpMemoryBarrierBuffer: - builder.createMemoryBarrier(spv::ExecutionScopeDevice, spv::MemorySemanticsUniform); + builder.createMemoryBarrier(spv::ExecutionScopeDevice, spv::MemorySemanticsUniformMemoryMask); return 0; case glslang::EOpMemoryBarrierImage: - builder.createMemoryBarrier(spv::ExecutionScopeDevice, spv::MemorySemanticsImage); + builder.createMemoryBarrier(spv::ExecutionScopeDevice, spv::MemorySemanticsImageMemoryMask); return 0; case glslang::EOpMemoryBarrierShared: - builder.createMemoryBarrier(spv::ExecutionScopeDevice, spv::MemorySemanticsWorkgroupLocal); + builder.createMemoryBarrier(spv::ExecutionScopeDevice, spv::MemorySemanticsWorkgroupLocalMemoryMask); return 0; case glslang::EOpGroupMemoryBarrier: - builder.createMemoryBarrier(spv::ExecutionScopeDevice, spv::MemorySemanticsWorkgroupGlobal); + builder.createMemoryBarrier(spv::ExecutionScopeDevice, spv::MemorySemanticsWorkgroupGlobalMemoryMask); return 0; default: spv::MissingFunctionality("operation with no arguments"); @@ -2409,53 +2410,53 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol addDecoration(id, TranslatePrecisionDecoration(symbol->getType())); addDecoration(id, TranslateInterpolationDecoration(symbol->getType())); if (symbol->getQualifier().hasLocation()) - builder.addDecoration(id, spv::DecLocation, symbol->getQualifier().layoutLocation); + builder.addDecoration(id, spv::DecorationLocation, symbol->getQualifier().layoutLocation); if (symbol->getQualifier().hasComponent()) - builder.addDecoration(id, spv::DecComponent, symbol->getQualifier().layoutComponent); + builder.addDecoration(id, spv::DecorationComponent, symbol->getQualifier().layoutComponent); if (glslangIntermediate->getXfbMode()) { if (symbol->getQualifier().hasXfbStride()) - builder.addDecoration(id, spv::DecStride, symbol->getQualifier().layoutXfbStride); + builder.addDecoration(id, spv::DecorationStride, symbol->getQualifier().layoutXfbStride); if (symbol->getQualifier().hasXfbBuffer()) - builder.addDecoration(id, spv::DecXfbBuffer, symbol->getQualifier().layoutXfbBuffer); + builder.addDecoration(id, spv::DecorationXfbBuffer, symbol->getQualifier().layoutXfbBuffer); if (symbol->getQualifier().hasXfbOffset()) - builder.addDecoration(id, spv::DecOffset, symbol->getQualifier().layoutXfbOffset); + builder.addDecoration(id, spv::DecorationOffset, symbol->getQualifier().layoutXfbOffset); } } addDecoration(id, TranslateInvariantDecoration(symbol->getType())); if (symbol->getQualifier().hasStream()) - builder.addDecoration(id, spv::DecStream, symbol->getQualifier().layoutStream); + builder.addDecoration(id, spv::DecorationStream, symbol->getQualifier().layoutStream); if (symbol->getQualifier().hasSet()) - builder.addDecoration(id, spv::DecDescriptorSet, symbol->getQualifier().layoutSet); + builder.addDecoration(id, spv::DecorationDescriptorSet, symbol->getQualifier().layoutSet); if (symbol->getQualifier().hasBinding()) - builder.addDecoration(id, spv::DecBinding, symbol->getQualifier().layoutBinding); + builder.addDecoration(id, spv::DecorationBinding, symbol->getQualifier().layoutBinding); if (glslangIntermediate->getXfbMode()) { if (symbol->getQualifier().hasXfbStride()) - builder.addDecoration(id, spv::DecStride, symbol->getQualifier().layoutXfbStride); + builder.addDecoration(id, spv::DecorationStride, symbol->getQualifier().layoutXfbStride); if (symbol->getQualifier().hasXfbBuffer()) - builder.addDecoration(id, spv::DecXfbBuffer, symbol->getQualifier().layoutXfbBuffer); + builder.addDecoration(id, spv::DecorationXfbBuffer, symbol->getQualifier().layoutXfbBuffer); } // built-in variable decorations int num = TranslateBuiltInDecoration(*symbol); if (num >= 0) - builder.addDecoration(id, spv::DecBuiltIn, num); + builder.addDecoration(id, spv::DecorationBuiltIn, num); if (linkageOnly) - builder.addDecoration(id, spv::DecNoStaticUse); + builder.addDecoration(id, spv::DecorationNoStaticUse); return id; } void TGlslangToSpvTraverser::addDecoration(spv::Id id, spv::Decoration dec) { - if (dec != spv::DecCount) + if (dec != spv::BadValue) builder.addDecoration(id, dec); } void TGlslangToSpvTraverser::addMemberDecoration(spv::Id id, int member, spv::Decoration dec) { - if (dec != spv::DecCount) + if (dec != spv::BadValue) builder.addMemberDecoration(id, (unsigned)member, dec); } diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 8e2b9bca..31df1d70 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -56,10 +56,10 @@ namespace spv { const int SpvBuilderMagic = 0xBB; Builder::Builder(unsigned int userNumber) : - source(LangUnknown), + source(SourceLanguageUnknown), sourceVersion(0), - addressModel(AddressingLogical), - memoryModel(MemoryGLSL450), + addressModel(AddressingModelLogical), + memoryModel(MemoryModelGLSL450), builderNumber(userNumber << 16 | SpvBuilderMagic), buildPoint(0), uniqueId(0), @@ -293,7 +293,7 @@ Id Builder::makeFunctionType(Id returnType, std::vector& paramTypes) return type->getResultId(); } -Id Builder::makeSampler(Id sampledType, Dimensionality dim, samplerContent content, bool arrayed, bool shadow, bool ms) +Id Builder::makeSampler(Id sampledType, Dim dim, samplerContent content, bool arrayed, bool shadow, bool ms) { // try to find it Instruction* type; @@ -332,11 +332,11 @@ Id Builder::getDerefTypeId(Id resultId) const return module.getInstruction(typeId)->getImmediateOperand(1); } -OpCode Builder::getMostBasicTypeClass(Id typeId) const +Op Builder::getMostBasicTypeClass(Id typeId) const { Instruction* instr = module.getInstruction(typeId); - OpCode typeClass = instr->getOpCode(); + Op typeClass = instr->getOpCode(); switch (typeClass) { case OpTypeVoid: @@ -384,7 +384,7 @@ Id Builder::getScalarTypeId(Id typeId) const { Instruction* instr = module.getInstruction(typeId); - OpCode typeClass = instr->getOpCode(); + Op typeClass = instr->getOpCode(); switch (typeClass) { case OpTypeVoid: @@ -410,7 +410,7 @@ Id Builder::getContainedTypeId(Id typeId, int member) const { Instruction* instr = module.getInstruction(typeId); - OpCode typeClass = instr->getOpCode(); + Op typeClass = instr->getOpCode(); switch (typeClass) { case OpTypeVector: @@ -436,7 +436,7 @@ Id Builder::getContainedTypeId(Id typeId) const // See if a scalar constant of this type has already been created, so it // can be reused rather than duplicated. (Required by the specification). -Id Builder::findScalarConstant(OpCode typeClass, Id typeId, unsigned value) const +Id Builder::findScalarConstant(Op typeClass, Id typeId, unsigned value) const { Instruction* constant; for (int i = 0; i < (int)groupedConstants[typeClass].size(); ++i) { @@ -515,7 +515,7 @@ Id Builder::makeDoubleConstant(double d) return NoResult; } -Id Builder::findCompositeConstant(OpCode typeClass, std::vector& comps) const +Id Builder::findCompositeConstant(Op typeClass, std::vector& comps) const { Instruction* constant; bool found = false; @@ -547,7 +547,7 @@ Id Builder::findCompositeConstant(OpCode typeClass, std::vector& comps) cons Id Builder::makeCompositeConstant(Id typeId, std::vector& members) { assert(typeId); - OpCode typeClass = getTypeClass(typeId); + Op typeClass = getTypeClass(typeId); switch (typeClass) { case OpTypeVector: @@ -735,7 +735,7 @@ void Builder::leaveFunction(bool main) if (function.getReturnType() == makeVoidType()) makeReturn(true); else { - Id retStorage = createVariable(StorageFunction, function.getReturnType(), "dummyReturn"); + Id retStorage = createVariable(StorageClassFunction, function.getReturnType(), "dummyReturn"); Id retValue = createLoad(retStorage); makeReturn(true, retValue); } @@ -761,18 +761,18 @@ Id Builder::createVariable(StorageClass storageClass, Id type, const char* name) inst->addImmediateOperand(storageClass); switch (storageClass) { - case StorageConstantUniform: - case StorageUniform: - case StorageInput: - case StorageOutput: - case StorageWorkgroupLocal: - case StoragePrivateGlobal: - case StorageWorkgroupGlobal: + case StorageClassUniformConstant: + case StorageClassUniform: + case StorageClassInput: + case StorageClassOutput: + case StorageClassWorkgroupLocal: + case StorageClassPrivateGlobal: + case StorageClassWorkgroupGlobal: constantsTypesGlobals.push_back(inst); module.mapInstruction(inst); break; - case StorageFunction: + case StorageClassFunction: // Validation rules require the declaration in the entry block buildPoint->getParent().addLocalVariable(inst); break; @@ -878,14 +878,14 @@ Id Builder::createCompositeInsert(Id object, Id composite, Id typeId, std::vecto } // An opcode that has no operands, no result id, and no type -void Builder::createNoResultOp(OpCode opCode) +void Builder::createNoResultOp(Op opCode) { Instruction* op = new Instruction(opCode); buildPoint->addInstruction(op); } // An opcode that has one operand, no result id, and no type -void Builder::createNoResultOp(OpCode opCode, Id operand) +void Builder::createNoResultOp(Op opCode, Id operand) { Instruction* op = new Instruction(opCode); op->addIdOperand(operand); @@ -908,7 +908,7 @@ void Builder::createMemoryBarrier(unsigned executionScope, unsigned memorySemant } // An opcode that has one operands, a result id, and a type -Id Builder::createUnaryOp(OpCode opCode, Id typeId, Id operand) +Id Builder::createUnaryOp(Op opCode, Id typeId, Id operand) { Instruction* op = new Instruction(getUniqueId(), typeId, opCode); op->addIdOperand(operand); @@ -917,7 +917,7 @@ Id Builder::createUnaryOp(OpCode opCode, Id typeId, Id operand) return op->getResultId(); } -Id Builder::createBinOp(OpCode opCode, Id typeId, Id left, Id right) +Id Builder::createBinOp(Op opCode, Id typeId, Id left, Id right) { Instruction* op = new Instruction(getUniqueId(), typeId, opCode); op->addIdOperand(left); @@ -927,7 +927,7 @@ Id Builder::createBinOp(OpCode opCode, Id typeId, Id left, Id right) return op->getResultId(); } -Id Builder::createTriOp(OpCode opCode, Id typeId, Id op1, Id op2, Id op3) +Id Builder::createTriOp(Op opCode, Id typeId, Id op1, Id op2, Id op3) { Instruction* op = new Instruction(getUniqueId(), typeId, opCode); op->addIdOperand(op1); @@ -938,7 +938,7 @@ Id Builder::createTriOp(OpCode opCode, Id typeId, Id op1, Id op2, Id op3) return op->getResultId(); } -Id Builder::createTernaryOp(OpCode opCode, Id typeId, Id op1, Id op2, Id op3) +Id Builder::createTernaryOp(Op opCode, Id typeId, Id op1, Id op2, Id op3) { Instruction* op = new Instruction(getUniqueId(), typeId, opCode); op->addIdOperand(op1); @@ -1080,7 +1080,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool proj, co // Set up the instruction // - OpCode opCode; + Op opCode; if (proj && parameters.gradX && parameters.offset) opCode = OpTextureSampleProjGradOffset; else if (proj && parameters.lod && parameters.offset) @@ -1118,7 +1118,7 @@ Id Builder::createTextureCall(Decoration precision, Id resultType, bool proj, co } // Comments in header -Id Builder::createTextureQueryCall(OpCode opCode, const TextureParameters& parameters) +Id Builder::createTextureQueryCall(Op opCode, const TextureParameters& parameters) { // Figure out the result type Id resultType; @@ -1190,7 +1190,7 @@ Id Builder::createTextureQueryCall(OpCode opCode, const TextureParameters& param // Comments in header //Id Builder::createBitFieldExtractCall(Decoration precision, Id id, Id offset, Id bits, bool isSigned) //{ -// OpCode opCode = isSigned ? sBitFieldExtract +// Op opCode = isSigned ? sBitFieldExtract // : uBitFieldExtract; // // if (isScalar(offset) == false || isScalar(bits) == false) @@ -1210,7 +1210,7 @@ Id Builder::createTextureQueryCall(OpCode opCode, const TextureParameters& param // Comments in header //Id Builder::createBitFieldInsertCall(Decoration precision, Id base, Id insert, Id offset, Id bits) //{ -// OpCode opCode = bitFieldInsert; +// Op opCode = bitFieldInsert; // // if (isScalar(offset) == false || isScalar(bits) == false) // MissingFunctionality("bitFieldInsert operand types"); @@ -1230,7 +1230,7 @@ Id Builder::createTextureQueryCall(OpCode opCode, const TextureParameters& param Id Builder::createCompare(Decoration precision, Id value1, Id value2, bool equal) { Instruction* compare = 0; - spv::OpCode binOp = spv::OpNop; + spv::Op binOp = spv::OpNop; Id boolType = makeBoolType(); Id valueType = getTypeId(value1); @@ -1242,7 +1242,7 @@ Id Builder::createCompare(Decoration precision, Id value1, Id value2, bool equal if (isVectorType(valueType)) { Id boolVectorType = makeVectorType(boolType, getNumTypeComponents(valueType)); Id boolVector; - OpCode op; + Op op; if (getMostBasicTypeClass(valueType) == OpTypeFloat) op = equal ? OpFOrdEqual : OpFOrdNotEqual; else @@ -1307,9 +1307,9 @@ Id Builder::createCompare(Decoration precision, Id value1, Id value2, bool equal } // Comments in header -//Id Builder::createOperation(Decoration precision, OpCode opCode, Id operand) +//Id Builder::createOperation(Decoration precision, Op opCode, Id operand) //{ -// OpCode* opCode = 0; +// Op* opCode = 0; // // // Handle special return types here. Things that don't have same result type as parameter // switch (opCode) { @@ -1362,7 +1362,7 @@ Id Builder::createCompare(Decoration precision, Id value1, Id value2, bool equal //} // //// Comments in header -//Id Builder::createOperation(Decoration precision, OpCode opCode, Id operand0, Id operand1) +//Id Builder::createOperation(Decoration precision, Op opCode, Id operand0, Id operand1) //{ // Function* opCode = 0; // @@ -1393,7 +1393,7 @@ Id Builder::createCompare(Decoration precision, Id value1, Id value2, bool equal // return instr; //} // -//Id Builder::createOperation(Decoration precision, OpCode opCode, Id operand0, Id operand1, Id operand2) +//Id Builder::createOperation(Decoration precision, Op opCode, Id operand0, Id operand1, Id operand2) //{ // Function* opCode; // @@ -1608,7 +1608,7 @@ void Builder::If::makeEndIf() // Go back to the headerBlock and make the flow control split builder.setBuildPoint(headerBlock); - builder.createMerge(OpSelectionMerge, mergeBlock, SelectControlNone); + builder.createMerge(OpSelectionMerge, mergeBlock, SelectionControlMaskNone); if (elseBlock) builder.createConditionalBranch(condition, thenBlock, elseBlock); else @@ -1632,7 +1632,7 @@ void Builder::makeSwitch(Id selector, int numSegments, std::vector& caseVal Block* mergeBlock = new Block(getUniqueId(), function); // make and insert the switch's selection-merge instruction - createMerge(OpSelectionMerge, mergeBlock, SelectControlNone); + createMerge(OpSelectionMerge, mergeBlock, SelectionControlMaskNone); // make the switch instruction Instruction* switchInst = new Instruction(NoResult, NoType, OpSwitch); @@ -1706,7 +1706,7 @@ void Builder::createLoopHeaderBranch(Id condition) Loop loop = loops.top(); Block* body = new Block(getUniqueId(), *loop.function); - createMerge(OpLoopMerge, loop.merge, LoopControlNone); + createMerge(OpLoopMerge, loop.merge, LoopControlMaskNone); createConditionalBranch(condition, body, loop.merge); loop.function->addBlock(body); setBuildPoint(body); @@ -1831,7 +1831,7 @@ Id Builder::accessChainLoad(Decoration precision) id = createCompositeExtract(accessChain.base, accessChain.resultType, indexes); else { // make a new function variable for this r-value - Id lValue = createVariable(StorageFunction, getTypeId(accessChain.base), "indexable"); + Id lValue = createVariable(StorageClassUniform, getTypeId(accessChain.base), "indexable"); // store into it createStore(accessChain.base, lValue); @@ -1887,7 +1887,7 @@ void Builder::dump(std::vector& out) const out.push_back(0); // First instructions, some created on the spot here: - if (source != LangUnknown) { + if (source != SourceLanguageUnknown) { Instruction sourceInst(0, 0, OpSource); sourceInst.addImmediateOperand(source); sourceInst.addImmediateOperand(sourceVersion); @@ -1979,7 +1979,7 @@ void Builder::createBranch(Block* block) block->addPredecessor(buildPoint); } -void Builder::createMerge(OpCode mergeCode, Block* mergeBlock, unsigned int control) +void Builder::createMerge(Op mergeCode, Block* mergeBlock, unsigned int control) { Instruction* merge = new Instruction(mergeCode); merge->addIdOperand(mergeBlock->getId()); diff --git a/SPIRV/SpvBuilder.h b/SPIRV/SpvBuilder.h index 787d852f..be6abd9d 100644 --- a/SPIRV/SpvBuilder.h +++ b/SPIRV/SpvBuilder.h @@ -106,14 +106,14 @@ public: samplerContentImage, samplerContentTextureFilter }; - Id makeSampler(Id sampledType, Dimensionality, samplerContent, bool arrayed, bool shadow, bool ms); + Id makeSampler(Id sampledType, Dim, samplerContent, bool arrayed, bool shadow, bool ms); // For querying about types. Id getTypeId(Id resultId) const { return module.getTypeId(resultId); } Id getDerefTypeId(Id resultId) const; - OpCode getOpCode(Id id) const { return module.getInstruction(id)->getOpCode(); } - OpCode getTypeClass(Id typeId) const { return getOpCode(typeId); } - OpCode getMostBasicTypeClass(Id typeId) const; + Op getOpCode(Id id) const { return module.getInstruction(id)->getOpCode(); } + Op getTypeClass(Id typeId) const { return getOpCode(typeId); } + Op getMostBasicTypeClass(Id typeId) const; int getNumComponents(Id resultId) const { return getNumTypeComponents(getTypeId(resultId)); } int getNumTypeComponents(Id typeId) const; Id getScalarTypeId(Id typeId) const; @@ -151,10 +151,10 @@ public: } int getNumRows(Id resultId) const { return getTypeNumRows(getTypeId(resultId)); } - Dimensionality getDimensionality(Id resultId) const + Dim getDimensionality(Id resultId) const { assert(isSamplerType(getTypeId(resultId))); - return (Dimensionality)module.getInstruction(getTypeId(resultId))->getImmediateOperand(1); + return (Dim)module.getInstruction(getTypeId(resultId))->getImmediateOperand(1); } bool isArrayedSampler(Id resultId) const { @@ -228,14 +228,14 @@ public: Id createCompositeInsert(Id object, Id composite, Id typeId, unsigned index); Id createCompositeInsert(Id object, Id composite, Id typeId, std::vector& indexes); - void createNoResultOp(OpCode); - void createNoResultOp(OpCode, Id operand); + void createNoResultOp(Op); + void createNoResultOp(Op, Id operand); void createControlBarrier(unsigned executionScope); void createMemoryBarrier(unsigned executionScope, unsigned memorySemantics); - Id createUnaryOp(OpCode, Id typeId, Id operand); - Id createBinOp(OpCode, Id typeId, Id operand1, Id operand2); - Id createTriOp(OpCode, Id typeId, Id operand1, Id operand2, Id operand3); - Id createTernaryOp(OpCode, Id typeId, Id operand1, Id operand2, Id operand3); + Id createUnaryOp(Op, Id typeId, Id operand); + Id createBinOp(Op, Id typeId, Id operand1, Id operand2); + Id createTriOp(Op, Id typeId, Id operand1, Id operand2, Id operand3); + Id createTernaryOp(Op, Id typeId, Id operand1, Id operand2, Id operand3); Id createFunctionCall(spv::Function*, std::vector&); // Take an rvalue (source) and a set of channels to extract from it to @@ -289,7 +289,7 @@ public: // Emit the OpTextureQuery* instruction that was passed in. // Figure out the right return value and type, and return it. - Id createTextureQueryCall(OpCode, const TextureParameters&); + Id createTextureQueryCall(Op, const TextureParameters&); Id createSamplePositionCall(Decoration precision, Id, Id); @@ -461,13 +461,13 @@ public: void dump(std::vector&) const; protected: - Id findScalarConstant(OpCode typeClass, Id typeId, unsigned value) const; - Id findCompositeConstant(OpCode typeClass, std::vector& comps) const; + Id findScalarConstant(Op typeClass, Id typeId, unsigned value) const; + Id findCompositeConstant(Op typeClass, std::vector& comps) const; Id collapseAccessChain(); void simplifyAccessChainSwizzle(); void createAndSetNoPredecessorBlock(const char*); void createBranch(Block* block); - void createMerge(OpCode, Block*, unsigned int control); + void createMerge(Op, Block*, unsigned int control); void createConditionalBranch(Id condition, Block* thenBlock, Block* elseBlock); void dumpInstructions(std::vector&, const std::vector&) const; diff --git a/SPIRV/disassemble.cpp b/SPIRV/disassemble.cpp index 35591b71..3daff74c 100644 --- a/SPIRV/disassemble.cpp +++ b/SPIRV/disassemble.cpp @@ -40,10 +40,11 @@ // Disassembler for SPIR-V. // +#include +#include #include #include #include -#include "stdlib.h" #include "GLSL450Lib.h" extern const char* GlslStd450DebugNames[GLSL_STD_450::Count]; @@ -69,7 +70,7 @@ public: void processInstructions(); protected: - OpCode getOpCode(int id) const { return idInstruction[id] ? (OpCode)(stream[idInstruction[id]] & OpCodeMask) : OpNop; } + Op getOpCode(int id) const { return idInstruction[id] ? (Op)(stream[idInstruction[id]] & OpCodeMask) : OpNop; } // Output methods void outputIndent(); @@ -80,7 +81,7 @@ protected: void disassembleImmediates(int numOperands); void disassembleIds(int numOperands); void disassembleString(); - void disassembleInstruction(Id resultId, Id typeId, OpCode opCode, int numOperands); + void disassembleInstruction(Id resultId, Id typeId, Op opCode, int numOperands); // Data std::ostream& out; // where to write the disassembly @@ -144,7 +145,7 @@ void SpirvStream::processInstructions() // Instruction wordCount and opcode unsigned int firstWord = stream[word]; unsigned wordCount = firstWord >> WordCountShift; - OpCode opCode = (OpCode)(firstWord & OpCodeMask); + Op opCode = (Op)(firstWord & OpCodeMask); int nextInst = word + wordCount; ++word; @@ -176,7 +177,7 @@ void SpirvStream::processInstructions() outputTypeId(typeId); outputIndent(); - // Hand off the OpCode and all its operands + // Hand off the Op and all its operands disassembleInstruction(resultId, typeId, opCode, numOperands); if (word != nextInst) { out << " ERROR, incorrect number of operands consumed. At " << word << " instead of " << nextInst << " instruction start was " << instructionStart; @@ -277,14 +278,11 @@ void SpirvStream::disassembleString() out << "\""; } -void SpirvStream::disassembleInstruction(Id resultId, Id typeId, OpCode opCode, int numOperands) +void SpirvStream::disassembleInstruction(Id resultId, Id typeId, Op opCode, int numOperands) { // Process the opcode - if (opCode < 0 || opCode >= OpCount) - Kill(out, "Bad opcode"); - else - out << InstructionDesc[opCode].opName + 2; // Skip the "Op" + out << (OpcodeString(opCode) + 2); // leave out the "Op" if (opCode == OpLoopMerge || opCode == OpSelectionMerge) nextNestedControl = stream[word]; @@ -339,7 +337,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id typeId, OpCode opCode, // Handle textures specially, so can put out helpful strings. if (opCode == OpTypeSampler) { disassembleIds(1); - out << " " << DimensionString((Dimensionality)stream[word++]); + out << " " << DimensionString((Dim)stream[word++]); switch (stream[word++]) { case 0: out << " texture"; break; case 1: out << " image"; break; @@ -354,7 +352,8 @@ void SpirvStream::disassembleInstruction(Id resultId, Id typeId, OpCode opCode, // Handle all the parameterized operands for (int op = 0; op < InstructionDesc[opCode].operands.getNum(); ++op) { out << " "; - switch (InstructionDesc[opCode].operands.getClass(op)) { + OperandClass operandClass = InstructionDesc[opCode].operands.getClass(op); + switch (operandClass) { case OperandId: disassembleIds(1); // Get names for printing "(XXX)" for readability, *after* this id @@ -366,7 +365,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id typeId, OpCode opCode, disassembleIds(numOperands); return; case OperandVariableLiterals: - if (opCode == OpDecorate && stream[word - 1] == DecBuiltIn) { + if (opCode == OpDecorate && stream[word - 1] == DecorationBuiltIn) { out << BuiltInString(stream[word++]); --numOperands; ++op; @@ -376,8 +375,8 @@ void SpirvStream::disassembleInstruction(Id resultId, Id typeId, OpCode opCode, case OperandVariableLiteralId: while (numOperands > 0) { out << std::endl; - outputResultId(NoResult); - outputTypeId(NoType); + outputResultId(0); + outputTypeId(0); outputIndent(); out << " case "; disassembleImmediates(1); @@ -397,76 +396,23 @@ void SpirvStream::disassembleInstruction(Id resultId, Id typeId, OpCode opCode, case OperandLiteralString: disassembleString(); return; - case OperandSource: - out << SourceString((SourceLanguage)stream[word++]); - break; - case OperandExecutionModel: - out << ExecutionModelString((ExecutionModel)stream[word++]); - break; - case OperandAddressing: - out << AddressingString((AddressingModel)stream[word++]); - break; - case OperandMemory: - out << MemoryString((MemoryModel)stream[word++]); - break; - case OperandExecutionMode: - out << ExecutionModeString((ExecutionMode)stream[word++]); - break; - case OperandStorage: - out << StorageClassString((StorageClass)stream[word++]); - break; - case OperandDimensionality: - out << DimensionString((Dimensionality)stream[word++]); - break; - case OperandDecoration: - out << DecorationString((Decoration)stream[word++]); - break; - case OperandBuiltIn: - out << BuiltInString((BuiltIn)stream[word++]); - break; - case OperandSelect: - out << SelectControlString((SelectControl)stream[word++]); - break; - case OperandLoop: - out << LoopControlString((LoopControl)stream[word++]); - break; - case OperandFunction: - { - unsigned int control = stream[word++]; - if (control == 0) - out << FunctionControlString(control); - else { - for (int m = 0; m < FunctionControlCount; ++m) { - if (control & (1 << m)) - out << FunctionControlString(m); - } - } - break; - } - case OperandMemorySemantics: - for (int shift = 0; shift < MemorySemanticsCount; ++shift) { - unsigned lit = (stream[word] & (1 << shift)); - if (lit) - out << MemorySemanticsString(lit) << " "; - } - word++; - break; - case OperandMemoryAccess: - out << MemoryAccessString(stream[word++]); - break; - case OperandExecutionScope: - out << ExecutionScopeString(stream[word++]); - break; - case OperandGroupOperation: - out << GroupOperationString(stream[word++]); - break; - case OperandKernelEnqueueFlags: - out << KernelEnqueueFlagsString(stream[word++]); - break; - case OperandKernelProfilingInfo: - out << KernelProfilingInfoString(stream[word++]); - break; default: + assert(operandClass >= OperandSource && operandClass < OperandOpcode); + + if (OperandClassParams[operandClass].bitmask) { + unsigned int mask = stream[word++]; + if (mask == 0) + out << "None"; + else { + for (int m = 0; m < OperandClassParams[operandClass].ceiling; ++m) { + if (mask & (1 << m)) + out << OperandClassParams[operandClass].getName(m) << " "; + } + } + break; + } else + out << OperandClassParams[operandClass].getName(stream[word++]); + break; } --numOperands; diff --git a/SPIRV/doc.cpp b/SPIRV/doc.cpp index d6fe37ba..4281bfa9 100644 --- a/SPIRV/doc.cpp +++ b/SPIRV/doc.cpp @@ -37,10 +37,11 @@ // // -// Programmatically fill in instruction/operand information. +// 1) Programatically fill in instruction/operand information. +// This can be used for disassembly, printing documentation, etc. +// +// 2) Print documentation from this parameterization. // - -#include "spirv.h" #include "doc.h" @@ -48,15 +49,824 @@ #include #include -#define LINE_BREAK " +\n" -#define GAP " +\n +\n" -#define NOTE GAP "*Note:* " - namespace spv { +// +// Whole set of functions that translate enumerants to their text strings for +// the specification (or their sanitized versions for auto-generating the +// spirv.h header. +// +// Also, the ceilings are declared next to these, to help keep them in sync. +// Ceilings should be +// - one more than the maximum value an enumerant takes on, for non-mask enumerants +// (for non-sparse enums, this is the number of enumurants) +// - the number of bits consumed by the set of masks +// (for non-sparse mask enums, this is the number of enumurants) +// + +const int SourceLanguageCeiling = 4; + +const char* SourceString(int source) +{ + switch (source) { + case 0: return "Unknown"; + case 1: return "ESSL"; + case 2: return "GLSL"; + case 3: return "OpenCL"; + + case SourceLanguageCeiling: + default: return "Bad"; + } +} + +const int ExecutionModelCeiling = 7; + +const char* ExecutionModelString(int model) +{ + switch (model) { + case 0: return "Vertex"; + case 1: return "TessellationControl"; + case 2: return "TessellationEvaluation"; + case 3: return "Geometry"; + case 4: return "Fragment"; + case 5: return "GLCompute"; + case 6: return "Kernel"; + + case ExecutionModelCeiling: + default: return "Bad"; + } +} + +const int AddressingModelCeiling = 3; + +const char* AddressingString(int addr) +{ + switch (addr) { + case 0: return "Logical"; + case 1: return "Physical32"; + case 2: return "Physical64"; + + case AddressingModelCeiling: + default: return "Bad"; + } +} + +const int MemoryModelCeiling = 5; + +const char* MemoryString(int mem) +{ + switch (mem) { + case 0: return "Simple"; + case 1: return "GLSL450"; + case 2: return "OpenCL1.2"; + case 3: return "OpenCL2.0"; + case 4: return "OpenCL2.1"; + + case MemoryModelCeiling: + default: return "Bad"; + } +} + +const int ExecutionModeCeiling = 31; + +const char* ExecutionModeString(int mode) +{ + switch (mode) { + case 0: return "Invocations"; + case 1: return "SpacingEqual"; + case 2: return "SpacingFractionalEven"; + case 3: return "SpacingFractionalOdd"; + case 4: return "VertexOrderCw"; + case 5: return "VertexOrderCcw"; + case 6: return "PixelCenterInteger"; + case 7: return "OriginUpperLeft"; + case 8: return "EarlyFragmentTests"; + case 9: return "PointMode"; + case 10: return "Xfb"; + case 11: return "DepthReplacing"; + case 12: return "DepthAny"; + case 13: return "DepthGreater"; + case 14: return "DepthLess"; + case 15: return "DepthUnchanged"; + case 16: return "LocalSize"; + case 17: return "LocalSizeHint"; + case 18: return "InputPoints"; + case 19: return "InputLines"; + case 20: return "InputLinesAdjacency"; + case 21: return "InputTriangles"; + case 22: return "InputTrianglesAdjacency"; + case 23: return "InputQuads"; + case 24: return "InputIsolines"; + case 25: return "OutputVertices"; + case 26: return "OutputPoints"; + case 27: return "OutputLineStrip"; + case 28: return "OutputTriangleStrip"; + case 29: return "VecTypeHint"; + case 30: return "ContractionOff"; + + case ExecutionModeCeiling: + default: return "Bad"; + } +} + +const int StorageClassCeiling = 11; + +const char* StorageClassString(int StorageClass) +{ + switch (StorageClass) { + case 0: return "UniformConstant"; + case 1: return "Input"; + case 2: return "Uniform"; + case 3: return "Output"; + case 4: return "WorkgroupLocal"; + case 5: return "WorkgroupGlobal"; + case 6: return "PrivateGlobal"; + case 7: return "Function"; + case 8: return "Generic"; + case 9: return "Private"; + case 10: return "AtomicCounter"; + + case StorageClassCeiling: + default: return "Bad"; + } +} + +const int DecorationCeiling = 45; + +const char* DecorationString(int decoration) +{ + switch (decoration) { + case 0: return "PrecisionLow"; + case 1: return "PrecisionMedium"; + case 2: return "PrecisionHigh"; + case 3: return "Block"; + case 4: return "BufferBlock"; + case 5: return "RowMajor"; + case 6: return "ColMajor"; + case 7: return "GLSLShared"; + case 8: return "GLSLStd140"; + case 9: return "GLSLStd430"; + case 10: return "GLSLPacked"; + case 11: return "Smooth"; + case 12: return "Noperspective"; + case 13: return "Flat"; + case 14: return "Patch"; + case 15: return "Centroid"; + case 16: return "Sample"; + case 17: return "Invariant"; + case 18: return "Restrict"; + case 19: return "Aliased"; + case 20: return "Volatile"; + case 21: return "Constant"; + case 22: return "Coherent"; + case 23: return "Nonwritable"; + case 24: return "Nonreadable"; + case 25: return "Uniform"; + case 26: return "NoStaticUse"; + case 27: return "CPacked"; + case 28: return "SaturatedConversion"; + case 29: return "Stream"; + case 30: return "Location"; + case 31: return "Component"; + case 32: return "Index"; + case 33: return "Binding"; + case 34: return "DescriptorSet"; + case 35: return "Offset"; + case 36: return "Alignment"; + case 37: return "XfbBuffer"; + case 38: return "Stride"; + case 39: return "BuiltIn"; + case 40: return "FuncParamAttr"; + case 41: return "FP Rounding Mode"; + case 42: return "FP Fast Math Mode"; + case 43: return "Linkage Attributes"; + case 44: return "SpecId"; + + case DecorationCeiling: + default: return "Bad"; + } +} + +const int BuiltInCeiling = 42; + +const char* BuiltInString(int builtIn) +{ + switch (builtIn) { + case 0: return "Position"; + case 1: return "PointSize"; + case 2: return "ClipVertex"; + case 3: return "ClipDistance"; + case 4: return "CullDistance"; + case 5: return "VertexId"; + case 6: return "InstanceId"; + case 7: return "PrimitiveId"; + case 8: return "InvocationId"; + case 9: return "Layer"; + case 10: return "ViewportIndex"; + case 11: return "TessLevelOuter"; + case 12: return "TessLevelInner"; + case 13: return "TessCoord"; + case 14: return "PatchVertices"; + case 15: return "FragCoord"; + case 16: return "PointCoord"; + case 17: return "FrontFacing"; + case 18: return "SampleId"; + case 19: return "SamplePosition"; + case 20: return "SampleMask"; + case 21: return "FragColor"; + case 22: return "FragDepth"; + case 23: return "HelperInvocation"; + case 24: return "NumWorkgroups"; + case 25: return "WorkgroupSize"; + case 26: return "WorkgroupId"; + case 27: return "LocalInvocationId"; + case 28: return "GlobalInvocationId"; + case 29: return "LocalInvocationIndex"; + case 30: return "WorkDim"; + case 31: return "GlobalSize"; + case 32: return "EnqueuedWorkgroupSize"; + case 33: return "GlobalOffset"; + case 34: return "GlobalLinearId"; + case 35: return "WorkgroupLinearId"; + case 36: return "SubgroupSize"; + case 37: return "SubgroupMaxSize"; + case 38: return "NumSubgroups"; + case 39: return "NumEnqueuedSubgroups"; + case 40: return "SubgroupId"; + case 41: return "SubgroupLocalInvocationId"; + + case BuiltInCeiling: + default: return "Bad"; + } +} + +const int DimensionCeiling = 6; + +const char* DimensionString(int dim) +{ + switch (dim) { + case 0: return "1D"; + case 1: return "2D"; + case 2: return "3D"; + case 3: return "Cube"; + case 4: return "Rect"; + case 5: return "Buffer"; + + case DimensionCeiling: + default: return "Bad"; + } +} + +const int SamplerAddressingModeCeiling = 9; + +const char* SamplerAddressingModeString(int mode) +{ + switch (mode) { + case 0: return "None"; + case 2: return "ClampToEdge"; + case 4: return "Clamp"; + case 6: return "Repeat"; + case 8: return "RepeatMirrored"; + + case SamplerAddressingModeCeiling: + default: return "Bad"; + } +} + +const int SamplerFilterModeCeiling = 0x21; + +const char* SamplerFilterModeString(int mode) +{ + switch (mode) { + case 0x10: return "Nearest"; + case 0x20: return "Linear"; + + case SamplerFilterModeCeiling: + default: return "Bad"; + } +} + +const int FPFastMathCeiling = 5; + +const char* FPFastMathString(int mode) +{ + switch (mode) { + case 0: return "NotNaN"; + case 1: return "NotInf"; + case 2: return "NSZ"; + case 3: return "AllowRecip"; + case 4: return "Fast"; + + case FPFastMathCeiling: + default: return "Bad"; + } +} + +const int FPRoundingModeCeiling = 4; + +const char* FPRoundingModeString(int mode) +{ + switch (mode) { + case 0: return "RTE"; + case 1: return "RTZ"; + case 2: return "RTP"; + case 3: return "RTN"; + + case FPRoundingModeCeiling: + default: return "Bad"; + } +} + +const int LinkageTypeCeiling = 2; + +const char* LinkageTypeString(int type) +{ + switch (type) { + case 0: return "Export"; + case 1: return "Import"; + + case LinkageTypeCeiling: + default: return "Bad"; + } +} + +const int FuncParamAttrCeiling = 9; + +const char* FuncParamAttrString(int attr) +{ + switch (attr) { + case 0: return "Zext"; + case 1: return "Sext"; + case 2: return "ByVal"; + case 3: return "Sret"; + case 4: return "NoAlias"; + case 5: return "NoCapture"; + case 6: return "SVM"; + case 7: return "NoWrite"; + case 8: return "NoReadWrite"; + + case FuncParamAttrCeiling: + default: return "Bad"; + } +} + +const int AccessQualifierCeiling = 3; + +const char* AccessQualifierString(int attr) +{ + switch (attr) { + case 0: return "ReadOnly"; + case 1: return "WriteOnly"; + case 2: return "ReadWrite"; + + case AccessQualifierCeiling: + default: return "Bad"; + } +} + +const int SelectControlCeiling = 2; + +const char* SelectControlString(int cont) +{ + switch (cont) { + case 0: return "Flatten"; + case 1: return "DontFlatten"; + + case SelectControlCeiling: + default: return "Bad"; + } +} + +const int LoopControlCeiling = 2; + +const char* LoopControlString(int cont) +{ + switch (cont) { + case 0: return "Unroll"; + case 1: return "DontUnroll"; + + case LoopControlCeiling: + default: return "Bad"; + } +} + +const int FunctionControlCeiling = 4; + +const char* FunctionControlString(int cont) +{ + switch (cont) { + case 0: return "Inline"; + case 1: return "DontInline"; + case 2: return "Pure"; + case 3: return "Const"; + + case FunctionControlCeiling: + default: return "Bad"; + } +} + +const int MemorySemanticsCeiling = 10; + +const char* MemorySemanticsString(int mem) +{ + switch (mem) { + case 0: return "Relaxed"; + case 1: return "SequentiallyConsistent"; + case 2: return "Acquire"; + case 3: return "Release"; + + case 4: return "UniformMemory"; + case 5: return "SubgroupMemory"; + case 6: return "WorkgroupLocalMemory"; + case 7: return "WorkgroupGlobalMemory"; + case 8: return "AtomicCounterMemory"; + case 9: return "ImageMemory"; + + case MemorySemanticsCeiling: + default: return "Bad"; + } +} + +const int MemoryAccessCeiling = 2; + +const char* MemoryAccessString(int mem) +{ + switch (mem) { + case 0: return "Volatile"; + case 1: return "Aligned"; + + case MemoryAccessCeiling: + default: return "Bad"; + } +} + +const int ExecutionScopeCeiling = 4; + +const char* ExecutionScopeString(int mem) +{ + switch (mem) { + case 0: return "CrossDevice"; + case 1: return "Device"; + case 2: return "Workgroup"; + case 3: return "Subgroup"; + + case ExecutionScopeCeiling: + default: return "Bad"; + } +} + +const int GroupOperationCeiling = 3; + +const char* GroupOperationString(int gop) +{ + + switch (gop) + { + case 0: return "Reduce"; + case 1: return "InclusiveScan"; + case 2: return "ExclusiveScan"; + + case GroupOperationCeiling: + default: return "Bad"; + } +} + +const int KernelEnqueueFlagsCeiling = 3; + +const char* KernelEnqueueFlagsString(int flag) +{ + switch (flag) + { + case 0: return "NoWait"; + case 1: return "WaitKernel"; + case 2: return "WaitWorkGroup"; + + case KernelEnqueueFlagsCeiling: + default: return "Bad"; + } +} + +const int KernelProfilingInfoCeiling = 1; + +const char* KernelProfilingInfoString(int info) +{ + switch (info) + { + case 0: return "CmdExecTime"; + + case KernelProfilingInfoCeiling: + default: return "Bad"; + } +} + +const char* OpcodeString(int op) +{ + switch (op) { + case 0: return "OpNop"; + case 1: return "OpSource"; + case 2: return "OpSourceExtension"; + case 3: return "OpExtension"; + case 4: return "OpExtInstImport"; + case 5: return "OpMemoryModel"; + case 6: return "OpEntryPoint"; + case 7: return "OpExecutionMode"; + case 8: return "OpTypeVoid"; + case 9: return "OpTypeBool"; + case 10: return "OpTypeInt"; + case 11: return "OpTypeFloat"; + case 12: return "OpTypeVector"; + case 13: return "OpTypeMatrix"; + case 14: return "OpTypeSampler"; + case 15: return "OpTypeFilter"; + case 16: return "OpTypeArray"; + case 17: return "OpTypeRuntimeArray"; + case 18: return "OpTypeStruct"; + case 19: return "OpTypeOpaque"; + case 20: return "OpTypePointer"; + case 21: return "OpTypeFunction"; + case 22: return "OpTypeEvent"; + case 23: return "OpTypeDeviceEvent"; + case 24: return "OpTypeReserveId"; + case 25: return "OpTypeQueue"; + case 26: return "OpTypePipe"; + case 27: return "OpConstantTrue"; + case 28: return "OpConstantFalse"; + case 29: return "OpConstant"; + case 30: return "OpConstantComposite"; + case 31: return "OpConstantSampler"; + case 32: return "OpConstantNullPointer"; + case 33: return "OpConstantNullObject"; + case 34: return "OpSpecConstantTrue"; + case 35: return "OpSpecConstantFalse"; + case 36: return "OpSpecConstant"; + case 37: return "OpSpecConstantComposite"; + case 38: return "OpVariable"; + case 39: return "OpVariableArray"; + case 40: return "OpFunction"; + case 41: return "OpFunctionParameter"; + case 42: return "OpFunctionEnd"; + case 43: return "OpFunctionCall"; + case 44: return "OpExtInst"; + case 45: return "OpUndef"; + case 46: return "OpLoad"; + case 47: return "OpStore"; + case 48: return "OpPhi"; + case 49: return "OpDecorationGroup"; + case 50: return "OpDecorate"; + case 51: return "OpMemberDecorate"; + case 52: return "OpGroupDecorate"; + case 53: return "OpGroupMemberDecorate"; + case 54: return "OpName"; + case 55: return "OpMemberName"; + case 56: return "OpString"; + case 57: return "OpLine"; + case 58: return "OpVectorExtractDynamic"; + case 59: return "OpVectorInsertDynamic"; + case 60: return "OpVectorShuffle"; + case 61: return "OpCompositeConstruct"; + case 62: return "OpCompositeExtract"; + case 63: return "OpCompositeInsert"; + case 64: return "OpCopyObject"; + case 65: return "OpCopyMemory"; + case 66: return "OpCopyMemorySized"; + case 67: return "OpSampler"; + case 68: return "OpTextureSample"; + case 69: return "OpTextureSampleDref"; + case 70: return "OpTextureSampleLod"; + case 71: return "OpTextureSampleProj"; + case 72: return "OpTextureSampleGrad"; + case 73: return "OpTextureSampleOffset"; + case 74: return "OpTextureSampleProjLod"; + case 75: return "OpTextureSampleProjGrad"; + case 76: return "OpTextureSampleLodOffset"; + case 77: return "OpTextureSampleProjOffset"; + case 78: return "OpTextureSampleGradOffset"; + case 79: return "OpTextureSampleProjLodOffset"; + case 80: return "OpTextureSampleProjGradOffset"; + case 81: return "OpTextureFetchTexelLod"; + case 82: return "OpTextureFetchTexelOffset"; + case 83: return "OpTextureFetchSample"; + case 84: return "OpTextureFetchTexel"; + case 85: return "OpTextureGather"; + case 86: return "OpTextureGatherOffset"; + case 87: return "OpTextureGatherOffsets"; + case 88: return "OpTextureQuerySizeLod"; + case 89: return "OpTextureQuerySize"; + case 90: return "OpTextureQueryLod"; + case 91: return "OpTextureQueryLevels"; + case 92: return "OpTextureQuerySamples"; + case 93: return "OpAccessChain"; + case 94: return "OpInBoundsAccessChain"; + case 95: return "OpSNegate"; + case 96: return "OpFNegate"; + case 97: return "OpNot"; + case 98: return "OpAny"; + case 99: return "OpAll"; + case 100: return "OpConvertFToU"; + case 101: return "OpConvertFToS"; + case 102: return "OpConvertSToF"; + case 103: return "OpConvertUToF"; + case 104: return "OpUConvert"; + case 105: return "OpSConvert"; + case 106: return "OpFConvert"; + case 107: return "OpConvertPtrToU"; + case 108: return "OpConvertUToPtr"; + case 109: return "OpPtrCastToGeneric"; + case 110: return "OpGenericCastToPtr"; + case 111: return "OpBitcast"; + case 112: return "OpTranspose"; + case 113: return "OpIsNan"; + case 114: return "OpIsInf"; + case 115: return "OpIsFinite"; + case 116: return "OpIsNormal"; + case 117: return "OpSignBitSet"; + case 118: return "OpLessOrGreater"; + case 119: return "OpOrdered"; + case 120: return "OpUnordered"; + case 121: return "OpArrayLength"; + case 122: return "OpIAdd"; + case 123: return "OpFAdd"; + case 124: return "OpISub"; + case 125: return "OpFSub"; + case 126: return "OpIMul"; + case 127: return "OpFMul"; + case 128: return "OpUDiv"; + case 129: return "OpSDiv"; + case 130: return "OpFDiv"; + case 131: return "OpUMod"; + case 132: return "OpSRem"; + case 133: return "OpSMod"; + case 134: return "OpFRem"; + case 135: return "OpFMod"; + case 136: return "OpVectorTimesScalar"; + case 137: return "OpMatrixTimesScalar"; + case 138: return "OpVectorTimesMatrix"; + case 139: return "OpMatrixTimesVector"; + case 140: return "OpMatrixTimesMatrix"; + case 141: return "OpOuterProduct"; + case 142: return "OpDot"; + case 143: return "OpShiftRightLogical"; + case 144: return "OpShiftRightArithmetic"; + case 145: return "OpShiftLeftLogical"; + case 146: return "OpLogicalOr"; + case 147: return "OpLogicalXor"; + case 148: return "OpLogicalAnd"; + case 149: return "OpBitwiseOr"; + case 150: return "OpBitwiseXor"; + case 151: return "OpBitwiseAnd"; + case 152: return "OpSelect"; + case 153: return "OpIEqual"; + case 154: return "OpFOrdEqual"; + case 155: return "OpFUnordEqual"; + case 156: return "OpINotEqual"; + case 157: return "OpFOrdNotEqual"; + case 158: return "OpFUnordNotEqual"; + case 159: return "OpULessThan"; + case 160: return "OpSLessThan"; + case 161: return "OpFOrdLessThan"; + case 162: return "OpFUnordLessThan"; + case 163: return "OpUGreaterThan"; + case 164: return "OpSGreaterThan"; + case 165: return "OpFOrdGreaterThan"; + case 166: return "OpFUnordGreaterThan"; + case 167: return "OpULessThanEqual"; + case 168: return "OpSLessThanEqual"; + case 169: return "OpFOrdLessThanEqual"; + case 170: return "OpFUnordLessThanEqual"; + case 171: return "OpUGreaterThanEqual"; + case 172: return "OpSGreaterThanEqual"; + case 173: return "OpFOrdGreaterThanEqual"; + case 174: return "OpFUnordGreaterThanEqual"; + case 175: return "OpDPdx"; + case 176: return "OpDPdy"; + case 177: return "OpFwidth"; + case 178: return "OpDPdxFine"; + case 179: return "OpDPdyFine"; + case 180: return "OpFwidthFine"; + case 181: return "OpDPdxCoarse"; + case 182: return "OpDPdyCoarse"; + case 183: return "OpFwidthCoarse"; + case 184: return "OpEmitVertex"; + case 185: return "OpEndPrimitive"; + case 186: return "OpEmitStreamVertex"; + case 187: return "OpEndStreamPrimitive"; + case 188: return "OpControlBarrier"; + case 189: return "OpMemoryBarrier"; + case 190: return "OpImagePointer"; + case 191: return "OpAtomicInit"; + case 192: return "OpAtomicLoad"; + case 193: return "OpAtomicStore"; + case 194: return "OpAtomicExchange"; + case 195: return "OpAtomicCompareExchange"; + case 196: return "OpAtomicCompareExchangeWeak"; + case 197: return "OpAtomicIIncrement"; + case 198: return "OpAtomicIDecrement"; + case 199: return "OpAtomicIAdd"; + case 200: return "OpAtomicISub"; + case 201: return "OpAtomicUMin"; + case 202: return "OpAtomicUMax"; + case 203: return "OpAtomicAnd"; + case 204: return "OpAtomicOr"; + case 205: return "OpAtomicXor"; + case 206: return "OpLoopMerge"; + case 207: return "OpSelectionMerge"; + case 208: return "OpLabel"; + case 209: return "OpBranch"; + case 210: return "OpBranchConditional"; + case 211: return "OpSwitch"; + case 212: return "OpKill"; + case 213: return "OpReturn"; + case 214: return "OpReturnValue"; + case 215: return "OpUnreachable"; + case 216: return "OpLifetimeStart"; + case 217: return "OpLifetimeStop"; + case 218: return "OpCompileFlag"; + case 219: return "OpAsyncGroupCopy"; + case 220: return "OpWaitGroupEvents"; + case 221: return "OpGroupAll"; + case 222: return "OpGroupAny"; + case 223: return "OpGroupBroadcast"; + case 224: return "OpGroupIAdd"; + case 225: return "OpGroupFAdd"; + case 226: return "OpGroupFMin"; + case 227: return "OpGroupUMin"; + case 228: return "OpGroupSMin"; + case 229: return "OpGroupFMax"; + case 230: return "OpGroupUMax"; + case 231: return "OpGroupSMax"; + case 232: return "OpGenericCastToPtrExplicit"; + case 233: return "OpGenericPtrMemSemantics"; + case 234: return "OpReadPipe"; + case 235: return "OpWritePipe"; + case 236: return "OpReservedReadPipe"; + case 237: return "OpReservedWritePipe"; + case 238: return "OpReserveReadPipePackets"; + case 239: return "OpReserveWritePipePackets"; + case 240: return "OpCommitReadPipe"; + case 241: return "OpCommitWritePipe"; + case 242: return "OpIsValidReserveId"; + case 243: return "OpGetNumPipePackets"; + case 244: return "OpGetMaxPipePackets"; + case 245: return "OpGroupReserveReadPipePackets"; + case 246: return "OpGroupReserveWritePipePackets"; + case 247: return "OpGroupCommitReadPipe"; + case 248: return "OpGroupCommitWritePipe"; + case 249: return "OpEnqueueMarker"; + case 250: return "OpEnqueueKernel"; + case 251: return "OpGetKernelNDrangeSubGroupCount"; + case 252: return "OpGetKernelNDrangeMaxSubGroupSize"; + case 253: return "OpGetKernelWorkGroupSize"; + case 254: return "OpGetKernelPreferredWorkGroupSizeMultiple"; + case 255: return "OpRetainEvent"; + case 256: return "OpReleaseEvent"; + case 257: return "OpCreateUserEvent"; + case 258: return "OpIsValidEvent"; + case 259: return "OpSetUserEventStatus"; + case 260: return "OpCaptureEventProfilingInfo"; + case 261: return "OpGetDefaultQueue"; + case 262: return "OpBuildNDRange"; + case 263: return "OpSatConvertSToU"; + case 264: return "OpSatConvertUToS"; + case 265: return "OpAtomicIMin"; + case 266: return "OpAtomicIMax"; + + case OpcodeCeiling: + default: + return "Bad"; + } +} + // The set of objects that hold all the instruction/operand // parameterization information. -InstructionParameters InstructionDesc[spv::OpCount]; +InstructionParameters InstructionDesc[OpcodeCeiling]; +OperandParameters ExecutionModeOperands[ExecutionModeCeiling]; +OperandParameters DecorationOperands[DecorationCeiling]; + +EnumDefinition OperandClassParams[OperandCount]; +EnumParameters ExecutionModelParams[ExecutionModelCeiling]; +EnumParameters AddressingParams[AddressingModelCeiling]; +EnumParameters MemoryParams[MemoryModelCeiling]; +EnumParameters ExecutionModeParams[ExecutionModeCeiling]; +EnumParameters StorageParams[StorageClassCeiling]; +EnumParameters SamplerAddressingModeParams[SamplerAddressingModeCeiling]; +EnumParameters SamplerFilterModeParams[SamplerFilterModeCeiling]; +EnumParameters FPFastMathParams[FPFastMathCeiling]; +EnumParameters FPRoundingModeParams[FPRoundingModeCeiling]; +EnumParameters LinkageTypeParams[LinkageTypeCeiling]; +EnumParameters DecorationParams[DecorationCeiling]; +EnumParameters BuiltInParams[BuiltInCeiling]; +EnumParameters DimensionalityParams[DimensionCeiling]; +EnumParameters FuncParamAttrParams[FuncParamAttrCeiling]; +EnumParameters AccessQualifierParams[AccessQualifierCeiling]; +EnumParameters GroupOperationParams[GroupOperationCeiling]; +EnumParameters LoopControlParams[FunctionControlCeiling]; +EnumParameters SelectionControlParams[SelectControlCeiling]; +EnumParameters FunctionControlParams[FunctionControlCeiling]; +EnumParameters MemorySemanticsParams[MemorySemanticsCeiling]; +EnumParameters MemoryAccessParams[MemoryAccessCeiling]; +EnumParameters ExecutionScopeParams[ExecutionScopeCeiling]; +EnumParameters KernelEnqueueFlagsParams[KernelEnqueueFlagsCeiling]; +EnumParameters KernelProfilingInfoParams[KernelProfilingInfoCeiling]; // Set up all the parameterizing descriptions of the opcodes, operands, etc. void Parameterize() @@ -64,77 +874,68 @@ void Parameterize() // Exceptions to having a result and a resulting type . // (Everything is initialized to have both). - InstructionDesc[OpNop] .setResultAndType(false, false); - InstructionDesc[OpSource] .setResultAndType(false, false); + InstructionDesc[OpNop].setResultAndType(false, false); + InstructionDesc[OpSource].setResultAndType(false, false); InstructionDesc[OpSourceExtension].setResultAndType(false, false); - InstructionDesc[OpExtension] .setResultAndType(false, false); - InstructionDesc[OpExtInstImport] .setResultAndType(true, false); - InstructionDesc[OpMemoryModel] .setResultAndType(false, false); - InstructionDesc[OpEntryPoint] .setResultAndType(false, false); - InstructionDesc[OpExecutionMode] .setResultAndType(false, false); - - InstructionDesc[OpTypeVoid] .setResultAndType(true, false); - InstructionDesc[OpTypeBool] .setResultAndType(true, false); - InstructionDesc[OpTypeInt] .setResultAndType(true, false); - InstructionDesc[OpTypeFloat] .setResultAndType(true, false); - InstructionDesc[OpTypeVector] .setResultAndType(true, false); - InstructionDesc[OpTypeMatrix] .setResultAndType(true, false); - InstructionDesc[OpTypeSampler] .setResultAndType(true, false); - InstructionDesc[OpTypeFilter] .setResultAndType(true, false); - InstructionDesc[OpTypeArray] .setResultAndType(true, false); - InstructionDesc[OpTypeRuntimeArray].setResultAndType(true, false); - InstructionDesc[OpTypeStruct] .setResultAndType(true, false); - InstructionDesc[OpTypeOpaque] .setResultAndType(true, false); - InstructionDesc[OpTypePointer] .setResultAndType(true, false); - InstructionDesc[OpTypeFunction] .setResultAndType(true, false); - - InstructionDesc[OpTypeEvent] .setResultAndType(true, false); - InstructionDesc[OpTypeDeviceEvent] .setResultAndType(true, false); - InstructionDesc[OpTypeReserveId] .setResultAndType(true, false); - InstructionDesc[OpTypeQueue] .setResultAndType(true, false); - InstructionDesc[OpTypePipe] .setResultAndType(true, false); - InstructionDesc[OpFunctionEnd] .setResultAndType(false, false); - InstructionDesc[OpStore] .setResultAndType(false, false); - InstructionDesc[OpDecorationGroup] .setResultAndType(true, false); - InstructionDesc[OpDecorate] .setResultAndType(false, false); - InstructionDesc[OpMemberDecorate] .setResultAndType(false, false); - InstructionDesc[OpGroupDecorate] .setResultAndType(false, false); + InstructionDesc[OpExtension].setResultAndType(false, false); + InstructionDesc[OpExtInstImport].setResultAndType(true, false); + InstructionDesc[OpMemoryModel].setResultAndType(false, false); + InstructionDesc[OpEntryPoint].setResultAndType(false, false); + InstructionDesc[OpExecutionMode].setResultAndType(false, false); + InstructionDesc[OpTypeVoid].setResultAndType(true, false); + InstructionDesc[OpTypeBool].setResultAndType(true, false); + InstructionDesc[OpTypeInt].setResultAndType(true, false); + InstructionDesc[OpTypeFloat].setResultAndType(true, false); + InstructionDesc[OpTypeVector].setResultAndType(true, false); + InstructionDesc[OpTypeMatrix].setResultAndType(true, false); + InstructionDesc[OpTypeSampler].setResultAndType(true, false); + InstructionDesc[OpTypeFilter].setResultAndType(true, false); + InstructionDesc[OpTypeArray].setResultAndType(true, false); + InstructionDesc[OpTypeRuntimeArray].setResultAndType(true, false); + InstructionDesc[OpTypeStruct].setResultAndType(true, false); + InstructionDesc[OpTypeOpaque].setResultAndType(true, false); + InstructionDesc[OpTypePointer].setResultAndType(true, false); + InstructionDesc[OpTypeFunction].setResultAndType(true, false); + InstructionDesc[OpTypeEvent].setResultAndType(true, false); + InstructionDesc[OpTypeDeviceEvent].setResultAndType(true, false); + InstructionDesc[OpTypeReserveId].setResultAndType(true, false); + InstructionDesc[OpTypeQueue].setResultAndType(true, false); + InstructionDesc[OpTypePipe].setResultAndType(true, false); + InstructionDesc[OpFunctionEnd].setResultAndType(false, false); + InstructionDesc[OpStore].setResultAndType(false, false); + InstructionDesc[OpDecorationGroup].setResultAndType(true, false); + InstructionDesc[OpDecorate].setResultAndType(false, false); + InstructionDesc[OpMemberDecorate].setResultAndType(false, false); + InstructionDesc[OpGroupDecorate].setResultAndType(false, false); InstructionDesc[OpGroupMemberDecorate].setResultAndType(false, false); - InstructionDesc[OpName] .setResultAndType(false, false); - InstructionDesc[OpMemberName] .setResultAndType(false, false); - InstructionDesc[OpString] .setResultAndType(true, false); - InstructionDesc[OpLine] .setResultAndType(false, false); - - InstructionDesc[OpCopyMemory] .setResultAndType(false, false); + InstructionDesc[OpName].setResultAndType(false, false); + InstructionDesc[OpMemberName].setResultAndType(false, false); + InstructionDesc[OpString].setResultAndType(true, false); + InstructionDesc[OpLine].setResultAndType(false, false); + InstructionDesc[OpCopyMemory].setResultAndType(false, false); InstructionDesc[OpCopyMemorySized].setResultAndType(false, false); - - InstructionDesc[OpEmitVertex] .setResultAndType(false, false); - InstructionDesc[OpEndPrimitive] .setResultAndType(false, false); - InstructionDesc[OpEmitStreamVertex] .setResultAndType(false, false); + InstructionDesc[OpEmitVertex].setResultAndType(false, false); + InstructionDesc[OpEndPrimitive].setResultAndType(false, false); + InstructionDesc[OpEmitStreamVertex].setResultAndType(false, false); InstructionDesc[OpEndStreamPrimitive].setResultAndType(false, false); - InstructionDesc[OpControlBarrier].setResultAndType(false, false); - InstructionDesc[OpMemoryBarrier] .setResultAndType(false, false); - + InstructionDesc[OpMemoryBarrier].setResultAndType(false, false); InstructionDesc[OpAtomicInit].setResultAndType(false, false); InstructionDesc[OpAtomicStore].setResultAndType(false, false); - - InstructionDesc[OpLoopMerge] .setResultAndType(false, false); - InstructionDesc[OpSelectionMerge] .setResultAndType(false, false); - InstructionDesc[OpLabel] .setResultAndType(true, false); - InstructionDesc[OpBranch] .setResultAndType(false, false); + InstructionDesc[OpLoopMerge].setResultAndType(false, false); + InstructionDesc[OpSelectionMerge].setResultAndType(false, false); + InstructionDesc[OpLabel].setResultAndType(true, false); + InstructionDesc[OpBranch].setResultAndType(false, false); InstructionDesc[OpBranchConditional].setResultAndType(false, false); - InstructionDesc[OpSwitch] .setResultAndType(false, false); - InstructionDesc[OpKill] .setResultAndType(false, false); - InstructionDesc[OpReturn] .setResultAndType(false, false); - InstructionDesc[OpReturnValue] .setResultAndType(false, false); - InstructionDesc[OpUnreachable] .setResultAndType(false, false); - - InstructionDesc[OpLifetimeStart] .setResultAndType(false, false); - InstructionDesc[OpLifetimeStop] .setResultAndType(false, false); - - InstructionDesc[OpCompileFlag] .setResultAndType(false, false); - InstructionDesc[OpCommitReadPipe] .setResultAndType(false, false); + InstructionDesc[OpSwitch].setResultAndType(false, false); + InstructionDesc[OpKill].setResultAndType(false, false); + InstructionDesc[OpReturn].setResultAndType(false, false); + InstructionDesc[OpReturnValue].setResultAndType(false, false); + InstructionDesc[OpUnreachable].setResultAndType(false, false); + InstructionDesc[OpLifetimeStart].setResultAndType(false, false); + InstructionDesc[OpLifetimeStop].setResultAndType(false, false); + InstructionDesc[OpCompileFlag].setResultAndType(false, false); + InstructionDesc[OpCommitReadPipe].setResultAndType(false, false); InstructionDesc[OpCommitWritePipe].setResultAndType(false, false); InstructionDesc[OpGroupCommitWritePipe].setResultAndType(false, false); InstructionDesc[OpGroupCommitReadPipe].setResultAndType(false, false); @@ -143,1327 +944,1176 @@ void Parameterize() InstructionDesc[OpRetainEvent].setResultAndType(false, false); InstructionDesc[OpReleaseEvent].setResultAndType(false, false); + // Specific additional context-dependent operands + + ExecutionModeOperands[ExecutionModeInvocations].push(OperandLiteralNumber, "Number of invocations"); + + ExecutionModeOperands[ExecutionModeLocalSize].push(OperandLiteralNumber, "'x size'"); + ExecutionModeOperands[ExecutionModeLocalSize].push(OperandLiteralNumber, "'y size'"); + ExecutionModeOperands[ExecutionModeLocalSize].push(OperandLiteralNumber, "'z size'"); + + ExecutionModeOperands[ExecutionModeLocalSizeHint].push(OperandLiteralNumber, "'x size'"); + ExecutionModeOperands[ExecutionModeLocalSizeHint].push(OperandLiteralNumber, "'y size'"); + ExecutionModeOperands[ExecutionModeLocalSizeHint].push(OperandLiteralNumber, "'z size'"); + + ExecutionModeOperands[ExecutionModeOutputVertices].push(OperandLiteralNumber, "Vertex count"); + ExecutionModeOperands[ExecutionModeVecTypeHint].push(OperandId, "Vector type"); + + DecorationOperands[DecorationStream].push(OperandLiteralNumber, "Stream number"); + DecorationOperands[DecorationLocation].push(OperandLiteralNumber, "Location"); + DecorationOperands[DecorationComponent].push(OperandLiteralNumber, "Component within a vector"); + DecorationOperands[DecorationIndex].push(OperandLiteralNumber, "Index"); + DecorationOperands[DecorationBinding].push(OperandLiteralNumber, "Binding point"); + DecorationOperands[DecorationDescriptorSet].push(OperandLiteralNumber, "Descriptor set"); + DecorationOperands[DecorationOffset].push(OperandLiteralNumber, "Byte offset"); + DecorationOperands[DecorationAlignment].push(OperandLiteralNumber, "Declared alignment"); + DecorationOperands[DecorationXfbBuffer].push(OperandLiteralNumber, "XFB Buffer number"); + DecorationOperands[DecorationStride].push(OperandLiteralNumber, "Stride"); + DecorationOperands[DecorationBuiltIn].push(OperandLiteralNumber, "See <>"); + DecorationOperands[DecorationFPRoundingMode].push(OperandFPRoundingMode, "floating-point rounding mode"); + DecorationOperands[DecorationFPFastMathMode].push(OperandFPFastMath, "fast-math mode"); + DecorationOperands[DecorationLinkageAttributes].push(OperandLiteralString, "name"); + DecorationOperands[DecorationLinkageAttributes].push(OperandLinkageType, "linkage type"); + DecorationOperands[DecorationFuncParamAttr].push(OperandFuncParamAttr, "function parameter attribute"); + DecorationOperands[DecorationSpecId].push(OperandLiteralNumber, "Specialization Constant ID"); + + OperandClassParams[OperandSource].set(SourceLanguageCeiling, SourceString, 0); + OperandClassParams[OperandExecutionModel].set(ExecutionModelCeiling, ExecutionModelString, ExecutionModelParams); + OperandClassParams[OperandAddressing].set(AddressingModelCeiling, AddressingString, AddressingParams); + OperandClassParams[OperandMemory].set(MemoryModelCeiling, MemoryString, MemoryParams); + OperandClassParams[OperandExecutionMode].set(ExecutionModeCeiling, ExecutionModeString, ExecutionModeParams); + OperandClassParams[OperandExecutionMode].setOperands(ExecutionModeOperands); + OperandClassParams[OperandStorage].set(StorageClassCeiling, StorageClassString, StorageParams); + OperandClassParams[OperandDimensionality].set(DimensionCeiling, DimensionString, DimensionalityParams); + OperandClassParams[OperandSamplerAddressingMode].set(SamplerAddressingModeCeiling, SamplerAddressingModeString, SamplerAddressingModeParams); + OperandClassParams[OperandSamplerFilterMode].set(SamplerFilterModeCeiling, SamplerFilterModeString, SamplerFilterModeParams); + OperandClassParams[OperandFPFastMath].set(FPFastMathCeiling, FPFastMathString, FPFastMathParams, true); + OperandClassParams[OperandFPRoundingMode].set(FPRoundingModeCeiling, FPRoundingModeString, FPRoundingModeParams); + OperandClassParams[OperandLinkageType].set(LinkageTypeCeiling, LinkageTypeString, LinkageTypeParams); + OperandClassParams[OperandFuncParamAttr].set(FuncParamAttrCeiling, FuncParamAttrString, FuncParamAttrParams); + OperandClassParams[OperandAccessQualifier].set(AccessQualifierCeiling, AccessQualifierString, AccessQualifierParams); + OperandClassParams[OperandDecoration].set(DecorationCeiling, DecorationString, DecorationParams); + OperandClassParams[OperandDecoration].setOperands(DecorationOperands); + OperandClassParams[OperandBuiltIn].set(BuiltInCeiling, BuiltInString, BuiltInParams); + OperandClassParams[OperandSelect].set(SelectControlCeiling, SelectControlString, SelectionControlParams, true); + OperandClassParams[OperandLoop].set(LoopControlCeiling, LoopControlString, LoopControlParams, true); + OperandClassParams[OperandFunction].set(FunctionControlCeiling, FunctionControlString, FunctionControlParams, true); + OperandClassParams[OperandMemorySemantics].set(MemorySemanticsCeiling, MemorySemanticsString, MemorySemanticsParams, true); + OperandClassParams[OperandMemoryAccess].set(MemoryAccessCeiling, MemoryAccessString, MemoryAccessParams, true); + OperandClassParams[OperandExecutionScope].set(ExecutionScopeCeiling, ExecutionScopeString, ExecutionScopeParams); + OperandClassParams[OperandGroupOperation].set(GroupOperationCeiling, GroupOperationString, GroupOperationParams); + OperandClassParams[OperandKernelEnqueueFlags].set(KernelEnqueueFlagsCeiling, KernelEnqueueFlagsString, KernelEnqueueFlagsParams); + OperandClassParams[OperandKernelProfilingInfo].set(KernelProfilingInfoCeiling, KernelProfilingInfoString, KernelProfilingInfoParams, true); + OperandClassParams[OperandOpcode].set(OpcodeCeiling, OpcodeString, 0); + + AddressingParams[AddressingModelPhysical32].caps.push_back(CapAddr); + AddressingParams[AddressingModelPhysical64].caps.push_back(CapAddr); + + MemoryParams[MemoryModelSimple].caps.push_back(CapShader); + MemoryParams[MemoryModelGLSL450].caps.push_back(CapShader); + MemoryParams[MemoryModelOpenCL12].caps.push_back(CapKernel); + MemoryParams[MemoryModelOpenCL20].caps.push_back(CapKernel); + MemoryParams[MemoryModelOpenCL21].caps.push_back(CapKernel); + + ExecutionModelParams[ExecutionModelVertex].caps.push_back(CapShader); + ExecutionModelParams[ExecutionModelTessellationControl].caps.push_back(CapTess); + ExecutionModelParams[ExecutionModelTessellationEvaluation].caps.push_back(CapTess); + ExecutionModelParams[ExecutionModelGeometry].caps.push_back(CapGeom); + ExecutionModelParams[ExecutionModelFragment].caps.push_back(CapShader); + ExecutionModelParams[ExecutionModelGLCompute].caps.push_back(CapShader); + ExecutionModelParams[ExecutionModelKernel].caps.push_back(CapKernel); + + // Storage capabilites + StorageParams[StorageClassInput].caps.push_back(CapShader); + StorageParams[StorageClassUniform].caps.push_back(CapShader); + StorageParams[StorageClassOutput].caps.push_back(CapShader); + StorageParams[StorageClassPrivateGlobal].caps.push_back(CapShader); + StorageParams[StorageClassFunction].caps.push_back(CapShader); + StorageParams[StorageClassGeneric].caps.push_back(CapKernel); + StorageParams[StorageClassPrivate].caps.push_back(CapKernel); + StorageParams[StorageClassAtomicCounter].caps.push_back(CapShader); + + // Sampler Filter & Addressing mode capabilities + SamplerAddressingModeParams[SamplerAddressingModeNone].caps.push_back(CapKernel); + SamplerAddressingModeParams[SamplerAddressingModeClampToEdge].caps.push_back(CapKernel); + SamplerAddressingModeParams[SamplerAddressingModeClamp].caps.push_back(CapKernel); + SamplerAddressingModeParams[SamplerAddressingModeRepeat].caps.push_back(CapKernel); + SamplerAddressingModeParams[SamplerAddressingModeRepeatMirrored].caps.push_back(CapKernel); + + SamplerFilterModeParams[SamplerFilterModeNearest].caps.push_back(CapKernel); + SamplerFilterModeParams[SamplerFilterModeLinear].caps.push_back(CapKernel); + + // fast math flags capabilities + for (int i = 0; i < FPFastMathCeiling; ++i) { + FPFastMathParams[i].caps.push_back(CapKernel); + } + + // fp rounding mode capabilities + for (int i = 0; i < FPRoundingModeCeiling; ++i) { + FPRoundingModeParams[i].caps.push_back(CapKernel); + } + + // linkage types + for (int i = 0; i < LinkageTypeCeiling; ++i) { + LinkageTypeParams[i].caps.push_back(CapLink); + } + + // function argument types + for (int i = 0; i < FuncParamAttrCeiling; ++i) { + FuncParamAttrParams[i].caps.push_back(CapKernel); + } + + // function argument types + for (int i = 0; i < AccessQualifierCeiling; ++i) { + AccessQualifierParams[i].caps.push_back(CapKernel); + } + + ExecutionModeParams[ExecutionModeInvocations].caps.push_back(CapGeom); + ExecutionModeParams[ExecutionModeSpacingEqual].caps.push_back(CapTess); + ExecutionModeParams[ExecutionModeSpacingFractionalEven].caps.push_back(CapTess); + ExecutionModeParams[ExecutionModeSpacingFractionalOdd].caps.push_back(CapTess); + ExecutionModeParams[ExecutionModeVertexOrderCw].caps.push_back(CapTess); + ExecutionModeParams[ExecutionModeVertexOrderCcw].caps.push_back(CapTess); + ExecutionModeParams[ExecutionModePixelCenterInteger].caps.push_back(CapShader); + ExecutionModeParams[ExecutionModeOriginUpperLeft].caps.push_back(CapShader); + ExecutionModeParams[ExecutionModeEarlyFragmentTests].caps.push_back(CapShader); + ExecutionModeParams[ExecutionModePointMode].caps.push_back(CapTess); + ExecutionModeParams[ExecutionModeXfb].caps.push_back(CapShader); + ExecutionModeParams[ExecutionModeDepthReplacing].caps.push_back(CapShader); + ExecutionModeParams[ExecutionModeDepthAny].caps.push_back(CapShader); + ExecutionModeParams[ExecutionModeDepthGreater].caps.push_back(CapShader); + ExecutionModeParams[ExecutionModeDepthLess].caps.push_back(CapShader); + ExecutionModeParams[ExecutionModeDepthUnchanged].caps.push_back(CapShader); + ExecutionModeParams[ExecutionModeLocalSizeHint].caps.push_back(CapKernel); + ExecutionModeParams[ExecutionModeInputPoints].caps.push_back(CapGeom); + ExecutionModeParams[ExecutionModeInputLines].caps.push_back(CapGeom); + ExecutionModeParams[ExecutionModeInputLinesAdjacency].caps.push_back(CapGeom); + ExecutionModeParams[ExecutionModeInputTriangles].caps.push_back(CapGeom); + ExecutionModeParams[ExecutionModeInputTriangles].caps.push_back(CapTess); + ExecutionModeParams[ExecutionModeInputTrianglesAdjacency].caps.push_back(CapGeom); + ExecutionModeParams[ExecutionModeInputQuads].caps.push_back(CapTess); + ExecutionModeParams[ExecutionModeInputIsolines].caps.push_back(CapTess); + ExecutionModeParams[ExecutionModeOutputVertices].caps.push_back(CapGeom); + ExecutionModeParams[ExecutionModeOutputVertices].caps.push_back(CapTess); + ExecutionModeParams[ExecutionModeOutputPoints].caps.push_back(CapGeom); + ExecutionModeParams[ExecutionModeOutputLineStrip].caps.push_back(CapGeom); + ExecutionModeParams[ExecutionModeOutputTriangleStrip].caps.push_back(CapGeom); + ExecutionModeParams[ExecutionModeVecTypeHint].caps.push_back(CapKernel); + ExecutionModeParams[ExecutionModeContractionOff].caps.push_back(CapKernel); + + DecorationParams[DecorationPrecisionLow].caps.push_back(CapShader); + DecorationParams[DecorationPrecisionMedium].caps.push_back(CapShader); + DecorationParams[DecorationPrecisionHigh].caps.push_back(CapShader); + DecorationParams[DecorationBlock].caps.push_back(CapShader); + DecorationParams[DecorationBufferBlock].caps.push_back(CapShader); + DecorationParams[DecorationRowMajor].caps.push_back(CapMatrix); + DecorationParams[DecorationColMajor].caps.push_back(CapMatrix); + DecorationParams[DecorationGLSLShared].caps.push_back(CapShader); + DecorationParams[DecorationGLSLStd140].caps.push_back(CapShader); + DecorationParams[DecorationGLSLStd430].caps.push_back(CapShader); + DecorationParams[DecorationGLSLPacked].caps.push_back(CapShader); + DecorationParams[DecorationSmooth].caps.push_back(CapShader); + DecorationParams[DecorationNoperspective].caps.push_back(CapShader); + DecorationParams[DecorationFlat].caps.push_back(CapShader); + DecorationParams[DecorationPatch].caps.push_back(CapTess); + DecorationParams[DecorationCentroid].caps.push_back(CapShader); + DecorationParams[DecorationSample].caps.push_back(CapShader); + DecorationParams[DecorationInvariant].caps.push_back(CapShader); + DecorationParams[DecorationConstant].caps.push_back(CapKernel); + DecorationParams[DecorationUniform].caps.push_back(CapShader); + DecorationParams[DecorationCPacked].caps.push_back(CapKernel); + DecorationParams[DecorationSaturatedConversion].caps.push_back(CapKernel); + DecorationParams[DecorationStream].caps.push_back(CapGeom); + DecorationParams[DecorationLocation].caps.push_back(CapShader); + DecorationParams[DecorationComponent].caps.push_back(CapShader); + DecorationParams[DecorationIndex].caps.push_back(CapShader); + DecorationParams[DecorationBinding].caps.push_back(CapShader); + DecorationParams[DecorationDescriptorSet].caps.push_back(CapShader); + DecorationParams[DecorationXfbBuffer].caps.push_back(CapShader); + DecorationParams[DecorationStride].caps.push_back(CapShader); + DecorationParams[DecorationBuiltIn].caps.push_back(CapShader); + DecorationParams[DecorationFuncParamAttr].caps.push_back(CapKernel); + DecorationParams[DecorationFPRoundingMode].caps.push_back(CapKernel); + DecorationParams[DecorationFPFastMathMode].caps.push_back(CapKernel); + DecorationParams[DecorationLinkageAttributes].caps.push_back(CapLink); + DecorationParams[DecorationSpecId].caps.push_back(CapShader); + + BuiltInParams[BuiltInPosition].caps.push_back(CapShader); + BuiltInParams[BuiltInPointSize].caps.push_back(CapShader); + BuiltInParams[BuiltInClipVertex].caps.push_back(CapShader); + BuiltInParams[BuiltInClipDistance].caps.push_back(CapShader); + BuiltInParams[BuiltInCullDistance].caps.push_back(CapShader); + BuiltInParams[BuiltInVertexId].caps.push_back(CapShader); + BuiltInParams[BuiltInInstanceId].caps.push_back(CapShader); + BuiltInParams[BuiltInPrimitiveId].caps.push_back(CapGeom); + BuiltInParams[BuiltInPrimitiveId].caps.push_back(CapTess); + BuiltInParams[BuiltInInvocationId].caps.push_back(CapGeom); + BuiltInParams[BuiltInInvocationId].caps.push_back(CapTess); + BuiltInParams[BuiltInLayer].caps.push_back(CapGeom); + BuiltInParams[BuiltInViewportIndex].caps.push_back(CapGeom); + BuiltInParams[BuiltInTessLevelOuter].caps.push_back(CapTess); + BuiltInParams[BuiltInTessLevelInner].caps.push_back(CapTess); + BuiltInParams[BuiltInTessCoord].caps.push_back(CapTess); + BuiltInParams[BuiltInPatchVertices].caps.push_back(CapTess); + BuiltInParams[BuiltInFragCoord].caps.push_back(CapShader); + BuiltInParams[BuiltInPointCoord].caps.push_back(CapShader); + BuiltInParams[BuiltInFrontFacing].caps.push_back(CapShader); + BuiltInParams[BuiltInSampleId].caps.push_back(CapShader); + BuiltInParams[BuiltInSamplePosition].caps.push_back(CapShader); + BuiltInParams[BuiltInSampleMask].caps.push_back(CapShader); + BuiltInParams[BuiltInFragColor].caps.push_back(CapShader); + BuiltInParams[BuiltInFragDepth].caps.push_back(CapShader); + BuiltInParams[BuiltInHelperInvocation].caps.push_back(CapShader); + BuiltInParams[BuiltInLocalInvocationIndex].caps.push_back(CapShader); + BuiltInParams[BuiltInWorkDim].caps.push_back(CapKernel); + BuiltInParams[BuiltInGlobalSize].caps.push_back(CapKernel); + BuiltInParams[BuiltInEnqueuedWorkgroupSize].caps.push_back(CapKernel); + BuiltInParams[BuiltInGlobalOffset].caps.push_back(CapKernel); + BuiltInParams[BuiltInGlobalLinearId].caps.push_back(CapKernel); + BuiltInParams[BuiltInWorkgroupLinearId].caps.push_back(CapKernel); + + BuiltInParams[BuiltInSubgroupSize].caps.push_back(CapKernel); + BuiltInParams[BuiltInSubgroupMaxSize].caps.push_back(CapKernel); + BuiltInParams[BuiltInNumSubgroups].caps.push_back(CapKernel); + BuiltInParams[BuiltInNumEnqueuedSubgroups].caps.push_back(CapKernel); + BuiltInParams[BuiltInSubgroupId].caps.push_back(CapKernel); + BuiltInParams[BuiltInSubgroupLocalInvocationId].caps.push_back(CapKernel); + + DimensionalityParams[DimCube].caps.push_back(CapShader); + DimensionalityParams[DimRect].caps.push_back(CapShader); + + // Group Operations + for (int i = 0; i < GroupOperationCeiling; ++i) { + GroupOperationParams[i].caps.push_back(CapKernel); + } + + // Enqueue flags + for (int i = 0; i < KernelEnqueueFlagsCeiling; ++i) { + KernelEnqueueFlagsParams[i].caps.push_back(CapKernel); + } + + // Profiling info + KernelProfilingInfoParams[0].caps.push_back(CapKernel); + // set name of operator, an initial set of style operands, and the description - #define SET_OPNAME(index) InstructionDesc[index].opName = #index; - - SET_OPNAME(OpNop); - SET_OPNAME(OpSource); - SET_OPNAME(OpSourceExtension); - SET_OPNAME(OpExtension); - SET_OPNAME(OpExtInstImport); - SET_OPNAME(OpMemoryModel); - SET_OPNAME(OpEntryPoint); - SET_OPNAME(OpExecutionMode); - - SET_OPNAME(OpTypeVoid); - SET_OPNAME(OpTypeInt); - SET_OPNAME(OpTypeBool); - SET_OPNAME(OpTypeFloat); - SET_OPNAME(OpTypeVector); - SET_OPNAME(OpTypeMatrix); - SET_OPNAME(OpTypeSampler); - SET_OPNAME(OpTypeFilter); - SET_OPNAME(OpTypeArray); - SET_OPNAME(OpTypeRuntimeArray); - SET_OPNAME(OpTypeStruct); - SET_OPNAME(OpTypeOpaque); - SET_OPNAME(OpTypePointer); - SET_OPNAME(OpTypeFunction); - - SET_OPNAME(OpTypeEvent); - SET_OPNAME(OpTypeDeviceEvent); - SET_OPNAME(OpTypeReserveId); - SET_OPNAME(OpTypeQueue); - SET_OPNAME(OpTypePipe); - - SET_OPNAME(OpConstantTrue); - SET_OPNAME(OpConstantFalse); - SET_OPNAME(OpConstant); - SET_OPNAME(OpConstantComposite); - SET_OPNAME(OpConstantNullPointer); - SET_OPNAME(OpConstantNullObject); - SET_OPNAME(OpConstantSampler); - - SET_OPNAME(OpSpecConstantTrue); - SET_OPNAME(OpSpecConstantFalse); - SET_OPNAME(OpSpecConstant); - SET_OPNAME(OpSpecConstantComposite); - - SET_OPNAME(OpVariable); - SET_OPNAME(OpVariableArray); - - SET_OPNAME(OpFunction); - SET_OPNAME(OpFunctionParameter); - SET_OPNAME(OpFunctionEnd); - SET_OPNAME(OpFunctionCall); - - SET_OPNAME(OpExtInst); - - SET_OPNAME(OpUndef); - SET_OPNAME(OpLoad); - SET_OPNAME(OpStore); - SET_OPNAME(OpPhi); - - SET_OPNAME(OpDecorationGroup); - SET_OPNAME(OpDecorate); - SET_OPNAME(OpMemberDecorate); - SET_OPNAME(OpGroupDecorate); - SET_OPNAME(OpGroupMemberDecorate); - SET_OPNAME(OpName); - SET_OPNAME(OpMemberName); - SET_OPNAME(OpString); - SET_OPNAME(OpLine); - - SET_OPNAME(OpVectorExtractDynamic); - SET_OPNAME(OpVectorInsertDynamic); - SET_OPNAME(OpVectorShuffle); - - SET_OPNAME(OpCompositeConstruct); - SET_OPNAME(OpCompositeExtract); - SET_OPNAME(OpCompositeInsert); - - SET_OPNAME(OpCopyObject); - SET_OPNAME(OpCopyMemory); - SET_OPNAME(OpCopyMemorySized); - - SET_OPNAME(OpSampler); - - SET_OPNAME(OpTextureSample); - SET_OPNAME(OpTextureSampleDref); - SET_OPNAME(OpTextureSampleLod); - SET_OPNAME(OpTextureSampleProj); - SET_OPNAME(OpTextureSampleGrad); - SET_OPNAME(OpTextureSampleOffset); - SET_OPNAME(OpTextureSampleProjLod); - SET_OPNAME(OpTextureSampleProjGrad); - SET_OPNAME(OpTextureSampleLodOffset); - SET_OPNAME(OpTextureSampleProjOffset); - SET_OPNAME(OpTextureSampleGradOffset); - SET_OPNAME(OpTextureSampleProjLodOffset); - SET_OPNAME(OpTextureSampleProjGradOffset); - SET_OPNAME(OpTextureFetchTexel); - SET_OPNAME(OpTextureFetchTexelOffset); - SET_OPNAME(OpTextureFetchSample); - SET_OPNAME(OpTextureFetchBuffer); - SET_OPNAME(OpTextureGather); - SET_OPNAME(OpTextureGatherOffset); - SET_OPNAME(OpTextureGatherOffsets); - SET_OPNAME(OpTextureQuerySizeLod); - SET_OPNAME(OpTextureQuerySize); - SET_OPNAME(OpTextureQueryLod); - SET_OPNAME(OpTextureQueryLevels); - SET_OPNAME(OpTextureQuerySamples); - - SET_OPNAME(OpAccessChain); - SET_OPNAME(OpInBoundsAccessChain); - - SET_OPNAME(OpSNegate); - SET_OPNAME(OpFNegate); - SET_OPNAME(OpNot); - SET_OPNAME(OpAny); - SET_OPNAME(OpAll); - - SET_OPNAME(OpConvertFToU); - SET_OPNAME(OpConvertFToS); - SET_OPNAME(OpConvertSToF); - SET_OPNAME(OpConvertUToF); - SET_OPNAME(OpFConvert); - SET_OPNAME(OpSConvert); - SET_OPNAME(OpUConvert); - SET_OPNAME(OpConvertPtrToU); - SET_OPNAME(OpConvertUToPtr); - SET_OPNAME(OpPtrCastToGeneric); - SET_OPNAME(OpGenericCastToPtr); - SET_OPNAME(OpGenericCastToPtrExplicit); - SET_OPNAME(OpGenericPtrMemSemantics); - SET_OPNAME(OpBitcast); - SET_OPNAME(OpTranspose); - - SET_OPNAME(OpIsNan); - SET_OPNAME(OpIsInf); - SET_OPNAME(OpIsFinite); - SET_OPNAME(OpIsNormal); - SET_OPNAME(OpSignBitSet); - SET_OPNAME(OpLessOrGreater); - SET_OPNAME(OpOrdered); - SET_OPNAME(OpUnordered); - - SET_OPNAME(OpArrayLength); - - SET_OPNAME(OpIAdd); - SET_OPNAME(OpFAdd); - SET_OPNAME(OpISub); - SET_OPNAME(OpFSub); - SET_OPNAME(OpIMul); - SET_OPNAME(OpFMul); - SET_OPNAME(OpUDiv); - SET_OPNAME(OpSDiv); - SET_OPNAME(OpFDiv); - SET_OPNAME(OpUMod); - SET_OPNAME(OpSRem); - SET_OPNAME(OpSMod); - SET_OPNAME(OpFRem); - SET_OPNAME(OpFMod); - - SET_OPNAME(OpVectorTimesScalar); - SET_OPNAME(OpMatrixTimesScalar); - SET_OPNAME(OpVectorTimesMatrix); - SET_OPNAME(OpMatrixTimesVector); - SET_OPNAME(OpMatrixTimesMatrix); - SET_OPNAME(OpOuterProduct); - SET_OPNAME(OpDot); - - SET_OPNAME(OpShiftRightLogical); - SET_OPNAME(OpShiftRightArithmetic); - SET_OPNAME(OpShiftLeftLogical); - SET_OPNAME(OpLogicalOr); - SET_OPNAME(OpLogicalXor); - SET_OPNAME(OpLogicalAnd); - - SET_OPNAME(OpBitwiseOr); - SET_OPNAME(OpBitwiseXor); - SET_OPNAME(OpBitwiseAnd); - - SET_OPNAME(OpSelect); - - SET_OPNAME(OpIEqual); - SET_OPNAME(OpFOrdEqual); - SET_OPNAME(OpFUnordEqual); - SET_OPNAME(OpINotEqual); - SET_OPNAME(OpFOrdNotEqual); - SET_OPNAME(OpFUnordNotEqual); - SET_OPNAME(OpULessThan); - SET_OPNAME(OpSLessThan); - SET_OPNAME(OpFOrdLessThan); - SET_OPNAME(OpFUnordLessThan); - SET_OPNAME(OpUGreaterThan); - SET_OPNAME(OpSGreaterThan); - SET_OPNAME(OpFOrdGreaterThan); - SET_OPNAME(OpFUnordGreaterThan); - SET_OPNAME(OpULessThanEqual); - SET_OPNAME(OpSLessThanEqual); - SET_OPNAME(OpFOrdLessThanEqual); - SET_OPNAME(OpFUnordLessThanEqual); - SET_OPNAME(OpUGreaterThanEqual); - SET_OPNAME(OpSGreaterThanEqual); - SET_OPNAME(OpFOrdGreaterThanEqual); - SET_OPNAME(OpFUnordGreaterThanEqual); - - SET_OPNAME(OpDPdx); - SET_OPNAME(OpDPdy); - SET_OPNAME(OpFwidth); - SET_OPNAME(OpDPdxFine); - SET_OPNAME(OpDPdyFine); - SET_OPNAME(OpFwidthFine); - SET_OPNAME(OpDPdxCoarse); - SET_OPNAME(OpDPdyCoarse); - SET_OPNAME(OpFwidthCoarse); - SET_OPNAME(OpEmitVertex); - SET_OPNAME(OpEndPrimitive); - SET_OPNAME(OpEmitStreamVertex); - SET_OPNAME(OpEndStreamPrimitive); - SET_OPNAME(OpControlBarrier); - SET_OPNAME(OpMemoryBarrier); - - SET_OPNAME(OpImagePointer); - - SET_OPNAME(OpAtomicInit); - SET_OPNAME(OpAtomicLoad); - SET_OPNAME(OpAtomicStore); - SET_OPNAME(OpAtomicExchange); - SET_OPNAME(OpAtomicCompareExchange); - SET_OPNAME(OpAtomicCompareExchangeWeak); - SET_OPNAME(OpAtomicIIncrement); - SET_OPNAME(OpAtomicIDecrement); - SET_OPNAME(OpAtomicIAdd); - SET_OPNAME(OpAtomicISub); - SET_OPNAME(OpAtomicUMin); - SET_OPNAME(OpAtomicUMax); - SET_OPNAME(OpAtomicAnd); - SET_OPNAME(OpAtomicOr); - SET_OPNAME(OpAtomicXor); - - SET_OPNAME(OpLoopMerge); - SET_OPNAME(OpSelectionMerge); - SET_OPNAME(OpLabel); - SET_OPNAME(OpBranch); - SET_OPNAME(OpBranchConditional); - SET_OPNAME(OpSwitch); - SET_OPNAME(OpKill); - SET_OPNAME(OpReturn); - SET_OPNAME(OpReturnValue); - SET_OPNAME(OpUnreachable); - - SET_OPNAME(OpLifetimeStart); - SET_OPNAME(OpLifetimeStop); - SET_OPNAME(OpCompileFlag); - - SET_OPNAME(OpAsyncGroupCopy); - SET_OPNAME(OpWaitGroupEvents); - - SET_OPNAME(OpGroupAll); - SET_OPNAME(OpGroupAny); - SET_OPNAME(OpGroupBroadcast); - SET_OPNAME(OpGroupIAdd); - SET_OPNAME(OpGroupFAdd); - SET_OPNAME(OpGroupFMin); - SET_OPNAME(OpGroupUMin); - SET_OPNAME(OpGroupSMin); - SET_OPNAME(OpGroupFMax); - SET_OPNAME(OpGroupUMax); - SET_OPNAME(OpGroupSMax); - - SET_OPNAME(OpReadPipe); - SET_OPNAME(OpWritePipe); - SET_OPNAME(OpReservedReadPipe); - SET_OPNAME(OpReservedWritePipe); - SET_OPNAME(OpReserveReadPipePackets); - SET_OPNAME(OpReserveWritePipePackets); - SET_OPNAME(OpCommitReadPipe); - SET_OPNAME(OpCommitWritePipe); - SET_OPNAME(OpIsValidReserveId); - SET_OPNAME(OpGetNumPipePackets); - SET_OPNAME(OpGetMaxPipePackets); - SET_OPNAME(OpGroupReserveReadPipePackets); - SET_OPNAME(OpGroupReserveWritePipePackets); - SET_OPNAME(OpGroupCommitReadPipe); - SET_OPNAME(OpGroupCommitWritePipe); - - // Device-side enqueueing of kernels - SET_OPNAME(OpBuildNDRange); - SET_OPNAME(OpGetDefaultQueue); - SET_OPNAME(OpCaptureEventProfilingInfo); - SET_OPNAME(OpSetUserEventStatus); - SET_OPNAME(OpIsValidEvent); - SET_OPNAME(OpCreateUserEvent); - SET_OPNAME(OpRetainEvent); - SET_OPNAME(OpReleaseEvent); - SET_OPNAME(OpGetKernelWorkGroupSize); - SET_OPNAME(OpGetKernelPreferredWorkGroupSizeMultiple); - SET_OPNAME(OpGetKernelNDrangeMaxSubGroupSize); - SET_OPNAME(OpGetKernelNDrangeSubGroupCount); - SET_OPNAME(OpEnqueueKernel); - SET_OPNAME(OpEnqueueMarker); - - InstructionDesc[OpSource].operands.push(OperandSource); - InstructionDesc[OpSource].operands.push(OperandLiteralNumber); - InstructionDesc[OpSourceExtension].operands.push(OperandLiteralString); - InstructionDesc[OpName].operands.push(OperandId); - InstructionDesc[OpName].operands.push(OperandLiteralString); - InstructionDesc[OpMemberName].operands.push(OperandId); - InstructionDesc[OpMemberName].operands.push(OperandLiteralNumber); - InstructionDesc[OpMemberName].operands.push(OperandLiteralString); - InstructionDesc[OpString].operands.push(OperandLiteralString); - InstructionDesc[OpLine].operands.push(OperandId); - InstructionDesc[OpLine].operands.push(OperandId); - InstructionDesc[OpLine].operands.push(OperandLiteralNumber); - InstructionDesc[OpLine].operands.push(OperandLiteralNumber); - InstructionDesc[OpExtension].operands.push(OperandLiteralString); - InstructionDesc[OpExtInstImport].operands.push(OperandLiteralString); - InstructionDesc[OpMemoryModel].operands.push(OperandAddressing); - InstructionDesc[OpMemoryModel].operands.push(OperandMemory); - InstructionDesc[OpEntryPoint].operands.push(OperandExecutionModel); - InstructionDesc[OpEntryPoint].operands.push(OperandId); - InstructionDesc[OpExecutionMode].operands.push(OperandId); - InstructionDesc[OpExecutionMode].operands.push(OperandExecutionMode); - InstructionDesc[OpExecutionMode].operands.push(OperandVariableLiterals); - InstructionDesc[OpTypeInt].operands.push(OperandLiteralNumber); - InstructionDesc[OpTypeInt].operands.push(OperandLiteralNumber); - InstructionDesc[OpTypeFloat].operands.push(OperandLiteralNumber); - InstructionDesc[OpTypeVector].operands.push(OperandId); - InstructionDesc[OpTypeVector].operands.push(OperandLiteralNumber); - InstructionDesc[OpTypeMatrix].operands.push(OperandId); - InstructionDesc[OpTypeMatrix].operands.push(OperandLiteralNumber); - InstructionDesc[OpTypeSampler].operands.push(OperandId); - InstructionDesc[OpTypeSampler].operands.push(OperandDimensionality); - InstructionDesc[OpTypeSampler].operands.push(OperandLiteralNumber); - InstructionDesc[OpTypeSampler].operands.push(OperandLiteralNumber); - InstructionDesc[OpTypeSampler].operands.push(OperandLiteralNumber); - InstructionDesc[OpTypeSampler].operands.push(OperandLiteralNumber); - InstructionDesc[OpTypeSampler].operands.push(OperandOptionalId); - InstructionDesc[OpTypeArray].operands.push(OperandId); - InstructionDesc[OpTypeArray].operands.push(OperandId); - InstructionDesc[OpTypeRuntimeArray].operands.push(OperandId); - InstructionDesc[OpTypeStruct].operands.push(OperandVariableIds); - InstructionDesc[OpTypeOpaque].operands.push(OperandLiteralString); - InstructionDesc[OpTypePointer].operands.push(OperandStorage); - InstructionDesc[OpTypePointer].operands.push(OperandId); - InstructionDesc[OpTypePipe].operands.push(OperandId); - InstructionDesc[OpTypePipe].operands.push(OperandAccessQualifier); - InstructionDesc[OpTypeFunction].operands.push(OperandId); - InstructionDesc[OpTypeFunction].operands.push(OperandVariableIds); - InstructionDesc[OpConstant].operands.push(OperandVariableLiterals); - InstructionDesc[OpConstantComposite].operands.push(OperandVariableIds); - InstructionDesc[OpConstantSampler].operands.push(OperandLiteralNumber); - InstructionDesc[OpConstantSampler].operands.push(OperandLiteralNumber); - InstructionDesc[OpConstantSampler].operands.push(OperandLiteralNumber); - InstructionDesc[OpSpecConstant].operands.push(OperandVariableLiterals); - InstructionDesc[OpSpecConstantComposite].operands.push(OperandVariableIds); - InstructionDesc[OpVariable].operands.push(OperandStorage); - InstructionDesc[OpVariable].operands.push(OperandOptionalId); - InstructionDesc[OpVariableArray].operands.push(OperandStorage); - InstructionDesc[OpVariableArray].operands.push(OperandId); - InstructionDesc[OpFunction].operands.push(OperandFunction); - InstructionDesc[OpFunction].operands.push(OperandId); - InstructionDesc[OpFunctionCall].operands.push(OperandId); - InstructionDesc[OpFunctionCall].operands.push(OperandVariableIds); - InstructionDesc[OpExtInst].operands.push(OperandId); - InstructionDesc[OpExtInst].operands.push(OperandLiteralNumber); - InstructionDesc[OpExtInst].operands.push(OperandVariableIds); - InstructionDesc[OpLoad].operands.push(OperandId); - InstructionDesc[OpLoad].operands.push(OperandVariableLiterals); - InstructionDesc[OpStore].operands.push(OperandId); - InstructionDesc[OpStore].operands.push(OperandId); - InstructionDesc[OpStore].operands.push(OperandVariableLiterals); - InstructionDesc[OpPhi].operands.push(OperandVariableIds); - InstructionDesc[OpDecorate].operands.push(OperandId); - InstructionDesc[OpDecorate].operands.push(OperandDecoration); - InstructionDesc[OpDecorate].operands.push(OperandVariableLiterals); - InstructionDesc[OpMemberDecorate].operands.push(OperandId); - InstructionDesc[OpMemberDecorate].operands.push(OperandLiteralNumber); - InstructionDesc[OpMemberDecorate].operands.push(OperandDecoration); - InstructionDesc[OpMemberDecorate].operands.push(OperandVariableLiterals); - InstructionDesc[OpGroupDecorate].operands.push(OperandId); - InstructionDesc[OpGroupDecorate].operands.push(OperandVariableIds); - InstructionDesc[OpGroupMemberDecorate].operands.push(OperandId); - InstructionDesc[OpGroupMemberDecorate].operands.push(OperandVariableIds); - InstructionDesc[OpVectorExtractDynamic].operands.push(OperandId); - InstructionDesc[OpVectorExtractDynamic].operands.push(OperandId); - InstructionDesc[OpVectorInsertDynamic].operands.push(OperandId); - InstructionDesc[OpVectorInsertDynamic].operands.push(OperandId); - InstructionDesc[OpVectorInsertDynamic].operands.push(OperandId); - InstructionDesc[OpVectorShuffle].operands.push(OperandId); - InstructionDesc[OpVectorShuffle].operands.push(OperandId); - InstructionDesc[OpVectorShuffle].operands.push(OperandVariableLiterals); - InstructionDesc[OpCompositeConstruct].operands.push(OperandVariableIds); - InstructionDesc[OpCompositeExtract].operands.push(OperandId); - InstructionDesc[OpCompositeExtract].operands.push(OperandVariableLiterals); - InstructionDesc[OpCompositeInsert].operands.push(OperandId); - InstructionDesc[OpCompositeInsert].operands.push(OperandId); - InstructionDesc[OpCompositeInsert].operands.push(OperandVariableLiterals); - InstructionDesc[OpCopyObject].operands.push(OperandId); - InstructionDesc[OpCopyMemory].operands.push(OperandId); - InstructionDesc[OpCopyMemory].operands.push(OperandId); - InstructionDesc[OpCopyMemory].operands.push(OperandVariableLiterals); - InstructionDesc[OpCopyMemorySized].operands.push(OperandId); - InstructionDesc[OpCopyMemorySized].operands.push(OperandId); - InstructionDesc[OpCopyMemorySized].operands.push(OperandId); - InstructionDesc[OpCopyMemorySized].operands.push(OperandVariableLiterals); - InstructionDesc[OpSampler].operands.push(OperandId); - InstructionDesc[OpSampler].operands.push(OperandId); - InstructionDesc[OpTextureSample].operands.push(OperandId); - InstructionDesc[OpTextureSample].operands.push(OperandId); - InstructionDesc[OpTextureSample].operands.push(OperandOptionalId); - InstructionDesc[OpTextureSampleDref].operands.push(OperandId); - InstructionDesc[OpTextureSampleDref].operands.push(OperandId); - InstructionDesc[OpTextureSampleDref].operands.push(OperandId); - InstructionDesc[OpTextureSampleLod].operands.push(OperandId); - InstructionDesc[OpTextureSampleLod].operands.push(OperandId); - InstructionDesc[OpTextureSampleLod].operands.push(OperandId); - InstructionDesc[OpTextureSampleProj].operands.push(OperandId); - InstructionDesc[OpTextureSampleProj].operands.push(OperandId); - InstructionDesc[OpTextureSampleProj].operands.push(OperandOptionalId); - InstructionDesc[OpTextureSampleGrad].operands.push(OperandId); - InstructionDesc[OpTextureSampleGrad].operands.push(OperandId); - InstructionDesc[OpTextureSampleGrad].operands.push(OperandId); - InstructionDesc[OpTextureSampleGrad].operands.push(OperandId); - InstructionDesc[OpTextureSampleOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleOffset].operands.push(OperandOptionalId); - InstructionDesc[OpTextureSampleProjLod].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjLod].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjLod].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjGrad].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjGrad].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjGrad].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjGrad].operands.push(OperandId); - InstructionDesc[OpTextureSampleLodOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleLodOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleLodOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleLodOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjOffset].operands.push(OperandOptionalId); - InstructionDesc[OpTextureSampleGradOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleGradOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleGradOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleGradOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleGradOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjLodOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjLodOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjLodOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjLodOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjGradOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjGradOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjGradOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjGradOffset].operands.push(OperandId); - InstructionDesc[OpTextureSampleProjGradOffset].operands.push(OperandId); - InstructionDesc[OpTextureFetchTexel].operands.push(OperandId); - InstructionDesc[OpTextureFetchTexel].operands.push(OperandId); - InstructionDesc[OpTextureFetchTexel].operands.push(OperandId); - InstructionDesc[OpTextureFetchTexelOffset].operands.push(OperandId); - InstructionDesc[OpTextureFetchTexelOffset].operands.push(OperandId); - InstructionDesc[OpTextureFetchTexelOffset].operands.push(OperandId); - InstructionDesc[OpTextureFetchSample].operands.push(OperandId); - InstructionDesc[OpTextureFetchSample].operands.push(OperandId); - InstructionDesc[OpTextureFetchSample].operands.push(OperandId); - InstructionDesc[OpTextureFetchBuffer].operands.push(OperandId); - InstructionDesc[OpTextureFetchBuffer].operands.push(OperandId); - InstructionDesc[OpTextureGather].operands.push(OperandId); - InstructionDesc[OpTextureGather].operands.push(OperandId); - InstructionDesc[OpTextureGather].operands.push(OperandId); - InstructionDesc[OpTextureGatherOffset].operands.push(OperandId); - InstructionDesc[OpTextureGatherOffset].operands.push(OperandId); - InstructionDesc[OpTextureGatherOffset].operands.push(OperandId); - InstructionDesc[OpTextureGatherOffset].operands.push(OperandId); - InstructionDesc[OpTextureGatherOffsets].operands.push(OperandId); - InstructionDesc[OpTextureGatherOffsets].operands.push(OperandId); - InstructionDesc[OpTextureGatherOffsets].operands.push(OperandId); - InstructionDesc[OpTextureGatherOffsets].operands.push(OperandId); - InstructionDesc[OpTextureQuerySizeLod].operands.push(OperandId); - InstructionDesc[OpTextureQuerySizeLod].operands.push(OperandId); - InstructionDesc[OpTextureQuerySize].operands.push(OperandId); - InstructionDesc[OpTextureQueryLod].operands.push(OperandId); - InstructionDesc[OpTextureQueryLod].operands.push(OperandId); - InstructionDesc[OpTextureQueryLevels].operands.push(OperandId); - InstructionDesc[OpTextureQuerySamples].operands.push(OperandId); - InstructionDesc[OpAccessChain].operands.push(OperandId); - InstructionDesc[OpAccessChain].operands.push(OperandVariableIds); - InstructionDesc[OpInBoundsAccessChain].operands.push(OperandId); - InstructionDesc[OpInBoundsAccessChain].operands.push(OperandVariableIds); - InstructionDesc[OpSNegate].operands.push(OperandId); - InstructionDesc[OpFNegate].operands.push(OperandId); - InstructionDesc[OpNot].operands.push(OperandId); - InstructionDesc[OpAny].operands.push(OperandId); - InstructionDesc[OpAll].operands.push(OperandId); - InstructionDesc[OpConvertFToU].operands.push(OperandId); - InstructionDesc[OpConvertFToS].operands.push(OperandId); - InstructionDesc[OpConvertSToF].operands.push(OperandId); - InstructionDesc[OpConvertUToF].operands.push(OperandId); - InstructionDesc[OpUConvert].operands.push(OperandId); - InstructionDesc[OpSConvert].operands.push(OperandId); - InstructionDesc[OpFConvert].operands.push(OperandId); - InstructionDesc[OpConvertPtrToU].operands.push(OperandId); - InstructionDesc[OpConvertUToPtr].operands.push(OperandId); - InstructionDesc[OpPtrCastToGeneric].operands.push(OperandId); - InstructionDesc[OpGenericCastToPtr].operands.push(OperandId); - InstructionDesc[OpGenericCastToPtrExplicit].operands.push(OperandId); - InstructionDesc[OpGenericCastToPtrExplicit].operands.push(OperandStorage); - InstructionDesc[OpGenericPtrMemSemantics].operands.push(OperandId); - InstructionDesc[OpBitcast].operands.push(OperandId); - InstructionDesc[OpTranspose].operands.push(OperandId); - InstructionDesc[OpIsNan].operands.push(OperandId); - InstructionDesc[OpIsInf].operands.push(OperandId); - InstructionDesc[OpIsFinite].operands.push(OperandId); - InstructionDesc[OpIsNormal].operands.push(OperandId); - InstructionDesc[OpSignBitSet].operands.push(OperandId); - InstructionDesc[OpLessOrGreater].operands.push(OperandId); - InstructionDesc[OpLessOrGreater].operands.push(OperandId); - InstructionDesc[OpOrdered].operands.push(OperandId); - InstructionDesc[OpOrdered].operands.push(OperandId); - InstructionDesc[OpUnordered].operands.push(OperandId); - InstructionDesc[OpUnordered].operands.push(OperandId); - InstructionDesc[OpArrayLength].operands.push(OperandId); - InstructionDesc[OpArrayLength].operands.push(OperandLiteralNumber); - InstructionDesc[OpIAdd].operands.push(OperandId); - InstructionDesc[OpIAdd].operands.push(OperandId); - InstructionDesc[OpFAdd].operands.push(OperandId); - InstructionDesc[OpFAdd].operands.push(OperandId); - InstructionDesc[OpISub].operands.push(OperandId); - InstructionDesc[OpISub].operands.push(OperandId); - InstructionDesc[OpFSub].operands.push(OperandId); - InstructionDesc[OpFSub].operands.push(OperandId); - InstructionDesc[OpIMul].operands.push(OperandId); - InstructionDesc[OpIMul].operands.push(OperandId); - InstructionDesc[OpFMul].operands.push(OperandId); - InstructionDesc[OpFMul].operands.push(OperandId); - InstructionDesc[OpUDiv].operands.push(OperandId); - InstructionDesc[OpUDiv].operands.push(OperandId); - InstructionDesc[OpSDiv].operands.push(OperandId); - InstructionDesc[OpSDiv].operands.push(OperandId); - InstructionDesc[OpFDiv].operands.push(OperandId); - InstructionDesc[OpFDiv].operands.push(OperandId); - InstructionDesc[OpUMod].operands.push(OperandId); - InstructionDesc[OpUMod].operands.push(OperandId); - InstructionDesc[OpSRem].operands.push(OperandId); - InstructionDesc[OpSRem].operands.push(OperandId); - InstructionDesc[OpSMod].operands.push(OperandId); - InstructionDesc[OpSMod].operands.push(OperandId); - InstructionDesc[OpFRem].operands.push(OperandId); - InstructionDesc[OpFRem].operands.push(OperandId); - InstructionDesc[OpFMod].operands.push(OperandId); - InstructionDesc[OpFMod].operands.push(OperandId); - InstructionDesc[OpVectorTimesScalar].operands.push(OperandId); - InstructionDesc[OpVectorTimesScalar].operands.push(OperandId); - InstructionDesc[OpMatrixTimesScalar].operands.push(OperandId); - InstructionDesc[OpMatrixTimesScalar].operands.push(OperandId); - InstructionDesc[OpVectorTimesMatrix].operands.push(OperandId); - InstructionDesc[OpVectorTimesMatrix].operands.push(OperandId); - InstructionDesc[OpMatrixTimesVector].operands.push(OperandId); - InstructionDesc[OpMatrixTimesVector].operands.push(OperandId); - InstructionDesc[OpMatrixTimesMatrix].operands.push(OperandId); - InstructionDesc[OpMatrixTimesMatrix].operands.push(OperandId); - InstructionDesc[OpOuterProduct].operands.push(OperandId); - InstructionDesc[OpOuterProduct].operands.push(OperandId); - InstructionDesc[OpDot].operands.push(OperandId); - InstructionDesc[OpDot].operands.push(OperandId); - InstructionDesc[OpShiftRightLogical].operands.push(OperandId); - InstructionDesc[OpShiftRightLogical].operands.push(OperandId); - InstructionDesc[OpShiftRightArithmetic].operands.push(OperandId); - InstructionDesc[OpShiftRightArithmetic].operands.push(OperandId); - InstructionDesc[OpShiftLeftLogical].operands.push(OperandId); - InstructionDesc[OpShiftLeftLogical].operands.push(OperandId); - InstructionDesc[OpLogicalOr].operands.push(OperandId); - InstructionDesc[OpLogicalOr].operands.push(OperandId); - InstructionDesc[OpLogicalXor].operands.push(OperandId); - InstructionDesc[OpLogicalXor].operands.push(OperandId); - InstructionDesc[OpLogicalAnd].operands.push(OperandId); - InstructionDesc[OpLogicalAnd].operands.push(OperandId); - InstructionDesc[OpBitwiseOr].operands.push(OperandId); - InstructionDesc[OpBitwiseOr].operands.push(OperandId); - InstructionDesc[OpBitwiseXor].operands.push(OperandId); - InstructionDesc[OpBitwiseXor].operands.push(OperandId); - InstructionDesc[OpBitwiseAnd].operands.push(OperandId); - InstructionDesc[OpBitwiseAnd].operands.push(OperandId); - InstructionDesc[OpSelect].operands.push(OperandId); - InstructionDesc[OpSelect].operands.push(OperandId); - InstructionDesc[OpSelect].operands.push(OperandId); - InstructionDesc[OpIEqual].operands.push(OperandId); - InstructionDesc[OpIEqual].operands.push(OperandId); - InstructionDesc[OpFOrdEqual].operands.push(OperandId); - InstructionDesc[OpFOrdEqual].operands.push(OperandId); - InstructionDesc[OpFUnordEqual].operands.push(OperandId); - InstructionDesc[OpFUnordEqual].operands.push(OperandId); - InstructionDesc[OpINotEqual].operands.push(OperandId); - InstructionDesc[OpINotEqual].operands.push(OperandId); - InstructionDesc[OpFOrdNotEqual].operands.push(OperandId); - InstructionDesc[OpFOrdNotEqual].operands.push(OperandId); - InstructionDesc[OpFUnordNotEqual].operands.push(OperandId); - InstructionDesc[OpFUnordNotEqual].operands.push(OperandId); - InstructionDesc[OpULessThan].operands.push(OperandId); - InstructionDesc[OpULessThan].operands.push(OperandId); - InstructionDesc[OpSLessThan].operands.push(OperandId); - InstructionDesc[OpSLessThan].operands.push(OperandId); - InstructionDesc[OpFOrdLessThan].operands.push(OperandId); - InstructionDesc[OpFOrdLessThan].operands.push(OperandId); - InstructionDesc[OpFUnordLessThan].operands.push(OperandId); - InstructionDesc[OpFUnordLessThan].operands.push(OperandId); - InstructionDesc[OpUGreaterThan].operands.push(OperandId); - InstructionDesc[OpUGreaterThan].operands.push(OperandId); - InstructionDesc[OpSGreaterThan].operands.push(OperandId); - InstructionDesc[OpSGreaterThan].operands.push(OperandId); - InstructionDesc[OpFOrdGreaterThan].operands.push(OperandId); - InstructionDesc[OpFOrdGreaterThan].operands.push(OperandId); - InstructionDesc[OpFUnordGreaterThan].operands.push(OperandId); - InstructionDesc[OpFUnordGreaterThan].operands.push(OperandId); - InstructionDesc[OpULessThanEqual].operands.push(OperandId); - InstructionDesc[OpULessThanEqual].operands.push(OperandId); - InstructionDesc[OpSLessThanEqual].operands.push(OperandId); - InstructionDesc[OpSLessThanEqual].operands.push(OperandId); - InstructionDesc[OpFOrdLessThanEqual].operands.push(OperandId); - InstructionDesc[OpFOrdLessThanEqual].operands.push(OperandId); - InstructionDesc[OpFUnordLessThanEqual].operands.push(OperandId); - InstructionDesc[OpFUnordLessThanEqual].operands.push(OperandId); - InstructionDesc[OpUGreaterThanEqual].operands.push(OperandId); - InstructionDesc[OpUGreaterThanEqual].operands.push(OperandId); - InstructionDesc[OpSGreaterThanEqual].operands.push(OperandId); - InstructionDesc[OpSGreaterThanEqual].operands.push(OperandId); - InstructionDesc[OpFOrdGreaterThanEqual].operands.push(OperandId); - InstructionDesc[OpFOrdGreaterThanEqual].operands.push(OperandId); - InstructionDesc[OpFUnordGreaterThanEqual].operands.push(OperandId); - InstructionDesc[OpFUnordGreaterThanEqual].operands.push(OperandId); - InstructionDesc[OpDPdx].operands.push(OperandId); - InstructionDesc[OpDPdy].operands.push(OperandId); - InstructionDesc[OpFwidth].operands.push(OperandId); - InstructionDesc[OpDPdxFine].operands.push(OperandId); - InstructionDesc[OpDPdyFine].operands.push(OperandId); - InstructionDesc[OpFwidthFine].operands.push(OperandId); - InstructionDesc[OpDPdxCoarse].operands.push(OperandId); - InstructionDesc[OpDPdyCoarse].operands.push(OperandId); - InstructionDesc[OpFwidthCoarse].operands.push(OperandId); - InstructionDesc[OpEmitStreamVertex].operands.push(OperandId); - InstructionDesc[OpEndStreamPrimitive].operands.push(OperandId); - InstructionDesc[OpControlBarrier].operands.push(OperandExecutionScope); - InstructionDesc[OpMemoryBarrier].operands.push(OperandExecutionScope); - InstructionDesc[OpMemoryBarrier].operands.push(OperandMemorySemantics); - InstructionDesc[OpImagePointer].operands.push(OperandId); - InstructionDesc[OpImagePointer].operands.push(OperandId); - InstructionDesc[OpImagePointer].operands.push(OperandId); - InstructionDesc[OpAtomicInit].operands.push(OperandId); - InstructionDesc[OpAtomicInit].operands.push(OperandId); - InstructionDesc[OpAtomicLoad].operands.push(OperandId); - InstructionDesc[OpAtomicLoad].operands.push(OperandExecutionScope); - InstructionDesc[OpAtomicLoad].operands.push(OperandMemorySemantics); - InstructionDesc[OpAtomicStore].operands.push(OperandId); - InstructionDesc[OpAtomicStore].operands.push(OperandExecutionScope); - InstructionDesc[OpAtomicStore].operands.push(OperandMemorySemantics); - InstructionDesc[OpAtomicStore].operands.push(OperandId); - InstructionDesc[OpAtomicExchange].operands.push(OperandId); - InstructionDesc[OpAtomicExchange].operands.push(OperandExecutionScope); - InstructionDesc[OpAtomicExchange].operands.push(OperandMemorySemantics); - InstructionDesc[OpAtomicExchange].operands.push(OperandId); - InstructionDesc[OpAtomicCompareExchange].operands.push(OperandId); - InstructionDesc[OpAtomicCompareExchange].operands.push(OperandExecutionScope); - InstructionDesc[OpAtomicCompareExchange].operands.push(OperandMemorySemantics); - InstructionDesc[OpAtomicCompareExchange].operands.push(OperandId); - InstructionDesc[OpAtomicCompareExchange].operands.push(OperandId); - InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandId); - InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandExecutionScope); - InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandMemorySemantics); - InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandId); - InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandId); - InstructionDesc[OpAtomicIIncrement].operands.push(OperandId); - InstructionDesc[OpAtomicIIncrement].operands.push(OperandExecutionScope); - InstructionDesc[OpAtomicIIncrement].operands.push(OperandMemorySemantics); - InstructionDesc[OpAtomicIDecrement].operands.push(OperandId); - InstructionDesc[OpAtomicIDecrement].operands.push(OperandExecutionScope); - InstructionDesc[OpAtomicIDecrement].operands.push(OperandMemorySemantics); - InstructionDesc[OpAtomicIAdd].operands.push(OperandId); - InstructionDesc[OpAtomicIAdd].operands.push(OperandExecutionScope); - InstructionDesc[OpAtomicIAdd].operands.push(OperandMemorySemantics); - InstructionDesc[OpAtomicIAdd].operands.push(OperandId); - InstructionDesc[OpAtomicISub].operands.push(OperandId); - InstructionDesc[OpAtomicISub].operands.push(OperandExecutionScope); - InstructionDesc[OpAtomicISub].operands.push(OperandMemorySemantics); - InstructionDesc[OpAtomicISub].operands.push(OperandId); - InstructionDesc[OpAtomicUMin].operands.push(OperandId); - InstructionDesc[OpAtomicUMin].operands.push(OperandExecutionScope); - InstructionDesc[OpAtomicUMin].operands.push(OperandMemorySemantics); - InstructionDesc[OpAtomicUMin].operands.push(OperandId); - InstructionDesc[OpAtomicUMax].operands.push(OperandId); - InstructionDesc[OpAtomicUMax].operands.push(OperandExecutionScope); - InstructionDesc[OpAtomicUMax].operands.push(OperandMemorySemantics); - InstructionDesc[OpAtomicUMax].operands.push(OperandId); - InstructionDesc[OpAtomicAnd].operands.push(OperandId); - InstructionDesc[OpAtomicAnd].operands.push(OperandExecutionScope); - InstructionDesc[OpAtomicAnd].operands.push(OperandMemorySemantics); - InstructionDesc[OpAtomicAnd].operands.push(OperandId); - InstructionDesc[OpAtomicOr].operands.push(OperandId); - InstructionDesc[OpAtomicOr].operands.push(OperandExecutionScope); - InstructionDesc[OpAtomicOr].operands.push(OperandMemorySemantics); - InstructionDesc[OpAtomicOr].operands.push(OperandId); - InstructionDesc[OpAtomicXor].operands.push(OperandId); - InstructionDesc[OpAtomicXor].operands.push(OperandExecutionScope); - InstructionDesc[OpAtomicXor].operands.push(OperandMemorySemantics); - InstructionDesc[OpAtomicXor].operands.push(OperandId); - InstructionDesc[OpLoopMerge].operands.push(OperandId); - InstructionDesc[OpLoopMerge].operands.push(OperandLoop); - InstructionDesc[OpSelectionMerge].operands.push(OperandId); - InstructionDesc[OpSelectionMerge].operands.push(OperandSelect); - InstructionDesc[OpBranch].operands.push(OperandId); - InstructionDesc[OpBranchConditional].operands.push(OperandId); - InstructionDesc[OpBranchConditional].operands.push(OperandId); - InstructionDesc[OpBranchConditional].operands.push(OperandId); - InstructionDesc[OpBranchConditional].operands.push(OperandVariableLiterals); - InstructionDesc[OpSwitch].operands.push(OperandId); - InstructionDesc[OpSwitch].operands.push(OperandId); - InstructionDesc[OpSwitch].operands.push(OperandVariableLiteralId); - InstructionDesc[OpReturnValue].operands.push(OperandId); - InstructionDesc[OpLifetimeStart].operands.push(OperandId); - InstructionDesc[OpLifetimeStart].operands.push(OperandLiteralNumber); - InstructionDesc[OpLifetimeStop].operands.push(OperandId); - InstructionDesc[OpLifetimeStop].operands.push(OperandLiteralNumber); - InstructionDesc[OpCompileFlag].operands.push(OperandLiteralString); - InstructionDesc[OpAsyncGroupCopy].operands.push(OperandExecutionScope); - InstructionDesc[OpAsyncGroupCopy].operands.push(OperandId); - InstructionDesc[OpAsyncGroupCopy].operands.push(OperandId); - InstructionDesc[OpAsyncGroupCopy].operands.push(OperandId); - InstructionDesc[OpAsyncGroupCopy].operands.push(OperandId); - InstructionDesc[OpAsyncGroupCopy].operands.push(OperandId); - InstructionDesc[OpWaitGroupEvents].operands.push(OperandExecutionScope); - InstructionDesc[OpWaitGroupEvents].operands.push(OperandId); - InstructionDesc[OpWaitGroupEvents].operands.push(OperandId); - InstructionDesc[OpGroupAll].operands.push(OperandExecutionScope); - InstructionDesc[OpGroupAll].operands.push(OperandId); - InstructionDesc[OpGroupAny].operands.push(OperandExecutionScope); - InstructionDesc[OpGroupAny].operands.push(OperandId); - InstructionDesc[OpGroupBroadcast].operands.push(OperandExecutionScope); - InstructionDesc[OpGroupBroadcast].operands.push(OperandId); - InstructionDesc[OpGroupBroadcast].operands.push(OperandId); - InstructionDesc[OpGroupIAdd].operands.push(OperandExecutionScope); - InstructionDesc[OpGroupIAdd].operands.push(OperandGroupOperation); - InstructionDesc[OpGroupIAdd].operands.push(OperandId); - InstructionDesc[OpGroupFAdd].operands.push(OperandExecutionScope); - InstructionDesc[OpGroupFAdd].operands.push(OperandGroupOperation); - InstructionDesc[OpGroupFAdd].operands.push(OperandId); - InstructionDesc[OpGroupUMin].operands.push(OperandExecutionScope); - InstructionDesc[OpGroupUMin].operands.push(OperandGroupOperation); - InstructionDesc[OpGroupUMin].operands.push(OperandId); - InstructionDesc[OpGroupSMin].operands.push(OperandExecutionScope); - InstructionDesc[OpGroupSMin].operands.push(OperandGroupOperation); - InstructionDesc[OpGroupSMin].operands.push(OperandId); - InstructionDesc[OpGroupFMin].operands.push(OperandExecutionScope); - InstructionDesc[OpGroupFMin].operands.push(OperandGroupOperation); - InstructionDesc[OpGroupFMin].operands.push(OperandId); - InstructionDesc[OpGroupUMax].operands.push(OperandExecutionScope); - InstructionDesc[OpGroupUMax].operands.push(OperandGroupOperation); - InstructionDesc[OpGroupUMax].operands.push(OperandId); - InstructionDesc[OpGroupSMax].operands.push(OperandExecutionScope); - InstructionDesc[OpGroupSMax].operands.push(OperandGroupOperation); - InstructionDesc[OpGroupSMax].operands.push(OperandId); - InstructionDesc[OpGroupFMax].operands.push(OperandExecutionScope); - InstructionDesc[OpGroupFMax].operands.push(OperandGroupOperation); - InstructionDesc[OpGroupFMax].operands.push(OperandId); - InstructionDesc[OpReadPipe].operands.push(OperandId); - InstructionDesc[OpReadPipe].operands.push(OperandId); - InstructionDesc[OpWritePipe].operands.push(OperandId); - InstructionDesc[OpWritePipe].operands.push(OperandId); - InstructionDesc[OpReservedReadPipe].operands.push(OperandId); - InstructionDesc[OpReservedReadPipe].operands.push(OperandId); - InstructionDesc[OpReservedReadPipe].operands.push(OperandId); - InstructionDesc[OpReservedReadPipe].operands.push(OperandId); - InstructionDesc[OpReservedWritePipe].operands.push(OperandId); - InstructionDesc[OpReservedWritePipe].operands.push(OperandId); - InstructionDesc[OpReservedWritePipe].operands.push(OperandId); - InstructionDesc[OpReservedWritePipe].operands.push(OperandId); - InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId); - InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId); - InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId); - InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId); - InstructionDesc[OpCommitReadPipe].operands.push(OperandId); - InstructionDesc[OpCommitReadPipe].operands.push(OperandId); - InstructionDesc[OpCommitWritePipe].operands.push(OperandId); - InstructionDesc[OpCommitWritePipe].operands.push(OperandId); - InstructionDesc[OpIsValidReserveId].operands.push(OperandId); - InstructionDesc[OpGetNumPipePackets].operands.push(OperandId); - InstructionDesc[OpGetMaxPipePackets].operands.push(OperandId); - InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandExecutionScope); - InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId); - InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId); - InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandExecutionScope); - InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId); - InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId); - InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandExecutionScope); - InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId); - InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId); - InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandExecutionScope); - InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId); - InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId); - InstructionDesc[OpBuildNDRange].operands.push(OperandId); - InstructionDesc[OpBuildNDRange].operands.push(OperandId); - InstructionDesc[OpBuildNDRange].operands.push(OperandId); - InstructionDesc[OpCaptureEventProfilingInfo].operands.push(OperandId); - InstructionDesc[OpCaptureEventProfilingInfo].operands.push(OperandKernelProfilingInfo); - InstructionDesc[OpCaptureEventProfilingInfo].operands.push(OperandId); - InstructionDesc[OpSetUserEventStatus].operands.push(OperandId); - InstructionDesc[OpSetUserEventStatus].operands.push(OperandId); - InstructionDesc[OpIsValidEvent].operands.push(OperandId); - InstructionDesc[OpRetainEvent].operands.push(OperandId); - InstructionDesc[OpReleaseEvent].operands.push(OperandId); - InstructionDesc[OpGetKernelWorkGroupSize].operands.push(OperandId); - InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].operands.push(OperandId); - InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId); - InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId); - InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId); - InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId); - InstructionDesc[OpEnqueueKernel].operands.push(OperandKernelEnqueueFlags); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId); - InstructionDesc[OpEnqueueKernel].operands.push(OperandId); - InstructionDesc[OpEnqueueKernel].operands.push(OperandVariableIds); - InstructionDesc[OpEnqueueMarker].operands.push(OperandId); - InstructionDesc[OpEnqueueMarker].operands.push(OperandId); - InstructionDesc[OpEnqueueMarker].operands.push(OperandId); - InstructionDesc[OpEnqueueMarker].operands.push(OperandId); -} - -// -// A whole set of functions that translate enums to English. -// - -const char* CapabilityString(int cap) -{ - switch (cap) { - case CapMatrix: return "Matrix"; - case CapShader: return "Shader"; - case CapGeom: return "Geom"; - case CapTess: return "Tess"; - case CapAddr: return "Addr"; - case CapLink: return "Link"; - case CapKernel: return "Kernel"; - - default: return "unknown"; - - } -} - -const char* SourceString(int source) -{ - switch (source) { - case LangESSL: return "ESSL"; - case LangGLSL: return "GLSL"; - case LangOpenCL: return "OpenCL"; - - default: return "unknown"; - } -} - -const char* ExecutionModelString(int model) -{ - switch (model) { - case ModelVertex: return "Vertex"; - case ModelTessellationControl: return "TessellationControl"; - case ModelTessellationEvaluation: return "TessellationEvaluation"; - case ModelGeometry: return "Geometry"; - case ModelFragment: return "Fragment"; - case ModelGLCompute: return "GLCompute"; - case ModelKernel: return "Kernel"; - - default: return "BadModel"; - } -} - -const char* AddressingString(int addr) -{ - switch (addr) { - case AddressingLogical: return "Logical"; - case AddressingPhysical32: return "Physical32"; - case AddressingPhysical64: return "Physical64"; - - default: return "BadAddressModel"; - } -} - -const char* AddressingDesc(int addr) -{ - switch (addr) { - case AddressingLogical: return "No variables that are pointers or other physical pointers. No arithmetic or casting on pointers."; - case AddressingPhysical32: return ""; - case AddressingPhysical64: return ""; - - default: return "BadAddressModel"; - } -} - -const char* MemoryString(int mem) -{ - switch (mem) { - case MemorySimple: return "Simple"; - case MemoryGLSL450: return "GLSL450"; - case MemoryOCL12: return "OpenCL1.2"; - case MemoryOCL20: return "OpenCL2.0"; - case MemoryOCL21: return "OpenCL2.1"; - default: return "BadMemoryModel"; - } -} - -const char* ExecutionModeString(int mode) -{ - switch (mode) { - case ExecutionInvocations: return "Invocations"; - case ExecutionSpacingEqual: return "SpacingEqual"; - case ExecutionSpacingFractionalEven: return "SpacingFractionalEven"; - case ExecutionSpacingFractionalOdd: return "SpacingFractionalOdd"; - case ExecutionVertexOrderCw: return "VertexOrderCw"; - case ExecutionVertexOrderCcw: return "VertexOrderCcw"; - case ExecutionPixelCenterInteger: return "PixelCenterInteger"; - case ExecutionOriginUpperLeft: return "OriginUpperLeft"; - case ExecutionEarlyFragmentTests: return "EarlyFragmentTests"; - case ExecutionPointMode: return "PointMode"; - case ExecutionLocalSize: return "LocalSize"; - case ExecutionLocalSizeHint: return "LocalSizeHint"; - case ExecutionVecTypeHint: return "VecTypeHint"; - case ExecutionContractionOff: return "ContractionOff"; - case ExecutionXfb: return "Xfb"; - case ExecutionDepthReplacing: return "DepthReplacing"; - case ExecutionDepthAny: return "DepthAny"; - case ExecutionDepthGreater: return "DepthGreater"; - case ExecutionDepthLess: return "DepthLess"; - case ExecutionDepthUnchanged: return "DepthUnchanged"; - - case ExecutionInputPoints: return "InputPoints"; - case ExecutionInputLines: return "InputLines"; - case ExecutionInputLinesAdjacency: return "InputLinesAdjacency"; - case ExecutionInputTriangles: return "InputTriangles"; - case ExecutionInputTrianglesAdjacency: return "InputTrianglesAdjacency"; - case ExecutionInputQuads: return "InputQuads"; - case ExecutionInputIsolines: return "InputIsolines"; - - case ExecutionOutputVertices: return "OutputVertices"; - case ExecutionOutputPoints: return "OutputPoints"; - case ExecutionOutputLineStrip: return "OutputLineStrip"; - case ExecutionOutputTriangleStrip: return "OutputTriangleStrip"; - - default: return "BadMode"; - } -} - -const char* StorageClassString(int StorageClass) -{ - switch (StorageClass) { - //case StorageLowertime: return "Lowertime"; // TODO: finish removing when sure they are gone. - case StorageConstantUniform: return "UniformConstant"; - case StorageUniform: return "Uniform"; - case StorageInput: return "Input"; - case StorageOutput: return "Output"; - case StorageWorkgroupLocal: return "WorkgroupLocal"; - case StoragePrivateGlobal: return "PrivateGlobal"; - case StorageWorkgroupGlobal: return "WorkgroupGlobal"; - case StorageFunction: return "Function"; - case StoragePrivate: return "Private"; - case StorageAtomicCounter: return "AtomicCounter"; - case StorageGeneric: return "Generic"; - - default: return 0; - } -} - -const char* DecorationString(int decoration) -{ - switch (decoration) { - case DecPrecisionLow: return "PrecisionLow"; - case DecPrecisionMedium: return "PrecisionMedium"; - case DecPrecisionHigh: return "PrecisionHigh"; - case DecBlock: return "Block"; - case DecBufferBlock: return "BufferBlock"; - case DecRowMajor: return "RowMajor"; - case DecColMajor: return "ColMajor"; - case DecGLSLShared: return "GLSLShared"; - case DecGLSLStd140: return "GLSLStd140"; - case DecGLSLStd430: return "GLSLStd430"; - case DecGLSLPacked: return "GLSLPacked"; - case DecSmooth: return "Smooth"; - case DecNoperspective: return "Noperspective"; - case DecFlat: return "Flat"; - case DecPatch: return "Patch"; - case DecCentroid: return "Centroid"; - case DecSample: return "Sample"; - case DecInvariant: return "Invariant"; - case DecRestrict: return "Restrict"; - case DecAliased: return "Aliased"; - case DecVolatile: return "Volatile"; - case DecConstant: return "Constant"; - case DecCoherent: return "Coherent"; - case DecNonwritable: return "Nonwritable"; - case DecNonreadable: return "Nonreadable"; - case DecUniform: return "Uniform"; - case DecNoStaticUse: return "NoStaticUse"; - case DecCPacked: return "CPacked"; - case DecFuncParamAttr: return "FuncParamAttr"; - case DecFPSaturatedConv: return "FPSaturatedConversion"; - case DecFPRoundingMode: return "FP Rounding Mode"; - case DecFPFastMathMode: return "FP Fast Math Mode"; - case DecLinkageType: return "Linkage Type"; - case DecStream: return "Stream"; - case DecLocation: return "Location"; - case DecComponent: return "Component"; - case DecIndex: return "Index"; - case DecBinding: return "Binding"; - case DecDescriptorSet: return "DescriptorSet"; - case DecOffset: return "Offset"; - case DecAlignment: return "Alignment"; - case DecXfbBuffer: return "XfbBuffer"; - case DecStride: return "Stride"; - case DecBuiltIn: return "Built-In"; - case DecSpecId: return "SpecId"; - - default: return "BadDecoration"; - } -} - -const char* BuiltInString(int builtIn) -{ - switch (builtIn) { - case BuiltInPosition: return "Position"; - case BuiltInPointSize: return "PointSize"; - case BuiltInClipVertex: return "ClipVertex"; - case BuiltInClipDistance: return "ClipDistance"; - case BuiltInCullDistance: return "CullDistance"; - case BuiltInVertexId: return "VertexId"; - case BuiltInInstanceId: return "InstanceId"; - case BuiltInPrimitiveId: return "PrimitiveId"; - case BuiltInInvocationId: return "InvocationId"; - case BuiltInLayer: return "Layer"; - case BuiltInViewportIndex: return "ViewportIndex"; - case BuiltInTessLevelOuter: return "TessLevelOuter"; - case BuiltInTessLevelInner: return "TessLevelInner"; - case BuiltInTessCoord: return "TessCoord"; - case BuiltInPatchVertices: return "PatchVertices"; - case BuiltInFragCoord: return "FragCoord"; - case BuiltInPointCoord: return "PointCoord"; - case BuiltInFrontFacing: return "FrontFacing"; - case BuiltInSampleId: return "SampleId"; - case BuiltInSamplePosition: return "SamplePosition"; - case BuiltInSampleMask: return "SampleMask"; - case BuiltInFragColor: return "FragColor"; - case BuiltInFragDepth: return "FragDepth"; - case BuiltInHelperInvocation: return "HelperInvocation"; - case BuiltInNumWorkgroups: return "NumWorkgroups"; - case BuiltInWorkgroupSize: return "WorkgroupSize"; - case BuiltInWorkgroupId: return "WorkgroupId"; - case BuiltInLocalInvocationId: return "LocalInvocationId"; - case BuiltInGlobalInvocationId: return "GlobalInvocationId"; - case BuiltInLocalInvocationIndex: return "LocalInvocationIndex"; - case BuiltInWorkDim: return "WorkDim"; - case BuiltInGlobalSize: return "GlobalSize"; - case BuiltInEnqueuedWorkgroupSize: return "EnqueuedWorkgroupSize"; - case BuiltInGlobalOffset: return "GlobalOffset"; - case BuiltInGlobalLinearId: return "GlobalLinearId"; - case BuiltInWorkgroupLinearId: return "WorkgroupLinearId"; - case BuiltInSubgroupSize: return "SubgroupSize"; - case BuiltInSubgroupMaxSize: return "SubgroupMaxSize"; - case BuiltInNumSubgroups: return "NumSubgroups"; - case BuiltInNumEnqueuedSubgroups: return "NumEnqueuedSubgroups"; - case BuiltInSubgroupId: return "SubgroupId"; - case BuiltInSubgroupLocalInvocationId: return "SubgroupLocalInvocationId"; - default: return "BadBuiltIn"; - } -} - -const char* DimensionString(int dim) -{ - switch (dim) { - case Dim1D: return "1D"; - case Dim2D: return "2D"; - case Dim3D: return "3D"; - case DimCube: return "Cube"; - case DimRect: return "Rect"; - case DimBuffer: return "Buffer"; - - default: return "BadDimensionality"; - } -} - -const char* SamplerAddressingModeString(int mode) -{ - switch (mode) { - case SamplerAddressingNone: return "None"; - case SamplerAddressingClampToEdge: return "ClampEdge"; - case SamplerAddressingClamp: return "Clamp"; - case SamplerAddressingRepeat: return "Repeat"; - case SamplerAddressingRepeatMirrored: return "RepeatMirrored"; - - default: return "BadSamplerAddrMode"; - } -} - -const char* SamplerFilterModeString(int mode) -{ - switch (mode) { - case SamplerFilterNearest: return "Nearest"; - case SamplerFilterLinear: return "Linear"; - - default: return "BadSamplerFilterMode"; - } -} - -const char* FPFastMathString(int mode) -{ - switch (mode) { - case FPFastMathNNan: return "NotNaN"; - case FPFastMathNInf: return "NotInf"; - case FPFastMathNSZ: return "NSZ"; - case FPFastMathARcp: return "AllowRecip"; - case FPFastMathFast: return "Fast"; - - default: return "BadFastMathMode"; - } -} - -const char* FPRoundingModeString(int mode) -{ - switch (mode) { - case FPRoundRTE: return "RTE"; - case FPRoundRTZ: return "RTZ"; - case FPRoundRTP: return "RTP"; - case FPRoundRTN: return "RTN"; - - default: return "BadFPRoundingMode"; - } -} - - -const char* LinkageTypeString(int type) -{ - switch (type) { - case LinkageExport: return "Export"; - case LinkageImport: return "Import"; - - default: return "BadLinkageType"; - } -} - -const char* FuncParamAttrString(int attr) -{ - switch (attr) { - case FuncParamAttrZext: return "Zext"; - case FuncParamAttrSext: return "Sext"; - case FuncParamAttrByval: return "ByVal"; - case FuncParamAttrSret: return "Sret"; - case FuncParamAttrNoAlias: return "NoAlias"; - case FuncParamAttrNoCapture: return "NoCapture"; - case FuncParamAttrSVM: return "SVM"; - case FuncParamAttrNoWrite: return "NoWrite"; - case FuncParamAttrNoReadWrite: return "NoReadWrite"; - - default: return "BadFunctionParameterAttribute"; - } -} - -const char* AccessQualifierString(int attr) -{ - switch (attr) { - case AccessQualReadOnly: return "ReadOnly"; - case AccessQualWriteOnly: return "WriteOnly"; - case AccessQualReadWrite: return "ReadWrite"; - - default: return "BadAccessQualifier"; - } -} - -const char* SelectControlString(int cont) -{ - switch (cont) { - case SelectControlNone: return "NoControl"; - case SelectControlFlatten: return "Flatten"; - case SelectControlDontFlatten: return "DontFlatten"; - - default: return "BadSelectControl"; - } -} - -const char* FunctionControlString(int cont) -{ - switch (cont) { - case FunctionControlNone: return "NoControl"; - case FunctionControlInline: return "InLine"; - case FunctionControlDontInline: return "DontInline"; - case FunctionControlPure: return "Pure"; - case FunctionControlConst: return "Const"; - - default: return "Bad-select-control"; - } -} - -const char* LoopControlString(int cont) -{ - switch (cont) { - case LoopControlNone: return "NoControl"; - case LoopControlUnroll: return "Unroll"; - case LoopControlDontUnroll: return "DontUnroll"; - - default: return "Bad-loop-control"; - } -} - -const char* MemorySemanticsString(int mem) -{ - switch (mem) { - case MemorySemanticsRelaxed: return "Relaxed"; - case MemorySemanticsSequentiallyConsistent: return "Sequentially-Consistent"; - case MemorySemanticsAcquire: return "Acquire"; - case MemorySemanticsRelease: return "Release"; - - case MemorySemanticsUniform: return "Uniform-memory"; - case MemorySemanticsSubgroup: return "Subgroup-memory"; - case MemorySemanticsWorkgroupLocal: return "Workgroup-local-memory"; - case MemorySemanticsWorkgroupGlobal: return "Workgroup-global-memory"; - case MemorySemanticsAtomicCounter: return "Atomic-counter-memory"; - case MemorySemanticsImage: return "Image-memory"; - - default: return "Bad-memory-semantic"; - } -} - -const char* MemoryAccessString(int mem) -{ - switch (mem) { - case MemoryAccessVolatile: return "Volatile"; - case MemoryAccessAligned: return "Aligned"; - - default: return "Bad-memory-access"; - } -} - -const char* ExecutionScopeString(int mem) -{ - switch (mem) { - case ExecutionScopeCrossDevice: return "CrossDevice"; - case ExecutionScopeDevice: return "Device"; - case ExecutionScopeWorkgroup: return "Workgroup"; - case ExecutionScopeSubgroup: return "Subgroup"; - - default: return "Bad-execution-scope"; - } -} - -const char* GroupOperationString(int gop) { - - switch (gop) - { - case GroupOpReduce: return "Reduce"; - case GroupOpInclusiveScan: return "InclusiveScan"; - case GroupOpExclusiveScan: return "ExclusiveScan"; - - default: return "Bad-execution-scope"; - } -} - -const char* KernelEnqueueFlagsString(int flag) { - switch (flag) - { - case spv::EnqFlagNoWait: return "NoWait"; - case spv::EnqFlagWaitKernel: return "WaitKernel"; - case spv::EnqFlagWaitWaitWorgGroup: return "WaitWorkGroup"; - - default: return "Bad-enqueue-flag"; - } -} - -const char* KernelProfilingInfoString(int info) { - switch (info) - { - case spv::ProfInfoCmdExecTime: return "CmdExecTime"; - default: return "Bad-profiling-info"; - } -} - -const char* GetOperandDesc(OperandClass operand) -{ - switch (operand) { - case OperandId: return ""; - case OperandOptionalId: return "Optional "; - case OperandVariableIds: return ", , ..."; - case OperandVariableLiterals: return "literal, literal, ..."; - case OperandVariableLiteralId: return "literal, label , +\nliteral, label , +\n..."; - case OperandLiteralNumber: return "Literal Number"; - case OperandLiteralString: return "Literal String"; - case OperandSource: return "Source Language"; - case OperandExecutionModel: return "Execution Model"; - case OperandAddressing: return "Addressing Model"; - case OperandMemory: return "Memory Model"; - case OperandExecutionMode: return "Execution Mode"; - case OperandStorage: return "Storage Class"; - case OperandDimensionality: return "Dim"; - case OperandDecoration: return "Decoration"; - case OperandBuiltIn: return "Built-In"; - case OperandSelect: return "Selection Control"; - case OperandLoop: return "Loop Control"; - case OperandFunction: return "Function Control Mask"; - case OperandSamplerAddressingMode: return "Sampler Addressing Mode"; - case OperandSamplerFilterMode: return "Sampler Filter Mode"; - case OperandFPFastMath: return "FP Fast Math Mode"; - case OperandFPRoundingMode: return "FP Rounding Mode"; - case OperandLinkageType: return "Linkage Type"; - case OperandFuncParamAttr: return "Function Parameter Attribute"; - case OperandAccessQualifier: return "Access Qualifier"; - case OperandMemorySemantics: return "Memory Semantics"; - case OperandMemoryAccess: return "Memory Access"; - case OperandExecutionScope: return "Execution Scope"; - case OperandGroupOperation: return "Group Operation"; - case OperandKernelEnqueueFlags: return "Kernel Enqueue Flags"; - case OperandKernelProfilingInfo: return "Kernel Profiling Info"; - default: return "Unknown"; - } + InstructionDesc[OpSource].operands.push(OperandSource, ""); + InstructionDesc[OpSource].operands.push(OperandLiteralNumber, "'Version'"); + + InstructionDesc[OpSourceExtension].operands.push(OperandLiteralString, "'Extension'"); + + InstructionDesc[OpName].operands.push(OperandId, "'Target'"); + InstructionDesc[OpName].operands.push(OperandLiteralString, "'Name'"); + + InstructionDesc[OpMemberName].operands.push(OperandId, "'Type'"); + InstructionDesc[OpMemberName].operands.push(OperandLiteralNumber, "'Member'"); + InstructionDesc[OpMemberName].operands.push(OperandLiteralString, "'Name'"); + + InstructionDesc[OpString].operands.push(OperandLiteralString, "'String'"); + + InstructionDesc[OpLine].operands.push(OperandId, "'Target'"); + InstructionDesc[OpLine].operands.push(OperandId, "'File'"); + InstructionDesc[OpLine].operands.push(OperandLiteralNumber, "'Line'"); + InstructionDesc[OpLine].operands.push(OperandLiteralNumber, "'Column'"); + + InstructionDesc[OpExtension].operands.push(OperandLiteralString, "'Name'"); + + InstructionDesc[OpExtInstImport].operands.push(OperandLiteralString, "'Name'"); + + InstructionDesc[OpMemoryModel].operands.push(OperandAddressing, ""); + InstructionDesc[OpMemoryModel].operands.push(OperandMemory, ""); + + InstructionDesc[OpEntryPoint].operands.push(OperandExecutionModel, ""); + InstructionDesc[OpEntryPoint].operands.push(OperandId, "'Entry Point'"); + + InstructionDesc[OpExecutionMode].operands.push(OperandId, "'Entry Point'"); + InstructionDesc[OpExecutionMode].operands.push(OperandExecutionMode, "'Mode'"); + InstructionDesc[OpExecutionMode].operands.push(OperandVariableLiterals, "See <>"); + + InstructionDesc[OpTypeInt].operands.push(OperandLiteralNumber, "'Width'"); + InstructionDesc[OpTypeInt].operands.push(OperandLiteralNumber, "'Signedness'"); + + InstructionDesc[OpTypeFloat].operands.push(OperandLiteralNumber, "'Width'"); + + InstructionDesc[OpTypeVector].operands.push(OperandId, "'Component type'"); + InstructionDesc[OpTypeVector].operands.push(OperandLiteralNumber, "'Component count'"); + + InstructionDesc[OpTypeMatrix].capabilities.push_back(CapMatrix); + InstructionDesc[OpTypeMatrix].operands.push(OperandId, "'Column type'"); + InstructionDesc[OpTypeMatrix].operands.push(OperandLiteralNumber, "'Column count'"); + + InstructionDesc[OpTypeSampler].operands.push(OperandId, "'Sampled Type'"); + InstructionDesc[OpTypeSampler].operands.push(OperandDimensionality, ""); + InstructionDesc[OpTypeSampler].operands.push(OperandLiteralNumber, "'Content'"); + InstructionDesc[OpTypeSampler].operands.push(OperandLiteralNumber, "'Arrayed'"); + InstructionDesc[OpTypeSampler].operands.push(OperandLiteralNumber, "'Compare'"); + InstructionDesc[OpTypeSampler].operands.push(OperandLiteralNumber, "'MS'"); + InstructionDesc[OpTypeSampler].operands.push(OperandOptionalId, "'Qualifier'"); + + InstructionDesc[OpTypeArray].operands.push(OperandId, "'Element type'"); + InstructionDesc[OpTypeArray].operands.push(OperandId, "'Length'"); + + InstructionDesc[OpTypeRuntimeArray].capabilities.push_back(CapShader); + InstructionDesc[OpTypeRuntimeArray].operands.push(OperandId, "'Element type'"); + + InstructionDesc[OpTypeStruct].operands.push(OperandVariableIds, "'Member 0 type', +\n'member 1 type', +\n..."); + + InstructionDesc[OpTypeOpaque].capabilities.push_back(CapKernel); + InstructionDesc[OpTypeOpaque].operands.push(OperandLiteralString, "The name of the opaque type."); + + InstructionDesc[OpTypePointer].operands.push(OperandStorage, ""); + InstructionDesc[OpTypePointer].operands.push(OperandId, "'Type'"); + + InstructionDesc[OpTypeEvent].capabilities.push_back(CapKernel); + + InstructionDesc[OpTypeDeviceEvent].capabilities.push_back(CapKernel); + + InstructionDesc[OpTypeReserveId].capabilities.push_back(CapKernel); + + InstructionDesc[OpTypeQueue].capabilities.push_back(CapKernel); + + InstructionDesc[OpTypePipe].operands.push(OperandId, "'Type'"); + InstructionDesc[OpTypePipe].operands.push(OperandAccessQualifier, "'Qualifier'"); + InstructionDesc[OpTypePipe].capabilities.push_back(CapKernel); + + InstructionDesc[OpTypeFunction].operands.push(OperandId, "'Return Type'"); + InstructionDesc[OpTypeFunction].operands.push(OperandVariableIds, "'Parameter 0 Type', +\n'Parameter 1 Type', +\n..."); + + InstructionDesc[OpConstant].operands.push(OperandVariableLiterals, "'Value'"); + + InstructionDesc[OpConstantComposite].operands.push(OperandVariableIds, "'Constituents'"); + + InstructionDesc[OpConstantNullPointer].capabilities.push_back(CapAddr); + + InstructionDesc[OpConstantNullObject].capabilities.push_back(CapKernel); + + InstructionDesc[OpConstantSampler].capabilities.push_back(CapKernel); + InstructionDesc[OpConstantSampler].operands.push(OperandLiteralNumber, "'Mode'"); + InstructionDesc[OpConstantSampler].operands.push(OperandLiteralNumber, "'Param'"); + InstructionDesc[OpConstantSampler].operands.push(OperandLiteralNumber, "'Filter'"); + + InstructionDesc[OpSpecConstantTrue].capabilities.push_back(CapShader); + + InstructionDesc[OpSpecConstantFalse].capabilities.push_back(CapShader); + + InstructionDesc[OpSpecConstant].operands.push(OperandVariableLiterals, "'Value'"); + InstructionDesc[OpSpecConstant].capabilities.push_back(CapShader); + + InstructionDesc[OpSpecConstantComposite].operands.push(OperandVariableIds, "'Constituents'"); + InstructionDesc[OpSpecConstantComposite].capabilities.push_back(CapShader); + + InstructionDesc[OpVariable].operands.push(OperandStorage, ""); + InstructionDesc[OpVariable].operands.push(OperandOptionalId, "'Initializer'"); + + InstructionDesc[OpVariableArray].operands.push(OperandStorage, ""); + InstructionDesc[OpVariableArray].operands.push(OperandId, "'N'"); + InstructionDesc[OpVariableArray].capabilities.push_back(CapAddr); + + InstructionDesc[OpFunction].operands.push(OperandFunction, ""); + InstructionDesc[OpFunction].operands.push(OperandId, "'Function Type'"); + + InstructionDesc[OpFunctionCall].operands.push(OperandId, "'Function'"); + InstructionDesc[OpFunctionCall].operands.push(OperandVariableIds, "'Argument 0', +\n'Argument 1', +\n..."); + + InstructionDesc[OpExtInst].operands.push(OperandId, "'Set'"); + InstructionDesc[OpExtInst].operands.push(OperandLiteralNumber, "'Instruction'"); + InstructionDesc[OpExtInst].operands.push(OperandVariableIds, "'Operand 1', +\n'Operand 2', +\n..."); + + InstructionDesc[OpLoad].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpLoad].operands.push(OperandVariableLiterals, "'Memory Access'"); + + InstructionDesc[OpStore].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpStore].operands.push(OperandId, "'Object'"); + InstructionDesc[OpStore].operands.push(OperandVariableLiterals, "'Memory Access'"); + + InstructionDesc[OpPhi].operands.push(OperandVariableIds, ""); + + InstructionDesc[OpDecorate].operands.push(OperandId, "'Target'"); + InstructionDesc[OpDecorate].operands.push(OperandDecoration, ""); + InstructionDesc[OpDecorate].operands.push(OperandVariableLiterals, "See <>."); + + InstructionDesc[OpMemberDecorate].operands.push(OperandId, "'Structure type'"); + InstructionDesc[OpMemberDecorate].operands.push(OperandLiteralNumber, "'Member'"); + InstructionDesc[OpMemberDecorate].operands.push(OperandDecoration, ""); + InstructionDesc[OpMemberDecorate].operands.push(OperandVariableLiterals, "See <>."); + + InstructionDesc[OpGroupDecorate].operands.push(OperandId, "'Decoration group'"); + InstructionDesc[OpGroupDecorate].operands.push(OperandVariableIds, "'Target', 'Target', ..."); + + InstructionDesc[OpGroupMemberDecorate].operands.push(OperandId, "'Decoration group'"); + InstructionDesc[OpGroupMemberDecorate].operands.push(OperandVariableIds, "'Target', 'Target', ..."); + + InstructionDesc[OpVectorExtractDynamic].operands.push(OperandId, "'Vector'"); + InstructionDesc[OpVectorExtractDynamic].operands.push(OperandId, "'Index'"); + + InstructionDesc[OpVectorInsertDynamic].operands.push(OperandId, "'Vector'"); + InstructionDesc[OpVectorInsertDynamic].operands.push(OperandId, "'Component'"); + InstructionDesc[OpVectorInsertDynamic].operands.push(OperandId, "'Index'"); + + InstructionDesc[OpVectorShuffle].operands.push(OperandId, "'Vector 1'"); + InstructionDesc[OpVectorShuffle].operands.push(OperandId, "'Vector 2'"); + InstructionDesc[OpVectorShuffle].operands.push(OperandVariableLiterals, "'Components'"); + + InstructionDesc[OpCompositeConstruct].operands.push(OperandVariableIds, "'Constituents'"); + + InstructionDesc[OpCompositeExtract].operands.push(OperandId, "'Composite'"); + InstructionDesc[OpCompositeExtract].operands.push(OperandVariableLiterals, "'Indexes'"); + + InstructionDesc[OpCompositeInsert].operands.push(OperandId, "'Object'"); + InstructionDesc[OpCompositeInsert].operands.push(OperandId, "'Composite'"); + InstructionDesc[OpCompositeInsert].operands.push(OperandVariableLiterals, "'Indexes'"); + + InstructionDesc[OpCopyObject].operands.push(OperandId, "'Operand'"); + + InstructionDesc[OpCopyMemory].operands.push(OperandId, "'Target'"); + InstructionDesc[OpCopyMemory].operands.push(OperandId, "'Source'"); + InstructionDesc[OpCopyMemory].operands.push(OperandVariableLiterals, "'Memory Access'"); + + InstructionDesc[OpCopyMemorySized].operands.push(OperandId, "'Target'"); + InstructionDesc[OpCopyMemorySized].operands.push(OperandId, "'Source'"); + InstructionDesc[OpCopyMemorySized].operands.push(OperandId, "'Size'"); + InstructionDesc[OpCopyMemorySized].operands.push(OperandVariableLiterals, "'Memory Access'"); + + InstructionDesc[OpCopyMemorySized].capabilities.push_back(CapAddr); + + InstructionDesc[OpSampler].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpSampler].operands.push(OperandId, "'Filter'"); + + InstructionDesc[OpTextureSample].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureSample].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureSample].operands.push(OperandOptionalId, "['Bias']"); + InstructionDesc[OpTextureSample].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureSampleDref].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureSampleDref].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureSampleDref].operands.push(OperandId, "'D~ref~'"); + InstructionDesc[OpTextureSampleDref].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureSampleLod].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureSampleLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureSampleLod].operands.push(OperandId, "'Level of Detail'"); + InstructionDesc[OpTextureSampleLod].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureSampleProj].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureSampleProj].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureSampleProj].operands.push(OperandOptionalId, "['Bias']"); + InstructionDesc[OpTextureSampleProj].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureSampleGrad].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureSampleGrad].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureSampleGrad].operands.push(OperandId, "'dx'"); + InstructionDesc[OpTextureSampleGrad].operands.push(OperandId, "'dy'"); + InstructionDesc[OpTextureSampleGrad].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureSampleOffset].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureSampleOffset].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureSampleOffset].operands.push(OperandId, "'Offset'"); + InstructionDesc[OpTextureSampleOffset].operands.push(OperandOptionalId, "['Bias']"); + InstructionDesc[OpTextureSampleOffset].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureSampleProjLod].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureSampleProjLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureSampleProjLod].operands.push(OperandId, "'Level of Detail'"); + InstructionDesc[OpTextureSampleProjLod].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureSampleProjGrad].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureSampleProjGrad].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureSampleProjGrad].operands.push(OperandId, "'dx'"); + InstructionDesc[OpTextureSampleProjGrad].operands.push(OperandId, "'dy'"); + InstructionDesc[OpTextureSampleProjGrad].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureSampleLodOffset].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureSampleLodOffset].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureSampleLodOffset].operands.push(OperandId, "'Level of Detail'"); + InstructionDesc[OpTextureSampleLodOffset].operands.push(OperandId, "'Offset'"); + InstructionDesc[OpTextureSampleLodOffset].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureSampleProjOffset].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureSampleProjOffset].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureSampleProjOffset].operands.push(OperandId, "'Offset'"); + InstructionDesc[OpTextureSampleProjOffset].operands.push(OperandOptionalId, "['Bias']"); + InstructionDesc[OpTextureSampleProjOffset].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureSampleGradOffset].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureSampleGradOffset].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureSampleGradOffset].operands.push(OperandId, "'dx'"); + InstructionDesc[OpTextureSampleGradOffset].operands.push(OperandId, "'dy'"); + InstructionDesc[OpTextureSampleGradOffset].operands.push(OperandId, "'Offset'"); + InstructionDesc[OpTextureSampleGradOffset].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureSampleProjLodOffset].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureSampleProjLodOffset].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureSampleProjLodOffset].operands.push(OperandId, "'Level of Detail'"); + InstructionDesc[OpTextureSampleProjLodOffset].operands.push(OperandId, "'Offset'"); + InstructionDesc[OpTextureSampleProjLodOffset].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureSampleProjGradOffset].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureSampleProjGradOffset].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureSampleProjGradOffset].operands.push(OperandId, "'dx'"); + InstructionDesc[OpTextureSampleProjGradOffset].operands.push(OperandId, "'dy'"); + InstructionDesc[OpTextureSampleProjGradOffset].operands.push(OperandId, "'Offset'"); + InstructionDesc[OpTextureSampleProjGradOffset].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureFetchTexelLod].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureFetchTexelLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureFetchTexelLod].operands.push(OperandId, "'Level of Detail'"); + InstructionDesc[OpTextureFetchTexelLod].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureFetchTexelOffset].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureFetchTexelOffset].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureFetchTexelOffset].operands.push(OperandId, "'Offset'"); + InstructionDesc[OpTextureFetchTexelOffset].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureFetchSample].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureFetchSample].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureFetchSample].operands.push(OperandId, "'Sample'"); + InstructionDesc[OpTextureFetchSample].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureFetchTexel].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureFetchTexel].operands.push(OperandId, "'Element'"); + InstructionDesc[OpTextureFetchTexel].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureGather].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureGather].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureGather].operands.push(OperandId, "'Component'"); + InstructionDesc[OpTextureGather].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureGatherOffset].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureGatherOffset].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureGatherOffset].operands.push(OperandId, "'Component'"); + InstructionDesc[OpTextureGatherOffset].operands.push(OperandId, "'Offset'"); + InstructionDesc[OpTextureGatherOffset].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureGatherOffsets].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureGatherOffsets].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureGatherOffsets].operands.push(OperandId, "'Component'"); + InstructionDesc[OpTextureGatherOffsets].operands.push(OperandId, "'Offsets'"); + InstructionDesc[OpTextureGatherOffsets].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureQuerySizeLod].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureQuerySizeLod].operands.push(OperandId, "'Level of Detail'"); + InstructionDesc[OpTextureQuerySizeLod].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureQuerySize].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureQuerySize].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureQueryLod].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureQueryLod].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpTextureQueryLod].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureQueryLevels].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureQueryLevels].capabilities.push_back(CapShader); + + InstructionDesc[OpTextureQuerySamples].operands.push(OperandId, "'Sampler'"); + InstructionDesc[OpTextureQuerySamples].capabilities.push_back(CapShader); + + InstructionDesc[OpAccessChain].operands.push(OperandId, "'Base'"); + InstructionDesc[OpAccessChain].operands.push(OperandVariableIds, "'Indexes'"); + + InstructionDesc[OpInBoundsAccessChain].operands.push(OperandId, "'Base'"); + InstructionDesc[OpInBoundsAccessChain].operands.push(OperandVariableIds, "'Indexes'"); + + InstructionDesc[OpSNegate].operands.push(OperandId, "'Operand'"); + + InstructionDesc[OpFNegate].operands.push(OperandId, "'Operand'"); + + InstructionDesc[OpNot].operands.push(OperandId, "'Operand'"); + + InstructionDesc[OpAny].operands.push(OperandId, "'Vector'"); + + InstructionDesc[OpAll].operands.push(OperandId, "'Vector'"); + + InstructionDesc[OpConvertFToU].operands.push(OperandId, "'Float Value'"); + + InstructionDesc[OpConvertFToS].operands.push(OperandId, "'Float Value'"); + + InstructionDesc[OpConvertSToF].operands.push(OperandId, "'Signed Value'"); + + InstructionDesc[OpConvertUToF].operands.push(OperandId, "'Unsigned value'"); + + InstructionDesc[OpUConvert].operands.push(OperandId, "'Unsigned value'"); + + InstructionDesc[OpSConvert].operands.push(OperandId, "'Signed Value'"); + + InstructionDesc[OpFConvert].operands.push(OperandId, "'Float Value'"); + + InstructionDesc[OpSatConvertSToU].operands.push(OperandId, "'Signed Value'"); + InstructionDesc[OpSatConvertSToU].capabilities.push_back(CapKernel); + + InstructionDesc[OpSatConvertUToS].operands.push(OperandId, "'Unsigned Value'"); + InstructionDesc[OpSatConvertUToS].capabilities.push_back(CapKernel); + + InstructionDesc[OpConvertPtrToU].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpConvertPtrToU].capabilities.push_back(CapAddr); + + InstructionDesc[OpConvertUToPtr].operands.push(OperandId, "'Integer value'"); + InstructionDesc[OpConvertUToPtr].capabilities.push_back(CapAddr); + + InstructionDesc[OpPtrCastToGeneric].operands.push(OperandId, "'Source pointer'"); + InstructionDesc[OpPtrCastToGeneric].capabilities.push_back(CapKernel); + + + InstructionDesc[OpGenericCastToPtr].operands.push(OperandId, "'Source pointer'"); + InstructionDesc[OpGenericCastToPtr].capabilities.push_back(CapKernel); + + InstructionDesc[OpGenericCastToPtrExplicit].operands.push(OperandId, "'Source pointer'"); + InstructionDesc[OpGenericCastToPtrExplicit].operands.push(OperandStorage, "'storage'"); + InstructionDesc[OpGenericCastToPtrExplicit].capabilities.push_back(CapKernel); + + InstructionDesc[OpGenericPtrMemSemantics].operands.push(OperandId, "'ptr'"); + InstructionDesc[OpGenericPtrMemSemantics].capabilities.push_back(CapKernel); + + InstructionDesc[OpBitcast].operands.push(OperandId, "'Operand'"); + + InstructionDesc[OpTranspose].capabilities.push_back(CapMatrix); + InstructionDesc[OpTranspose].operands.push(OperandId, "'Matrix'"); + + InstructionDesc[OpIsNan].operands.push(OperandId, "'x'"); + + InstructionDesc[OpIsInf].operands.push(OperandId, "'x'"); + + InstructionDesc[OpIsFinite].capabilities.push_back(CapKernel); + InstructionDesc[OpIsFinite].operands.push(OperandId, "'x'"); + + InstructionDesc[OpIsNormal].capabilities.push_back(CapKernel); + InstructionDesc[OpIsNormal].operands.push(OperandId, "'x'"); + + InstructionDesc[OpSignBitSet].capabilities.push_back(CapKernel); + InstructionDesc[OpSignBitSet].operands.push(OperandId, "'x'"); + + InstructionDesc[OpLessOrGreater].capabilities.push_back(CapKernel); + InstructionDesc[OpLessOrGreater].operands.push(OperandId, "'x'"); + InstructionDesc[OpLessOrGreater].operands.push(OperandId, "'y'"); + + InstructionDesc[OpOrdered].capabilities.push_back(CapKernel); + InstructionDesc[OpOrdered].operands.push(OperandId, "'x'"); + InstructionDesc[OpOrdered].operands.push(OperandId, "'y'"); + + InstructionDesc[OpUnordered].capabilities.push_back(CapKernel); + InstructionDesc[OpUnordered].operands.push(OperandId, "'x'"); + InstructionDesc[OpUnordered].operands.push(OperandId, "'y'"); + + InstructionDesc[OpArrayLength].operands.push(OperandId, "'Structure'"); + InstructionDesc[OpArrayLength].operands.push(OperandLiteralNumber, "'Array member'"); + InstructionDesc[OpArrayLength].capabilities.push_back(CapShader); + + InstructionDesc[OpIAdd].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpIAdd].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFAdd].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFAdd].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpISub].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpISub].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFSub].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFSub].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpIMul].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpIMul].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFMul].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFMul].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpUDiv].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpUDiv].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpSDiv].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpSDiv].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFDiv].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFDiv].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpUMod].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpUMod].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpSRem].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpSRem].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpSMod].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpSMod].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFRem].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFRem].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFMod].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFMod].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpVectorTimesScalar].operands.push(OperandId, "'Vector'"); + InstructionDesc[OpVectorTimesScalar].operands.push(OperandId, "'Scalar'"); + + InstructionDesc[OpMatrixTimesScalar].capabilities.push_back(CapMatrix); + InstructionDesc[OpMatrixTimesScalar].operands.push(OperandId, "'Matrix'"); + InstructionDesc[OpMatrixTimesScalar].operands.push(OperandId, "'Scalar'"); + + InstructionDesc[OpVectorTimesMatrix].capabilities.push_back(CapMatrix); + InstructionDesc[OpVectorTimesMatrix].operands.push(OperandId, "'Vector'"); + InstructionDesc[OpVectorTimesMatrix].operands.push(OperandId, "'Matrix'"); + + InstructionDesc[OpMatrixTimesVector].capabilities.push_back(CapMatrix); + InstructionDesc[OpMatrixTimesVector].operands.push(OperandId, "'Matrix'"); + InstructionDesc[OpMatrixTimesVector].operands.push(OperandId, "'Vector'"); + + InstructionDesc[OpMatrixTimesMatrix].capabilities.push_back(CapMatrix); + InstructionDesc[OpMatrixTimesMatrix].operands.push(OperandId, "'LeftMatrix'"); + InstructionDesc[OpMatrixTimesMatrix].operands.push(OperandId, "'RightMatrix'"); + + InstructionDesc[OpOuterProduct].capabilities.push_back(CapMatrix); + InstructionDesc[OpOuterProduct].operands.push(OperandId, "'Vector 1'"); + InstructionDesc[OpOuterProduct].operands.push(OperandId, "'Vector 2'"); + + InstructionDesc[OpDot].operands.push(OperandId, "'Vector 1'"); + InstructionDesc[OpDot].operands.push(OperandId, "'Vector 2'"); + + InstructionDesc[OpShiftRightLogical].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpShiftRightLogical].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpShiftRightArithmetic].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpShiftRightArithmetic].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpShiftLeftLogical].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpShiftLeftLogical].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpLogicalOr].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpLogicalOr].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpLogicalXor].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpLogicalXor].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpLogicalAnd].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpLogicalAnd].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpBitwiseOr].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpBitwiseOr].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpBitwiseXor].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpBitwiseXor].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpBitwiseAnd].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpBitwiseAnd].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpSelect].operands.push(OperandId, "'Condition'"); + InstructionDesc[OpSelect].operands.push(OperandId, "'Object 1'"); + InstructionDesc[OpSelect].operands.push(OperandId, "'Object 2'"); + + InstructionDesc[OpIEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpIEqual].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFOrdEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFOrdEqual].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFUnordEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFUnordEqual].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpINotEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpINotEqual].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFOrdNotEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFOrdNotEqual].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFUnordNotEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFUnordNotEqual].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpULessThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpULessThan].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpSLessThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpSLessThan].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFOrdLessThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFOrdLessThan].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFUnordLessThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFUnordLessThan].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpUGreaterThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpUGreaterThan].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpSGreaterThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpSGreaterThan].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFOrdGreaterThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFOrdGreaterThan].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFUnordGreaterThan].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFUnordGreaterThan].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpULessThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpULessThanEqual].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpSLessThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpSLessThanEqual].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFOrdLessThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFOrdLessThanEqual].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFUnordLessThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFUnordLessThanEqual].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpUGreaterThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpUGreaterThanEqual].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpSGreaterThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpSGreaterThanEqual].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFOrdGreaterThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFOrdGreaterThanEqual].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpFUnordGreaterThanEqual].operands.push(OperandId, "'Operand 1'"); + InstructionDesc[OpFUnordGreaterThanEqual].operands.push(OperandId, "'Operand 2'"); + + InstructionDesc[OpDPdx].capabilities.push_back(CapShader); + InstructionDesc[OpDPdx].operands.push(OperandId, "'P'"); + + InstructionDesc[OpDPdy].capabilities.push_back(CapShader); + InstructionDesc[OpDPdy].operands.push(OperandId, "'P'"); + + InstructionDesc[OpFwidth].capabilities.push_back(CapShader); + InstructionDesc[OpFwidth].operands.push(OperandId, "'P'"); + + InstructionDesc[OpDPdxFine].capabilities.push_back(CapShader); + InstructionDesc[OpDPdxFine].operands.push(OperandId, "'P'"); + + InstructionDesc[OpDPdyFine].capabilities.push_back(CapShader); + InstructionDesc[OpDPdyFine].operands.push(OperandId, "'P'"); + + InstructionDesc[OpFwidthFine].capabilities.push_back(CapShader); + InstructionDesc[OpFwidthFine].operands.push(OperandId, "'P'"); + + InstructionDesc[OpDPdxCoarse].capabilities.push_back(CapShader); + InstructionDesc[OpDPdxCoarse].operands.push(OperandId, "'P'"); + + InstructionDesc[OpDPdyCoarse].capabilities.push_back(CapShader); + InstructionDesc[OpDPdyCoarse].operands.push(OperandId, "'P'"); + + InstructionDesc[OpFwidthCoarse].capabilities.push_back(CapShader); + InstructionDesc[OpFwidthCoarse].operands.push(OperandId, "'P'"); + + InstructionDesc[OpEmitVertex].capabilities.push_back(CapGeom); + + InstructionDesc[OpEndPrimitive].capabilities.push_back(CapGeom); + + InstructionDesc[OpEmitStreamVertex].operands.push(OperandId, "'Stream'"); + InstructionDesc[OpEmitStreamVertex].capabilities.push_back(CapGeom); + + InstructionDesc[OpEndStreamPrimitive].operands.push(OperandId, "'Stream'"); + InstructionDesc[OpEndStreamPrimitive].capabilities.push_back(CapGeom); + + InstructionDesc[OpControlBarrier].operands.push(OperandExecutionScope, "'Scope'"); + + InstructionDesc[OpMemoryBarrier].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpMemoryBarrier].operands.push(OperandMemorySemantics, "'Semantics'"); + + InstructionDesc[OpImagePointer].operands.push(OperandId, "'Image'"); + InstructionDesc[OpImagePointer].operands.push(OperandId, "'Coordinate'"); + InstructionDesc[OpImagePointer].operands.push(OperandId, "'Sample'"); + + InstructionDesc[OpAtomicInit].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicInit].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpAtomicLoad].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicLoad].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicLoad].operands.push(OperandMemorySemantics, "'Semantics'"); + + InstructionDesc[OpAtomicStore].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicStore].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicStore].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicStore].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpAtomicExchange].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicExchange].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicExchange].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicExchange].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpAtomicCompareExchange].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicCompareExchange].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicCompareExchange].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicCompareExchange].operands.push(OperandId, "'Value'"); + InstructionDesc[OpAtomicCompareExchange].operands.push(OperandId, "'Comparator'"); + + InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandId, "'Value'"); + InstructionDesc[OpAtomicCompareExchangeWeak].operands.push(OperandId, "'Comparator'"); + + InstructionDesc[OpAtomicIIncrement].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicIIncrement].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicIIncrement].operands.push(OperandMemorySemantics, "'Semantics'"); + + InstructionDesc[OpAtomicIDecrement].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicIDecrement].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicIDecrement].operands.push(OperandMemorySemantics, "'Semantics'"); + + InstructionDesc[OpAtomicIAdd].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicIAdd].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicIAdd].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicIAdd].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpAtomicISub].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicISub].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicISub].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicISub].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpAtomicUMin].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicUMin].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicUMin].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicUMin].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpAtomicUMax].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicUMax].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicUMax].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicUMax].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpAtomicIMin].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicIMin].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicIMin].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicIMin].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpAtomicIMax].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicIMax].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicIMax].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicIMax].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpAtomicAnd].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicAnd].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicAnd].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicAnd].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpAtomicOr].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicOr].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicOr].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicOr].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpAtomicXor].operands.push(OperandId, "'Pointer'"); + InstructionDesc[OpAtomicXor].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAtomicXor].operands.push(OperandMemorySemantics, "'Semantics'"); + InstructionDesc[OpAtomicXor].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpLoopMerge].operands.push(OperandId, "'Label'"); + InstructionDesc[OpLoopMerge].operands.push(OperandLoop, ""); + + InstructionDesc[OpSelectionMerge].operands.push(OperandId, "'Label'"); + InstructionDesc[OpSelectionMerge].operands.push(OperandSelect, ""); + + InstructionDesc[OpBranch].operands.push(OperandId, "'Target Label'"); + + InstructionDesc[OpBranchConditional].operands.push(OperandId, "'Condition'"); + InstructionDesc[OpBranchConditional].operands.push(OperandId, "'True Label'"); + InstructionDesc[OpBranchConditional].operands.push(OperandId, "'False Label'"); + InstructionDesc[OpBranchConditional].operands.push(OperandVariableLiterals, "'Branch weights'"); + + InstructionDesc[OpSwitch].operands.push(OperandId, "'Selector'"); + InstructionDesc[OpSwitch].operands.push(OperandId, "'Default'"); + InstructionDesc[OpSwitch].operands.push(OperandVariableLiteralId, "'Target'"); + + InstructionDesc[OpKill].capabilities.push_back(CapShader); + + InstructionDesc[OpReturnValue].operands.push(OperandId, "'Value'"); + + InstructionDesc[OpUnreachable].capabilities.push_back(CapKernel); + + InstructionDesc[OpLifetimeStart].operands.push(OperandId, ""); + InstructionDesc[OpLifetimeStart].operands.push(OperandLiteralNumber, ""); + + InstructionDesc[OpLifetimeStop].operands.push(OperandId, ""); + InstructionDesc[OpLifetimeStop].operands.push(OperandLiteralNumber, ""); + + InstructionDesc[OpCompileFlag].capabilities.push_back(CapKernel); + InstructionDesc[OpCompileFlag].operands.push(OperandLiteralString, "'Flag'"); + + InstructionDesc[OpAsyncGroupCopy].capabilities.push_back(CapKernel); + InstructionDesc[OpAsyncGroupCopy].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpAsyncGroupCopy].operands.push(OperandId, "'Destination'"); + InstructionDesc[OpAsyncGroupCopy].operands.push(OperandId, "'Source'"); + InstructionDesc[OpAsyncGroupCopy].operands.push(OperandId, "'Num Elements'"); + InstructionDesc[OpAsyncGroupCopy].operands.push(OperandId, "'Stride'"); + InstructionDesc[OpAsyncGroupCopy].operands.push(OperandId, "'Event'"); + + InstructionDesc[OpWaitGroupEvents].capabilities.push_back(CapKernel); + InstructionDesc[OpWaitGroupEvents].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpWaitGroupEvents].operands.push(OperandId, "'Num Events'"); + InstructionDesc[OpWaitGroupEvents].operands.push(OperandId, "'Events List'"); + + InstructionDesc[OpGroupAll].capabilities.push_back(CapKernel); + InstructionDesc[OpGroupAll].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpGroupAll].operands.push(OperandId, "'Predicate'"); + + InstructionDesc[OpGroupAny].capabilities.push_back(CapKernel); + InstructionDesc[OpGroupAny].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpGroupAny].operands.push(OperandId, "'Predicate'"); + + InstructionDesc[OpGroupBroadcast].capabilities.push_back(CapKernel); + InstructionDesc[OpGroupBroadcast].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpGroupBroadcast].operands.push(OperandId, "'Value'"); + InstructionDesc[OpGroupBroadcast].operands.push(OperandId, "'LocalId'"); + + InstructionDesc[OpGroupIAdd].capabilities.push_back(CapKernel); + InstructionDesc[OpGroupIAdd].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpGroupIAdd].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupIAdd].operands.push(OperandId, "'X'"); + + InstructionDesc[OpGroupFAdd].capabilities.push_back(CapKernel); + InstructionDesc[OpGroupFAdd].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpGroupFAdd].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupFAdd].operands.push(OperandId, "'X'"); + + InstructionDesc[OpGroupUMin].capabilities.push_back(CapKernel); + InstructionDesc[OpGroupUMin].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpGroupUMin].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupUMin].operands.push(OperandId, "'X'"); + + InstructionDesc[OpGroupSMin].capabilities.push_back(CapKernel); + InstructionDesc[OpGroupSMin].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpGroupSMin].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupSMin].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupFMin].capabilities.push_back(CapKernel); + InstructionDesc[OpGroupFMin].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpGroupFMin].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupFMin].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupUMax].capabilities.push_back(CapKernel); + InstructionDesc[OpGroupUMax].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpGroupUMax].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupUMax].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupSMax].capabilities.push_back(CapKernel); + InstructionDesc[OpGroupSMax].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpGroupSMax].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupSMax].operands.push(OperandId, "X"); + + InstructionDesc[OpGroupFMax].capabilities.push_back(CapKernel); + InstructionDesc[OpGroupFMax].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpGroupFMax].operands.push(OperandGroupOperation, "'Operation'"); + InstructionDesc[OpGroupFMax].operands.push(OperandId, "X"); + + InstructionDesc[OpReadPipe].capabilities.push_back(CapKernel); + InstructionDesc[OpReadPipe].operands.push(OperandId, "'p'"); + InstructionDesc[OpReadPipe].operands.push(OperandId, "'ptr'"); + + InstructionDesc[OpWritePipe].capabilities.push_back(CapKernel); + InstructionDesc[OpWritePipe].operands.push(OperandId, "'p'"); + InstructionDesc[OpWritePipe].operands.push(OperandId, "'ptr'"); + + InstructionDesc[OpReservedReadPipe].capabilities.push_back(CapKernel); + InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'p'"); + InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'reserve_id'"); + InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'index'"); + InstructionDesc[OpReservedReadPipe].operands.push(OperandId, "'ptr'"); + + InstructionDesc[OpReservedWritePipe].capabilities.push_back(CapKernel); + InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'p'"); + InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'reserve_id'"); + InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'index'"); + InstructionDesc[OpReservedWritePipe].operands.push(OperandId, "'ptr'"); + + InstructionDesc[OpReserveReadPipePackets].capabilities.push_back(CapKernel); + InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId, "'p'"); + InstructionDesc[OpReserveReadPipePackets].operands.push(OperandId, "'num_packets'"); + + InstructionDesc[OpReserveWritePipePackets].capabilities.push_back(CapKernel); + InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId, "'p'"); + InstructionDesc[OpReserveWritePipePackets].operands.push(OperandId, "'num_packets'"); + + InstructionDesc[OpCommitReadPipe].capabilities.push_back(CapKernel); + InstructionDesc[OpCommitReadPipe].operands.push(OperandId, "'p'"); + InstructionDesc[OpCommitReadPipe].operands.push(OperandId, "'reserve_id'"); + + InstructionDesc[OpCommitWritePipe].capabilities.push_back(CapKernel); + InstructionDesc[OpCommitWritePipe].operands.push(OperandId, "'p'"); + InstructionDesc[OpCommitWritePipe].operands.push(OperandId, "'reserve_id'"); + + InstructionDesc[OpIsValidReserveId].capabilities.push_back(CapKernel); + InstructionDesc[OpIsValidReserveId].operands.push(OperandId, "'reserve_id'"); + + InstructionDesc[OpGetNumPipePackets].capabilities.push_back(CapKernel); + InstructionDesc[OpGetNumPipePackets].operands.push(OperandId, "'p'"); + + InstructionDesc[OpGetMaxPipePackets].capabilities.push_back(CapKernel); + InstructionDesc[OpGetMaxPipePackets].operands.push(OperandId, "'p'"); + + InstructionDesc[OpGroupReserveReadPipePackets].capabilities.push_back(CapKernel); + InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId, "'p'"); + InstructionDesc[OpGroupReserveReadPipePackets].operands.push(OperandId, "'num_packets'"); + + InstructionDesc[OpGroupReserveWritePipePackets].capabilities.push_back(CapKernel); + InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId, "'p'"); + InstructionDesc[OpGroupReserveWritePipePackets].operands.push(OperandId, "'num_packets'"); + + InstructionDesc[OpGroupCommitReadPipe].capabilities.push_back(CapKernel); + InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId, "'p'"); + InstructionDesc[OpGroupCommitReadPipe].operands.push(OperandId, "'reserve_id'"); + + InstructionDesc[OpGroupCommitWritePipe].capabilities.push_back(CapKernel); + InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandExecutionScope, "'Scope'"); + InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId, "'p'"); + InstructionDesc[OpGroupCommitWritePipe].operands.push(OperandId, "'reserve_id'"); + + InstructionDesc[OpBuildNDRange].capabilities.push_back(CapKernel); + InstructionDesc[OpBuildNDRange].operands.push(OperandId, "'GlobalWorkSize'"); + InstructionDesc[OpBuildNDRange].operands.push(OperandId, "'LocalWorkSize'"); + InstructionDesc[OpBuildNDRange].operands.push(OperandId, "'GlobalWorkOffset'"); + + InstructionDesc[OpGetDefaultQueue].capabilities.push_back(CapKernel); + + InstructionDesc[OpCaptureEventProfilingInfo].capabilities.push_back(CapKernel); + + InstructionDesc[OpCaptureEventProfilingInfo].operands.push(OperandId, "'event'"); + InstructionDesc[OpCaptureEventProfilingInfo].operands.push(OperandKernelProfilingInfo, "'info'"); + InstructionDesc[OpCaptureEventProfilingInfo].operands.push(OperandId, "'value'"); + + InstructionDesc[OpSetUserEventStatus].capabilities.push_back(CapKernel); + + InstructionDesc[OpSetUserEventStatus].operands.push(OperandId, "'event'"); + InstructionDesc[OpSetUserEventStatus].operands.push(OperandId, "'status'"); + + InstructionDesc[OpIsValidEvent].capabilities.push_back(CapKernel); + InstructionDesc[OpIsValidEvent].operands.push(OperandId, "'event'"); + + InstructionDesc[OpCreateUserEvent].capabilities.push_back(CapKernel); + + InstructionDesc[OpRetainEvent].capabilities.push_back(CapKernel); + InstructionDesc[OpRetainEvent].operands.push(OperandId, "'event'"); + + InstructionDesc[OpReleaseEvent].capabilities.push_back(CapKernel); + InstructionDesc[OpReleaseEvent].operands.push(OperandId, "'event'"); + + InstructionDesc[OpGetKernelWorkGroupSize].capabilities.push_back(CapKernel); + InstructionDesc[OpGetKernelWorkGroupSize].operands.push(OperandId, "'Invoke'"); + + InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].capabilities.push_back(CapKernel); + InstructionDesc[OpGetKernelPreferredWorkGroupSizeMultiple].operands.push(OperandId, "'Invoke'"); + + InstructionDesc[OpGetKernelNDrangeSubGroupCount].capabilities.push_back(CapKernel); + InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'ND Range'"); + InstructionDesc[OpGetKernelNDrangeSubGroupCount].operands.push(OperandId, "'Invoke'"); + + InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].capabilities.push_back(CapKernel); + InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'ND Range'"); + InstructionDesc[OpGetKernelNDrangeMaxSubGroupSize].operands.push(OperandId, "'Invoke'"); + + InstructionDesc[OpEnqueueKernel].capabilities.push_back(CapKernel); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'q'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandKernelEnqueueFlags, "'flags'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'ND Range'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Num Events'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Wait Events'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Ret Event'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Invoke'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Param'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Param Size'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandId, "'Param Align'"); + InstructionDesc[OpEnqueueKernel].operands.push(OperandVariableIds, "'Local Size'"); + + InstructionDesc[OpEnqueueMarker].capabilities.push_back(CapKernel); + InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'q'"); + InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Num Events'"); + InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Wait Events'"); + InstructionDesc[OpEnqueueMarker].operands.push(OperandId, "'Ret Event'"); } }; // end spv namespace diff --git a/SPIRV/doc.h b/SPIRV/doc.h index 176ae918..9059f0e5 100644 --- a/SPIRV/doc.h +++ b/SPIRV/doc.h @@ -37,8 +37,7 @@ // // -// Return English versions of instruction/operand information. -// This can be used for disassembly, printing documentation, etc. +// Parameterize the SPIR-V enumerants. // #include "spirv.h" @@ -47,7 +46,7 @@ namespace spv { -// Fill in all the parameters of the instruction set +// Fill in all the parameters void Parameterize(); // Return the English names of all the enums. @@ -76,6 +75,35 @@ const char* ExecutionScopeString(int); const char* GroupOperationString(int); const char* KernelEnqueueFlagsString(int); const char* KernelProfilingInfoString(int); +const char* OpcodeString(int); + +// For grouping opcodes into subsections +enum OpcodeClass { + OpClassMisc, // default, until opcode is classified + OpClassDebug, + OpClassAnnotate, + OpClassExtension, + OpClassMode, + OpClassType, + OpClassConstant, + OpClassMemory, + OpClassFunction, + OpClassTexture, + OpClassConvert, + OpClassComposite, + OpClassArithmetic, + OpClassRelationalLogical, + OpClassDerivative, + OpClassFlowControl, + OpClassAtomic, + OpClassPrimitive, + OpClassBarrier, + OpClassGroup, + OpClassDeviceSideEnqueue, + OpClassPipe, + + OpClassCount +}; // For parameterizing operands. enum OperandClass { @@ -99,35 +127,85 @@ enum OperandClass { OperandFPFastMath, OperandFPRoundingMode, OperandLinkageType, + OperandAccessQualifier, OperandFuncParamAttr, OperandDecoration, OperandBuiltIn, OperandSelect, OperandLoop, OperandFunction, - OperandAccessQualifier, OperandMemorySemantics, OperandMemoryAccess, OperandExecutionScope, OperandGroupOperation, OperandKernelEnqueueFlags, OperandKernelProfilingInfo, + + OperandOpcode, + OperandCount }; +// Set of capabilities. Generally, something is assumed to be in core, +// if nothing else is said. So, these are used to identify when something +// requires a specific capability to be declared. +enum Capability { + CapMatrix, + CapShader, + CapGeom, + CapTess, + CapAddr, + CapLink, + CapKernel +}; + +// Any specific enum can have a set of capabilities that allow it: +typedef std::vector EnumCaps; + // Parameterize a set of operands with their OperandClass(es) and descriptions. class OperandParameters { public: OperandParameters() { } - void push(OperandClass oc) + void push(OperandClass oc, const char* d) { opClass.push_back(oc); + desc.push_back(d); } OperandClass getClass(int op) const { return opClass[op]; } + const char* getDesc(int op) const { return desc[op]; } int getNum() const { return (int)opClass.size(); } protected: std::vector opClass; + std::vector desc; +}; + +// Parameterize an enumerant +class EnumParameters { +public: + EnumParameters() : desc(0) { } + EnumCaps caps; + const char* desc; +}; + +// Parameterize a set of enumerants that form an enum +class EnumDefinition : public EnumParameters { +public: + EnumDefinition() : + ceiling(0), bitmask(false), getName(0), enumParams(0), operandParams(0) { } + void set(int ceil, const char* (*name)(int), EnumParameters* ep, bool mask = false) + { + ceiling = ceil; + getName = name; + bitmask = mask; + enumParams = ep; + } + void setOperands(OperandParameters* op) { operandParams = op; } + int ceiling; // ceiling of enumerants + bool bitmask; // true if these enumerants combine into a bitmask + const char* (*getName)(int); // a function that returns the name for each enumerant value (or shift) + EnumParameters* enumParams; // parameters for each individual enumerant + OperandParameters* operandParams; // sets of operands }; // Parameterize an instruction's logical format, including its known set of operands, @@ -137,7 +215,8 @@ public: InstructionParameters() : typePresent(true), // most normal, only exceptions have to be spelled out resultPresent(true), // most normal, only exceptions have to be spelled out - opName(0) + opDesc(0), + opClass(OpClassMisc) { } void setResultAndType(bool r, bool t) @@ -149,7 +228,9 @@ public: bool hasResult() const { return resultPresent != 0; } bool hasType() const { return typePresent != 0; } - const char* opName; + const char* opDesc; + EnumCaps capabilities; + OpcodeClass opClass; OperandParameters operands; protected: @@ -157,8 +238,19 @@ protected: int resultPresent : 1; }; +const int OpcodeCeiling = 267; + // The set of objects that hold all the instruction/operand // parameterization information. -extern InstructionParameters InstructionDesc[spv::OpCount]; +extern InstructionParameters InstructionDesc[]; + +// These hold definitions of the enumerants used for operands +extern EnumDefinition OperandClassParams[]; + +const char* GetOperandDesc(OperandClass operand); +void PrintImmediateRow(int imm, const char* name, const EnumParameters* enumParams, bool caps, bool hex = false); +const char* AccessQualifierString(int attr); + +void PrintOperands(const OperandParameters& operands, int reservedOperands); }; // end namespace spv diff --git a/SPIRV/spirv.h b/SPIRV/spirv.h index 7404d6fd..757fdce4 100644 --- a/SPIRV/spirv.h +++ b/SPIRV/spirv.h @@ -21,742 +21,1281 @@ ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ -// -// Enumeration tokens for SPIR V. -// +/* +** This header is automatically generated by the same tool that creates +** the Binary Section of the SPIR-V specification. +*/ + +/* +** Specification revision 29. +** Enumeration tokens for SPIR-V, in three styles: C, C++, generic. +** - C++ will have the tokens in the "spv" name space, with no prefix. +** - C will have tokens with as "Spv" prefix. +** +** Some tokens act like mask values, which can be OR'd together, +** while others are mutually exclusive. The mask-like ones have +** "Mask" in their name, and a parallel enum that has the shift +** amount (1 << x) for each corresponding enumerant. +*/ -#pragma once #ifndef spirv_H #define spirv_H #ifdef __cplusplus -namespace spv{ -#endif + +namespace spv { const int MagicNumber = 0x07230203; const int Version = 99; typedef unsigned int Id; -const Id NoResult = 0; -const Id NoType = 0; - const unsigned int OpCodeMask = 0xFFFF; const unsigned int WordCountShift = 16; -// Set of capabilities. Generally, something is assumed to be in core, -// if nothing else is said. So, these are used to identify when something -// requires a specific capability to be declared. -enum Capability { - CapMatrix, - CapShader, - CapGeom, - CapTess, - CapAddr, - CapLink, - CapKernel -}; - -// What language is the source code in? Note the OpSource instruction has a separate -// operand for the version number, this is just the language name. The GLSL -// compatibility profile will be indicated by using an OpSourceExtension string. enum SourceLanguage { - LangUnknown, - LangESSL, - LangGLSL, - LangOpenCL, - - LangCount // guard for validation, "default:" statements, etc. + SourceLanguageUnknown = 0, + SourceLanguageESSL = 1, + SourceLanguageGLSL = 2, + SourceLanguageOpenCL = 3, }; -// Used per entry point to communicate the "stage" or other model of -// execution used by that entry point. -// See OpEntryPoint. enum ExecutionModel { - ModelVertex, - ModelTessellationControl, - ModelTessellationEvaluation, - ModelGeometry, - ModelFragment, - ModelGLCompute, - ModelKernel, - - ModelCount // guard for validation, "default:" statements, etc. + ExecutionModelVertex = 0, + ExecutionModelTessellationControl = 1, + ExecutionModelTessellationEvaluation = 2, + ExecutionModelGeometry = 3, + ExecutionModelFragment = 4, + ExecutionModelGLCompute = 5, + ExecutionModelKernel = 6, }; -// Used as an argument to OpMemoryModel enum AddressingModel { - AddressingLogical, - AddressingPhysical32, - AddressingPhysical64, - - AddressingCount // guard for validation, "default:" statements, etc. + AddressingModelLogical = 0, + AddressingModelPhysical32 = 1, + AddressingModelPhysical64 = 2, }; -// Used as an argment to OpMemoryModel enum MemoryModel { - MemorySimple, - MemoryGLSL450, - MemoryOCL12, - MemoryOCL20, - MemoryOCL21, - - MemoryCount // guard for validation, "default:" statements, etc. + MemoryModelSimple = 0, + MemoryModelGLSL450 = 1, + MemoryModelOpenCL12 = 2, + MemoryModelOpenCL20 = 3, + MemoryModelOpenCL21 = 4, }; -// Used per entry point to communicate modes related to input, output, and execution. -// See OpExecutionMode. enum ExecutionMode { - ExecutionInvocations, - ExecutionSpacingEqual, - ExecutionSpacingFractionalEven, - ExecutionSpacingFractionalOdd, - ExecutionVertexOrderCw, - ExecutionVertexOrderCcw, - ExecutionPixelCenterInteger, - ExecutionOriginUpperLeft, - ExecutionEarlyFragmentTests, - ExecutionPointMode, - ExecutionXfb, - ExecutionDepthReplacing, - ExecutionDepthAny, - ExecutionDepthGreater, - ExecutionDepthLess, - ExecutionDepthUnchanged, - ExecutionLocalSize, - ExecutionLocalSizeHint, - - ExecutionInputPoints, - ExecutionInputLines, - ExecutionInputLinesAdjacency, - ExecutionInputTriangles, - ExecutionInputTrianglesAdjacency, - ExecutionInputQuads, - ExecutionInputIsolines, - - ExecutionOutputVertices, - ExecutionOutputPoints, - ExecutionOutputLineStrip, - ExecutionOutputTriangleStrip, - - ExecutionVecTypeHint, - ExecutionContractionOff, - ExecutionModeCount // guard for validation, "default:" statements, etc. + ExecutionModeInvocations = 0, + ExecutionModeSpacingEqual = 1, + ExecutionModeSpacingFractionalEven = 2, + ExecutionModeSpacingFractionalOdd = 3, + ExecutionModeVertexOrderCw = 4, + ExecutionModeVertexOrderCcw = 5, + ExecutionModePixelCenterInteger = 6, + ExecutionModeOriginUpperLeft = 7, + ExecutionModeEarlyFragmentTests = 8, + ExecutionModePointMode = 9, + ExecutionModeXfb = 10, + ExecutionModeDepthReplacing = 11, + ExecutionModeDepthAny = 12, + ExecutionModeDepthGreater = 13, + ExecutionModeDepthLess = 14, + ExecutionModeDepthUnchanged = 15, + ExecutionModeLocalSize = 16, + ExecutionModeLocalSizeHint = 17, + ExecutionModeInputPoints = 18, + ExecutionModeInputLines = 19, + ExecutionModeInputLinesAdjacency = 20, + ExecutionModeInputTriangles = 21, + ExecutionModeInputTrianglesAdjacency = 22, + ExecutionModeInputQuads = 23, + ExecutionModeInputIsolines = 24, + ExecutionModeOutputVertices = 25, + ExecutionModeOutputPoints = 26, + ExecutionModeOutputLineStrip = 27, + ExecutionModeOutputTriangleStrip = 28, + ExecutionModeVecTypeHint = 29, + ExecutionModeContractionOff = 30, }; enum StorageClass { - StorageConstantUniform, - StorageInput, - StorageUniform, - StorageOutput, - StorageWorkgroupLocal, - StorageWorkgroupGlobal, - StoragePrivateGlobal, - StorageFunction, - StorageGeneric, - StoragePrivate, - StorageAtomicCounter, - StorageCount // guard for validation, "default:" statements, etc. + StorageClassUniformConstant = 0, + StorageClassInput = 1, + StorageClassUniform = 2, + StorageClassOutput = 3, + StorageClassWorkgroupLocal = 4, + StorageClassWorkgroupGlobal = 5, + StorageClassPrivateGlobal = 6, + StorageClassFunction = 7, + StorageClassGeneric = 8, + StorageClassPrivate = 9, + StorageClassAtomicCounter = 10, }; -// Dimensionalities currently used for sampling. -// See TypeSampler in TypeClass. -enum Dimensionality { - Dim1D, - Dim2D, - Dim3D, - DimCube, - DimRect, - DimBuffer, - - DimCount // guard for validation, "default:" statements, etc. +enum Dim { + Dim1D = 0, + Dim2D = 1, + Dim3D = 2, + DimCube = 3, + DimRect = 4, + DimBuffer = 5, }; -// Sampler addressing mode. enum SamplerAddressingMode { - SamplerAddressingNone = 0, - SamplerAddressingClampToEdge = 2, - SamplerAddressingClamp = 4, - SamplerAddressingRepeat = 6, - SamplerAddressingRepeatMirrored = 8, - SamplerAddressingModeLast, + SamplerAddressingModeNone = 0, + SamplerAddressingModeClampToEdge = 2, + SamplerAddressingModeClamp = 4, + SamplerAddressingModeRepeat = 6, + SamplerAddressingModeRepeatMirrored = 8, }; -// Sampler filter mode. enum SamplerFilterMode { - SamplerFilterNearest = 0x10, - SamplerFilterLinear = 0x20, - SamplerFilterModeLast, + SamplerFilterModeNearest = 16, + SamplerFilterModeLinear = 32, }; -// FP Fast Math Mode. -enum FPFastMath { - FPFastMathNNan = 0, // assume parameters and result are not NaN. - FPFastMathNInf = 0x02, // assume parameters and result are not +/- Inf. - FPFastMathNSZ = 0x04, // treat the sign of a zero parameter or result as insignificant. - FPFastMathARcp = 0x08, // allow the usage of reciprocal rather than perform a division. - FPFastMathFast = 0x10, // allow Algebraic transformations according to real number associative and distibutive algebra. This flag implies all the others. - FPFastMathLast, +enum FPFastMathModeShift { + FPFastMathModeNotNaNShift = 0, + FPFastMathModeNotInfShift = 1, + FPFastMathModeNSZShift = 2, + FPFastMathModeAllowRecipShift = 3, + FPFastMathModeFastShift = 4, +}; + +enum FPFastMathModeMask { + FPFastMathModeMaskNone = 0, + FPFastMathModeNotNaNMask = 0x00000001, + FPFastMathModeNotInfMask = 0x00000002, + FPFastMathModeNSZMask = 0x00000004, + FPFastMathModeAllowRecipMask = 0x00000008, + FPFastMathModeFastMask = 0x00000010, }; -// FP Fast Math Mode. enum FPRoundingMode { - FPRoundRTE, // round to nearest even. - FPRoundRTZ, // round towards zero. - FPRoundRTP, // round towards positive infinity. - FPRoundRTN, // round towards negative infinity. - FPRoundLast, + FPRoundingModeRTE = 0, + FPRoundingModeRTZ = 1, + FPRoundingModeRTP = 2, + FPRoundingModeRTN = 3, }; -// Global identifier linkage types (by default the linkage type of global identifiers is private. This means that they are only accessible to objects inside the module.) enum LinkageType { - LinkageExport, // accessible by objects in other modules as well. - LinkageImport, // a forward declaration to a global identifier that exists in another module. - LinkageLast, + LinkageTypeExport = 0, + LinkageTypeImport = 1, }; -// Access Qualifiers for OpenCL pipes and images enum AccessQualifier { - AccessQualReadOnly, - AccessQualWriteOnly, - AccessQualReadWrite, - AccessQualLast, + AccessQualifierReadOnly = 0, + AccessQualifierWriteOnly = 1, + AccessQualifierReadWrite = 2, }; -// Function argument attributes enum FunctionParameterAttribute { - FuncParamAttrZext, // value should be zero extended if needed - FuncParamAttrSext, // value should be sign extended if needed - FuncParamAttrByval, // only valid for pointer parameters (not for ret value), this indicates that the pointer parameter should really be passed by value to the function. - FuncParamAttrSret, // indicates that the pointer parameter specifies the address of a structure that is the return value of the function in the source program. only applicable to the first parameter - FuncParamAttrNoAlias, - FuncParamAttrNoCapture, - FuncParamAttrSVM, - FuncParamAttrNoWrite, - FuncParamAttrNoReadWrite, - FuncParamAttrLast, // guard for validation, "default:" statements, etc. + FunctionParameterAttributeZext = 0, + FunctionParameterAttributeSext = 1, + FunctionParameterAttributeByVal = 2, + FunctionParameterAttributeSret = 3, + FunctionParameterAttributeNoAlias = 4, + FunctionParameterAttributeNoCapture = 5, + FunctionParameterAttributeSVM = 6, + FunctionParameterAttributeNoWrite = 7, + FunctionParameterAttributeNoReadWrite = 8, }; - -// Extra forms of "qualification" to add as needed. See OpDecorate. enum Decoration { - // For legacy ES precision qualifiers; newer language - // designs can use the "num-bits" feature in TypeClass. - // The precision qualifiers may be decorated on type s or instruction s. - DecPrecisionLow, - DecPrecisionMedium, - DecPrecisionHigh, - - DecBlock, // basic in/out/uniform block, applied only to types of TypeStruct - DecBufferBlock, // shader storage buffer block - DecRowMajor, - DecColMajor, - DecGLSLShared, - DecGLSLStd140, - DecGLSLStd430, - DecGLSLPacked, - DecSmooth, - DecNoperspective, - DecFlat, - DecPatch, - DecCentroid, - DecSample, - DecInvariant, - DecRestrict, - DecAliased, - DecVolatile, - DecConstant, - DecCoherent, - DecNonwritable, - DecNonreadable, - DecUniform, - DecNoStaticUse, - - DecCPacked, - DecFPSaturatedConv, - - // these all take one additional operand - DecStream, - DecLocation, - DecComponent, - DecIndex, - DecBinding, - DecDescriptorSet, - DecOffset, - DecAlignment, - DecXfbBuffer, - DecStride, - DecBuiltIn, - DecFuncParamAttr, - DecFPRoundingMode, - DecFPFastMathMode, - DecLinkageType, - DecSpecId, - - DecCount // guard for validation, "default:" statements, etc. + DecorationPrecisionLow = 0, + DecorationPrecisionMedium = 1, + DecorationPrecisionHigh = 2, + DecorationBlock = 3, + DecorationBufferBlock = 4, + DecorationRowMajor = 5, + DecorationColMajor = 6, + DecorationGLSLShared = 7, + DecorationGLSLStd140 = 8, + DecorationGLSLStd430 = 9, + DecorationGLSLPacked = 10, + DecorationSmooth = 11, + DecorationNoperspective = 12, + DecorationFlat = 13, + DecorationPatch = 14, + DecorationCentroid = 15, + DecorationSample = 16, + DecorationInvariant = 17, + DecorationRestrict = 18, + DecorationAliased = 19, + DecorationVolatile = 20, + DecorationConstant = 21, + DecorationCoherent = 22, + DecorationNonwritable = 23, + DecorationNonreadable = 24, + DecorationUniform = 25, + DecorationNoStaticUse = 26, + DecorationCPacked = 27, + DecorationSaturatedConversion = 28, + DecorationStream = 29, + DecorationLocation = 30, + DecorationComponent = 31, + DecorationIndex = 32, + DecorationBinding = 33, + DecorationDescriptorSet = 34, + DecorationOffset = 35, + DecorationAlignment = 36, + DecorationXfbBuffer = 37, + DecorationStride = 38, + DecorationBuiltIn = 39, + DecorationFuncParamAttr = 40, + DecorationFPRoundingMode = 41, + DecorationFPFastMathMode = 42, + DecorationLinkageAttributes = 43, + DecorationSpecId = 44, }; enum BuiltIn { - BuiltInPosition, - BuiltInPointSize, - BuiltInClipVertex, - BuiltInClipDistance, - BuiltInCullDistance, - BuiltInVertexId, - BuiltInInstanceId, - BuiltInPrimitiveId, - BuiltInInvocationId, - BuiltInLayer, - BuiltInViewportIndex, - BuiltInTessLevelOuter, - BuiltInTessLevelInner, - BuiltInTessCoord, - BuiltInPatchVertices, - BuiltInFragCoord, - BuiltInPointCoord, - BuiltInFrontFacing, - BuiltInSampleId, - BuiltInSamplePosition, - BuiltInSampleMask, - BuiltInFragColor, - BuiltInFragDepth, - BuiltInHelperInvocation, - - // OpenGL compute stage, OpenCL work item built-ins - BuiltInNumWorkgroups, // number of work-groups that will execute a kernel - BuiltInWorkgroupSize, // OpenCL number of local work-items - BuiltInWorkgroupId, // OpenCL work group id - BuiltInLocalInvocationId, // OpenCL local work item id (decorates a vector3 i32/i64) - BuiltInGlobalInvocationId, // OpenCL global work item id (decorates a vector3 i32/i64) - BuiltInLocalInvocationIndex, // not in use in OpenCL - BuiltInWorkDim, // OpenCL number of dimensions in use (decorates a scalar i32/i64) - BuiltInGlobalSize, // OpenCL number of global work items, per dimension (decorates a vector3 i32/i64) - BuiltInEnqueuedWorkgroupSize, // OpenCL 2.0 only, get local size - BuiltInGlobalOffset, // OpenCL offset values specified global_work_offset - BuiltInGlobalLinearId, // OpenCL 2.0 only, work items 1-dimensional global ID. - BuiltInWorkgroupLinearId, // OpenCL 2.0 only work items 1-dimensional local ID. - - // OpenCL 2.0 subgroups - BuiltInSubgroupSize, // Returns the number of work-items in the subgroup - BuiltInSubgroupMaxSize, // Returns the maximum size of a subgroup within the dispatch - BuiltInNumSubgroups, // Returns the maximum size of a subgroup within the dispatch - BuiltInNumEnqueuedSubgroups, // Returns the maximum size of a subgroup within the dispatch - BuiltInSubgroupId, // - BuiltInSubgroupLocalInvocationId, // Returns the unique work-item ID within the current subgroup - - BuiltInCount // guard for validation, "default:" statements, etc. + BuiltInPosition = 0, + BuiltInPointSize = 1, + BuiltInClipVertex = 2, + BuiltInClipDistance = 3, + BuiltInCullDistance = 4, + BuiltInVertexId = 5, + BuiltInInstanceId = 6, + BuiltInPrimitiveId = 7, + BuiltInInvocationId = 8, + BuiltInLayer = 9, + BuiltInViewportIndex = 10, + BuiltInTessLevelOuter = 11, + BuiltInTessLevelInner = 12, + BuiltInTessCoord = 13, + BuiltInPatchVertices = 14, + BuiltInFragCoord = 15, + BuiltInPointCoord = 16, + BuiltInFrontFacing = 17, + BuiltInSampleId = 18, + BuiltInSamplePosition = 19, + BuiltInSampleMask = 20, + BuiltInFragColor = 21, + BuiltInFragDepth = 22, + BuiltInHelperInvocation = 23, + BuiltInNumWorkgroups = 24, + BuiltInWorkgroupSize = 25, + BuiltInWorkgroupId = 26, + BuiltInLocalInvocationId = 27, + BuiltInGlobalInvocationId = 28, + BuiltInLocalInvocationIndex = 29, + BuiltInWorkDim = 30, + BuiltInGlobalSize = 31, + BuiltInEnqueuedWorkgroupSize = 32, + BuiltInGlobalOffset = 33, + BuiltInGlobalLinearId = 34, + BuiltInWorkgroupLinearId = 35, + BuiltInSubgroupSize = 36, + BuiltInSubgroupMaxSize = 37, + BuiltInNumSubgroups = 38, + BuiltInNumEnqueuedSubgroups = 39, + BuiltInSubgroupId = 40, + BuiltInSubgroupLocalInvocationId = 41, }; -enum SelectControl { - SelectControlNone, - SelectControlFlatten, - SelectControlDontFlatten, - - SelectControlCount, // guard for validation, "default:" statements, etc. +enum SelectionControlShift { + SelectionControlFlattenShift = 0, + SelectionControlDontFlattenShift = 1, }; -enum LoopControl { - LoopControlNone, - LoopControlUnroll, - LoopControlDontUnroll, +enum SelectionControlMask { + SelectionControlMaskNone = 0, + SelectionControlFlattenMask = 0x00000001, + SelectionControlDontFlattenMask = 0x00000002, +}; - LoopControlCount, +enum LoopControlShift { + LoopControlUnrollShift = 0, + LoopControlDontUnrollShift = 1, +}; + +enum LoopControlMask { + LoopControlMaskNone = 0, + LoopControlUnrollMask = 0x00000001, + LoopControlDontUnrollMask = 0x00000002, +}; + +enum FunctionControlShift { + FunctionControlInlineShift = 0, + FunctionControlDontInlineShift = 1, + FunctionControlPureShift = 2, + FunctionControlConstShift = 3, }; enum FunctionControlMask { - FunctionControlNone = 0x0, - FunctionControlInline = 0x1, - FunctionControlDontInline = 0x2, - FunctionControlPure = 0x4, - FunctionControlConst = 0x8, + FunctionControlMaskNone = 0, + FunctionControlInlineMask = 0x00000001, + FunctionControlDontInlineMask = 0x00000002, + FunctionControlPureMask = 0x00000004, + FunctionControlConstMask = 0x00000008, +}; - FunctionControlCount = 4, +enum MemorySemanticsShift { + MemorySemanticsRelaxedShift = 0, + MemorySemanticsSequentiallyConsistentShift = 1, + MemorySemanticsAcquireShift = 2, + MemorySemanticsReleaseShift = 3, + MemorySemanticsUniformMemoryShift = 4, + MemorySemanticsSubgroupMemoryShift = 5, + MemorySemanticsWorkgroupLocalMemoryShift = 6, + MemorySemanticsWorkgroupGlobalMemoryShift = 7, + MemorySemanticsAtomicCounterMemoryShift = 8, + MemorySemanticsImageMemoryShift = 9, }; enum MemorySemanticsMask { - MemorySemanticsRelaxed = 0x0001, - MemorySemanticsSequentiallyConsistent = 0x0002, - MemorySemanticsAcquire = 0x0004, - MemorySemanticsRelease = 0x0008, + MemorySemanticsMaskNone = 0, + MemorySemanticsRelaxedMask = 0x00000001, + MemorySemanticsSequentiallyConsistentMask = 0x00000002, + MemorySemanticsAcquireMask = 0x00000004, + MemorySemanticsReleaseMask = 0x00000008, + MemorySemanticsUniformMemoryMask = 0x00000010, + MemorySemanticsSubgroupMemoryMask = 0x00000020, + MemorySemanticsWorkgroupLocalMemoryMask = 0x00000040, + MemorySemanticsWorkgroupGlobalMemoryMask = 0x00000080, + MemorySemanticsAtomicCounterMemoryMask = 0x00000100, + MemorySemanticsImageMemoryMask = 0x00000200, +}; - MemorySemanticsUniform = 0x0010, - MemorySemanticsSubgroup = 0x0020, - MemorySemanticsWorkgroupLocal = 0x0040, - MemorySemanticsWorkgroupGlobal = 0x0080, - MemorySemanticsAtomicCounter = 0x0100, - MemorySemanticsImage = 0x0200, - MemorySemanticsAllMemory = 0x03FF, - - MemorySemanticsCount = 10 +enum MemoryAccessShift { + MemoryAccessVolatileShift = 0, + MemoryAccessAlignedShift = 1, }; enum MemoryAccessMask { - MemoryAccessVolatile = 0x0001, - MemoryAccessAligned = 0x0002, - - MemoryAccessCount = 2 + MemoryAccessMaskNone = 0, + MemoryAccessVolatileMask = 0x00000001, + MemoryAccessAlignedMask = 0x00000002, }; enum ExecutionScope { - ExecutionScopeCrossDevice, - ExecutionScopeDevice, - ExecutionScopeWorkgroup, - ExecutionScopeSubgroup, - - ExecutionScopeCount // guard for validation, "default:" statements, etc. + ExecutionScopeCrossDevice = 0, + ExecutionScopeDevice = 1, + ExecutionScopeWorkgroup = 2, + ExecutionScopeSubgroup = 3, }; enum GroupOperation { - GroupOpReduce, - GroupOpInclusiveScan, - GroupOpExclusiveScan, - - GroupOpCount + GroupOperationReduce = 0, + GroupOperationInclusiveScan = 1, + GroupOperationExclusiveScan = 2, }; enum KernelEnqueueFlags { - EnqFlagNoWait, - EnqFlagWaitKernel, - EnqFlagWaitWaitWorgGroup, - - EnqFlagCount + KernelEnqueueFlagsNoWait = 0, + KernelEnqueueFlagsWaitKernel = 1, + KernelEnqueueFlagsWaitWorkGroup = 2, }; -enum KernelProfilingInfo { - ProfInfoCmdExecTime = 0x01, - ProfilingInfoCount = 1 +enum KernelProfilingInfoShift { + KernelProfilingInfoCmdExecTimeShift = 0, }; -enum OpCode { - OpNop = 0, // Not used. - - OpSource, - OpSourceExtension, - OpExtension, - OpExtInstImport, - - OpMemoryModel, - OpEntryPoint, - OpExecutionMode, - - OpTypeVoid, - OpTypeBool, - OpTypeInt, - OpTypeFloat, - OpTypeVector, - OpTypeMatrix, - OpTypeSampler, - OpTypeFilter, - OpTypeArray, - OpTypeRuntimeArray, - OpTypeStruct, - OpTypeOpaque, - OpTypePointer, - OpTypeFunction, - OpTypeEvent, - OpTypeDeviceEvent, - OpTypeReserveId, - OpTypeQueue, - OpTypePipe, - - OpConstantTrue, - OpConstantFalse, - OpConstant, - OpConstantComposite, - OpConstantSampler, - OpConstantNullPointer, - OpConstantNullObject, - - OpSpecConstantTrue, - OpSpecConstantFalse, - OpSpecConstant, - OpSpecConstantComposite, - - OpVariable, - OpVariableArray, - - OpFunction, - OpFunctionParameter, - OpFunctionEnd, - OpFunctionCall, - - OpExtInst, - - OpUndef, - - OpLoad, - OpStore, - - OpPhi, - - OpDecorationGroup, - OpDecorate, - OpMemberDecorate, - OpGroupDecorate, - OpGroupMemberDecorate, - - OpName, - OpMemberName, - OpString, - OpLine, - - OpVectorExtractDynamic, - OpVectorInsertDynamic, - OpVectorShuffle, - - OpCompositeConstruct, - OpCompositeExtract, - OpCompositeInsert, - - OpCopyObject, - OpCopyMemory, - OpCopyMemorySized, - - OpSampler, - - OpTextureSample, - OpTextureSampleDref, - OpTextureSampleLod, - OpTextureSampleProj, - OpTextureSampleGrad, - OpTextureSampleOffset, - OpTextureSampleProjLod, - OpTextureSampleProjGrad, - OpTextureSampleLodOffset, - OpTextureSampleProjOffset, - OpTextureSampleGradOffset, - OpTextureSampleProjLodOffset, - OpTextureSampleProjGradOffset, - - OpTextureFetchTexel, - OpTextureFetchTexelOffset, - OpTextureFetchSample, - OpTextureFetchBuffer, - OpTextureGather, - OpTextureGatherOffset, - OpTextureGatherOffsets, - - OpTextureQuerySizeLod, - OpTextureQuerySize, - OpTextureQueryLod, - OpTextureQueryLevels, - OpTextureQuerySamples, - - OpAccessChain, - OpInBoundsAccessChain, - - OpSNegate, - OpFNegate, - - OpNot, - - OpAny, - OpAll, - - OpConvertFToU, - OpConvertFToS, - OpConvertSToF, - OpConvertUToF, - OpUConvert, - OpSConvert, - OpFConvert, - OpConvertPtrToU, - OpConvertUToPtr, - OpPtrCastToGeneric, // cast a pointer storage class to be in storage generic - OpGenericCastToPtr, // cast a pointer in the generic storage class generic to another storage class - OpBitcast, - - OpTranspose, - - OpIsNan, - OpIsInf, - OpIsFinite, - OpIsNormal, - OpSignBitSet, - OpLessOrGreater, - OpOrdered, - OpUnordered, - - OpArrayLength, - - OpIAdd, - OpFAdd, - OpISub, - OpFSub, - OpIMul, - OpFMul, - OpUDiv, - OpSDiv, - OpFDiv, - - OpUMod, - OpSRem, - OpSMod, - OpFRem, - OpFMod, - - OpVectorTimesScalar, - OpMatrixTimesScalar, - OpVectorTimesMatrix, - OpMatrixTimesVector, - OpMatrixTimesMatrix, - OpOuterProduct, - - OpDot, - - OpShiftRightLogical, - OpShiftRightArithmetic, - OpShiftLeftLogical, - OpLogicalOr, - OpLogicalXor, - OpLogicalAnd, - - OpBitwiseOr, - OpBitwiseXor, - OpBitwiseAnd, - - OpSelect, - - OpIEqual, - OpFOrdEqual, - OpFUnordEqual, - - OpINotEqual, - OpFOrdNotEqual, - OpFUnordNotEqual, - - OpULessThan, - OpSLessThan, - OpFOrdLessThan, - OpFUnordLessThan, - - OpUGreaterThan, - OpSGreaterThan, - OpFOrdGreaterThan, - OpFUnordGreaterThan, - - OpULessThanEqual, - OpSLessThanEqual, - OpFOrdLessThanEqual, - OpFUnordLessThanEqual, - - OpUGreaterThanEqual, - OpSGreaterThanEqual, - OpFOrdGreaterThanEqual, - OpFUnordGreaterThanEqual, - - OpDPdx, - OpDPdy, - OpFwidth, - OpDPdxFine, - OpDPdyFine, - OpFwidthFine, - OpDPdxCoarse, - OpDPdyCoarse, - OpFwidthCoarse, - - OpEmitVertex, - OpEndPrimitive, - OpEmitStreamVertex, - OpEndStreamPrimitive, - - OpControlBarrier, - OpMemoryBarrier, - - OpImagePointer, - - OpAtomicInit, - OpAtomicLoad, - OpAtomicStore, - OpAtomicExchange, - OpAtomicCompareExchange, - OpAtomicCompareExchangeWeak, - OpAtomicIIncrement, - OpAtomicIDecrement, - OpAtomicIAdd, - OpAtomicISub, - OpAtomicUMin, - OpAtomicUMax, - OpAtomicAnd, - OpAtomicOr, - OpAtomicXor, - - OpLoopMerge, - OpSelectionMerge, - OpLabel, - OpBranch, - OpBranchConditional, - OpSwitch, - OpKill, - OpReturn, - OpReturnValue, - - OpUnreachable, - - OpLifetimeStart, - OpLifetimeStop, - - OpCompileFlag, - - OpAsyncGroupCopy, - OpWaitGroupEvents, - - OpGroupAll, - OpGroupAny, - OpGroupBroadcast, - - OpGroupIAdd, - OpGroupFAdd, - OpGroupFMin, - OpGroupUMin, - OpGroupSMin, - OpGroupFMax, - OpGroupUMax, - OpGroupSMax, - - OpGenericCastToPtrExplicit, - OpGenericPtrMemSemantics, - - OpReadPipe, - OpWritePipe, - OpReservedReadPipe, - OpReservedWritePipe, - OpReserveReadPipePackets, - OpReserveWritePipePackets, - OpCommitReadPipe, - OpCommitWritePipe, - OpIsValidReserveId, - OpGetNumPipePackets, - OpGetMaxPipePackets, - OpGroupReserveReadPipePackets, - OpGroupReserveWritePipePackets, - OpGroupCommitReadPipe, - OpGroupCommitWritePipe, - - OpEnqueueMarker, - OpEnqueueKernel, - OpGetKernelNDrangeSubGroupCount, - OpGetKernelNDrangeMaxSubGroupSize, - - OpGetKernelWorkGroupSize, - OpGetKernelPreferredWorkGroupSizeMultiple, - - OpRetainEvent, - OpReleaseEvent, - - OpCreateUserEvent, - OpIsValidEvent, - OpSetUserEventStatus, - OpCaptureEventProfilingInfo, - OpGetDefaultQueue, - - OpBuildNDRange, - - OpCount // guard for validation, "default:" statements, etc. +enum KernelProfilingInfoMask { + KernelProfilingInfoMaskNone = 0, + KernelProfilingInfoCmdExecTimeMask = 0x00000001, +}; + +enum Op { + OpNop = 0, + OpSource = 1, + OpSourceExtension = 2, + OpExtension = 3, + OpExtInstImport = 4, + OpMemoryModel = 5, + OpEntryPoint = 6, + OpExecutionMode = 7, + OpTypeVoid = 8, + OpTypeBool = 9, + OpTypeInt = 10, + OpTypeFloat = 11, + OpTypeVector = 12, + OpTypeMatrix = 13, + OpTypeSampler = 14, + OpTypeFilter = 15, + OpTypeArray = 16, + OpTypeRuntimeArray = 17, + OpTypeStruct = 18, + OpTypeOpaque = 19, + OpTypePointer = 20, + OpTypeFunction = 21, + OpTypeEvent = 22, + OpTypeDeviceEvent = 23, + OpTypeReserveId = 24, + OpTypeQueue = 25, + OpTypePipe = 26, + OpConstantTrue = 27, + OpConstantFalse = 28, + OpConstant = 29, + OpConstantComposite = 30, + OpConstantSampler = 31, + OpConstantNullPointer = 32, + OpConstantNullObject = 33, + OpSpecConstantTrue = 34, + OpSpecConstantFalse = 35, + OpSpecConstant = 36, + OpSpecConstantComposite = 37, + OpVariable = 38, + OpVariableArray = 39, + OpFunction = 40, + OpFunctionParameter = 41, + OpFunctionEnd = 42, + OpFunctionCall = 43, + OpExtInst = 44, + OpUndef = 45, + OpLoad = 46, + OpStore = 47, + OpPhi = 48, + OpDecorationGroup = 49, + OpDecorate = 50, + OpMemberDecorate = 51, + OpGroupDecorate = 52, + OpGroupMemberDecorate = 53, + OpName = 54, + OpMemberName = 55, + OpString = 56, + OpLine = 57, + OpVectorExtractDynamic = 58, + OpVectorInsertDynamic = 59, + OpVectorShuffle = 60, + OpCompositeConstruct = 61, + OpCompositeExtract = 62, + OpCompositeInsert = 63, + OpCopyObject = 64, + OpCopyMemory = 65, + OpCopyMemorySized = 66, + OpSampler = 67, + OpTextureSample = 68, + OpTextureSampleDref = 69, + OpTextureSampleLod = 70, + OpTextureSampleProj = 71, + OpTextureSampleGrad = 72, + OpTextureSampleOffset = 73, + OpTextureSampleProjLod = 74, + OpTextureSampleProjGrad = 75, + OpTextureSampleLodOffset = 76, + OpTextureSampleProjOffset = 77, + OpTextureSampleGradOffset = 78, + OpTextureSampleProjLodOffset = 79, + OpTextureSampleProjGradOffset = 80, + OpTextureFetchTexelLod = 81, + OpTextureFetchTexelOffset = 82, + OpTextureFetchSample = 83, + OpTextureFetchTexel = 84, + OpTextureGather = 85, + OpTextureGatherOffset = 86, + OpTextureGatherOffsets = 87, + OpTextureQuerySizeLod = 88, + OpTextureQuerySize = 89, + OpTextureQueryLod = 90, + OpTextureQueryLevels = 91, + OpTextureQuerySamples = 92, + OpAccessChain = 93, + OpInBoundsAccessChain = 94, + OpSNegate = 95, + OpFNegate = 96, + OpNot = 97, + OpAny = 98, + OpAll = 99, + OpConvertFToU = 100, + OpConvertFToS = 101, + OpConvertSToF = 102, + OpConvertUToF = 103, + OpUConvert = 104, + OpSConvert = 105, + OpFConvert = 106, + OpConvertPtrToU = 107, + OpConvertUToPtr = 108, + OpPtrCastToGeneric = 109, + OpGenericCastToPtr = 110, + OpBitcast = 111, + OpTranspose = 112, + OpIsNan = 113, + OpIsInf = 114, + OpIsFinite = 115, + OpIsNormal = 116, + OpSignBitSet = 117, + OpLessOrGreater = 118, + OpOrdered = 119, + OpUnordered = 120, + OpArrayLength = 121, + OpIAdd = 122, + OpFAdd = 123, + OpISub = 124, + OpFSub = 125, + OpIMul = 126, + OpFMul = 127, + OpUDiv = 128, + OpSDiv = 129, + OpFDiv = 130, + OpUMod = 131, + OpSRem = 132, + OpSMod = 133, + OpFRem = 134, + OpFMod = 135, + OpVectorTimesScalar = 136, + OpMatrixTimesScalar = 137, + OpVectorTimesMatrix = 138, + OpMatrixTimesVector = 139, + OpMatrixTimesMatrix = 140, + OpOuterProduct = 141, + OpDot = 142, + OpShiftRightLogical = 143, + OpShiftRightArithmetic = 144, + OpShiftLeftLogical = 145, + OpLogicalOr = 146, + OpLogicalXor = 147, + OpLogicalAnd = 148, + OpBitwiseOr = 149, + OpBitwiseXor = 150, + OpBitwiseAnd = 151, + OpSelect = 152, + OpIEqual = 153, + OpFOrdEqual = 154, + OpFUnordEqual = 155, + OpINotEqual = 156, + OpFOrdNotEqual = 157, + OpFUnordNotEqual = 158, + OpULessThan = 159, + OpSLessThan = 160, + OpFOrdLessThan = 161, + OpFUnordLessThan = 162, + OpUGreaterThan = 163, + OpSGreaterThan = 164, + OpFOrdGreaterThan = 165, + OpFUnordGreaterThan = 166, + OpULessThanEqual = 167, + OpSLessThanEqual = 168, + OpFOrdLessThanEqual = 169, + OpFUnordLessThanEqual = 170, + OpUGreaterThanEqual = 171, + OpSGreaterThanEqual = 172, + OpFOrdGreaterThanEqual = 173, + OpFUnordGreaterThanEqual = 174, + OpDPdx = 175, + OpDPdy = 176, + OpFwidth = 177, + OpDPdxFine = 178, + OpDPdyFine = 179, + OpFwidthFine = 180, + OpDPdxCoarse = 181, + OpDPdyCoarse = 182, + OpFwidthCoarse = 183, + OpEmitVertex = 184, + OpEndPrimitive = 185, + OpEmitStreamVertex = 186, + OpEndStreamPrimitive = 187, + OpControlBarrier = 188, + OpMemoryBarrier = 189, + OpImagePointer = 190, + OpAtomicInit = 191, + OpAtomicLoad = 192, + OpAtomicStore = 193, + OpAtomicExchange = 194, + OpAtomicCompareExchange = 195, + OpAtomicCompareExchangeWeak = 196, + OpAtomicIIncrement = 197, + OpAtomicIDecrement = 198, + OpAtomicIAdd = 199, + OpAtomicISub = 200, + OpAtomicUMin = 201, + OpAtomicUMax = 202, + OpAtomicAnd = 203, + OpAtomicOr = 204, + OpAtomicXor = 205, + OpLoopMerge = 206, + OpSelectionMerge = 207, + OpLabel = 208, + OpBranch = 209, + OpBranchConditional = 210, + OpSwitch = 211, + OpKill = 212, + OpReturn = 213, + OpReturnValue = 214, + OpUnreachable = 215, + OpLifetimeStart = 216, + OpLifetimeStop = 217, + OpCompileFlag = 218, + OpAsyncGroupCopy = 219, + OpWaitGroupEvents = 220, + OpGroupAll = 221, + OpGroupAny = 222, + OpGroupBroadcast = 223, + OpGroupIAdd = 224, + OpGroupFAdd = 225, + OpGroupFMin = 226, + OpGroupUMin = 227, + OpGroupSMin = 228, + OpGroupFMax = 229, + OpGroupUMax = 230, + OpGroupSMax = 231, + OpGenericCastToPtrExplicit = 232, + OpGenericPtrMemSemantics = 233, + OpReadPipe = 234, + OpWritePipe = 235, + OpReservedReadPipe = 236, + OpReservedWritePipe = 237, + OpReserveReadPipePackets = 238, + OpReserveWritePipePackets = 239, + OpCommitReadPipe = 240, + OpCommitWritePipe = 241, + OpIsValidReserveId = 242, + OpGetNumPipePackets = 243, + OpGetMaxPipePackets = 244, + OpGroupReserveReadPipePackets = 245, + OpGroupReserveWritePipePackets = 246, + OpGroupCommitReadPipe = 247, + OpGroupCommitWritePipe = 248, + OpEnqueueMarker = 249, + OpEnqueueKernel = 250, + OpGetKernelNDrangeSubGroupCount = 251, + OpGetKernelNDrangeMaxSubGroupSize = 252, + OpGetKernelWorkGroupSize = 253, + OpGetKernelPreferredWorkGroupSizeMultiple = 254, + OpRetainEvent = 255, + OpReleaseEvent = 256, + OpCreateUserEvent = 257, + OpIsValidEvent = 258, + OpSetUserEventStatus = 259, + OpCaptureEventProfilingInfo = 260, + OpGetDefaultQueue = 261, + OpBuildNDRange = 262, + OpSatConvertSToU = 263, + OpSatConvertUToS = 264, + OpAtomicIMin = 265, + OpAtomicIMax = 266, }; -#ifdef __cplusplus }; // end namespace spv -#endif -#endif // spirv_H +#endif // #ifdef __cplusplus + + +#ifndef __cplusplus + +const int SpvMagicNumber = 0x07230203; +const int SpvVersion = 99; + +typedef unsigned int SpvId; + +const unsigned int SpvOpCodeMask = 0xFFFF; +const unsigned int SpvWordCountShift = 16; + +typedef enum SpvSourceLanguage_ { + SpvSourceLanguageUnknown = 0, + SpvSourceLanguageESSL = 1, + SpvSourceLanguageGLSL = 2, + SpvSourceLanguageOpenCL = 3, +} SpvSourceLanguage; + +typedef enum SpvExecutionModel_ { + SpvExecutionModelVertex = 0, + SpvExecutionModelTessellationControl = 1, + SpvExecutionModelTessellationEvaluation = 2, + SpvExecutionModelGeometry = 3, + SpvExecutionModelFragment = 4, + SpvExecutionModelGLCompute = 5, + SpvExecutionModelKernel = 6, +} SpvExecutionModel; + +typedef enum SpvAddressingModel_ { + SpvAddressingModelLogical = 0, + SpvAddressingModelPhysical32 = 1, + SpvAddressingModelPhysical64 = 2, +} SpvAddressingModel; + +typedef enum SpvMemoryModel_ { + SpvMemoryModelSimple = 0, + SpvMemoryModelGLSL450 = 1, + SpvMemoryModelOpenCL12 = 2, + SpvMemoryModelOpenCL20 = 3, + SpvMemoryModelOpenCL21 = 4, +} SpvMemoryModel; + +typedef enum SpvExecutionMode_ { + SpvExecutionModeInvocations = 0, + SpvExecutionModeSpacingEqual = 1, + SpvExecutionModeSpacingFractionalEven = 2, + SpvExecutionModeSpacingFractionalOdd = 3, + SpvExecutionModeVertexOrderCw = 4, + SpvExecutionModeVertexOrderCcw = 5, + SpvExecutionModePixelCenterInteger = 6, + SpvExecutionModeOriginUpperLeft = 7, + SpvExecutionModeEarlyFragmentTests = 8, + SpvExecutionModePointMode = 9, + SpvExecutionModeXfb = 10, + SpvExecutionModeDepthReplacing = 11, + SpvExecutionModeDepthAny = 12, + SpvExecutionModeDepthGreater = 13, + SpvExecutionModeDepthLess = 14, + SpvExecutionModeDepthUnchanged = 15, + SpvExecutionModeLocalSize = 16, + SpvExecutionModeLocalSizeHint = 17, + SpvExecutionModeInputPoints = 18, + SpvExecutionModeInputLines = 19, + SpvExecutionModeInputLinesAdjacency = 20, + SpvExecutionModeInputTriangles = 21, + SpvExecutionModeInputTrianglesAdjacency = 22, + SpvExecutionModeInputQuads = 23, + SpvExecutionModeInputIsolines = 24, + SpvExecutionModeOutputVertices = 25, + SpvExecutionModeOutputPoints = 26, + SpvExecutionModeOutputLineStrip = 27, + SpvExecutionModeOutputTriangleStrip = 28, + SpvExecutionModeVecTypeHint = 29, + SpvExecutionModeContractionOff = 30, +} SpvExecutionMode; + +typedef enum SpvStorageClass_ { + SpvStorageClassUniformConstant = 0, + SpvStorageClassInput = 1, + SpvStorageClassUniform = 2, + SpvStorageClassOutput = 3, + SpvStorageClassWorkgroupLocal = 4, + SpvStorageClassWorkgroupGlobal = 5, + SpvStorageClassPrivateGlobal = 6, + SpvStorageClassFunction = 7, + SpvStorageClassGeneric = 8, + SpvStorageClassPrivate = 9, + SpvStorageClassAtomicCounter = 10, +} SpvStorageClass; + +typedef enum SpvDim_ { + SpvDim1D = 0, + SpvDim2D = 1, + SpvDim3D = 2, + SpvDimCube = 3, + SpvDimRect = 4, + SpvDimBuffer = 5, +} SpvDim; + +typedef enum SpvSamplerAddressingMode_ { + SpvSamplerAddressingModeNone = 0, + SpvSamplerAddressingModeClampToEdge = 2, + SpvSamplerAddressingModeClamp = 4, + SpvSamplerAddressingModeRepeat = 6, + SpvSamplerAddressingModeRepeatMirrored = 8, +} SpvSamplerAddressingMode; + +typedef enum SpvSamplerFilterMode_ { + SpvSamplerFilterModeNearest = 16, + SpvSamplerFilterModeLinear = 32, +} SpvSamplerFilterMode; + +typedef enum SpvFPFastMathModeShift_ { + SpvFPFastMathModeNotNaNShift = 0, + SpvFPFastMathModeNotInfShift = 1, + SpvFPFastMathModeNSZShift = 2, + SpvFPFastMathModeAllowRecipShift = 3, + SpvFPFastMathModeFastShift = 4, +} SpvFPFastMathModeShift; + +typedef enum SpvFPFastMathModeMask_ { + SpvFPFastMathModeMaskNone = 0, + SpvFPFastMathModeNotNaNMask = 0x00000001, + SpvFPFastMathModeNotInfMask = 0x00000002, + SpvFPFastMathModeNSZMask = 0x00000004, + SpvFPFastMathModeAllowRecipMask = 0x00000008, + SpvFPFastMathModeFastMask = 0x00000010, +} SpvFPFastMathModeMask; + +typedef enum SpvFPRoundingMode_ { + SpvFPRoundingModeRTE = 0, + SpvFPRoundingModeRTZ = 1, + SpvFPRoundingModeRTP = 2, + SpvFPRoundingModeRTN = 3, +} SpvFPRoundingMode; + +typedef enum SpvLinkageType_ { + SpvLinkageTypeExport = 0, + SpvLinkageTypeImport = 1, +} SpvLinkageType; + +typedef enum SpvAccessQualifier_ { + SpvAccessQualifierReadOnly = 0, + SpvAccessQualifierWriteOnly = 1, + SpvAccessQualifierReadWrite = 2, +} SpvAccessQualifier; + +typedef enum SpvFunctionParameterAttribute_ { + SpvFunctionParameterAttributeZext = 0, + SpvFunctionParameterAttributeSext = 1, + SpvFunctionParameterAttributeByVal = 2, + SpvFunctionParameterAttributeSret = 3, + SpvFunctionParameterAttributeNoAlias = 4, + SpvFunctionParameterAttributeNoCapture = 5, + SpvFunctionParameterAttributeSVM = 6, + SpvFunctionParameterAttributeNoWrite = 7, + SpvFunctionParameterAttributeNoReadWrite = 8, +} SpvFunctionParameterAttribute; + +typedef enum SpvDecoration_ { + SpvDecorationPrecisionLow = 0, + SpvDecorationPrecisionMedium = 1, + SpvDecorationPrecisionHigh = 2, + SpvDecorationBlock = 3, + SpvDecorationBufferBlock = 4, + SpvDecorationRowMajor = 5, + SpvDecorationColMajor = 6, + SpvDecorationGLSLShared = 7, + SpvDecorationGLSLStd140 = 8, + SpvDecorationGLSLStd430 = 9, + SpvDecorationGLSLPacked = 10, + SpvDecorationSmooth = 11, + SpvDecorationNoperspective = 12, + SpvDecorationFlat = 13, + SpvDecorationPatch = 14, + SpvDecorationCentroid = 15, + SpvDecorationSample = 16, + SpvDecorationInvariant = 17, + SpvDecorationRestrict = 18, + SpvDecorationAliased = 19, + SpvDecorationVolatile = 20, + SpvDecorationConstant = 21, + SpvDecorationCoherent = 22, + SpvDecorationNonwritable = 23, + SpvDecorationNonreadable = 24, + SpvDecorationUniform = 25, + SpvDecorationNoStaticUse = 26, + SpvDecorationCPacked = 27, + SpvDecorationSaturatedConversion = 28, + SpvDecorationStream = 29, + SpvDecorationLocation = 30, + SpvDecorationComponent = 31, + SpvDecorationIndex = 32, + SpvDecorationBinding = 33, + SpvDecorationDescriptorSet = 34, + SpvDecorationOffset = 35, + SpvDecorationAlignment = 36, + SpvDecorationXfbBuffer = 37, + SpvDecorationStride = 38, + SpvDecorationBuiltIn = 39, + SpvDecorationFuncParamAttr = 40, + SpvDecorationFPRoundingMode = 41, + SpvDecorationFPFastMathMode = 42, + SpvDecorationLinkageAttributes = 43, + SpvDecorationSpecId = 44, +} SpvDecoration; + +typedef enum SpvBuiltIn_ { + SpvBuiltInPosition = 0, + SpvBuiltInPointSize = 1, + SpvBuiltInClipVertex = 2, + SpvBuiltInClipDistance = 3, + SpvBuiltInCullDistance = 4, + SpvBuiltInVertexId = 5, + SpvBuiltInInstanceId = 6, + SpvBuiltInPrimitiveId = 7, + SpvBuiltInInvocationId = 8, + SpvBuiltInLayer = 9, + SpvBuiltInViewportIndex = 10, + SpvBuiltInTessLevelOuter = 11, + SpvBuiltInTessLevelInner = 12, + SpvBuiltInTessCoord = 13, + SpvBuiltInPatchVertices = 14, + SpvBuiltInFragCoord = 15, + SpvBuiltInPointCoord = 16, + SpvBuiltInFrontFacing = 17, + SpvBuiltInSampleId = 18, + SpvBuiltInSamplePosition = 19, + SpvBuiltInSampleMask = 20, + SpvBuiltInFragColor = 21, + SpvBuiltInFragDepth = 22, + SpvBuiltInHelperInvocation = 23, + SpvBuiltInNumWorkgroups = 24, + SpvBuiltInWorkgroupSize = 25, + SpvBuiltInWorkgroupId = 26, + SpvBuiltInLocalInvocationId = 27, + SpvBuiltInGlobalInvocationId = 28, + SpvBuiltInLocalInvocationIndex = 29, + SpvBuiltInWorkDim = 30, + SpvBuiltInGlobalSize = 31, + SpvBuiltInEnqueuedWorkgroupSize = 32, + SpvBuiltInGlobalOffset = 33, + SpvBuiltInGlobalLinearId = 34, + SpvBuiltInWorkgroupLinearId = 35, + SpvBuiltInSubgroupSize = 36, + SpvBuiltInSubgroupMaxSize = 37, + SpvBuiltInNumSubgroups = 38, + SpvBuiltInNumEnqueuedSubgroups = 39, + SpvBuiltInSubgroupId = 40, + SpvBuiltInSubgroupLocalInvocationId = 41, +} SpvBuiltIn; + +typedef enum SpvSelectionControlShift_ { + SpvSelectionControlFlattenShift = 0, + SpvSelectionControlDontFlattenShift = 1, +} SpvSelectionControlShift; + +typedef enum SpvSelectionControlMask_ { + SpvSelectionControlMaskNone = 0, + SpvSelectionControlFlattenMask = 0x00000001, + SpvSelectionControlDontFlattenMask = 0x00000002, +} SpvSelectionControlMask; + +typedef enum SpvLoopControlShift_ { + SpvLoopControlUnrollShift = 0, + SpvLoopControlDontUnrollShift = 1, +} SpvLoopControlShift; + +typedef enum SpvLoopControlMask_ { + SpvLoopControlMaskNone = 0, + SpvLoopControlUnrollMask = 0x00000001, + SpvLoopControlDontUnrollMask = 0x00000002, +} SpvLoopControlMask; + +typedef enum SpvFunctionControlShift_ { + SpvFunctionControlInlineShift = 0, + SpvFunctionControlDontInlineShift = 1, + SpvFunctionControlPureShift = 2, + SpvFunctionControlConstShift = 3, +} SpvFunctionControlShift; + +typedef enum SpvFunctionControlMask_ { + SpvFunctionControlMaskNone = 0, + SpvFunctionControlInlineMask = 0x00000001, + SpvFunctionControlDontInlineMask = 0x00000002, + SpvFunctionControlPureMask = 0x00000004, + SpvFunctionControlConstMask = 0x00000008, +} SpvFunctionControlMask; + +typedef enum SpvMemorySemanticsShift_ { + SpvMemorySemanticsRelaxedShift = 0, + SpvMemorySemanticsSequentiallyConsistentShift = 1, + SpvMemorySemanticsAcquireShift = 2, + SpvMemorySemanticsReleaseShift = 3, + SpvMemorySemanticsUniformMemoryShift = 4, + SpvMemorySemanticsSubgroupMemoryShift = 5, + SpvMemorySemanticsWorkgroupLocalMemoryShift = 6, + SpvMemorySemanticsWorkgroupGlobalMemoryShift = 7, + SpvMemorySemanticsAtomicCounterMemoryShift = 8, + SpvMemorySemanticsImageMemoryShift = 9, +} SpvMemorySemanticsShift; + +typedef enum SpvMemorySemanticsMask_ { + SpvMemorySemanticsMaskNone = 0, + SpvMemorySemanticsRelaxedMask = 0x00000001, + SpvMemorySemanticsSequentiallyConsistentMask = 0x00000002, + SpvMemorySemanticsAcquireMask = 0x00000004, + SpvMemorySemanticsReleaseMask = 0x00000008, + SpvMemorySemanticsUniformMemoryMask = 0x00000010, + SpvMemorySemanticsSubgroupMemoryMask = 0x00000020, + SpvMemorySemanticsWorkgroupLocalMemoryMask = 0x00000040, + SpvMemorySemanticsWorkgroupGlobalMemoryMask = 0x00000080, + SpvMemorySemanticsAtomicCounterMemoryMask = 0x00000100, + SpvMemorySemanticsImageMemoryMask = 0x00000200, +} SpvMemorySemanticsMask; + +typedef enum SpvMemoryAccessShift_ { + SpvMemoryAccessVolatileShift = 0, + SpvMemoryAccessAlignedShift = 1, +} SpvMemoryAccessShift; + +typedef enum SpvMemoryAccessMask_ { + SpvMemoryAccessMaskNone = 0, + SpvMemoryAccessVolatileMask = 0x00000001, + SpvMemoryAccessAlignedMask = 0x00000002, +} SpvMemoryAccessMask; + +typedef enum SpvExecutionScope_ { + SpvExecutionScopeCrossDevice = 0, + SpvExecutionScopeDevice = 1, + SpvExecutionScopeWorkgroup = 2, + SpvExecutionScopeSubgroup = 3, +} SpvExecutionScope; + +typedef enum SpvGroupOperation_ { + SpvGroupOperationReduce = 0, + SpvGroupOperationInclusiveScan = 1, + SpvGroupOperationExclusiveScan = 2, +} SpvGroupOperation; + +typedef enum SpvKernelEnqueueFlags_ { + SpvKernelEnqueueFlagsNoWait = 0, + SpvKernelEnqueueFlagsWaitKernel = 1, + SpvKernelEnqueueFlagsWaitWorkGroup = 2, +} SpvKernelEnqueueFlags; + +typedef enum SpvKernelProfilingInfoShift_ { + SpvKernelProfilingInfoCmdExecTimeShift = 0, +} SpvKernelProfilingInfoShift; + +typedef enum SpvKernelProfilingInfoMask_ { + SpvKernelProfilingInfoMaskNone = 0, + SpvKernelProfilingInfoCmdExecTimeMask = 0x00000001, +} SpvKernelProfilingInfoMask; + +typedef enum SpvOp_ { + SpvOpNop = 0, + SpvOpSource = 1, + SpvOpSourceExtension = 2, + SpvOpExtension = 3, + SpvOpExtInstImport = 4, + SpvOpMemoryModel = 5, + SpvOpEntryPoint = 6, + SpvOpExecutionMode = 7, + SpvOpTypeVoid = 8, + SpvOpTypeBool = 9, + SpvOpTypeInt = 10, + SpvOpTypeFloat = 11, + SpvOpTypeVector = 12, + SpvOpTypeMatrix = 13, + SpvOpTypeSampler = 14, + SpvOpTypeFilter = 15, + SpvOpTypeArray = 16, + SpvOpTypeRuntimeArray = 17, + SpvOpTypeStruct = 18, + SpvOpTypeOpaque = 19, + SpvOpTypePointer = 20, + SpvOpTypeFunction = 21, + SpvOpTypeEvent = 22, + SpvOpTypeDeviceEvent = 23, + SpvOpTypeReserveId = 24, + SpvOpTypeQueue = 25, + SpvOpTypePipe = 26, + SpvOpConstantTrue = 27, + SpvOpConstantFalse = 28, + SpvOpConstant = 29, + SpvOpConstantComposite = 30, + SpvOpConstantSampler = 31, + SpvOpConstantNullPointer = 32, + SpvOpConstantNullObject = 33, + SpvOpSpecConstantTrue = 34, + SpvOpSpecConstantFalse = 35, + SpvOpSpecConstant = 36, + SpvOpSpecConstantComposite = 37, + SpvOpVariable = 38, + SpvOpVariableArray = 39, + SpvOpFunction = 40, + SpvOpFunctionParameter = 41, + SpvOpFunctionEnd = 42, + SpvOpFunctionCall = 43, + SpvOpExtInst = 44, + SpvOpUndef = 45, + SpvOpLoad = 46, + SpvOpStore = 47, + SpvOpPhi = 48, + SpvOpDecorationGroup = 49, + SpvOpDecorate = 50, + SpvOpMemberDecorate = 51, + SpvOpGroupDecorate = 52, + SpvOpGroupMemberDecorate = 53, + SpvOpName = 54, + SpvOpMemberName = 55, + SpvOpString = 56, + SpvOpLine = 57, + SpvOpVectorExtractDynamic = 58, + SpvOpVectorInsertDynamic = 59, + SpvOpVectorShuffle = 60, + SpvOpCompositeConstruct = 61, + SpvOpCompositeExtract = 62, + SpvOpCompositeInsert = 63, + SpvOpCopyObject = 64, + SpvOpCopyMemory = 65, + SpvOpCopyMemorySized = 66, + SpvOpSampler = 67, + SpvOpTextureSample = 68, + SpvOpTextureSampleDref = 69, + SpvOpTextureSampleLod = 70, + SpvOpTextureSampleProj = 71, + SpvOpTextureSampleGrad = 72, + SpvOpTextureSampleOffset = 73, + SpvOpTextureSampleProjLod = 74, + SpvOpTextureSampleProjGrad = 75, + SpvOpTextureSampleLodOffset = 76, + SpvOpTextureSampleProjOffset = 77, + SpvOpTextureSampleGradOffset = 78, + SpvOpTextureSampleProjLodOffset = 79, + SpvOpTextureSampleProjGradOffset = 80, + SpvOpTextureFetchTexelLod = 81, + SpvOpTextureFetchTexelOffset = 82, + SpvOpTextureFetchSample = 83, + SpvOpTextureFetchTexel = 84, + SpvOpTextureGather = 85, + SpvOpTextureGatherOffset = 86, + SpvOpTextureGatherOffsets = 87, + SpvOpTextureQuerySizeLod = 88, + SpvOpTextureQuerySize = 89, + SpvOpTextureQueryLod = 90, + SpvOpTextureQueryLevels = 91, + SpvOpTextureQuerySamples = 92, + SpvOpAccessChain = 93, + SpvOpInBoundsAccessChain = 94, + SpvOpSNegate = 95, + SpvOpFNegate = 96, + SpvOpNot = 97, + SpvOpAny = 98, + SpvOpAll = 99, + SpvOpConvertFToU = 100, + SpvOpConvertFToS = 101, + SpvOpConvertSToF = 102, + SpvOpConvertUToF = 103, + SpvOpUConvert = 104, + SpvOpSConvert = 105, + SpvOpFConvert = 106, + SpvOpConvertPtrToU = 107, + SpvOpConvertUToPtr = 108, + SpvOpPtrCastToGeneric = 109, + SpvOpGenericCastToPtr = 110, + SpvOpBitcast = 111, + SpvOpTranspose = 112, + SpvOpIsNan = 113, + SpvOpIsInf = 114, + SpvOpIsFinite = 115, + SpvOpIsNormal = 116, + SpvOpSignBitSet = 117, + SpvOpLessOrGreater = 118, + SpvOpOrdered = 119, + SpvOpUnordered = 120, + SpvOpArrayLength = 121, + SpvOpIAdd = 122, + SpvOpFAdd = 123, + SpvOpISub = 124, + SpvOpFSub = 125, + SpvOpIMul = 126, + SpvOpFMul = 127, + SpvOpUDiv = 128, + SpvOpSDiv = 129, + SpvOpFDiv = 130, + SpvOpUMod = 131, + SpvOpSRem = 132, + SpvOpSMod = 133, + SpvOpFRem = 134, + SpvOpFMod = 135, + SpvOpVectorTimesScalar = 136, + SpvOpMatrixTimesScalar = 137, + SpvOpVectorTimesMatrix = 138, + SpvOpMatrixTimesVector = 139, + SpvOpMatrixTimesMatrix = 140, + SpvOpOuterProduct = 141, + SpvOpDot = 142, + SpvOpShiftRightLogical = 143, + SpvOpShiftRightArithmetic = 144, + SpvOpShiftLeftLogical = 145, + SpvOpLogicalOr = 146, + SpvOpLogicalXor = 147, + SpvOpLogicalAnd = 148, + SpvOpBitwiseOr = 149, + SpvOpBitwiseXor = 150, + SpvOpBitwiseAnd = 151, + SpvOpSelect = 152, + SpvOpIEqual = 153, + SpvOpFOrdEqual = 154, + SpvOpFUnordEqual = 155, + SpvOpINotEqual = 156, + SpvOpFOrdNotEqual = 157, + SpvOpFUnordNotEqual = 158, + SpvOpULessThan = 159, + SpvOpSLessThan = 160, + SpvOpFOrdLessThan = 161, + SpvOpFUnordLessThan = 162, + SpvOpUGreaterThan = 163, + SpvOpSGreaterThan = 164, + SpvOpFOrdGreaterThan = 165, + SpvOpFUnordGreaterThan = 166, + SpvOpULessThanEqual = 167, + SpvOpSLessThanEqual = 168, + SpvOpFOrdLessThanEqual = 169, + SpvOpFUnordLessThanEqual = 170, + SpvOpUGreaterThanEqual = 171, + SpvOpSGreaterThanEqual = 172, + SpvOpFOrdGreaterThanEqual = 173, + SpvOpFUnordGreaterThanEqual = 174, + SpvOpDPdx = 175, + SpvOpDPdy = 176, + SpvOpFwidth = 177, + SpvOpDPdxFine = 178, + SpvOpDPdyFine = 179, + SpvOpFwidthFine = 180, + SpvOpDPdxCoarse = 181, + SpvOpDPdyCoarse = 182, + SpvOpFwidthCoarse = 183, + SpvOpEmitVertex = 184, + SpvOpEndPrimitive = 185, + SpvOpEmitStreamVertex = 186, + SpvOpEndStreamPrimitive = 187, + SpvOpControlBarrier = 188, + SpvOpMemoryBarrier = 189, + SpvOpImagePointer = 190, + SpvOpAtomicInit = 191, + SpvOpAtomicLoad = 192, + SpvOpAtomicStore = 193, + SpvOpAtomicExchange = 194, + SpvOpAtomicCompareExchange = 195, + SpvOpAtomicCompareExchangeWeak = 196, + SpvOpAtomicIIncrement = 197, + SpvOpAtomicIDecrement = 198, + SpvOpAtomicIAdd = 199, + SpvOpAtomicISub = 200, + SpvOpAtomicUMin = 201, + SpvOpAtomicUMax = 202, + SpvOpAtomicAnd = 203, + SpvOpAtomicOr = 204, + SpvOpAtomicXor = 205, + SpvOpLoopMerge = 206, + SpvOpSelectionMerge = 207, + SpvOpLabel = 208, + SpvOpBranch = 209, + SpvOpBranchConditional = 210, + SpvOpSwitch = 211, + SpvOpKill = 212, + SpvOpReturn = 213, + SpvOpReturnValue = 214, + SpvOpUnreachable = 215, + SpvOpLifetimeStart = 216, + SpvOpLifetimeStop = 217, + SpvOpCompileFlag = 218, + SpvOpAsyncGroupCopy = 219, + SpvOpWaitGroupEvents = 220, + SpvOpGroupAll = 221, + SpvOpGroupAny = 222, + SpvOpGroupBroadcast = 223, + SpvOpGroupIAdd = 224, + SpvOpGroupFAdd = 225, + SpvOpGroupFMin = 226, + SpvOpGroupUMin = 227, + SpvOpGroupSMin = 228, + SpvOpGroupFMax = 229, + SpvOpGroupUMax = 230, + SpvOpGroupSMax = 231, + SpvOpGenericCastToPtrExplicit = 232, + SpvOpGenericPtrMemSemantics = 233, + SpvOpReadPipe = 234, + SpvOpWritePipe = 235, + SpvOpReservedReadPipe = 236, + SpvOpReservedWritePipe = 237, + SpvOpReserveReadPipePackets = 238, + SpvOpReserveWritePipePackets = 239, + SpvOpCommitReadPipe = 240, + SpvOpCommitWritePipe = 241, + SpvOpIsValidReserveId = 242, + SpvOpGetNumPipePackets = 243, + SpvOpGetMaxPipePackets = 244, + SpvOpGroupReserveReadPipePackets = 245, + SpvOpGroupReserveWritePipePackets = 246, + SpvOpGroupCommitReadPipe = 247, + SpvOpGroupCommitWritePipe = 248, + SpvOpEnqueueMarker = 249, + SpvOpEnqueueKernel = 250, + SpvOpGetKernelNDrangeSubGroupCount = 251, + SpvOpGetKernelNDrangeMaxSubGroupSize = 252, + SpvOpGetKernelWorkGroupSize = 253, + SpvOpGetKernelPreferredWorkGroupSizeMultiple = 254, + SpvOpRetainEvent = 255, + SpvOpReleaseEvent = 256, + SpvOpCreateUserEvent = 257, + SpvOpIsValidEvent = 258, + SpvOpSetUserEventStatus = 259, + SpvOpCaptureEventProfilingInfo = 260, + SpvOpGetDefaultQueue = 261, + SpvOpBuildNDRange = 262, + SpvOpSatConvertSToU = 263, + SpvOpSatConvertUToS = 264, + SpvOpAtomicIMin = 265, + SpvOpAtomicIMax = 266, +} SpvOp; + +#endif // #ifndef __cplusplus + +#endif // #ifndef spirv_H diff --git a/SPIRV/spvIR.h b/SPIRV/spvIR.h index 5bea5967..585af82d 100644 --- a/SPIRV/spvIR.h +++ b/SPIRV/spvIR.h @@ -60,14 +60,21 @@ namespace spv { class Function; class Module; +const Id NoResult = 0; +const Id NoType = 0; + +const unsigned int BadValue = 0xFFFFFFFF; +const Decoration NoPrecision = (Decoration)BadValue; +const MemorySemanticsMask MemorySemanticsAllMemory = (MemorySemanticsMask)0x3FF; + // // SPIR-V IR instruction. // class Instruction { public: - Instruction(Id resultId, Id typeId, OpCode opCode) : resultId(resultId), typeId(typeId), opCode(opCode), string(0) { } - explicit Instruction(OpCode opCode) : resultId(NoResult), typeId(NoType), opCode(opCode), string(0) { } + Instruction(Id resultId, Id typeId, Op opCode) : resultId(resultId), typeId(typeId), opCode(opCode), string(0) { } + explicit Instruction(Op opCode) : resultId(NoResult), typeId(NoType), opCode(opCode), string(0) { } virtual ~Instruction() { delete string; @@ -103,7 +110,7 @@ public: originalString = str; } - OpCode getOpCode() const { return opCode; } + Op getOpCode() const { return opCode; } int getNumOperands() const { return operands.size(); } Id getResultId() const { return resultId; } Id getTypeId() const { return typeId; } @@ -143,7 +150,7 @@ protected: Instruction(const Instruction&); Id resultId; Id typeId; - OpCode opCode; + Op opCode; std::vector operands; std::vector* string; // usually non-existent std::string originalString; // could be optimized away; convenience for getting string operand @@ -310,7 +317,7 @@ __inline Function::Function(Id id, Id resultType, Id functionType, Id firstParam : parent(parent), functionInstruction(id, resultType, OpFunction) { // OpFunction - functionInstruction.addImmediateOperand(FunctionControlNone); + functionInstruction.addImmediateOperand(FunctionControlMaskNone); functionInstruction.addIdOperand(functionType); parent.mapInstruction(&functionInstruction); parent.addFunction(this);