SPIRV-Tools/source/operand.cpp
Kenneth Benzie (Benie) 83e5a29b06 Code drop of the Codeplay spirv-tools source.
This commit contains the source for the SPIRV static library, spirv-as,
spirv-dis, and spirv-val tools.
2015-05-22 18:26:19 +01:00

1520 lines
43 KiB
C++

// Copyright (c) 2015 The Khronos Group Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and/or associated documentation files (the
// "Materials"), to deal in the Materials without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Materials, and to
// permit persons to whom the Materials are furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Materials.
//
// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
// KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
// SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
// https://www.khronos.org/registry/
//
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
#include "operand.h"
#include <assert.h>
#include <string.h>
static const spv_operand_desc_t sourceLanguageEntries[] = {
{"Unknown",
SourceLanguageUnknown,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"ESSL",
SourceLanguageESSL,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"GLSL",
SourceLanguageGLSL,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"OpenCL",
SourceLanguageOpenCL,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t executionModelEntries[] = {
{"Vertex",
ExecutionModelVertex,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"TessellationControl",
ExecutionModelTessellationControl,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"TessellationEvaluation",
ExecutionModelTessellationEvaluation,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"Geometry",
ExecutionModelGeometry,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry,
{SPV_OPERAND_TYPE_NONE}},
{"Fragment",
ExecutionModelFragment,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"GLCompute",
ExecutionModelGLCompute,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Kernel",
ExecutionModelKernel,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t addressingModelEntries[] = {
{"Logical",
AddressingModelLogical,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Physical32",
AddressingModelPhysical32,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityAddresses,
{SPV_OPERAND_TYPE_NONE}},
{"Physical64",
AddressingModelPhysical64,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityAddresses,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t memoryModelEntries[] = {
{"Simple",
MemoryModelSimple,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"GLSL450",
MemoryModelGLSL450,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"OpenCL1.2",
MemoryModelOpenCL12,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"OpenCL2.0",
MemoryModelOpenCL20,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"OpenCL2.1",
MemoryModelOpenCL21,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t executionModeEntries[] = {
{"Invocations",
ExecutionModeInvocations,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry,
{SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
{"SpacingEqual",
ExecutionModeSpacingEqual,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"SpacingFractionalEven",
ExecutionModeSpacingFractionalEven,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"SpacingFractionalOdd",
ExecutionModeSpacingFractionalOdd,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"VertexOrderCw",
ExecutionModeVertexOrderCw,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"VertexOrderCcw",
ExecutionModeVertexOrderCcw,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"PixelCenterInteger",
ExecutionModePixelCenterInteger,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"OriginUpperLeft",
ExecutionModeOriginUpperLeft,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"EarlyFragmentTests",
ExecutionModeEarlyFragmentTests,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"PointMode",
ExecutionModePointMode,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"Xfb",
ExecutionModeXfb,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"DepthReplacing",
ExecutionModeDepthReplacing,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"DepthAny",
ExecutionModeDepthAny,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"DepthGreater",
ExecutionModeDepthGreater,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"DepthLess",
ExecutionModeDepthLess,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"DepthUnchanged",
ExecutionModeDepthUnchanged,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"LocalSize",
ExecutionModeLocalSize,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_LITERAL_NUMBER,
SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
{"LocalSizeHint",
ExecutionModeLocalSizeHint,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_LITERAL_NUMBER,
SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
{"InputPoints",
ExecutionModeInputPoints,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry,
{SPV_OPERAND_TYPE_NONE}},
{"InputLines",
ExecutionModeInputLines,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry,
{SPV_OPERAND_TYPE_NONE}},
{"InputLinesAdjacency",
ExecutionModeInputLinesAdjacency,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry,
{SPV_OPERAND_TYPE_NONE}},
{"InputTriangles",
ExecutionModeInputTriangles,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry | CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"InputTrianglesAdjacency",
ExecutionModeInputTrianglesAdjacency,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry,
{SPV_OPERAND_TYPE_NONE}},
{"InputQuads",
ExecutionModeInputQuads,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"InputIsolines",
ExecutionModeInputIsolines,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"OutputVertices",
ExecutionModeOutputVertices,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry | CapabilityTessellation,
{SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
{"OutputPoints",
ExecutionModeOutputPoints,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry,
{SPV_OPERAND_TYPE_NONE}},
{"OutputLineStrip",
ExecutionModeOutputLineStrip,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry,
{SPV_OPERAND_TYPE_NONE}},
{"OutputTriangleStrip",
ExecutionModeOutputTriangleStrip,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry,
{SPV_OPERAND_TYPE_NONE}},
{"VecTypeHint",
ExecutionModeVecTypeHint,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_NONE}},
{"ContractionOff",
ExecutionModeContractionOff,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{
"OriginLowerLeft",
ExecutionModeOriginLowerLeft,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE},
},
};
static const spv_operand_desc_t storageClassEntries[] = {
{"UniformConstant",
StorageClassUniformConstant,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Input",
StorageClassInput,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Uniform",
StorageClassUniform,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Output",
StorageClassOutput,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"WorkgroupLocal",
StorageClassWorkgroupLocal,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"WorkgroupGlobal",
StorageClassWorkgroupGlobal,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"PrivateGlobal",
StorageClassPrivateGlobal,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Function",
StorageClassFunction,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Generic",
StorageClassGeneric,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"AtomicCounter",
StorageClassAtomicCounter,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t dimensionalityEntries[] = {
{"1D", Dim1D, SPV_OPCODE_FLAGS_NONE, 0, {SPV_OPERAND_TYPE_NONE}},
{"2D", Dim2D, SPV_OPCODE_FLAGS_NONE, 0, {SPV_OPERAND_TYPE_NONE}},
{"3D", Dim3D, SPV_OPCODE_FLAGS_NONE, 0, {SPV_OPERAND_TYPE_NONE}},
{"Cube",
DimCube,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Rect",
DimRect,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Buffer", DimBuffer, SPV_OPCODE_FLAGS_NONE, 0, {SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t samplerAddressingModeEntries[] = {
{"None",
SamplerAddressingModeNone,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"ClampToEdge",
SamplerAddressingModeClampToEdge,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"Clamp",
SamplerAddressingModeClamp,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"Repeat",
SamplerAddressingModeRepeat,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"RepeatMirrored",
SamplerAddressingModeRepeatMirrored,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t samplerFilterModeEntries[] = {
{"Nearest",
SamplerFilterModeNearest,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"Linear",
SamplerFilterModeLinear,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t fpFastMathModeEntries[] = {
{"None",
FPFastMathModeMaskNone,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"NotNaN",
FPFastMathModeNotNaNMask,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"NotInf",
FPFastMathModeNotInfMask,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"NSZ",
FPFastMathModeNSZMask,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"AllowRecip",
FPFastMathModeAllowRecipMask,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"Fast",
FPFastMathModeFastMask,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t fpRoundingModeEntries[] = {
{"RTE",
FPRoundingModeRTE,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"RTZ",
FPRoundingModeRTZ,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"RTP",
FPRoundingModeRTP,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"RTN",
FPRoundingModeRTN,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t linkageTypeEntries[] = {
{"Export",
LinkageTypeExport,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityLinkage,
{SPV_OPERAND_TYPE_NONE}},
{"Import",
LinkageTypeImport,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityLinkage,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t accessQualifierEntries[] = {
{"ReadOnly",
AccessQualifierReadOnly,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"WriteOnly",
AccessQualifierWriteOnly,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"ReadWrite",
AccessQualifierReadWrite,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t functionParameterAttributeEntries[] = {
{"Zext",
FunctionParameterAttributeZext,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"Sext",
FunctionParameterAttributeSext,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"ByVal",
FunctionParameterAttributeByVal,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"Sret",
FunctionParameterAttributeSret,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"NoAlias",
FunctionParameterAttributeNoAlias,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"NoCapabilityture",
FunctionParameterAttributeNoCapture,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"SVM",
FunctionParameterAttributeSVM,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"NoWrite",
FunctionParameterAttributeNoWrite,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"NoReadWrite",
FunctionParameterAttributeNoReadWrite,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t decorationEntries[] = {
{"PrecisionLow",
DecorationPrecisionLow,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"PrecisionMedium",
DecorationPrecisionMedium,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"PrecisionHigh",
DecorationPrecisionHigh,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Block",
DecorationBlock,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"BufferBlock",
DecorationBufferBlock,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"RowMajor",
DecorationRowMajor,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityMatrix,
{SPV_OPERAND_TYPE_NONE}},
{"ColMajor",
DecorationColMajor,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityMatrix,
{SPV_OPERAND_TYPE_NONE}},
{"GLSLShared",
DecorationGLSLShared,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"GLSLStd140",
DecorationGLSLStd140,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"GLSLStd430",
DecorationGLSLStd430,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"GLSLPacked",
DecorationGLSLPacked,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Smooth",
DecorationSmooth,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Noperspective",
DecorationNoperspective,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Flat",
DecorationFlat,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Patch",
DecorationPatch,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"Centroid",
DecorationCentroid,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Sample",
DecorationSample,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Invariant",
DecorationInvariant,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Restrict",
DecorationRestrict,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Aliased",
DecorationAliased,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Volatile",
DecorationVolatile,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Constant",
DecorationConstant,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"Coherent",
DecorationCoherent,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Nonwritable",
DecorationNonwritable,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Nonreadable",
DecorationNonreadable,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Uniform",
DecorationUniform,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"NoStaticUse",
DecorationNoStaticUse,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"CPacked",
DecorationCPacked,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"FPSaturatedConversion",
DecorationSaturatedConversion,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"Stream",
DecorationStream,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry,
{SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
{"Location",
DecorationLocation,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
{"Component",
DecorationComponent,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
{"Index",
DecorationIndex,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
{"Binding",
DecorationBinding,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
{"DescriptorSet",
DecorationDescriptorSet,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
{"Offset",
DecorationOffset,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
{"Alignment",
DecorationAlignment,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
{"XfbBuffer",
DecorationXfbBuffer,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
{"Stride",
DecorationStride,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
{"BuiltIn",
DecorationBuiltIn,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_BUILT_IN, SPV_OPERAND_TYPE_NONE}},
{"FuncParamAttr",
DecorationFuncParamAttr,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE, SPV_OPERAND_TYPE_NONE}},
{"FPRoundingMode",
DecorationFPRoundingMode,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_FP_ROUNDING_MODE, SPV_OPERAND_TYPE_NONE}},
{"FPFastMathMode",
DecorationFPRoundingMode,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, SPV_OPERAND_TYPE_NONE}},
{"LinkageAttributes",
DecorationLinkageAttributes,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityLinkage,
{SPV_OPERAND_TYPE_LINKAGE_TYPE, SPV_OPERAND_TYPE_NONE}},
{
"SpecId",
DecorationSpecId,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_LITERAL_NUMBER},
},
};
static const spv_operand_desc_t builtInEntries[] = {
{"Position",
BuiltInPosition,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"PointSize",
BuiltInPointSize,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"ClipVertex",
BuiltInClipVertex,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"ClipDistance",
BuiltInClipDistance,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"CullDistance",
BuiltInCullDistance,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"VertexId",
BuiltInVertexId,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"InstanceId",
BuiltInInstanceId,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"PrimitiveId",
BuiltInPrimitiveId,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry | CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"InvocationId",
BuiltInInvocationId,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry | CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"Layer",
BuiltInLayer,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry,
{SPV_OPERAND_TYPE_NONE}},
{"ViewportIndex",
BuiltInViewportIndex,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityGeometry,
{SPV_OPERAND_TYPE_NONE}},
{"TessLevelOuter",
BuiltInTessLevelOuter,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"TessLevelInner",
BuiltInTessLevelInner,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"TessCoord",
BuiltInTessCoord,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"PatchVertices",
BuiltInPatchVertices,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityTessellation,
{SPV_OPERAND_TYPE_NONE}},
{"FragCoord",
BuiltInFragCoord,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"PointCoord",
BuiltInPointCoord,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"FrontFacing",
BuiltInFrontFacing,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"SampleId",
BuiltInSampleId,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"SamplePosition",
BuiltInSamplePosition,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"SampleMask",
BuiltInSampleMask,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"FragColor",
BuiltInFragColor,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"FragDepth",
BuiltInFragDepth,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"HelperInvocation",
BuiltInHelperInvocation,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"NumWorkgroups",
BuiltInNumWorkgroups,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"WorkgroupSize",
BuiltInWorkgroupSize,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"WorkgroupId",
BuiltInWorkgroupId,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"LocalInvocationId",
BuiltInLocalInvocationId,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"GlobalInvocationId",
BuiltInGlobalInvocationId,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"LocalInvocationIndex",
BuiltInLocalInvocationId,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"WorkDim",
BuiltInWorkDim,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"GlobalSize",
BuiltInGlobalSize,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"EnqueuedWorkgroupSize",
BuiltInEnqueuedWorkgroupSize,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"GlobalOffset",
BuiltInGlobalOffset,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"GlobalLinearId",
BuiltInGlobalLinearId,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"WorkgroupLinearId",
BuiltInWorkgroupLinearId,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"SubgroupSize",
BuiltInSubgroupSize,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"SubgroupMaxSize",
BuiltInSubgroupMaxSize,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"NumSubgroups",
BuiltInNumSubgroups,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"NumEnqueuedSubgroups",
BuiltInNumEnqueuedSubgroups,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"SubgroupId",
BuiltInSampleId,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"SubgroupLocalInvocationId",
BuiltInSubgroupLocalInvocationId,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t selectionControlEntries[] = {
{"None",
SelectionControlMaskNone,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Flatten",
SelectionControlFlattenMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"DontFlatten",
SelectionControlDontFlattenMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t loopControlEntries[] = {
{"None",
LoopControlMaskNone,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Unroll",
LoopControlUnrollMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"DontUnroll",
LoopControlDontUnrollMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t functionControlEntries[] = {
{"None",
FunctionControlMaskNone,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"InLine",
FunctionControlInlineMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"DontInline",
FunctionControlDontInlineMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Pure",
FunctionControlPureMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Const",
FunctionControlConstMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t memorySemanticsEntries[] = {
{"None",
MemorySemanticsMaskNone,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Relaxed",
MemorySemanticsRelaxedMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"SequentiallyConsistent",
MemorySemanticsSequentiallyConsistentMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Acquire",
MemorySemanticsAcquireMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Release",
MemorySemanticsReleaseMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"UniformMemory",
MemorySemanticsUniformMemoryMask,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"SubgroupMemory",
MemorySemanticsSubgroupMemoryMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"WorkgroupLocalMemory",
MemorySemanticsWorkgroupLocalMemoryMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"WorkgroupGlobalMemory",
MemorySemanticsWorkgroupGlobalMemoryMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"AtomicCounterMemory",
MemorySemanticsAtomicCounterMemoryMask,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{
"ImageMemory",
MemorySemanticsImageMemoryMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE},
},
};
static const spv_operand_desc_t memoryAccessEntries[] = {
{"None",
MemoryAccessMaskNone,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Volatile",
MemoryAccessVolatileMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{
"Aligned",
MemoryAccessAlignedMask,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE},
},
};
static const spv_operand_desc_t scopeEntries[] = {
{"CrossDevice",
ScopeCrossDevice,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Device", ScopeDevice, SPV_OPCODE_FLAGS_NONE, 0, {SPV_OPERAND_TYPE_NONE}},
{"Workgroup",
ScopeWorkgroup,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Subgroup",
ScopeSubgroup,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{
"Invocation",
ScopeInvocation,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE},
},
};
static const spv_operand_desc_t groupOperationEntries[] = {
{"Reduce",
GroupOperationReduce,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"InclusiveScan",
GroupOperationInclusiveScan,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"ExclusiveScan",
GroupOperationExclusiveScan,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t kernelKernelEnqueueFlagssEntries[] = {
{"NoWait",
KernelEnqueueFlagsNoWait,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"WaitKernel",
KernelEnqueueFlagsWaitKernel,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
{"WaitWorkGroup",
KernelEnqueueFlagsWaitWorkGroup,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t kernelProfilingInfoEntries[] = {
{"None",
KernelProfilingInfoMaskNone,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"CmdExecTime",
KernelProfilingInfoCmdExecTimeMask,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityKernel,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_t capabilityInfoEntries[] = {
{"Matrix",
CapabilityMatrix,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Shader",
CapabilityShader,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityMatrix,
{SPV_OPERAND_TYPE_NONE}},
{"Geometry",
CapabilityGeometry,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Tessellation",
CapabilityTessellation,
SPV_OPCODE_FLAGS_CAPABILITIES,
CapabilityShader,
{SPV_OPERAND_TYPE_NONE}},
{"Addresses",
CapabilityAddresses,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Linkage",
CapabilityLinkage,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Kernel",
CapabilityKernel,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Vector16",
CapabilityVector16,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Float16Buffer",
CapabilityFloat16Buffer,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Float16",
CapabilityFloat16,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Float64",
CapabilityFloat64,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Int64",
CapabilityInt64,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Int64Atomics",
CapabilityInt64Atomics,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"ImageBasic",
CapabilityImageBasic,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"ImageReadWrite",
CapabilityImageReadWrite,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"ImageSRGBWrite",
CapabilityImageSRGBWrite,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Pipes",
CapabilityPipes,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"Groups",
CapabilityGroups,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
{"DeviceEnqueue",
CapabilityDeviceEnqueue,
SPV_OPCODE_FLAGS_NONE,
0,
{SPV_OPERAND_TYPE_NONE}},
};
static const spv_operand_desc_group_t opcodeEntryTypes[] = {
{SPV_OPERAND_TYPE_SOURCE_LANGUAGE,
sizeof(sourceLanguageEntries) / sizeof(spv_operand_desc_t),
sourceLanguageEntries},
{SPV_OPERAND_TYPE_EXECUTION_MODEL,
sizeof(executionModelEntries) / sizeof(spv_operand_desc_t),
executionModelEntries},
{SPV_OPERAND_TYPE_ADDRESSING_MODEL,
sizeof(addressingModelEntries) / sizeof(spv_operand_desc_t),
addressingModelEntries},
{SPV_OPERAND_TYPE_MEMORY_MODEL,
sizeof(memoryModelEntries) / sizeof(spv_operand_desc_t),
memoryModelEntries},
{SPV_OPERAND_TYPE_EXECUTION_MODE,
sizeof(executionModeEntries) / sizeof(spv_operand_desc_t),
executionModeEntries},
{SPV_OPERAND_TYPE_STORAGE_CLASS,
sizeof(storageClassEntries) / sizeof(spv_operand_desc_t),
storageClassEntries},
{SPV_OPERAND_TYPE_DIMENSIONALITY,
sizeof(dimensionalityEntries) / sizeof(spv_operand_desc_t),
dimensionalityEntries},
{SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE,
sizeof(samplerAddressingModeEntries) / sizeof(spv_operand_desc_t),
samplerAddressingModeEntries},
{SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE,
sizeof(samplerFilterModeEntries) / sizeof(spv_operand_desc_t),
samplerFilterModeEntries},
{SPV_OPERAND_TYPE_FP_FAST_MATH_MODE,
sizeof(fpFastMathModeEntries) / sizeof(spv_operand_desc_t),
fpFastMathModeEntries},
{SPV_OPERAND_TYPE_FP_ROUNDING_MODE,
sizeof(fpRoundingModeEntries) / sizeof(spv_operand_desc_t),
fpRoundingModeEntries},
{SPV_OPERAND_TYPE_LINKAGE_TYPE,
sizeof(linkageTypeEntries) / sizeof(spv_operand_desc_t),
linkageTypeEntries},
{SPV_OPERAND_TYPE_ACCESS_QUALIFIER,
sizeof(accessQualifierEntries) / sizeof(spv_operand_desc_t),
accessQualifierEntries},
{SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE,
sizeof(functionParameterAttributeEntries) / sizeof(spv_operand_desc_t),
functionParameterAttributeEntries},
{SPV_OPERAND_TYPE_DECORATION,
sizeof(decorationEntries) / sizeof(spv_operand_desc_t), decorationEntries},
{SPV_OPERAND_TYPE_BUILT_IN,
sizeof(builtInEntries) / sizeof(spv_operand_desc_t), builtInEntries},
{SPV_OPERAND_TYPE_SELECTION_CONTROL,
sizeof(selectionControlEntries) / sizeof(spv_operand_desc_t),
selectionControlEntries},
{SPV_OPERAND_TYPE_LOOP_CONTROL,
sizeof(loopControlEntries) / sizeof(spv_operand_desc_t),
loopControlEntries},
{SPV_OPERAND_TYPE_FUNCTION_CONTROL,
sizeof(functionControlEntries) / sizeof(spv_operand_desc_t),
functionControlEntries},
{SPV_OPERAND_TYPE_MEMORY_SEMANTICS,
sizeof(memorySemanticsEntries) / sizeof(spv_operand_desc_t),
memorySemanticsEntries},
{SPV_OPERAND_TYPE_MEMORY_ACCESS,
sizeof(memoryAccessEntries) / sizeof(spv_operand_desc_t),
memoryAccessEntries},
{SPV_OPERAND_TYPE_EXECUTION_SCOPE,
sizeof(scopeEntries) / sizeof(spv_operand_desc_t), scopeEntries},
{SPV_OPERAND_TYPE_GROUP_OPERATION,
sizeof(groupOperationEntries) / sizeof(spv_operand_desc_t),
groupOperationEntries},
{SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS,
sizeof(kernelKernelEnqueueFlagssEntries) / sizeof(spv_operand_desc_t),
kernelKernelEnqueueFlagssEntries},
{SPV_OPERAND_TYPE_KERENL_PROFILING_INFO,
sizeof(kernelProfilingInfoEntries) / sizeof(spv_operand_desc_t),
kernelProfilingInfoEntries},
{SPV_OPERAND_TYPE_CAPABILITY,
sizeof(capabilityInfoEntries) / sizeof(spv_operand_desc_t),
capabilityInfoEntries},
};
spv_result_t spvOperandTableGet(spv_operand_table *pOperandTable) {
spvCheck(!pOperandTable, return SPV_ERROR_INVALID_POINTER);
static const spv_operand_table_t table = {
sizeof(opcodeEntryTypes) / sizeof(spv_operand_desc_group_t),
opcodeEntryTypes};
*pOperandTable = &table;
return SPV_SUCCESS;
}
spv_result_t spvOperandTableNameLookup(const spv_operand_table table,
const spv_operand_type_t type,
const char *name,
spv_operand_desc *pEntry) {
spvCheck(!table, return SPV_ERROR_INVALID_TABLE);
spvCheck(!name || !pEntry, return SPV_ERROR_INVALID_POINTER);
const uint64_t nameLength = strlen(name);
for (uint64_t typeIndex = 0; typeIndex < table->count; ++typeIndex) {
if (type == table->types[typeIndex].type) {
for (uint64_t operandIndex = 0;
operandIndex < table->types[typeIndex].count; ++operandIndex) {
if (nameLength ==
strlen(table->types[typeIndex].entries[operandIndex].name) &&
!strncmp(table->types[typeIndex].entries[operandIndex].name, name,
strlen(name))) {
*pEntry = &table->types[typeIndex].entries[operandIndex];
return SPV_SUCCESS;
}
}
}
}
return SPV_ERROR_INVALID_LOOKUP;
}
spv_result_t spvOperandTableValueLookup(const spv_operand_table table,
const spv_operand_type_t type,
const uint32_t value,
spv_operand_desc *pEntry) {
spvCheck(!table, return SPV_ERROR_INVALID_TABLE);
spvCheck(!pEntry, return SPV_ERROR_INVALID_POINTER);
for (uint64_t typeIndex = 0; typeIndex < table->count; ++typeIndex) {
if (type == table->types[typeIndex].type) {
for (uint64_t operandIndex = 0;
operandIndex < table->types[typeIndex].count; ++operandIndex) {
if (value == table->types[typeIndex].entries[operandIndex].value) {
*pEntry = &table->types[typeIndex].entries[operandIndex];
return SPV_SUCCESS;
}
}
}
}
return SPV_ERROR_INVALID_LOOKUP;
}
const char *spvOperandTypeStr(spv_operand_type_t type) {
switch (type) {
case SPV_OPERAND_TYPE_ID:
return "id";
case SPV_OPERAND_TYPE_RESULT_ID:
return "result ID";
case SPV_OPERAND_TYPE_LITERAL:
return "literal";
case SPV_OPERAND_TYPE_LITERAL_NUMBER:
return "literal number";
case SPV_OPERAND_TYPE_LITERAL_STRING:
return "literal string";
case SPV_OPERAND_TYPE_SOURCE_LANGUAGE:
return "source langauge";
case SPV_OPERAND_TYPE_EXECUTION_MODEL:
return "execution model";
case SPV_OPERAND_TYPE_ADDRESSING_MODEL:
return "addressing model";
case SPV_OPERAND_TYPE_MEMORY_MODEL:
return "memory model";
case SPV_OPERAND_TYPE_EXECUTION_MODE:
return "execution mode";
case SPV_OPERAND_TYPE_STORAGE_CLASS:
return "storage class";
case SPV_OPERAND_TYPE_DIMENSIONALITY:
return "dimensionality";
case SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE:
return "addressing mode";
case SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE:
return "sampler filter mode";
case SPV_OPERAND_TYPE_FP_FAST_MATH_MODE:
return "floating pointer fast math mode";
case SPV_OPERAND_TYPE_FP_ROUNDING_MODE:
return "floating point rounding mode";
case SPV_OPERAND_TYPE_LINKAGE_TYPE:
return "linkage type";
case SPV_OPERAND_TYPE_ACCESS_QUALIFIER:
return "access qualifier";
case SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE:
return "function parameter attribute";
case SPV_OPERAND_TYPE_DECORATION:
return "decoration";
case SPV_OPERAND_TYPE_BUILT_IN:
return "built in";
case SPV_OPERAND_TYPE_SELECTION_CONTROL:
return "selection control";
case SPV_OPERAND_TYPE_LOOP_CONTROL:
return "loop control";
case SPV_OPERAND_TYPE_FUNCTION_CONTROL:
return "function control";
case SPV_OPERAND_TYPE_MEMORY_SEMANTICS:
return "memory semantics";
case SPV_OPERAND_TYPE_MEMORY_ACCESS:
return "memory access";
case SPV_OPERAND_TYPE_EXECUTION_SCOPE:
return "execution scope";
case SPV_OPERAND_TYPE_GROUP_OPERATION:
return "group operation";
case SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS:
return "kernel enqeue flags";
case SPV_OPERAND_TYPE_KERENL_PROFILING_INFO:
return "kernel profiling info";
case SPV_OPERAND_TYPE_CAPABILITY:
return "capability";
default:
assert(0 && "Unhandled operand type!");
break;
}
return "unknown";
}