| 83 | } |
| 84 | |
| 85 | spv_result_t ValidateReadWritePipe(ValidationState_t& _, |
| 86 | const Instruction* inst) { |
| 87 | const uint32_t result_type = inst->type_id(); |
| 88 | if (!_.IsIntScalarType(result_type, 32)) { |
| 89 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 90 | << "Result Type must be a 32-bit int scalar."; |
| 91 | } |
| 92 | |
| 93 | if (inst->opcode() == spv::Op::OpReadPipe) { |
| 94 | if (auto error = ValidatePipeType(_, inst, 2, ValidPipeType::READ_ONLY)) |
| 95 | return error; |
| 96 | } else if (inst->opcode() == spv::Op::OpWritePipe) { |
| 97 | if (auto error = ValidatePipeType(_, inst, 2, ValidPipeType::WRITE_ONLY)) |
| 98 | return error; |
| 99 | } |
| 100 | |
| 101 | const Instruction* pointer_type = _.FindDef(_.GetOperandTypeId(inst, 3)); |
| 102 | if (pointer_type->opcode() != spv::Op::OpTypePointer) { |
| 103 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 104 | << "Pointer must be a type of OpTypePointer."; |
| 105 | } |
| 106 | if (pointer_type->GetOperandAs<spv::StorageClass>(1) != |
| 107 | spv::StorageClass::Generic) { |
| 108 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 109 | << "Pointer must be a OpTypePointer with a Generic storage class."; |
| 110 | } |
| 111 | |
| 112 | if (auto error = ValidatePacketSizeAlign(_, inst, 4, 5)) return error; |
| 113 | |
| 114 | return SPV_SUCCESS; |
| 115 | } |
| 116 | |
| 117 | spv_result_t ValidateReservedReadWritePipe(ValidationState_t& _, |
| 118 | const Instruction* inst) { |
no test coverage detected