Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1 | // Copyright (c) 2015 The Khronos Group Inc. |
| 2 | // |
| 3 | // Permission is hereby granted, free of charge, to any person obtaining a |
| 4 | // copy of this software and/or associated documentation files (the |
| 5 | // "Materials"), to deal in the Materials without restriction, including |
| 6 | // without limitation the rights to use, copy, modify, merge, publish, |
| 7 | // distribute, sublicense, and/or sell copies of the Materials, and to |
| 8 | // permit persons to whom the Materials are furnished to do so, subject to |
| 9 | // the following conditions: |
| 10 | // |
| 11 | // The above copyright notice and this permission notice shall be included |
| 12 | // in all copies or substantial portions of the Materials. |
| 13 | // |
| 14 | // MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS |
| 15 | // KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS |
| 16 | // SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT |
| 17 | // https://www.khronos.org/registry/ |
| 18 | // |
| 19 | // THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 20 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 21 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 22 | // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 23 | // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 24 | // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 25 | // MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. |
| 26 | |
| 27 | #include "operand.h" |
| 28 | |
| 29 | #include <assert.h> |
| 30 | #include <string.h> |
| 31 | |
| 32 | static const spv_operand_desc_t sourceLanguageEntries[] = { |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 33 | {"Unknown", SpvSourceLanguageUnknown, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 34 | {"ESSL", SpvSourceLanguageESSL, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 35 | {"GLSL", SpvSourceLanguageGLSL, 0, {SPV_OPERAND_TYPE_NONE}}, |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 36 | {"OpenCL_C", SpvSourceLanguageOpenCL_C, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 37 | {"OpenCL_CPP", SpvSourceLanguageOpenCL_CPP, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | static const spv_operand_desc_t executionModelEntries[] = { |
| 41 | {"Vertex", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 42 | SpvExecutionModelVertex, |
| 43 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 44 | {SPV_OPERAND_TYPE_NONE}}, |
| 45 | {"TessellationControl", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 46 | SpvExecutionModelTessellationControl, |
| 47 | SPV_CAPABILITY_AS_MASK(SpvCapabilityTessellation), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 48 | {SPV_OPERAND_TYPE_NONE}}, |
| 49 | {"TessellationEvaluation", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 50 | SpvExecutionModelTessellationEvaluation, |
| 51 | SPV_CAPABILITY_AS_MASK(SpvCapabilityTessellation), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 52 | {SPV_OPERAND_TYPE_NONE}}, |
| 53 | {"Geometry", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 54 | SpvExecutionModelGeometry, |
| 55 | SPV_CAPABILITY_AS_MASK(SpvCapabilityGeometry), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 56 | {SPV_OPERAND_TYPE_NONE}}, |
| 57 | {"Fragment", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 58 | SpvExecutionModelFragment, |
| 59 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 60 | {SPV_OPERAND_TYPE_NONE}}, |
| 61 | {"GLCompute", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 62 | SpvExecutionModelGLCompute, |
| 63 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 64 | {SPV_OPERAND_TYPE_NONE}}, |
| 65 | {"Kernel", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 66 | SpvExecutionModelKernel, |
| 67 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 68 | {SPV_OPERAND_TYPE_NONE}}, |
| 69 | }; |
| 70 | |
| 71 | static const spv_operand_desc_t addressingModelEntries[] = { |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 72 | {"Logical", SpvAddressingModelLogical, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 73 | {"Physical32", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 74 | SpvAddressingModelPhysical32, |
| 75 | SPV_CAPABILITY_AS_MASK(SpvCapabilityAddresses), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 76 | {SPV_OPERAND_TYPE_NONE}}, |
| 77 | {"Physical64", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 78 | SpvAddressingModelPhysical64, |
| 79 | SPV_CAPABILITY_AS_MASK(SpvCapabilityAddresses), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 80 | {SPV_OPERAND_TYPE_NONE}}, |
| 81 | }; |
| 82 | |
| 83 | static const spv_operand_desc_t memoryModelEntries[] = { |
| 84 | {"Simple", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 85 | SpvMemoryModelSimple, |
| 86 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 87 | {SPV_OPERAND_TYPE_NONE}}, |
| 88 | {"GLSL450", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 89 | SpvMemoryModelGLSL450, |
| 90 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 91 | {SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 604e5ce | 2015-08-14 14:46:43 -0400 | [diff] [blame] | 92 | {"OpenCL", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 93 | SpvMemoryModelOpenCL, |
| 94 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 95 | {SPV_OPERAND_TYPE_NONE}}, |
| 96 | }; |
| 97 | |
Lei Zhang | 85c6f79 | 2015-09-23 15:42:18 -0400 | [diff] [blame] | 98 | // Execution mode requiring the given capability and having no operands. |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 99 | #define ExecMode0(mode, cap) \ |
| 100 | #mode, SpvExecutionMode##mode, SPV_CAPABILITY_AS_MASK(SpvCapability##cap), { \ |
| 101 | SPV_OPERAND_TYPE_NONE \ |
Lei Zhang | 85c6f79 | 2015-09-23 15:42:18 -0400 | [diff] [blame] | 102 | } |
| 103 | // Execution mode requiring the given capability and having one literal number |
| 104 | // operand. |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 105 | #define ExecMode1(mode, cap) \ |
| 106 | #mode, SpvExecutionMode##mode, SPV_CAPABILITY_AS_MASK(SpvCapability##cap), { \ |
| 107 | SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE \ |
Lei Zhang | 85c6f79 | 2015-09-23 15:42:18 -0400 | [diff] [blame] | 108 | } |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 109 | static const spv_operand_desc_t executionModeEntries[] = { |
Lei Zhang | 85c6f79 | 2015-09-23 15:42:18 -0400 | [diff] [blame] | 110 | {ExecMode1(Invocations, Geometry)}, |
| 111 | {ExecMode0(SpacingEqual, Tessellation)}, |
| 112 | {ExecMode0(SpacingFractionalEven, Tessellation)}, |
| 113 | {ExecMode0(SpacingFractionalOdd, Tessellation)}, |
| 114 | {ExecMode0(VertexOrderCw, Tessellation)}, |
| 115 | {ExecMode0(VertexOrderCcw, Tessellation)}, |
| 116 | {ExecMode0(PixelCenterInteger, Shader)}, |
| 117 | {ExecMode0(OriginUpperLeft, Shader)}, |
| 118 | {ExecMode0(OriginLowerLeft, Shader)}, |
| 119 | {ExecMode0(EarlyFragmentTests, Shader)}, |
| 120 | {ExecMode0(PointMode, Tessellation)}, |
Lei Zhang | 863ddbe | 2015-09-23 17:09:01 -0400 | [diff] [blame] | 121 | {ExecMode0(Xfb, TransformFeedback)}, |
Lei Zhang | 85c6f79 | 2015-09-23 15:42:18 -0400 | [diff] [blame] | 122 | {ExecMode0(DepthReplacing, Shader)}, |
Lei Zhang | 85c6f79 | 2015-09-23 15:42:18 -0400 | [diff] [blame] | 123 | {ExecMode0(DepthGreater, Shader)}, |
| 124 | {ExecMode0(DepthLess, Shader)}, |
| 125 | {ExecMode0(DepthUnchanged, Shader)}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 126 | {"LocalSize", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 127 | SpvExecutionModeLocalSize, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 128 | 0, |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 129 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, |
| 130 | SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 131 | {"LocalSizeHint", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 132 | SpvExecutionModeLocalSizeHint, |
| 133 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 134 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_LITERAL_INTEGER, |
| 135 | SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 85c6f79 | 2015-09-23 15:42:18 -0400 | [diff] [blame] | 136 | {ExecMode0(InputPoints, Geometry)}, |
| 137 | {ExecMode0(InputLines, Geometry)}, |
| 138 | {ExecMode0(InputLinesAdjacency, Geometry)}, |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 139 | {"Triangles", |
| 140 | SpvExecutionModeTriangles, |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 141 | SPV_CAPABILITY_AS_MASK(SpvCapabilityGeometry) | |
| 142 | SPV_CAPABILITY_AS_MASK(SpvCapabilityTessellation), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 143 | {SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 85c6f79 | 2015-09-23 15:42:18 -0400 | [diff] [blame] | 144 | {ExecMode0(InputTrianglesAdjacency, Geometry)}, |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 145 | {ExecMode0(Quads, Tessellation)}, |
| 146 | {ExecMode0(Isolines, Tessellation)}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 147 | {"OutputVertices", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 148 | SpvExecutionModeOutputVertices, |
| 149 | SPV_CAPABILITY_AS_MASK(SpvCapabilityGeometry) | |
| 150 | SPV_CAPABILITY_AS_MASK(SpvCapabilityTessellation), |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 151 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 85c6f79 | 2015-09-23 15:42:18 -0400 | [diff] [blame] | 152 | {ExecMode0(OutputPoints, Geometry)}, |
| 153 | {ExecMode0(OutputLineStrip, Geometry)}, |
| 154 | {ExecMode0(OutputTriangleStrip, Geometry)}, |
| 155 | {ExecMode1(VecTypeHint, Kernel)}, |
| 156 | {ExecMode0(ContractionOff, Kernel)}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 157 | }; |
Lei Zhang | 85c6f79 | 2015-09-23 15:42:18 -0400 | [diff] [blame] | 158 | #undef ExecMode0 |
| 159 | #undef ExecMode1 |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 160 | |
| 161 | static const spv_operand_desc_t storageClassEntries[] = { |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 162 | // TODO(dneto): There are more storage classes in Rev32 and later. |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 163 | {"UniformConstant", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 164 | SpvStorageClassUniformConstant, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 165 | 0, |
| 166 | {SPV_OPERAND_TYPE_NONE}}, |
| 167 | {"Input", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 168 | SpvStorageClassInput, |
| 169 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 170 | {SPV_OPERAND_TYPE_NONE}}, |
| 171 | {"Uniform", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 172 | SpvStorageClassUniform, |
| 173 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 174 | {SPV_OPERAND_TYPE_NONE}}, |
| 175 | {"Output", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 176 | SpvStorageClassOutput, |
| 177 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 178 | {SPV_OPERAND_TYPE_NONE}}, |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 179 | {"Workgroup", |
| 180 | SpvStorageClassWorkgroup, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 181 | 0, |
| 182 | {SPV_OPERAND_TYPE_NONE}}, |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 183 | {"CrossWorkgroup", |
| 184 | SpvStorageClassCrossWorkgroup, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 185 | 0, |
| 186 | {SPV_OPERAND_TYPE_NONE}}, |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 187 | {"Private", |
| 188 | SpvStorageClassPrivate, |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 189 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 190 | {SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 191 | {"Function", SpvStorageClassFunction, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 192 | {"Generic", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 193 | SpvStorageClassGeneric, |
| 194 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 195 | {SPV_OPERAND_TYPE_NONE}}, |
David Neto | 9819adf | 2015-09-23 10:19:57 -0400 | [diff] [blame] | 196 | {"PushConstant", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 197 | SpvStorageClassPushConstant, |
| 198 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
David Neto | 9819adf | 2015-09-23 10:19:57 -0400 | [diff] [blame] | 199 | {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 200 | {"AtomicCounter", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 201 | SpvStorageClassAtomicCounter, |
| 202 | SPV_CAPABILITY_AS_MASK(SpvCapabilityAtomicStorage), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 203 | {SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 204 | {"Image", SpvStorageClassImage, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 205 | }; |
| 206 | |
| 207 | static const spv_operand_desc_t dimensionalityEntries[] = { |
David Neto | ddda85a | 2015-10-02 17:10:10 -0400 | [diff] [blame] | 208 | {"1D", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 209 | SpvDim1D, |
| 210 | SPV_CAPABILITY_AS_MASK(SpvCapabilitySampled1D), |
David Neto | ddda85a | 2015-10-02 17:10:10 -0400 | [diff] [blame] | 211 | {SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 212 | {"2D", SpvDim2D, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 213 | {"3D", SpvDim3D, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 214 | {"Cube", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 215 | SpvDimCube, |
| 216 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 217 | {SPV_OPERAND_TYPE_NONE}}, |
| 218 | {"Rect", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 219 | SpvDimRect, |
| 220 | SPV_CAPABILITY_AS_MASK(SpvCapabilitySampledRect), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 221 | {SPV_OPERAND_TYPE_NONE}}, |
David Neto | ddda85a | 2015-10-02 17:10:10 -0400 | [diff] [blame] | 222 | {"Buffer", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 223 | SpvDimBuffer, |
| 224 | SPV_CAPABILITY_AS_MASK(SpvCapabilitySampledBuffer), |
David Neto | ddda85a | 2015-10-02 17:10:10 -0400 | [diff] [blame] | 225 | {SPV_OPERAND_TYPE_NONE}}, |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 226 | {"SubpassData", |
| 227 | SpvDimSubpassData, |
| 228 | SPV_CAPABILITY_AS_MASK(SpvCapabilityInputAttachment), |
David Neto | aa0c3a5 | 2015-09-23 10:30:06 -0400 | [diff] [blame] | 229 | {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 230 | }; |
| 231 | |
| 232 | static const spv_operand_desc_t samplerAddressingModeEntries[] = { |
| 233 | {"None", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 234 | SpvSamplerAddressingModeNone, |
| 235 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 236 | {SPV_OPERAND_TYPE_NONE}}, |
| 237 | {"ClampToEdge", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 238 | SpvSamplerAddressingModeClampToEdge, |
| 239 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 240 | {SPV_OPERAND_TYPE_NONE}}, |
| 241 | {"Clamp", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 242 | SpvSamplerAddressingModeClamp, |
| 243 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 244 | {SPV_OPERAND_TYPE_NONE}}, |
| 245 | {"Repeat", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 246 | SpvSamplerAddressingModeRepeat, |
| 247 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 248 | {SPV_OPERAND_TYPE_NONE}}, |
| 249 | {"RepeatMirrored", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 250 | SpvSamplerAddressingModeRepeatMirrored, |
| 251 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 252 | {SPV_OPERAND_TYPE_NONE}}, |
| 253 | }; |
| 254 | |
| 255 | static const spv_operand_desc_t samplerFilterModeEntries[] = { |
| 256 | {"Nearest", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 257 | SpvSamplerFilterModeNearest, |
| 258 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 259 | {SPV_OPERAND_TYPE_NONE}}, |
| 260 | {"Linear", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 261 | SpvSamplerFilterModeLinear, |
| 262 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 263 | {SPV_OPERAND_TYPE_NONE}}, |
| 264 | }; |
| 265 | |
David Neto | b30a0c5 | 2015-09-16 15:56:43 -0400 | [diff] [blame] | 266 | static const spv_operand_desc_t samplerImageFormatEntries[] = { |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 267 | #define CASE0(NAME) \ |
| 268 | { \ |
| 269 | #NAME, SpvImageFormat##NAME, 0, { SPV_OPERAND_TYPE_NONE } \ |
David Neto | ddda85a | 2015-10-02 17:10:10 -0400 | [diff] [blame] | 270 | } |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 271 | #define CASE(NAME, CAP) \ |
| 272 | { \ |
| 273 | #NAME, SpvImageFormat##NAME, SPV_CAPABILITY_AS_MASK(SpvCapability##CAP), { \ |
| 274 | SPV_OPERAND_TYPE_NONE \ |
| 275 | } \ |
David Neto | b30a0c5 | 2015-09-16 15:56:43 -0400 | [diff] [blame] | 276 | } |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 277 | // clang-format off |
David Neto | ddda85a | 2015-10-02 17:10:10 -0400 | [diff] [blame] | 278 | CASE0(Unknown), |
| 279 | CASE(Rgba32f, Shader), |
| 280 | CASE(Rgba16f, Shader), |
| 281 | CASE(R32f, Shader), |
| 282 | CASE(Rgba8, Shader), |
| 283 | CASE(Rgba8Snorm, Shader), |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 284 | CASE(Rg32f, StorageImageExtendedFormats), |
| 285 | CASE(Rg16f, StorageImageExtendedFormats), |
| 286 | CASE(R11fG11fB10f, StorageImageExtendedFormats), |
| 287 | CASE(R16f, StorageImageExtendedFormats), |
| 288 | CASE(Rgba16, StorageImageExtendedFormats), |
| 289 | CASE(Rgb10A2, StorageImageExtendedFormats), |
| 290 | CASE(Rg16, StorageImageExtendedFormats), |
| 291 | CASE(Rg8, StorageImageExtendedFormats), |
| 292 | CASE(R16, StorageImageExtendedFormats), |
| 293 | CASE(R8, StorageImageExtendedFormats), |
| 294 | CASE(Rgba16Snorm, StorageImageExtendedFormats), |
| 295 | CASE(Rg16Snorm, StorageImageExtendedFormats), |
| 296 | CASE(Rg8Snorm, StorageImageExtendedFormats), |
| 297 | CASE(R16Snorm, StorageImageExtendedFormats), |
| 298 | CASE(R8Snorm, StorageImageExtendedFormats), |
David Neto | ddda85a | 2015-10-02 17:10:10 -0400 | [diff] [blame] | 299 | CASE(Rgba32i, Shader), |
| 300 | CASE(Rgba16i, Shader), |
| 301 | CASE(Rgba8i, Shader), |
| 302 | CASE(R32i, Shader), |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 303 | CASE(Rg32i, StorageImageExtendedFormats), |
| 304 | CASE(Rg16i, StorageImageExtendedFormats), |
| 305 | CASE(Rg8i, StorageImageExtendedFormats), |
| 306 | CASE(R16i, StorageImageExtendedFormats), |
| 307 | CASE(R8i, StorageImageExtendedFormats), |
David Neto | ddda85a | 2015-10-02 17:10:10 -0400 | [diff] [blame] | 308 | CASE(Rgba32ui, Shader), |
| 309 | CASE(Rgba16ui, Shader), |
| 310 | CASE(Rgba8ui, Shader), |
| 311 | CASE(R32ui, Shader), |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 312 | CASE(Rgb10a2ui, StorageImageExtendedFormats), |
| 313 | CASE(Rg32ui, StorageImageExtendedFormats), |
| 314 | CASE(Rg16ui, StorageImageExtendedFormats), |
| 315 | CASE(Rg8ui, StorageImageExtendedFormats), |
| 316 | CASE(R16ui, StorageImageExtendedFormats), |
| 317 | CASE(R8ui, StorageImageExtendedFormats), |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 318 | // clang-format on |
David Neto | b30a0c5 | 2015-09-16 15:56:43 -0400 | [diff] [blame] | 319 | #undef CASE |
| 320 | }; |
| 321 | |
David Neto | ddda85a | 2015-10-02 17:10:10 -0400 | [diff] [blame] | 322 | // All image channel orders depend on the Kernel capability. |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 323 | #define CASE(NAME) \ |
| 324 | { \ |
| 325 | #NAME, SpvImageChannelOrder##NAME, \ |
| 326 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), { \ |
| 327 | SPV_OPERAND_TYPE_NONE \ |
| 328 | } \ |
David Neto | ddda85a | 2015-10-02 17:10:10 -0400 | [diff] [blame] | 329 | } |
| 330 | static const spv_operand_desc_t imageChannelOrderEntries[] = { |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 331 | CASE(R), CASE(A), CASE(RG), CASE(RA), CASE(RGB), |
| 332 | CASE(RGBA), CASE(BGRA), CASE(ARGB), CASE(Intensity), CASE(Luminance), |
| 333 | CASE(Rx), CASE(RGx), CASE(RGBx), CASE(Depth), CASE(DepthStencil), |
| 334 | CASE(sRGB), CASE(sRGBx), CASE(sRGBA), CASE(sBGRA), |
David Neto | ddda85a | 2015-10-02 17:10:10 -0400 | [diff] [blame] | 335 | }; |
| 336 | #undef CASE |
| 337 | |
| 338 | // All image channel data types depend on the Kernel capability. |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 339 | #define CASE(NAME) \ |
| 340 | { \ |
| 341 | #NAME, SpvImageChannelDataType##NAME, \ |
| 342 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), { \ |
| 343 | SPV_OPERAND_TYPE_NONE \ |
| 344 | } \ |
David Neto | ddda85a | 2015-10-02 17:10:10 -0400 | [diff] [blame] | 345 | } |
| 346 | static const spv_operand_desc_t imageChannelDataTypeEntries[] = { |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 347 | CASE(SnormInt8), CASE(SnormInt16), CASE(UnormInt8), |
| 348 | CASE(UnormInt16), CASE(UnormShort565), CASE(UnormShort555), |
| 349 | CASE(UnormInt101010), CASE(SignedInt8), CASE(SignedInt16), |
| 350 | CASE(SignedInt32), CASE(UnsignedInt8), CASE(UnsignedInt16), |
| 351 | CASE(UnsignedInt32), CASE(HalfFloat), CASE(Float), |
| 352 | CASE(UnormInt24), CASE(UnormInt101010_2), |
David Neto | ddda85a | 2015-10-02 17:10:10 -0400 | [diff] [blame] | 353 | }; |
| 354 | #undef CASE |
| 355 | |
David Neto | ee1b3bb | 2015-09-18 11:19:18 -0400 | [diff] [blame] | 356 | // Image operand definitions. Each enum value is a mask. When that mask |
| 357 | // bit is set, the instruction should have further ID operands. |
| 358 | // Some mask values depend on a capability. |
| 359 | static const spv_operand_desc_t imageOperandEntries[] = { |
| 360 | // Rev32 and later adds many more enums. |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 361 | #define CASE(NAME) #NAME, SpvImageOperands##NAME##Mask, 0 |
| 362 | #define CASE_CAP(NAME, CAP) #NAME, SpvImageOperands##NAME##Mask, CAP |
David Neto | ee1b3bb | 2015-09-18 11:19:18 -0400 | [diff] [blame] | 363 | #define ID SPV_OPERAND_TYPE_ID |
| 364 | #define NONE SPV_OPERAND_TYPE_NONE |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 365 | {"None", SpvImageOperandsMaskNone, 0, {NONE}}, |
| 366 | {CASE_CAP(Bias, SPV_CAPABILITY_AS_MASK(SpvCapabilityShader)), {ID, NONE}}, |
David Neto | ee1b3bb | 2015-09-18 11:19:18 -0400 | [diff] [blame] | 367 | {CASE(Lod), {ID, NONE}}, |
| 368 | {CASE(Grad), {ID, ID, NONE}}, |
| 369 | {CASE(ConstOffset), {ID, NONE}}, |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 370 | {CASE_CAP(Offset, SPV_CAPABILITY_AS_MASK(SpvCapabilityImageGatherExtended)), |
Dejan Mircevski | 205408b | 2015-09-30 16:42:34 -0400 | [diff] [blame] | 371 | {ID, NONE}}, |
David Neto | ee1b3bb | 2015-09-18 11:19:18 -0400 | [diff] [blame] | 372 | {CASE(ConstOffsets), {ID, NONE}}, |
| 373 | {CASE(Sample), {ID, NONE}}, |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 374 | {CASE_CAP(MinLod, SPV_CAPABILITY_AS_MASK(SpvCapabilityMinLod)), {ID, NONE}}, |
David Neto | ee1b3bb | 2015-09-18 11:19:18 -0400 | [diff] [blame] | 375 | #undef CASE |
| 376 | #undef CASE_CAP |
| 377 | #undef ID |
| 378 | #undef NONE |
| 379 | }; |
| 380 | |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 381 | static const spv_operand_desc_t fpFastMathModeEntries[] = { |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 382 | {"None", SpvFPFastMathModeMaskNone, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 383 | {"NotNaN", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 384 | SpvFPFastMathModeNotNaNMask, |
| 385 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 386 | {SPV_OPERAND_TYPE_NONE}}, |
| 387 | {"NotInf", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 388 | SpvFPFastMathModeNotInfMask, |
| 389 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 390 | {SPV_OPERAND_TYPE_NONE}}, |
| 391 | {"NSZ", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 392 | SpvFPFastMathModeNSZMask, |
| 393 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 394 | {SPV_OPERAND_TYPE_NONE}}, |
| 395 | {"AllowRecip", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 396 | SpvFPFastMathModeAllowRecipMask, |
| 397 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 398 | {SPV_OPERAND_TYPE_NONE}}, |
| 399 | {"Fast", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 400 | SpvFPFastMathModeFastMask, |
| 401 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 402 | {SPV_OPERAND_TYPE_NONE}}, |
| 403 | }; |
| 404 | |
| 405 | static const spv_operand_desc_t fpRoundingModeEntries[] = { |
| 406 | {"RTE", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 407 | SpvFPRoundingModeRTE, |
| 408 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 409 | {SPV_OPERAND_TYPE_NONE}}, |
| 410 | {"RTZ", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 411 | SpvFPRoundingModeRTZ, |
| 412 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 413 | {SPV_OPERAND_TYPE_NONE}}, |
| 414 | {"RTP", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 415 | SpvFPRoundingModeRTP, |
| 416 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 417 | {SPV_OPERAND_TYPE_NONE}}, |
| 418 | {"RTN", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 419 | SpvFPRoundingModeRTN, |
| 420 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 421 | {SPV_OPERAND_TYPE_NONE}}, |
| 422 | }; |
| 423 | |
| 424 | static const spv_operand_desc_t linkageTypeEntries[] = { |
| 425 | {"Export", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 426 | SpvLinkageTypeExport, |
| 427 | SPV_CAPABILITY_AS_MASK(SpvCapabilityLinkage), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 428 | {SPV_OPERAND_TYPE_NONE}}, |
| 429 | {"Import", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 430 | SpvLinkageTypeImport, |
| 431 | SPV_CAPABILITY_AS_MASK(SpvCapabilityLinkage), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 432 | {SPV_OPERAND_TYPE_NONE}}, |
| 433 | }; |
| 434 | |
| 435 | static const spv_operand_desc_t accessQualifierEntries[] = { |
| 436 | {"ReadOnly", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 437 | SpvAccessQualifierReadOnly, |
| 438 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 439 | {SPV_OPERAND_TYPE_NONE}}, |
| 440 | {"WriteOnly", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 441 | SpvAccessQualifierWriteOnly, |
| 442 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 443 | {SPV_OPERAND_TYPE_NONE}}, |
| 444 | {"ReadWrite", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 445 | SpvAccessQualifierReadWrite, |
| 446 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 447 | {SPV_OPERAND_TYPE_NONE}}, |
| 448 | }; |
| 449 | |
| 450 | static const spv_operand_desc_t functionParameterAttributeEntries[] = { |
| 451 | {"Zext", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 452 | SpvFunctionParameterAttributeZext, |
| 453 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 454 | {SPV_OPERAND_TYPE_NONE}}, |
| 455 | {"Sext", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 456 | SpvFunctionParameterAttributeSext, |
| 457 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 458 | {SPV_OPERAND_TYPE_NONE}}, |
| 459 | {"ByVal", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 460 | SpvFunctionParameterAttributeByVal, |
| 461 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 462 | {SPV_OPERAND_TYPE_NONE}}, |
| 463 | {"Sret", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 464 | SpvFunctionParameterAttributeSret, |
| 465 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 466 | {SPV_OPERAND_TYPE_NONE}}, |
| 467 | {"NoAlias", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 468 | SpvFunctionParameterAttributeNoAlias, |
| 469 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 470 | {SPV_OPERAND_TYPE_NONE}}, |
David Neto | 37547b2 | 2015-09-10 13:23:11 -0400 | [diff] [blame] | 471 | {"NoCapture", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 472 | SpvFunctionParameterAttributeNoCapture, |
| 473 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 474 | {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 475 | {"NoWrite", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 476 | SpvFunctionParameterAttributeNoWrite, |
| 477 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 478 | {SPV_OPERAND_TYPE_NONE}}, |
| 479 | {"NoReadWrite", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 480 | SpvFunctionParameterAttributeNoReadWrite, |
| 481 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 482 | {SPV_OPERAND_TYPE_NONE}}, |
| 483 | }; |
| 484 | |
| 485 | static const spv_operand_desc_t decorationEntries[] = { |
Lei Zhang | 604e5ce | 2015-08-14 14:46:43 -0400 | [diff] [blame] | 486 | {"RelaxedPrecision", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 487 | SpvDecorationRelaxedPrecision, |
| 488 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 489 | {SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 604e5ce | 2015-08-14 14:46:43 -0400 | [diff] [blame] | 490 | { |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 491 | "SpecId", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 492 | SpvDecorationSpecId, |
| 493 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 494 | {SPV_OPERAND_TYPE_LITERAL_INTEGER}, |
Lei Zhang | 604e5ce | 2015-08-14 14:46:43 -0400 | [diff] [blame] | 495 | }, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 496 | {"Block", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 497 | SpvDecorationBlock, |
| 498 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 499 | {SPV_OPERAND_TYPE_NONE}}, |
| 500 | {"BufferBlock", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 501 | SpvDecorationBufferBlock, |
| 502 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 503 | {SPV_OPERAND_TYPE_NONE}}, |
| 504 | {"RowMajor", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 505 | SpvDecorationRowMajor, |
| 506 | SPV_CAPABILITY_AS_MASK(SpvCapabilityMatrix), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 507 | {SPV_OPERAND_TYPE_NONE}}, |
| 508 | {"ColMajor", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 509 | SpvDecorationColMajor, |
| 510 | SPV_CAPABILITY_AS_MASK(SpvCapabilityMatrix), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 511 | {SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 604e5ce | 2015-08-14 14:46:43 -0400 | [diff] [blame] | 512 | {"ArrayStride", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 513 | SpvDecorationArrayStride, |
| 514 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 515 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 604e5ce | 2015-08-14 14:46:43 -0400 | [diff] [blame] | 516 | {"MatrixStride", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 517 | SpvDecorationMatrixStride, |
| 518 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 519 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 520 | {"GLSLShared", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 521 | SpvDecorationGLSLShared, |
| 522 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 523 | {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 524 | {"GLSLPacked", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 525 | SpvDecorationGLSLPacked, |
| 526 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 527 | {SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 604e5ce | 2015-08-14 14:46:43 -0400 | [diff] [blame] | 528 | {"CPacked", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 529 | SpvDecorationCPacked, |
| 530 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Lei Zhang | 604e5ce | 2015-08-14 14:46:43 -0400 | [diff] [blame] | 531 | {SPV_OPERAND_TYPE_NONE}}, |
| 532 | {"BuiltIn", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 533 | SpvDecorationBuiltIn, |
| 534 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Lei Zhang | 604e5ce | 2015-08-14 14:46:43 -0400 | [diff] [blame] | 535 | {SPV_OPERAND_TYPE_BUILT_IN, SPV_OPERAND_TYPE_NONE}}, |
David Neto | dbaf407 | 2015-09-22 16:23:06 -0400 | [diff] [blame] | 536 | {"NoPerspective", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 537 | SpvDecorationNoPerspective, |
| 538 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 539 | {SPV_OPERAND_TYPE_NONE}}, |
| 540 | {"Flat", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 541 | SpvDecorationFlat, |
| 542 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 543 | {SPV_OPERAND_TYPE_NONE}}, |
| 544 | {"Patch", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 545 | SpvDecorationPatch, |
| 546 | SPV_CAPABILITY_AS_MASK(SpvCapabilityTessellation), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 547 | {SPV_OPERAND_TYPE_NONE}}, |
| 548 | {"Centroid", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 549 | SpvDecorationCentroid, |
| 550 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 551 | {SPV_OPERAND_TYPE_NONE}}, |
| 552 | {"Sample", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 553 | SpvDecorationSample, |
| 554 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 555 | {SPV_OPERAND_TYPE_NONE}}, |
| 556 | {"Invariant", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 557 | SpvDecorationInvariant, |
| 558 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 559 | {SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 560 | {"Restrict", SpvDecorationRestrict, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 561 | {"Aliased", SpvDecorationAliased, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 562 | {"Volatile", SpvDecorationVolatile, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 563 | {"Constant", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 564 | SpvDecorationConstant, |
| 565 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 566 | {SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 567 | {"Coherent", SpvDecorationCoherent, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 568 | {"NonWritable", SpvDecorationNonWritable, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 569 | {"NonReadable", SpvDecorationNonReadable, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 570 | {"Uniform", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 571 | SpvDecorationUniform, |
| 572 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 573 | {SPV_OPERAND_TYPE_NONE}}, |
David Neto | 37547b2 | 2015-09-10 13:23:11 -0400 | [diff] [blame] | 574 | {"SaturatedConversion", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 575 | SpvDecorationSaturatedConversion, |
| 576 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 577 | {SPV_OPERAND_TYPE_NONE}}, |
| 578 | {"Stream", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 579 | SpvDecorationStream, |
David Neto | 12511c8 | 2015-11-12 15:30:28 -0500 | [diff] [blame] | 580 | SPV_CAPABILITY_AS_MASK(SpvCapabilityGeometryStreams), |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 581 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 582 | {"Location", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 583 | SpvDecorationLocation, |
| 584 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 585 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 586 | {"Component", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 587 | SpvDecorationComponent, |
| 588 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 589 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 590 | {"Index", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 591 | SpvDecorationIndex, |
| 592 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 593 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 594 | {"Binding", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 595 | SpvDecorationBinding, |
| 596 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 597 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 598 | {"DescriptorSet", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 599 | SpvDecorationDescriptorSet, |
| 600 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 601 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 602 | {"Offset", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 603 | SpvDecorationOffset, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 604 | 0, |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 605 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 606 | {"XfbBuffer", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 607 | SpvDecorationXfbBuffer, |
| 608 | SPV_CAPABILITY_AS_MASK(SpvCapabilityTransformFeedback), |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 609 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 604e5ce | 2015-08-14 14:46:43 -0400 | [diff] [blame] | 610 | {"XfbStride", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 611 | SpvDecorationXfbStride, |
| 612 | SPV_CAPABILITY_AS_MASK(SpvCapabilityTransformFeedback), |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 613 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 614 | {"FuncParamAttr", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 615 | SpvDecorationFuncParamAttr, |
| 616 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 617 | {SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE, SPV_OPERAND_TYPE_NONE}}, |
| 618 | {"FPRoundingMode", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 619 | SpvDecorationFPRoundingMode, |
| 620 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 621 | {SPV_OPERAND_TYPE_FP_ROUNDING_MODE, SPV_OPERAND_TYPE_NONE}}, |
| 622 | {"FPFastMathMode", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 623 | SpvDecorationFPFastMathMode, |
| 624 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 625 | {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, SPV_OPERAND_TYPE_NONE}}, |
| 626 | {"LinkageAttributes", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 627 | SpvDecorationLinkageAttributes, |
| 628 | SPV_CAPABILITY_AS_MASK(SpvCapabilityLinkage), |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 629 | {SPV_OPERAND_TYPE_LITERAL_STRING, SPV_OPERAND_TYPE_LINKAGE_TYPE, |
| 630 | SPV_OPERAND_TYPE_NONE}}, |
David Neto | d768798 | 2015-09-23 14:59:27 -0400 | [diff] [blame] | 631 | {"NoContraction", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 632 | SpvDecorationNoContraction, |
| 633 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
David Neto | d768798 | 2015-09-23 14:59:27 -0400 | [diff] [blame] | 634 | {SPV_OPERAND_TYPE_NONE}}, |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 635 | {"InputAttachmentIndex", |
| 636 | SpvDecorationInputAttachmentIndex, |
| 637 | SPV_CAPABILITY_AS_MASK(SpvCapabilityInputAttachment), |
| 638 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
David Neto | d768798 | 2015-09-23 14:59:27 -0400 | [diff] [blame] | 639 | {"Alignment", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 640 | SpvDecorationAlignment, |
| 641 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 642 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 643 | }; |
| 644 | |
| 645 | static const spv_operand_desc_t builtInEntries[] = { |
| 646 | {"Position", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 647 | SpvBuiltInPosition, |
| 648 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 649 | {SPV_OPERAND_TYPE_NONE}}, |
| 650 | {"PointSize", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 651 | SpvBuiltInPointSize, |
| 652 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 653 | {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 654 | {"ClipDistance", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 655 | SpvBuiltInClipDistance, |
| 656 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 657 | {SPV_OPERAND_TYPE_NONE}}, |
| 658 | {"CullDistance", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 659 | SpvBuiltInCullDistance, |
| 660 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 661 | {SPV_OPERAND_TYPE_NONE}}, |
| 662 | {"VertexId", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 663 | SpvBuiltInVertexId, |
| 664 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 665 | {SPV_OPERAND_TYPE_NONE}}, |
| 666 | {"InstanceId", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 667 | SpvBuiltInInstanceId, |
| 668 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 669 | {SPV_OPERAND_TYPE_NONE}}, |
| 670 | {"PrimitiveId", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 671 | SpvBuiltInPrimitiveId, |
| 672 | SPV_CAPABILITY_AS_MASK(SpvCapabilityGeometry) | |
| 673 | SPV_CAPABILITY_AS_MASK(SpvCapabilityTessellation), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 674 | {SPV_OPERAND_TYPE_NONE}}, |
| 675 | {"InvocationId", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 676 | SpvBuiltInInvocationId, |
| 677 | SPV_CAPABILITY_AS_MASK(SpvCapabilityGeometry) | |
| 678 | SPV_CAPABILITY_AS_MASK(SpvCapabilityTessellation), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 679 | {SPV_OPERAND_TYPE_NONE}}, |
| 680 | {"Layer", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 681 | SpvBuiltInLayer, |
| 682 | SPV_CAPABILITY_AS_MASK(SpvCapabilityGeometry), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 683 | {SPV_OPERAND_TYPE_NONE}}, |
| 684 | {"ViewportIndex", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 685 | SpvBuiltInViewportIndex, |
| 686 | SPV_CAPABILITY_AS_MASK(SpvCapabilityGeometry), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 687 | {SPV_OPERAND_TYPE_NONE}}, |
| 688 | {"TessLevelOuter", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 689 | SpvBuiltInTessLevelOuter, |
| 690 | SPV_CAPABILITY_AS_MASK(SpvCapabilityTessellation), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 691 | {SPV_OPERAND_TYPE_NONE}}, |
| 692 | {"TessLevelInner", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 693 | SpvBuiltInTessLevelInner, |
| 694 | SPV_CAPABILITY_AS_MASK(SpvCapabilityTessellation), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 695 | {SPV_OPERAND_TYPE_NONE}}, |
| 696 | {"TessCoord", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 697 | SpvBuiltInTessCoord, |
| 698 | SPV_CAPABILITY_AS_MASK(SpvCapabilityTessellation), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 699 | {SPV_OPERAND_TYPE_NONE}}, |
| 700 | {"PatchVertices", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 701 | SpvBuiltInPatchVertices, |
| 702 | SPV_CAPABILITY_AS_MASK(SpvCapabilityTessellation), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 703 | {SPV_OPERAND_TYPE_NONE}}, |
| 704 | {"FragCoord", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 705 | SpvBuiltInFragCoord, |
| 706 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 707 | {SPV_OPERAND_TYPE_NONE}}, |
| 708 | {"PointCoord", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 709 | SpvBuiltInPointCoord, |
| 710 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 711 | {SPV_OPERAND_TYPE_NONE}}, |
| 712 | {"FrontFacing", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 713 | SpvBuiltInFrontFacing, |
| 714 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 715 | {SPV_OPERAND_TYPE_NONE}}, |
| 716 | {"SampleId", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 717 | SpvBuiltInSampleId, |
| 718 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 719 | {SPV_OPERAND_TYPE_NONE}}, |
| 720 | {"SamplePosition", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 721 | SpvBuiltInSamplePosition, |
| 722 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 723 | {SPV_OPERAND_TYPE_NONE}}, |
| 724 | {"SampleMask", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 725 | SpvBuiltInSampleMask, |
| 726 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 727 | {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 728 | {"FragDepth", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 729 | SpvBuiltInFragDepth, |
| 730 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 731 | {SPV_OPERAND_TYPE_NONE}}, |
| 732 | {"HelperInvocation", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 733 | SpvBuiltInHelperInvocation, |
| 734 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 735 | {SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 736 | {"NumWorkgroups", SpvBuiltInNumWorkgroups, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 737 | {"WorkgroupSize", SpvBuiltInWorkgroupSize, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 738 | {"WorkgroupId", SpvBuiltInWorkgroupId, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 739 | {"LocalInvocationId", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 740 | SpvBuiltInLocalInvocationId, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 741 | 0, |
| 742 | {SPV_OPERAND_TYPE_NONE}}, |
| 743 | {"GlobalInvocationId", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 744 | SpvBuiltInGlobalInvocationId, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 745 | 0, |
| 746 | {SPV_OPERAND_TYPE_NONE}}, |
| 747 | {"LocalInvocationIndex", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 748 | SpvBuiltInLocalInvocationIndex, |
| 749 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 750 | {SPV_OPERAND_TYPE_NONE}}, |
| 751 | {"WorkDim", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 752 | SpvBuiltInWorkDim, |
| 753 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 754 | {SPV_OPERAND_TYPE_NONE}}, |
| 755 | {"GlobalSize", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 756 | SpvBuiltInGlobalSize, |
| 757 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 758 | {SPV_OPERAND_TYPE_NONE}}, |
| 759 | {"EnqueuedWorkgroupSize", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 760 | SpvBuiltInEnqueuedWorkgroupSize, |
| 761 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 762 | {SPV_OPERAND_TYPE_NONE}}, |
| 763 | {"GlobalOffset", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 764 | SpvBuiltInGlobalOffset, |
| 765 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 766 | {SPV_OPERAND_TYPE_NONE}}, |
| 767 | {"GlobalLinearId", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 768 | SpvBuiltInGlobalLinearId, |
| 769 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 770 | {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 771 | {"SubgroupSize", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 772 | SpvBuiltInSubgroupSize, |
| 773 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 774 | {SPV_OPERAND_TYPE_NONE}}, |
| 775 | {"SubgroupMaxSize", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 776 | SpvBuiltInSubgroupMaxSize, |
| 777 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 778 | {SPV_OPERAND_TYPE_NONE}}, |
| 779 | {"NumSubgroups", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 780 | SpvBuiltInNumSubgroups, |
| 781 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 782 | {SPV_OPERAND_TYPE_NONE}}, |
| 783 | {"NumEnqueuedSubgroups", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 784 | SpvBuiltInNumEnqueuedSubgroups, |
| 785 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 786 | {SPV_OPERAND_TYPE_NONE}}, |
| 787 | {"SubgroupId", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 788 | SpvBuiltInSubgroupId, |
| 789 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 790 | {SPV_OPERAND_TYPE_NONE}}, |
| 791 | {"SubgroupLocalInvocationId", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 792 | SpvBuiltInSubgroupLocalInvocationId, |
| 793 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 794 | {SPV_OPERAND_TYPE_NONE}}, |
David Neto | 2d1b5e5 | 2015-09-23 15:35:27 -0400 | [diff] [blame] | 795 | {"VertexIndex", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 796 | SpvBuiltInVertexIndex, |
| 797 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
David Neto | 2d1b5e5 | 2015-09-23 15:35:27 -0400 | [diff] [blame] | 798 | {SPV_OPERAND_TYPE_NONE}}, |
| 799 | {"InstanceIndex", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 800 | SpvBuiltInInstanceIndex, |
| 801 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
David Neto | 2d1b5e5 | 2015-09-23 15:35:27 -0400 | [diff] [blame] | 802 | {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 803 | }; |
| 804 | |
| 805 | static const spv_operand_desc_t selectionControlEntries[] = { |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 806 | {"None", SpvSelectionControlMaskNone, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 807 | {"Flatten", SpvSelectionControlFlattenMask, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 808 | {"DontFlatten", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 809 | SpvSelectionControlDontFlattenMask, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 810 | 0, |
| 811 | {SPV_OPERAND_TYPE_NONE}}, |
| 812 | }; |
| 813 | |
| 814 | static const spv_operand_desc_t loopControlEntries[] = { |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 815 | {"None", SpvLoopControlMaskNone, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 816 | {"Unroll", SpvLoopControlUnrollMask, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 817 | {"DontUnroll", SpvLoopControlDontUnrollMask, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 818 | }; |
| 819 | |
| 820 | static const spv_operand_desc_t functionControlEntries[] = { |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 821 | {"None", SpvFunctionControlMaskNone, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 822 | {"Inline", SpvFunctionControlInlineMask, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 823 | {"DontInline", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 824 | SpvFunctionControlDontInlineMask, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 825 | 0, |
| 826 | {SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 827 | {"Pure", SpvFunctionControlPureMask, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 828 | {"Const", SpvFunctionControlConstMask, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 829 | }; |
| 830 | |
| 831 | static const spv_operand_desc_t memorySemanticsEntries[] = { |
David Neto | bfa3d86 | 2015-09-25 10:30:27 -0400 | [diff] [blame] | 832 | // "Relaxed" should be a synonym for "None". |
| 833 | // Put the Relaxed entry first so that the disassembler |
| 834 | // will prefer to emit "Relaxed". |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 835 | {"Relaxed", SpvMemorySemanticsMaskNone, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 836 | {"None", SpvMemorySemanticsMaskNone, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 837 | {"SequentiallyConsistent", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 838 | SpvMemorySemanticsSequentiallyConsistentMask, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 839 | 0, |
| 840 | {SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 841 | {"Acquire", SpvMemorySemanticsAcquireMask, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 842 | {"Release", SpvMemorySemanticsReleaseMask, 0, {SPV_OPERAND_TYPE_NONE}}, |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 843 | {"AcquireRelease", |
| 844 | SpvMemorySemanticsAcquireReleaseMask, |
| 845 | 0, |
| 846 | {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 847 | {"UniformMemory", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 848 | SpvMemorySemanticsUniformMemoryMask, |
| 849 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 850 | {SPV_OPERAND_TYPE_NONE}}, |
| 851 | {"SubgroupMemory", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 852 | SpvMemorySemanticsSubgroupMemoryMask, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 853 | 0, |
| 854 | {SPV_OPERAND_TYPE_NONE}}, |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 855 | {"WorkgroupMemory", |
| 856 | SpvMemorySemanticsWorkgroupMemoryMask, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 857 | 0, |
| 858 | {SPV_OPERAND_TYPE_NONE}}, |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 859 | {"CrossWorkgroupMemory", |
| 860 | SpvMemorySemanticsCrossWorkgroupMemoryMask, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 861 | 0, |
| 862 | {SPV_OPERAND_TYPE_NONE}}, |
| 863 | {"AtomicCounterMemory", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 864 | SpvMemorySemanticsAtomicCounterMemoryMask, |
| 865 | SPV_CAPABILITY_AS_MASK(SpvCapabilityShader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 866 | {SPV_OPERAND_TYPE_NONE}}, |
| 867 | { |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 868 | "ImageMemory", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 869 | SpvMemorySemanticsImageMemoryMask, |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 870 | 0, |
| 871 | {SPV_OPERAND_TYPE_NONE}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 872 | }, |
| 873 | }; |
| 874 | |
| 875 | static const spv_operand_desc_t memoryAccessEntries[] = { |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 876 | {"None", SpvMemoryAccessMaskNone, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 877 | {"Volatile", SpvMemoryAccessVolatileMask, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 878 | { |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 879 | "Aligned", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 880 | SpvMemoryAccessAlignedMask, |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 881 | 0, |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 882 | {SPV_OPERAND_TYPE_LITERAL_INTEGER, SPV_OPERAND_TYPE_NONE}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 883 | }, |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 884 | {"Nontemporal", SpvMemoryAccessNontemporalMask, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 885 | }; |
| 886 | |
| 887 | static const spv_operand_desc_t scopeEntries[] = { |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 888 | {"CrossDevice", SpvScopeCrossDevice, 0, {SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 889 | {"Device", SpvScopeDevice, 0, {SPV_OPERAND_TYPE_NONE}}, |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 890 | {"Workgroup", SpvScopeWorkgroup, 0, {SPV_OPERAND_TYPE_NONE}}, |
| 891 | {"Subgroup", SpvScopeSubgroup, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 892 | { |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 893 | "Invocation", SpvScopeInvocation, 0, {SPV_OPERAND_TYPE_NONE}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 894 | }, |
| 895 | }; |
| 896 | |
| 897 | static const spv_operand_desc_t groupOperationEntries[] = { |
| 898 | {"Reduce", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 899 | SpvGroupOperationReduce, |
| 900 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 901 | {SPV_OPERAND_TYPE_NONE}}, |
| 902 | {"InclusiveScan", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 903 | SpvGroupOperationInclusiveScan, |
| 904 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 905 | {SPV_OPERAND_TYPE_NONE}}, |
| 906 | {"ExclusiveScan", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 907 | SpvGroupOperationExclusiveScan, |
| 908 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 909 | {SPV_OPERAND_TYPE_NONE}}, |
| 910 | }; |
| 911 | |
| 912 | static const spv_operand_desc_t kernelKernelEnqueueFlagssEntries[] = { |
| 913 | {"NoWait", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 914 | SpvKernelEnqueueFlagsNoWait, |
| 915 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 916 | {SPV_OPERAND_TYPE_NONE}}, |
| 917 | {"WaitKernel", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 918 | SpvKernelEnqueueFlagsWaitKernel, |
| 919 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 920 | {SPV_OPERAND_TYPE_NONE}}, |
| 921 | {"WaitWorkGroup", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 922 | SpvKernelEnqueueFlagsWaitWorkGroup, |
| 923 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 924 | {SPV_OPERAND_TYPE_NONE}}, |
| 925 | }; |
| 926 | |
| 927 | static const spv_operand_desc_t kernelProfilingInfoEntries[] = { |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 928 | {"None", SpvKernelProfilingInfoMaskNone, 0, {SPV_OPERAND_TYPE_NONE}}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 929 | {"CmdExecTime", |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 930 | SpvKernelProfilingInfoCmdExecTimeMask, |
| 931 | SPV_CAPABILITY_AS_MASK(SpvCapabilityKernel), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 932 | {SPV_OPERAND_TYPE_NONE}}, |
| 933 | }; |
| 934 | |
David Neto | d30b233 | 2015-09-23 16:04:24 -0400 | [diff] [blame] | 935 | // A macro for defining a capability that doesn't depend on another capability. |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 936 | #define CASE(NAME) \ |
| 937 | { \ |
| 938 | #NAME, SpvCapability##NAME, 0, { SPV_OPERAND_TYPE_NONE } \ |
David Neto | d30b233 | 2015-09-23 16:04:24 -0400 | [diff] [blame] | 939 | } |
| 940 | |
| 941 | // A macro for defining a capability that depends on another. |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 942 | #define CASE_CAP(NAME, CAP) \ |
| 943 | { \ |
| 944 | #NAME, SpvCapability##NAME, SPV_CAPABILITY_AS_MASK(SpvCapability##CAP), { \ |
| 945 | SPV_OPERAND_TYPE_NONE \ |
| 946 | } \ |
David Neto | d30b233 | 2015-09-23 16:04:24 -0400 | [diff] [blame] | 947 | } |
| 948 | |
David Neto | 64a9be9 | 2015-11-18 15:48:32 -0500 | [diff] [blame] | 949 | // clang-format off |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 950 | static const spv_operand_desc_t capabilityInfoEntries[] = { |
David Neto | d30b233 | 2015-09-23 16:04:24 -0400 | [diff] [blame] | 951 | CASE(Matrix), |
| 952 | CASE_CAP(Shader, Matrix), |
| 953 | CASE_CAP(Geometry, Shader), |
| 954 | CASE_CAP(Tessellation, Shader), |
| 955 | CASE(Addresses), |
| 956 | CASE(Linkage), |
| 957 | CASE(Kernel), |
| 958 | CASE_CAP(Vector16, Kernel), |
| 959 | CASE_CAP(Float16Buffer, Kernel), |
| 960 | CASE_CAP(Float16, Float16Buffer), |
| 961 | CASE(Float64), |
| 962 | CASE(Int64), |
| 963 | CASE_CAP(Int64Atomics, Int64), |
| 964 | CASE_CAP(ImageBasic, Kernel), |
| 965 | CASE_CAP(ImageReadWrite, Kernel), |
| 966 | CASE_CAP(ImageMipmap, Kernel), |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 967 | // Value 16 intentionally missing. |
David Neto | d30b233 | 2015-09-23 16:04:24 -0400 | [diff] [blame] | 968 | CASE_CAP(Pipes, Kernel), |
| 969 | CASE(Groups), |
| 970 | CASE_CAP(DeviceEnqueue, Kernel), |
| 971 | CASE_CAP(LiteralSampler, Kernel), |
| 972 | CASE_CAP(AtomicStorage, Shader), |
| 973 | CASE(Int16), |
| 974 | CASE_CAP(TessellationPointSize, Tessellation), |
| 975 | CASE_CAP(GeometryPointSize, Geometry), |
| 976 | CASE_CAP(ImageGatherExtended, Shader), |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 977 | // Value 26 intentionally missing. |
David Neto | d30b233 | 2015-09-23 16:04:24 -0400 | [diff] [blame] | 978 | CASE_CAP(StorageImageMultisample, Shader), |
| 979 | CASE_CAP(UniformBufferArrayDynamicIndexing, Shader), |
| 980 | CASE_CAP(SampledImageArrayDynamicIndexing, Shader), |
| 981 | CASE_CAP(StorageBufferArrayDynamicIndexing, Shader), |
| 982 | CASE_CAP(StorageImageArrayDynamicIndexing, Shader), |
| 983 | CASE_CAP(ClipDistance, Shader), |
| 984 | CASE_CAP(CullDistance, Shader), |
| 985 | CASE_CAP(ImageCubeArray, SampledCubeArray), |
| 986 | CASE_CAP(SampleRateShading, Shader), |
| 987 | CASE_CAP(ImageRect, SampledRect), |
| 988 | CASE_CAP(SampledRect, Shader), |
| 989 | CASE_CAP(GenericPointer, Addresses), |
| 990 | CASE_CAP(Int8, Kernel), |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 991 | CASE_CAP(InputAttachment, Shader), |
David Neto | d30b233 | 2015-09-23 16:04:24 -0400 | [diff] [blame] | 992 | CASE_CAP(SparseResidency, Shader), |
| 993 | CASE_CAP(MinLod, Shader), |
| 994 | CASE_CAP(Sampled1D, Shader), |
| 995 | CASE_CAP(Image1D, Sampled1D), |
| 996 | CASE_CAP(SampledCubeArray, Shader), |
| 997 | CASE_CAP(SampledBuffer, Shader), |
| 998 | CASE_CAP(ImageBuffer, SampledBuffer), |
| 999 | CASE_CAP(ImageMSArray, Shader), |
David Neto | d02f68a | 2015-11-11 12:32:21 -0500 | [diff] [blame] | 1000 | CASE_CAP(StorageImageExtendedFormats, Shader), |
David Neto | d30b233 | 2015-09-23 16:04:24 -0400 | [diff] [blame] | 1001 | CASE_CAP(ImageQuery, Shader), |
| 1002 | CASE_CAP(DerivativeControl, Shader), |
| 1003 | CASE_CAP(InterpolationFunction, Shader), |
| 1004 | CASE_CAP(TransformFeedback, Shader), |
David Neto | 12511c8 | 2015-11-12 15:30:28 -0500 | [diff] [blame] | 1005 | CASE_CAP(GeometryStreams, Geometry), |
David Neto | 5f7ed91 | 2015-11-12 15:44:25 -0500 | [diff] [blame] | 1006 | CASE_CAP(StorageImageReadWithoutFormat, Shader), |
| 1007 | CASE_CAP(StorageImageWriteWithoutFormat, Shader), |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1008 | }; |
David Neto | 64a9be9 | 2015-11-18 15:48:32 -0500 | [diff] [blame] | 1009 | // clang-format on |
David Neto | d30b233 | 2015-09-23 16:04:24 -0400 | [diff] [blame] | 1010 | #undef CASE |
| 1011 | #undef CASE_CAP |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1012 | |
| 1013 | static const spv_operand_desc_group_t opcodeEntryTypes[] = { |
| 1014 | {SPV_OPERAND_TYPE_SOURCE_LANGUAGE, |
| 1015 | sizeof(sourceLanguageEntries) / sizeof(spv_operand_desc_t), |
| 1016 | sourceLanguageEntries}, |
| 1017 | {SPV_OPERAND_TYPE_EXECUTION_MODEL, |
| 1018 | sizeof(executionModelEntries) / sizeof(spv_operand_desc_t), |
| 1019 | executionModelEntries}, |
| 1020 | {SPV_OPERAND_TYPE_ADDRESSING_MODEL, |
| 1021 | sizeof(addressingModelEntries) / sizeof(spv_operand_desc_t), |
| 1022 | addressingModelEntries}, |
| 1023 | {SPV_OPERAND_TYPE_MEMORY_MODEL, |
| 1024 | sizeof(memoryModelEntries) / sizeof(spv_operand_desc_t), |
| 1025 | memoryModelEntries}, |
| 1026 | {SPV_OPERAND_TYPE_EXECUTION_MODE, |
| 1027 | sizeof(executionModeEntries) / sizeof(spv_operand_desc_t), |
| 1028 | executionModeEntries}, |
| 1029 | {SPV_OPERAND_TYPE_STORAGE_CLASS, |
| 1030 | sizeof(storageClassEntries) / sizeof(spv_operand_desc_t), |
| 1031 | storageClassEntries}, |
| 1032 | {SPV_OPERAND_TYPE_DIMENSIONALITY, |
| 1033 | sizeof(dimensionalityEntries) / sizeof(spv_operand_desc_t), |
| 1034 | dimensionalityEntries}, |
| 1035 | {SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE, |
| 1036 | sizeof(samplerAddressingModeEntries) / sizeof(spv_operand_desc_t), |
| 1037 | samplerAddressingModeEntries}, |
| 1038 | {SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE, |
| 1039 | sizeof(samplerFilterModeEntries) / sizeof(spv_operand_desc_t), |
| 1040 | samplerFilterModeEntries}, |
David Neto | b30a0c5 | 2015-09-16 15:56:43 -0400 | [diff] [blame] | 1041 | {SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT, |
| 1042 | sizeof(samplerImageFormatEntries) / sizeof(spv_operand_desc_t), |
| 1043 | samplerImageFormatEntries}, |
David Neto | ddda85a | 2015-10-02 17:10:10 -0400 | [diff] [blame] | 1044 | {SPV_OPERAND_TYPE_IMAGE_CHANNEL_ORDER, |
| 1045 | sizeof(imageChannelOrderEntries) / sizeof(spv_operand_desc_t), |
| 1046 | imageChannelOrderEntries}, |
| 1047 | {SPV_OPERAND_TYPE_IMAGE_CHANNEL_DATA_TYPE, |
| 1048 | sizeof(imageChannelDataTypeEntries) / sizeof(spv_operand_desc_t), |
| 1049 | imageChannelDataTypeEntries}, |
David Neto | 201caf7 | 2015-11-04 17:38:17 -0500 | [diff] [blame] | 1050 | {SPV_OPERAND_TYPE_IMAGE, |
| 1051 | sizeof(imageOperandEntries) / sizeof(spv_operand_desc_t), |
| 1052 | imageOperandEntries}, |
| 1053 | {SPV_OPERAND_TYPE_OPTIONAL_IMAGE, // Same as *_IMAGE |
David Neto | ee1b3bb | 2015-09-18 11:19:18 -0400 | [diff] [blame] | 1054 | sizeof(imageOperandEntries) / sizeof(spv_operand_desc_t), |
| 1055 | imageOperandEntries}, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1056 | {SPV_OPERAND_TYPE_FP_FAST_MATH_MODE, |
| 1057 | sizeof(fpFastMathModeEntries) / sizeof(spv_operand_desc_t), |
| 1058 | fpFastMathModeEntries}, |
| 1059 | {SPV_OPERAND_TYPE_FP_ROUNDING_MODE, |
| 1060 | sizeof(fpRoundingModeEntries) / sizeof(spv_operand_desc_t), |
| 1061 | fpRoundingModeEntries}, |
| 1062 | {SPV_OPERAND_TYPE_LINKAGE_TYPE, |
| 1063 | sizeof(linkageTypeEntries) / sizeof(spv_operand_desc_t), |
| 1064 | linkageTypeEntries}, |
| 1065 | {SPV_OPERAND_TYPE_ACCESS_QUALIFIER, |
| 1066 | sizeof(accessQualifierEntries) / sizeof(spv_operand_desc_t), |
| 1067 | accessQualifierEntries}, |
| 1068 | {SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE, |
| 1069 | sizeof(functionParameterAttributeEntries) / sizeof(spv_operand_desc_t), |
| 1070 | functionParameterAttributeEntries}, |
| 1071 | {SPV_OPERAND_TYPE_DECORATION, |
| 1072 | sizeof(decorationEntries) / sizeof(spv_operand_desc_t), decorationEntries}, |
| 1073 | {SPV_OPERAND_TYPE_BUILT_IN, |
| 1074 | sizeof(builtInEntries) / sizeof(spv_operand_desc_t), builtInEntries}, |
| 1075 | {SPV_OPERAND_TYPE_SELECTION_CONTROL, |
| 1076 | sizeof(selectionControlEntries) / sizeof(spv_operand_desc_t), |
| 1077 | selectionControlEntries}, |
| 1078 | {SPV_OPERAND_TYPE_LOOP_CONTROL, |
| 1079 | sizeof(loopControlEntries) / sizeof(spv_operand_desc_t), |
| 1080 | loopControlEntries}, |
| 1081 | {SPV_OPERAND_TYPE_FUNCTION_CONTROL, |
| 1082 | sizeof(functionControlEntries) / sizeof(spv_operand_desc_t), |
| 1083 | functionControlEntries}, |
David Neto | 64a9be9 | 2015-11-18 15:48:32 -0500 | [diff] [blame] | 1084 | {SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1085 | sizeof(memorySemanticsEntries) / sizeof(spv_operand_desc_t), |
| 1086 | memorySemanticsEntries}, |
David Neto | 201caf7 | 2015-11-04 17:38:17 -0500 | [diff] [blame] | 1087 | {SPV_OPERAND_TYPE_MEMORY_ACCESS, |
| 1088 | sizeof(memoryAccessEntries) / sizeof(spv_operand_desc_t), |
| 1089 | memoryAccessEntries}, |
| 1090 | {SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS, // Same as *_MEMORY_ACCESS |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1091 | sizeof(memoryAccessEntries) / sizeof(spv_operand_desc_t), |
| 1092 | memoryAccessEntries}, |
David Neto | 64a9be9 | 2015-11-18 15:48:32 -0500 | [diff] [blame] | 1093 | {SPV_OPERAND_TYPE_SCOPE_ID, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1094 | sizeof(scopeEntries) / sizeof(spv_operand_desc_t), scopeEntries}, |
| 1095 | {SPV_OPERAND_TYPE_GROUP_OPERATION, |
| 1096 | sizeof(groupOperationEntries) / sizeof(spv_operand_desc_t), |
| 1097 | groupOperationEntries}, |
| 1098 | {SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS, |
| 1099 | sizeof(kernelKernelEnqueueFlagssEntries) / sizeof(spv_operand_desc_t), |
| 1100 | kernelKernelEnqueueFlagssEntries}, |
David Neto | 4799482 | 2015-08-27 13:11:01 -0400 | [diff] [blame] | 1101 | {SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1102 | sizeof(kernelProfilingInfoEntries) / sizeof(spv_operand_desc_t), |
| 1103 | kernelProfilingInfoEntries}, |
| 1104 | {SPV_OPERAND_TYPE_CAPABILITY, |
| 1105 | sizeof(capabilityInfoEntries) / sizeof(spv_operand_desc_t), |
| 1106 | capabilityInfoEntries}, |
| 1107 | }; |
| 1108 | |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 1109 | spv_result_t spvOperandTableGet(spv_operand_table* pOperandTable) { |
Lei Zhang | 4005670 | 2015-09-11 14:31:27 -0400 | [diff] [blame] | 1110 | if (!pOperandTable) return SPV_ERROR_INVALID_POINTER; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1111 | |
| 1112 | static const spv_operand_table_t table = { |
| 1113 | sizeof(opcodeEntryTypes) / sizeof(spv_operand_desc_group_t), |
| 1114 | opcodeEntryTypes}; |
| 1115 | |
| 1116 | *pOperandTable = &table; |
| 1117 | |
| 1118 | return SPV_SUCCESS; |
| 1119 | } |
| 1120 | |
| 1121 | spv_result_t spvOperandTableNameLookup(const spv_operand_table table, |
| 1122 | const spv_operand_type_t type, |
David Neto | 388c40d | 2015-09-16 16:42:56 -0400 | [diff] [blame] | 1123 | const char* name, |
| 1124 | const size_t nameLength, |
| 1125 | spv_operand_desc* pEntry) { |
Lei Zhang | 4005670 | 2015-09-11 14:31:27 -0400 | [diff] [blame] | 1126 | if (!table) return SPV_ERROR_INVALID_TABLE; |
| 1127 | if (!name || !pEntry) return SPV_ERROR_INVALID_POINTER; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1128 | |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1129 | for (uint64_t typeIndex = 0; typeIndex < table->count; ++typeIndex) { |
| 1130 | if (type == table->types[typeIndex].type) { |
| 1131 | for (uint64_t operandIndex = 0; |
| 1132 | operandIndex < table->types[typeIndex].count; ++operandIndex) { |
| 1133 | if (nameLength == |
| 1134 | strlen(table->types[typeIndex].entries[operandIndex].name) && |
| 1135 | !strncmp(table->types[typeIndex].entries[operandIndex].name, name, |
David Neto | 388c40d | 2015-09-16 16:42:56 -0400 | [diff] [blame] | 1136 | nameLength)) { |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1137 | *pEntry = &table->types[typeIndex].entries[operandIndex]; |
| 1138 | return SPV_SUCCESS; |
| 1139 | } |
| 1140 | } |
| 1141 | } |
| 1142 | } |
| 1143 | |
| 1144 | return SPV_ERROR_INVALID_LOOKUP; |
| 1145 | } |
| 1146 | |
| 1147 | spv_result_t spvOperandTableValueLookup(const spv_operand_table table, |
| 1148 | const spv_operand_type_t type, |
| 1149 | const uint32_t value, |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 1150 | spv_operand_desc* pEntry) { |
Lei Zhang | 4005670 | 2015-09-11 14:31:27 -0400 | [diff] [blame] | 1151 | if (!table) return SPV_ERROR_INVALID_TABLE; |
| 1152 | if (!pEntry) return SPV_ERROR_INVALID_POINTER; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1153 | |
| 1154 | for (uint64_t typeIndex = 0; typeIndex < table->count; ++typeIndex) { |
| 1155 | if (type == table->types[typeIndex].type) { |
| 1156 | for (uint64_t operandIndex = 0; |
| 1157 | operandIndex < table->types[typeIndex].count; ++operandIndex) { |
| 1158 | if (value == table->types[typeIndex].entries[operandIndex].value) { |
| 1159 | *pEntry = &table->types[typeIndex].entries[operandIndex]; |
| 1160 | return SPV_SUCCESS; |
| 1161 | } |
| 1162 | } |
| 1163 | } |
| 1164 | } |
| 1165 | |
| 1166 | return SPV_ERROR_INVALID_LOOKUP; |
| 1167 | } |
| 1168 | |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 1169 | const char* spvOperandTypeStr(spv_operand_type_t type) { |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1170 | switch (type) { |
| 1171 | case SPV_OPERAND_TYPE_ID: |
David Neto | fadbf62 | 2015-09-14 17:07:11 -0400 | [diff] [blame] | 1172 | case SPV_OPERAND_TYPE_OPTIONAL_ID: |
David Neto | fadbf62 | 2015-09-14 17:07:11 -0400 | [diff] [blame] | 1173 | return "ID"; |
David Neto | 201caf7 | 2015-11-04 17:38:17 -0500 | [diff] [blame] | 1174 | case SPV_OPERAND_TYPE_TYPE_ID: |
| 1175 | return "type ID"; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1176 | case SPV_OPERAND_TYPE_RESULT_ID: |
| 1177 | return "result ID"; |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 1178 | case SPV_OPERAND_TYPE_LITERAL_INTEGER: |
David Neto | 201caf7 | 2015-11-04 17:38:17 -0500 | [diff] [blame] | 1179 | case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER: |
| 1180 | case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_NUMBER: |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1181 | return "literal number"; |
David Neto | 201caf7 | 2015-11-04 17:38:17 -0500 | [diff] [blame] | 1182 | case SPV_OPERAND_TYPE_OPTIONAL_TYPED_LITERAL_INTEGER: |
| 1183 | return "possibly multi-word literal integer"; |
| 1184 | case SPV_OPERAND_TYPE_TYPED_LITERAL_NUMBER: |
| 1185 | return "possibly multi-word literal number"; |
| 1186 | case SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER: |
| 1187 | return "extension instruction number"; |
David Neto | 0f166be | 2015-11-11 01:56:49 -0500 | [diff] [blame] | 1188 | case SPV_OPERAND_TYPE_SPEC_CONSTANT_OP_NUMBER: |
| 1189 | return "OpSpecConstantOp opcode"; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1190 | case SPV_OPERAND_TYPE_LITERAL_STRING: |
David Neto | 201caf7 | 2015-11-04 17:38:17 -0500 | [diff] [blame] | 1191 | case SPV_OPERAND_TYPE_OPTIONAL_LITERAL_STRING: |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1192 | return "literal string"; |
| 1193 | case SPV_OPERAND_TYPE_SOURCE_LANGUAGE: |
Dejan Mircevski | d2c81cf | 2015-10-09 11:06:10 -0400 | [diff] [blame] | 1194 | return "source language"; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1195 | case SPV_OPERAND_TYPE_EXECUTION_MODEL: |
| 1196 | return "execution model"; |
| 1197 | case SPV_OPERAND_TYPE_ADDRESSING_MODEL: |
| 1198 | return "addressing model"; |
| 1199 | case SPV_OPERAND_TYPE_MEMORY_MODEL: |
| 1200 | return "memory model"; |
| 1201 | case SPV_OPERAND_TYPE_EXECUTION_MODE: |
David Neto | 201caf7 | 2015-11-04 17:38:17 -0500 | [diff] [blame] | 1202 | case SPV_OPERAND_TYPE_OPTIONAL_EXECUTION_MODE: |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1203 | return "execution mode"; |
| 1204 | case SPV_OPERAND_TYPE_STORAGE_CLASS: |
| 1205 | return "storage class"; |
| 1206 | case SPV_OPERAND_TYPE_DIMENSIONALITY: |
| 1207 | return "dimensionality"; |
| 1208 | case SPV_OPERAND_TYPE_SAMPLER_ADDRESSING_MODE: |
| 1209 | return "addressing mode"; |
| 1210 | case SPV_OPERAND_TYPE_SAMPLER_FILTER_MODE: |
| 1211 | return "sampler filter mode"; |
David Neto | b30a0c5 | 2015-09-16 15:56:43 -0400 | [diff] [blame] | 1212 | case SPV_OPERAND_TYPE_SAMPLER_IMAGE_FORMAT: |
Dejan Mircevski | 971b344 | 2015-10-13 12:54:47 -0400 | [diff] [blame] | 1213 | return "image format"; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1214 | case SPV_OPERAND_TYPE_FP_FAST_MATH_MODE: |
Dejan Mircevski | 355cc0c | 2015-10-13 15:02:03 -0400 | [diff] [blame] | 1215 | return "floating-point fast math mode"; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1216 | case SPV_OPERAND_TYPE_FP_ROUNDING_MODE: |
Dejan Mircevski | 355cc0c | 2015-10-13 15:02:03 -0400 | [diff] [blame] | 1217 | return "floating-point rounding mode"; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1218 | case SPV_OPERAND_TYPE_LINKAGE_TYPE: |
| 1219 | return "linkage type"; |
| 1220 | case SPV_OPERAND_TYPE_ACCESS_QUALIFIER: |
| 1221 | return "access qualifier"; |
| 1222 | case SPV_OPERAND_TYPE_FUNCTION_PARAMETER_ATTRIBUTE: |
| 1223 | return "function parameter attribute"; |
| 1224 | case SPV_OPERAND_TYPE_DECORATION: |
| 1225 | return "decoration"; |
| 1226 | case SPV_OPERAND_TYPE_BUILT_IN: |
Dejan Mircevski | d7b0f83 | 2015-10-13 15:39:38 -0400 | [diff] [blame] | 1227 | return "built-in"; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1228 | case SPV_OPERAND_TYPE_SELECTION_CONTROL: |
| 1229 | return "selection control"; |
| 1230 | case SPV_OPERAND_TYPE_LOOP_CONTROL: |
| 1231 | return "loop control"; |
| 1232 | case SPV_OPERAND_TYPE_FUNCTION_CONTROL: |
| 1233 | return "function control"; |
David Neto | 64a9be9 | 2015-11-18 15:48:32 -0500 | [diff] [blame] | 1234 | case SPV_OPERAND_TYPE_MEMORY_SEMANTICS_ID: |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1235 | return "memory semantics"; |
David Neto | 201caf7 | 2015-11-04 17:38:17 -0500 | [diff] [blame] | 1236 | case SPV_OPERAND_TYPE_MEMORY_ACCESS: |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1237 | case SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS: |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1238 | return "memory access"; |
David Neto | 64a9be9 | 2015-11-18 15:48:32 -0500 | [diff] [blame] | 1239 | case SPV_OPERAND_TYPE_SCOPE_ID: |
David Neto | fadbf62 | 2015-09-14 17:07:11 -0400 | [diff] [blame] | 1240 | return "execution scope ID"; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1241 | case SPV_OPERAND_TYPE_GROUP_OPERATION: |
| 1242 | return "group operation"; |
| 1243 | case SPV_OPERAND_TYPE_KERNEL_ENQ_FLAGS: |
| 1244 | return "kernel enqeue flags"; |
David Neto | 4799482 | 2015-08-27 13:11:01 -0400 | [diff] [blame] | 1245 | case SPV_OPERAND_TYPE_KERNEL_PROFILING_INFO: |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1246 | return "kernel profiling info"; |
| 1247 | case SPV_OPERAND_TYPE_CAPABILITY: |
| 1248 | return "capability"; |
David Neto | 201caf7 | 2015-11-04 17:38:17 -0500 | [diff] [blame] | 1249 | case SPV_OPERAND_TYPE_IMAGE: |
David Neto | ee1b3bb | 2015-09-18 11:19:18 -0400 | [diff] [blame] | 1250 | case SPV_OPERAND_TYPE_OPTIONAL_IMAGE: |
| 1251 | return "image operand"; |
David Neto | 201caf7 | 2015-11-04 17:38:17 -0500 | [diff] [blame] | 1252 | case SPV_OPERAND_TYPE_OPTIONAL_CIV: |
| 1253 | return "context-insensitive value"; |
| 1254 | |
| 1255 | // The next values are for values returned from an instruction, not actually |
| 1256 | // an operand. So the specific strings don't matter. But let's add them |
| 1257 | // for completeness and ease of testing. |
| 1258 | case SPV_OPERAND_TYPE_IMAGE_CHANNEL_ORDER: |
| 1259 | return "image channel order"; |
| 1260 | case SPV_OPERAND_TYPE_IMAGE_CHANNEL_DATA_TYPE: |
| 1261 | return "image channel data type"; |
| 1262 | |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1263 | case SPV_OPERAND_TYPE_NONE: |
| 1264 | return "NONE"; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 1265 | default: |
| 1266 | assert(0 && "Unhandled operand type!"); |
| 1267 | break; |
| 1268 | } |
| 1269 | return "unknown"; |
| 1270 | } |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1271 | |
| 1272 | void spvPrependOperandTypes(const spv_operand_type_t* types, |
| 1273 | spv_operand_pattern_t* pattern) { |
| 1274 | const spv_operand_type_t* endTypes; |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 1275 | for (endTypes = types; *endTypes != SPV_OPERAND_TYPE_NONE; ++endTypes) |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1276 | ; |
| 1277 | pattern->insert(pattern->begin(), types, endTypes); |
| 1278 | } |
| 1279 | |
David Neto | 5bf88fc | 2015-09-17 17:06:10 -0400 | [diff] [blame] | 1280 | void spvPrependOperandTypesForMask(const spv_operand_table operandTable, |
| 1281 | const spv_operand_type_t type, |
| 1282 | const uint32_t mask, |
| 1283 | spv_operand_pattern_t* pattern) { |
| 1284 | // Scan from highest bits to lowest bits because we will prepend in LIFO |
| 1285 | // fashion, and we need the operands for lower order bits to appear first. |
| 1286 | for (uint32_t candidate_bit = (1 << 31); candidate_bit; candidate_bit >>= 1) { |
| 1287 | if (candidate_bit & mask) { |
| 1288 | spv_operand_desc entry = nullptr; |
| 1289 | if (SPV_SUCCESS == spvOperandTableValueLookup(operandTable, type, |
| 1290 | candidate_bit, &entry)) { |
| 1291 | spvPrependOperandTypes(entry->operandTypes, pattern); |
| 1292 | } |
| 1293 | } |
| 1294 | } |
| 1295 | } |
| 1296 | |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1297 | bool spvOperandIsOptional(spv_operand_type_t type) { |
David Neto | 201caf7 | 2015-11-04 17:38:17 -0500 | [diff] [blame] | 1298 | return SPV_OPERAND_TYPE_FIRST_OPTIONAL_TYPE <= type && |
| 1299 | type <= SPV_OPERAND_TYPE_LAST_OPTIONAL_TYPE; |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1300 | } |
| 1301 | |
| 1302 | bool spvOperandIsVariable(spv_operand_type_t type) { |
David Neto | 201caf7 | 2015-11-04 17:38:17 -0500 | [diff] [blame] | 1303 | return SPV_OPERAND_TYPE_FIRST_VARIABLE_TYPE <= type && |
| 1304 | type <= SPV_OPERAND_TYPE_LAST_VARIABLE_TYPE; |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1305 | } |
| 1306 | |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1307 | bool spvExpandOperandSequenceOnce(spv_operand_type_t type, |
| 1308 | spv_operand_pattern_t* pattern) { |
| 1309 | switch (type) { |
| 1310 | case SPV_OPERAND_TYPE_VARIABLE_ID: |
| 1311 | pattern->insert(pattern->begin(), {SPV_OPERAND_TYPE_OPTIONAL_ID, type}); |
| 1312 | return true; |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 1313 | case SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER: |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1314 | pattern->insert(pattern->begin(), |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 1315 | {SPV_OPERAND_TYPE_OPTIONAL_LITERAL_INTEGER, type}); |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1316 | return true; |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 1317 | case SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER_ID: |
David Neto | 201caf7 | 2015-11-04 17:38:17 -0500 | [diff] [blame] | 1318 | // Represents Zero or more (Literal number, Id) pairs, |
| 1319 | // where the literal number must be a scalar integer. |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1320 | pattern->insert(pattern->begin(), |
David Neto | 201caf7 | 2015-11-04 17:38:17 -0500 | [diff] [blame] | 1321 | {SPV_OPERAND_TYPE_OPTIONAL_TYPED_LITERAL_INTEGER, |
| 1322 | SPV_OPERAND_TYPE_ID, type}); |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1323 | return true; |
Lei Zhang | 6483bd7 | 2015-10-14 17:02:39 -0400 | [diff] [blame] | 1324 | case SPV_OPERAND_TYPE_VARIABLE_ID_LITERAL_INTEGER: |
David Neto | 561dc4e | 2015-09-25 14:23:29 -0400 | [diff] [blame] | 1325 | // Represents Zero or more (Id, Literal number) pairs. |
David Neto | 201caf7 | 2015-11-04 17:38:17 -0500 | [diff] [blame] | 1326 | pattern->insert(pattern->begin(), |
| 1327 | {SPV_OPERAND_TYPE_OPTIONAL_ID, |
| 1328 | SPV_OPERAND_TYPE_LITERAL_INTEGER, type}); |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1329 | return true; |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1330 | case SPV_OPERAND_TYPE_VARIABLE_EXECUTION_MODE: |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 1331 | pattern->insert(pattern->begin(), |
| 1332 | {SPV_OPERAND_TYPE_OPTIONAL_EXECUTION_MODE, type}); |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1333 | return true; |
| 1334 | default: |
| 1335 | break; |
| 1336 | } |
| 1337 | return false; |
| 1338 | } |
| 1339 | |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 1340 | spv_operand_type_t spvTakeFirstMatchableOperand( |
| 1341 | spv_operand_pattern_t* pattern) { |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1342 | assert(!pattern->empty()); |
| 1343 | spv_operand_type_t result; |
| 1344 | do { |
| 1345 | result = pattern->front(); |
| 1346 | pattern->pop_front(); |
Dejan Mircevski | 50babb2 | 2015-09-29 10:56:32 -0400 | [diff] [blame] | 1347 | } while (spvExpandOperandSequenceOnce(result, pattern)); |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 1348 | return result; |
| 1349 | } |
Dejan Mircevski | 903f9d6 | 2015-09-28 17:04:39 -0400 | [diff] [blame] | 1350 | |
Dejan Mircevski | 897bff9 | 2015-09-29 10:38:18 -0400 | [diff] [blame] | 1351 | spv_operand_pattern_t spvAlternatePatternFollowingImmediate( |
| 1352 | const spv_operand_pattern_t& pattern) { |
| 1353 | spv_operand_pattern_t alternatePattern; |
| 1354 | for (const auto& operand : pattern) { |
| 1355 | if (operand == SPV_OPERAND_TYPE_RESULT_ID) { |
| 1356 | alternatePattern.push_back(operand); |
| 1357 | alternatePattern.push_back(SPV_OPERAND_TYPE_OPTIONAL_CIV); |
| 1358 | return alternatePattern; |
Dejan Mircevski | 903f9d6 | 2015-09-28 17:04:39 -0400 | [diff] [blame] | 1359 | } |
Dejan Mircevski | 897bff9 | 2015-09-29 10:38:18 -0400 | [diff] [blame] | 1360 | alternatePattern.push_back(SPV_OPERAND_TYPE_OPTIONAL_CIV); |
Dejan Mircevski | 903f9d6 | 2015-09-28 17:04:39 -0400 | [diff] [blame] | 1361 | } |
Dejan Mircevski | 897bff9 | 2015-09-29 10:38:18 -0400 | [diff] [blame] | 1362 | // No result-id found, so just expect CIVs. |
| 1363 | return {SPV_OPERAND_TYPE_OPTIONAL_CIV}; |
Dejan Mircevski | 903f9d6 | 2015-09-28 17:04:39 -0400 | [diff] [blame] | 1364 | } |