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

Function ValidateReadWritePipe

source/val/validate_pipe.cpp:85–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85spv_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
117spv_result_t ValidateReservedReadWritePipe(ValidationState_t& _,
118 const Instruction* inst) {

Callers 1

PipePassFunction · 0.85

Calls 8

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

Tested by

no test coverage detected