| 2223 | } |
| 2224 | |
| 2225 | spv_result_t ValidateImageQueryFormatOrOrder(ValidationState_t& _, |
| 2226 | const Instruction* inst) { |
| 2227 | if (!_.IsIntScalarType(inst->type_id())) { |
| 2228 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 2229 | << "Expected Result Type to be int scalar type"; |
| 2230 | } |
| 2231 | |
| 2232 | const uint32_t image_type = _.GetOperandTypeId(inst, 2); |
| 2233 | if (_.GetIdOpcode(image_type) != spv::Op::OpTypeImage) { |
| 2234 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 2235 | << "Expected operand to be of type OpTypeImage"; |
| 2236 | } |
| 2237 | |
| 2238 | ImageTypeInfo info; |
| 2239 | if (!GetImageTypeInfo(_, image_type, &info)) { |
| 2240 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 2241 | << "Corrupt image type definition"; |
| 2242 | } |
| 2243 | |
| 2244 | if (info.dim == spv::Dim::TileImageDataEXT) { |
| 2245 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 2246 | << "Image 'Dim' cannot be TileImageDataEXT"; |
| 2247 | } |
| 2248 | return SPV_SUCCESS; |
| 2249 | } |
| 2250 | |
| 2251 | spv_result_t ValidateImageQueryLod(ValidationState_t& _, |
| 2252 | const Instruction* inst) { |
no test coverage detected