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

Function ValidateBitFieldInsert

source/val/validate_bitwise.cpp:143–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143spv_result_t ValidateBitFieldInsert(ValidationState_t& _,
144 const Instruction* inst) {
145 const spv::Op opcode = inst->opcode();
146 const uint32_t result_type = inst->type_id();
147 const uint32_t base_type = _.GetOperandTypeId(inst, 2);
148 const uint32_t insert_type = _.GetOperandTypeId(inst, 3);
149 const uint32_t offset_type = _.GetOperandTypeId(inst, 4);
150 const uint32_t count_type = _.GetOperandTypeId(inst, 5);
151
152 if (spv_result_t error = ValidateBaseType(_, inst, base_type)) {
153 return error;
154 }
155
156 if (insert_type != result_type)
157 return _.diag(SPV_ERROR_INVALID_DATA, inst)
158 << "Expected Insert Type to be equal to Result Type: "
159 << spvOpcodeString(opcode);
160
161 if (!offset_type || !_.IsIntScalarType(offset_type))
162 return _.diag(SPV_ERROR_INVALID_DATA, inst)
163 << "Expected Offset Type to be int scalar: "
164 << spvOpcodeString(opcode);
165
166 if (!count_type || !_.IsIntScalarType(count_type))
167 return _.diag(SPV_ERROR_INVALID_DATA, inst)
168 << "Expected Count Type to be int scalar: "
169 << spvOpcodeString(opcode);
170 return SPV_SUCCESS;
171}
172
173spv_result_t ValidateBitFieldExtract(ValidationState_t& _,
174 const Instruction* inst) {

Callers 1

BitwisePassFunction · 0.85

Calls 7

ValidateBaseTypeFunction · 0.85
spvOpcodeStringFunction · 0.85
GetOperandTypeIdMethod · 0.80
diagMethod · 0.80
IsIntScalarTypeMethod · 0.80
opcodeMethod · 0.45
type_idMethod · 0.45

Tested by

no test coverage detected