Lines Matching refs:_
86 bool GetImageTypeInfo(const ValidationState_t& _, uint32_t id, in GetImageTypeInfo() argument
90 const Instruction* inst = _.FindDef(id); in GetImageTypeInfo()
94 inst = _.FindDef(inst->word(2)); in GetImageTypeInfo()
211 spv_result_t ValidateImageOperands(ValidationState_t& _, in ValidateImageOperands() argument
233 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
240 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
252 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
256 const uint32_t type_id = _.GetTypeId(inst->word(word_index++)); in ValidateImageOperands()
257 if (!_.IsFloatScalarType(type_id)) { in ValidateImageOperands()
258 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
264 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
270 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
278 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
284 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
289 const uint32_t type_id = _.GetTypeId(inst->word(word_index++)); in ValidateImageOperands()
291 if (!_.IsFloatScalarType(type_id)) { in ValidateImageOperands()
292 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
297 if (!_.IsIntScalarType(type_id)) { in ValidateImageOperands()
298 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
306 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
312 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
319 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
323 const uint32_t dx_type_id = _.GetTypeId(inst->word(word_index++)); in ValidateImageOperands()
324 const uint32_t dy_type_id = _.GetTypeId(inst->word(word_index++)); in ValidateImageOperands()
325 if (!_.IsFloatScalarOrVectorType(dx_type_id) || in ValidateImageOperands()
326 !_.IsFloatScalarOrVectorType(dy_type_id)) { in ValidateImageOperands()
327 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
333 const uint32_t dx_size = _.GetDimension(dx_type_id); in ValidateImageOperands()
334 const uint32_t dy_size = _.GetDimension(dy_type_id); in ValidateImageOperands()
336 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
342 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
348 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
355 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
361 const uint32_t type_id = _.GetTypeId(id); in ValidateImageOperands()
362 if (!_.IsIntScalarOrVectorType(type_id)) { in ValidateImageOperands()
363 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
368 if (!spvOpcodeIsConstant(_.GetIdOpcode(id))) { in ValidateImageOperands()
369 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
374 const uint32_t offset_size = _.GetDimension(type_id); in ValidateImageOperands()
376 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
384 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
389 const uint32_t type_id = _.GetTypeId(id); in ValidateImageOperands()
390 if (!_.IsIntScalarOrVectorType(type_id)) { in ValidateImageOperands()
391 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
397 const uint32_t offset_size = _.GetDimension(type_id); in ValidateImageOperands()
399 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
409 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
415 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
421 const uint32_t type_id = _.GetTypeId(id); in ValidateImageOperands()
422 const Instruction* type_inst = _.FindDef(type_id); in ValidateImageOperands()
426 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
431 if (!_.GetConstantValUint64(type_inst->word(3), &array_size)) { in ValidateImageOperands()
436 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
441 if (!_.IsIntVectorType(component_type) || in ValidateImageOperands()
442 _.GetDimension(component_type) != 2) { in ValidateImageOperands()
443 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
448 if (!spvOpcodeIsConstant(_.GetIdOpcode(id))) { in ValidateImageOperands()
449 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
458 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
465 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
469 const uint32_t type_id = _.GetTypeId(inst->word(word_index++)); in ValidateImageOperands()
470 if (!_.IsIntScalarType(type_id)) { in ValidateImageOperands()
471 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
478 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
483 const uint32_t type_id = _.GetTypeId(inst->word(word_index++)); in ValidateImageOperands()
484 if (!_.IsFloatScalarType(type_id)) { in ValidateImageOperands()
485 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
491 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
497 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
505 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
512 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
519 if (auto error = ValidateMemoryScope(_, inst, available_scope)) in ValidateImageOperands()
526 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
534 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageOperands()
541 if (auto error = ValidateMemoryScope(_, inst, visible_scope)) return error; in ValidateImageOperands()
548 spv_result_t ValidateImageCommon(ValidationState_t& _, const Instruction* inst, in ValidateImageCommon() argument
554 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageCommon()
559 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageCommon()
564 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageCommon()
573 if (info.dim == SpvDim1D && !_.HasCapability(SpvCapabilityImage1D)) { in ValidateImageCommon()
574 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageCommon()
577 !_.HasCapability(SpvCapabilityImageRect)) { in ValidateImageCommon()
578 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageCommon()
581 !_.HasCapability(SpvCapabilityImageBuffer)) { in ValidateImageCommon()
582 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageCommon()
585 !_.HasCapability(SpvCapabilityImageCubeArray)) { in ValidateImageCommon()
586 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageCommon()
592 !_.HasCapability(SpvCapabilityImageMSArray)) { in ValidateImageCommon()
597 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageCommon()
603 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageCommon()
639 spv_result_t GetActualResultType(ValidationState_t& _, const Instruction* inst, in GetActualResultType() argument
644 const Instruction* const type_inst = _.FindDef(inst->type_id()); in GetActualResultType()
648 return _.diag(SPV_ERROR_INVALID_DATA, inst) in GetActualResultType()
653 !_.IsIntScalarType(type_inst->word(2))) { in GetActualResultType()
654 return _.diag(SPV_ERROR_INVALID_DATA, inst) in GetActualResultType()
674 spv_result_t ValidateTypeImage(ValidationState_t& _, const Instruction* inst) { in ValidateTypeImage() argument
678 if (!GetImageTypeInfo(_, inst->word(1), &info)) { in ValidateTypeImage()
679 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateTypeImage()
683 if (spvIsVulkanEnv(_.context()->target_env)) { in ValidateTypeImage()
684 if ((!_.IsFloatScalarType(info.sampled_type) && in ValidateTypeImage()
685 !_.IsIntScalarType(info.sampled_type)) || in ValidateTypeImage()
686 32 != _.GetBitWidth(info.sampled_type)) { in ValidateTypeImage()
687 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateTypeImage()
692 const SpvOp sampled_type_opcode = _.GetIdOpcode(info.sampled_type); in ValidateTypeImage()
696 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateTypeImage()
705 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateTypeImage()
710 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateTypeImage()
715 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateTypeImage()
720 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateTypeImage()
726 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateTypeImage()
731 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateTypeImage()
741 spv_result_t ValidateTypeSampledImage(ValidationState_t& _, in ValidateTypeSampledImage() argument
744 if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { in ValidateTypeSampledImage()
745 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateTypeSampledImage()
751 spv_result_t ValidateSampledImage(ValidationState_t& _, in ValidateSampledImage() argument
753 if (_.GetIdOpcode(inst->type_id()) != SpvOpTypeSampledImage) { in ValidateSampledImage()
754 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateSampledImage()
758 const uint32_t image_type = _.GetOperandTypeId(inst, 2); in ValidateSampledImage()
759 if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { in ValidateSampledImage()
760 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateSampledImage()
765 if (!GetImageTypeInfo(_, image_type, &info)) { in ValidateSampledImage()
766 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateSampledImage()
773 if (spvIsVulkanEnv(_.context()->target_env)) { in ValidateSampledImage()
775 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateSampledImage()
781 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateSampledImage()
787 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateSampledImage()
791 if (_.GetIdOpcode(_.GetOperandTypeId(inst, 3)) != SpvOpTypeSampler) { in ValidateSampledImage()
792 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateSampledImage()
803 std::vector<uint32_t> consumers = _.getSampledImageConsumers(inst->id()); in ValidateSampledImage()
806 const auto consumer_instr = _.FindDef(consumer_id); in ValidateSampledImage()
809 return _.diag(SPV_ERROR_INVALID_ID, inst) in ValidateSampledImage()
814 << _.getIdName(inst->id()) in ValidateSampledImage()
817 << _.getIdName(consumer_id) << "'."; in ValidateSampledImage()
825 return _.diag(SPV_ERROR_INVALID_ID, inst) in ValidateSampledImage()
830 << " Found result <id> '" << _.getIdName(inst->id()) in ValidateSampledImage()
831 << "' as an operand of <id> '" << _.getIdName(consumer_id) in ValidateSampledImage()
839 spv_result_t ValidateImageTexelPointer(ValidationState_t& _, in ValidateImageTexelPointer() argument
841 const auto result_type = _.FindDef(inst->type_id()); in ValidateImageTexelPointer()
843 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageTexelPointer()
849 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageTexelPointer()
855 const auto ptr_opcode = _.GetIdOpcode(ptr_type); in ValidateImageTexelPointer()
858 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageTexelPointer()
863 const auto image_ptr = _.FindDef(_.GetOperandTypeId(inst, 2)); in ValidateImageTexelPointer()
865 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageTexelPointer()
870 if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { in ValidateImageTexelPointer()
871 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageTexelPointer()
876 if (!GetImageTypeInfo(_, image_type, &info)) { in ValidateImageTexelPointer()
877 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageTexelPointer()
882 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageTexelPointer()
888 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageTexelPointer()
892 const uint32_t coord_type = _.GetOperandTypeId(inst, 3); in ValidateImageTexelPointer()
893 if (!coord_type || !_.IsIntScalarOrVectorType(coord_type)) { in ValidateImageTexelPointer()
894 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageTexelPointer()
911 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageTexelPointer()
918 const uint32_t actual_coord_size = _.GetDimension(coord_type); in ValidateImageTexelPointer()
920 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageTexelPointer()
925 const uint32_t sample_type = _.GetOperandTypeId(inst, 4); in ValidateImageTexelPointer()
926 if (!sample_type || !_.IsIntScalarType(sample_type)) { in ValidateImageTexelPointer()
927 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageTexelPointer()
933 if (!_.GetConstantValUint64(inst->GetOperandAs<uint32_t>(4), &ms) || in ValidateImageTexelPointer()
935 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageTexelPointer()
943 spv_result_t ValidateImageLod(ValidationState_t& _, const Instruction* inst) { in ValidateImageLod() argument
946 if (spv_result_t error = GetActualResultType(_, inst, &actual_result_type)) { in ValidateImageLod()
950 if (!_.IsIntVectorType(actual_result_type) && in ValidateImageLod()
951 !_.IsFloatVectorType(actual_result_type)) { in ValidateImageLod()
952 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageLod()
957 if (_.GetDimension(actual_result_type) != 4) { in ValidateImageLod()
958 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageLod()
963 const uint32_t image_type = _.GetOperandTypeId(inst, 2); in ValidateImageLod()
964 if (_.GetIdOpcode(image_type) != SpvOpTypeSampledImage) { in ValidateImageLod()
965 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageLod()
970 if (!GetImageTypeInfo(_, image_type, &info)) { in ValidateImageLod()
971 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageLod()
975 if (spv_result_t result = ValidateImageCommon(_, inst, info)) return result; in ValidateImageLod()
977 if (_.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { in ValidateImageLod()
979 _.GetComponentType(actual_result_type); in ValidateImageLod()
981 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageLod()
987 const uint32_t coord_type = _.GetOperandTypeId(inst, 3); in ValidateImageLod()
990 _.HasCapability(SpvCapabilityKernel)) { in ValidateImageLod()
991 if (!_.IsFloatScalarOrVectorType(coord_type) && in ValidateImageLod()
992 !_.IsIntScalarOrVectorType(coord_type)) { in ValidateImageLod()
993 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageLod()
997 if (!_.IsFloatScalarOrVectorType(coord_type)) { in ValidateImageLod()
998 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageLod()
1004 const uint32_t actual_coord_size = _.GetDimension(coord_type); in ValidateImageLod()
1006 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageLod()
1018 ValidateImageOperands(_, inst, info, mask, /* word_index = */ 6)) in ValidateImageLod()
1024 spv_result_t ValidateImageDrefLod(ValidationState_t& _, in ValidateImageDrefLod() argument
1028 if (spv_result_t error = GetActualResultType(_, inst, &actual_result_type)) { in ValidateImageDrefLod()
1032 if (!_.IsIntScalarType(actual_result_type) && in ValidateImageDrefLod()
1033 !_.IsFloatScalarType(actual_result_type)) { in ValidateImageDrefLod()
1034 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageDrefLod()
1039 const uint32_t image_type = _.GetOperandTypeId(inst, 2); in ValidateImageDrefLod()
1040 if (_.GetIdOpcode(image_type) != SpvOpTypeSampledImage) { in ValidateImageDrefLod()
1041 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageDrefLod()
1046 if (!GetImageTypeInfo(_, image_type, &info)) { in ValidateImageDrefLod()
1047 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageDrefLod()
1051 if (spv_result_t result = ValidateImageCommon(_, inst, info)) return result; in ValidateImageDrefLod()
1054 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageDrefLod()
1059 const uint32_t coord_type = _.GetOperandTypeId(inst, 3); in ValidateImageDrefLod()
1060 if (!_.IsFloatScalarOrVectorType(coord_type)) { in ValidateImageDrefLod()
1061 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageDrefLod()
1066 const uint32_t actual_coord_size = _.GetDimension(coord_type); in ValidateImageDrefLod()
1068 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageDrefLod()
1073 const uint32_t dref_type = _.GetOperandTypeId(inst, 4); in ValidateImageDrefLod()
1074 if (!_.IsFloatScalarType(dref_type) || _.GetBitWidth(dref_type) != 32) { in ValidateImageDrefLod()
1075 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageDrefLod()
1086 ValidateImageOperands(_, inst, info, mask, /* word_index = */ 7)) in ValidateImageDrefLod()
1092 spv_result_t ValidateImageFetch(ValidationState_t& _, const Instruction* inst) { in ValidateImageFetch() argument
1094 if (spv_result_t error = GetActualResultType(_, inst, &actual_result_type)) { in ValidateImageFetch()
1099 if (!_.IsIntVectorType(actual_result_type) && in ValidateImageFetch()
1100 !_.IsFloatVectorType(actual_result_type)) { in ValidateImageFetch()
1101 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageFetch()
1106 if (_.GetDimension(actual_result_type) != 4) { in ValidateImageFetch()
1107 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageFetch()
1112 const uint32_t image_type = _.GetOperandTypeId(inst, 2); in ValidateImageFetch()
1113 if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { in ValidateImageFetch()
1114 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageFetch()
1119 if (!GetImageTypeInfo(_, image_type, &info)) { in ValidateImageFetch()
1120 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageFetch()
1124 if (_.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { in ValidateImageFetch()
1126 _.GetComponentType(actual_result_type); in ValidateImageFetch()
1128 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageFetch()
1135 return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'Dim' cannot be Cube"; in ValidateImageFetch()
1139 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageFetch()
1143 const uint32_t coord_type = _.GetOperandTypeId(inst, 3); in ValidateImageFetch()
1144 if (!_.IsIntScalarOrVectorType(coord_type)) { in ValidateImageFetch()
1145 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageFetch()
1150 const uint32_t actual_coord_size = _.GetDimension(coord_type); in ValidateImageFetch()
1152 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageFetch()
1161 ValidateImageOperands(_, inst, info, mask, /* word_index = */ 6)) in ValidateImageFetch()
1167 spv_result_t ValidateImageGather(ValidationState_t& _, in ValidateImageGather() argument
1170 if (spv_result_t error = GetActualResultType(_, inst, &actual_result_type)) in ValidateImageGather()
1174 if (!_.IsIntVectorType(actual_result_type) && in ValidateImageGather()
1175 !_.IsFloatVectorType(actual_result_type)) { in ValidateImageGather()
1176 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageGather()
1181 if (_.GetDimension(actual_result_type) != 4) { in ValidateImageGather()
1182 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageGather()
1187 const uint32_t image_type = _.GetOperandTypeId(inst, 2); in ValidateImageGather()
1188 if (_.GetIdOpcode(image_type) != SpvOpTypeSampledImage) { in ValidateImageGather()
1189 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageGather()
1194 if (!GetImageTypeInfo(_, image_type, &info)) { in ValidateImageGather()
1195 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageGather()
1200 _.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { in ValidateImageGather()
1202 _.GetComponentType(actual_result_type); in ValidateImageGather()
1204 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageGather()
1212 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageGather()
1216 const uint32_t coord_type = _.GetOperandTypeId(inst, 3); in ValidateImageGather()
1217 if (!_.IsFloatScalarOrVectorType(coord_type)) { in ValidateImageGather()
1218 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageGather()
1223 const uint32_t actual_coord_size = _.GetDimension(coord_type); in ValidateImageGather()
1225 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageGather()
1231 const uint32_t component_index_type = _.GetOperandTypeId(inst, 4); in ValidateImageGather()
1232 if (!_.IsIntScalarType(component_index_type) || in ValidateImageGather()
1233 _.GetBitWidth(component_index_type) != 32) { in ValidateImageGather()
1234 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageGather()
1240 const uint32_t dref_type = _.GetOperandTypeId(inst, 4); in ValidateImageGather()
1241 if (!_.IsFloatScalarType(dref_type) || _.GetBitWidth(dref_type) != 32) { in ValidateImageGather()
1242 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageGather()
1251 ValidateImageOperands(_, inst, info, mask, /* word_index = */ 7)) in ValidateImageGather()
1257 spv_result_t ValidateImageRead(ValidationState_t& _, const Instruction* inst) { in ValidateImageRead() argument
1260 if (spv_result_t error = GetActualResultType(_, inst, &actual_result_type)) { in ValidateImageRead()
1264 if (!_.IsIntScalarOrVectorType(actual_result_type) && in ValidateImageRead()
1265 !_.IsFloatScalarOrVectorType(actual_result_type)) { in ValidateImageRead()
1266 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageRead()
1273 if (_.GetDimension(actual_result_type) != 4) { in ValidateImageRead()
1274 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageRead()
1280 const uint32_t image_type = _.GetOperandTypeId(inst, 2); in ValidateImageRead()
1281 if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { in ValidateImageRead()
1282 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageRead()
1287 if (!GetImageTypeInfo(_, image_type, &info)) { in ValidateImageRead()
1288 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageRead()
1294 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageRead()
1298 _.function(inst->function()->id()) in ValidateImageRead()
1305 if (_.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { in ValidateImageRead()
1307 _.GetComponentType(actual_result_type); in ValidateImageRead()
1309 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageRead()
1315 if (spv_result_t result = ValidateImageCommon(_, inst, info)) return result; in ValidateImageRead()
1317 const uint32_t coord_type = _.GetOperandTypeId(inst, 3); in ValidateImageRead()
1318 if (!_.IsIntScalarOrVectorType(coord_type)) { in ValidateImageRead()
1319 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageRead()
1324 const uint32_t actual_coord_size = _.GetDimension(coord_type); in ValidateImageRead()
1326 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageRead()
1332 !_.HasCapability(SpvCapabilityStorageImageReadWithoutFormat)) { in ValidateImageRead()
1333 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageRead()
1342 ValidateImageOperands(_, inst, info, mask, /* word_index = */ 6)) in ValidateImageRead()
1348 spv_result_t ValidateImageWrite(ValidationState_t& _, const Instruction* inst) { in ValidateImageWrite() argument
1349 const uint32_t image_type = _.GetOperandTypeId(inst, 0); in ValidateImageWrite()
1350 if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { in ValidateImageWrite()
1351 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageWrite()
1356 if (!GetImageTypeInfo(_, image_type, &info)) { in ValidateImageWrite()
1357 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageWrite()
1362 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageWrite()
1366 if (spv_result_t result = ValidateImageCommon(_, inst, info)) return result; in ValidateImageWrite()
1368 const uint32_t coord_type = _.GetOperandTypeId(inst, 1); in ValidateImageWrite()
1369 if (!_.IsIntScalarOrVectorType(coord_type)) { in ValidateImageWrite()
1370 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageWrite()
1375 const uint32_t actual_coord_size = _.GetDimension(coord_type); in ValidateImageWrite()
1377 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageWrite()
1384 const uint32_t texel_type = _.GetOperandTypeId(inst, 2); in ValidateImageWrite()
1385 if (!_.IsIntScalarOrVectorType(texel_type) && in ValidateImageWrite()
1386 !_.IsFloatScalarOrVectorType(texel_type)) { in ValidateImageWrite()
1387 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageWrite()
1393 if (_.GetDimension(texel_type) != 4) { in ValidateImageWrite()
1394 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageWrite()
1399 if (_.GetIdOpcode(info.sampled_type) != SpvOpTypeVoid) { in ValidateImageWrite()
1400 const uint32_t texel_component_type = _.GetComponentType(texel_type); in ValidateImageWrite()
1402 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageWrite()
1409 !_.HasCapability(SpvCapabilityStorageImageWriteWithoutFormat)) { in ValidateImageWrite()
1410 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageWrite()
1420 ValidateImageOperands(_, inst, info, mask, /* word_index = */ 5)) in ValidateImageWrite()
1426 spv_result_t ValidateImage(ValidationState_t& _, const Instruction* inst) { in ValidateImage() argument
1428 if (_.GetIdOpcode(result_type) != SpvOpTypeImage) { in ValidateImage()
1429 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImage()
1433 const uint32_t sampled_image_type = _.GetOperandTypeId(inst, 2); in ValidateImage()
1434 const Instruction* sampled_image_type_inst = _.FindDef(sampled_image_type); in ValidateImage()
1438 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImage()
1443 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImage()
1450 spv_result_t ValidateImageQuerySizeLod(ValidationState_t& _, in ValidateImageQuerySizeLod() argument
1453 if (!_.IsIntScalarOrVectorType(result_type)) { in ValidateImageQuerySizeLod()
1454 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQuerySizeLod()
1458 const uint32_t image_type = _.GetOperandTypeId(inst, 2); in ValidateImageQuerySizeLod()
1459 if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { in ValidateImageQuerySizeLod()
1460 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQuerySizeLod()
1465 if (!GetImageTypeInfo(_, image_type, &info)) { in ValidateImageQuerySizeLod()
1466 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQuerySizeLod()
1483 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQuerySizeLod()
1488 return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'MS' must be 0"; in ValidateImageQuerySizeLod()
1491 uint32_t result_num_components = _.GetDimension(result_type); in ValidateImageQuerySizeLod()
1493 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQuerySizeLod()
1498 const uint32_t lod_type = _.GetOperandTypeId(inst, 3); in ValidateImageQuerySizeLod()
1499 if (!_.IsIntScalarType(lod_type)) { in ValidateImageQuerySizeLod()
1500 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQuerySizeLod()
1506 spv_result_t ValidateImageQuerySize(ValidationState_t& _, in ValidateImageQuerySize() argument
1509 if (!_.IsIntScalarOrVectorType(result_type)) { in ValidateImageQuerySize()
1510 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQuerySize()
1514 const uint32_t image_type = _.GetOperandTypeId(inst, 2); in ValidateImageQuerySize()
1515 if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { in ValidateImageQuerySize()
1516 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQuerySize()
1521 if (!GetImageTypeInfo(_, image_type, &info)) { in ValidateImageQuerySize()
1522 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQuerySize()
1541 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQuerySize()
1548 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQuerySize()
1553 uint32_t result_num_components = _.GetDimension(result_type); in ValidateImageQuerySize()
1555 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQuerySize()
1563 spv_result_t ValidateImageQueryFormatOrOrder(ValidationState_t& _, in ValidateImageQueryFormatOrOrder() argument
1565 if (!_.IsIntScalarType(inst->type_id())) { in ValidateImageQueryFormatOrOrder()
1566 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQueryFormatOrOrder()
1570 if (_.GetIdOpcode(_.GetOperandTypeId(inst, 2)) != SpvOpTypeImage) { in ValidateImageQueryFormatOrOrder()
1571 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQueryFormatOrOrder()
1577 spv_result_t ValidateImageQueryLod(ValidationState_t& _, in ValidateImageQueryLod() argument
1579 _.function(inst->function()->id()) in ValidateImageQueryLod()
1585 if (!_.IsFloatVectorType(result_type)) { in ValidateImageQueryLod()
1586 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQueryLod()
1590 if (_.GetDimension(result_type) != 2) { in ValidateImageQueryLod()
1591 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQueryLod()
1595 const uint32_t image_type = _.GetOperandTypeId(inst, 2); in ValidateImageQueryLod()
1596 if (_.GetIdOpcode(image_type) != SpvOpTypeSampledImage) { in ValidateImageQueryLod()
1597 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQueryLod()
1602 if (!GetImageTypeInfo(_, image_type, &info)) { in ValidateImageQueryLod()
1603 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQueryLod()
1609 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQueryLod()
1613 const uint32_t coord_type = _.GetOperandTypeId(inst, 3); in ValidateImageQueryLod()
1614 if (_.HasCapability(SpvCapabilityKernel)) { in ValidateImageQueryLod()
1615 if (!_.IsFloatScalarOrVectorType(coord_type) && in ValidateImageQueryLod()
1616 !_.IsIntScalarOrVectorType(coord_type)) { in ValidateImageQueryLod()
1617 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQueryLod()
1621 if (!_.IsFloatScalarOrVectorType(coord_type)) { in ValidateImageQueryLod()
1622 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQueryLod()
1628 const uint32_t actual_coord_size = _.GetDimension(coord_type); in ValidateImageQueryLod()
1630 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQueryLod()
1637 spv_result_t ValidateImageSparseLod(ValidationState_t& _, in ValidateImageSparseLod() argument
1639 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageSparseLod()
1644 spv_result_t ValidateImageQueryLevelsOrSamples(ValidationState_t& _, in ValidateImageQueryLevelsOrSamples() argument
1646 if (!_.IsIntScalarType(inst->type_id())) { in ValidateImageQueryLevelsOrSamples()
1647 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQueryLevelsOrSamples()
1651 const uint32_t image_type = _.GetOperandTypeId(inst, 2); in ValidateImageQueryLevelsOrSamples()
1652 if (_.GetIdOpcode(image_type) != SpvOpTypeImage) { in ValidateImageQueryLevelsOrSamples()
1653 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQueryLevelsOrSamples()
1658 if (!GetImageTypeInfo(_, image_type, &info)) { in ValidateImageQueryLevelsOrSamples()
1659 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQueryLevelsOrSamples()
1667 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageQueryLevelsOrSamples()
1673 return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'Dim' must be 2D"; in ValidateImageQueryLevelsOrSamples()
1677 return _.diag(SPV_ERROR_INVALID_DATA, inst) << "Image 'MS' must be 1"; in ValidateImageQueryLevelsOrSamples()
1683 spv_result_t ValidateImageSparseTexelsResident(ValidationState_t& _, in ValidateImageSparseTexelsResident() argument
1685 if (!_.IsBoolScalarType(inst->type_id())) { in ValidateImageSparseTexelsResident()
1686 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageSparseTexelsResident()
1690 const uint32_t resident_code_type = _.GetOperandTypeId(inst, 2); in ValidateImageSparseTexelsResident()
1691 if (!_.IsIntScalarType(resident_code_type)) { in ValidateImageSparseTexelsResident()
1692 return _.diag(SPV_ERROR_INVALID_DATA, inst) in ValidateImageSparseTexelsResident()
1702 spv_result_t ImagePass(ValidationState_t& _, const Instruction* inst) { in ImagePass() argument
1705 _.function(inst->function()->id()) in ImagePass()
1713 return ValidateTypeImage(_, inst); in ImagePass()
1715 return ValidateTypeSampledImage(_, inst); in ImagePass()
1717 return ValidateSampledImage(_, inst); in ImagePass()
1719 return ValidateImageTexelPointer(_, inst); in ImagePass()
1727 return ValidateImageLod(_, inst); in ImagePass()
1735 return ValidateImageDrefLod(_, inst); in ImagePass()
1739 return ValidateImageFetch(_, inst); in ImagePass()
1745 return ValidateImageGather(_, inst); in ImagePass()
1749 return ValidateImageRead(_, inst); in ImagePass()
1752 return ValidateImageWrite(_, inst); in ImagePass()
1755 return ValidateImage(_, inst); in ImagePass()
1759 return ValidateImageQueryFormatOrOrder(_, inst); in ImagePass()
1762 return ValidateImageQuerySizeLod(_, inst); in ImagePass()
1764 return ValidateImageQuerySize(_, inst); in ImagePass()
1766 return ValidateImageQueryLod(_, inst); in ImagePass()
1770 return ValidateImageQueryLevelsOrSamples(_, inst); in ImagePass()
1776 return ValidateImageSparseLod(_, inst); in ImagePass()
1779 return ValidateImageSparseTexelsResident(_, inst); in ImagePass()