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

Function ValidateSatConvertInt

source/val/validate_conversion.cpp:414–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412}
413
414spv_result_t ValidateSatConvertInt(ValidationState_t& _,
415 const Instruction* inst) {
416 const spv::Op opcode = inst->opcode();
417 const uint32_t result_type = inst->type_id();
418 if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type))
419 return _.diag(SPV_ERROR_INVALID_DATA, inst)
420 << "Expected int scalar or vector type as Result Type: "
421 << spvOpcodeString(opcode);
422
423 const uint32_t input_type = _.GetOperandTypeId(inst, 2);
424 if (!input_type ||
425 (!_.IsIntScalarType(input_type) && !_.IsIntVectorType(input_type)))
426 return _.diag(SPV_ERROR_INVALID_DATA, inst)
427 << "Expected int scalar or vector as input: "
428 << spvOpcodeString(opcode);
429
430 if (_.GetDimension(result_type) != _.GetDimension(input_type))
431 return _.diag(SPV_ERROR_INVALID_DATA, inst)
432 << "Expected input to have the same dimension as Result Type: "
433 << spvOpcodeString(opcode);
434 return SPV_SUCCESS;
435}
436
437spv_result_t ValidateConvertUToPtr(ValidationState_t& _,
438 const Instruction* inst,

Callers 1

ConversionPassFunction · 0.85

Calls 8

spvOpcodeStringFunction · 0.85
IsIntScalarTypeMethod · 0.80
IsIntVectorTypeMethod · 0.80
diagMethod · 0.80
GetOperandTypeIdMethod · 0.80
GetDimensionMethod · 0.80
opcodeMethod · 0.45
type_idMethod · 0.45

Tested by

no test coverage detected