Normalise and make python/public interface more consistent

* We enforce a naming scheme more strongly - types, member functions,
  and enum values must be UpperCaseCamel, and member variables must be
  lowerCaseCamel. No underscores allowed.
* eventId not eventID or EID, and Id preferred to ID in general. Also
  for resourceId.
* Removed some lingering hungarian m_Foo naming.
* Some pipeline state structs that are almost identical between the
  different APIs are pulled out into common structs. Where something
  doesn't make sense (e.g. viewport enable for vulkan) it will just be
  set to a sensible default (in that case always true).
* Changed scissors to be x/y & width/height instead of sometimes
  left/top/right/bottom
* Abbreviations are discouraged, e.g. operation not op, function not
  func.
This commit is contained in:
baldurk committed 2017-12-22 13:02:36 +00:00
1 parent fd66995ac2
commit ebaefc82a9
171 files changed
+9843 -10175

No files matched your search

+41 -41
View File
@@ -425,7 +425,7 @@ void CaptureDialog::CheckAndroidSetup(QString &filename)
LambdaThread *scan = new LambdaThread([this, filename]() {
rdcstr host = m_Ctx.Replay().CurrentRemote()->Hostname;
rdcstr host = m_Ctx.Replay().CurrentRemote()->hostname;
RENDERDOC_CheckAndroidPackage(host.c_str(), filename.toUtf8().data(), &m_AndroidFlags);
const bool missingLibrary = bool(m_AndroidFlags & AndroidFlags::MissingLibrary);
@@ -544,7 +544,7 @@ void CaptureDialog::androidWarn_mouseClick()
// Call into layer push routine, then continue
LambdaThread *push = new LambdaThread([this, exe, &pushSucceeded]() {
rdcstr host = m_Ctx.Replay().CurrentRemote()->Hostname;
rdcstr host = m_Ctx.Replay().CurrentRemote()->hostname;
if(RENDERDOC_PushLayerToInstalledAndroidApp(host.c_str(), exe.toUtf8().data()))
{
// Sucess!
@@ -609,7 +609,7 @@ void CaptureDialog::androidWarn_mouseClick()
// call into APK pull, patch, install routine, then continue
LambdaThread *patch = new LambdaThread([this, exe, &patchSucceeded, &progress]() {
rdcstr host = m_Ctx.Replay().CurrentRemote()->Hostname;
rdcstr host = m_Ctx.Replay().CurrentRemote()->hostname;
if(RENDERDOC_AddLayerToAndroidPackage(host.c_str(), exe.toUtf8().data(), &progress))
{
// Sucess!
@@ -698,7 +698,7 @@ void CaptureDialog::on_exePathBrowse_clicked()
{
SetExecutableFilename(filename);
if(m_Ctx.Replay().CurrentRemote() && m_Ctx.Replay().CurrentRemote()->IsHostADB())
if(m_Ctx.Replay().CurrentRemote() && m_Ctx.Replay().CurrentRemote()->IsADB())
{
CheckAndroidSetup(filename);
}
@@ -831,7 +831,7 @@ void CaptureDialog::on_toggleGlobal_clicked()
QString capturefile = m_Ctx.TempCaptureFilename(QFileInfo(exe).baseName());
bool success = RENDERDOC_StartGlobalHook(exe.toUtf8().data(), capturefile.toUtf8().data(),
Settings().Options);
Settings().options);
if(!success)
{
@@ -907,30 +907,30 @@ void CaptureDialog::on_close_clicked()
void CaptureDialog::SetSettings(CaptureSettings settings)
{
SetInjectMode(settings.Inject);
SetInjectMode(settings.inject);
ui->exePath->setText(settings.Executable);
ui->workDirPath->setText(settings.WorkingDir);
ui->cmdline->setText(settings.CmdLine);
ui->exePath->setText(settings.executable);
ui->workDirPath->setText(settings.workingDir);
ui->cmdline->setText(settings.commandLine);
SetEnvironmentModifications(settings.Environment);
SetEnvironmentModifications(settings.environment);
ui->AllowFullscreen->setChecked(settings.Options.AllowFullscreen);
ui->AllowVSync->setChecked(settings.Options.AllowVSync);
ui->HookIntoChildren->setChecked(settings.Options.HookIntoChildren);
ui->CaptureCallstacks->setChecked(settings.Options.CaptureCallstacks);
ui->CaptureCallstacksOnlyDraws->setChecked(settings.Options.CaptureCallstacksOnlyDraws);
ui->APIValidation->setChecked(settings.Options.APIValidation);
ui->RefAllResources->setChecked(settings.Options.RefAllResources);
ui->SaveAllInitials->setChecked(settings.Options.SaveAllInitials);
ui->DelayForDebugger->setValue(settings.Options.DelayForDebugger);
ui->VerifyMapWrites->setChecked(settings.Options.VerifyMapWrites);
ui->AutoStart->setChecked(settings.AutoStart);
ui->AllowFullscreen->setChecked(settings.options.allowFullscreen);
ui->AllowVSync->setChecked(settings.options.allowVSync);
ui->HookIntoChildren->setChecked(settings.options.hookIntoChildren);
ui->CaptureCallstacks->setChecked(settings.options.captureCallstacks);
ui->CaptureCallstacksOnlyDraws->setChecked(settings.options.captureCallstacksOnlyDraws);
ui->APIValidation->setChecked(settings.options.apiValidation);
ui->RefAllResources->setChecked(settings.options.refAllResources);
ui->SaveAllInitials->setChecked(settings.options.saveAllInitials);
ui->DelayForDebugger->setValue(settings.options.delayForDebugger);
ui->VerifyMapWrites->setChecked(settings.options.verifyMapWrites);
ui->AutoStart->setChecked(settings.autoStart);
// force flush this state
on_CaptureCallstacks_toggled(ui->CaptureCallstacks->isChecked());
if(settings.AutoStart)
if(settings.autoStart)
{
TriggerCapture();
}
@@ -940,27 +940,27 @@ CaptureSettings CaptureDialog::Settings()
{
CaptureSettings ret;
ret.Inject = IsInjectMode();
ret.inject = IsInjectMode();
ret.AutoStart = ui->AutoStart->isChecked();
ret.autoStart = ui->AutoStart->isChecked();
ret.Executable = ui->exePath->text();
ret.WorkingDir = ui->workDirPath->text();
ret.CmdLine = ui->cmdline->text();
ret.executable = ui->exePath->text();
ret.workingDir = ui->workDirPath->text();
ret.commandLine = ui->cmdline->text();
ret.Environment = m_EnvModifications;
ret.environment = m_EnvModifications;
ret.Options.AllowFullscreen = ui->AllowFullscreen->isChecked();
ret.Options.AllowVSync = ui->AllowVSync->isChecked();
ret.Options.HookIntoChildren = ui->HookIntoChildren->isChecked();
ret.Options.CaptureCallstacks = ui->CaptureCallstacks->isChecked();
ret.Options.CaptureCallstacksOnlyDraws = ui->CaptureCallstacksOnlyDraws->isChecked();
ret.Options.APIValidation = ui->APIValidation->isChecked();
ret.Options.RefAllResources = ui->RefAllResources->isChecked();
ret.Options.SaveAllInitials = ui->SaveAllInitials->isChecked();
ret.Options.CaptureAllCmdLists = ui->CaptureAllCmdLists->isChecked();
ret.Options.DelayForDebugger = (uint32_t)ui->DelayForDebugger->value();
ret.Options.VerifyMapWrites = ui->VerifyMapWrites->isChecked();
ret.options.allowFullscreen = ui->AllowFullscreen->isChecked();
ret.options.allowVSync = ui->AllowVSync->isChecked();
ret.options.hookIntoChildren = ui->HookIntoChildren->isChecked();
ret.options.captureCallstacks = ui->CaptureCallstacks->isChecked();
ret.options.captureCallstacksOnlyDraws = ui->CaptureCallstacksOnlyDraws->isChecked();
ret.options.apiValidation = ui->APIValidation->isChecked();
ret.options.refAllResources = ui->RefAllResources->isChecked();
ret.options.saveAllInitials = ui->SaveAllInitials->isChecked();
ret.options.captureAllCmdLists = ui->CaptureAllCmdLists->isChecked();
ret.options.delayForDebugger = (uint32_t)ui->DelayForDebugger->value();
ret.options.verifyMapWrites = ui->VerifyMapWrites->isChecked();
return ret;
}
@@ -1107,7 +1107,7 @@ void CaptureDialog::TriggerCapture()
QString name = m_ProcessModel->data(m_ProcessModel->index(item.row(), 0)).toString();
uint32_t PID = m_ProcessModel->data(m_ProcessModel->index(item.row(), 1)).toUInt();
m_InjectCallback(PID, Settings().Environment, name, Settings().Options,
m_InjectCallback(PID, Settings().environment, name, Settings().options,
[this](LiveCapture *live) {
if(ui->queueFrameCap->isChecked())
live->QueueCapture((int)ui->queuedFrame->value());
@@ -1144,7 +1144,7 @@ void CaptureDialog::TriggerCapture()
QString cmdLine = ui->cmdline->text();
m_CaptureCallback(exe, workingDir, cmdLine, Settings().Environment, Settings().Options,
m_CaptureCallback(exe, workingDir, cmdLine, Settings().environment, Settings().options,
[this](LiveCapture *live) {
if(ui->queueFrameCap->isChecked())
live->QueueCapture((int)ui->queuedFrame->value());
+4 -4
View File
@@ -360,7 +360,7 @@ void CrashDialog::sendReport()
if(!m_ReportID.isEmpty())
{
BugReport bug;
bug.ID = m_ReportID;
bug.reportId = m_ReportID;
QString url = bug.URL();
text +=
@@ -409,9 +409,9 @@ void CrashDialog::on_buttonBox_accepted()
{
// add to list of bug reports to check for updates.
BugReport bug;
bug.ID = m_ReportID;
bug.SubmitDate = QDateTime::currentDateTimeUtc();
bug.CheckDate = QDateTime::currentDateTimeUtc();
bug.reportId = m_ReportID;
bug.submitDate = QDateTime::currentDateTimeUtc();
bug.checkDate = QDateTime::currentDateTimeUtc();
m_Config.CrashReport_ReportedBugs.push_back(bug);
if(m_Config.CrashReport_ReportedBugs.count() > 20)
+25 -25
View File
@@ -618,8 +618,8 @@ bool LiveCapture::checkAllowClose()
// to by having an active connection or replay context on that host.
if(suppressRemoteWarning == false && (!m_Connection || !m_Connection->Connected()) &&
!cap->local && (!m_Ctx.Replay().CurrentRemote() ||
QString(m_Ctx.Replay().CurrentRemote()->Hostname) != m_Hostname ||
!m_Ctx.Replay().CurrentRemote()->Connected))
QString(m_Ctx.Replay().CurrentRemote()->hostname) != m_Hostname ||
!m_Ctx.Replay().CurrentRemote()->connected))
{
QMessageBox::StandardButton res2 = RDDialog::question(
this, tr("No active replay context"),
@@ -671,8 +671,8 @@ void LiveCapture::openCapture(Capture *cap)
cap->opened = true;
if(!cap->local && (!m_Ctx.Replay().CurrentRemote() ||
QString(m_Ctx.Replay().CurrentRemote()->Hostname) != m_Hostname ||
!m_Ctx.Replay().CurrentRemote()->Connected))
QString(m_Ctx.Replay().CurrentRemote()->hostname) != m_Hostname ||
!m_Ctx.Replay().CurrentRemote()->connected))
{
RDDialog::critical(
this, tr("No active replay context"),
@@ -726,8 +726,8 @@ bool LiveCapture::saveCapture(Capture *cap)
else
{
if(!m_Ctx.Replay().CurrentRemote() ||
QString(m_Ctx.Replay().CurrentRemote()->Hostname) != m_Hostname ||
!m_Ctx.Replay().CurrentRemote()->Connected)
QString(m_Ctx.Replay().CurrentRemote()->hostname) != m_Hostname ||
!m_Ctx.Replay().CurrentRemote()->connected)
{
RDDialog::critical(this, tr("No active replay context"),
tr("This capture is on remote host %1 and there is no active replay "
@@ -952,8 +952,8 @@ void LiveCapture::connectionClosed()
if(!cap->local)
{
if(!m_Ctx.Replay().CurrentRemote() ||
QString(m_Ctx.Replay().CurrentRemote()->Hostname) != m_Hostname ||
!m_Ctx.Replay().CurrentRemote()->Connected)
QString(m_Ctx.Replay().CurrentRemote()->hostname) != m_Hostname ||
!m_Ctx.Replay().CurrentRemote()->connected)
return;
}
@@ -1089,9 +1089,9 @@ void LiveCapture::connectionThreadEntry()
TargetControlMessage msg = m_Connection->ReceiveMessage();
if(msg.Type == TargetControlMessageType::RegisterAPI)
if(msg.type == TargetControlMessageType::RegisterAPI)
{
QString api = msg.RegisterAPI.APIName;
QString api = msg.apiUse.name;
GUIInvoke::call([this, api]() {
QString target = QString::fromUtf8(m_Connection->GetTarget());
uint32_t pid = m_Connection->GetPID();
@@ -1111,16 +1111,16 @@ void LiveCapture::connectionThreadEntry()
});
}
if(msg.Type == TargetControlMessageType::NewCapture)
if(msg.type == TargetControlMessageType::NewCapture)
{
uint32_t capID = msg.NewCapture.ID;
uint32_t capID = msg.newCapture.captureId;
QDateTime timestamp = QDateTime(QDate(1970, 1, 1), QTime(0, 0, 0));
timestamp = timestamp.addSecs(msg.NewCapture.timestamp).toLocalTime();
bytebuf thumb = msg.NewCapture.thumbnail;
int32_t thumbWidth = msg.NewCapture.thumbWidth;
int32_t thumbHeight = msg.NewCapture.thumbHeight;
QString path = msg.NewCapture.path;
bool local = msg.NewCapture.local;
timestamp = timestamp.addSecs(msg.newCapture.timestamp).toLocalTime();
bytebuf thumb = msg.newCapture.thumbnail;
int32_t thumbWidth = msg.newCapture.thumbWidth;
int32_t thumbHeight = msg.newCapture.thumbHeight;
QString path = msg.newCapture.path;
bool local = msg.newCapture.local;
GUIInvoke::call([this, capID, timestamp, thumb, thumbWidth, thumbHeight, path, local]() {
QString target = QString::fromUtf8(m_Connection->GetTarget());
@@ -1130,21 +1130,21 @@ void LiveCapture::connectionThreadEntry()
});
}
if(msg.Type == TargetControlMessageType::CaptureCopied)
if(msg.type == TargetControlMessageType::CaptureCopied)
{
uint32_t capID = msg.NewCapture.ID;
QString path = msg.NewCapture.path;
uint32_t capID = msg.newCapture.captureId;
QString path = msg.newCapture.path;
GUIInvoke::call([=]() { captureCopied(capID, path); });
}
if(msg.Type == TargetControlMessageType::NewChild)
if(msg.type == TargetControlMessageType::NewChild)
{
if(msg.NewChild.PID != 0)
if(msg.newChild.processId != 0)
{
ChildProcess c;
c.PID = (int)msg.NewChild.PID;
c.ident = msg.NewChild.ident;
c.PID = (int)msg.newChild.processId;
c.ident = msg.newChild.ident;
{
QMutexLocker l(&m_ChildrenLock);
@@ -273,10 +273,10 @@ void PerformanceCounterSelection::SetCounters(const QVector<CounterDescription>
for(const CounterDescription &desc : descriptions)
{
m_CounterToUuid[desc.counterID] = desc.uuid;
m_UuidToCounter[desc.uuid] = desc.counterID;
m_CounterToUuid[desc.counter] = desc.uuid;
m_UuidToCounter[desc.uuid] = desc.counter;
const CounterFamily family = GetCounterFamily(desc.counterID);
const CounterFamily family = GetCounterFamily(desc.counter);
if(family != currentFamily)
{
currentRoot = new RDTreeWidgetItem();
@@ -314,12 +314,12 @@ void PerformanceCounterSelection::SetCounters(const QVector<CounterDescription>
RDTreeWidgetItem *counterItem = new RDTreeWidgetItem();
counterItem->setText(0, desc.name);
counterItem->setData(0, CounterDescriptionRole, desc.description);
counterItem->setData(0, CounterIdRole, (uint32_t)desc.counterID);
counterItem->setData(0, CounterIdRole, (uint32_t)desc.counter);
counterItem->setCheckState(0, Qt::Unchecked);
counterItem->setData(0, PreviousCheckStateRole, Qt::Unchecked);
categoryItem->addChild(counterItem);
m_CounterToTreeItem[desc.counterID] = counterItem;
m_CounterToTreeItem[desc.counter] = counterItem;
}
}
+22 -22
View File
@@ -142,8 +142,8 @@ void RemoteManager::setRemoteServerLive(RDTreeWidgetItem *node, bool live, bool
if(!host)
return;
host->ServerRunning = live;
host->Busy = busy;
host->serverRunning = live;
host->busy = busy;
if(host->IsLocalhost())
{
@@ -154,11 +154,11 @@ void RemoteManager::setRemoteServerLive(RDTreeWidgetItem *node, bool live, bool
{
QString text = live ? tr("Remote server running") : tr("No remote server");
if(host->Connected)
if(host->connected)
text += tr(" (Active Context)");
else if(host->VersionMismatch)
else if(host->versionMismatch)
text += tr(" (Version Mismatch)");
else if(host->Busy)
else if(host->busy)
text += tr(" (Busy)");
node->setText(1, text);
@@ -170,7 +170,7 @@ void RemoteManager::setRemoteServerLive(RDTreeWidgetItem *node, bool live, bool
bool RemoteManager::isRemoteServerLive(RDTreeWidgetItem *node)
{
RemoteHost *host = getRemoteHost(node);
return host && host->ServerRunning;
return host && host->serverRunning;
}
void RemoteManager::addHost(RemoteHost *host)
@@ -228,7 +228,7 @@ void RemoteManager::refreshHost(RDTreeWidgetItem *node)
host->CheckStatus();
GUIInvoke::call(
[this, node, host]() { setRemoteServerLive(node, host->ServerRunning, host->Busy); });
[this, node, host]() { setRemoteServerLive(node, host->serverRunning, host->busy); });
uint32_t nextIdent = 0;
@@ -237,13 +237,13 @@ void RemoteManager::refreshHost(RDTreeWidgetItem *node)
// just a sanity check to make sure we don't hit some unexpected case and infinite loop
uint32_t prevIdent = nextIdent;
nextIdent = RENDERDOC_EnumerateRemoteTargets(host->Hostname.c_str(), nextIdent);
nextIdent = RENDERDOC_EnumerateRemoteTargets(host->hostname.c_str(), nextIdent);
if(nextIdent == 0 || prevIdent >= nextIdent)
break;
ITargetControl *conn =
RENDERDOC_CreateTargetControl(host->Hostname.c_str(), nextIdent, username.data(), false);
RENDERDOC_CreateTargetControl(host->hostname.c_str(), nextIdent, username.data(), false);
if(conn)
{
@@ -258,7 +258,7 @@ void RemoteManager::refreshHost(RDTreeWidgetItem *node)
else
running = tr("Running %1").arg(api);
RemoteConnect tag(host->Hostname, host->Name(), nextIdent);
RemoteConnect tag(host->hostname, host->Name(), nextIdent);
GUIInvoke::call([this, node, target, running, tag]() {
RDTreeWidgetItem *child = new RDTreeWidgetItem({target, running});
@@ -340,18 +340,18 @@ void RemoteManager::updateConnectButton()
ui->connect->setText(tr("Run Server"));
ui->connect->setEnabled(false);
}
else if(host->ServerRunning)
else if(host->serverRunning)
{
ui->connect->setText(tr("Shutdown"));
if(host->Busy && !host->Connected)
if(host->busy && !host->connected)
ui->connect->setEnabled(false);
}
else
{
ui->connect->setText(tr("Run Server"));
if(host->RunCommand.isEmpty())
if(host->runCommand.isEmpty())
ui->connect->setEnabled(false);
}
}
@@ -371,7 +371,7 @@ void RemoteManager::addNewHost()
for(int i = 0; i < m_Ctx.Config().RemoteHosts.count(); i++)
{
QString hostname = m_Ctx.Config().RemoteHosts[i]->Hostname;
QString hostname = m_Ctx.Config().RemoteHosts[i]->hostname;
if(hostname.compare(host, Qt::CaseInsensitive) == 0)
{
found = true;
@@ -382,8 +382,8 @@ void RemoteManager::addNewHost()
if(!found)
{
RemoteHost *h = new RemoteHost();
h->Hostname = host;
h->RunCommand = ui->runCommand->text().trimmed();
h->hostname = host;
h->runCommand = ui->runCommand->text().trimmed();
m_Ctx.Config().RemoteHosts.push_back(h);
m_Ctx.Config().Save();
@@ -406,7 +406,7 @@ void RemoteManager::setRunCommand()
if(h)
{
h->RunCommand = ui->runCommand->text().trimmed();
h->runCommand = ui->runCommand->text().trimmed();
m_Ctx.Config().Save();
}
}
@@ -451,12 +451,12 @@ void RemoteManager::on_hosts_itemSelectionChanged()
if(ui->refreshAll->isEnabled())
ui->refreshOne->setEnabled(true);
ui->runCommand->setText(host->RunCommand);
ui->runCommand->setText(host->runCommand);
ui->hostname->setText(host->Name());
ui->addUpdateHost->setText(tr("Update"));
if(host->IsLocalhost() || host->IsHostADB())
if(host->IsLocalhost() || host->IsADB())
{
// localhost and android hosts cannot be updated or have their run command changed
ui->addUpdateHost->setEnabled(false);
@@ -591,7 +591,7 @@ void RemoteManager::on_connect_clicked()
}
else if(host)
{
if(host->ServerRunning)
if(host->serverRunning)
{
QMessageBox::StandardButton res = RDDialog::question(
this, tr("Remote server shutdown"),
@@ -602,7 +602,7 @@ void RemoteManager::on_connect_clicked()
return;
// shut down
if(host->Connected)
if(host->connected)
{
m_Ctx.Replay().ShutdownServer();
setRemoteServerLive(node, false, false);
@@ -611,7 +611,7 @@ void RemoteManager::on_connect_clicked()
{
IRemoteServer *server = NULL;
ReplayStatus status =
RENDERDOC_CreateRemoteServerConnection(host->Hostname.c_str(), 0, &server);
RENDERDOC_CreateRemoteServerConnection(host->hostname.c_str(), 0, &server);
if(server)
server->ShutdownServerAndConnection();
setRemoteServerLive(node, false, false);