From 33ff48811b493bb426332d734bdf8820ad407390 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 16 Nov 2017 14:21:42 +0000 Subject: [PATCH] Normalise terminology in UI code - don't call captures 'logs' * Log is an overloaded term since it can also mean the debug log. We now consistently refer to capture files as capture files or just captures for short. The log is just for log messages and diagnostics. * The user-facing UI was mostly already consistent, but many of the public interfaces exposed to python needed to be renamed, and it made more sense just to make everything consistent. --- qrenderdoc/Code/CaptureContext.cpp | 139 +++++++--- qrenderdoc/Code/CaptureContext.h | 42 +-- .../Code/Interface/CommonPipelineState.cpp | 180 ++++++------ .../Code/Interface/CommonPipelineState.h | 34 +-- .../Code/Interface/PersistantConfig.cpp | 9 + qrenderdoc/Code/Interface/PersistantConfig.h | 12 +- qrenderdoc/Code/Interface/QRDInterface.h | 86 +++--- qrenderdoc/Code/ReplayManager.cpp | 22 +- qrenderdoc/Code/ReplayManager.h | 8 +- qrenderdoc/Widgets/CustomPaintWidget.h | 2 +- qrenderdoc/Windows/APIInspector.cpp | 8 +- qrenderdoc/Windows/APIInspector.h | 8 +- qrenderdoc/Windows/BufferViewer.cpp | 30 +- qrenderdoc/Windows/BufferViewer.h | 8 +- .../Windows/ConstantBufferPreviewer.cpp | 10 +- qrenderdoc/Windows/ConstantBufferPreviewer.h | 8 +- qrenderdoc/Windows/DebugMessageView.cpp | 10 +- qrenderdoc/Windows/DebugMessageView.h | 8 +- qrenderdoc/Windows/Dialogs/CaptureDialog.cpp | 8 +- qrenderdoc/Windows/Dialogs/LiveCapture.cpp | 246 +++++++++-------- qrenderdoc/Windows/Dialogs/LiveCapture.h | 20 +- qrenderdoc/Windows/Dialogs/SettingsDialog.ui | 4 +- qrenderdoc/Windows/EventBrowser.cpp | 28 +- qrenderdoc/Windows/EventBrowser.h | 8 +- qrenderdoc/Windows/MainWindow.cpp | 261 ++++++++---------- qrenderdoc/Windows/MainWindow.h | 41 ++- qrenderdoc/Windows/MainWindow.ui | 29 +- .../Windows/PerformanceCounterViewer.cpp | 14 +- qrenderdoc/Windows/PerformanceCounterViewer.h | 8 +- .../D3D11PipelineStateViewer.cpp | 14 +- .../PipelineState/D3D11PipelineStateViewer.h | 8 +- .../D3D12PipelineStateViewer.cpp | 12 +- .../PipelineState/D3D12PipelineStateViewer.h | 8 +- .../PipelineState/GLPipelineStateViewer.cpp | 12 +- .../PipelineState/GLPipelineStateViewer.h | 8 +- .../PipelineState/PipelineStateViewer.cpp | 24 +- .../PipelineState/PipelineStateViewer.h | 10 +- .../VulkanPipelineStateViewer.cpp | 12 +- .../PipelineState/VulkanPipelineStateViewer.h | 6 +- qrenderdoc/Windows/PixelHistoryView.cpp | 8 +- qrenderdoc/Windows/PixelHistoryView.h | 8 +- qrenderdoc/Windows/PythonShell.cpp | 33 ++- qrenderdoc/Windows/ResourceInspector.cpp | 8 +- qrenderdoc/Windows/ResourceInspector.h | 8 +- qrenderdoc/Windows/ShaderViewer.cpp | 8 +- qrenderdoc/Windows/ShaderViewer.h | 8 +- qrenderdoc/Windows/StatisticsViewer.cpp | 10 +- qrenderdoc/Windows/StatisticsViewer.h | 8 +- qrenderdoc/Windows/TextureViewer.cpp | 34 +-- qrenderdoc/Windows/TextureViewer.h | 8 +- qrenderdoc/Windows/TimelineBar.cpp | 8 +- qrenderdoc/Windows/TimelineBar.h | 8 +- 52 files changed, 810 insertions(+), 752 deletions(-) diff --git a/qrenderdoc/Code/CaptureContext.cpp b/qrenderdoc/Code/CaptureContext.cpp index 424ff4a4d..a4b61ddab 100644 --- a/qrenderdoc/Code/CaptureContext.cpp +++ b/qrenderdoc/Code/CaptureContext.cpp @@ -55,7 +55,7 @@ CaptureContext::CaptureContext(QString paramFilename, QString remoteHost, uint32 bool temp, PersistantConfig &cfg) : m_Config(cfg), m_CurPipelineState(*this) { - m_LogLoaded = false; + m_CaptureLoaded = false; m_LoadInProgress = false; m_EventID = 0; @@ -89,7 +89,7 @@ CaptureContext::CaptureContext(QString paramFilename, QString remoteHost, uint32 m_MainWindow->LoadFromFilename(paramFilename, temp); if(temp) - m_MainWindow->takeLogOwnership(); + m_MainWindow->takeCaptureOwnership(); } } @@ -105,7 +105,7 @@ bool CaptureContext::isRunning() return m_MainWindow && m_MainWindow->isVisible(); } -QString CaptureContext::TempLogFilename(QString appname) +QString CaptureContext::TempCaptureFilename(QString appname) { QString folder = Config().TemporaryCaptureDirectory; @@ -126,13 +126,13 @@ QString CaptureContext::TempLogFilename(QString appname) .arg(QDateTime::currentDateTimeUtc().toString(lit("yyyy.MM.dd_HH.mm.ss")))); } -void CaptureContext::LoadLogfile(const QString &logFile, const QString &origFilename, +void CaptureContext::LoadCapture(const QString &captureFile, const QString &origFilename, bool temporary, bool local) { m_LoadInProgress = true; - LambdaThread *thread = new LambdaThread([this, logFile, origFilename, temporary, local]() { - LoadLogfileThreaded(logFile, origFilename, temporary, local); + LambdaThread *thread = new LambdaThread([this, captureFile, origFilename, temporary, local]() { + LoadCaptureThreaded(captureFile, origFilename, temporary, local); }); thread->selfDelete(true); thread->start(); @@ -143,22 +143,24 @@ void CaptureContext::LoadLogfile(const QString &logFile, const QString &origFile m_MainWindow->setProgress(-1.0f); - if(m_LogLoaded) + if(m_CaptureLoaded) { - QVector logviewers(m_LogViewers); + m_CaptureTemporary = temporary; - // make sure we're on a consistent event before invoking log viewer forms + QVector viewers(m_CaptureViewers); + + // make sure we're on a consistent event before invoking viewer forms if(m_LastDrawcall) - SetEventID(logviewers, m_LastDrawcall->eventID, true); + SetEventID(viewers, m_LastDrawcall->eventID, true); else if(!m_Drawcalls.empty()) - SetEventID(logviewers, m_Drawcalls.back().eventID, true); + SetEventID(viewers, m_Drawcalls.back().eventID, true); - GUIInvoke::blockcall([&logviewers]() { - // notify all the registers log viewers that a log has been loaded - for(ILogViewer *logviewer : logviewers) + GUIInvoke::blockcall([&viewers]() { + // notify all the registers viewers that a capture has been loaded + for(ICaptureViewer *viewer : viewers) { - if(logviewer) - logviewer->OnLogfileLoaded(); + if(viewer) + viewer->OnCaptureLoaded(); } }); } @@ -173,32 +175,32 @@ float CaptureContext::UpdateLoadProgress() return val; } -void CaptureContext::LoadLogfileThreaded(const QString &logFile, const QString &origFilename, +void CaptureContext::LoadCaptureThreaded(const QString &captureFile, const QString &origFilename, bool temporary, bool local) { - m_LogFile = origFilename; + m_CaptureFile = origFilename; - m_LogLocal = local; + m_CaptureLocal = local; Config().Save(); m_LoadProgress = 0.0f; m_PostloadProgress = 0.0f; - // this function call will block until the log is either loaded, or there's some failure - m_Renderer.OpenCapture(logFile, &m_LoadProgress); + // this function call will block until the capture is either loaded, or there's some failure + m_Renderer.OpenCapture(captureFile, &m_LoadProgress); // if the renderer isn't running, we hit a failure case so display an error message if(!m_Renderer.IsRunning()) { QString errmsg = ToQStr(m_Renderer.GetCreateStatus()); - QString messageText = tr("%1\nFailed to open logfile for replay: %2.\n\n" + QString messageText = tr("%1\nFailed to open capture for replay: %2.\n\n" "Check diagnostic log in Help menu for more details.") - .arg(logFile) + .arg(captureFile) .arg(errmsg); - RDDialog::critical(NULL, tr("Error opening log"), messageText); + RDDialog::critical(NULL, tr("Error opening capture"), messageText); m_LoadInProgress = false; return; @@ -206,7 +208,7 @@ void CaptureContext::LoadLogfileThreaded(const QString &logFile, const QString & if(!temporary) { - AddRecentFile(Config().RecentLogFiles, origFilename, 10); + AddRecentFile(Config().RecentCaptureFiles, origFilename, 10); Config().Save(); } @@ -296,13 +298,13 @@ void CaptureContext::LoadLogfileThreaded(const QString &logFile, const QString & QDateTime today = QDateTime::currentDateTimeUtc(); QDateTime compare = today.addDays(-21); - if(compare > Config().DegradedLog_LastUpdate && m_APIProps.degraded) + if(compare > Config().DegradedCapture_LastUpdate && m_APIProps.degraded) { - Config().DegradedLog_LastUpdate = today; + Config().DegradedCapture_LastUpdate = today; RDDialog::critical( - NULL, tr("Degraded support of log"), - tr("%1\nThis log opened with degraded support - " + NULL, tr("Degraded support of capture"), + tr("%1\nThis capture opened with degraded support - " "this could mean missing hardware support caused a fallback to software rendering.\n\n" "This warning will not appear every time this happens, " "check debug errors/warnings window for more details.") @@ -310,7 +312,7 @@ void CaptureContext::LoadLogfileThreaded(const QString &logFile, const QString & } m_LoadInProgress = false; - m_LogLoaded = true; + m_CaptureLoaded = true; } bool CaptureContext::PassEquivalent(const DrawcallDescription &a, const DrawcallDescription &b) @@ -527,12 +529,59 @@ void CaptureContext::AddFakeProfileMarkers() m_Drawcalls = ret; } -void CaptureContext::CloseLogfile() +bool CaptureContext::SaveCaptureTo(const QString &captureFile) { - if(!m_LogLoaded) + bool success = false; + QString error; + + if(IsCaptureLocal()) + { + if(QFileInfo(GetCaptureFilename()).exists()) + { + // QFile::copy won't overwrite, so remove the destination first (the save dialog already + // prompted for overwrite) + QFile::remove(captureFile); + success = QFile::copy(GetCaptureFilename(), captureFile); + + error = tr("Couldn't save to %1").arg(captureFile); + } + else + { + RDDialog::critical( + NULL, tr("File not found"), + error = + tr("Capture '%1' couldn't be found on disk, cannot save.").arg(GetCaptureFilename())); + success = false; + } + } + else + { + Replay().CopyCaptureFromRemote(GetCaptureFilename(), captureFile, m_MainWindow); + success = QFile::exists(captureFile); + + error = tr("File couldn't be transferred from remote host"); + } + + if(!success) + { + RDDialog::critical(NULL, tr("Error Saving"), error); + return false; + } + + m_CaptureFile = captureFile; + m_CaptureTemporary = false; + + return true; +} + +void CaptureContext::CloseCapture() +{ + if(!m_CaptureLoaded) return; - m_LogFile = QString(); + m_CaptureTemporary = false; + + m_CaptureFile = QString(); m_Renderer.CloseThread(); @@ -561,18 +610,18 @@ void CaptureContext::CloseLogfile() m_DebugMessages.clear(); m_UnreadMessageCount = 0; - m_LogLoaded = false; + m_CaptureLoaded = false; - QVector logviewers(m_LogViewers); + QVector capviewers(m_CaptureViewers); - for(ILogViewer *logviewer : logviewers) + for(ICaptureViewer *viewer : capviewers) { - if(logviewer) - logviewer->OnLogfileClosed(); + if(viewer) + viewer->OnCaptureClosed(); } } -void CaptureContext::SetEventID(const QVector &exclude, uint32_t selectedEventID, +void CaptureContext::SetEventID(const QVector &exclude, uint32_t selectedEventID, uint32_t eventID, bool force) { uint32_t prevSelectedEventID = m_SelectedEventID; @@ -596,18 +645,18 @@ void CaptureContext::SetEventID(const QVector &exclude, uint32_t s RefreshUIStatus(exclude, updateSelectedEvent, updateEvent); } -void CaptureContext::RefreshUIStatus(const QVector &exclude, bool updateSelectedEvent, - bool updateEvent) +void CaptureContext::RefreshUIStatus(const QVector &exclude, + bool updateSelectedEvent, bool updateEvent) { - for(ILogViewer *logviewer : m_LogViewers) + for(ICaptureViewer *viewer : m_CaptureViewers) { - if(exclude.contains(logviewer)) + if(exclude.contains(viewer)) continue; if(updateSelectedEvent) - logviewer->OnSelectedEventChanged(m_SelectedEventID); + viewer->OnSelectedEventChanged(m_SelectedEventID); if(updateEvent) - logviewer->OnEventChanged(m_EventID); + viewer->OnEventChanged(m_EventID); } } diff --git a/qrenderdoc/Code/CaptureContext.h b/qrenderdoc/Code/CaptureContext.h index 89a2319c9..8af2287e6 100644 --- a/qrenderdoc/Code/CaptureContext.h +++ b/qrenderdoc/Code/CaptureContext.h @@ -65,43 +65,44 @@ public: bool isRunning(); QString ConfigFilePath(const QString &filename) override { return ::ConfigFilePath(filename); } - QString TempLogFilename(QString appname) override; + QString TempCaptureFilename(QString appname) override; ////////////////////////////////////////////////////////////////////////////// // Control functions - void LoadLogfile(const QString &logFile, const QString &origFilename, bool temporary, + void LoadCapture(const QString &captureFile, const QString &origFilename, bool temporary, bool local) override; + bool SaveCaptureTo(const QString &captureFile) override; + void CloseCapture() override; - void CloseLogfile() override; - - void SetEventID(const QVector &exclude, uint32_t selectedEventID, uint32_t eventID, - bool force = false) override; + void SetEventID(const QVector &exclude, uint32_t selectedEventID, + uint32_t eventID, bool force = false) override; void RefreshStatus() override { SetEventID({}, m_SelectedEventID, m_EventID, true); } - void RefreshUIStatus(const QVector &exclude, bool updateSelectedEvent, + void RefreshUIStatus(const QVector &exclude, bool updateSelectedEvent, bool updateEvent); - void AddLogViewer(ILogViewer *f) override + void AddCaptureViewer(ICaptureViewer *f) override { - m_LogViewers.push_back(f); + m_CaptureViewers.push_back(f); - if(LogLoaded()) + if(IsCaptureLoaded()) { - f->OnLogfileLoaded(); + f->OnCaptureLoaded(); f->OnEventChanged(CurEvent()); } } - void RemoveLogViewer(ILogViewer *f) override { m_LogViewers.removeAll(f); } + void RemoveCaptureViewer(ICaptureViewer *f) override { m_CaptureViewers.removeAll(f); } ////////////////////////////////////////////////////////////////////////////// // Accessors ReplayManager &Replay() override { return m_Renderer; } - bool LogLoaded() override { return m_LogLoaded; } - bool IsLogLocal() override { return m_LogLocal; } - bool LogLoading() override { return m_LoadInProgress; } - QString LogFilename() override { return m_LogFile; } + bool IsCaptureLoaded() override { return m_CaptureLoaded; } + bool IsCaptureLocal() override { return m_CaptureLocal; } + bool IsCaptureTemporary() override { return m_CaptureTemporary; } + bool IsCaptureLoading() override { return m_LoadInProgress; } + QString GetCaptureFilename() override { return m_CaptureFile; } const FrameDescription &FrameInfo() override { return m_FrameInfo; } const APIProperties &APIProps() override { return m_APIProps; } uint32_t CurSelectedEvent() override { return m_SelectedEventID; } @@ -227,10 +228,11 @@ private: PersistantConfig &m_Config; - QVector m_LogViewers; + QVector m_CaptureViewers; - bool m_LogLoaded, m_LoadInProgress, m_LogLocal; - QString m_LogFile; + bool m_CaptureLoaded = false, m_LoadInProgress = false, m_CaptureLocal = false, + m_CaptureTemporary = false; + QString m_CaptureFile; QVector m_DebugMessages; int m_UnreadMessageCount = 0; @@ -243,7 +245,7 @@ private: float m_PostloadProgress = 0.0f; float UpdateLoadProgress(); - void LoadLogfileThreaded(const QString &logFile, const QString &origFilename, bool temporary, + void LoadCaptureThreaded(const QString &captureFile, const QString &origFilename, bool temporary, bool local); uint32_t m_SelectedEventID; diff --git a/qrenderdoc/Code/Interface/CommonPipelineState.cpp b/qrenderdoc/Code/Interface/CommonPipelineState.cpp index fb705d452..6523ed04e 100644 --- a/qrenderdoc/Code/Interface/CommonPipelineState.cpp +++ b/qrenderdoc/Code/Interface/CommonPipelineState.cpp @@ -28,9 +28,9 @@ QString CommonPipelineState::GetResourceLayout(ResourceId id) { - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogVK()) + if(IsCaptureVK()) { for(const VKPipe::ImageData &i : m_Vulkan->images) { @@ -39,7 +39,7 @@ QString CommonPipelineState::GetResourceLayout(ResourceId id) } } - if(IsLogD3D12()) + if(IsCaptureD3D12()) { for(const D3D12Pipe::ResourceData &r : m_D3D12->Resources) { @@ -54,8 +54,8 @@ QString CommonPipelineState::GetResourceLayout(ResourceId id) QString CommonPipelineState::Abbrev(ShaderStage stage) { - if(IsLogD3D11() || (!LogLoaded() && DefaultType == GraphicsAPI::D3D11) || IsLogD3D12() || - (!LogLoaded() && DefaultType == GraphicsAPI::D3D12)) + if(IsCaptureD3D11() || (!IsCaptureLoaded() && DefaultType == GraphicsAPI::D3D11) || + IsCaptureD3D12() || (!IsCaptureLoaded() && DefaultType == GraphicsAPI::D3D12)) { switch(stage) { @@ -68,8 +68,8 @@ QString CommonPipelineState::Abbrev(ShaderStage stage) default: break; } } - else if(IsLogGL() || (!LogLoaded() && DefaultType == GraphicsAPI::OpenGL) || IsLogVK() || - (!LogLoaded() && DefaultType == GraphicsAPI::Vulkan)) + else if(IsCaptureGL() || (!IsCaptureLoaded() && DefaultType == GraphicsAPI::OpenGL) || + IsCaptureVK() || (!IsCaptureLoaded() && DefaultType == GraphicsAPI::Vulkan)) { switch(stage) { @@ -88,8 +88,8 @@ QString CommonPipelineState::Abbrev(ShaderStage stage) QString CommonPipelineState::OutputAbbrev() { - if(IsLogGL() || (!LogLoaded() && DefaultType == GraphicsAPI::OpenGL) || IsLogVK() || - (!LogLoaded() && DefaultType == GraphicsAPI::Vulkan)) + if(IsCaptureGL() || (!IsCaptureLoaded() && DefaultType == GraphicsAPI::OpenGL) || IsCaptureVK() || + (!IsCaptureLoaded() && DefaultType == GraphicsAPI::Vulkan)) { return lit("FB"); } @@ -175,8 +175,8 @@ const VKPipe::Shader &CommonPipelineState::GetVulkanStage(ShaderStage stage) QString CommonPipelineState::GetShaderExtension() { - if(IsLogGL() || (!LogLoaded() && DefaultType == GraphicsAPI::OpenGL) || IsLogVK() || - (!LogLoaded() && DefaultType == GraphicsAPI::Vulkan)) + if(IsCaptureGL() || (!IsCaptureLoaded() && DefaultType == GraphicsAPI::OpenGL) || IsCaptureVK() || + (!IsCaptureLoaded() && DefaultType == GraphicsAPI::Vulkan)) { return lit("glsl"); } @@ -192,30 +192,30 @@ Viewport CommonPipelineState::GetViewport(int index) ret.x = ret.y = 0.0f; ret.width = ret.height = 1.0f; - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11() && index < m_D3D11->m_RS.Viewports.count()) + if(IsCaptureD3D11() && index < m_D3D11->m_RS.Viewports.count()) { ret.x = m_D3D11->m_RS.Viewports[index].X; ret.y = m_D3D11->m_RS.Viewports[index].Y; ret.width = m_D3D11->m_RS.Viewports[index].Width; ret.height = m_D3D11->m_RS.Viewports[index].Height; } - else if(IsLogD3D12() && index < m_D3D12->m_RS.Viewports.count()) + else if(IsCaptureD3D12() && index < m_D3D12->m_RS.Viewports.count()) { ret.x = m_D3D12->m_RS.Viewports[index].X; ret.y = m_D3D12->m_RS.Viewports[index].Y; ret.width = m_D3D12->m_RS.Viewports[index].Width; ret.height = m_D3D12->m_RS.Viewports[index].Height; } - else if(IsLogGL() && index < m_GL->m_Rasterizer.Viewports.count()) + else if(IsCaptureGL() && index < m_GL->m_Rasterizer.Viewports.count()) { ret.x = m_GL->m_Rasterizer.Viewports[index].Left; ret.y = m_GL->m_Rasterizer.Viewports[index].Bottom; ret.width = m_GL->m_Rasterizer.Viewports[index].Width; ret.height = m_GL->m_Rasterizer.Viewports[index].Height; } - else if(IsLogVK() && index < m_Vulkan->VP.viewportScissors.count()) + else if(IsCaptureVK() && index < m_Vulkan->VP.viewportScissors.count()) { ret.x = m_Vulkan->VP.viewportScissors[index].vp.x; ret.y = m_Vulkan->VP.viewportScissors[index].vp.y; @@ -229,9 +229,9 @@ Viewport CommonPipelineState::GetViewport(int index) const ShaderBindpointMapping &CommonPipelineState::GetBindpointMapping(ShaderStage stage) { - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11()) + if(IsCaptureD3D11()) { switch(stage) { @@ -244,7 +244,7 @@ const ShaderBindpointMapping &CommonPipelineState::GetBindpointMapping(ShaderSta default: break; } } - else if(IsLogD3D12()) + else if(IsCaptureD3D12()) { switch(stage) { @@ -257,7 +257,7 @@ const ShaderBindpointMapping &CommonPipelineState::GetBindpointMapping(ShaderSta default: break; } } - else if(IsLogGL()) + else if(IsCaptureGL()) { switch(stage) { @@ -270,7 +270,7 @@ const ShaderBindpointMapping &CommonPipelineState::GetBindpointMapping(ShaderSta default: break; } } - else if(IsLogVK()) + else if(IsCaptureVK()) { switch(stage) { @@ -292,9 +292,9 @@ const ShaderBindpointMapping &CommonPipelineState::GetBindpointMapping(ShaderSta const ShaderReflection *CommonPipelineState::GetShaderReflection(ShaderStage stage) { - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11()) + if(IsCaptureD3D11()) { switch(stage) { @@ -307,7 +307,7 @@ const ShaderReflection *CommonPipelineState::GetShaderReflection(ShaderStage sta default: break; } } - else if(IsLogD3D12()) + else if(IsCaptureD3D12()) { switch(stage) { @@ -320,7 +320,7 @@ const ShaderReflection *CommonPipelineState::GetShaderReflection(ShaderStage sta default: break; } } - else if(IsLogGL()) + else if(IsCaptureGL()) { switch(stage) { @@ -333,7 +333,7 @@ const ShaderReflection *CommonPipelineState::GetShaderReflection(ShaderStage sta default: break; } } - else if(IsLogVK()) + else if(IsCaptureVK()) { switch(stage) { @@ -353,11 +353,11 @@ const ShaderReflection *CommonPipelineState::GetShaderReflection(ShaderStage sta ResourceId CommonPipelineState::GetComputePipelineObject() { - if(LogLoaded() && IsLogVK()) + if(IsCaptureLoaded() && IsCaptureVK()) { return m_Vulkan->compute.obj; } - else if(LogLoaded() && IsLogD3D12()) + else if(IsCaptureLoaded() && IsCaptureD3D12()) { return m_D3D12->pipeline; } @@ -367,11 +367,11 @@ ResourceId CommonPipelineState::GetComputePipelineObject() ResourceId CommonPipelineState::GetGraphicsPipelineObject() { - if(LogLoaded() && IsLogVK()) + if(IsCaptureLoaded() && IsCaptureVK()) { return m_Vulkan->graphics.obj; } - else if(LogLoaded() && IsLogD3D12()) + else if(IsCaptureLoaded() && IsCaptureD3D12()) { return m_D3D12->pipeline; } @@ -381,7 +381,7 @@ ResourceId CommonPipelineState::GetGraphicsPipelineObject() QString CommonPipelineState::GetShaderEntryPoint(ShaderStage stage) { - if(LogLoaded() && IsLogVK()) + if(IsCaptureLoaded() && IsCaptureVK()) { switch(stage) { @@ -400,9 +400,9 @@ QString CommonPipelineState::GetShaderEntryPoint(ShaderStage stage) ResourceId CommonPipelineState::GetShader(ShaderStage stage) { - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11()) + if(IsCaptureD3D11()) { switch(stage) { @@ -415,7 +415,7 @@ ResourceId CommonPipelineState::GetShader(ShaderStage stage) default: break; } } - else if(IsLogD3D12()) + else if(IsCaptureD3D12()) { switch(stage) { @@ -428,7 +428,7 @@ ResourceId CommonPipelineState::GetShader(ShaderStage stage) default: break; } } - else if(IsLogGL()) + else if(IsCaptureGL()) { switch(stage) { @@ -441,7 +441,7 @@ ResourceId CommonPipelineState::GetShader(ShaderStage stage) default: break; } } - else if(IsLogVK()) + else if(IsCaptureVK()) { switch(stage) { @@ -463,9 +463,9 @@ QString CommonPipelineState::GetShaderName(ShaderStage stage) { QString ret; - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11()) + if(IsCaptureD3D11()) { switch(stage) { @@ -478,7 +478,7 @@ QString CommonPipelineState::GetShaderName(ShaderStage stage) default: break; } } - else if(IsLogD3D12()) + else if(IsCaptureD3D12()) { switch(stage) { @@ -491,7 +491,7 @@ QString CommonPipelineState::GetShaderName(ShaderStage stage) default: break; } } - else if(IsLogGL()) + else if(IsCaptureGL()) { switch(stage) { @@ -504,7 +504,7 @@ QString CommonPipelineState::GetShaderName(ShaderStage stage) default: break; } } - else if(IsLogVK()) + else if(IsCaptureVK()) { switch(stage) { @@ -527,24 +527,24 @@ QPair CommonPipelineState::GetIBuffer() ResourceId buf; uint64_t ByteOffset = 0; - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11()) + if(IsCaptureD3D11()) { buf = m_D3D11->m_IA.ibuffer.Buffer; ByteOffset = m_D3D11->m_IA.ibuffer.Offset; } - else if(IsLogD3D12()) + else if(IsCaptureD3D12()) { buf = m_D3D12->m_IA.ibuffer.Buffer; ByteOffset = m_D3D12->m_IA.ibuffer.Offset; } - else if(IsLogGL()) + else if(IsCaptureGL()) { buf = m_GL->m_VtxIn.ibuffer; ByteOffset = 0; // GL only has per-draw index offset } - else if(IsLogVK()) + else if(IsCaptureVK()) { buf = m_Vulkan->IA.ibuffer.buf; ByteOffset = m_Vulkan->IA.ibuffer.offs; @@ -556,22 +556,22 @@ QPair CommonPipelineState::GetIBuffer() bool CommonPipelineState::IsStripRestartEnabled() { - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11()) + if(IsCaptureD3D11()) { // D3D11 this is always enabled return true; } - else if(IsLogD3D12()) + else if(IsCaptureD3D12()) { return m_D3D12->m_IA.indexStripCutValue != 0; } - else if(IsLogGL()) + else if(IsCaptureGL()) { return m_GL->m_VtxIn.primitiveRestart; } - else if(IsLogVK()) + else if(IsCaptureVK()) { return m_Vulkan->IA.primitiveRestartEnable; } @@ -582,18 +582,18 @@ bool CommonPipelineState::IsStripRestartEnabled() uint32_t CommonPipelineState::GetStripRestartIndex() { - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11() || IsLogVK()) + if(IsCaptureD3D11() || IsCaptureVK()) { // D3D11 or Vulkan this is always '-1' return UINT32_MAX; } - else if(IsLogD3D12()) + else if(IsCaptureD3D12()) { return m_D3D12->m_IA.indexStripCutValue; } - else if(IsLogGL()) + else if(IsCaptureGL()) { return qMin(UINT32_MAX, m_GL->m_VtxIn.restartIndex); } @@ -606,9 +606,9 @@ QVector CommonPipelineState::GetVBuffers() { QVector ret; - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11()) + if(IsCaptureD3D11()) { ret.resize(m_D3D11->m_IA.vbuffers.count()); for(int i = 0; i < m_D3D11->m_IA.vbuffers.count(); i++) @@ -618,7 +618,7 @@ QVector CommonPipelineState::GetVBuffers() ret[i].ByteStride = m_D3D11->m_IA.vbuffers[i].Stride; } } - else if(IsLogD3D12()) + else if(IsCaptureD3D12()) { ret.resize(m_D3D12->m_IA.vbuffers.count()); for(int i = 0; i < m_D3D12->m_IA.vbuffers.count(); i++) @@ -628,7 +628,7 @@ QVector CommonPipelineState::GetVBuffers() ret[i].ByteStride = m_D3D12->m_IA.vbuffers[i].Stride; } } - else if(IsLogGL()) + else if(IsCaptureGL()) { ret.resize(m_GL->m_VtxIn.vbuffers.count()); for(int i = 0; i < m_GL->m_VtxIn.vbuffers.count(); i++) @@ -638,7 +638,7 @@ QVector CommonPipelineState::GetVBuffers() ret[i].ByteStride = m_GL->m_VtxIn.vbuffers[i].Stride; } } - else if(IsLogVK()) + else if(IsCaptureVK()) { ret.resize(m_Vulkan->VI.binds.count()); for(int i = 0; i < m_Vulkan->VI.binds.count(); i++) @@ -656,9 +656,9 @@ QVector CommonPipelineState::GetVBuffers() QVector CommonPipelineState::GetVertexInputs() { - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11()) + if(IsCaptureD3D11()) { uint32_t byteOffs[128] = {}; @@ -716,7 +716,7 @@ QVector CommonPipelineState::GetVertexInputs() return ret; } - else if(IsLogD3D12()) + else if(IsCaptureD3D12()) { uint32_t byteOffs[128] = {}; @@ -774,7 +774,7 @@ QVector CommonPipelineState::GetVertexInputs() return ret; } - else if(IsLogGL()) + else if(IsCaptureGL()) { auto &attrs = m_GL->m_VtxIn.attributes; @@ -851,7 +851,7 @@ QVector CommonPipelineState::GetVertexInputs() return ret; } - else if(IsLogVK()) + else if(IsCaptureVK()) { auto &attrs = m_Vulkan->VI.attrs; @@ -918,9 +918,9 @@ BoundCBuffer CommonPipelineState::GetConstantBuffer(ShaderStage stage, uint32_t uint64_t ByteOffset = 0; uint64_t ByteSize = 0; - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11()) + if(IsCaptureD3D11()) { const D3D11Pipe::Shader &s = GetD3D11Stage(stage); @@ -939,7 +939,7 @@ BoundCBuffer CommonPipelineState::GetConstantBuffer(ShaderStage stage, uint32_t ByteSize = descriptor.VecCount * 4 * sizeof(float); } } - else if(IsLogD3D12()) + else if(IsCaptureD3D12()) { const D3D12Pipe::Shader &s = GetD3D12Stage(stage); @@ -959,7 +959,7 @@ BoundCBuffer CommonPipelineState::GetConstantBuffer(ShaderStage stage, uint32_t ByteSize = descriptor.ByteSize; } } - else if(IsLogGL()) + else if(IsCaptureGL()) { const GLPipe::Shader &s = GetGLStage(stage); @@ -980,7 +980,7 @@ BoundCBuffer CommonPipelineState::GetConstantBuffer(ShaderStage stage, uint32_t } } } - else if(IsLogVK()) + else if(IsCaptureVK()) { const VKPipe::Pipeline &pipe = stage == ShaderStage::Compute ? m_Vulkan->compute : m_Vulkan->graphics; @@ -1021,9 +1021,9 @@ QMap> CommonPipelineState::GetReadOnlyResou { QMap> ret; - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11()) + if(IsCaptureD3D11()) { const D3D11Pipe::Shader &s = GetD3D11Stage(stage); @@ -1042,7 +1042,7 @@ QMap> CommonPipelineState::GetReadOnlyResou return ret; } - else if(IsLogD3D12()) + else if(IsCaptureD3D12()) { const D3D12Pipe::Shader &s = GetD3D12Stage(stage); @@ -1070,7 +1070,7 @@ QMap> CommonPipelineState::GetReadOnlyResou return ret; } - else if(IsLogGL()) + else if(IsCaptureGL()) { for(int i = 0; i < m_GL->Textures.count(); i++) { @@ -1087,7 +1087,7 @@ QMap> CommonPipelineState::GetReadOnlyResou return ret; } - else if(IsLogVK()) + else if(IsCaptureVK()) { const auto &descsets = stage == ShaderStage::Compute ? m_Vulkan->compute.DescSets : m_Vulkan->graphics.DescSets; @@ -1131,9 +1131,9 @@ QMap> CommonPipelineState::GetReadWriteReso { QMap> ret; - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11()) + if(IsCaptureD3D11()) { if(stage == ShaderStage::Compute) { @@ -1177,7 +1177,7 @@ QMap> CommonPipelineState::GetReadWriteReso } } } - else if(IsLogD3D12()) + else if(IsCaptureD3D12()) { const D3D12Pipe::Shader &s = GetD3D12Stage(stage); @@ -1203,7 +1203,7 @@ QMap> CommonPipelineState::GetReadWriteReso } } } - else if(IsLogGL()) + else if(IsCaptureGL()) { for(int i = 0; i < m_GL->Images.count(); i++) { @@ -1218,7 +1218,7 @@ QMap> CommonPipelineState::GetReadWriteReso ret[key] = {val}; } } - else if(IsLogVK()) + else if(IsCaptureVK()) { const auto &descsets = stage == ShaderStage::Compute ? m_Vulkan->compute.DescSets : m_Vulkan->graphics.DescSets; @@ -1258,9 +1258,9 @@ QMap> CommonPipelineState::GetReadWriteReso BoundResource CommonPipelineState::GetDepthTarget() { - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11()) + if(IsCaptureD3D11()) { BoundResource ret; ret.Id = m_D3D11->m_OM.DepthTarget.Resource; @@ -1269,7 +1269,7 @@ BoundResource CommonPipelineState::GetDepthTarget() ret.typeHint = m_D3D11->m_OM.DepthTarget.Format.compType; return ret; } - else if(IsLogD3D12()) + else if(IsCaptureD3D12()) { BoundResource ret; ret.Id = m_D3D12->m_OM.DepthTarget.Resource; @@ -1278,7 +1278,7 @@ BoundResource CommonPipelineState::GetDepthTarget() ret.typeHint = m_D3D12->m_OM.DepthTarget.Format.compType; return ret; } - else if(IsLogGL()) + else if(IsCaptureGL()) { BoundResource ret; ret.Id = m_GL->m_FB.m_DrawFBO.Depth.Obj; @@ -1287,7 +1287,7 @@ BoundResource CommonPipelineState::GetDepthTarget() ret.typeHint = CompType::Typeless; return ret; } - else if(IsLogVK()) + else if(IsCaptureVK()) { const auto &rp = m_Vulkan->Pass.renderpass; const auto &fb = m_Vulkan->Pass.framebuffer; @@ -1313,9 +1313,9 @@ QVector CommonPipelineState::GetOutputTargets() { QVector ret; - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11()) + if(IsCaptureD3D11()) { ret.resize(m_D3D11->m_OM.RenderTargets.count()); for(int i = 0; i < m_D3D11->m_OM.RenderTargets.count(); i++) @@ -1326,7 +1326,7 @@ QVector CommonPipelineState::GetOutputTargets() ret[i].typeHint = m_D3D11->m_OM.RenderTargets[i].Format.compType; } } - else if(IsLogD3D12()) + else if(IsCaptureD3D12()) { ret.resize(m_D3D12->m_OM.RenderTargets.count()); for(int i = 0; i < m_D3D12->m_OM.RenderTargets.count(); i++) @@ -1337,7 +1337,7 @@ QVector CommonPipelineState::GetOutputTargets() ret[i].typeHint = m_D3D12->m_OM.RenderTargets[i].Format.compType; } } - else if(IsLogGL()) + else if(IsCaptureGL()) { ret.resize(m_GL->m_FB.m_DrawFBO.DrawBuffers.count()); for(int i = 0; i < m_GL->m_FB.m_DrawFBO.DrawBuffers.count(); i++) @@ -1353,7 +1353,7 @@ QVector CommonPipelineState::GetOutputTargets() } } } - else if(IsLogVK()) + else if(IsCaptureVK()) { const auto &rp = m_Vulkan->Pass.renderpass; const auto &fb = m_Vulkan->Pass.framebuffer; diff --git a/qrenderdoc/Code/Interface/CommonPipelineState.h b/qrenderdoc/Code/Interface/CommonPipelineState.h index c755e299e..f68945103 100644 --- a/qrenderdoc/Code/Interface/CommonPipelineState.h +++ b/qrenderdoc/Code/Interface/CommonPipelineState.h @@ -169,7 +169,7 @@ public: :return: A boolean indicating if a capture is currently loaded. :rtype: ``bool`` )"); - bool LogLoaded() + bool IsCaptureLoaded() { return m_D3D11 != NULL || m_D3D12 != NULL || m_GL != NULL || m_Vulkan != NULL; } @@ -179,9 +179,9 @@ public: :return: A boolean indicating if a D3D11 capture is currently loaded. :rtype: ``bool`` )"); - bool IsLogD3D11() + bool IsCaptureD3D11() { - return LogLoaded() && m_APIProps.pipelineType == GraphicsAPI::D3D11 && m_D3D11 != NULL; + return IsCaptureLoaded() && m_APIProps.pipelineType == GraphicsAPI::D3D11 && m_D3D11 != NULL; } DOCUMENT(R"(Determines whether or not a D3D12 capture is currently loaded. @@ -189,9 +189,9 @@ public: :return: A boolean indicating if a D3D12 capture is currently loaded. :rtype: ``bool`` )"); - bool IsLogD3D12() + bool IsCaptureD3D12() { - return LogLoaded() && m_APIProps.pipelineType == GraphicsAPI::D3D12 && m_D3D12 != NULL; + return IsCaptureLoaded() && m_APIProps.pipelineType == GraphicsAPI::D3D12 && m_D3D12 != NULL; } DOCUMENT(R"(Determines whether or not an OpenGL capture is currently loaded. @@ -199,9 +199,9 @@ public: :return: A boolean indicating if an OpenGL capture is currently loaded. :rtype: ``bool`` )"); - bool IsLogGL() + bool IsCaptureGL() { - return LogLoaded() && m_APIProps.pipelineType == GraphicsAPI::OpenGL && m_GL != NULL; + return IsCaptureLoaded() && m_APIProps.pipelineType == GraphicsAPI::OpenGL && m_GL != NULL; } DOCUMENT(R"(Determines whether or not a Vulkan capture is currently loaded. @@ -209,9 +209,9 @@ public: :return: A boolean indicating if a Vulkan capture is currently loaded. :rtype: ``bool`` )"); - bool IsLogVK() + bool IsCaptureVK() { - return LogLoaded() && m_APIProps.pipelineType == GraphicsAPI::Vulkan && m_Vulkan != NULL; + return IsCaptureLoaded() && m_APIProps.pipelineType == GraphicsAPI::Vulkan && m_Vulkan != NULL; } // add a bunch of generic properties that people can check to save having to see which pipeline @@ -223,18 +223,18 @@ public: )"); bool IsTessellationEnabled() { - if(LogLoaded()) + if(IsCaptureLoaded()) { - if(IsLogD3D11()) + if(IsCaptureD3D11()) return m_D3D11 != NULL && m_D3D11->m_HS.Object != ResourceId(); - if(IsLogD3D12()) + if(IsCaptureD3D12()) return m_D3D12 != NULL && m_D3D12->m_HS.Object != ResourceId(); - if(IsLogGL()) + if(IsCaptureGL()) return m_GL != NULL && m_GL->m_TES.Object != ResourceId(); - if(IsLogVK()) + if(IsCaptureVK()) return m_Vulkan != NULL && m_Vulkan->m_TES.Object != ResourceId(); } @@ -246,13 +246,13 @@ public: :return: A boolean indicating if binding arrays of resources is supported. :rtype: ``bool`` )"); - bool SupportsResourceArrays() { return LogLoaded() && IsLogVK(); } + bool SupportsResourceArrays() { return IsCaptureLoaded() && IsCaptureVK(); } DOCUMENT(R"(Determines whether or not the current capture uses explicit barriers. :return: A boolean indicating if explicit barriers are used. :rtype: ``bool`` )"); - bool SupportsBarriers() { return LogLoaded() && (IsLogVK() || IsLogD3D12()); } + bool SupportsBarriers() { return IsCaptureLoaded() && (IsCaptureVK() || IsCaptureD3D12()); } DOCUMENT(R"(Determines whether or not the PostVS data is aligned in the typical fashion (ie. vectors not crossing ``float4`` boundaries). APIs that use stream-out or transform feedback have tightly packed data, but APIs that rewrite shaders to dump data might have these alignment @@ -261,7 +261,7 @@ requirements. :return: A boolean indicating if post-VS data is aligned. :rtype: ``bool`` )"); - bool HasAlignedPostVSData() { return LogLoaded() && IsLogVK(); } + bool HasAlignedPostVSData() { return IsCaptureLoaded() && IsCaptureVK(); } DOCUMENT(R"(For APIs that have explicit barriers, retrieves the current layout of a resource. :return: The name of the current resource layout. diff --git a/qrenderdoc/Code/Interface/PersistantConfig.cpp b/qrenderdoc/Code/Interface/PersistantConfig.cpp index 3ba4cb4b8..015549849 100644 --- a/qrenderdoc/Code/Interface/PersistantConfig.cpp +++ b/qrenderdoc/Code/Interface/PersistantConfig.cpp @@ -168,6 +168,15 @@ void PersistantConfig::applyValues(const QVariantMap &values) name = convertFromVariant(values[lit(#name)].value()); CONFIG_SETTINGS() + +// backwards compatibility code, to apply old values. +#define RENAMED_SETTING(variantType, oldName, newName) \ + if(values.contains(lit(#oldName))) \ + newName = convertFromVariant(values[lit(#oldName)].value()); + + RENAMED_SETTING(QString, LastLogPath, LastCaptureFilePath); + RENAMED_SETTING(QVariantList, RecentLogFiles, RecentCaptureFiles); + RENAMED_SETTING(QDateTime, DegradedLog_LastUpdate, DegradedCapture_LastUpdate); } void PersistantConfig::AddAndroidHosts() diff --git a/qrenderdoc/Code/Interface/PersistantConfig.h b/qrenderdoc/Code/Interface/PersistantConfig.h index 354a0013a..f20dbbef5 100644 --- a/qrenderdoc/Code/Interface/PersistantConfig.h +++ b/qrenderdoc/Code/Interface/PersistantConfig.h @@ -61,9 +61,9 @@ DECLARE_REFLECTION_STRUCT(SPIRVDisassembler); \ CONFIG_SETTING_VAL(public, QString, QString, UIStyle, QString()) \ \ - CONFIG_SETTING_VAL(public, QString, QString, LastLogPath, QString()) \ + CONFIG_SETTING_VAL(public, QString, QString, LastCaptureFilePath, QString()) \ \ - CONFIG_SETTING(public, QVariantList, QList, RecentLogFiles) \ + CONFIG_SETTING(public, QVariantList, QList, RecentCaptureFiles) \ \ CONFIG_SETTING_VAL(public, QString, QString, LastCapturePath, QString()) \ \ @@ -122,7 +122,7 @@ DECLARE_REFLECTION_STRUCT(SPIRVDisassembler); CONFIG_SETTING_VAL(public, QDateTime, QDateTime, CheckUpdate_LastUpdate, \ QDateTime(QDate(2012, 06, 27), QTime(0, 0, 0))) \ \ - CONFIG_SETTING_VAL(public, QDateTime, QDateTime, DegradedLog_LastUpdate, \ + CONFIG_SETTING_VAL(public, QDateTime, QDateTime, DegradedCapture_LastUpdate, \ QDateTime(QDate(2015, 01, 01), QTime(0, 0, 0))) \ \ CONFIG_SETTING_VAL(public, bool, bool, Tips_HasSeenFirst, false) \ @@ -206,11 +206,11 @@ For more information about some of these settings that are user-facing see the closest of RDLight and RDDark will be chosen, based on the overall light-on-dark or dark-on-light theme of the application native style. -.. data:: LastLogPath +.. data:: LastCaptureFilePath The path to the last capture to be opened, which is useful as a default location for browsing. -.. data:: RecentLogFiles +.. data:: RecentCaptureFiles A ``list`` of ``str`` with the recently opened capture files. @@ -386,7 +386,7 @@ For more information about some of these settings that are user-facing see A date containing the last time that update checks happened. -.. data:: DegradedLog_LastUpdate +.. data:: DegradedCapture_LastUpdate A date containing the last time that the user was warned about captures being loaded in degraded support. This prevents the user being spammed if their hardware is low spec. diff --git a/qrenderdoc/Code/Interface/QRDInterface.h b/qrenderdoc/Code/Interface/QRDInterface.h index a35a1ef8a..34c656a38 100644 --- a/qrenderdoc/Code/Interface/QRDInterface.h +++ b/qrenderdoc/Code/Interface/QRDInterface.h @@ -568,13 +568,13 @@ protected: DECLARE_REFLECTION_STRUCT(IPixelHistoryView); DOCUMENT("An interface implemented by any object wanting to be notified of capture events."); -struct ILogViewer +struct ICaptureViewer { DOCUMENT("Called whenever a capture is opened."); - virtual void OnLogfileLoaded() = 0; + virtual void OnCaptureLoaded() = 0; DOCUMENT("Called whenever a capture is closed."); - virtual void OnLogfileClosed() = 0; + virtual void OnCaptureClosed() = 0; DOCUMENT(R"(Called whenever the current selected event changes. This is distinct from the actual effective current event, since for example selecting a marker region will change the current event @@ -600,11 +600,11 @@ to a marker region. virtual void OnEventChanged(uint32_t eventID) = 0; protected: - ILogViewer() = default; - ~ILogViewer() = default; + ICaptureViewer() = default; + ~ICaptureViewer() = default; }; -DECLARE_REFLECTION_STRUCT(ILogViewer); +DECLARE_REFLECTION_STRUCT(ICaptureViewer); DOCUMENT(R"(A manager for accessing the underlying replay information that isn't already abstracted in UI side structures. This manager controls and serialises access to the underlying @@ -631,10 +631,10 @@ struct IReplayManager DOCUMENT(R"(Delete a capture file, whether local or remote. -:param str logfile: The path to the file. +:param str capturefile: The path to the file. :param bool local: ``True`` if the file is on the local machine. )"); - virtual void DeleteCapture(const QString &logfile, bool local) = 0; + virtual void DeleteCapture(const QString &capturefile, bool local) = 0; DOCUMENT(R"(Connect to a remote server. @@ -680,7 +680,7 @@ This happens either locally, or on the remote server, depending on whether a con :param str cmdLine: The command line to use when running the executable, it will be processed in a platform specific way to generate arguments. :param list env: Any :class:`EnvironmentModification` that should be made when running the program. -:param str logfile: The location to save any captures, if running locally. +:param str capturefile: The location to save any captures, if running locally. :param CaptureOptions opts: The capture options to use when injecting into the program. :return: The ident where the new application is listening for target control, or 0 if something went wrong. @@ -688,7 +688,7 @@ This happens either locally, or on the remote server, depending on whether a con )"); virtual uint32_t ExecuteAndInject(const QString &exe, const QString &workingDir, const QString &cmdLine, const QList &env, - const QString &logfile, CaptureOptions opts) = 0; + const QString &capturefile, CaptureOptions opts) = 0; DOCUMENT(R"(Retrieve a list of drivers that the current remote server supports. @@ -890,51 +890,65 @@ data. :return: The absolute path. :rtype: ``str`` )"); - virtual QString TempLogFilename(QString appname) = 0; + virtual QString TempCaptureFilename(QString appname) = 0; DOCUMENT(R"(Open a capture file for replay. -:param str logFile: The actual path to the capture file. +:param str captureFile: The actual path to the capture file. :param str origFilename: The original filename, if the capture was copied remotely for replay. :param bool temporary: ``True`` if this is a temporary capture which should prompt the user for either save or delete on close. -:param bool local: ``True`` if ``logFile`` refers to a file on the local machine. +:param bool local: ``True`` if ``captureFile`` refers to a file on the local machine. )"); - virtual void LoadLogfile(const QString &logFile, const QString &origFilename, bool temporary, + virtual void LoadCapture(const QString &captureFile, const QString &origFilename, bool temporary, bool local) = 0; + DOCUMENT(R"(Saves the current capture file to a given path. + +If the capture was temporary, this save action means it is no longer temporary and will be treated +like any other capture. + +Any modifications to the capture (see :meth:`GetCaptureModifcations`) will be applied at the same +time. + +:param str captureFile: The path to save the capture file to. +:return: ``True`` if the save operation was successful. +:rtype: ``bool`` +)"); + virtual bool SaveCaptureTo(const QString &captureFile) = 0; + DOCUMENT("Close the currently open capture file."); - virtual void CloseLogfile() = 0; + virtual void CloseCapture() = 0; DOCUMENT(R"(Move the current replay to a new event in the capture. -:param list exclude: A list of :class:`LogViewer` to exclude from being notified of this, to stop +:param list exclude: A list of :class:`CaptureViewer` to exclude from being notified of this, to stop infinite recursion. :param int selectedEventID: The selected :data:`EID `. See - :meth:`LogViewer.OnSelectedEventChanged` for more information. + :meth:`CaptureViewer.OnSelectedEventChanged` for more information. :param int eventID: The new current :data:`EID `. See - :meth:`LogViewer.OnEventChanged` for more information. + :meth:`CaptureViewer.OnEventChanged` for more information. :param bool force: Optional parameter, if ``True`` then the replay will 'move' even if it is moving to the same :data:`EID ` as it's currently on. )"); - virtual void SetEventID(const QVector &exclude, uint32_t selectedEventID, + virtual void SetEventID(const QVector &exclude, uint32_t selectedEventID, uint32_t eventID, bool force = false) = 0; DOCUMENT(R"(Replay the capture to the current event again, to pick up any changes that might have been made. )"); virtual void RefreshStatus() = 0; - DOCUMENT(R"(Register a new instance of :class:`LogViewer` to receive capture event notifications. + DOCUMENT(R"(Register a new instance of :class:`CaptureViewer` to receive capture event notifications. -:param LogViewer viewer: The viewer to register. +:param CaptureViewer viewer: The viewer to register. )"); - virtual void AddLogViewer(ILogViewer *viewer) = 0; + virtual void AddCaptureViewer(ICaptureViewer *viewer) = 0; - DOCUMENT(R"(Unregister an instance of :class:`LogViewer` from receiving notifications. + DOCUMENT(R"(Unregister an instance of :class:`CaptureViewer` from receiving notifications. -:param LogViewer viewer: The viewer to unregister. +:param CaptureViewer viewer: The viewer to unregister. )"); - virtual void RemoveLogViewer(ILogViewer *viewer) = 0; + virtual void RemoveCaptureViewer(ICaptureViewer *viewer) = 0; ////////////////////////////////////////////////////////////////////////////// // Accessors @@ -951,28 +965,38 @@ been made. :return: ``True`` if a capture is loaded. :rtype: ``bool`` )"); - virtual bool LogLoaded() = 0; + virtual bool IsCaptureLoaded() = 0; DOCUMENT(R"(Check whether or not the current capture is stored locally, or on a remote host. :return: ``True`` if a capture is local. :rtype: ``bool`` )"); - virtual bool IsLogLocal() = 0; + virtual bool IsCaptureLocal() = 0; + + DOCUMENT(R"(Check whether or not the current capture is considered temporary. Captures that were +made by an application and then have not been explicitly saved anywhere are temporary and will be +cleaned up on close (with a final prompt to save). Once they are save to disk, they are no longer +temporary and treated like any other capture. + +:return: ``True`` if a capture is temporary. +:rtype: ``bool`` +)"); + virtual bool IsCaptureTemporary() = 0; DOCUMENT(R"(Check whether or not a capture is currently loading in-progress. :return: ``True`` if a capture is currently loading. :rtype: ``bool`` )"); - virtual bool LogLoading() = 0; + virtual bool IsCaptureLoading() = 0; DOCUMENT(R"(Retrieve the filename for the currently loaded capture. :return: The filename of the current capture. :rtype: ``str`` )"); - virtual QString LogFilename() = 0; + virtual QString GetCaptureFilename() = 0; DOCUMENT(R"(Retrieve the :class:`~renderdoc.FrameDescription` for the currently loaded capture. @@ -990,7 +1014,7 @@ been made. DOCUMENT(R"(Retrieve the currently selected :data:`EID `. -In most cases, prefer using :meth:`CurEvent`. See :meth:`LogViewer.OnSelectedEventChanged` for more +In most cases, prefer using :meth:`CurEvent`. See :meth:`CaptureViewer.OnSelectedEventChanged` for more information for how this differs. :return: The current selected event. @@ -1007,7 +1031,7 @@ information for how this differs. DOCUMENT(R"(Retrieve the currently selected drawcall. -In most cases, prefer using :meth:`CurDrawcall`. See :meth:`LogViewer.OnSelectedEventChanged` for +In most cases, prefer using :meth:`CurDrawcall`. See :meth:`CaptureViewer.OnSelectedEventChanged` for more information for how this differs. :return: The currently selected drawcall. diff --git a/qrenderdoc/Code/ReplayManager.cpp b/qrenderdoc/Code/ReplayManager.cpp index e01218c81..e716fcc7c 100644 --- a/qrenderdoc/Code/ReplayManager.cpp +++ b/qrenderdoc/Code/ReplayManager.cpp @@ -39,14 +39,14 @@ ReplayManager::~ReplayManager() { } -void ReplayManager::OpenCapture(const QString &logfile, float *progress) +void ReplayManager::OpenCapture(const QString &capturefile, float *progress) { if(m_Running) return; m_ProxyRenderer = -1; m_ReplayHost = QString(); - m_Logfile = logfile; + m_CaptureFilename = capturefile; m_Progress = progress; *progress = 0.0f; @@ -59,17 +59,17 @@ void ReplayManager::OpenCapture(const QString &logfile, float *progress) } } -void ReplayManager::DeleteCapture(const QString &logfile, bool local) +void ReplayManager::DeleteCapture(const QString &capture, bool local) { if(IsRunning()) { - AsyncInvoke([this, logfile, local](IReplayController *) { DeleteCapture(logfile, local); }); + AsyncInvoke([this, capture, local](IReplayController *) { DeleteCapture(capture, local); }); return; } if(local) { - QFile::remove(logfile); + QFile::remove(capture); } else { @@ -78,7 +78,7 @@ void ReplayManager::DeleteCapture(const QString &logfile, bool local) if(m_Remote) { QMutexLocker autolock(&m_RemoteLock); - m_Remote->TakeOwnershipCapture(logfile.toUtf8().data()); + m_Remote->TakeOwnershipCapture(capture.toUtf8().data()); } } } @@ -358,7 +358,7 @@ void ReplayManager::PingRemote() uint32_t ReplayManager::ExecuteAndInject(const QString &exe, const QString &workingDir, const QString &cmdLine, const QList &env, - const QString &logfile, CaptureOptions opts) + const QString &capturefile, CaptureOptions opts) { rdcarray envList = env.toVector().toStdVector(); @@ -373,7 +373,7 @@ uint32_t ReplayManager::ExecuteAndInject(const QString &exe, const QString &work else { ret = RENDERDOC_ExecuteAndInject(exe.toUtf8().data(), workingDir.toUtf8().data(), - cmdLine.toUtf8().data(), envList, logfile.toUtf8().data(), + cmdLine.toUtf8().data(), envList, capturefile.toUtf8().data(), opts, false); } @@ -403,13 +403,13 @@ void ReplayManager::run() if(m_Remote) { std::tie(m_CreateStatus, m_Renderer) = - m_Remote->OpenCapture(~0U, m_Logfile.toUtf8().data(), m_Progress); + m_Remote->OpenCapture(~0U, m_CaptureFilename.toUtf8().data(), m_Progress); } else { m_CaptureFile = RENDERDOC_OpenCaptureFile(); - m_CreateStatus = m_CaptureFile->OpenFile(m_Logfile.toUtf8().data(), "rdc"); + m_CreateStatus = m_CaptureFile->OpenFile(m_CaptureFilename.toUtf8().data(), "rdc"); if(m_CreateStatus == ReplayStatus::Succeeded) std::tie(m_CreateStatus, m_Renderer) = m_CaptureFile->OpenCapture(m_Progress); @@ -418,7 +418,7 @@ void ReplayManager::run() if(m_Renderer == NULL) return; - qInfo() << "QRenderDoc - renderer created for" << m_Logfile; + qInfo() << "QRenderDoc - renderer created for" << m_CaptureFilename; m_Running = true; diff --git a/qrenderdoc/Code/ReplayManager.h b/qrenderdoc/Code/ReplayManager.h index 3c0daaee4..f7008fc27 100644 --- a/qrenderdoc/Code/ReplayManager.h +++ b/qrenderdoc/Code/ReplayManager.h @@ -51,8 +51,8 @@ public: ReplayManager(); ~ReplayManager(); - void OpenCapture(const QString &logfile, float *progress); - void DeleteCapture(const QString &logfile, bool local); + void OpenCapture(const QString &capturefile, float *progress); + void DeleteCapture(const QString &capturefile, bool local); bool IsRunning(); ReplayStatus GetCreateStatus() { return m_CreateStatus; } @@ -85,7 +85,7 @@ public: } const RemoteHost *CurrentRemote() { return m_RemoteHost; } uint32_t ExecuteAndInject(const QString &exe, const QString &workingDir, const QString &cmdLine, - const QList &env, const QString &logfile, + const QList &env, const QString &capturefile, CaptureOptions opts); QStringList GetRemoteSupport(); @@ -123,7 +123,7 @@ private: int m_ProxyRenderer; QString m_ReplayHost; - QString m_Logfile; + QString m_CaptureFilename; float *m_Progress; QMutex m_RemoteLock; diff --git a/qrenderdoc/Widgets/CustomPaintWidget.h b/qrenderdoc/Widgets/CustomPaintWidget.h index 5296c5c6c..41ec7589f 100644 --- a/qrenderdoc/Widgets/CustomPaintWidget.h +++ b/qrenderdoc/Widgets/CustomPaintWidget.h @@ -39,7 +39,7 @@ public: ~CustomPaintWidget(); // this is needed to solve a chicken-and-egg problem. We need to recreate the widget - // whenever we go from custom rendering to painting (e.g. log loaded or closed). But + // whenever we go from custom rendering to painting (e.g. capture loaded or closed). But // we need the widget to have been recreated before we create the output, so we can // pass in the winId. // So we go by whether or not we have a CaptureContext * and go on faith that the diff --git a/qrenderdoc/Windows/APIInspector.cpp b/qrenderdoc/Windows/APIInspector.cpp index d9aa7cf9f..fdfd258b4 100644 --- a/qrenderdoc/Windows/APIInspector.cpp +++ b/qrenderdoc/Windows/APIInspector.cpp @@ -46,21 +46,21 @@ APIInspector::APIInspector(ICaptureContext &ctx, QWidget *parent) handle->setIndex(1); handle->setCollapsed(true); - m_Ctx.AddLogViewer(this); + m_Ctx.AddCaptureViewer(this); } APIInspector::~APIInspector() { m_Ctx.BuiltinWindowClosed(this); - m_Ctx.RemoveLogViewer(this); + m_Ctx.RemoveCaptureViewer(this); delete ui; } -void APIInspector::OnLogfileLoaded() +void APIInspector::OnCaptureLoaded() { } -void APIInspector::OnLogfileClosed() +void APIInspector::OnCaptureClosed() { ui->apiEvents->clear(); ui->callstack->clear(); diff --git a/qrenderdoc/Windows/APIInspector.h b/qrenderdoc/Windows/APIInspector.h index 6139a9811..2960e2b71 100644 --- a/qrenderdoc/Windows/APIInspector.h +++ b/qrenderdoc/Windows/APIInspector.h @@ -34,7 +34,7 @@ class APIInspector; class RDTreeWidgetItem; -class APIInspector : public QFrame, public IAPIInspector, public ILogViewer +class APIInspector : public QFrame, public IAPIInspector, public ICaptureViewer { Q_OBJECT @@ -45,9 +45,9 @@ public: // IAPIInspector QWidget *Widget() override { return this; } void Refresh() override { on_apiEvents_itemSelectionChanged(); } - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override; void OnEventChanged(uint32_t eventID) override {} public slots: diff --git a/qrenderdoc/Windows/BufferViewer.cpp b/qrenderdoc/Windows/BufferViewer.cpp index c95bc0ebc..f00dd7885 100644 --- a/qrenderdoc/Windows/BufferViewer.cpp +++ b/qrenderdoc/Windows/BufferViewer.cpp @@ -1121,7 +1121,7 @@ BufferViewer::BufferViewer(ICaptureContext &ctx, bool meshview, QWidget *parent) Reset(); - m_Ctx.AddLogViewer(this); + m_Ctx.AddCaptureViewer(this); } void BufferViewer::SetupRawView() @@ -1303,7 +1303,7 @@ void BufferViewer::stageRowMenu(MeshDataStage stage, QMenu *menu, const QPoint & menu->clear(); - if(m_MeshView && stage != MeshDataStage::GSOut && m_Ctx.CurPipelineState().IsLogD3D11()) + if(m_MeshView && stage != MeshDataStage::GSOut && m_Ctx.CurPipelineState().IsCaptureD3D11()) { menu->addAction(m_DebugVert); menu->addSeparator(); @@ -1345,11 +1345,11 @@ BufferViewer::~BufferViewer() if(m_MeshView) m_Ctx.BuiltinWindowClosed(this); - m_Ctx.RemoveLogViewer(this); + m_Ctx.RemoveCaptureViewer(this); delete ui; } -void BufferViewer::OnLogfileLoaded() +void BufferViewer::OnCaptureLoaded() { Reset(); @@ -1368,7 +1368,7 @@ void BufferViewer::OnLogfileLoaded() }); } -void BufferViewer::OnLogfileClosed() +void BufferViewer::OnCaptureClosed() { Reset(); @@ -2421,7 +2421,7 @@ void BufferViewer::configureDrawRange() bool instanced = true; // don't check the flags, check if there are actually multiple instances - if(m_Ctx.LogLoaded()) + if(m_Ctx.IsCaptureLoaded()) instanced = draw && draw->numInstances > 1; ui->drawRange->blockSignals(true); @@ -2525,7 +2525,7 @@ void BufferViewer::UpdateMeshConfig() void BufferViewer::render_mouseMove(QMouseEvent *e) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; if(m_CurrentCamera) @@ -2539,7 +2539,7 @@ void BufferViewer::render_mouseMove(QMouseEvent *e) void BufferViewer::render_clicked(QMouseEvent *e) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; QPoint curpos = e->pos(); @@ -2592,7 +2592,7 @@ void BufferViewer::ScrollToRow(BufferItemModel *model, int row) void BufferViewer::ViewBuffer(uint64_t byteOffset, uint64_t byteSize, ResourceId id, const QString &format) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; m_IsBuffer = true; @@ -2611,7 +2611,7 @@ void BufferViewer::ViewBuffer(uint64_t byteOffset, uint64_t byteSize, ResourceId void BufferViewer::ViewTexture(uint32_t arrayIdx, uint32_t mip, ResourceId id, const QString &format) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; m_IsBuffer = false; @@ -2710,7 +2710,7 @@ bool BufferViewer::isCurrentRasterOut() } else if(m_CurStage == MeshDataStage::VSOut) { - if(m_Ctx.LogLoaded() && m_Ctx.CurPipelineState().IsTessellationEnabled()) + if(m_Ctx.IsCaptureLoaded() && m_Ctx.CurPipelineState().IsTessellationEnabled()) return false; return true; @@ -2751,8 +2751,8 @@ void BufferViewer::Reset() ICaptureContext *ctx = &m_Ctx; - // while a log is loaded, pass NULL into the widget - if(!m_Ctx.LogLoaded()) + // while a capture is loaded, pass NULL into the widget + if(!m_Ctx.IsCaptureLoaded()) ctx = NULL; { @@ -3031,7 +3031,7 @@ void BufferViewer::on_byteRangeLength_valueChanged(int value) void BufferViewer::exportData(const BufferExport ¶ms) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; if(!m_Ctx.CurDrawcall()) @@ -3154,7 +3154,7 @@ void BufferViewer::exportData(const BufferExport ¶ms) void BufferViewer::debugVertex() { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; if(!m_Ctx.CurDrawcall()) diff --git a/qrenderdoc/Windows/BufferViewer.h b/qrenderdoc/Windows/BufferViewer.h index 2751a8550..d6f4ab433 100644 --- a/qrenderdoc/Windows/BufferViewer.h +++ b/qrenderdoc/Windows/BufferViewer.h @@ -52,7 +52,7 @@ struct BufferExport BufferExport(ExportFormat f) : format(f) {} }; -class BufferViewer : public QFrame, public IBufferViewer, public ILogViewer +class BufferViewer : public QFrame, public IBufferViewer, public ICaptureViewer { Q_OBJECT @@ -78,9 +78,9 @@ public: void ViewTexture(uint32_t arrayIdx, uint32_t mip, ResourceId id, const QString &format = QString()) override; - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override; diff --git a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp index 1b1fa2c59..3408769ff 100644 --- a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp +++ b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp @@ -58,12 +58,12 @@ ConstantBufferPreviewer::ConstantBufferPreviewer(ICaptureContext &ctx, const Sha ui->variables->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); m_Previews.push_back(this); - m_Ctx.AddLogViewer(this); + m_Ctx.AddCaptureViewer(this); } ConstantBufferPreviewer::~ConstantBufferPreviewer() { - m_Ctx.RemoveLogViewer(this); + m_Ctx.RemoveCaptureViewer(this); m_Previews.removeOne(this); delete ui; } @@ -90,12 +90,12 @@ ConstantBufferPreviewer *ConstantBufferPreviewer::getOne() return NULL; } -void ConstantBufferPreviewer::OnLogfileLoaded() +void ConstantBufferPreviewer::OnCaptureLoaded() { - OnLogfileClosed(); + OnCaptureClosed(); } -void ConstantBufferPreviewer::OnLogfileClosed() +void ConstantBufferPreviewer::OnCaptureClosed() { ui->variables->clear(); diff --git a/qrenderdoc/Windows/ConstantBufferPreviewer.h b/qrenderdoc/Windows/ConstantBufferPreviewer.h index be0f3edf1..ec7bafcfb 100644 --- a/qrenderdoc/Windows/ConstantBufferPreviewer.h +++ b/qrenderdoc/Windows/ConstantBufferPreviewer.h @@ -35,7 +35,7 @@ class ConstantBufferPreviewer; class RDTreeWidgetItem; struct FormatElement; -class ConstantBufferPreviewer : public QFrame, public IConstantBufferPreviewer, public ILogViewer +class ConstantBufferPreviewer : public QFrame, public IConstantBufferPreviewer, public ICaptureViewer { Q_OBJECT @@ -49,9 +49,9 @@ public: // IConstantBufferPreviewer QWidget *Widget() override { return this; } - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override; diff --git a/qrenderdoc/Windows/DebugMessageView.cpp b/qrenderdoc/Windows/DebugMessageView.cpp index 16e60e7a5..56d6c95f1 100644 --- a/qrenderdoc/Windows/DebugMessageView.cpp +++ b/qrenderdoc/Windows/DebugMessageView.cpp @@ -251,24 +251,24 @@ DebugMessageView::DebugMessageView(ICaptureContext &ctx, QWidget *parent) RefreshMessageList(); - m_Ctx.AddLogViewer(this); + m_Ctx.AddCaptureViewer(this); } DebugMessageView::~DebugMessageView() { m_Ctx.BuiltinWindowClosed(this); - m_Ctx.RemoveLogViewer(this); + m_Ctx.RemoveCaptureViewer(this); delete ui; } -void DebugMessageView::OnLogfileClosed() +void DebugMessageView::OnCaptureClosed() { m_FilterModel->showHidden = false; RefreshMessageList(); } -void DebugMessageView::OnLogfileLoaded() +void DebugMessageView::OnCaptureLoaded() { m_FilterModel->showHidden = false; RefreshMessageList(); @@ -341,7 +341,7 @@ void DebugMessageView::messages_toggled() void DebugMessageView::messages_contextMenu(const QPoint &pos) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; QModelIndex index = ui->messages->indexAt(pos); diff --git a/qrenderdoc/Windows/DebugMessageView.h b/qrenderdoc/Windows/DebugMessageView.h index da907ab5e..766268cd3 100644 --- a/qrenderdoc/Windows/DebugMessageView.h +++ b/qrenderdoc/Windows/DebugMessageView.h @@ -37,7 +37,7 @@ class QMenu; class DebugMessageItemModel; class DebugMessageFilterModel; -class DebugMessageView : public QFrame, public IDebugMessageView, public ILogViewer +class DebugMessageView : public QFrame, public IDebugMessageView, public ICaptureViewer { Q_OBJECT @@ -47,9 +47,9 @@ public: // IDebugMessageView QWidget *Widget() override { return this; } - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override {} void RefreshMessageList(); diff --git a/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp b/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp index 5c34b4bbf..354685b72 100644 --- a/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp +++ b/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp @@ -818,10 +818,10 @@ void CaptureDialog::on_toggleGlobal_clicked() QString exe = ui->exePath->text(); - QString logfile = m_Ctx.TempLogFilename(QFileInfo(exe).baseName()); + QString capturefile = m_Ctx.TempCaptureFilename(QFileInfo(exe).baseName()); - bool success = - RENDERDOC_StartGlobalHook(exe.toUtf8().data(), logfile.toUtf8().data(), Settings().Options); + bool success = RENDERDOC_StartGlobalHook(exe.toUtf8().data(), capturefile.toUtf8().data(), + Settings().Options); if(!success) { @@ -868,7 +868,7 @@ void CaptureDialog::on_saveSettings_clicked() { SaveSettings(filename); AddRecentFile(m_Ctx.Config().RecentCaptureSettings, filename, 10); - m_Main->PopulateRecentCaptures(); + m_Main->PopulateRecentCaptureSettings(); } } } diff --git a/qrenderdoc/Windows/Dialogs/LiveCapture.cpp b/qrenderdoc/Windows/Dialogs/LiveCapture.cpp index 0ba308b36..666455704 100644 --- a/qrenderdoc/Windows/Dialogs/LiveCapture.cpp +++ b/qrenderdoc/Windows/Dialogs/LiveCapture.cpp @@ -41,7 +41,7 @@ static const int PIDRole = Qt::UserRole + 1; static const int IdentRole = Qt::UserRole + 2; -static const int LogPtrRole = Qt::UserRole + 3; +static const int CapPtrRole = Qt::UserRole + 3; class NameEditOnlyDelegate : public QStyledItemDelegate { @@ -55,9 +55,9 @@ public: if(!n.isEmpty() && item) { - LiveCapture::CaptureLog *log = live->GetLog(item); - if(log) - editor->setProperty(n, log->name); + LiveCapture::Capture *cap = live->GetCapture(item); + if(cap) + editor->setProperty(n, cap->name); } } @@ -68,11 +68,11 @@ public: if(!n.isEmpty() && item) { - LiveCapture::CaptureLog *log = live->GetLog(item); - if(log) + LiveCapture::Capture *cap = live->GetCapture(item); + if(cap) { - log->name = editor->property(n).toString(); - item->setText(live->MakeText(log)); + cap->name = editor->property(n).toString(); + item->setText(live->MakeText(cap)); } } } @@ -220,7 +220,7 @@ void LiveCapture::on_captures_mouseClicked(QMouseEvent *e) if(ui->captures->selectedItems().size() == 1) { - newAction.setEnabled(GetLog(ui->captures->selectedItems()[0])->local); + newAction.setEnabled(GetCapture(ui->captures->selectedItems()[0])->local); } else { @@ -286,30 +286,30 @@ void LiveCapture::on_triggerCapture_clicked() void LiveCapture::openCapture_triggered() { if(ui->captures->selectedItems().size() == 1) - openCapture(GetLog(ui->captures->selectedItems()[0])); + openCapture(GetCapture(ui->captures->selectedItems()[0])); } void LiveCapture::openNewWindow_triggered() { if(ui->captures->selectedItems().size() == 1) { - CaptureLog *log = GetLog(ui->captures->selectedItems()[0]); + Capture *cap = GetCapture(ui->captures->selectedItems()[0]); - QString temppath = m_Ctx.TempLogFilename(lit("newwindow")); + QString temppath = m_Ctx.TempCaptureFilename(lit("newwindow")); - if(!log->local) + if(!cap->local) { RDDialog::critical(this, tr("Cannot open new instance"), - tr("Can't open log in new instance with remote server in use")); + tr("Can't open capture in new instance with remote server in use")); return; } - QFile f(log->path); + QFile f(cap->path); if(!f.copy(temppath)) { - RDDialog::critical(this, tr("Cannot save temporary log"), - tr("Couldn't save log to temporary location\n%1").arg(f.errorString())); + RDDialog::critical(this, tr("Cannot save temporary capture"), + tr("Couldn't save capture to temporary location\n%1").arg(f.errorString())); return; } @@ -322,7 +322,7 @@ void LiveCapture::openNewWindow_triggered() void LiveCapture::saveCapture_triggered() { if(ui->captures->selectedItems().size() == 1) - saveCapture(GetLog(ui->captures->selectedItems()[0])); + saveCapture(GetCapture(ui->captures->selectedItems()[0])); } void LiveCapture::deleteCapture_triggered() @@ -336,31 +336,31 @@ void LiveCapture::deleteCapture_triggered() for(QListWidgetItem *item : sel) { - CaptureLog *log = GetLog(item); + Capture *cap = GetCapture(item); - if(!log->saved) + if(!cap->saved) { - if(log->path == m_Ctx.LogFilename()) + if(cap->path == m_Ctx.GetCaptureFilename()) { - m_Main->takeLogOwnership(); - m_Main->CloseLogfile(); + m_Main->takeCaptureOwnership(); + m_Main->CloseCapture(); } else { // if connected, prefer using the live connection - if(m_Connection && m_Connection->Connected() && !log->local) + if(m_Connection && m_Connection->Connected() && !cap->local) { - QMutexLocker l(&m_DeleteLogsLock); - m_DeleteLogs.push_back(log->remoteID); + QMutexLocker l(&m_DeleteCapturesLock); + m_DeleteCaptures.push_back(cap->remoteID); } else { - m_Ctx.Replay().DeleteCapture(log->path, log->local); + m_Ctx.Replay().DeleteCapture(cap->path, cap->local); } } } - delete log; + delete cap; delete ui->captures->takeItem(ui->captures->row(item)); } @@ -496,14 +496,14 @@ void LiveCapture::setTitle(const QString &title) title); } -LiveCapture::CaptureLog *LiveCapture::GetLog(QListWidgetItem *item) +LiveCapture::Capture *LiveCapture::GetCapture(QListWidgetItem *item) { - return (CaptureLog *)item->data(LogPtrRole).value(); + return (Capture *)item->data(CapPtrRole).value(); } -void LiveCapture::SetLog(QListWidgetItem *item, CaptureLog *log) +void LiveCapture::AddCapture(QListWidgetItem *item, Capture *cap) { - item->setData(LogPtrRole, QVariant::fromValue(log)); + item->setData(CapPtrRole, QVariant::fromValue(cap)); } QImage LiveCapture::MakeThumb(const QImage &screenshot) @@ -546,8 +546,8 @@ bool LiveCapture::checkAllowDelete() for(int i = 0; i < ui->captures->count(); i++) { - CaptureLog *log = GetLog(ui->captures->item(i)); - needcheck |= !log->saved; + Capture *cap = GetCapture(ui->captures->item(i)); + needcheck |= !cap->saved; } if(!needcheck || ui->captures->selectedItems().empty()) @@ -555,23 +555,24 @@ bool LiveCapture::checkAllowDelete() ToolWindowManager::raiseToolWindow(this); - QMessageBox::StandardButton res = RDDialog::question( - this, tr("Unsaved log(s)", "", ui->captures->selectedItems().size()), - tr("Are you sure you wish to delete the log(s)?\nAny log currently opened will be closed", "", - ui->captures->selectedItems().size()), - RDDialog::YesNoCancel); + QMessageBox::StandardButton res = + RDDialog::question(this, tr("Unsaved capture(s)", "", ui->captures->selectedItems().size()), + tr("Are you sure you wish to delete the capture(s)?\nAny capture " + "currently opened will be closed", + "", ui->captures->selectedItems().size()), + RDDialog::YesNoCancel); return (res == QMessageBox::Yes); } -QString LiveCapture::MakeText(CaptureLog *log) +QString LiveCapture::MakeText(Capture *cap) { - QString text = log->name; - if(!log->local) + QString text = cap->name; + if(!cap->local) text += tr(" (Remote)"); - text += lit("\n") + log->api; - text += lit("\n") + log->timestamp.toString(lit("yyyy-MM-dd HH:mm:ss")); + text += lit("\n") + cap->api; + text += lit("\n") + cap->timestamp.toString(lit("yyyy-MM-dd HH:mm:ss")); return text; } @@ -585,9 +586,9 @@ bool LiveCapture::checkAllowClose() for(int i = 0; i < ui->captures->count(); i++) { QListWidgetItem *item = ui->captures->item(i); - CaptureLog *log = GetLog(ui->captures->item(i)); + Capture *cap = GetCapture(ui->captures->item(i)); - if(log->saved) + if(cap->saved) continue; ui->captures->clearSelection(); @@ -599,10 +600,10 @@ bool LiveCapture::checkAllowClose() if(!suppressRemoteWarning) { - res = RDDialog::question(this, tr("Unsaved log"), - tr("Save this logfile '%1' at %2?") - .arg(log->name) - .arg(log->timestamp.toString(lit("HH:mm:ss"))), + res = RDDialog::question(this, tr("Unsaved capture"), + tr("Save this capture '%1' at %2?") + .arg(cap->name) + .arg(cap->timestamp.toString(lit("HH:mm:ss"))), RDDialog::YesNoCancel); } @@ -612,10 +613,10 @@ bool LiveCapture::checkAllowClose() return false; } - // we either have to save or delete the log. Make sure that if it's remote that we are able + // we either have to save or delete the capture. Make sure that if it's remote that we are able // to by having an active connection or replay context on that host. if(suppressRemoteWarning == false && (!m_Connection || !m_Connection->Connected()) && - !log->local && + !cap->local && (!m_Ctx.Replay().CurrentRemote() || m_Ctx.Replay().CurrentRemote()->Hostname != m_Hostname || !m_Ctx.Replay().CurrentRemote()->Connected)) { @@ -644,7 +645,7 @@ bool LiveCapture::checkAllowClose() if(res == QMessageBox::Yes) { - bool success = saveCapture(log); + bool success = saveCapture(cap); if(!success) { @@ -652,42 +653,49 @@ bool LiveCapture::checkAllowClose() return false; } } + + if(res == QMessageBox::No) + { + // treat this capture as saved now, so we don't prompt about it again. + cap->saved = true; + } } m_IgnoreThreadClosed = false; return true; } -void LiveCapture::openCapture(CaptureLog *log) +void LiveCapture::openCapture(Capture *cap) { - log->opened = true; + cap->opened = true; - if(!log->local && + if(!cap->local && (!m_Ctx.Replay().CurrentRemote() || 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 context on that " - "host.\nYou can either save the log locally, or switch to a replay context on %1.") + "host.\nYou can either save the capture locally, or switch to a replay context on %1.") .arg(m_HostFriendlyname)); return; } - m_Main->LoadLogfile(log->path, !log->saved, log->local); + m_Main->LoadCapture(cap->path, !cap->saved, cap->local); } -bool LiveCapture::saveCapture(CaptureLog *log) +bool LiveCapture::saveCapture(Capture *cap) { QString path = m_Main->GetSavePath(); - // we copy the temp log to the desired path, but the log item remains referring to the temp path. + // we copy the temp capture to the desired path, but the capture item remains referring to the + // temp path. // This ensures that if the user deletes the saved path we can still open or re-save it. if(!path.isEmpty()) { - if(log->local) + if(cap->local) { - QFile src(log->path); + QFile src(cap->path); QFile dst(path); // remove any existing file, the user was already prompted to overwrite @@ -711,8 +719,8 @@ bool LiveCapture::saveCapture(CaptureLog *log) else if(m_Connection && m_Connection->Connected()) { // if we have a current live connection, prefer using it - m_CopyLogLocalPath = path; - m_CopyLogID = log->remoteID; + m_CopyCaptureLocalPath = path; + m_CopyCaptureID = cap->remoteID; } else { @@ -728,7 +736,7 @@ bool LiveCapture::saveCapture(CaptureLog *log) return false; } - m_Ctx.Replay().CopyCaptureFromRemote(log->path, path, this); + m_Ctx.Replay().CopyCaptureFromRemote(cap->path, path, this); if(!QFile::exists(path)) { @@ -737,13 +745,17 @@ bool LiveCapture::saveCapture(CaptureLog *log) return false; } - m_Ctx.Replay().DeleteCapture(log->path, false); + m_Ctx.Replay().DeleteCapture(cap->path, false); } - log->saved = true; - log->path = path; - AddRecentFile(m_Ctx.Config().RecentLogFiles, path, 10); - m_Main->PopulateRecentFiles(); + // delete the temporary copy + if(!cap->saved) + m_Ctx.Replay().DeleteCapture(cap->path, cap->local); + + cap->saved = true; + cap->path = path; + AddRecentFile(m_Ctx.Config().RecentCaptureFiles, path, 10); + m_Main->PopulateRecentCaptureFiles(); return true; } @@ -754,30 +766,30 @@ void LiveCapture::cleanItems() { for(int i = 0; i < ui->captures->count(); i++) { - CaptureLog *log = GetLog(ui->captures->item(i)); + Capture *cap = GetCapture(ui->captures->item(i)); - if(!log->saved) + if(!cap->saved) { - if(log->path == m_Ctx.LogFilename()) + if(cap->path == m_Ctx.GetCaptureFilename()) { - m_Main->takeLogOwnership(); + m_Main->takeCaptureOwnership(); } else { // if connected, prefer using the live connection - if(m_Connection && m_Connection->Connected() && !log->local) + if(m_Connection && m_Connection->Connected() && !cap->local) { - QMutexLocker l(&m_DeleteLogsLock); - m_DeleteLogs.push_back(log->remoteID); + QMutexLocker l(&m_DeleteCapturesLock); + m_DeleteCaptures.push_back(cap->remoteID); } else { - m_Ctx.Replay().DeleteCapture(log->path, log->local); + m_Ctx.Replay().DeleteCapture(cap->path, cap->local); } } } - delete log; + delete cap; } ui->captures->clear(); } @@ -852,15 +864,15 @@ void LiveCapture::on_captures_itemSelectionChanged() if(ui->captures->selectedItems().size() == 1) { QListWidgetItem *item = ui->captures->selectedItems()[0]; - CaptureLog *log = GetLog(item); + Capture *cap = GetCapture(item); - newWindowAction->setEnabled(log->local); + newWindowAction->setEnabled(cap->local); - if(log->thumb.width() > 0) + if(cap->thumb.width() > 0) { - ui->preview->setPixmap(QPixmap::fromImage(log->thumb)); - ui->preview->setMinimumSize(log->thumb.size()); - ui->preview->setMaximumSize(log->thumb.size()); + ui->preview->setPixmap(QPixmap::fromImage(cap->thumb)); + ui->preview->setMinimumSize(cap->thumb.size()); + ui->preview->setMaximumSize(cap->thumb.size()); } else { @@ -876,16 +888,16 @@ void LiveCapture::captureCopied(uint32_t ID, const QString &localPath) for(int i = 0; i < ui->captures->count(); i++) { QListWidgetItem *item = ui->captures->item(i); - CaptureLog *log = GetLog(ui->captures->item(i)); + Capture *cap = GetCapture(ui->captures->item(i)); - if(log && log->remoteID == ID) + if(cap && cap->remoteID == ID) { - log->local = true; - log->path = localPath; + cap->local = true; + cap->path = localPath; QFont f = item->font(); f.setItalic(false); item->setFont(f); - item->setText(MakeText(log)); + item->setText(MakeText(cap)); } } } @@ -894,21 +906,21 @@ void LiveCapture::captureAdded(uint32_t ID, const QString &executable, const QSt const bytebuf &thumbnail, int32_t thumbWidth, int32_t thumbHeight, QDateTime timestamp, const QString &path, bool local) { - CaptureLog *log = new CaptureLog(); - log->remoteID = ID; - log->name = executable; - log->api = api; - log->timestamp = timestamp; - log->thumb = QImage(thumbnail.data(), thumbWidth, thumbHeight, QImage::Format_RGB888) + Capture *cap = new Capture(); + cap->remoteID = ID; + cap->name = executable; + cap->api = api; + cap->timestamp = timestamp; + cap->thumb = QImage(thumbnail.data(), thumbWidth, thumbHeight, QImage::Format_RGB888) .copy(0, 0, thumbWidth, thumbHeight); - log->saved = false; - log->path = path; - log->local = local; + cap->saved = false; + cap->path = path; + cap->local = local; QListWidgetItem *item = new QListWidgetItem(); item->setFlags(item->flags() | Qt::ItemIsEditable); - item->setText(MakeText(log)); - item->setIcon(QIcon(QPixmap::fromImage(MakeThumb(log->thumb)))); + item->setText(MakeText(cap)); + item->setIcon(QIcon(QPixmap::fromImage(MakeThumb(cap->thumb)))); if(!local) { QFont f = item->font(); @@ -916,7 +928,7 @@ void LiveCapture::captureAdded(uint32_t ID, const QString &executable, const QSt item->setFont(f); } - SetLog(item, log); + AddCapture(item, cap); ui->captures->addItem(item); } @@ -930,29 +942,29 @@ void LiveCapture::connectionClosed() { if(ui->captures->count() == 1) { - CaptureLog *log = GetLog(ui->captures->item(0)); + Capture *cap = GetCapture(ui->captures->item(0)); - // only auto-open a non-local log if we are successfully connected + // only auto-open a non-local capture if we are successfully connected // to this machine as a remote context - if(!log->local) + if(!cap->local) { if(!m_Ctx.Replay().CurrentRemote() || m_Ctx.Replay().CurrentRemote()->Hostname != m_Hostname || !m_Ctx.Replay().CurrentRemote()->Connected) return; } - if(log->opened) + if(cap->opened) return; - openCapture(log); - if(!log->saved) + openCapture(cap); + if(!cap->saved) { - log->saved = true; - m_Main->takeLogOwnership(); + cap->saved = true; + m_Main->takeCaptureOwnership(); } } - // auto-close and load log if we got a capture. If we + // auto-close and load capture if we got a capture. If we // don't have any captures but DO have child processes, // then don't close just yet. if(ui->captures->count() == 1 || m_Children.count() == 0) @@ -1048,17 +1060,17 @@ void LiveCapture::connectionThreadEntry() m_CaptureFrameNum = 0; } - if(!m_CopyLogLocalPath.isEmpty()) + if(!m_CopyCaptureLocalPath.isEmpty()) { - m_Connection->CopyCapture(m_CopyLogID, m_CopyLogLocalPath.toUtf8().data()); - m_CopyLogLocalPath = QString(); - m_CopyLogID = ~0U; + m_Connection->CopyCapture(m_CopyCaptureID, m_CopyCaptureLocalPath.toUtf8().data()); + m_CopyCaptureLocalPath = QString(); + m_CopyCaptureID = ~0U; } QVector dels; { - QMutexLocker l(&m_DeleteLogsLock); - dels.swap(m_DeleteLogs); + QMutexLocker l(&m_DeleteCapturesLock); + dels.swap(m_DeleteCaptures); } for(uint32_t del : dels) diff --git a/qrenderdoc/Windows/Dialogs/LiveCapture.h b/qrenderdoc/Windows/Dialogs/LiveCapture.h index c66627e50..d67f4b2b6 100644 --- a/qrenderdoc/Windows/Dialogs/LiveCapture.h +++ b/qrenderdoc/Windows/Dialogs/LiveCapture.h @@ -90,7 +90,7 @@ private: friend class NameEditOnlyDelegate; - struct CaptureLog + struct Capture { uint32_t remoteID; QString name; @@ -113,10 +113,10 @@ private: bool added = false; }; - CaptureLog *GetLog(QListWidgetItem *item); - void SetLog(QListWidgetItem *item, CaptureLog *log); + Capture *GetCapture(QListWidgetItem *item); + void AddCapture(QListWidgetItem *item, Capture *cap); - QString MakeText(CaptureLog *log); + QString MakeText(Capture *cap); QImage MakeThumb(const QImage &screenshot); void connectionThreadEntry(); @@ -131,8 +131,8 @@ private: void killThread(); void setTitle(const QString &title); - void openCapture(CaptureLog *log); - bool saveCapture(CaptureLog *log); + void openCapture(Capture *cap); + bool saveCapture(Capture *cap); bool checkAllowDelete(); void deleteCaptureUnprompted(QListWidgetItem *item); @@ -152,10 +152,10 @@ private: QSemaphore m_Disconnect; ITargetControl *m_Connection = NULL; - uint32_t m_CopyLogID = ~0U; - QString m_CopyLogLocalPath; - QMutex m_DeleteLogsLock; - QVector m_DeleteLogs; + uint32_t m_CopyCaptureID = ~0U; + QString m_CopyCaptureLocalPath; + QMutex m_DeleteCapturesLock; + QVector m_DeleteCaptures; bool m_IgnoreThreadClosed = false; bool m_IgnorePreviewToggle = false; diff --git a/qrenderdoc/Windows/Dialogs/SettingsDialog.ui b/qrenderdoc/Windows/Dialogs/SettingsDialog.ui index 5e34b3a7a..fad7147a9 100644 --- a/qrenderdoc/Windows/Dialogs/SettingsDialog.ui +++ b/qrenderdoc/Windows/Dialogs/SettingsDialog.ui @@ -338,7 +338,7 @@ as is currently running, then by default the UI will prompt to ask if you want t This option overrides that and will always replay locally if the local context is selected. - Always replay logs locally, never prompt about it + Always replay captures locally, never prompt about it @@ -849,7 +849,7 @@ If {spv_disas} is not used, the tool is expected to output the disassembly on st In the Event Browser, add fake markers if none are found in the capture. - Add fake markers if none present (requires log reload) + Add fake markers if none present (requires capture reload) true diff --git a/qrenderdoc/Windows/EventBrowser.cpp b/qrenderdoc/Windows/EventBrowser.cpp index 31e08b6a8..2e7527721 100644 --- a/qrenderdoc/Windows/EventBrowser.cpp +++ b/qrenderdoc/Windows/EventBrowser.cpp @@ -156,22 +156,22 @@ EventBrowser::EventBrowser(ICaptureContext &ctx, QWidget *parent) QObject::connect(ui->events->header(), &QHeaderView::customContextMenuRequested, this, &EventBrowser::events_contextMenu); - OnLogfileClosed(); + OnCaptureClosed(); m_redPalette = palette(); m_redPalette.setColor(QPalette::Base, Qt::red); - m_Ctx.AddLogViewer(this); + m_Ctx.AddCaptureViewer(this); } EventBrowser::~EventBrowser() { m_Ctx.BuiltinWindowClosed(this); - m_Ctx.RemoveLogViewer(this); + m_Ctx.RemoveCaptureViewer(this); delete ui; } -void EventBrowser::OnLogfileLoaded() +void EventBrowser::OnCaptureLoaded() { RDTreeWidgetItem *frame = new RDTreeWidgetItem( {QFormatStr("Frame #%1").arg(m_Ctx.FrameInfo().frameNumber), QString(), QString(), QString()}); @@ -202,7 +202,7 @@ void EventBrowser::OnLogfileLoaded() m_Ctx.SetEventID({this}, lastEIDDraw.first, lastEIDDraw.first); } -void EventBrowser::OnLogfileClosed() +void EventBrowser::OnCaptureClosed() { clearBookmarks(); @@ -507,7 +507,7 @@ void EventBrowser::on_findPrev_clicked() void EventBrowser::on_stepNext_clicked() { - if(!m_Ctx.LogLoaded() || !ui->stepNext->isEnabled()) + if(!m_Ctx.IsCaptureLoaded() || !ui->stepNext->isEnabled()) return; const DrawcallDescription *draw = m_Ctx.CurDrawcall(); @@ -522,7 +522,7 @@ void EventBrowser::on_stepNext_clicked() void EventBrowser::on_stepPrev_clicked() { - if(!m_Ctx.LogLoaded() || !ui->stepPrev->isEnabled()) + if(!m_Ctx.IsCaptureLoaded() || !ui->stepPrev->isEnabled()) return; const DrawcallDescription *draw = m_Ctx.CurDrawcall(); @@ -550,7 +550,9 @@ void EventBrowser::on_exportDraws_clicked() { QTextStream stream(&f); - stream << tr("%1 - Frame #%2\n\n").arg(m_Ctx.LogFilename()).arg(m_Ctx.FrameInfo().frameNumber); + stream << tr("%1 - Frame #%2\n\n") + .arg(m_Ctx.GetCaptureFilename()) + .arg(m_Ctx.FrameInfo().frameNumber); int maxNameLength = 0; @@ -817,7 +819,7 @@ void EventBrowser::setPersistData(const QVariant &persistData) void EventBrowser::events_keyPress(QKeyEvent *event) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; if(event->key() == Qt::Key_F3) @@ -953,7 +955,7 @@ void EventBrowser::toggleBookmark(uint32_t EID) void EventBrowser::jumpToBookmark(int idx) { - if(idx < 0 || idx >= m_Bookmarks.count() || !m_Ctx.LogLoaded()) + if(idx < 0 || idx >= m_Bookmarks.count() || !m_Ctx.IsCaptureLoaded()) return; // don't exclude ourselves, so we're updated as normal @@ -1039,7 +1041,7 @@ void EventBrowser::ExpandNode(RDTreeWidgetItem *node) bool EventBrowser::SelectEvent(uint32_t eventID) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return false; RDTreeWidgetItem *found = NULL; @@ -1074,7 +1076,7 @@ void EventBrowser::ClearFindIcons(RDTreeWidgetItem *parent) void EventBrowser::ClearFindIcons() { - if(m_Ctx.LogLoaded()) + if(m_Ctx.IsCaptureLoaded()) ClearFindIcons(ui->events->topLevelItem(0)); } @@ -1170,7 +1172,7 @@ int EventBrowser::FindEvent(RDTreeWidgetItem *parent, QString filter, uint32_t a int EventBrowser::FindEvent(QString filter, uint32_t after, bool forward) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return 0; return FindEvent(ui->events->topLevelItem(0), filter, after, forward); diff --git a/qrenderdoc/Windows/EventBrowser.h b/qrenderdoc/Windows/EventBrowser.h index c6bd49c36..3a8d90dd2 100644 --- a/qrenderdoc/Windows/EventBrowser.h +++ b/qrenderdoc/Windows/EventBrowser.h @@ -41,7 +41,7 @@ class QTextStream; class FlowLayout; struct EventItemTag; -class EventBrowser : public QFrame, public IEventBrowser, public ILogViewer +class EventBrowser : public QFrame, public IEventBrowser, public ICaptureViewer { private: Q_OBJECT @@ -55,9 +55,9 @@ public: // IEventBrowser QWidget *Widget() override { return this; } void UpdateDurationColumn() override; - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override; diff --git a/qrenderdoc/Windows/MainWindow.cpp b/qrenderdoc/Windows/MainWindow.cpp index 9d5bae6a3..35019bb23 100644 --- a/qrenderdoc/Windows/MainWindow.cpp +++ b/qrenderdoc/Windows/MainWindow.cpp @@ -106,10 +106,10 @@ MainWindow::MainWindow(ICaptureContext &ctx) : QMainWindow(NULL), ui(new Ui::Mai QObject::connect(ui->action_Launch_Application_Window, &QAction::triggered, this, &MainWindow::on_action_Launch_Application_triggered); - QObject::connect(ui->action_Clear_Capture_History, &QAction::triggered, this, - &MainWindow::ClearRecentCaptures); - QObject::connect(ui->action_Clear_Log_History, &QAction::triggered, this, - &MainWindow::ClearRecentFiles); + QObject::connect(ui->action_Clear_Capture_Files_History, &QAction::triggered, this, + &MainWindow::ClearRecentCaptureFiles); + QObject::connect(ui->action_Clear_Capture_Settings_History, &QAction::triggered, this, + &MainWindow::ClearRecentCaptureSettings); contextChooserMenu = new QMenu(this); @@ -172,8 +172,8 @@ MainWindow::MainWindow(ICaptureContext &ctx) : QMainWindow(NULL), ui(new Ui::Mai SetTitle(); - PopulateRecentFiles(); - PopulateRecentCaptures(); + PopulateRecentCaptureFiles(); + PopulateRecentCaptureSettings(); ui->toolWindowManager->setToolWindowCreateCallback([this](const QString &objectName) -> QWidget * { return m_Ctx.CreateBuiltinWindow(objectName); @@ -218,10 +218,10 @@ MainWindow::MainWindow(ICaptureContext &ctx) : QMainWindow(NULL), ui(new Ui::Mai } #endif - m_Ctx.AddLogViewer(this); + m_Ctx.AddCaptureViewer(this); - ui->action_Save_Log->setEnabled(false); - ui->action_Close_Log->setEnabled(false); + ui->action_Save_Capture->setEnabled(false); + ui->action_Close_Capture->setEnabled(false); QList actions = ui->menuBar->actions(); @@ -268,13 +268,13 @@ void MainWindow::on_action_Exit_triggered() this->close(); } -void MainWindow::on_action_Open_Log_triggered() +void MainWindow::on_action_Open_Capture_triggered() { - if(!PromptCloseLog()) + if(!PromptCloseCapture()) return; QString filename = RDDialog::getOpenFileName( - this, tr("Select Logfile to open"), m_Ctx.Config().LastLogPath, + this, tr("Select file to open"), m_Ctx.Config().LastCaptureFilePath, tr("Capture Files (*.rdc);;Image Files (*.dds *.hdr *.exr *.bmp *.jpg " "*.jpeg *.png *.tga *.gif *.psd;;All Files (*)")); @@ -289,7 +289,7 @@ void MainWindow::LoadFromFilename(const QString &filename, bool temporary) if(ext == lit("rdc")) { - LoadLogfile(filename, temporary, true); + LoadCapture(filename, temporary, true); } else if(ext == lit("cap")) { @@ -302,7 +302,7 @@ void MainWindow::LoadFromFilename(const QString &filename, bool temporary) else { // not a recognised filetype, see if we can load it anyway - LoadLogfile(filename, temporary, true); + LoadCapture(filename, temporary, true); } } @@ -310,13 +310,13 @@ void MainWindow::OnCaptureTrigger(const QString &exe, const QString &workingDir, const QString &cmdLine, const QList &env, CaptureOptions opts, std::function callback) { - if(!PromptCloseLog()) + if(!PromptCloseCapture()) return; LambdaThread *th = new LambdaThread([this, exe, workingDir, cmdLine, env, opts, callback]() { - QString logfile = m_Ctx.TempLogFilename(QFileInfo(exe).baseName()); + QString capturefile = m_Ctx.TempCaptureFilename(QFileInfo(exe).baseName()); - uint32_t ret = m_Ctx.Replay().ExecuteAndInject(exe, workingDir, cmdLine, env, logfile, opts); + uint32_t ret = m_Ctx.Replay().ExecuteAndInject(exe, workingDir, cmdLine, env, capturefile, opts); GUIInvoke::call([this, exe, ret, callback]() { if(ret == 0) @@ -352,15 +352,16 @@ void MainWindow::OnInjectTrigger(uint32_t PID, const QList callback) { - if(!PromptCloseLog()) + if(!PromptCloseCapture()) return; rdcarray envList = env.toVector().toStdVector(); LambdaThread *th = new LambdaThread([this, PID, envList, name, opts, callback]() { - QString logfile = m_Ctx.TempLogFilename(name); + QString capturefile = m_Ctx.TempCaptureFilename(name); - uint32_t ret = RENDERDOC_InjectIntoProcess(PID, envList, logfile.toUtf8().data(), opts, false); + uint32_t ret = + RENDERDOC_InjectIntoProcess(PID, envList, capturefile.toUtf8().data(), opts, false); GUIInvoke::call([this, PID, ret, callback]() { if(ret == 0) @@ -388,11 +389,11 @@ void MainWindow::OnInjectTrigger(uint32_t PID, const QListdeleteLater(); } -void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local) +void MainWindow::LoadCapture(const QString &filename, bool temporary, bool local) { - if(PromptCloseLog()) + if(PromptCloseCapture()) { - if(m_Ctx.LogLoading()) + if(m_Ctx.IsCaptureLoading()) return; QString driver; @@ -496,29 +497,29 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local QString origFilename = filename; - // if driver is empty something went wrong loading the log, let it be handled as usual + // if driver is empty something went wrong loading the capture, let it be handled as usual // below. Otherwise indicate that support is missing. if(!driver.isEmpty() && support == ReplaySupport::Unsupported) { if(remoteReplay) { QString remoteMessage = - tr("This log was captured with %1 and cannot be replayed on %2.\n\n") + tr("This capture was captured with %1 and cannot be replayed on %2.\n\n") .arg(driver) .arg(m_Ctx.Replay().CurrentRemote()->Name()); remoteMessage += tr("Try selecting a different remote context in the status bar."); - RDDialog::critical(NULL, tr("Unsupported logfile type"), remoteMessage); + RDDialog::critical(NULL, tr("Unsupported capture driver"), remoteMessage); } else { QString remoteMessage = - tr("This log was captured with %1 and cannot be replayed locally.\n\n").arg(driver); + tr("This capture was captured with %1 and cannot be replayed locally.\n\n").arg(driver); remoteMessage += tr("Try selecting a remote context in the status bar."); - RDDialog::critical(NULL, tr("Unsupported logfile type"), remoteMessage); + RDDialog::critical(NULL, tr("Unsupported capture driver"), remoteMessage); } return; @@ -531,7 +532,7 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local { fileToLoad = m_Ctx.Replay().CopyCaptureToRemote(filename, this); - // deliberately leave local as true so that we keep referring to the locally saved log + // deliberately leave local as true so that we keep referring to the locally saved capture // some error if(fileToLoad.isEmpty()) @@ -542,12 +543,12 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local } } - m_Ctx.LoadLogfile(fileToLoad, origFilename, temporary, local); + m_Ctx.LoadCapture(fileToLoad, origFilename, temporary, local); } if(!remoteReplay) { - m_Ctx.Config().LastLogPath = QFileInfo(filename).absolutePath(); + m_Ctx.Config().LastCaptureFilePath = QFileInfo(filename).absolutePath(); } statusText->setText(tr("Loading %1...").arg(origFilename)); @@ -596,91 +597,50 @@ QString MainWindow::GetSavePath() return QString(); } -bool MainWindow::PromptSaveLog() +bool MainWindow::PromptSaveCaptureAs() { QString saveFilename = GetSavePath(); if(!saveFilename.isEmpty()) { - if(m_Ctx.IsLogLocal() && !QFileInfo(m_Ctx.LogFilename()).exists()) - { - RDDialog::critical(NULL, tr("File not found"), - tr("Logfile %1 couldn't be found, cannot save.").arg(m_Ctx.LogFilename())); - return false; - } - - bool success = false; - QString error; - - if(m_Ctx.IsLogLocal()) - { - // we copy the (possibly) temp log to the desired path, but the log item remains referring to - // the original path. - // This ensures that if the user deletes the saved path we can still open or re-save it. - - // QFile::copy won't overwrite, so remove the destination first (the save dialog already - // prompted for overwrite) - QFile::remove(saveFilename); - success = QFile::copy(m_Ctx.LogFilename(), saveFilename); - - error = tr("Couldn't save to %1").arg(saveFilename); - } - else - { - m_Ctx.Replay().CopyCaptureFromRemote(m_Ctx.LogFilename(), saveFilename, this); - success = QFile::exists(saveFilename); - - error = tr("File couldn't be transferred from remote host"); - } + bool success = m_Ctx.SaveCaptureTo(saveFilename); if(!success) - { - RDDialog::critical(NULL, tr("Error Saving"), error); return false; - } - AddRecentFile(m_Ctx.Config().RecentLogFiles, saveFilename, 10); - PopulateRecentFiles(); + AddRecentFile(m_Ctx.Config().RecentCaptureFiles, saveFilename, 10); + PopulateRecentCaptureFiles(); SetTitle(saveFilename); - // we don't prompt to save on closing - if the user deleted the log that we just saved, then - // that is up to them. - m_SavedTempLog = true; - return true; } return false; } -bool MainWindow::PromptCloseLog() +bool MainWindow::PromptCloseCapture() { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return true; QString deletepath; - bool loglocal = false; + bool caplocal = false; - if(m_OwnTempLog) + if(m_OwnTempCapture && m_Ctx.IsCaptureTemporary()) { - QString temppath = m_Ctx.LogFilename(); - loglocal = m_Ctx.IsLogLocal(); + QString temppath = m_Ctx.GetCaptureFilename(); + caplocal = m_Ctx.IsCaptureLocal(); - QMessageBox::StandardButton res = QMessageBox::No; - - // unless we've saved the log, prompt to save - if(!m_SavedTempLog) - res = RDDialog::question(NULL, tr("Unsaved log"), tr("Save this logfile?"), - QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); + QMessageBox::StandardButton res = + RDDialog::question(NULL, tr("Unsaved capture"), tr("Save this capture?"), + QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel); if(res == QMessageBox::Cancel) - { return false; - } if(res == QMessageBox::Yes) { - bool success = PromptSaveLog(); + bool success = PromptSaveCaptureAs(); if(!success) { @@ -688,32 +648,31 @@ bool MainWindow::PromptCloseLog() } } - if(temppath != m_Ctx.LogFilename() || res == QMessageBox::No) + if(temppath != m_Ctx.GetCaptureFilename() || res == QMessageBox::No) deletepath = temppath; - m_OwnTempLog = false; - m_SavedTempLog = false; + m_OwnTempCapture = false; } - CloseLogfile(); + CloseCapture(); if(!deletepath.isEmpty()) - m_Ctx.Replay().DeleteCapture(deletepath, loglocal); + m_Ctx.Replay().DeleteCapture(deletepath, caplocal); return true; } -void MainWindow::CloseLogfile() +void MainWindow::CloseCapture() { - m_Ctx.CloseLogfile(); + m_Ctx.CloseCapture(); - ui->action_Save_Log->setEnabled(false); + ui->action_Save_Capture->setEnabled(false); } void MainWindow::SetTitle(const QString &filename) { QString prefix; - if(m_Ctx.LogLoaded()) + if(m_Ctx.IsCaptureLoaded()) { prefix = QFileInfo(filename).fileName(); if(m_Ctx.APIProps().degraded) @@ -739,43 +698,43 @@ void MainWindow::SetTitle(const QString &filename) void MainWindow::SetTitle() { - SetTitle(m_Ctx.LogFilename()); + SetTitle(m_Ctx.GetCaptureFilename()); } -void MainWindow::ClearRecentFiles() +void MainWindow::ClearRecentCaptureFiles() { - m_Ctx.Config().RecentLogFiles.clear(); - PopulateRecentFiles(); + m_Ctx.Config().RecentCaptureFiles.clear(); + PopulateRecentCaptureFiles(); } -void MainWindow::PopulateRecentFiles() +void MainWindow::PopulateRecentCaptureFiles() { - ui->menu_Recent_Logs->clear(); + ui->menu_Recent_Capture_Files->clear(); - ui->menu_Recent_Logs->setEnabled(false); + ui->menu_Recent_Capture_Files->setEnabled(false); int idx = 1; - for(int i = m_Ctx.Config().RecentLogFiles.size() - 1; i >= 0; i--) + for(int i = m_Ctx.Config().RecentCaptureFiles.size() - 1; i >= 0; i--) { - const QString &filename = m_Ctx.Config().RecentLogFiles[i]; - ui->menu_Recent_Logs->addAction(QFormatStr("&%1 %2").arg(idx).arg(filename), - [this, filename] { recentLog(filename); }); + const QString &filename = m_Ctx.Config().RecentCaptureFiles[i]; + ui->menu_Recent_Capture_Files->addAction(QFormatStr("&%1 %2").arg(idx).arg(filename), + [this, filename] { recentCaptureFile(filename); }); idx++; - ui->menu_Recent_Logs->setEnabled(true); + ui->menu_Recent_Capture_Files->setEnabled(true); } - ui->menu_Recent_Logs->addSeparator(); - ui->menu_Recent_Logs->addAction(ui->action_Clear_Log_History); + ui->menu_Recent_Capture_Files->addSeparator(); + ui->menu_Recent_Capture_Files->addAction(ui->action_Clear_Capture_Files_History); } -void MainWindow::ClearRecentCaptures() +void MainWindow::ClearRecentCaptureSettings() { m_Ctx.Config().RecentCaptureSettings.clear(); - PopulateRecentCaptures(); + PopulateRecentCaptureSettings(); } -void MainWindow::PopulateRecentCaptures() +void MainWindow::PopulateRecentCaptureSettings() { ui->menu_Recent_Capture_Settings->clear(); @@ -786,14 +745,14 @@ void MainWindow::PopulateRecentCaptures() { const QString &filename = m_Ctx.Config().RecentCaptureSettings[i]; ui->menu_Recent_Capture_Settings->addAction(QFormatStr("&%1 %2").arg(idx).arg(filename), - [this, filename] { recentCapture(filename); }); + [this, filename] { recentCaptureSetting(filename); }); idx++; ui->menu_Recent_Capture_Settings->setEnabled(true); } ui->menu_Recent_Capture_Settings->addSeparator(); - ui->menu_Recent_Capture_Settings->addAction(ui->action_Clear_Capture_History); + ui->menu_Recent_Capture_Settings->addAction(ui->action_Clear_Capture_Settings_History); } void MainWindow::ShowLiveCapture(LiveCapture *live) @@ -906,11 +865,11 @@ void MainWindow::show() QMainWindow::show(); } -void MainWindow::recentLog(const QString &filename) +void MainWindow::recentCaptureFile(const QString &filename) { if(QFileInfo::exists(filename)) { - LoadLogfile(filename, false, true); + LoadCapture(filename, false, true); } else { @@ -920,14 +879,14 @@ void MainWindow::recentLog(const QString &filename) if(res == QMessageBox::Yes) { - m_Ctx.Config().RecentLogFiles.removeOne(filename); + m_Ctx.Config().RecentCaptureFiles.removeOne(filename); - PopulateRecentFiles(); + PopulateRecentCaptureFiles(); } } } -void MainWindow::recentCapture(const QString &filename) +void MainWindow::recentCaptureSetting(const QString &filename) { if(QFileInfo::exists(filename)) { @@ -943,7 +902,7 @@ void MainWindow::recentCapture(const QString &filename) { m_Ctx.Config().RecentCaptureSettings.removeOne(filename); - PopulateRecentCaptures(); + PopulateRecentCaptureSettings(); } } } @@ -961,9 +920,9 @@ void MainWindow::setProgress(float val) } } -void MainWindow::setLogHasErrors(bool errors) +void MainWindow::setCaptureHasErrors(bool errors) { - QString filename = QFileInfo(m_Ctx.LogFilename()).fileName(); + QString filename = QFileInfo(m_Ctx.GetCaptureFilename()).fileName(); if(errors) { const QPixmap &del = Pixmaps::del(this); @@ -989,7 +948,7 @@ void MainWindow::setLogHasErrors(bool errors) void MainWindow::remoteProbe() { - if(!m_Ctx.LogLoaded() && !m_Ctx.LogLoading()) + if(!m_Ctx.IsCaptureLoaded() && !m_Ctx.IsCaptureLoading()) { for(RemoteHost *host : m_Ctx.Config().RemoteHosts) { @@ -1008,7 +967,7 @@ void MainWindow::remoteProbe() void MainWindow::messageCheck() { - if(m_Ctx.LogLoaded()) + if(m_Ctx.IsCaptureLoaded()) { m_Ctx.Replay().AsyncInvoke([this](IReplayController *r) { rdcarray msgs = r->GetDebugMessages(); @@ -1026,7 +985,7 @@ void MainWindow::messageCheck() } GUIInvoke::call([this, disconnected, msgs] { - // if we just got disconnected while replaying a log, alert the user. + // if we just got disconnected while replaying a capture, alert the user. if(disconnected) { RDDialog::critical(this, tr("Remote server disconnected"), @@ -1049,11 +1008,11 @@ void MainWindow::messageCheck() else m_messageAlternate = false; - setLogHasErrors(!m_Ctx.DebugMessages().empty()); + setCaptureHasErrors(!m_Ctx.DebugMessages().empty()); }); }); } - else if(!m_Ctx.LogLoaded() && !m_Ctx.LogLoading()) + else if(!m_Ctx.IsCaptureLoaded() && !m_Ctx.IsCaptureLoading()) { if(m_Ctx.Replay().CurrentRemote()) m_Ctx.Replay().PingRemote(); @@ -1153,7 +1112,7 @@ void MainWindow::switchContext() return; } - if(!PromptCloseLog()) + if(!PromptCloseCapture()) return; for(LiveCapture *live : m_LiveCaptures) @@ -1265,19 +1224,19 @@ void MainWindow::statusDoubleClicked(QMouseEvent *event) showDebugMessageView(); } -void MainWindow::OnLogfileLoaded() +void MainWindow::OnCaptureLoaded() { - ui->action_Save_Log->setEnabled(true); - ui->action_Close_Log->setEnabled(true); + ui->action_Save_Capture->setEnabled(true); + ui->action_Close_Capture->setEnabled(true); - // don't allow changing context while log is open + // don't allow changing context while capture is open contextChooser->setEnabled(false); statusProgress->setVisible(false); ui->action_Start_Replay_Loop->setEnabled(true); - setLogHasErrors(!m_Ctx.DebugMessages().empty()); + setCaptureHasErrors(!m_Ctx.DebugMessages().empty()); ui->action_Resolve_Symbols->setEnabled(false); @@ -1287,23 +1246,23 @@ void MainWindow::OnLogfileLoaded() 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")); + : tr("Resolve Symbols - None in capture")); - ui->action_Save_Log->setEnabled(true); + ui->action_Save_Capture->setEnabled(true); }); }); SetTitle(); - PopulateRecentFiles(); + PopulateRecentCaptureFiles(); ToolWindowManager::raiseToolWindow(m_Ctx.GetEventBrowser()->Widget()); } -void MainWindow::OnLogfileClosed() +void MainWindow::OnCaptureClosed() { - ui->action_Save_Log->setEnabled(false); - ui->action_Close_Log->setEnabled(false); + ui->action_Save_Capture->setEnabled(false); + ui->action_Close_Capture->setEnabled(false); ui->action_Start_Replay_Loop->setEnabled(false); @@ -1318,7 +1277,7 @@ void MainWindow::OnLogfileClosed() SetTitle(); - // if the remote sever disconnected during log replay, resort back to a 'disconnected' state + // if the remote sever disconnected during capture replay, resort back to a 'disconnected' state if(m_Ctx.Replay().CurrentRemote() && !m_Ctx.Replay().CurrentRemote()->ServerRunning) { statusText->setText( @@ -1397,14 +1356,14 @@ bool MainWindow::eventFilter(QObject *watched, QEvent *event) return QMainWindow::eventFilter(watched, event); } -void MainWindow::on_action_Close_Log_triggered() +void MainWindow::on_action_Close_Capture_triggered() { - PromptCloseLog(); + PromptCloseCapture(); } -void MainWindow::on_action_Save_Log_triggered() +void MainWindow::on_action_Save_Capture_triggered() { - PromptSaveLog(); + PromptSaveCaptureAs(); } void MainWindow::on_action_About_triggered() @@ -1580,7 +1539,7 @@ void MainWindow::on_action_Resolve_Symbols_triggered() void MainWindow::on_action_Start_Replay_Loop_triggered() { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; QDialog popup; @@ -1616,14 +1575,16 @@ void MainWindow::on_action_Start_Replay_Loop_triggered() { id = displayTex->ID; popup.resize((int)displayTex->width, (int)displayTex->height); - popup.setWindowTitle( - tr("Looping replay of %1 Displaying %2").arg(m_Ctx.LogFilename()).arg(m_Ctx.GetResourceName(id))); + popup.setWindowTitle(tr("Looping replay of %1 Displaying %2") + .arg(m_Ctx.GetCaptureFilename()) + .arg(m_Ctx.GetResourceName(id))); } else { popup.resize(100, 100); - popup.setWindowTitle( - tr("Looping replay of %1 Displaying %2").arg(m_Ctx.LogFilename()).arg(tr("nothing"))); + popup.setWindowTitle(tr("Looping replay of %1 Displaying %2") + .arg(m_Ctx.GetCaptureFilename()) + .arg(tr("nothing"))); } WindowingSystem winSys = m_Ctx.CurWindowingSystem(); @@ -1741,7 +1702,7 @@ void MainWindow::closeEvent(QCloseEvent *event) return; } - if(!PromptCloseLog()) + if(!PromptCloseCapture()) { event->ignore(); return; diff --git a/qrenderdoc/Windows/MainWindow.h b/qrenderdoc/Windows/MainWindow.h index 40bbaab03..c9d8cf357 100644 --- a/qrenderdoc/Windows/MainWindow.h +++ b/qrenderdoc/Windows/MainWindow.h @@ -42,7 +42,7 @@ class QToolButton; class CaptureDialog; class LiveCapture; -class MainWindow : public QMainWindow, public IMainWindow, public ILogViewer +class MainWindow : public QMainWindow, public IMainWindow, public ICaptureViewer { private: Q_OBJECT @@ -54,9 +54,9 @@ public: // IMainWindow QWidget *Widget() override { return this; } void RegisterShortcut(const QString &shortcut, QWidget *widget, ShortcutCallback callback) override; - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override; @@ -67,10 +67,10 @@ public: void show(); void setProgress(float val); - void takeLogOwnership() { m_OwnTempLog = true; } + void takeCaptureOwnership() { m_OwnTempCapture = true; } void LoadFromFilename(const QString &filename, bool temporary); - void LoadLogfile(const QString &filename, bool temporary, bool local); - void CloseLogfile(); + void LoadCapture(const QString &filename, bool temporary, bool local); + void CloseCapture(); QString GetSavePath(); void OnCaptureTrigger(const QString &exe, const QString &workingDir, const QString &cmdLine, @@ -94,15 +94,15 @@ public: void showPythonShell() { on_action_Python_Shell_triggered(); } void showPerformanceCounterViewer() { on_action_Counter_Viewer_triggered(); } void showResourceInspector() { on_action_Resource_Inspector_triggered(); } - void PopulateRecentFiles(); - void PopulateRecentCaptures(); + void PopulateRecentCaptureFiles(); + void PopulateRecentCaptureSettings(); private slots: // automatic slots void on_action_Exit_triggered(); void on_action_About_triggered(); - void on_action_Open_Log_triggered(); - void on_action_Save_Log_triggered(); - void on_action_Close_Log_triggered(); + void on_action_Open_Capture_triggered(); + void on_action_Save_Capture_triggered(); + void on_action_Close_Capture_triggered(); void on_action_Mesh_Output_triggered(); void on_action_API_Inspector_triggered(); void on_action_Event_Browser_triggered(); @@ -136,8 +136,8 @@ private slots: void switchContext(); void contextChooser_menuShowing(); - void ClearRecentFiles(); - void ClearRecentCaptures(); + void ClearRecentCaptureFiles(); + void ClearRecentCaptureSettings(); private: void closeEvent(QCloseEvent *event) override; @@ -170,21 +170,20 @@ private: bool m_messageAlternate = false; - bool m_OwnTempLog = false; - bool m_SavedTempLog = false; + bool m_OwnTempCapture = false; QString m_LastSaveCapturePath; - void setLogHasErrors(bool errors); + void setCaptureHasErrors(bool errors); void SetTitle(const QString &filename); void SetTitle(); - void recentLog(const QString &filename); - void recentCapture(const QString &filename); + void recentCaptureFile(const QString &filename); + void recentCaptureSetting(const QString &filename); - bool PromptCloseLog(); - bool PromptSaveLog(); + bool PromptCloseCapture(); + bool PromptSaveCaptureAs(); void OpenCaptureConfigFile(const QString &filename, bool exe); QVariantMap saveState(); diff --git a/qrenderdoc/Windows/MainWindow.ui b/qrenderdoc/Windows/MainWindow.ui index fa0782db5..94f020db2 100644 --- a/qrenderdoc/Windows/MainWindow.ui +++ b/qrenderdoc/Windows/MainWindow.ui @@ -60,29 +60,29 @@ &File - + &Recent Captures - + R&ecent Capture Settings - + - - - + + + - + @@ -173,7 +173,7 @@ &Inject into Process - + &Open Capture @@ -181,7 +181,7 @@ Ctrl+O - + &Save Capture @@ -189,7 +189,7 @@ Ctrl+S - + &Close Capture @@ -324,11 +324,6 @@ &Resolve Symbols - - - &Statistics - - &Settings @@ -374,12 +369,12 @@ &About - + Clear History - + Clear History diff --git a/qrenderdoc/Windows/PerformanceCounterViewer.cpp b/qrenderdoc/Windows/PerformanceCounterViewer.cpp index 637a6a4e8..45e80a98f 100644 --- a/qrenderdoc/Windows/PerformanceCounterViewer.cpp +++ b/qrenderdoc/Windows/PerformanceCounterViewer.cpp @@ -100,13 +100,13 @@ PerformanceCounterViewer::PerformanceCounterViewer(ICaptureContext &ctx, QWidget { ui->setupUi(this); - m_Ctx.AddLogViewer(this); + m_Ctx.AddCaptureViewer(this); connect(ui->captureCounters, &QToolButton::clicked, this, &PerformanceCounterViewer::CaptureCounters); - ui->captureCounters->setEnabled(m_Ctx.LogLoaded()); - ui->saveCSV->setEnabled(m_Ctx.LogLoaded()); + ui->captureCounters->setEnabled(m_Ctx.IsCaptureLoaded()); + ui->saveCSV->setEnabled(m_Ctx.IsCaptureLoaded()); ui->counterResults->horizontalHeader()->setSectionsMovable(true); } @@ -115,7 +115,7 @@ PerformanceCounterViewer::~PerformanceCounterViewer() { m_Ctx.BuiltinWindowClosed(this); - m_Ctx.RemoveLogViewer(this); + m_Ctx.RemoveCaptureViewer(this); delete ui; } @@ -178,7 +178,7 @@ QTableWidgetItem *PerformanceCounterViewer::MakeCounterResultItem(const CounterR void PerformanceCounterViewer::CaptureCounters() { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; PerformanceCounterSelection pcs(m_Ctx, m_SelectedCounters, this); @@ -253,13 +253,13 @@ void PerformanceCounterViewer::CaptureCounters() ShowProgressDialog(this, tr("Capturing counters"), [&done]() -> bool { return done; }); } -void PerformanceCounterViewer::OnLogfileClosed() +void PerformanceCounterViewer::OnCaptureClosed() { ui->captureCounters->setEnabled(false); ui->saveCSV->setEnabled(false); } -void PerformanceCounterViewer::OnLogfileLoaded() +void PerformanceCounterViewer::OnCaptureLoaded() { ui->captureCounters->setEnabled(true); ui->saveCSV->setEnabled(true); diff --git a/qrenderdoc/Windows/PerformanceCounterViewer.h b/qrenderdoc/Windows/PerformanceCounterViewer.h index 62187c804..a69c62a59 100644 --- a/qrenderdoc/Windows/PerformanceCounterViewer.h +++ b/qrenderdoc/Windows/PerformanceCounterViewer.h @@ -34,7 +34,7 @@ class PerformanceCounterViewer; class QTableWidgetItem; -class PerformanceCounterViewer : public QFrame, public IPerformanceCounterViewer, public ILogViewer +class PerformanceCounterViewer : public QFrame, public IPerformanceCounterViewer, public ICaptureViewer { Q_OBJECT @@ -44,9 +44,9 @@ public: // IStatisticsViewer QWidget *Widget() override { return this; } - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override {} private slots: diff --git a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp index bbb16adbd..7606608b4 100644 --- a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp @@ -410,12 +410,12 @@ D3D11PipelineStateViewer::~D3D11PipelineStateViewer() delete ui; } -void D3D11PipelineStateViewer::OnLogfileLoaded() +void D3D11PipelineStateViewer::OnCaptureLoaded() { OnEventChanged(m_Ctx.CurEvent()); } -void D3D11PipelineStateViewer::OnLogfileClosed() +void D3D11PipelineStateViewer::OnCaptureClosed() { ui->pipeFlow->setStagesEnabled({true, true, true, true, true, true, true, true, true}); @@ -737,7 +737,7 @@ bool D3D11PipelineStateViewer::showNode(bool usedSlot, bool filledSlot) const D3D11Pipe::Shader *D3D11PipelineStateViewer::stageForSender(QWidget *widget) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return NULL; while(widget) @@ -1091,7 +1091,7 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11Pipe::Shader &stage, QL void D3D11PipelineStateViewer::setState() { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) { clearState(); return; @@ -2109,7 +2109,7 @@ void D3D11PipelineStateViewer::highlightIABind(int slot) void D3D11PipelineStateViewer::on_iaLayouts_mouseMove(QMouseEvent *e) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; QModelIndex idx = ui->iaLayouts->indexAt(e->pos()); @@ -2131,7 +2131,7 @@ void D3D11PipelineStateViewer::on_iaLayouts_mouseMove(QMouseEvent *e) void D3D11PipelineStateViewer::on_iaBuffers_mouseMove(QMouseEvent *e) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; RDTreeWidgetItem *item = ui->iaBuffers->itemAt(e->pos()); @@ -3044,7 +3044,7 @@ void D3D11PipelineStateViewer::on_meshView_clicked() void D3D11PipelineStateViewer::on_debugThread_clicked() { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; const DrawcallDescription *draw = m_Ctx.CurDrawcall(); diff --git a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h index 04225985b..168fa4686 100644 --- a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h @@ -38,7 +38,7 @@ class RDTreeWidgetItem; struct D3D11ViewTag; class PipelineStateViewer; -class D3D11PipelineStateViewer : public QFrame, public ILogViewer +class D3D11PipelineStateViewer : public QFrame, public ICaptureViewer { Q_OBJECT @@ -47,9 +47,9 @@ public: QWidget *parent = 0); ~D3D11PipelineStateViewer(); - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override; diff --git a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp index b63066828..c08b77063 100644 --- a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp @@ -425,12 +425,12 @@ D3D12PipelineStateViewer::~D3D12PipelineStateViewer() delete ui; } -void D3D12PipelineStateViewer::OnLogfileLoaded() +void D3D12PipelineStateViewer::OnCaptureLoaded() { OnEventChanged(m_Ctx.CurEvent()); } -void D3D12PipelineStateViewer::OnLogfileClosed() +void D3D12PipelineStateViewer::OnCaptureClosed() { ui->pipeFlow->setStagesEnabled({true, true, true, true, true, true, true, true, true}); @@ -802,7 +802,7 @@ bool D3D12PipelineStateViewer::showNode(bool usedSlot, bool filledSlot) const D3D12Pipe::Shader *D3D12PipelineStateViewer::stageForSender(QWidget *widget) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return NULL; while(widget) @@ -1183,7 +1183,7 @@ void D3D12PipelineStateViewer::setShaderState(const D3D12Pipe::Shader &stage, QL void D3D12PipelineStateViewer::setState() { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) { clearState(); return; @@ -1940,7 +1940,7 @@ void D3D12PipelineStateViewer::highlightIABind(int slot) void D3D12PipelineStateViewer::on_iaLayouts_mouseMove(QMouseEvent *e) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; QModelIndex idx = ui->iaLayouts->indexAt(e->pos()); @@ -1962,7 +1962,7 @@ void D3D12PipelineStateViewer::on_iaLayouts_mouseMove(QMouseEvent *e) void D3D12PipelineStateViewer::on_iaBuffers_mouseMove(QMouseEvent *e) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; RDTreeWidgetItem *item = ui->iaBuffers->itemAt(e->pos()); diff --git a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h index 94c9828fa..07349b0c3 100644 --- a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h @@ -39,7 +39,7 @@ class RDTreeWidgetItem; struct D3D12ViewTag; class PipelineStateViewer; -class D3D12PipelineStateViewer : public QFrame, public ILogViewer +class D3D12PipelineStateViewer : public QFrame, public ICaptureViewer { Q_OBJECT @@ -48,9 +48,9 @@ public: QWidget *parent = 0); ~D3D12PipelineStateViewer(); - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override; diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp index 55b5ddd37..6a83715f4 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp @@ -391,12 +391,12 @@ GLPipelineStateViewer::~GLPipelineStateViewer() delete ui; } -void GLPipelineStateViewer::OnLogfileLoaded() +void GLPipelineStateViewer::OnCaptureLoaded() { OnEventChanged(m_Ctx.CurEvent()); } -void GLPipelineStateViewer::OnLogfileClosed() +void GLPipelineStateViewer::OnCaptureClosed() { ui->pipeFlow->setStagesEnabled({true, true, true, true, true, true, true, true, true}); @@ -451,7 +451,7 @@ bool GLPipelineStateViewer::showNode(bool usedSlot, bool filledSlot) const GLPipe::Shader *GLPipelineStateViewer::stageForSender(QWidget *widget) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return NULL; while(widget) @@ -1074,7 +1074,7 @@ GLPipelineStateViewer::GLReadWriteType GLPipelineStateViewer::GetGLReadWriteType void GLPipelineStateViewer::setState() { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) { clearState(); return; @@ -2083,7 +2083,7 @@ void GLPipelineStateViewer::highlightIABind(int slot) void GLPipelineStateViewer::on_viAttrs_mouseMove(QMouseEvent *e) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; QModelIndex idx = ui->viAttrs->indexAt(e->pos()); @@ -2105,7 +2105,7 @@ void GLPipelineStateViewer::on_viAttrs_mouseMove(QMouseEvent *e) void GLPipelineStateViewer::on_viBuffers_mouseMove(QMouseEvent *e) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; RDTreeWidgetItem *item = ui->viBuffers->itemAt(e->pos()); diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h index c22938c13..41dd95e39 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h @@ -38,7 +38,7 @@ class RDTreeWidget; class RDTreeWidgetItem; class PipelineStateViewer; -class GLPipelineStateViewer : public QFrame, public ILogViewer +class GLPipelineStateViewer : public QFrame, public ICaptureViewer { Q_OBJECT @@ -47,9 +47,9 @@ public: QWidget *parent = 0); ~GLPipelineStateViewer(); - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override; diff --git a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp index 3e27ae616..aec0a63ee 100644 --- a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp @@ -50,7 +50,7 @@ PipelineStateViewer::PipelineStateViewer(ICaptureContext &ctx, QWidget *parent) setToD3D11(); - m_Ctx.AddLogViewer(this); + m_Ctx.AddCaptureViewer(this); } PipelineStateViewer::~PipelineStateViewer() @@ -58,12 +58,12 @@ PipelineStateViewer::~PipelineStateViewer() reset(); m_Ctx.BuiltinWindowClosed(this); - m_Ctx.RemoveLogViewer(this); + m_Ctx.RemoveCaptureViewer(this); delete ui; } -void PipelineStateViewer::OnLogfileLoaded() +void PipelineStateViewer::OnCaptureLoaded() { if(m_Ctx.APIProps().pipelineType == GraphicsAPI::D3D11) setToD3D11(); @@ -75,19 +75,19 @@ void PipelineStateViewer::OnLogfileLoaded() setToVulkan(); if(m_Current) - m_Current->OnLogfileLoaded(); + m_Current->OnCaptureLoaded(); } -void PipelineStateViewer::OnLogfileClosed() +void PipelineStateViewer::OnCaptureClosed() { if(m_Current) - m_Current->OnLogfileClosed(); + m_Current->OnCaptureClosed(); } void PipelineStateViewer::OnEventChanged(uint32_t eventID) { if(m_Ctx.CurPipelineState().DefaultType != m_Ctx.APIProps().pipelineType) - OnLogfileLoaded(); + OnCaptureLoaded(); if(m_Current) m_Current->OnEventChanged(eventID); @@ -223,7 +223,7 @@ QXmlStreamWriter *PipelineStateViewer::beginHTMLExport() xml.writeAttribute(lit("lang"), lit("en")); QString title = tr("%1 EID %2 - %3 Pipeline export") - .arg(QFileInfo(m_Ctx.LogFilename()).fileName()) + .arg(QFileInfo(m_Ctx.GetCaptureFilename()).fileName()) .arg(m_Ctx.CurEvent()) .arg(GetCurrentAPI()); @@ -818,7 +818,7 @@ void PipelineStateViewer::EditShader(ShaderStage shaderType, ResourceId id, if(updatedfiles.contains(lit("@cmdline"))) compileSource = updatedfiles[lit("@cmdline")] + lit("\n\n") + compileSource; - // invoke off to the ReplayController to replace the log's shader + // invoke off to the ReplayController to replace the capture's shader // with our edited one ctx->Replay().AsyncInvoke([ctx, entryFunc, compileSource, shaderType, id, shaderDetails, viewer](IReplayController *r) { @@ -866,15 +866,15 @@ bool PipelineStateViewer::SaveShaderFile(const ShaderReflection *shader) QString filter; - if(m_Ctx.CurPipelineState().IsLogD3D11() || m_Ctx.CurPipelineState().IsLogD3D12()) + if(m_Ctx.CurPipelineState().IsCaptureD3D11() || m_Ctx.CurPipelineState().IsCaptureD3D12()) { filter = tr("DXBC Shader files (*.dxbc)"); } - else if(m_Ctx.CurPipelineState().IsLogGL()) + else if(m_Ctx.CurPipelineState().IsCaptureGL()) { filter = tr("GLSL files (*.glsl)"); } - else if(m_Ctx.CurPipelineState().IsLogVK()) + else if(m_Ctx.CurPipelineState().IsCaptureVK()) { filter = tr("SPIR-V files (*.spv)"); } diff --git a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.h index 304eb7f61..50005010b 100644 --- a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.h @@ -41,7 +41,7 @@ class D3D12PipelineStateViewer; class GLPipelineStateViewer; class VulkanPipelineStateViewer; -class PipelineStateViewer : public QFrame, public IPipelineStateViewer, public ILogViewer +class PipelineStateViewer : public QFrame, public IPipelineStateViewer, public ICaptureViewer { Q_OBJECT @@ -55,9 +55,9 @@ public: QWidget *Widget() override { return this; } bool SaveShaderFile(const ShaderReflection *shader) override; - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override; @@ -101,5 +101,5 @@ private: D3D12PipelineStateViewer *m_D3D12; GLPipelineStateViewer *m_GL; VulkanPipelineStateViewer *m_Vulkan; - ILogViewer *m_Current; + ICaptureViewer *m_Current; }; diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp index 22cb2c0c5..a1fc40a0a 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp @@ -335,12 +335,12 @@ VulkanPipelineStateViewer::~VulkanPipelineStateViewer() delete ui; } -void VulkanPipelineStateViewer::OnLogfileLoaded() +void VulkanPipelineStateViewer::OnCaptureLoaded() { OnEventChanged(m_Ctx.CurEvent()); } -void VulkanPipelineStateViewer::OnLogfileClosed() +void VulkanPipelineStateViewer::OnCaptureClosed() { ui->pipeFlow->setStagesEnabled({true, true, true, true, true, true, true, true, true}); @@ -492,7 +492,7 @@ bool VulkanPipelineStateViewer::showNode(bool usedSlot, bool filledSlot) const VKPipe::Shader *VulkanPipelineStateViewer::stageForSender(QWidget *widget) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return NULL; while(widget) @@ -1434,7 +1434,7 @@ void VulkanPipelineStateViewer::setShaderState(const VKPipe::Shader &stage, void VulkanPipelineStateViewer::setState() { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) { clearState(); return; @@ -2187,7 +2187,7 @@ void VulkanPipelineStateViewer::highlightIABind(int slot) void VulkanPipelineStateViewer::on_viAttrs_mouseMove(QMouseEvent *e) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; QModelIndex idx = ui->viAttrs->indexAt(e->pos()); @@ -2209,7 +2209,7 @@ void VulkanPipelineStateViewer::on_viAttrs_mouseMove(QMouseEvent *e) void VulkanPipelineStateViewer::on_viBuffers_mouseMove(QMouseEvent *e) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; RDTreeWidgetItem *item = ui->viBuffers->itemAt(e->pos()); diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h index 0e31dd5f2..1404a4272 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h @@ -45,7 +45,7 @@ struct SamplerData RDTreeWidgetItem *node; }; -class VulkanPipelineStateViewer : public QFrame, public ILogViewer +class VulkanPipelineStateViewer : public QFrame, public ICaptureViewer { Q_OBJECT @@ -54,8 +54,8 @@ public: QWidget *parent = 0); ~VulkanPipelineStateViewer(); - void OnLogfileLoaded(); - void OnLogfileClosed(); + void OnCaptureLoaded(); + void OnCaptureClosed(); void OnSelectedEventChanged(uint32_t eventID) {} void OnEventChanged(uint32_t eventID); diff --git a/qrenderdoc/Windows/PixelHistoryView.cpp b/qrenderdoc/Windows/PixelHistoryView.cpp index 91472b943..e7ae58acf 100644 --- a/qrenderdoc/Windows/PixelHistoryView.cpp +++ b/qrenderdoc/Windows/PixelHistoryView.cpp @@ -606,7 +606,7 @@ PixelHistoryView::PixelHistoryView(ICaptureContext &ctx, ResourceId id, QPoint p ui->events->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents); ui->events->header()->setSectionResizeMode(4, QHeaderView::ResizeToContents); - m_Ctx.AddLogViewer(this); + m_Ctx.AddCaptureViewer(this); } void PixelHistoryView::updateWindowTitle() @@ -628,7 +628,7 @@ PixelHistoryView::~PixelHistoryView() disableTimelineHighlight(); ui->events->setModel(NULL); - m_Ctx.RemoveLogViewer(this); + m_Ctx.RemoveCaptureViewer(this); delete ui; } @@ -654,11 +654,11 @@ void PixelHistoryView::leaveEvent(QEvent *event) disableTimelineHighlight(); } -void PixelHistoryView::OnLogfileLoaded() +void PixelHistoryView::OnCaptureLoaded() { } -void PixelHistoryView::OnLogfileClosed() +void PixelHistoryView::OnCaptureClosed() { ToolWindowManager::closeToolWindow(this); } diff --git a/qrenderdoc/Windows/PixelHistoryView.h b/qrenderdoc/Windows/PixelHistoryView.h index 2b718cb44..bef7032ae 100644 --- a/qrenderdoc/Windows/PixelHistoryView.h +++ b/qrenderdoc/Windows/PixelHistoryView.h @@ -35,7 +35,7 @@ class PixelHistoryView; class PixelHistoryItemModel; struct EventTag; -class PixelHistoryView : public QFrame, public IPixelHistoryView, public ILogViewer +class PixelHistoryView : public QFrame, public IPixelHistoryView, public ICaptureViewer { Q_OBJECT @@ -48,9 +48,9 @@ public: QWidget *Widget() override { return this; } void SetHistory(const rdcarray &history) override; - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override; private slots: diff --git a/qrenderdoc/Windows/PythonShell.cpp b/qrenderdoc/Windows/PythonShell.cpp index 94befc1c6..34912acd5 100644 --- a/qrenderdoc/Windows/PythonShell.cpp +++ b/qrenderdoc/Windows/PythonShell.cpp @@ -50,15 +50,16 @@ struct CaptureContextInvoker : ICaptureContext { return m_Ctx.ConfigFilePath(filename); } - virtual QString TempLogFilename(QString appname) override + virtual QString TempCaptureFilename(QString appname) override { - return m_Ctx.TempLogFilename(appname); + return m_Ctx.TempCaptureFilename(appname); } virtual IReplayManager &Replay() override { return m_Ctx.Replay(); } - virtual bool LogLoaded() override { return m_Ctx.LogLoaded(); } - virtual bool IsLogLocal() override { return m_Ctx.IsLogLocal(); } - virtual bool LogLoading() override { return m_Ctx.LogLoading(); } - virtual QString LogFilename() override { return m_Ctx.LogFilename(); } + virtual bool IsCaptureLoaded() override { return m_Ctx.IsCaptureLoaded(); } + virtual bool IsCaptureLocal() override { return m_Ctx.IsCaptureLocal(); } + virtual bool IsCaptureTemporary() override { return m_Ctx.IsCaptureTemporary(); } + virtual bool IsCaptureLoading() override { return m_Ctx.IsCaptureLoading(); } + virtual QString GetCaptureFilename() override { return m_Ctx.GetCaptureFilename(); } virtual const FrameDescription &FrameInfo() override { return m_Ctx.FrameInfo(); } virtual const APIProperties &APIProps() override { return m_Ctx.APIProps(); } virtual uint32_t CurSelectedEvent() override { return m_Ctx.CurSelectedEvent(); } @@ -153,25 +154,29 @@ struct CaptureContextInvoker : ICaptureContext return (m_Ctx.*ptr)(params...); } - virtual void LoadLogfile(const QString &logFile, const QString &origFilename, bool temporary, + virtual void LoadCapture(const QString &capture, const QString &origFilename, bool temporary, bool local) override { - InvokeVoidFunction(&ICaptureContext::LoadLogfile, logFile, origFilename, temporary, local); + InvokeVoidFunction(&ICaptureContext::LoadCapture, capture, origFilename, temporary, local); } - virtual void CloseLogfile() override { InvokeVoidFunction(&ICaptureContext::CloseLogfile); } - virtual void SetEventID(const QVector &exclude, uint32_t selectedEventID, + virtual bool SaveCaptureTo(const QString &capture) override + { + return InvokeRetFunction(&ICaptureContext::SaveCaptureTo, capture); + } + virtual void CloseCapture() override { InvokeVoidFunction(&ICaptureContext::CloseCapture); } + virtual void SetEventID(const QVector &exclude, uint32_t selectedEventID, uint32_t eventID, bool force = false) override { InvokeVoidFunction(&ICaptureContext::SetEventID, exclude, selectedEventID, eventID, force); } virtual void RefreshStatus() override { InvokeVoidFunction(&ICaptureContext::RefreshStatus); } - virtual void AddLogViewer(ILogViewer *viewer) override + virtual void AddCaptureViewer(ICaptureViewer *viewer) override { - InvokeVoidFunction(&ICaptureContext::AddLogViewer, viewer); + InvokeVoidFunction(&ICaptureContext::AddCaptureViewer, viewer); } - virtual void RemoveLogViewer(ILogViewer *viewer) override + virtual void RemoveCaptureViewer(ICaptureViewer *viewer) override { - InvokeVoidFunction(&ICaptureContext::RemoveLogViewer, viewer); + InvokeVoidFunction(&ICaptureContext::RemoveCaptureViewer, viewer); } virtual void AddMessages(const rdcarray &msgs) override { diff --git a/qrenderdoc/Windows/ResourceInspector.cpp b/qrenderdoc/Windows/ResourceInspector.cpp index 533979ad6..b38136f63 100644 --- a/qrenderdoc/Windows/ResourceInspector.cpp +++ b/qrenderdoc/Windows/ResourceInspector.cpp @@ -144,13 +144,13 @@ ResourceInspector::ResourceInspector(ICaptureContext &ctx, QWidget *parent) Inspect(ResourceId()); - m_Ctx.AddLogViewer(this); + m_Ctx.AddCaptureViewer(this); } ResourceInspector::~ResourceInspector() { m_Ctx.BuiltinWindowClosed(this); - m_Ctx.RemoveLogViewer(this); + m_Ctx.RemoveCaptureViewer(this); delete ui; } @@ -252,7 +252,7 @@ void ResourceInspector::Inspect(ResourceId id) ui->initChunks->setUpdatesEnabled(true); } -void ResourceInspector::OnLogfileLoaded() +void ResourceInspector::OnCaptureLoaded() { ui->renameResource->setEnabled(true); @@ -260,7 +260,7 @@ void ResourceInspector::OnLogfileLoaded() m_FilterModel->sort(0); } -void ResourceInspector::OnLogfileClosed() +void ResourceInspector::OnCaptureClosed() { ui->renameResource->setEnabled(false); ui->resetName->hide(); diff --git a/qrenderdoc/Windows/ResourceInspector.h b/qrenderdoc/Windows/ResourceInspector.h index cea8aa87e..092c3ecbc 100644 --- a/qrenderdoc/Windows/ResourceInspector.h +++ b/qrenderdoc/Windows/ResourceInspector.h @@ -37,7 +37,7 @@ class QSortFilterProxyModel; class RDTreeWidgetItem; class ResourceListItemModel; -class ResourceInspector : public QFrame, public IResourceInspector, public ILogViewer +class ResourceInspector : public QFrame, public IResourceInspector, public ICaptureViewer { Q_OBJECT @@ -49,9 +49,9 @@ public: QWidget *Widget() override { return this; } void Inspect(ResourceId id) override; ResourceId CurrentResource() override { return m_Resource; } - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override; public slots: diff --git a/qrenderdoc/Windows/ShaderViewer.cpp b/qrenderdoc/Windows/ShaderViewer.cpp index 04b3fc313..15b1b7f05 100644 --- a/qrenderdoc/Windows/ShaderViewer.cpp +++ b/qrenderdoc/Windows/ShaderViewer.cpp @@ -194,7 +194,7 @@ ShaderViewer::ShaderViewer(ICaptureContext &ctx, QWidget *parent) layout->addWidget(ui->toolbar); layout->addWidget(ui->docking); - m_Ctx.AddLogViewer(this); + m_Ctx.AddCaptureViewer(this); } void ShaderViewer::editShader(bool customShader, const QString &entryPoint, const QStringMap &files) @@ -590,15 +590,15 @@ ShaderViewer::~ShaderViewer() if(m_CloseCallback) m_CloseCallback(&m_Ctx); - m_Ctx.RemoveLogViewer(this); + m_Ctx.RemoveCaptureViewer(this); delete ui; } -void ShaderViewer::OnLogfileLoaded() +void ShaderViewer::OnCaptureLoaded() { } -void ShaderViewer::OnLogfileClosed() +void ShaderViewer::OnCaptureClosed() { ToolWindowManager::closeToolWindow(this); } diff --git a/qrenderdoc/Windows/ShaderViewer.h b/qrenderdoc/Windows/ShaderViewer.h index 84d43f658..b744b7440 100644 --- a/qrenderdoc/Windows/ShaderViewer.h +++ b/qrenderdoc/Windows/ShaderViewer.h @@ -55,7 +55,7 @@ enum class VariableCategory Outputs, }; -class ShaderViewer : public QFrame, public IShaderViewer, public ILogViewer +class ShaderViewer : public QFrame, public IShaderViewer, public ICaptureViewer { Q_OBJECT @@ -99,9 +99,9 @@ public: virtual void ShowErrors(const QString &errors) override; - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override; diff --git a/qrenderdoc/Windows/StatisticsViewer.cpp b/qrenderdoc/Windows/StatisticsViewer.cpp index 5227836b4..7f5b29f4b 100644 --- a/qrenderdoc/Windows/StatisticsViewer.cpp +++ b/qrenderdoc/Windows/StatisticsViewer.cpp @@ -769,7 +769,7 @@ void StatisticsViewer::GenerateReport() QString header = tr("Stats for %1.\n\nFile size: %2MB (%3MB uncompressed, compression ratio %4:1)\n" "Persistent Data (approx): %5MB, Frame-initial data (approx): %6MB\n") - .arg(QFileInfo(m_Ctx.LogFilename()).fileName()) + .arg(QFileInfo(m_Ctx.GetCaptureFilename()).fileName()) .arg(compressedMB, 2, 'f', 2) .arg(uncompressedMB, 2, 'f', 2) .arg(compressRatio, 2, 'f', 2) @@ -818,23 +818,23 @@ StatisticsViewer::StatisticsViewer(ICaptureContext &ctx, QWidget *parent) ui->statistics->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); - m_Ctx.AddLogViewer(this); + m_Ctx.AddCaptureViewer(this); } StatisticsViewer::~StatisticsViewer() { m_Ctx.BuiltinWindowClosed(this); - m_Ctx.RemoveLogViewer(this); + m_Ctx.RemoveCaptureViewer(this); delete ui; } -void StatisticsViewer::OnLogfileClosed() +void StatisticsViewer::OnCaptureClosed() { ui->statistics->clear(); } -void StatisticsViewer::OnLogfileLoaded() +void StatisticsViewer::OnCaptureLoaded() { GenerateReport(); ui->statistics->setText(m_Report); diff --git a/qrenderdoc/Windows/StatisticsViewer.h b/qrenderdoc/Windows/StatisticsViewer.h index f77605bda..9918dcfe8 100644 --- a/qrenderdoc/Windows/StatisticsViewer.h +++ b/qrenderdoc/Windows/StatisticsViewer.h @@ -32,7 +32,7 @@ namespace Ui class StatisticsViewer; } -class StatisticsViewer : public QFrame, public IStatisticsViewer, public ILogViewer +class StatisticsViewer : public QFrame, public IStatisticsViewer, public ICaptureViewer { Q_OBJECT @@ -42,9 +42,9 @@ public: // IStatisticsViewer QWidget *Widget() override { return this; } - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override {} private: diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index 1ec73ea7e..0e142b2f3 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -463,7 +463,7 @@ TextureDescription *TextureViewer::GetCurrentTexture() void TextureViewer::UI_UpdateCachedTexture() { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) { m_CachedTexture = NULL; return; @@ -646,7 +646,7 @@ TextureViewer::TextureViewer(ICaptureContext &ctx, QWidget *parent) ui->zoomOption->setCurrentText(QString()); ui->fitToWindow->toggle(); - m_Ctx.AddLogViewer(this); + m_Ctx.AddCaptureViewer(this); SetupTextureTabs(); } @@ -657,7 +657,7 @@ TextureViewer::~TextureViewer() m_Output->Shutdown(); m_Ctx.BuiltinWindowClosed(this); - m_Ctx.RemoveLogViewer(this); + m_Ctx.RemoveCaptureViewer(this); delete ui; } @@ -1416,7 +1416,7 @@ void TextureViewer::UI_UpdateChannels() } m_TexDisplay.CustomShader = ResourceId(); } - else if(ui->channels->currentIndex() == 0 || !m_Ctx.LogLoaded()) + else if(ui->channels->currentIndex() == 0 || !m_Ctx.IsCaptureLoaded()) { // RGBA SHOW(ui->channelRed); @@ -1654,7 +1654,7 @@ void TextureViewer::UI_CreateThumbnails() void TextureViewer::GotoLocation(int x, int y) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; TextureDescription *tex = GetCurrentTexture(); @@ -1770,7 +1770,7 @@ void TextureViewer::showDisabled_triggered() { m_ShowDisabled = !m_ShowDisabled; - if(m_Ctx.LogLoaded()) + if(m_Ctx.IsCaptureLoaded()) m_Ctx.RefreshStatus(); } @@ -1778,7 +1778,7 @@ void TextureViewer::showEmpty_triggered() { m_ShowEmpty = !m_ShowEmpty; - if(m_Ctx.LogLoaded()) + if(m_Ctx.IsCaptureLoaded()) m_Ctx.RefreshStatus(); } @@ -2182,7 +2182,7 @@ void TextureViewer::render_keyPress(QKeyEvent *e) clipboard->setText(ui->texStatusDim->text() + lit(" | ") + ui->statusText->text()); } - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; if((e->modifiers() & Qt::ControlModifier) && e->key() == Qt::Key_G) @@ -2355,8 +2355,8 @@ void TextureViewer::UI_RecreatePanels() { ICaptureContext *ctx = &m_Ctx; - // while a log is loaded, pass NULL into the widget - if(!m_Ctx.LogLoaded()) + // while a capture is loaded, pass NULL into the widget + if(!m_Ctx.IsCaptureLoaded()) ctx = NULL; { @@ -2404,7 +2404,7 @@ void TextureViewer::updateBackgroundColors() } } -void TextureViewer::OnLogfileLoaded() +void TextureViewer::OnCaptureLoaded() { Reset(); @@ -2415,7 +2415,7 @@ void TextureViewer::OnLogfileLoaded() ui->locationGoto->setEnabled(true); ui->viewTexBuffer->setEnabled(true); - if(m_Ctx.CurPipelineState().IsLogD3D11()) + if(m_Ctx.CurPipelineState().IsCaptureD3D11()) { ui->pixelHistory->setEnabled(true); ui->pixelHistory->setToolTip(QString()); @@ -2426,7 +2426,7 @@ void TextureViewer::OnLogfileLoaded() ui->pixelHistory->setToolTip(tr("Pixel History not implemented on this API")); } - if(m_Ctx.CurPipelineState().IsLogD3D11()) + if(m_Ctx.CurPipelineState().IsCaptureD3D11()) { ui->debugPixelContext->setEnabled(true); ui->debugPixelContext->setToolTip(QString()); @@ -2528,7 +2528,7 @@ void TextureViewer::Reset() UI_UpdateChannels(); } -void TextureViewer::OnLogfileClosed() +void TextureViewer::OnCaptureClosed() { Reset(); @@ -2990,8 +2990,8 @@ void TextureViewer::on_visualiseRange_clicked() void TextureViewer::AutoFitRange() { - // no log loaded or buffer/empty texture currently being viewed - don't autofit - if(!m_Ctx.LogLoaded() || GetCurrentTexture() == NULL || m_Output == NULL) + // no capture loaded or buffer/empty texture currently being viewed - don't autofit + if(!m_Ctx.IsCaptureLoaded() || GetCurrentTexture() == NULL || m_Output == NULL) return; m_Ctx.Replay().AsyncInvoke([this](IReplayController *r) { @@ -3501,7 +3501,7 @@ void TextureViewer::on_textureList_clicked(const QModelIndex &index) void TextureViewer::reloadCustomShaders(const QString &filter) { - if(!m_Ctx.LogLoaded()) + if(!m_Ctx.IsCaptureLoaded()) return; if(filter.isEmpty()) diff --git a/qrenderdoc/Windows/TextureViewer.h b/qrenderdoc/Windows/TextureViewer.h index b3e4fd1da..03630b970 100644 --- a/qrenderdoc/Windows/TextureViewer.h +++ b/qrenderdoc/Windows/TextureViewer.h @@ -114,7 +114,7 @@ struct TexSettings CompType typeHint; }; -class TextureViewer : public QFrame, public ITextureViewer, public ILogViewer +class TextureViewer : public QFrame, public ITextureViewer, public ICaptureViewer { private: Q_OBJECT @@ -130,9 +130,9 @@ public: void ViewTexture(ResourceId ID, bool focus) override; void GotoLocation(int x, int y) override; - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override; diff --git a/qrenderdoc/Windows/TimelineBar.cpp b/qrenderdoc/Windows/TimelineBar.cpp index 02f3d03ed..9daacb238 100644 --- a/qrenderdoc/Windows/TimelineBar.cpp +++ b/qrenderdoc/Windows/TimelineBar.cpp @@ -49,7 +49,7 @@ QMargins uniformMargins(int m) TimelineBar::TimelineBar(ICaptureContext &ctx, QWidget *parent) : QAbstractScrollArea(parent), m_Ctx(ctx) { - m_Ctx.AddLogViewer(this); + m_Ctx.AddCaptureViewer(this); setMouseTracking(true); @@ -68,7 +68,7 @@ TimelineBar::~TimelineBar() { m_Ctx.BuiltinWindowClosed(this); - m_Ctx.RemoveLogViewer(this); + m_Ctx.RemoveCaptureViewer(this); } void TimelineBar::HighlightResourceUsage(ResourceId id) @@ -107,7 +107,7 @@ void TimelineBar::HighlightHistory(ResourceId id, const QList viewport()->update(); } -void TimelineBar::OnLogfileClosed() +void TimelineBar::OnCaptureClosed() { setWindowTitle(tr("Timeline")); @@ -118,7 +118,7 @@ void TimelineBar::OnLogfileClosed() layout(); } -void TimelineBar::OnLogfileLoaded() +void TimelineBar::OnCaptureLoaded() { setWindowTitle(tr("Timeline - Frame #%1").arg(m_Ctx.FrameInfo().frameNumber)); diff --git a/qrenderdoc/Windows/TimelineBar.h b/qrenderdoc/Windows/TimelineBar.h index ec4efd850..6098ce403 100644 --- a/qrenderdoc/Windows/TimelineBar.h +++ b/qrenderdoc/Windows/TimelineBar.h @@ -27,7 +27,7 @@ #include #include "Code/CaptureContext.h" -class TimelineBar : public QAbstractScrollArea, public ITimelineBar, public ILogViewer +class TimelineBar : public QAbstractScrollArea, public ITimelineBar, public ICaptureViewer { Q_OBJECT @@ -41,9 +41,9 @@ public: QWidget *Widget() override { return this; } void HighlightResourceUsage(ResourceId id) override; void HighlightHistory(ResourceId id, const QList &history) override; - // ILogViewerForm - void OnLogfileLoaded() override; - void OnLogfileClosed() override; + // ICaptureViewer + void OnCaptureLoaded() override; + void OnCaptureClosed() override; void OnSelectedEventChanged(uint32_t eventID) override {} void OnEventChanged(uint32_t eventID) override;