Change core capture code to be more centred around container handle

* When opening a capture file, a format is now available to allow
  easy import from another format without a completely different
  interface. Only rdc files can be replayed, but any other file can
  load and access structured data through the same interface.
* The replay initialisation and capture writing interfaces also use the
  RDCFile instead of passing filenames or Serialisers around directly.
  Driver initialisation parameters are now entirely private, and don't
  need to be exposed - any agnostic metadata like thumbnail, driver, etc
  are all accessed via the RDCFile container itself.
* Callstack resolution is now part of the container file, not the
  back-end via way of its Serialiser.
* Importers/Exporters to other non-RDC formats are registered in a
  similar way to replay/remote drivers.
* It is also then possible to construct an RDC file from thin air, by
  creating an empty RDCFile container and filling it with data, then
  requesting it to be written to disk.
This commit is contained in:
baldurk
2017-11-07 19:30:35 +00:00
parent a63e99177d
commit 9388d2b71b
26 changed files with 1036 additions and 593 deletions
+33 -12
View File
@@ -402,9 +402,9 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local
if(local)
{
ICaptureFile *file = RENDERDOC_OpenCaptureFile(filename.toUtf8().data());
ICaptureFile *file = RENDERDOC_OpenCaptureFile();
if(file->OpenStatus() != ReplayStatus::Succeeded)
if(file->OpenFile(filename.toUtf8().data(), "rdc") != ReplayStatus::Succeeded)
{
RDDialog::critical(NULL, tr("Error opening capture"),
tr("Couldn't open file '%1'").arg(filename));
@@ -1275,18 +1275,20 @@ void MainWindow::OnLogfileLoaded()
setLogHasErrors(!m_Ctx.DebugMessages().empty());
m_Ctx.Replay().AsyncInvoke([this](IReplayController *r) {
bool hasResolver = r->HasCallstacks();
ui->action_Resolve_Symbols->setEnabled(false);
m_Ctx.Replay().AsyncInvoke([this](IReplayController *) {
bool hasResolver = m_Ctx.Replay().GetResolver()->HasCallstacks();
GUIInvoke::call([this, hasResolver]() {
ui->action_Resolve_Symbols->setEnabled(hasResolver);
ui->action_Resolve_Symbols->setText(hasResolver ? tr("Resolve Symbols")
: tr("Resolve Symbols - None in log"));
ui->action_Save_Log->setEnabled(true);
});
});
ui->action_Save_Log->setEnabled(true);
SetTitle();
PopulateRecentFiles();
@@ -1540,15 +1542,34 @@ void MainWindow::on_action_Python_Shell_triggered()
void MainWindow::on_action_Resolve_Symbols_triggered()
{
m_Ctx.Replay().AsyncInvoke([this](IReplayController *r) { r->InitResolver(); });
if(!m_Ctx.Replay().GetResolver())
{
RDDialog::critical(
this, tr("Not Available"),
tr("Callstack resolution is not available.\n\nCheck remote server connection."));
return;
}
ShowProgressDialog(this, tr("Please Wait - Resolving Symbols"), [this]() {
bool running = true;
m_Ctx.Replay().BlockInvoke(
[&running](IReplayController *r) { running = r->HasCallstacks() && !r->InitResolver(); });
return !running;
float progress = 0.0f;
bool finished = false;
m_Ctx.Replay().AsyncInvoke([this, &progress, &finished](IReplayController *) {
bool success = m_Ctx.Replay().GetResolver()->InitResolver(&progress, NULL);
if(!success)
{
RDDialog::critical(
this, tr("Error loading symbols"),
tr("Couldn't load symbols for callstack resolution.\n\nCheck diagnostic log in "
"Help menu for more details."));
}
finished = true;
});
ShowProgressDialog(this, tr("Resolving symbols, please wait..."),
[&finished]() { return finished; }, [&progress]() { return progress; });
if(m_Ctx.HasAPIInspector())
m_Ctx.GetAPIInspector()->Refresh();
}