MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / ValidateImage

Function ValidateImage

source/val/validate_image.cpp:2078–2100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2076}
2077
2078spv_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
2102spv_result_t ValidateImageQuerySizeLod(ValidationState_t& _,
2103 const Instruction* inst) {

Callers 1

ImagePassFunction · 0.85

Calls 7

GetIdOpcodeMethod · 0.80
diagMethod · 0.80
GetOperandTypeIdMethod · 0.80
FindDefMethod · 0.80
wordMethod · 0.80
type_idMethod · 0.45
opcodeMethod · 0.45

Tested by

no test coverage detected