MCPcopy Create free account
hub / github.com/baldurk/renderdoc / Load

Method Load

qrenderdoc/Windows/Dialogs/PerformanceCounterSelection.cpp:413–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411}
412
413void PerformanceCounterSelection::Load()
414{
415 QString filename = RDDialog::getOpenFileName(this, tr("Load file"), QDir::homePath(),
416 tr("Performance Counter Settings (*.json)"));
417
418 if(filename.isEmpty())
419 return;
420
421 QVariantMap doc;
422 QFile f(filename);
423 if(f.open(QIODevice::ReadOnly | QIODevice::Text))
424 {
425 bool success = LoadFromJSON(doc, f, JSON_ID, JSON_VER);
426
427 if(success)
428 {
429 QSet<GPUCounter> selectedCounters;
430
431 QVariantList counters = doc[lit("counters")].toList();
432
433 for(const QVariant &counter : counters)
434 {
435 QVariantList bytes = counter.toList();
436 Uuid uuid;
437
438 if(bytes.size() != 4)
439 {
440 qWarning() << "Counter ID doesn't count 4 words";
441 continue;
442 }
443
444 for(int i = 0; i < 4; ++i)
445 {
446 uuid.words[i] = bytes[i].toUInt();
447 }
448
449 if(!m_UuidToCounter.contains(uuid))
450 continue;
451
452 selectedCounters.insert(m_UuidToCounter[uuid]);
453 }
454
455 SetSelectedCounters(selectedCounters.toList());
456 }
457 else
458 {
459 RDDialog::critical(this, tr("Error loading config"),
460 tr("Couldn't interpret settings in %1.").arg(filename));
461 }
462 }
463 else
464 {
465 RDDialog::critical(this, tr("Error loading config"),
466 tr("Couldn't open path %1 for reading.").arg(filename));
467 }
468}
469
470void PerformanceCounterSelection::on_enabledCounters_activated(const QModelIndex &index)

Callers

nothing calls this directly

Calls 10

LoadFromJSONFunction · 0.85
criticalFunction · 0.85
trFunction · 0.50
isEmptyMethod · 0.45
openMethod · 0.45
toListMethod · 0.45
sizeMethod · 0.45
containsMethod · 0.45
insertMethod · 0.45
argMethod · 0.45

Tested by

no test coverage detected