| 186 | } |
| 187 | |
| 188 | spv_result_t ValidateGroupReservePackets(ValidationState_t& _, |
| 189 | const Instruction* inst) { |
| 190 | const Instruction* result_type = _.FindDef(inst->type_id()); |
| 191 | if (result_type->opcode() != spv::Op::OpTypeReserveId) { |
| 192 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 193 | << "Result Type must be OpTypeReserveId."; |
| 194 | } |
| 195 | |
| 196 | if (inst->opcode() == spv::Op::OpGroupReserveReadPipePackets) { |
| 197 | if (auto error = ValidatePipeType(_, inst, 3, ValidPipeType::READ_ONLY)) |
| 198 | return error; |
| 199 | } else if (inst->opcode() == spv::Op::OpGroupReserveWritePipePackets) { |
| 200 | if (auto error = ValidatePipeType(_, inst, 3, ValidPipeType::WRITE_ONLY)) |
| 201 | return error; |
| 202 | } |
| 203 | |
| 204 | const uint32_t num_packets_id = _.GetOperandTypeId(inst, 4); |
| 205 | if (!_.IsIntScalarType(num_packets_id, 32)) { |
| 206 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 207 | << "Num Packets must be a 32-bit scalar integer."; |
| 208 | } |
| 209 | |
| 210 | if (auto error = ValidatePacketSizeAlign(_, inst, 5, 6)) return error; |
| 211 | |
| 212 | return SPV_SUCCESS; |
| 213 | } |
| 214 | |
| 215 | spv_result_t ValidateCommitPipe(ValidationState_t& _, const Instruction* inst) { |
| 216 | if (inst->opcode() == spv::Op::OpCommitReadPipe) { |
no test coverage detected