| 499 | } |
| 500 | |
| 501 | spv_result_t ValidateCompositeInsert(ValidationState_t& _, |
| 502 | const Instruction* inst, |
| 503 | uint32_t operand_index = 2) { |
| 504 | const uint32_t object_type = _.GetOperandTypeId(inst, operand_index); |
| 505 | const uint32_t composite_type = _.GetOperandTypeId(inst, operand_index + 1); |
| 506 | const uint32_t result_type = inst->type_id(); |
| 507 | if (result_type != composite_type) { |
| 508 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 509 | << "The Result Type must be the same as Composite type in Op" |
| 510 | << spvOpcodeString(inst->opcode()) << " yielding Result Id " |
| 511 | << result_type << "."; |
| 512 | } |
| 513 | |
| 514 | uint32_t member_type = 0; |
| 515 | if (spv_result_t error = |
| 516 | GetExtractInsertValueType(_, inst, &member_type, operand_index + 1)) { |
| 517 | return error; |
| 518 | } |
| 519 | |
| 520 | if (object_type != member_type) { |
| 521 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 522 | << "The Object type (Op" |
| 523 | << spvOpcodeString(_.GetIdOpcode(object_type)) |
| 524 | << ") does not match the type that results from indexing into the " |
| 525 | "Composite (Op" |
| 526 | << spvOpcodeString(_.GetIdOpcode(member_type)) << ")."; |
| 527 | } |
| 528 | |
| 529 | if (_.HasCapability(spv::Capability::Shader) && |
| 530 | _.ContainsLimitedUseIntOrFloatType(inst->type_id())) { |
| 531 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 532 | << "Cannot insert into a composite of 8- or 16-bit types"; |
| 533 | } |
| 534 | |
| 535 | return SPV_SUCCESS; |
| 536 | } |
| 537 | |
| 538 | spv_result_t ValidateCopyObject(ValidationState_t& _, const Instruction* inst) { |
| 539 | const uint32_t result_type = inst->type_id(); |
no test coverage detected