Remove spv_opcode_flags_t and flags fields.
authorDavid Neto <dneto@google.com>
Wed, 7 Oct 2015 20:58:38 +0000 (16:58 -0400)
committerDavid Neto <dneto@google.com>
Mon, 26 Oct 2015 16:55:33 +0000 (12:55 -0400)
The flags fields in both spv_opcode_desc_t and spv_operand_desc_t
are redundant with the capabilities mask field in the same
structure.

include/libspirv/libspirv.h
source/opcode.cpp
source/opcode.h
source/operand.cpp
test/OpcodeRequiresCapabilities.cpp

index 16f7ccb..f4d821a 100644 (file)
@@ -140,12 +140,6 @@ typedef enum spv_endianness_t {
   SPV_FORCE_32_BIT_ENUM(spv_endianness_t)
 } spv_endianness_t;
 
-typedef enum spv_opcode_flags_t {
-  SPV_OPCODE_FLAGS_NONE = 0,
-  SPV_OPCODE_FLAGS_CAPABILITIES = 1,
-  SPV_FORCE_32_BIT_ENUM(spv_opcode_flags_t)
-} spv_opcode_flags_t;
-
 // The kinds of operands that an instruction may have.
 //
 // In addition to determining what kind of value an operand may be, certain
@@ -292,7 +286,6 @@ typedef struct spv_header_t {
 typedef struct spv_opcode_desc_t {
   const char *name;
   const Op opcode;
-  const uint32_t flags;  // Bitfield of spv_opcode_flags_t
   const spv_capability_mask_t
       capabilities;  // Bitfield of SPV_CAPABILITY_AS_MASK(spv::Capability)
   // operandTypes[0..numTypes-1] describe logical operands for the instruction.
@@ -315,7 +308,6 @@ typedef struct spv_opcode_table_t {
 typedef struct spv_operand_desc_t {
   const char *name;
   const uint32_t value;
-  const uint32_t flags;  // Bitfield of spv_opcode_flags_t
   const spv_capability_mask_t
       capabilities;  // Bitfield of SPV_CAPABILITY_AS_MASK(spv::Capability)
   const spv_operand_type_t operandTypes[16];  // TODO: Smaller/larger?
index a55e605..957ddef 100644 (file)
@@ -52,7 +52,6 @@ spv_opcode_desc_t opcodeTableEntries[] = {
 #define Instruction(Name,HasResult,HasType,NumLogicalOperands,NumCapabilities,CapabilityRequired,IsVariable,LogicalArgsList) \
   { #Name, \
     Op##Name, \
-    (NumCapabilities) ? SPV_OPCODE_FLAGS_CAPABILITIES : 0, \
     (NumCapabilities) ? (CapabilityRequired) : 0, \
     0, {}, /* Filled in later. Operand list, including result id and type id, if needed */ \
     HasResult, \
@@ -305,8 +304,7 @@ int16_t spvOpcodeResultIdIndex(spv_opcode_desc entry) {
 }
 
 int32_t spvOpcodeRequiresCapabilities(spv_opcode_desc entry) {
-  return SPV_OPCODE_FLAGS_CAPABILITIES ==
-         (SPV_OPCODE_FLAGS_CAPABILITIES & entry->flags);
+  return entry->capabilities != 0;
 }
 
 void spvInstructionCopy(const uint32_t *words, const Op opcode,
index 65764a5..8d17d10 100644 (file)
@@ -88,7 +88,7 @@ spv_result_t spvOpcodeTableValueLookup(const spv_opcode_table table,
 /// the wordcount/opcode word.
 int16_t spvOpcodeResultIdIndex(spv_opcode_desc entry);
 
-/// @brief Determine if the Opcode has capaspvity requirements
+/// @brief Determine if the Opcode has capability requirements.
 ///
 /// This function does not check if @a entry is valid.
 ///
index e57fa0c..26abffb 100644 (file)
 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}},
 };
@@ -55,37 +51,30 @@ static const spv_operand_desc_t sourceLanguageEntries[] = {
 static const spv_operand_desc_t executionModelEntries[] = {
     {"Vertex",
      ExecutionModelVertex,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"TessellationControl",
      ExecutionModelTessellationControl,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityTessellation),
      {SPV_OPERAND_TYPE_NONE}},
     {"TessellationEvaluation",
      ExecutionModelTessellationEvaluation,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityTessellation),
      {SPV_OPERAND_TYPE_NONE}},
     {"Geometry",
      ExecutionModelGeometry,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityGeometry),
      {SPV_OPERAND_TYPE_NONE}},
     {"Fragment",
      ExecutionModelFragment,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"GLCompute",
      ExecutionModelGLCompute,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"Kernel",
      ExecutionModelKernel,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
 };
@@ -93,17 +82,14 @@ static const spv_operand_desc_t executionModelEntries[] = {
 static const spv_operand_desc_t addressingModelEntries[] = {
     {"Logical",
      AddressingModelLogical,
-     SPV_OPCODE_FLAGS_NONE,
      0,
      {SPV_OPERAND_TYPE_NONE}},
     {"Physical32",
      AddressingModelPhysical32,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityAddresses),
      {SPV_OPERAND_TYPE_NONE}},
     {"Physical64",
      AddressingModelPhysical64,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityAddresses),
      {SPV_OPERAND_TYPE_NONE}},
 };
@@ -111,33 +97,28 @@ static const spv_operand_desc_t addressingModelEntries[] = {
 static const spv_operand_desc_t memoryModelEntries[] = {
     {"Simple",
      MemoryModelSimple,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"GLSL450",
      MemoryModelGLSL450,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"OpenCL",
      MemoryModelOpenCL,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
 };
 
 // Execution mode requiring the given capability and having no operands.
-#define ExecMode0(mode, cap)                                 \
-  #mode, ExecutionMode##mode, SPV_OPCODE_FLAGS_CAPABILITIES, \
-      SPV_CAPABILITY_AS_MASK(Capability##cap), {             \
-    SPV_OPERAND_TYPE_NONE                                    \
+#define ExecMode0(mode, cap)                                             \
+  #mode, ExecutionMode##mode, SPV_CAPABILITY_AS_MASK(Capability##cap), { \
+    SPV_OPERAND_TYPE_NONE                                                \
   }
 // Execution mode requiring the given capability and having one literal number
 // operand.
-#define ExecMode1(mode, cap)                                 \
-  #mode, ExecutionMode##mode, SPV_OPCODE_FLAGS_CAPABILITIES, \
-      SPV_CAPABILITY_AS_MASK(Capability##cap), {             \
-    SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE   \
+#define ExecMode1(mode, cap)                                             \
+  #mode, ExecutionMode##mode, SPV_CAPABILITY_AS_MASK(Capability##cap), { \
+    SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE               \
   }
 static const spv_operand_desc_t executionModeEntries[] = {
     {ExecMode1(Invocations, Geometry)},
@@ -158,13 +139,11 @@ static const spv_operand_desc_t executionModeEntries[] = {
     {ExecMode0(DepthUnchanged, Shader)},
     {"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,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_LITERAL_NUMBER,
       SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
@@ -173,7 +152,6 @@ static const spv_operand_desc_t executionModeEntries[] = {
     {ExecMode0(InputLinesAdjacency, Geometry)},
     {"InputTriangles",
      ExecutionModeInputTriangles,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityGeometry) |
          SPV_CAPABILITY_AS_MASK(CapabilityTessellation),
      {SPV_OPERAND_TYPE_NONE}},
@@ -182,7 +160,6 @@ static const spv_operand_desc_t executionModeEntries[] = {
     {ExecMode0(InputIsolines, Tessellation)},
     {"OutputVertices",
      ExecutionModeOutputVertices,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityGeometry) |
          SPV_CAPABILITY_AS_MASK(CapabilityTessellation),
      {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
@@ -200,62 +177,50 @@ static const spv_operand_desc_t storageClassEntries[] = {
     // TODO(dneto): There are more storage classes in Rev32 and later.
     {"UniformConstant",
      StorageClassUniformConstant,
-     SPV_OPCODE_FLAGS_NONE,
      0,
      {SPV_OPERAND_TYPE_NONE}},
     {"Input",
      StorageClassInput,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"Uniform",
      StorageClassUniform,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"Output",
      StorageClassOutput,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(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,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"Function",
      StorageClassFunction,
-     SPV_OPCODE_FLAGS_NONE,
      0,
      {SPV_OPERAND_TYPE_NONE}},
     {"Generic",
      StorageClassGeneric,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"PushConstant",
      StorageClassPushConstant,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"AtomicCounter",
      StorageClassAtomicCounter,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityAtomicStorage),
      {SPV_OPERAND_TYPE_NONE}},
     {"Image",
      StorageClassImage,
-     SPV_OPCODE_FLAGS_NONE,
      0,
      {SPV_OPERAND_TYPE_NONE}},
 };
@@ -263,29 +228,24 @@ static const spv_operand_desc_t storageClassEntries[] = {
 static const spv_operand_desc_t dimensionalityEntries[] = {
     {"1D",
      Dim1D,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilitySampled1D),
      {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}},
+    {"2D", Dim2D, 0, {SPV_OPERAND_TYPE_NONE}},
+    {"3D", Dim3D, 0, {SPV_OPERAND_TYPE_NONE}},
     {"Cube",
      DimCube,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"Rect",
      DimRect,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilitySampledRect),
      {SPV_OPERAND_TYPE_NONE}},
     {"Buffer",
      DimBuffer,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilitySampledBuffer),
      {SPV_OPERAND_TYPE_NONE}},
     {"InputTarget",
      DimInputTarget,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityInputTarget),
      {SPV_OPERAND_TYPE_NONE}},
 };
@@ -293,27 +253,22 @@ static const spv_operand_desc_t dimensionalityEntries[] = {
 static const spv_operand_desc_t samplerAddressingModeEntries[] = {
     {"None",
      SamplerAddressingModeNone,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"ClampToEdge",
      SamplerAddressingModeClampToEdge,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"Clamp",
      SamplerAddressingModeClamp,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"Repeat",
      SamplerAddressingModeRepeat,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"RepeatMirrored",
      SamplerAddressingModeRepeatMirrored,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
 };
@@ -321,27 +276,24 @@ static const spv_operand_desc_t samplerAddressingModeEntries[] = {
 static const spv_operand_desc_t samplerFilterModeEntries[] = {
     {"Nearest",
      SamplerFilterModeNearest,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"Linear",
      SamplerFilterModeLinear,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
 };
 
 static const spv_operand_desc_t samplerImageFormatEntries[] = {
-#define CASE0(NAME)                                           \
-  {                                                           \
-    #NAME, ImageFormat##NAME, 0, 0, { SPV_OPERAND_TYPE_NONE } \
+#define CASE0(NAME)                                        \
+  {                                                        \
+    #NAME, ImageFormat##NAME, 0, { SPV_OPERAND_TYPE_NONE } \
   }
-#define CASE(NAME, CAP)                                      \
-  {                                                          \
-    #NAME, ImageFormat##NAME, SPV_OPCODE_FLAGS_CAPABILITIES, \
-        SPV_CAPABILITY_AS_MASK(Capability##CAP), {           \
-      SPV_OPERAND_TYPE_NONE                                  \
-    }                                                        \
+#define CASE(NAME, CAP)                                                  \
+  {                                                                      \
+    #NAME, ImageFormat##NAME, SPV_CAPABILITY_AS_MASK(Capability##CAP), { \
+      SPV_OPERAND_TYPE_NONE                                              \
+    }                                                                    \
   }
     // clang-format off
   CASE0(Unknown),
@@ -389,12 +341,12 @@ static const spv_operand_desc_t samplerImageFormatEntries[] = {
 };
 
 // All image channel orders depend on the Kernel capability.
-#define CASE(NAME)                                                 \
-  {                                                                \
-    #NAME, ImageChannelOrder##NAME, SPV_OPCODE_FLAGS_CAPABILITIES, \
-        SPV_CAPABILITY_AS_MASK(CapabilityKernel), {                \
-      SPV_OPERAND_TYPE_NONE                                        \
-    }                                                              \
+#define CASE(NAME)                                                            \
+  {                                                                           \
+    #NAME, ImageChannelOrder##NAME, SPV_CAPABILITY_AS_MASK(CapabilityKernel), \
+    {                                                                         \
+      SPV_OPERAND_TYPE_NONE                                                   \
+    }                                                                         \
   }
 static const spv_operand_desc_t imageChannelOrderEntries[] = {
   CASE(R),
@@ -420,12 +372,12 @@ static const spv_operand_desc_t imageChannelOrderEntries[] = {
 #undef CASE
 
 // All image channel data types depend on the Kernel capability.
-#define CASE(NAME)                                                 \
-  {                                                                \
-    #NAME, ImageChannelDataType##NAME, SPV_OPCODE_FLAGS_CAPABILITIES, \
-        SPV_CAPABILITY_AS_MASK(CapabilityKernel), {                \
-      SPV_OPERAND_TYPE_NONE                                        \
-    }                                                              \
+#define CASE(NAME)                                  \
+  {                                                 \
+    #NAME, ImageChannelDataType##NAME,              \
+        SPV_CAPABILITY_AS_MASK(CapabilityKernel), { \
+      SPV_OPERAND_TYPE_NONE                         \
+    }                                               \
   }
 static const spv_operand_desc_t imageChannelDataTypeEntries[] = {
   CASE(SnormInt8),
@@ -453,12 +405,12 @@ static const spv_operand_desc_t imageChannelDataTypeEntries[] = {
 static const spv_operand_desc_t imageOperandEntries[] = {
 // Rev32 and later adds many more enums.
 #define CASE(NAME) \
-  #NAME, spv::ImageOperands##NAME##Mask, SPV_OPCODE_FLAGS_NONE, 0
+  #NAME, spv::ImageOperands##NAME##Mask, 0
 #define CASE_CAP(NAME, CAP) \
-  #NAME, spv::ImageOperands##NAME##Mask, SPV_OPCODE_FLAGS_CAPABILITIES, CAP
+  #NAME, spv::ImageOperands##NAME##Mask, CAP
 #define ID SPV_OPERAND_TYPE_ID
 #define NONE SPV_OPERAND_TYPE_NONE
-    {"None", spv::ImageOperandsMaskNone, SPV_OPCODE_FLAGS_NONE, 0, {NONE}},
+    {"None", spv::ImageOperandsMaskNone, 0, {NONE}},
     {CASE_CAP(Bias, SPV_CAPABILITY_AS_MASK(CapabilityShader)), {ID, NONE}},
     {CASE(Lod), {ID, NONE}},
     {CASE(Grad), {ID, ID, NONE}},
@@ -477,32 +429,26 @@ static const spv_operand_desc_t imageOperandEntries[] = {
 static const spv_operand_desc_t fpFastMathModeEntries[] = {
     {"None",
      FPFastMathModeMaskNone,
-     SPV_OPCODE_FLAGS_NONE,
      0,
      {SPV_OPERAND_TYPE_NONE}},
     {"NotNaN",
      FPFastMathModeNotNaNMask,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"NotInf",
      FPFastMathModeNotInfMask,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"NSZ",
      FPFastMathModeNSZMask,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"AllowRecip",
      FPFastMathModeAllowRecipMask,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"Fast",
      FPFastMathModeFastMask,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
 };
@@ -510,22 +456,18 @@ static const spv_operand_desc_t fpFastMathModeEntries[] = {
 static const spv_operand_desc_t fpRoundingModeEntries[] = {
     {"RTE",
      FPRoundingModeRTE,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"RTZ",
      FPRoundingModeRTZ,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"RTP",
      FPRoundingModeRTP,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"RTN",
      FPRoundingModeRTN,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
 };
@@ -533,12 +475,10 @@ static const spv_operand_desc_t fpRoundingModeEntries[] = {
 static const spv_operand_desc_t linkageTypeEntries[] = {
     {"Export",
      LinkageTypeExport,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityLinkage),
      {SPV_OPERAND_TYPE_NONE}},
     {"Import",
      LinkageTypeImport,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityLinkage),
      {SPV_OPERAND_TYPE_NONE}},
 };
@@ -546,17 +486,14 @@ static const spv_operand_desc_t linkageTypeEntries[] = {
 static const spv_operand_desc_t accessQualifierEntries[] = {
     {"ReadOnly",
      AccessQualifierReadOnly,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"WriteOnly",
      AccessQualifierWriteOnly,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"ReadWrite",
      AccessQualifierReadWrite,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
 };
@@ -564,42 +501,34 @@ static const spv_operand_desc_t accessQualifierEntries[] = {
 static const spv_operand_desc_t functionParameterAttributeEntries[] = {
     {"Zext",
      FunctionParameterAttributeZext,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"Sext",
      FunctionParameterAttributeSext,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"ByVal",
      FunctionParameterAttributeByVal,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"Sret",
      FunctionParameterAttributeSret,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"NoAlias",
      FunctionParameterAttributeNoAlias,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"NoCapture",
      FunctionParameterAttributeNoCapture,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"NoWrite",
      FunctionParameterAttributeNoWrite,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"NoReadWrite",
      FunctionParameterAttributeNoReadWrite,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
 };
@@ -607,227 +536,183 @@ static const spv_operand_desc_t functionParameterAttributeEntries[] = {
 static const spv_operand_desc_t decorationEntries[] = {
     {"RelaxedPrecision",
      DecorationRelaxedPrecision,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {
         "SpecId",
         DecorationSpecId,
-        SPV_OPCODE_FLAGS_CAPABILITIES,
         SPV_CAPABILITY_AS_MASK(CapabilityShader),
         {SPV_OPERAND_TYPE_LITERAL_NUMBER},
     },
     {"Block",
      DecorationBlock,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"BufferBlock",
      DecorationBufferBlock,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"RowMajor",
      DecorationRowMajor,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityMatrix),
      {SPV_OPERAND_TYPE_NONE}},
     {"ColMajor",
      DecorationColMajor,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityMatrix),
      {SPV_OPERAND_TYPE_NONE}},
     {"ArrayStride",
      DecorationArrayStride,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
     {"MatrixStride",
      DecorationMatrixStride,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
     {"GLSLShared",
      DecorationGLSLShared,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"GLSLPacked",
      DecorationGLSLPacked,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"CPacked",
      DecorationCPacked,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"BuiltIn",
      DecorationBuiltIn,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_BUILT_IN, SPV_OPERAND_TYPE_NONE}},
     {"Smooth",
      DecorationSmooth,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"NoPerspective",
      DecorationNoPerspective,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"Flat",
      DecorationFlat,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"Patch",
      DecorationPatch,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityTessellation),
      {SPV_OPERAND_TYPE_NONE}},
     {"Centroid",
      DecorationCentroid,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"Sample",
      DecorationSample,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"Invariant",
      DecorationInvariant,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(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,
      SPV_CAPABILITY_AS_MASK(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,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"SaturatedConversion",
      DecorationSaturatedConversion,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"Stream",
      DecorationStream,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityGeometry),
      {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
     {"Location",
      DecorationLocation,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
     {"Component",
      DecorationComponent,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
     {"Index",
      DecorationIndex,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
     {"Binding",
      DecorationBinding,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
     {"DescriptorSet",
      DecorationDescriptorSet,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(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}},
     {"XfbBuffer",
      DecorationXfbBuffer,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityTransformFeedback),
      {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
     {"XfbStride",
      DecorationXfbStride,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityTransformFeedback),
      {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
     {"FuncParamAttr",
      DecorationFuncParamAttr,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE, SPV_OPERAND_TYPE_NONE}},
     {"FPRoundingMode",
      DecorationFPRoundingMode,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_FP_ROUNDING_MODE, SPV_OPERAND_TYPE_NONE}},
     {"FPFastMathMode",
      DecorationFPFastMathMode,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, SPV_OPERAND_TYPE_NONE}},
     {"LinkageAttributes",
      DecorationLinkageAttributes,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      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,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"InputTargetIndex",
      DecorationInputTargetIndex,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      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,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE}},
 };
@@ -835,219 +720,176 @@ static const spv_operand_desc_t decorationEntries[] = {
 static const spv_operand_desc_t builtInEntries[] = {
     {"Position",
      BuiltInPosition,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"PointSize",
      BuiltInPointSize,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"ClipDistance",
      BuiltInClipDistance,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"CullDistance",
      BuiltInCullDistance,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"VertexId",
      BuiltInVertexId,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"InstanceId",
      BuiltInInstanceId,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"PrimitiveId",
      BuiltInPrimitiveId,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityGeometry) |
          SPV_CAPABILITY_AS_MASK(CapabilityTessellation),
      {SPV_OPERAND_TYPE_NONE}},
     {"InvocationId",
      BuiltInInvocationId,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityGeometry) |
          SPV_CAPABILITY_AS_MASK(CapabilityTessellation),
      {SPV_OPERAND_TYPE_NONE}},
     {"Layer",
      BuiltInLayer,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityGeometry),
      {SPV_OPERAND_TYPE_NONE}},
     {"ViewportIndex",
      BuiltInViewportIndex,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityGeometry),
      {SPV_OPERAND_TYPE_NONE}},
     {"TessLevelOuter",
      BuiltInTessLevelOuter,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityTessellation),
      {SPV_OPERAND_TYPE_NONE}},
     {"TessLevelInner",
      BuiltInTessLevelInner,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityTessellation),
      {SPV_OPERAND_TYPE_NONE}},
     {"TessCoord",
      BuiltInTessCoord,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityTessellation),
      {SPV_OPERAND_TYPE_NONE}},
     {"PatchVertices",
      BuiltInPatchVertices,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityTessellation),
      {SPV_OPERAND_TYPE_NONE}},
     {"FragCoord",
      BuiltInFragCoord,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"PointCoord",
      BuiltInPointCoord,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"FrontFacing",
      BuiltInFrontFacing,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"SampleId",
      BuiltInSampleId,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"SamplePosition",
      BuiltInSamplePosition,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"SampleMask",
      BuiltInSampleMask,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"FragColor",
      BuiltInFragColor,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"FragDepth",
      BuiltInFragDepth,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"HelperInvocation",
      BuiltInHelperInvocation,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(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",
      BuiltInLocalInvocationIndex,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"WorkDim",
      BuiltInWorkDim,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"GlobalSize",
      BuiltInGlobalSize,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"EnqueuedWorkgroupSize",
      BuiltInEnqueuedWorkgroupSize,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"GlobalOffset",
      BuiltInGlobalOffset,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"GlobalLinearId",
      BuiltInGlobalLinearId,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"WorkgroupLinearId",
      BuiltInWorkgroupLinearId,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"SubgroupSize",
      BuiltInSubgroupSize,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"SubgroupMaxSize",
      BuiltInSubgroupMaxSize,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"NumSubgroups",
      BuiltInNumSubgroups,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"NumEnqueuedSubgroups",
      BuiltInNumEnqueuedSubgroups,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"SubgroupId",
      BuiltInSubgroupId,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"SubgroupLocalInvocationId",
      BuiltInSubgroupLocalInvocationId,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"VertexIndex",
      BuiltInVertexIndex,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {"InstanceIndex",
      BuiltInInstanceIndex,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
 };
@@ -1055,17 +897,14 @@ static const spv_operand_desc_t builtInEntries[] = {
 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}},
 };
@@ -1073,17 +912,14 @@ static const spv_operand_desc_t selectionControlEntries[] = {
 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}},
 };
@@ -1091,27 +927,22 @@ static const spv_operand_desc_t loopControlEntries[] = {
 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}},
 };
@@ -1122,58 +953,47 @@ static const spv_operand_desc_t memorySemanticsEntries[] = {
     // will prefer to emit "Relaxed".
     {"Relaxed",
      MemorySemanticsMaskNone,
-     SPV_OPCODE_FLAGS_NONE,
      0,
      {SPV_OPERAND_TYPE_NONE}},
     {"None",
      MemorySemanticsMaskNone,
-     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,
      SPV_CAPABILITY_AS_MASK(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,
      SPV_CAPABILITY_AS_MASK(CapabilityShader),
      {SPV_OPERAND_TYPE_NONE}},
     {
         "ImageMemory",
         MemorySemanticsImageMemoryMask,
-        SPV_OPCODE_FLAGS_NONE,
         0,
         {SPV_OPERAND_TYPE_NONE},
     },
@@ -1182,24 +1002,20 @@ static const spv_operand_desc_t memorySemanticsEntries[] = {
 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_LITERAL_NUMBER, SPV_OPERAND_TYPE_NONE},
     },
     {"Nontemporal",
      MemoryAccessNontemporalMask,
-     SPV_OPCODE_FLAGS_NONE,
      0,
      {SPV_OPERAND_TYPE_NONE}},
 };
@@ -1207,24 +1023,20 @@ static const spv_operand_desc_t memoryAccessEntries[] = {
 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}},
+    {"Device", ScopeDevice, 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},
     },
@@ -1233,17 +1045,14 @@ static const spv_operand_desc_t scopeEntries[] = {
 static const spv_operand_desc_t groupOperationEntries[] = {
     {"Reduce",
      GroupOperationReduce,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"InclusiveScan",
      GroupOperationInclusiveScan,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"ExclusiveScan",
      GroupOperationExclusiveScan,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
 };
@@ -1251,17 +1060,14 @@ static const spv_operand_desc_t groupOperationEntries[] = {
 static const spv_operand_desc_t kernelKernelEnqueueFlagssEntries[] = {
     {"NoWait",
      KernelEnqueueFlagsNoWait,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"WaitKernel",
      KernelEnqueueFlagsWaitKernel,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
     {"WaitWorkGroup",
      KernelEnqueueFlagsWaitWorkGroup,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
 };
@@ -1269,31 +1075,26 @@ static const spv_operand_desc_t kernelKernelEnqueueFlagssEntries[] = {
 static const spv_operand_desc_t kernelProfilingInfoEntries[] = {
     {"None",
      KernelProfilingInfoMaskNone,
-     SPV_OPCODE_FLAGS_NONE,
      0,
      {SPV_OPERAND_TYPE_NONE}},
     {"CmdExecTime",
      KernelProfilingInfoCmdExecTimeMask,
-     SPV_OPCODE_FLAGS_CAPABILITIES,
      SPV_CAPABILITY_AS_MASK(CapabilityKernel),
      {SPV_OPERAND_TYPE_NONE}},
 };
 
 // A macro for defining a capability that doesn't depend on another capability.
-#define CASE(NAME)                                       \
-  {                                                      \
-    #NAME, Capability##NAME, SPV_OPCODE_FLAGS_NONE, 0, { \
-      SPV_OPERAND_TYPE_NONE                              \
-    }                                                    \
+#define CASE(NAME)                                        \
+  {                                                       \
+    #NAME, Capability##NAME, 0, { SPV_OPERAND_TYPE_NONE } \
   }
 
 // A macro for defining a capability that depends on another.
-#define CASE_CAP(NAME, CAP)                                 \
-  {                                                         \
-    #NAME, Capability##NAME, SPV_OPCODE_FLAGS_CAPABILITIES, \
-        SPV_CAPABILITY_AS_MASK(Capability##CAP), {          \
-      SPV_OPERAND_TYPE_NONE                                 \
-    }                                                       \
+#define CASE_CAP(NAME, CAP)                                             \
+  {                                                                     \
+    #NAME, Capability##NAME, SPV_CAPABILITY_AS_MASK(Capability##CAP), { \
+      SPV_OPERAND_TYPE_NONE                                             \
+    }                                                                   \
   }
 
 static const spv_operand_desc_t capabilityInfoEntries[] = {
index dd5dd98..55264c1 100644 (file)
@@ -33,8 +33,7 @@ class Requires : public ::testing::TestWithParam<Capability> {
   Requires()
       : entry({nullptr,
                (Op)0,
-               SPV_OPCODE_FLAGS_CAPABILITIES,
-               GetParam(),
+               SPV_CAPABILITY_AS_MASK(GetParam()),
                0,
                {},
                false,
@@ -57,11 +56,20 @@ INSTANTIATE_TEST_CASE_P(Op, Requires,
                                           CapabilityGeometry,
                                           CapabilityTessellation,
                                           CapabilityAddresses,
-                                          CapabilityLinkage, CapabilityKernel));
+                                          CapabilityLinkage, CapabilityKernel,
+                                          // ClipDistance has enum value 32.
+                                          // So it tests that we are sensitive
+                                          // to more than just the least
+                                          // significant 32 bits of the
+                                          // capability mask.
+                                          CapabilityClipDistance,
+                                          // Transformfeedback has value 53,
+                                          // and is the last capability.
+                                          CapabilityTransformFeedback));
 
 TEST(OpcodeRequiresCapability, None) {
   spv_opcode_desc_t entry = {
-      nullptr, (Op)0, SPV_OPCODE_FLAGS_NONE, 0, 0, {}, false, false, {}};
+      nullptr, (Op)0, 0, 0, {}, false, false, {}};
   ASSERT_EQ(0, spvOpcodeRequiresCapabilities(&entry));
 }