| 514 | } |
| 515 | |
| 516 | spv_result_t ValidateGroupDecorate(ValidationState_t& _, |
| 517 | const Instruction* inst) { |
| 518 | const auto decoration_group_id = inst->GetOperandAs<uint32_t>(0); |
| 519 | auto decoration_group = _.FindDef(decoration_group_id); |
| 520 | if (!decoration_group || |
| 521 | spv::Op::OpDecorationGroup != decoration_group->opcode()) { |
| 522 | return _.diag(SPV_ERROR_INVALID_ID, inst) |
| 523 | << "OpGroupDecorate Decoration group <id> " |
| 524 | << _.getIdName(decoration_group_id) << " is not a decoration group."; |
| 525 | } |
| 526 | for (unsigned i = 1; i < inst->operands().size(); ++i) { |
| 527 | auto target_id = inst->GetOperandAs<uint32_t>(i); |
| 528 | auto target = _.FindDef(target_id); |
| 529 | if (!target || target->opcode() == spv::Op::OpDecorationGroup) { |
| 530 | return _.diag(SPV_ERROR_INVALID_ID, inst) |
| 531 | << "OpGroupDecorate may not target OpDecorationGroup <id> " |
| 532 | << _.getIdName(target_id); |
| 533 | } |
| 534 | } |
| 535 | return SPV_SUCCESS; |
| 536 | } |
| 537 | |
| 538 | spv_result_t ValidateGroupMemberDecorate(ValidationState_t& _, |
| 539 | const Instruction* inst) { |