diff --git a/qrenderdoc/Code/CaptureContext.cpp b/qrenderdoc/Code/CaptureContext.cpp index ff01a41f1..2815fb5d9 100644 --- a/qrenderdoc/Code/CaptureContext.cpp +++ b/qrenderdoc/Code/CaptureContext.cpp @@ -943,6 +943,20 @@ void CaptureContext::AddDockWindow(QWidget *newWindow, DockReference ref, QWidge m_MainWindow->mainToolManager()->addToolWindow(newWindow, m_MainWindow->leftToolArea()); return; } + if(ref == DockReference::ConstantBufferArea) + { + if(ConstantBufferPreviewer::getOne()) + { + ToolWindowManager *manager = ToolWindowManager::managerOf(refWindow); + + manager->addToolWindow(newWindow, ToolWindowManager::AreaReference( + ToolWindowManager::AddTo, + manager->areaOf(ConstantBufferPreviewer::getOne()))); + return; + } + + ref = DockReference::RightOf; + } ToolWindowManager *manager = ToolWindowManager::managerOf(refWindow); diff --git a/qrenderdoc/Code/Interface/QRDInterface.h b/qrenderdoc/Code/Interface/QRDInterface.h index a24ad6e56..299c98f79 100644 --- a/qrenderdoc/Code/Interface/QRDInterface.h +++ b/qrenderdoc/Code/Interface/QRDInterface.h @@ -684,6 +684,11 @@ a new dock window or moving an existing dock window. The new dock window is placed in the 'left' tool area as defined by finding an existing known window and using that as the main area, then adding to the left of that. In the default layout this is where the event browser is placed. + +.. data:: ConstantBufferArea + + The new dock window is docked with other constant buffer views, if they exist, or to the right + of the existing window if there are none open. )"); enum class DockReference : int { @@ -700,6 +705,7 @@ enum class DockReference : int // extra values here MainToolArea, LeftToolArea, + ConstantBufferArea, }; DOCUMENT("The capture context that the python script is running in.") diff --git a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp index 7240153c0..537126597 100644 --- a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp +++ b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp @@ -24,6 +24,7 @@ #include "ConstantBufferPreviewer.h" #include +#include "3rdparty/toolwindowmanager/ToolWindowManager.h" #include "ui_ConstantBufferPreviewer.h" QList ConstantBufferPreviewer::m_Previews; @@ -78,6 +79,17 @@ ConstantBufferPreviewer *ConstantBufferPreviewer::has(ShaderStage stage, uint32_ return NULL; } +ConstantBufferPreviewer *ConstantBufferPreviewer::getOne() +{ + for(ConstantBufferPreviewer *c : m_Previews) + { + if(ToolWindowManager::managerOf(c)) + return c; + } + + return NULL; +} + void ConstantBufferPreviewer::OnLogfileLoaded() { OnLogfileClosed(); diff --git a/qrenderdoc/Windows/ConstantBufferPreviewer.h b/qrenderdoc/Windows/ConstantBufferPreviewer.h index e8b955477..34ee96f37 100644 --- a/qrenderdoc/Windows/ConstantBufferPreviewer.h +++ b/qrenderdoc/Windows/ConstantBufferPreviewer.h @@ -45,6 +45,7 @@ public: ~ConstantBufferPreviewer(); static ConstantBufferPreviewer *has(ShaderStage stage, uint32_t slot, uint32_t idx); + static ConstantBufferPreviewer *getOne(); // IConstantBufferPreviewer QWidget *Widget() override { return this; } diff --git a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp index 7daa0c2cc..1064c7dec 100644 --- a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp @@ -1959,7 +1959,7 @@ void D3D11PipelineStateViewer::cbuffer_itemActivated(RDTreeWidgetItem *item, int IConstantBufferPreviewer *prev = m_Ctx.ViewConstantBuffer(stage->stage, cb, 0); - m_Ctx.AddDockWindow(prev->Widget(), DockReference::RightOf, this, 0.3f); + m_Ctx.AddDockWindow(prev->Widget(), DockReference::ConstantBufferArea, this, 0.3f); } void D3D11PipelineStateViewer::on_iaLayouts_itemActivated(RDTreeWidgetItem *item, int column)