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