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