MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / validate

Method validate

tools/ktx/validate.cpp:372–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370// -------------------------------------------------------------------------------------------------
371
372int ValidationContext::validate(bool doCreateAndTranscodeChecks) {
373 const auto call = [&](const auto& fn, std::string_view name, auto&&... args) {
374 try {
375 (this->*fn)(std::forward<decltype(args)>(args)...);
376 } catch (const std::bad_alloc& ex) {
377 error(System::OutOfMemory, name, ex.what());
378 }
379 };
380
381 call(&ValidationContext::validateHeader, "Header");
382 call(&ValidationContext::validateIndices, "Index");
383 call(&ValidationContext::calculateExpectedDFD, "Expected DFD", VkFormat(header.vkFormat));
384 call(&ValidationContext::validateDFD, "DFD");
385 call(&ValidationContext::validateLevelIndex, "Level Index"); // Must come after the DFD parsed
386 call(&ValidationContext::validateKVD, "KVD");
387 call(&ValidationContext::validateSGD, "SGD");
388 call(&ValidationContext::validatePaddings, "padding");
389 if (doCreateAndTranscodeChecks)
390 call(&ValidationContext::validateCreateAndTranscode, "Create and Transcode");
391
392 return returnCode;
393}
394
395void ValidationContext::validateHeader() {
396 static constexpr uint8_t ktx2_identifier_reference[12] = KTX2_IDENTIFIER_REF;

Callers 7

executeExtractMethod · 0.45
validateIOStreamFunction · 0.45
validateMemoryFunction · 0.45
validateNamedFileFunction · 0.45
validateStdioStreamFunction · 0.45
TEST_FFunction · 0.45
three.min.jsFile · 0.45

Calls 3

errorFunction · 0.85
VkFormatEnum · 0.50
whatMethod · 0.45

Tested by 1

TEST_FFunction · 0.36