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

Method processArgs

tests/loadtests/vkloadtests/Texture.cpp:232–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230//===================================================================
231
232void
233Texture::processArgs(std::string sArgs)
234{
235 // Options descriptor
236 struct argparser::option longopts[] = {
237 {"external", argparser::option::no_argument, &externalFile, 1},
238 {"linear-tiling", argparser::option::no_argument, (int*)&tiling, (int)vk::ImageTiling::eLinear},
239 {"use-vma", argparser::option::no_argument, (int*)&useSubAlloc, (int)UseSuballocator::Yes},
240 {"qcolor", argparser::option::required_argument, NULL, 1},
241 {NULL, argparser::option::no_argument, NULL, 0}
242 };
243
244 argvector argv(sArgs);
245 argparser ap(argv);
246
247 int ch;
248 while ((ch = ap.getopt(nullptr, longopts, nullptr)) != -1) {
249 switch (ch) {
250 case 0: break;
251 case 1:
252 {
253 std::istringstream in(ap.optarg);
254 rgbcolor clr;
255 int i;
256
257 for (i = 0; i < 4 && !in.eof(); i++) {
258 in >> clr[0] >> skip(",") >> clr[1] >> skip(",") >> clr[2];
259 quadColor[i] = clr;
260 if (!in.eof())
261 in >> skip(",");
262 }
263 assert(!in.fail() && (i == 1 || i == 4));
264 if (i == 1) {
265 for(; i < 4; i++)
266 quadColor[i] = quadColor[0];
267 }
268 break;
269 }
270 default: assert(false); // Error in args in sample table.
271 }
272 }
273 assert(ap.optind < argv.size());
274 ktxfilename = argv[ap.optind];
275}
276
277/* ------------------------------------------------------------------------- */
278

Callers

nothing calls this directly

Calls 4

skipClass · 0.85
assertFunction · 0.85
getoptMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected