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

Method process

tools/ktx/command_create.cpp:436–815  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

434 }
435
436 void process(cxxopts::Options&, cxxopts::ParseResult& args, Reporter& report) {
437 _1d = args[k1D].as<bool>();
438 cubemap = args[kCubemap].as<bool>();
439 raw = args[kRaw].as<bool>();
440
441 if (args[kWidth].count())
442 width = args[kWidth].as<uint32_t>();
443 if (args[kHeight].count())
444 height = args[kHeight].as<uint32_t>();
445 if (args[kDepth].count())
446 depth = args[kDepth].as<uint32_t>();
447 if (args[kLayers].count())
448 layers = args[kLayers].as<uint32_t>();
449 if (args[kLevels].count())
450 levels = args[kLevels].as<uint32_t>();
451
452 mipmapRuntime = args[kRuntimeMipmap].as<bool>();
453 mipmapGenerate = args[kGenerateMipmap].as<bool>();
454
455 if (args[kMipmapFilter].count()) {
456 static const std::unordered_set<std::string> filter_table{
457 "box",
458 "tent",
459 "bell",
460 "b-spline",
461 "mitchell",
462 "blackman",
463 "lanczos3",
464 "lanczos4",
465 "lanczos6",
466 "lanczos12",
467 "kaiser",
468 "gaussian",
469 "catmullrom",
470 "quadratic_interp",
471 "quadratic_approx",
472 "quadratic_mix",
473 };
474
475 mipmapFilter = to_lower_copy(args[kMipmapFilter].as<std::string>());
476 if (filter_table.count(*mipmapFilter) == 0)
477 report.fatal_usage("Invalid or unsupported mipmap filter specified as --mipmap-filter argument: \"{}\".", *mipmapFilter);
478 }
479
480 if (args[kMipmapFilterScale].count())
481 mipmapFilterScale = args[kMipmapFilterScale].as<float>();
482
483 if (args[kMipmapWrap].count()) {
484 static const std::unordered_map<std::string, basisu::Resampler::Boundary_Op> wrap_table{
485 { "clamp", basisu::Resampler::Boundary_Op::BOUNDARY_CLAMP },
486 { "wrap", basisu::Resampler::Boundary_Op::BOUNDARY_WRAP },
487 { "reflect", basisu::Resampler::Boundary_Op::BOUNDARY_REFLECT },
488 };
489
490 const auto wrapStr = to_lower_copy(args[kMipmapWrap].as<std::string>());
491 const auto it = wrap_table.find(wrapStr);
492 if (it == wrap_table.end())
493 report.fatal_usage("Invalid or unsupported mipmap wrap mode specified as --mipmap-wrap argument: \"{}\".", wrapStr);

Callers 1

processOptionsMethod · 0.45

Calls 15

to_lower_copyFunction · 0.85
containsFunction · 0.85
parseVkFormatFunction · 0.85
isProhibitedFormatFunction · 0.85
createFormatDescriptorFunction · 0.85
isFormatSRGBFunction · 0.85
fatal_usageMethod · 0.80
toStringFunction · 0.70
log2Function · 0.70
maxFunction · 0.50
countMethod · 0.45

Tested by

no test coverage detected