| 2076 | } |
| 2077 | |
| 2078 | spv_result_t ValidateImage(ValidationState_t& _, const Instruction* inst) { |
| 2079 | const uint32_t result_type = inst->type_id(); |
| 2080 | if (_.GetIdOpcode(result_type) != spv::Op::OpTypeImage) { |
| 2081 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 2082 | << "Expected Result Type to be OpTypeImage"; |
| 2083 | } |
| 2084 | |
| 2085 | const uint32_t sampled_image_type = _.GetOperandTypeId(inst, 2); |
| 2086 | const Instruction* sampled_image_type_inst = _.FindDef(sampled_image_type); |
| 2087 | assert(sampled_image_type_inst); |
| 2088 | |
| 2089 | if (sampled_image_type_inst->opcode() != spv::Op::OpTypeSampledImage) { |
| 2090 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 2091 | << "Expected Sample Image to be of type OpTypeSampleImage"; |
| 2092 | } |
| 2093 | |
| 2094 | if (sampled_image_type_inst->word(2) != result_type) { |
| 2095 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 2096 | << "Expected Sample Image image type to be equal to Result Type"; |
| 2097 | } |
| 2098 | |
| 2099 | return SPV_SUCCESS; |
| 2100 | } |
| 2101 | |
| 2102 | spv_result_t ValidateImageQuerySizeLod(ValidationState_t& _, |
| 2103 | const Instruction* inst) { |
no test coverage detected