@@ -1183,6 +1183,28 @@ void Builder::addExecutionMode(Function* entryPoint, ExecutionMode mode, int val
1183
1183
executionModes.push_back (std::unique_ptr<Instruction>(instr));
1184
1184
}
1185
1185
1186
+ void Builder::addExecutionMode (Function* entryPoint, ExecutionMode mode, const std::vector<unsigned >& literals)
1187
+ {
1188
+ Instruction* instr = new Instruction (OpExecutionMode);
1189
+ instr->addIdOperand (entryPoint->getId ());
1190
+ instr->addImmediateOperand (mode);
1191
+ for (auto literal : literals)
1192
+ instr->addImmediateOperand (literal);
1193
+
1194
+ executionModes.push_back (std::unique_ptr<Instruction>(instr));
1195
+ }
1196
+
1197
+ void Builder::addExecutionModeId (Function* entryPoint, ExecutionMode mode, const std::vector<Id>& operandIds)
1198
+ {
1199
+ Instruction* instr = new Instruction (OpExecutionModeId);
1200
+ instr->addIdOperand (entryPoint->getId ());
1201
+ instr->addImmediateOperand (mode);
1202
+ for (auto operandId : operandIds)
1203
+ instr->addIdOperand (operandId);
1204
+
1205
+ executionModes.push_back (std::unique_ptr<Instruction>(instr));
1206
+ }
1207
+
1186
1208
void Builder::addName (Id id, const char * string)
1187
1209
{
1188
1210
Instruction* name = new Instruction (OpName);
@@ -1221,14 +1243,42 @@ void Builder::addDecoration(Id id, Decoration decoration, const char* s)
1221
1243
if (decoration == spv::DecorationMax)
1222
1244
return ;
1223
1245
1224
- Instruction* dec = new Instruction (OpDecorateStringGOOGLE );
1246
+ Instruction* dec = new Instruction (OpDecorateString );
1225
1247
dec->addIdOperand (id);
1226
1248
dec->addImmediateOperand (decoration);
1227
1249
dec->addStringOperand (s);
1228
1250
1229
1251
decorations.push_back (std::unique_ptr<Instruction>(dec));
1230
1252
}
1231
1253
1254
+ void Builder::addDecoration (Id id, Decoration decoration, const std::vector<unsigned >& literals)
1255
+ {
1256
+ if (decoration == spv::DecorationMax)
1257
+ return ;
1258
+
1259
+ Instruction* dec = new Instruction (OpDecorate);
1260
+ dec->addIdOperand (id);
1261
+ dec->addImmediateOperand (decoration);
1262
+ for (auto literal : literals)
1263
+ dec->addImmediateOperand (literal);
1264
+
1265
+ decorations.push_back (std::unique_ptr<Instruction>(dec));
1266
+ }
1267
+
1268
+ void Builder::addDecoration (Id id, Decoration decoration, const std::vector<const char *>& strings)
1269
+ {
1270
+ if (decoration == spv::DecorationMax)
1271
+ return ;
1272
+
1273
+ Instruction* dec = new Instruction (OpDecorateString);
1274
+ dec->addIdOperand (id);
1275
+ dec->addImmediateOperand (decoration);
1276
+ for (auto string : strings)
1277
+ dec->addStringOperand (string);
1278
+
1279
+ decorations.push_back (std::unique_ptr<Instruction>(dec));
1280
+ }
1281
+
1232
1282
void Builder::addDecorationId (Id id, Decoration decoration, Id idDecoration)
1233
1283
{
1234
1284
if (decoration == spv::DecorationMax)
@@ -1242,6 +1292,21 @@ void Builder::addDecorationId(Id id, Decoration decoration, Id idDecoration)
1242
1292
decorations.push_back (std::unique_ptr<Instruction>(dec));
1243
1293
}
1244
1294
1295
+ void Builder::addDecorationId (Id id, Decoration decoration, const std::vector<Id>& operandIds)
1296
+ {
1297
+ if (decoration == spv::DecorationMax)
1298
+ return ;
1299
+
1300
+ Instruction* dec = new Instruction (OpDecorateId);
1301
+ dec->addIdOperand (id);
1302
+ dec->addImmediateOperand (decoration);
1303
+
1304
+ for (auto operandId : operandIds)
1305
+ dec->addIdOperand (operandId);
1306
+
1307
+ decorations.push_back (std::unique_ptr<Instruction>(dec));
1308
+ }
1309
+
1245
1310
void Builder::addMemberDecoration (Id id, unsigned int member, Decoration decoration, int num)
1246
1311
{
1247
1312
if (decoration == spv::DecorationMax)
@@ -1271,6 +1336,36 @@ void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decorat
1271
1336
decorations.push_back (std::unique_ptr<Instruction>(dec));
1272
1337
}
1273
1338
1339
+ void Builder::addMemberDecoration (Id id, unsigned int member, Decoration decoration, const std::vector<unsigned >& literals)
1340
+ {
1341
+ if (decoration == spv::DecorationMax)
1342
+ return ;
1343
+
1344
+ Instruction* dec = new Instruction (OpMemberDecorate);
1345
+ dec->addIdOperand (id);
1346
+ dec->addImmediateOperand (member);
1347
+ dec->addImmediateOperand (decoration);
1348
+ for (auto literal : literals)
1349
+ dec->addImmediateOperand (literal);
1350
+
1351
+ decorations.push_back (std::unique_ptr<Instruction>(dec));
1352
+ }
1353
+
1354
+ void Builder::addMemberDecoration (Id id, unsigned int member, Decoration decoration, const std::vector<const char *>& strings)
1355
+ {
1356
+ if (decoration == spv::DecorationMax)
1357
+ return ;
1358
+
1359
+ Instruction* dec = new Instruction (OpMemberDecorateString);
1360
+ dec->addIdOperand (id);
1361
+ dec->addImmediateOperand (member);
1362
+ dec->addImmediateOperand (decoration);
1363
+ for (auto string : strings)
1364
+ dec->addStringOperand (string);
1365
+
1366
+ decorations.push_back (std::unique_ptr<Instruction>(dec));
1367
+ }
1368
+
1274
1369
// Comments in header
1275
1370
Function* Builder::makeEntryPoint (const char * entryPoint)
1276
1371
{
0 commit comments