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

Function ProcessCommandLine

tools/explorer/NtcExplorer.cpp:69–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67 bool enableCoopVec = true;
68 int adapterIndex = -1;
69 int cudaDevice = 0;
70} g_options;
71
72bool ProcessCommandLine(int argc, const char** argv)
73{
74 struct argparse_option options[] = {
75 OPT_HELP(),
76 OPT_BOOLEAN(0, "debug", &g_options.debug, "Enable graphics debug runtime"),
77 OPT_BOOLEAN(0, "noshared", &g_options.noshared, "Disable the use of shared textures (CUDA/Graphics interop)"),
78 OPT_INTEGER(0, "adapter", &g_options.adapterIndex, "Index of the graphics adapter to use (use ntc-cli.exe --dx12|vk --listAdapters to find out)"),
79 OPT_INTEGER(0, "cudaDevice", &g_options.cudaDevice, "Index of the CUDA device to use (use ntc-cli.exe --listCudaDevices to find out)"),
80 OPT_BOOLEAN(0, "coopVec", &g_options.enableCoopVec, "Enable CoopVec extensions (default on, use --no-coopVec)"),
81 OPT_BOOLEAN(0, "captureMode", &g_options.captureMode, "Trace capture mode - run Graphics decompression in a loop"),
82 OPT_BOOLEAN(0, "compare", &g_options.compare, "Use Explorer to compare two images specified on the command line"),
83 OPT_BOOLEAN(0, "hdr", &g_options.hdr, "Use an HDR (FP16) swap chain"),
84#if NTC_WITH_VULKAN
85 OPT_BOOLEAN(0, "vk", &g_options.useVulkan, "Use Vulkan API"),
86#endif
87#if NTC_WITH_DX12
88 OPT_BOOLEAN(0, "dx12", &g_options.useDX12, "Use DX12 API"),
89#endif
90 OPT_END()
91 };
92
93 static const char* usages[] = {
94 "ntc-explorer.exe [options...] [<source-folder|source-manifest.json|compressed-file.ntc>]",
95 nullptr
96 };
97
98 struct argparse argparse {};
99 argparse_init(&argparse, options, usages, ARGPARSE_USE_MESSAGE_BUFFER | ARGPARSE_NEVER_EXIT);
100 argparse_describe(&argparse, nullptr, "\nNeural texture compression and decompression tool.\n");
101 int argparse_result = argparse_parse(&argparse, argc, argv);
102 if (argparse_result < 0)
103 {
104 if (argparse.messages)
105 {
106 bool isError = argparse_result != ARGPARSE_HELP;
107#ifdef _WIN32
108 MessageBoxA(NULL, argparse.messages, g_ApplicationName, MB_OK | (isError ? MB_ICONERROR : 0));
109#else
110 log::error("%s\n", argparse.messages);
111#endif
112 }
113 argparse_cleanup(&argparse);
114 return false;
115 }
116
117 // Process positional arguments and detect their input types
118 for (int i = 0; argparse.out[i]; ++i)
119 {
120 char const* arg = argparse.out[i];
121 if (!arg[0])
122 continue;
123
124 fs::path argPath = arg;
125 if (fs::is_directory(argPath))
126 {

Callers 1

mainFunction · 0.70

Calls 7

argparse_initFunction · 0.85
argparse_describeFunction · 0.85
argparse_parseFunction · 0.85
argparse_cleanupFunction · 0.85
UpdateToolInputTypeFunction · 0.85
LowercaseStringFunction · 0.85

Tested by

no test coverage detected