Implement shutting down individual replay outputs

* This means e.g. that if the mesh output view gets closed, we don't
  keep it around internally and keep calling InitPostVSBuffers for it.
This commit is contained in:
baldurk committed 2017-11-10 12:22:13 +00:00
1 parent 241b8f4404
commit 954a11de89
6 files changed
+30 -7

No files matched your search

+3
View File
@@ -1274,6 +1274,9 @@ void BufferViewer::stageRowMenu(MeshDataStage stage, QMenu *menu, const QPoint &
BufferViewer::~BufferViewer()
{
if(m_Output)
m_Output->Shutdown();
if(m_ModelVSIn->indices)
m_ModelVSIn->indices->deref();
+3
View File
@@ -652,6 +652,9 @@ TextureViewer::TextureViewer(ICaptureContext &ctx, QWidget *parent)
TextureViewer::~TextureViewer()
{
if(m_Output)
m_Output->Shutdown();
m_Ctx.BuiltinWindowClosed(this);
m_Ctx.RemoveLogViewer(this);
delete ui;
+7 -6
View File
@@ -404,6 +404,13 @@ The different types are enumerated in :class:`ReplayOutputType`.
)");
struct IReplayOutput
{
DOCUMENT(R"(Shutdown this output.
It's optional to call this, as calling :meth:`ReplayController.Shutdown` will shut down all of its
outputs.
)");
virtual void Shutdown() = 0;
DOCUMENT("Sets the :class:`TextureDisplay` configuration for a texture output.");
virtual void SetTextureDisplay(const TextureDisplay &o) = 0;
@@ -587,12 +594,6 @@ struct IReplayController
DOCUMENT("Shutdown and destroy the current interface and all outputs that have been created.");
virtual void Shutdown() = 0;
DOCUMENT(R"(Shutdown a particular output.
:param ReplayOutput output: The output to shut down.
)");
virtual void ShutdownOutput(IReplayOutput *output) = 0;
DOCUMENT(R"(Goes into a blocking loop, repeatedly replaying the open capture as fast as possible,
displaying the selected texture in a default unscaled manner to the given output window.
+11 -1
View File
@@ -1427,7 +1427,17 @@ ReplayOutput *ReplayController::CreateOutput(WindowingSystem system, void *data,
void ReplayController::ShutdownOutput(IReplayOutput *output)
{
RDCUNIMPLEMENTED("Shutting down individual outputs");
for(auto it = m_Outputs.begin(); it != m_Outputs.end(); ++it)
{
if((IReplayOutput *)*it == output)
{
delete *it;
m_Outputs.erase(it);
return;
}
}
RDCERR("Unrecognised output");
}
void ReplayController::Shutdown()
+1
View File
@@ -37,6 +37,7 @@ struct ReplayController;
struct ReplayOutput : public IReplayOutput
{
public:
void Shutdown();
void SetTextureDisplay(const TextureDisplay &o);
void SetMeshDisplay(const MeshDisplay &o);
+5
View File
@@ -117,6 +117,11 @@ ReplayOutput::~ReplayOutput()
ClearThumbnails();
}
void ReplayOutput::Shutdown()
{
m_pRenderer->ShutdownOutput(this);
}
void ReplayOutput::SetTextureDisplay(const TextureDisplay &o)
{
if(o.overlay != m_RenderData.texDisplay.overlay ||