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

Function ValidateCompositeExtract

source/val/validate_composites.cpp:473–499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

471}
472
473spv_result_t ValidateCompositeExtract(ValidationState_t& _,
474 const Instruction* inst,
475 uint32_t operand_index = 2) {
476 uint32_t member_type = 0;
477
478 if (spv_result_t error =
479 GetExtractInsertValueType(_, inst, &member_type, operand_index)) {
480 return error;
481 }
482
483 const uint32_t result_type = inst->type_id();
484 if (result_type != member_type) {
485 return _.diag(SPV_ERROR_INVALID_DATA, inst)
486 << "Result type (Op" << spvOpcodeString(_.GetIdOpcode(result_type))
487 << ") does not match the type that results from indexing into "
488 "the composite (Op"
489 << spvOpcodeString(_.GetIdOpcode(member_type)) << ").";
490 }
491
492 if (_.HasCapability(spv::Capability::Shader) &&
493 _.ContainsLimitedUseIntOrFloatType(inst->type_id())) {
494 return _.diag(SPV_ERROR_INVALID_DATA, inst)
495 << "Cannot extract from a composite of 8- or 16-bit types";
496 }
497
498 return SPV_SUCCESS;
499}
500
501spv_result_t ValidateCompositeInsert(ValidationState_t& _,
502 const Instruction* inst,

Callers 1

CompositesPassFunction · 0.85

Calls 7

spvOpcodeStringFunction · 0.85
diagMethod · 0.80
GetIdOpcodeMethod · 0.80
type_idMethod · 0.45
HasCapabilityMethod · 0.45

Tested by

no test coverage detected