Fix Capability dependencies on capabilities, Rev32
authorDavid Neto <dneto@google.com>
Wed, 23 Sep 2015 20:04:24 +0000 (16:04 -0400)
committerDavid Neto <dneto@google.com>
Mon, 26 Oct 2015 16:55:33 +0000 (12:55 -0400)
source/operand.cpp

index 2dd6cc2..94b7669 100644 (file)
@@ -1186,146 +1186,80 @@ static const spv_operand_desc_t kernelProfilingInfoEntries[] = {
      {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                              \
+    }                                                    \
+  }
+
+// A macro for defining a capability that depends on another.
+#define CASE_CAP(NAME, CAP)                                                    \
+  {                                                                            \
+    #NAME, Capability##NAME, SPV_OPCODE_FLAGS_CAPABILITIES, Capability##CAP, { \
+      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}},
-    {"ImageMipmap",
-     CapabilityImageMipmap,
-     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}},
-// A macro for defining a capability that doesn't depend on other capabilities.
-// TODO(dneto): Rev32 adds many dependencies between capbilities.
-#define CASE(NAME) { #NAME, Capability##NAME, SPV_OPCODE_FLAGS_NONE, 0, {SPV_OPERAND_TYPE_NONE}}
-     CASE(LiteralSampler),
-     CASE(AtomicStorage),
-     CASE(Int16),
-     CASE(TessellationPointSize),
-     CASE(GeometryPointSize),
-     CASE(ImageGatherExtended),
-     CASE(StorageImageExtendedFormats),
-     CASE(StorageImageMultisample),
-     CASE(UniformBufferArrayDynamicIndexing),
-     CASE(SampledImageArrayDynamicIndexing),
-     CASE(StorageBufferArrayDynamicIndexing),
-     CASE(StorageImageArrayDynamicIndexing),
-     CASE(ClipDistance),
-     CASE(CullDistance),
-     CASE(ImageCubeArray),
-     CASE(SampleRateShading),
-     CASE(ImageRect),
-     CASE(SampledRect),
-     CASE(GenericPointer),
-     CASE(Int8),
-     CASE(InputTarget),
-     CASE(SparseResidency),
-     CASE(MinLod),
-     CASE(Sampled1D),
-     CASE(Image1D),
-     CASE(SampledCubeArray),
-     CASE(SampledBuffer),
-     CASE(ImageBuffer),
-     CASE(ImageMSArray),
-     CASE(AdvancedFormats),
-     CASE(ImageQuery),
-     CASE(DerivativeControl),
-     CASE(InterpolationFunction),
-     CASE(TransformFeedback),
-#undef CASE
+    CASE(Matrix),
+    CASE_CAP(Shader, Matrix),
+    CASE_CAP(Geometry, Shader),
+    CASE_CAP(Tessellation, Shader),
+    CASE(Addresses),
+    CASE(Linkage),
+    CASE(Kernel),
+    CASE_CAP(Vector16, Kernel),
+    CASE_CAP(Float16Buffer, Kernel),
+    CASE_CAP(Float16, Float16Buffer),
+    CASE(Float64),
+    CASE(Int64),
+    CASE_CAP(Int64Atomics, Int64),
+    CASE_CAP(ImageBasic, Kernel),
+    CASE_CAP(ImageReadWrite, Kernel),
+    CASE_CAP(ImageMipmap, Kernel),
+    CASE_CAP(ImageSRGBWrite, Kernel),
+    CASE_CAP(Pipes, Kernel),
+    CASE(Groups),
+    CASE_CAP(DeviceEnqueue, Kernel),
+    CASE_CAP(LiteralSampler, Kernel),
+    CASE_CAP(AtomicStorage, Shader),
+    CASE(Int16),
+    CASE_CAP(TessellationPointSize, Tessellation),
+    CASE_CAP(GeometryPointSize, Geometry),
+    CASE_CAP(ImageGatherExtended, Shader),
+    CASE_CAP(StorageImageExtendedFormats, Shader),
+    CASE_CAP(StorageImageMultisample, Shader),
+    CASE_CAP(UniformBufferArrayDynamicIndexing, Shader),
+    CASE_CAP(SampledImageArrayDynamicIndexing, Shader),
+    CASE_CAP(StorageBufferArrayDynamicIndexing, Shader),
+    CASE_CAP(StorageImageArrayDynamicIndexing, Shader),
+    CASE_CAP(ClipDistance, Shader),
+    CASE_CAP(CullDistance, Shader),
+    CASE_CAP(ImageCubeArray, SampledCubeArray),
+    CASE_CAP(SampleRateShading, Shader),
+    CASE_CAP(ImageRect, SampledRect),
+    CASE_CAP(SampledRect, Shader),
+    CASE_CAP(GenericPointer, Addresses),
+    CASE_CAP(Int8, Kernel),
+    CASE_CAP(InputTarget, Shader),
+    CASE_CAP(SparseResidency, Shader),
+    CASE_CAP(MinLod, Shader),
+    CASE_CAP(Sampled1D, Shader),
+    CASE_CAP(Image1D, Sampled1D),
+    CASE_CAP(SampledCubeArray, Shader),
+    CASE_CAP(SampledBuffer, Shader),
+    CASE_CAP(ImageBuffer, SampledBuffer),
+    CASE_CAP(ImageMSArray, Shader),
+    CASE_CAP(AdvancedFormats, Shader),
+    CASE_CAP(ImageQuery, Shader),
+    CASE_CAP(DerivativeControl, Shader),
+    CASE_CAP(InterpolationFunction, Shader),
+    CASE_CAP(TransformFeedback, Shader),
 };
+#undef CASE
+#undef CASE_CAP
 
 static const spv_operand_desc_group_t opcodeEntryTypes[] = {
     {SPV_OPERAND_TYPE_SOURCE_LANGUAGE,