MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / ValidateGroupReservePackets

Function ValidateGroupReservePackets

source/val/validate_pipe.cpp:188–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188spv_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
215spv_result_t ValidateCommitPipe(ValidationState_t& _, const Instruction* inst) {
216 if (inst->opcode() == spv::Op::OpCommitReadPipe) {

Callers 1

PipePassFunction · 0.85

Calls 8

ValidatePipeTypeFunction · 0.85
ValidatePacketSizeAlignFunction · 0.85
FindDefMethod · 0.80
diagMethod · 0.80
GetOperandTypeIdMethod · 0.80
IsIntScalarTypeMethod · 0.80
type_idMethod · 0.45
opcodeMethod · 0.45

Tested by

no test coverage detected