| 471 | } |
| 472 | |
| 473 | spv_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 | |
| 501 | spv_result_t ValidateCompositeInsert(ValidationState_t& _, |
| 502 | const Instruction* inst, |
no test coverage detected