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

Function ValidateReservePackets

source/val/validate_pipe.cpp:161–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161spv_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
188spv_result_t ValidateGroupReservePackets(ValidationState_t& _,
189 const Instruction* inst) {

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