| 159 | } |
| 160 | |
| 161 | spv_result_t ValidateReservePackets(ValidationState_t& _, |
| 162 | const Instruction* inst) { |
| 163 | const Instruction* result_type = _.FindDef(inst->type_id()); |
| 164 | if (result_type->opcode() != spv::Op::OpTypeReserveId) { |
| 165 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 166 | << "Result Type must be OpTypeReserveId."; |
| 167 | } |
| 168 | |
| 169 | if (inst->opcode() == spv::Op::OpReserveReadPipePackets) { |
| 170 | if (auto error = ValidatePipeType(_, inst, 2, ValidPipeType::READ_ONLY)) |
| 171 | return error; |
| 172 | } else if (inst->opcode() == spv::Op::OpReserveWritePipePackets) { |
| 173 | if (auto error = ValidatePipeType(_, inst, 2, ValidPipeType::WRITE_ONLY)) |
| 174 | return error; |
| 175 | } |
| 176 | |
| 177 | const uint32_t num_packets_id = _.GetOperandTypeId(inst, 3); |
| 178 | if (!_.IsIntScalarType(num_packets_id, 32)) { |
| 179 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 180 | << "Num Packets must be a 32-bit scalar integer."; |
| 181 | } |
| 182 | |
| 183 | if (auto error = ValidatePacketSizeAlign(_, inst, 4, 5)) return error; |
| 184 | |
| 185 | return SPV_SUCCESS; |
| 186 | } |
| 187 | |
| 188 | spv_result_t ValidateGroupReservePackets(ValidationState_t& _, |
| 189 | const Instruction* inst) { |
no test coverage detected