mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Tidy up handling of windowing data, make it a bit more type safe
This commit is contained in:
@@ -1144,33 +1144,23 @@ int CaptureContext::ResourceNameCacheID()
|
||||
return m_CustomNameCachedID;
|
||||
}
|
||||
|
||||
void *CaptureContext::FillWindowingData(uintptr_t widget)
|
||||
WindowingData CaptureContext::CreateWindowingData(uintptr_t widget)
|
||||
{
|
||||
#if defined(WIN32)
|
||||
|
||||
return (void *)widget;
|
||||
return CreateWin32WindowingData((HWND)widget);
|
||||
|
||||
#elif defined(RENDERDOC_PLATFORM_LINUX)
|
||||
|
||||
static XCBWindowData xcb;
|
||||
static XlibWindowData xlib;
|
||||
|
||||
if(m_CurWinSystem == WindowingSystem::XCB)
|
||||
{
|
||||
xcb.connection = m_XCBConnection;
|
||||
xcb.window = (xcb_window_t)widget;
|
||||
return &xcb;
|
||||
}
|
||||
return CreateXCBWindowingData(m_XCBConnection, (xcb_window_t)widget);
|
||||
else
|
||||
{
|
||||
xlib.display = m_X11Display;
|
||||
xlib.window = (Drawable)widget;
|
||||
return &xlib;
|
||||
}
|
||||
return CreateXlibWindowingData(m_X11Display, (Drawable)widget);
|
||||
|
||||
#elif defined(RENDERDOC_PLATFORM_APPLE)
|
||||
|
||||
return (void *)widget;
|
||||
WindowingData ret = {WindowingSystem::Unknown};
|
||||
return ret;
|
||||
|
||||
#else
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
}
|
||||
const SDFile &GetStructuredFile() override { return *m_StructuredFile; }
|
||||
WindowingSystem CurWindowingSystem() override { return m_CurWinSystem; }
|
||||
void *FillWindowingData(uintptr_t winId) override;
|
||||
WindowingData CreateWindowingData(uintptr_t winId) override;
|
||||
|
||||
const rdcarray<DebugMessage> &DebugMessages() override { return m_DebugMessages; }
|
||||
int UnreadMessageCount() override { return m_UnreadMessageCount; }
|
||||
|
||||
@@ -1296,16 +1296,11 @@ considered out of date
|
||||
DOCUMENT(R"(Create an opaque pointer suitable for passing to
|
||||
:meth:`~renderdoc.ReplayController.CreateOutput` or other functions that expect windowing data.
|
||||
|
||||
.. note::
|
||||
|
||||
This data only stays valid until the next call to FillWindowingData. You should pass it to the
|
||||
consuming function immediately.
|
||||
|
||||
:param int winId: The window ID as returned from ``QWidget.winId()``.
|
||||
:return: The windowing data.
|
||||
:rtype: opaque void * pointer.
|
||||
:rtype: ~renderdoc.WindowingData
|
||||
)");
|
||||
virtual void *FillWindowingData(uintptr_t winId) = 0;
|
||||
virtual WindowingData CreateWindowingData(uintptr_t winId) = 0;
|
||||
|
||||
DOCUMENT(R"(Retrieve the current list of debug messages. This includes messages from the capture
|
||||
as well as messages generated during replay and analysis.
|
||||
|
||||
@@ -1362,8 +1362,7 @@ void BufferViewer::OnCaptureLoaded()
|
||||
WId renderID = ui->render->winId();
|
||||
|
||||
m_Ctx.Replay().BlockInvoke([renderID, this](IReplayController *r) {
|
||||
m_Output = r->CreateOutput(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(renderID),
|
||||
ReplayOutputType::Mesh);
|
||||
m_Output = r->CreateOutput(m_Ctx.CreateWindowingData(renderID), ReplayOutputType::Mesh);
|
||||
|
||||
ui->render->setOutput(m_Output);
|
||||
|
||||
|
||||
@@ -2087,11 +2087,9 @@ void MainWindow::on_action_Start_Replay_Loop_triggered()
|
||||
.arg(tr("nothing")));
|
||||
}
|
||||
|
||||
WindowingSystem winSys = m_Ctx.CurWindowingSystem();
|
||||
void *winData = m_Ctx.FillWindowingData(popup.winId());
|
||||
WindowingData winData = m_Ctx.CreateWindowingData(popup.winId());
|
||||
|
||||
m_Ctx.Replay().AsyncInvoke(
|
||||
[winSys, winData, id](IReplayController *r) { r->ReplayLoop(winSys, winData, id); });
|
||||
m_Ctx.Replay().AsyncInvoke([winData, id](IReplayController *r) { r->ReplayLoop(winData, id); });
|
||||
|
||||
RDDialog::show(&popup);
|
||||
|
||||
|
||||
@@ -101,9 +101,9 @@ struct CaptureContextInvoker : ICaptureContext
|
||||
}
|
||||
virtual const SDFile &GetStructuredFile() override { return m_Ctx.GetStructuredFile(); }
|
||||
virtual WindowingSystem CurWindowingSystem() override { return m_Ctx.CurWindowingSystem(); }
|
||||
virtual void *FillWindowingData(uintptr_t winId) override
|
||||
virtual WindowingData CreateWindowingData(uintptr_t winId) override
|
||||
{
|
||||
return m_Ctx.FillWindowingData(winId);
|
||||
return m_Ctx.CreateWindowingData(winId);
|
||||
}
|
||||
virtual const rdcarray<DebugMessage> &DebugMessages() override { return m_Ctx.DebugMessages(); }
|
||||
virtual int UnreadMessageCount() override { return m_Ctx.UnreadMessageCount(); }
|
||||
|
||||
@@ -1875,15 +1875,13 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id, Co
|
||||
if(m_Ctx.GetTexture(id))
|
||||
{
|
||||
m_Ctx.Replay().AsyncInvoke([this, handle, id, typeHint](IReplayController *) {
|
||||
m_Output->AddThumbnail(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(handle), id,
|
||||
typeHint);
|
||||
m_Output->AddThumbnail(m_Ctx.CreateWindowingData(handle), id, typeHint);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Ctx.Replay().AsyncInvoke([this, handle](IReplayController *) {
|
||||
m_Output->AddThumbnail(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(handle),
|
||||
ResourceId(), CompType::Typeless);
|
||||
m_Output->AddThumbnail(m_Ctx.CreateWindowingData(handle), ResourceId(), CompType::Typeless);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1900,8 +1898,7 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id, Co
|
||||
|
||||
WId handle = prev->thumbWinId();
|
||||
m_Ctx.Replay().AsyncInvoke([this, handle](IReplayController *) {
|
||||
m_Output->AddThumbnail(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(handle),
|
||||
ResourceId(), CompType::Typeless);
|
||||
m_Output->AddThumbnail(m_Ctx.CreateWindowingData(handle), ResourceId(), CompType::Typeless);
|
||||
});
|
||||
}
|
||||
else
|
||||
@@ -2445,10 +2442,9 @@ void TextureViewer::OnCaptureLoaded()
|
||||
: FloatVector();
|
||||
|
||||
m_Ctx.Replay().BlockInvoke([renderID, contextID, this](IReplayController *r) {
|
||||
m_Output = r->CreateOutput(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(renderID),
|
||||
ReplayOutputType::Texture);
|
||||
m_Output = r->CreateOutput(m_Ctx.CreateWindowingData(renderID), ReplayOutputType::Texture);
|
||||
|
||||
m_Output->SetPixelContext(m_Ctx.CurWindowingSystem(), m_Ctx.FillWindowingData(contextID));
|
||||
m_Output->SetPixelContext(m_Ctx.CreateWindowingData(contextID));
|
||||
|
||||
ui->render->setOutput(m_Output);
|
||||
ui->pixelContext->setOutput(m_Output);
|
||||
|
||||
Reference in New Issue
Block a user