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

Function ValidateCopyLogical

source/val/validate_composites.cpp:665–687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

663}
664
665spv_result_t ValidateCopyLogical(ValidationState_t& _,
666 const Instruction* inst) {
667 const auto result_type = _.FindDef(inst->type_id());
668 const auto source = _.FindDef(inst->GetOperandAs<uint32_t>(2u));
669 const auto source_type = _.FindDef(source->type_id());
670 if (!source_type || !result_type || source_type == result_type) {
671 return _.diag(SPV_ERROR_INVALID_ID, inst)
672 << "Result Type must not equal the Operand type";
673 }
674
675 if (!_.LogicallyMatch(source_type, result_type, false)) {
676 return _.diag(SPV_ERROR_INVALID_ID, inst)
677 << "Result Type does not logically match the Operand type";
678 }
679
680 if (_.HasCapability(spv::Capability::Shader) &&
681 _.ContainsLimitedUseIntOrFloatType(inst->type_id())) {
682 return _.diag(SPV_ERROR_INVALID_DATA, inst)
683 << "Cannot copy composites of 8- or 16-bit types";
684 }
685
686 return SPV_SUCCESS;
687}
688
689spv_result_t ValidateCompositeConstructCoopMatQCOM(ValidationState_t& _,
690 const Instruction* inst) {

Callers 1

CompositesPassFunction · 0.85

Calls 6

FindDefMethod · 0.80
diagMethod · 0.80
LogicallyMatchMethod · 0.80
type_idMethod · 0.45
HasCapabilityMethod · 0.45

Tested by

no test coverage detected