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

Method ValidateArrayedF32Vec

source/val/validate_builtins.cpp:1164–1194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1162}
1163
1164spv_result_t BuiltInsValidator::ValidateArrayedF32Vec(
1165 const Decoration& decoration, const Instruction& inst,
1166 uint32_t num_components, uint32_t array_length,
1167 const std::function<spv_result_t(const std::string& message)>& diag) {
1168 uint32_t underlying_type = 0;
1169 if (spv_result_t error =
1170 GetUnderlyingType(_, decoration, inst, &underlying_type)) {
1171 return error;
1172 }
1173
1174 if (_.GetIdOpcode(underlying_type) != spv::Op::OpTypeArray) {
1175 return diag(GetDefinitionDesc(decoration, inst) + " is not an array.");
1176 }
1177
1178 const uint32_t length_id = _.FindDef(underlying_type)->word(3u);
1179 uint64_t found_length = 0;
1180 if (!_.EvalConstantValUint64(length_id, &found_length)) {
1181 return diag(GetDefinitionDesc(decoration, inst) +
1182 " array has a non constant length.");
1183 }
1184
1185 if (array_length != found_length) {
1186 return diag(GetDefinitionDesc(decoration, inst) + " array length must be " +
1187 std::to_string(array_length));
1188 }
1189
1190 underlying_type = _.FindDef(underlying_type)->word(2u);
1191
1192 return ValidateF32VecHelper(decoration, inst, num_components, diag,
1193 underlying_type);
1194}
1195
1196spv_result_t BuiltInsValidator::ValidateF32Vec(
1197 const Decoration& decoration, const Instruction& inst,

Callers

nothing calls this directly

Calls 6

GetUnderlyingTypeFunction · 0.85
GetIdOpcodeMethod · 0.80
wordMethod · 0.80
FindDefMethod · 0.80
EvalConstantValUint64Method · 0.80
to_stringFunction · 0.50

Tested by

no test coverage detected