Dejan Mircevski | b6fe02f | 2016-01-07 13:44:22 -0500 | [diff] [blame] | 1 | // Copyright (c) 2015-2016 The Khronos Group Inc. |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 2 | // |
David Neto | 9fc8658 | 2016-09-01 15:33:59 -0400 | [diff] [blame] | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 6 | // |
David Neto | 9fc8658 | 2016-09-01 15:33:59 -0400 | [diff] [blame] | 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 8 | // |
David Neto | 9fc8658 | 2016-09-01 15:33:59 -0400 | [diff] [blame] | 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 14 | |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 15 | #include "opcode.h" |
| 16 | |
| 17 | #include <assert.h> |
| 18 | #include <string.h> |
| 19 | |
David Neto | 5a0b5ca | 2016-12-09 14:01:43 -0500 | [diff] [blame] | 20 | #include <algorithm> |
Lei Zhang | 972788b | 2015-11-12 13:48:30 -0500 | [diff] [blame] | 21 | #include <cstdlib> |
| 22 | |
Lei Zhang | 923f6c1 | 2015-11-11 12:45:23 -0500 | [diff] [blame] | 23 | #include "instruction.h" |
Lei Zhang | ca1bf94 | 2016-04-27 16:47:13 -0400 | [diff] [blame] | 24 | #include "macro.h" |
David Neto | 5a70335 | 2016-02-17 14:44:00 -0500 | [diff] [blame] | 25 | #include "spirv-tools/libspirv.h" |
Lei Zhang | aa056cd | 2015-11-11 14:24:04 -0500 | [diff] [blame] | 26 | #include "spirv_constant.h" |
David Neto | 4c21571 | 2015-12-22 15:08:41 -0500 | [diff] [blame] | 27 | #include "spirv_endian.h" |
Lei Zhang | 923f6c1 | 2015-11-11 12:45:23 -0500 | [diff] [blame] | 28 | |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 29 | namespace { |
Lei Zhang | 16981f8 | 2017-09-21 17:24:57 -0400 | [diff] [blame^] | 30 | struct OpcodeDescPtrLen { |
| 31 | const spv_opcode_desc_t* ptr; |
| 32 | uint32_t len; |
| 33 | }; |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 34 | |
Lei Zhang | 16981f8 | 2017-09-21 17:24:57 -0400 | [diff] [blame^] | 35 | OpcodeDescPtrLen getOpcodeTableEntries_1_2() { |
| 36 | static const spv_opcode_desc_t opcodeTableEntries_1_2[] = { |
David Neto | dbc2049 | 2017-03-14 12:43:41 -0400 | [diff] [blame] | 37 | #include "core.insts-1.2.inc" |
Lei Zhang | 16981f8 | 2017-09-21 17:24:57 -0400 | [diff] [blame^] | 38 | }; |
| 39 | |
| 40 | return {opcodeTableEntries_1_2, ARRAY_SIZE(opcodeTableEntries_1_2)}; |
| 41 | } |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 42 | |
David Neto | 5a0b5ca | 2016-12-09 14:01:43 -0500 | [diff] [blame] | 43 | // Represents a vendor tool entry in the SPIR-V XML Regsitry. |
| 44 | struct VendorTool { |
| 45 | uint32_t value; |
| 46 | const char* vendor; |
Lei Zhang | 16981f8 | 2017-09-21 17:24:57 -0400 | [diff] [blame^] | 47 | const char* tool; // Might be empty string. |
| 48 | const char* vendor_tool; // Combiantion of vendor and tool. |
David Neto | 5a0b5ca | 2016-12-09 14:01:43 -0500 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | const VendorTool vendor_tools[] = { |
| 52 | #include "generators.inc" |
| 53 | }; |
| 54 | |
Lei Zhang | a94701d | 2015-09-14 10:05:37 -0400 | [diff] [blame] | 55 | } // anonymous namespace |
David Neto | 78c3b43 | 2015-08-27 13:03:52 -0400 | [diff] [blame] | 56 | |
David Neto | 5a0b5ca | 2016-12-09 14:01:43 -0500 | [diff] [blame] | 57 | // TODO(dneto): Move this to another file. It doesn't belong with opcode |
| 58 | // processing. |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 59 | const char* spvGeneratorStr(uint32_t generator) { |
David Neto | 5a0b5ca | 2016-12-09 14:01:43 -0500 | [diff] [blame] | 60 | auto where = std::find_if( |
| 61 | std::begin(vendor_tools), std::end(vendor_tools), |
| 62 | [generator](const VendorTool& vt) { return generator == vt.value; }); |
| 63 | if (where != std::end(vendor_tools)) return where->vendor_tool; |
| 64 | return "Unknown"; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 65 | } |
| 66 | |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 67 | uint32_t spvOpcodeMake(uint16_t wordCount, SpvOp opcode) { |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 68 | return ((uint32_t)opcode) | (((uint32_t)wordCount) << 16); |
| 69 | } |
| 70 | |
Lei Zhang | 6fa3f8a | 2016-03-31 17:26:31 -0400 | [diff] [blame] | 71 | void spvOpcodeSplit(const uint32_t word, uint16_t* pWordCount, |
| 72 | uint16_t* pOpcode) { |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 73 | if (pWordCount) { |
| 74 | *pWordCount = (uint16_t)((0xffff0000 & word) >> 16); |
| 75 | } |
| 76 | if (pOpcode) { |
Lei Zhang | 6fa3f8a | 2016-03-31 17:26:31 -0400 | [diff] [blame] | 77 | *pOpcode = 0x0000ffff & word; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 78 | } |
| 79 | } |
| 80 | |
Dejan Mircevski | cb3c49e | 2016-04-07 14:41:34 -0400 | [diff] [blame] | 81 | spv_result_t spvOpcodeTableGet(spv_opcode_table* pInstTable, |
| 82 | spv_target_env env) { |
Lei Zhang | 4005670 | 2015-09-11 14:31:27 -0400 | [diff] [blame] | 83 | if (!pInstTable) return SPV_ERROR_INVALID_POINTER; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 84 | |
Lei Zhang | 16981f8 | 2017-09-21 17:24:57 -0400 | [diff] [blame^] | 85 | // Descriptions of each opcode. Each entry describes the format of the |
| 86 | // instruction that follows a particular opcode. |
| 87 | static const spv_opcode_desc_t opcodeTableEntries_1_0[] = { |
| 88 | #include "core.insts-1.0.inc" |
| 89 | }; |
| 90 | static const spv_opcode_desc_t opcodeTableEntries_1_1[] = { |
| 91 | #include "core.insts-1.1.inc" |
| 92 | }; |
| 93 | |
| 94 | const auto ptr_len = getOpcodeTableEntries_1_2(); |
| 95 | |
Dejan Mircevski | cb3c49e | 2016-04-07 14:41:34 -0400 | [diff] [blame] | 96 | static const spv_opcode_table_t table_1_0 = { |
| 97 | ARRAY_SIZE(opcodeTableEntries_1_0), opcodeTableEntries_1_0}; |
| 98 | static const spv_opcode_table_t table_1_1 = { |
| 99 | ARRAY_SIZE(opcodeTableEntries_1_1), opcodeTableEntries_1_1}; |
Lei Zhang | 16981f8 | 2017-09-21 17:24:57 -0400 | [diff] [blame^] | 100 | static const spv_opcode_table_t table_1_2 = {ptr_len.len, ptr_len.ptr}; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 101 | |
Dejan Mircevski | cb3c49e | 2016-04-07 14:41:34 -0400 | [diff] [blame] | 102 | switch (env) { |
| 103 | case SPV_ENV_UNIVERSAL_1_0: |
| 104 | case SPV_ENV_VULKAN_1_0: |
David Neto | c296701 | 2016-08-05 18:19:30 -0400 | [diff] [blame] | 105 | case SPV_ENV_OPENCL_2_1: |
| 106 | case SPV_ENV_OPENGL_4_0: |
| 107 | case SPV_ENV_OPENGL_4_1: |
| 108 | case SPV_ENV_OPENGL_4_2: |
| 109 | case SPV_ENV_OPENGL_4_3: |
| 110 | case SPV_ENV_OPENGL_4_5: |
Dejan Mircevski | cb3c49e | 2016-04-07 14:41:34 -0400 | [diff] [blame] | 111 | *pInstTable = &table_1_0; |
| 112 | return SPV_SUCCESS; |
| 113 | case SPV_ENV_UNIVERSAL_1_1: |
| 114 | *pInstTable = &table_1_1; |
| 115 | return SPV_SUCCESS; |
David Neto | dbc2049 | 2017-03-14 12:43:41 -0400 | [diff] [blame] | 116 | case SPV_ENV_UNIVERSAL_1_2: |
| 117 | case SPV_ENV_OPENCL_2_2: |
| 118 | *pInstTable = &table_1_2; |
| 119 | return SPV_SUCCESS; |
Dejan Mircevski | cb3c49e | 2016-04-07 14:41:34 -0400 | [diff] [blame] | 120 | } |
| 121 | assert(0 && "Unknown spv_target_env in spvOpcodeTableGet()"); |
| 122 | return SPV_ERROR_INVALID_TABLE; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | spv_result_t spvOpcodeTableNameLookup(const spv_opcode_table table, |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 126 | const char* name, |
| 127 | spv_opcode_desc* pEntry) { |
Lei Zhang | 4005670 | 2015-09-11 14:31:27 -0400 | [diff] [blame] | 128 | if (!name || !pEntry) return SPV_ERROR_INVALID_POINTER; |
| 129 | if (!table) return SPV_ERROR_INVALID_TABLE; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 130 | |
| 131 | // TODO: This lookup of the Opcode table is suboptimal! Binary sort would be |
| 132 | // preferable but the table requires sorting on the Opcode name, but it's |
| 133 | // static |
| 134 | // const initialized and matches the order of the spec. |
| 135 | const size_t nameLength = strlen(name); |
| 136 | for (uint64_t opcodeIndex = 0; opcodeIndex < table->count; ++opcodeIndex) { |
| 137 | if (nameLength == strlen(table->entries[opcodeIndex].name) && |
| 138 | !strncmp(name, table->entries[opcodeIndex].name, nameLength)) { |
| 139 | // NOTE: Found out Opcode! |
| 140 | *pEntry = &table->entries[opcodeIndex]; |
| 141 | return SPV_SUCCESS; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | return SPV_ERROR_INVALID_LOOKUP; |
| 146 | } |
| 147 | |
| 148 | spv_result_t spvOpcodeTableValueLookup(const spv_opcode_table table, |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 149 | const SpvOp opcode, |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 150 | spv_opcode_desc* pEntry) { |
Lei Zhang | 4005670 | 2015-09-11 14:31:27 -0400 | [diff] [blame] | 151 | if (!table) return SPV_ERROR_INVALID_TABLE; |
| 152 | if (!pEntry) return SPV_ERROR_INVALID_POINTER; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 153 | |
| 154 | // TODO: As above this lookup is not optimal. |
| 155 | for (uint64_t opcodeIndex = 0; opcodeIndex < table->count; ++opcodeIndex) { |
| 156 | if (opcode == table->entries[opcodeIndex].opcode) { |
| 157 | // NOTE: Found the Opcode! |
| 158 | *pEntry = &table->entries[opcodeIndex]; |
| 159 | return SPV_SUCCESS; |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | return SPV_ERROR_INVALID_LOOKUP; |
| 164 | } |
| 165 | |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 166 | void spvInstructionCopy(const uint32_t* words, const SpvOp opcode, |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 167 | const uint16_t wordCount, const spv_endianness_t endian, |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 168 | spv_instruction_t* pInst) { |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 169 | pInst->opcode = opcode; |
David Neto | b5dc8fc | 2015-10-06 16:22:00 -0400 | [diff] [blame] | 170 | pInst->words.resize(wordCount); |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 171 | for (uint16_t wordIndex = 0; wordIndex < wordCount; ++wordIndex) { |
| 172 | pInst->words[wordIndex] = spvFixWord(words[wordIndex], endian); |
| 173 | if (!wordIndex) { |
| 174 | uint16_t thisWordCount; |
Lei Zhang | 6fa3f8a | 2016-03-31 17:26:31 -0400 | [diff] [blame] | 175 | uint16_t thisOpcode; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 176 | spvOpcodeSplit(pInst->words[wordIndex], &thisWordCount, &thisOpcode); |
Lei Zhang | 6fa3f8a | 2016-03-31 17:26:31 -0400 | [diff] [blame] | 177 | assert(opcode == static_cast<SpvOp>(thisOpcode) && |
| 178 | wordCount == thisWordCount && "Endianness failed!"); |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 179 | } |
| 180 | } |
| 181 | } |
| 182 | |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 183 | const char* spvOpcodeString(const SpvOp opcode) { |
Dejan Mircevski | cb3c49e | 2016-04-07 14:41:34 -0400 | [diff] [blame] | 184 | // Use the latest SPIR-V version, which should be backward-compatible with all |
| 185 | // previous ones. |
Lei Zhang | 16981f8 | 2017-09-21 17:24:57 -0400 | [diff] [blame^] | 186 | const auto entries = getOpcodeTableEntries_1_2(); |
| 187 | |
| 188 | for (uint32_t i = 0; i < entries.len; ++i) { |
| 189 | if (entries.ptr[i].opcode == opcode) return entries.ptr[i].name; |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 190 | } |
Lei Zhang | 16981f8 | 2017-09-21 17:24:57 -0400 | [diff] [blame^] | 191 | |
Lei Zhang | 4f293b7 | 2016-03-21 16:36:14 -0400 | [diff] [blame] | 192 | assert(0 && "Unreachable!"); |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 193 | return "unknown"; |
| 194 | } |
| 195 | |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 196 | int32_t spvOpcodeIsScalarType(const SpvOp opcode) { |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 197 | switch (opcode) { |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 198 | case SpvOpTypeInt: |
| 199 | case SpvOpTypeFloat: |
Dejan Mircevski | 276a724 | 2016-01-21 15:55:43 -0500 | [diff] [blame] | 200 | case SpvOpTypeBool: |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 201 | return true; |
| 202 | default: |
| 203 | return false; |
| 204 | } |
| 205 | } |
| 206 | |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 207 | int32_t spvOpcodeIsConstant(const SpvOp opcode) { |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 208 | switch (opcode) { |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 209 | case SpvOpConstantTrue: |
| 210 | case SpvOpConstantFalse: |
| 211 | case SpvOpConstant: |
| 212 | case SpvOpConstantComposite: |
| 213 | case SpvOpConstantSampler: |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 214 | case SpvOpConstantNull: |
| 215 | case SpvOpSpecConstantTrue: |
| 216 | case SpvOpSpecConstantFalse: |
| 217 | case SpvOpSpecConstant: |
| 218 | case SpvOpSpecConstantComposite: |
Dejan Mircevski | 3fb2676 | 2016-04-04 15:55:05 -0400 | [diff] [blame] | 219 | case SpvOpSpecConstantOp: |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 220 | return true; |
| 221 | default: |
| 222 | return false; |
| 223 | } |
| 224 | } |
| 225 | |
David Neto | 1f3fb50 | 2016-09-14 11:57:20 -0400 | [diff] [blame] | 226 | bool spvOpcodeIsConstantOrUndef(const SpvOp opcode) { |
| 227 | return opcode == SpvOpUndef || spvOpcodeIsConstant(opcode); |
| 228 | } |
| 229 | |
Aliya Pazylbekova | edb5264 | 2017-02-24 20:43:28 -0500 | [diff] [blame] | 230 | bool spvOpcodeIsScalarSpecConstant(const SpvOp opcode) { |
| 231 | switch (opcode) { |
| 232 | case SpvOpSpecConstantTrue: |
| 233 | case SpvOpSpecConstantFalse: |
| 234 | case SpvOpSpecConstant: |
| 235 | return true; |
| 236 | default: |
| 237 | return false; |
| 238 | } |
| 239 | } |
| 240 | |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 241 | int32_t spvOpcodeIsComposite(const SpvOp opcode) { |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 242 | switch (opcode) { |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 243 | case SpvOpTypeVector: |
| 244 | case SpvOpTypeMatrix: |
| 245 | case SpvOpTypeArray: |
| 246 | case SpvOpTypeStruct: |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 247 | return true; |
| 248 | default: |
| 249 | return false; |
| 250 | } |
| 251 | } |
| 252 | |
Ehsan Nasiri | 23af06c | 2017-02-01 15:37:39 -0500 | [diff] [blame] | 253 | bool spvOpcodeReturnsLogicalVariablePointer(const SpvOp opcode) { |
| 254 | switch (opcode) { |
| 255 | case SpvOpVariable: |
| 256 | case SpvOpAccessChain: |
| 257 | case SpvOpInBoundsAccessChain: |
| 258 | case SpvOpFunctionParameter: |
| 259 | case SpvOpImageTexelPointer: |
| 260 | case SpvOpCopyObject: |
| 261 | case SpvOpSelect: |
| 262 | case SpvOpPhi: |
| 263 | case SpvOpFunctionCall: |
| 264 | case SpvOpPtrAccessChain: |
| 265 | case SpvOpLoad: |
| 266 | case SpvOpConstantNull: |
| 267 | return true; |
| 268 | default: |
| 269 | return false; |
| 270 | } |
| 271 | } |
| 272 | |
Florian Ziesche | 66fcb45 | 2016-03-02 22:17:54 +0100 | [diff] [blame] | 273 | int32_t spvOpcodeReturnsLogicalPointer(const SpvOp opcode) { |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 274 | switch (opcode) { |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 275 | case SpvOpVariable: |
| 276 | case SpvOpAccessChain: |
| 277 | case SpvOpInBoundsAccessChain: |
| 278 | case SpvOpFunctionParameter: |
Florian Ziesche | 66fcb45 | 2016-03-02 22:17:54 +0100 | [diff] [blame] | 279 | case SpvOpImageTexelPointer: |
| 280 | case SpvOpCopyObject: |
Kenneth Benzie (Benie) | 83e5a29 | 2015-05-22 18:26:19 +0100 | [diff] [blame] | 281 | return true; |
| 282 | default: |
| 283 | return false; |
| 284 | } |
| 285 | } |
| 286 | |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 287 | int32_t spvOpcodeGeneratesType(SpvOp op) { |
Lei Zhang | 1a0334e | 2015-11-02 09:41:20 -0500 | [diff] [blame] | 288 | switch (op) { |
Lei Zhang | b36e704 | 2015-10-28 13:40:52 -0400 | [diff] [blame] | 289 | case SpvOpTypeVoid: |
| 290 | case SpvOpTypeBool: |
| 291 | case SpvOpTypeInt: |
| 292 | case SpvOpTypeFloat: |
| 293 | case SpvOpTypeVector: |
| 294 | case SpvOpTypeMatrix: |
| 295 | case SpvOpTypeImage: |
| 296 | case SpvOpTypeSampler: |
| 297 | case SpvOpTypeSampledImage: |
| 298 | case SpvOpTypeArray: |
| 299 | case SpvOpTypeRuntimeArray: |
| 300 | case SpvOpTypeStruct: |
| 301 | case SpvOpTypeOpaque: |
| 302 | case SpvOpTypePointer: |
| 303 | case SpvOpTypeFunction: |
| 304 | case SpvOpTypeEvent: |
| 305 | case SpvOpTypeDeviceEvent: |
| 306 | case SpvOpTypeReserveId: |
| 307 | case SpvOpTypeQueue: |
| 308 | case SpvOpTypePipe: |
Andrey Tuganov | 4ef3b3e | 2017-02-28 11:53:47 -0500 | [diff] [blame] | 309 | case SpvOpTypePipeStorage: |
| 310 | case SpvOpTypeNamedBarrier: |
Andrew Woloszyn | 537e776 | 2015-09-29 11:28:34 -0400 | [diff] [blame] | 311 | return true; |
David Neto | aef608c | 2015-11-02 14:59:02 -0500 | [diff] [blame] | 312 | default: |
| 313 | // In particular, OpTypeForwardPointer does not generate a type, |
| 314 | // but declares a storage class for a pointer type generated |
| 315 | // by a different instruction. |
| 316 | break; |
Andrew Woloszyn | 537e776 | 2015-09-29 11:28:34 -0400 | [diff] [blame] | 317 | } |
| 318 | return 0; |
| 319 | } |