MCPcopy Create free account
hub / github.com/NVIDIA-RTX/RTXNTC / LoadImages

Function LoadImages

tools/cli/NtcCommandLine.cpp:701–1353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

699 int const channels = texture->GetNumChannels();
700 switch(channels)
701 {
702 case 1: bcFormat = ntc::BlockCompressedFormat::BC4; break;
703 case 2: bcFormat = ntc::BlockCompressedFormat::BC5; break;
704 default: bcFormat = ntc::BlockCompressedFormat::BC7; break;
705 }
706 }
707 }
708
709 assert(bcFormat != BlockCompressedFormat_Auto);
710
711 texture->SetBlockCompressedFormat(bcFormat);
712
713 // Apply the same override to the manifest entry, if it's provided
714 // (in case the user wants to save the manifest)
715 if (manifestEntry)
716 {
717 manifestEntry->bcFormat = bcFormat;
718 }
719 }
720}
721
722ntc::ITextureSet* LoadImages(ntc::IContext* context, Manifest& manifest)
723{
724 ntc::TextureSetDesc textureSetDesc{};
725 textureSetDesc.mips = 1;
726
727 ntc::LatentShape latentShape;
728 if (!PickLatentShape(latentShape))
729 return nullptr;
730
731 // Count the number of MIP 0 images in the manifest
732 int numMipZeroImages = 0;
733 for (auto const& entry : manifest.textures)
734 {
735 if (entry.mipLevel == 0)
736 ++numMipZeroImages;
737 }
738
739 if (numMipZeroImages > NTC_MAX_CHANNELS)
740 {
741 if (g_options.loadImagesPath)
742 {
743 fprintf(stderr, "Too many images (%d) found in the input folder. At most %d channels are supported.\n"
744 "Note: when loading images from a folder, a single material with all images is created. "
745 "To load a material with only some images from a folder, use manifest files or specify each image "
746 "on the command line separately.",
747 int(manifest.textures.size()), NTC_MAX_CHANNELS);
748 }
749 else
750 {
751 fprintf(stderr, "Too many images (%d) specified in the manifest. At most %d channels are supported.\n",
752 int(manifest.textures.size()), NTC_MAX_CHANNELS);
753 }
754 return nullptr;
755 }
756
757 struct SourceImageData
758 {

Callers 1

mainFunction · 0.85

Calls 8

PickLatentShapeFunction · 0.85
StartAsyncTaskFunction · 0.85
LowercaseStringFunction · 0.85
WaitForAllTasksFunction · 0.85
GuessImageSemanticsFunction · 0.85
OverrideTextureBcFormatFunction · 0.85
CreateTextureSetMethod · 0.80
AddTextureMethod · 0.80

Tested by

no test coverage detected