From 205408bae4f22c301ca9ce41bfd60c499583dd10 Mon Sep 17 00:00:00 2001 From: Dejan Mircevski Date: Wed, 30 Sep 2015 16:42:34 -0400 Subject: [PATCH] Make capabilities a bitfield in opcode/operand tables. --- source/opcode.cpp | 17 ++- source/operand.cpp | 304 +++++++++++++++++++++++++++-------------------------- 2 files changed, 159 insertions(+), 162 deletions(-) diff --git a/source/opcode.cpp b/source/opcode.cpp index b3532cb..3344a98 100644 --- a/source/opcode.cpp +++ b/source/opcode.cpp @@ -45,20 +45,14 @@ namespace { spv_opcode_desc_t opcodeTableEntries[] = { #define EmptyList {} #define List(...) {__VA_ARGS__} -#define Capability(X) Capability##X -#define CapabilityNone -1 -// TODO(dneto): Some things can be enabled by one of two different capabilities. -// The capabilities field in spv_operand_desc_t can't handle that yet. -// Maybe have to make it a 64-bit mask. Currently there are 54 distinct -// capabilities. -// For now, just select the first one. This must be fixed for the validator -// to work. -#define Capability2(X,Y) Capability##X +#define Capability(X) SPV_CAPABILITY_AS_MASK(Capability##X) +#define Capability2(X,Y) Capability(X)|Capability(Y) +#define CapabilityNone 0 // Needed so Capability(None) still expands to valid syntax. #define Instruction(Name,HasResult,HasType,NumLogicalOperands,NumCapabilities,CapabilityRequired,IsVariable,LogicalArgsList) \ { #Name, \ Op##Name, \ - ((CapabilityRequired != CapabilityNone ? SPV_OPCODE_FLAGS_CAPABILITIES : 0)), \ - uint32_t(CapabilityRequired), \ + (NumCapabilities) ? SPV_OPCODE_FLAGS_CAPABILITIES : 0, \ + (NumCapabilities) ? (CapabilityRequired) : 0, \ 0, {}, /* Filled in later. Operand list, including result id and type id, if needed */ \ HasResult, \ HasType, \ @@ -67,6 +61,7 @@ spv_opcode_desc_t opcodeTableEntries[] = { #undef EmptyList #undef List #undef Capability +#undef Capability2 #undef CapabilityNone #undef Instruction }; diff --git a/source/operand.cpp b/source/operand.cpp index 27bd545..e53c48f 100644 --- a/source/operand.cpp +++ b/source/operand.cpp @@ -56,37 +56,37 @@ static const spv_operand_desc_t executionModelEntries[] = { {"Vertex", ExecutionModelVertex, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"TessellationControl", ExecutionModelTessellationControl, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityTessellation, + SPV_CAPABILITY_AS_MASK(CapabilityTessellation), {SPV_OPERAND_TYPE_NONE}}, {"TessellationEvaluation", ExecutionModelTessellationEvaluation, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityTessellation, + SPV_CAPABILITY_AS_MASK(CapabilityTessellation), {SPV_OPERAND_TYPE_NONE}}, {"Geometry", ExecutionModelGeometry, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityGeometry, + SPV_CAPABILITY_AS_MASK(CapabilityGeometry), {SPV_OPERAND_TYPE_NONE}}, {"Fragment", ExecutionModelFragment, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"GLCompute", ExecutionModelGLCompute, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"Kernel", ExecutionModelKernel, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, }; @@ -99,12 +99,12 @@ static const spv_operand_desc_t addressingModelEntries[] = { {"Physical32", AddressingModelPhysical32, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityAddresses, + SPV_CAPABILITY_AS_MASK(CapabilityAddresses), {SPV_OPERAND_TYPE_NONE}}, {"Physical64", AddressingModelPhysical64, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityAddresses, + SPV_CAPABILITY_AS_MASK(CapabilityAddresses), {SPV_OPERAND_TYPE_NONE}}, }; @@ -112,17 +112,17 @@ static const spv_operand_desc_t memoryModelEntries[] = { {"Simple", MemoryModelSimple, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"GLSL450", MemoryModelGLSL450, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"OpenCL", MemoryModelOpenCL, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, }; @@ -165,7 +165,7 @@ static const spv_operand_desc_t executionModeEntries[] = { {"LocalSizeHint", ExecutionModeLocalSizeHint, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}}, {ExecMode0(InputPoints, Geometry)}, @@ -174,9 +174,8 @@ static const spv_operand_desc_t executionModeEntries[] = { {"InputTriangles", ExecutionModeInputTriangles, SPV_OPCODE_FLAGS_CAPABILITIES, - // TODO(dneto): Capabilities are defined as sequential numbers instead of - // bit masks. They cannot be meaningfully combined with a bitwise OR. - CapabilityGeometry | CapabilityTessellation, + SPV_CAPABILITY_AS_MASK(CapabilityGeometry) | + SPV_CAPABILITY_AS_MASK(CapabilityTessellation), {SPV_OPERAND_TYPE_NONE}}, {ExecMode0(InputTrianglesAdjacency, Geometry)}, {ExecMode0(InputQuads, Tessellation)}, @@ -184,9 +183,8 @@ static const spv_operand_desc_t executionModeEntries[] = { {"OutputVertices", ExecutionModeOutputVertices, SPV_OPCODE_FLAGS_CAPABILITIES, - // TODO(dneto): Capabilities are defined as sequential numbers instead of - // bit masks. They cannot be meaningfully combined with a bitwise OR. - CapabilityGeometry | CapabilityTessellation, + SPV_CAPABILITY_AS_MASK(CapabilityGeometry) | + SPV_CAPABILITY_AS_MASK(CapabilityTessellation), {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}}, {ExecMode0(OutputPoints, Geometry)}, {ExecMode0(OutputLineStrip, Geometry)}, @@ -208,17 +206,17 @@ static const spv_operand_desc_t storageClassEntries[] = { {"Input", StorageClassInput, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"Uniform", StorageClassUniform, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"Output", StorageClassOutput, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"WorkgroupLocal", StorageClassWorkgroupLocal, @@ -233,7 +231,7 @@ static const spv_operand_desc_t storageClassEntries[] = { {"PrivateGlobal", StorageClassPrivateGlobal, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"Function", StorageClassFunction, @@ -243,17 +241,17 @@ static const spv_operand_desc_t storageClassEntries[] = { {"Generic", StorageClassGeneric, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"PushConstant", StorageClassPushConstant, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"AtomicCounter", StorageClassAtomicCounter, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"Image", StorageClassImage, @@ -270,18 +268,18 @@ static const spv_operand_desc_t dimensionalityEntries[] = { {"Cube", DimCube, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"Rect", DimRect, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"Buffer", DimBuffer, SPV_OPCODE_FLAGS_NONE, 0, {SPV_OPERAND_TYPE_NONE}}, {"InputTarget", DimInputTarget, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityInputTarget, + SPV_CAPABILITY_AS_MASK(CapabilityInputTarget), {SPV_OPERAND_TYPE_NONE}}, }; @@ -289,27 +287,27 @@ static const spv_operand_desc_t samplerAddressingModeEntries[] = { {"None", SamplerAddressingModeNone, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"ClampToEdge", SamplerAddressingModeClampToEdge, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"Clamp", SamplerAddressingModeClamp, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"Repeat", SamplerAddressingModeRepeat, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"RepeatMirrored", SamplerAddressingModeRepeatMirrored, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, }; @@ -317,12 +315,12 @@ static const spv_operand_desc_t samplerFilterModeEntries[] = { {"Nearest", SamplerFilterModeNearest, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"Linear", SamplerFilterModeLinear, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, }; @@ -330,12 +328,12 @@ static const spv_operand_desc_t samplerImageFormatEntries[] = { // In Rev31, all the cases depend on the Shader capability. // TODO(dneto): In Rev32, many of these depend on the AdvancedFormats // capability instead. -#define CASE(NAME) \ - { \ - #NAME, ImageFormat##NAME, SPV_OPCODE_FLAGS_CAPABILITIES, CapabilityShader, \ - { \ - SPV_OPERAND_TYPE_NONE \ - } \ +#define CASE(NAME) \ + { \ + #NAME, ImageFormat##NAME, SPV_OPCODE_FLAGS_CAPABILITIES, \ + SPV_CAPABILITY_AS_MASK(CapabilityShader), { \ + SPV_OPERAND_TYPE_NONE \ + } \ } // clang-format off CASE(Unknown), @@ -394,14 +392,15 @@ static const spv_operand_desc_t imageOperandEntries[] = { #define ID SPV_OPERAND_TYPE_ID #define NONE SPV_OPERAND_TYPE_NONE {"None", spv::ImageOperandsMaskNone, SPV_OPCODE_FLAGS_NONE, 0, {NONE}}, - {CASE_CAP(Bias, CapabilityShader), {ID, NONE}}, + {CASE_CAP(Bias, SPV_CAPABILITY_AS_MASK(CapabilityShader)), {ID, NONE}}, {CASE(Lod), {ID, NONE}}, {CASE(Grad), {ID, ID, NONE}}, {CASE(ConstOffset), {ID, NONE}}, - {CASE_CAP(Offset, CapabilityImageGatherExtended), {ID, NONE}}, + {CASE_CAP(Offset, SPV_CAPABILITY_AS_MASK(CapabilityImageGatherExtended)), + {ID, NONE}}, {CASE(ConstOffsets), {ID, NONE}}, {CASE(Sample), {ID, NONE}}, - {CASE_CAP(MinLod, CapabilityMinLod), {ID, NONE}}, + {CASE_CAP(MinLod, SPV_CAPABILITY_AS_MASK(CapabilityMinLod)), {ID, NONE}}, #undef CASE #undef CASE_CAP #undef ID @@ -417,27 +416,27 @@ static const spv_operand_desc_t fpFastMathModeEntries[] = { {"NotNaN", FPFastMathModeNotNaNMask, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"NotInf", FPFastMathModeNotInfMask, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"NSZ", FPFastMathModeNSZMask, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"AllowRecip", FPFastMathModeAllowRecipMask, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"Fast", FPFastMathModeFastMask, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, }; @@ -445,22 +444,22 @@ static const spv_operand_desc_t fpRoundingModeEntries[] = { {"RTE", FPRoundingModeRTE, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"RTZ", FPRoundingModeRTZ, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"RTP", FPRoundingModeRTP, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"RTN", FPRoundingModeRTN, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, }; @@ -468,12 +467,12 @@ static const spv_operand_desc_t linkageTypeEntries[] = { {"Export", LinkageTypeExport, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityLinkage, + SPV_CAPABILITY_AS_MASK(CapabilityLinkage), {SPV_OPERAND_TYPE_NONE}}, {"Import", LinkageTypeImport, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityLinkage, + SPV_CAPABILITY_AS_MASK(CapabilityLinkage), {SPV_OPERAND_TYPE_NONE}}, }; @@ -481,17 +480,17 @@ static const spv_operand_desc_t accessQualifierEntries[] = { {"ReadOnly", AccessQualifierReadOnly, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"WriteOnly", AccessQualifierWriteOnly, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"ReadWrite", AccessQualifierReadWrite, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, }; @@ -499,42 +498,42 @@ static const spv_operand_desc_t functionParameterAttributeEntries[] = { {"Zext", FunctionParameterAttributeZext, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"Sext", FunctionParameterAttributeSext, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"ByVal", FunctionParameterAttributeByVal, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"Sret", FunctionParameterAttributeSret, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"NoAlias", FunctionParameterAttributeNoAlias, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"NoCapture", FunctionParameterAttributeNoCapture, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"NoWrite", FunctionParameterAttributeNoWrite, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"NoReadWrite", FunctionParameterAttributeNoReadWrite, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, }; @@ -542,99 +541,99 @@ static const spv_operand_desc_t decorationEntries[] = { {"RelaxedPrecision", DecorationRelaxedPrecision, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, { "SpecId", DecorationSpecId, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_LITERAL_NUMBER}, }, {"Block", DecorationBlock, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"BufferBlock", DecorationBufferBlock, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"RowMajor", DecorationRowMajor, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityMatrix, + SPV_CAPABILITY_AS_MASK(CapabilityMatrix), {SPV_OPERAND_TYPE_NONE}}, {"ColMajor", DecorationColMajor, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityMatrix, + SPV_CAPABILITY_AS_MASK(CapabilityMatrix), {SPV_OPERAND_TYPE_NONE}}, {"ArrayStride", DecorationArrayStride, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}}, {"MatrixStride", DecorationMatrixStride, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}}, {"GLSLShared", DecorationGLSLShared, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"GLSLPacked", DecorationGLSLPacked, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"CPacked", DecorationCPacked, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"BuiltIn", DecorationBuiltIn, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_BUILT_IN, SPV_OPERAND_TYPE_NONE}}, {"Smooth", DecorationSmooth, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"NoPerspective", DecorationNoPerspective, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"Flat", DecorationFlat, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"Patch", DecorationPatch, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityTessellation, + SPV_CAPABILITY_AS_MASK(CapabilityTessellation), {SPV_OPERAND_TYPE_NONE}}, {"Centroid", DecorationCentroid, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"Sample", DecorationSample, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"Invariant", DecorationInvariant, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"Restrict", DecorationRestrict, @@ -654,7 +653,7 @@ static const spv_operand_desc_t decorationEntries[] = { {"Constant", DecorationConstant, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"Coherent", DecorationCoherent, @@ -674,42 +673,42 @@ static const spv_operand_desc_t decorationEntries[] = { {"Uniform", DecorationUniform, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"SaturatedConversion", DecorationSaturatedConversion, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"Stream", DecorationStream, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityGeometry, + SPV_CAPABILITY_AS_MASK(CapabilityGeometry), {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}}, {"Location", DecorationLocation, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}}, {"Component", DecorationComponent, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}}, {"Index", DecorationIndex, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}}, {"Binding", DecorationBinding, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}}, {"DescriptorSet", DecorationDescriptorSet, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}}, {"Offset", DecorationOffset, @@ -719,49 +718,50 @@ static const spv_operand_desc_t decorationEntries[] = { {"XfbBuffer", DecorationXfbBuffer, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}}, {"XfbStride", DecorationXfbStride, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}}, {"FuncParamAttr", DecorationFuncParamAttr, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE, SPV_OPERAND_TYPE_NONE}}, {"FPRoundingMode", DecorationFPRoundingMode, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_FP_ROUNDING_MODE, SPV_OPERAND_TYPE_NONE}}, {"FPFastMathMode", DecorationFPFastMathMode, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, SPV_OPERAND_TYPE_NONE}}, {"LinkageAttributes", DecorationLinkageAttributes, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityLinkage, + SPV_CAPABILITY_AS_MASK(CapabilityLinkage), {SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_LINKAGE_TYPE, SPV_OPERAND_TYPE_NONE}}, {"NoContraction", DecorationNoContraction, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"InputTargetIndex", DecorationInputTargetIndex, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, // TODO(dneto): Should this be CapabilityInputTarget? + SPV_CAPABILITY_AS_MASK(CapabilityShader), // TODO(dneto): Should this be + // CapabilityInputTarget? {SPV_OPERAND_TYPE_NONE}}, // TODO(dneto): Should this have a literal // number argument? {"Alignment", DecorationAlignment, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}}, }; @@ -769,117 +769,119 @@ static const spv_operand_desc_t builtInEntries[] = { {"Position", BuiltInPosition, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"PointSize", BuiltInPointSize, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"ClipDistance", BuiltInClipDistance, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"CullDistance", BuiltInCullDistance, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"VertexId", BuiltInVertexId, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"InstanceId", BuiltInInstanceId, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"PrimitiveId", BuiltInPrimitiveId, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityGeometry | CapabilityTessellation, + SPV_CAPABILITY_AS_MASK(CapabilityGeometry) | + SPV_CAPABILITY_AS_MASK(CapabilityTessellation), {SPV_OPERAND_TYPE_NONE}}, {"InvocationId", BuiltInInvocationId, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityGeometry | CapabilityTessellation, + SPV_CAPABILITY_AS_MASK(CapabilityGeometry) | + SPV_CAPABILITY_AS_MASK(CapabilityTessellation), {SPV_OPERAND_TYPE_NONE}}, {"Layer", BuiltInLayer, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityGeometry, + SPV_CAPABILITY_AS_MASK(CapabilityGeometry), {SPV_OPERAND_TYPE_NONE}}, {"ViewportIndex", BuiltInViewportIndex, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityGeometry, + SPV_CAPABILITY_AS_MASK(CapabilityGeometry), {SPV_OPERAND_TYPE_NONE}}, {"TessLevelOuter", BuiltInTessLevelOuter, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityTessellation, + SPV_CAPABILITY_AS_MASK(CapabilityTessellation), {SPV_OPERAND_TYPE_NONE}}, {"TessLevelInner", BuiltInTessLevelInner, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityTessellation, + SPV_CAPABILITY_AS_MASK(CapabilityTessellation), {SPV_OPERAND_TYPE_NONE}}, {"TessCoord", BuiltInTessCoord, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityTessellation, + SPV_CAPABILITY_AS_MASK(CapabilityTessellation), {SPV_OPERAND_TYPE_NONE}}, {"PatchVertices", BuiltInPatchVertices, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityTessellation, + SPV_CAPABILITY_AS_MASK(CapabilityTessellation), {SPV_OPERAND_TYPE_NONE}}, {"FragCoord", BuiltInFragCoord, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"PointCoord", BuiltInPointCoord, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"FrontFacing", BuiltInFrontFacing, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"SampleId", BuiltInSampleId, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"SamplePosition", BuiltInSamplePosition, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"SampleMask", BuiltInSampleMask, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"FragColor", BuiltInFragColor, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"FragDepth", BuiltInFragDepth, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"HelperInvocation", BuiltInHelperInvocation, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"NumWorkgroups", BuiltInNumWorkgroups, @@ -909,77 +911,77 @@ static const spv_operand_desc_t builtInEntries[] = { {"LocalInvocationIndex", BuiltInLocalInvocationIndex, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"WorkDim", BuiltInWorkDim, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"GlobalSize", BuiltInGlobalSize, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"EnqueuedWorkgroupSize", BuiltInEnqueuedWorkgroupSize, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"GlobalOffset", BuiltInGlobalOffset, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"GlobalLinearId", BuiltInGlobalLinearId, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"WorkgroupLinearId", BuiltInWorkgroupLinearId, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"SubgroupSize", BuiltInSubgroupSize, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"SubgroupMaxSize", BuiltInSubgroupMaxSize, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"NumSubgroups", BuiltInNumSubgroups, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"NumEnqueuedSubgroups", BuiltInNumEnqueuedSubgroups, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"SubgroupId", BuiltInSubgroupId, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"SubgroupLocalInvocationId", BuiltInSubgroupLocalInvocationId, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"VertexIndex", BuiltInVertexIndex, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"InstanceIndex", BuiltInInstanceIndex, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, }; @@ -1079,7 +1081,7 @@ static const spv_operand_desc_t memorySemanticsEntries[] = { {"UniformMemory", MemorySemanticsUniformMemoryMask, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, {"SubgroupMemory", MemorySemanticsSubgroupMemoryMask, @@ -1099,7 +1101,7 @@ static const spv_operand_desc_t memorySemanticsEntries[] = { {"AtomicCounterMemory", MemorySemanticsAtomicCounterMemoryMask, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityShader, + SPV_CAPABILITY_AS_MASK(CapabilityShader), {SPV_OPERAND_TYPE_NONE}}, { "ImageMemory", @@ -1165,17 +1167,17 @@ static const spv_operand_desc_t groupOperationEntries[] = { {"Reduce", GroupOperationReduce, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"InclusiveScan", GroupOperationInclusiveScan, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"ExclusiveScan", GroupOperationExclusiveScan, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, }; @@ -1183,17 +1185,17 @@ static const spv_operand_desc_t kernelKernelEnqueueFlagssEntries[] = { {"NoWait", KernelEnqueueFlagsNoWait, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"WaitKernel", KernelEnqueueFlagsWaitKernel, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, {"WaitWorkGroup", KernelEnqueueFlagsWaitWorkGroup, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, }; @@ -1206,7 +1208,7 @@ static const spv_operand_desc_t kernelProfilingInfoEntries[] = { {"CmdExecTime", KernelProfilingInfoCmdExecTimeMask, SPV_OPCODE_FLAGS_CAPABILITIES, - CapabilityKernel, + SPV_CAPABILITY_AS_MASK(CapabilityKernel), {SPV_OPERAND_TYPE_NONE}}, }; -- 2.7.4