mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 13:20:54 +00:00
When StartFrameCapture() is called on API, also make that wnd active
This commit is contained in:
+28
-2
@@ -319,7 +319,7 @@ void RenderDoc::Shutdown()
|
||||
}
|
||||
}
|
||||
|
||||
IFrameCapturer *RenderDoc::MatchFrameCapturer(void *dev, void *wnd)
|
||||
bool RenderDoc::MatchClosestWindow(void *&dev, void *&wnd)
|
||||
{
|
||||
DeviceWnd dw(dev, wnd);
|
||||
|
||||
@@ -338,7 +338,25 @@ IFrameCapturer *RenderDoc::MatchFrameCapturer(void *dev, void *wnd)
|
||||
++it;
|
||||
}
|
||||
|
||||
if(it == m_WindowFrameCapturers.end())
|
||||
if(it != m_WindowFrameCapturers.end())
|
||||
{
|
||||
dev = it->first.dev;
|
||||
wnd = it->first.wnd;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
IFrameCapturer *RenderDoc::MatchFrameCapturer(void *dev, void *wnd)
|
||||
{
|
||||
DeviceWnd dw(dev, wnd);
|
||||
|
||||
// try and find the closest frame capture registered, and update
|
||||
// the values in dw to point to it precisely
|
||||
bool exactMatch = MatchClosestWindow(dw.dev, dw.wnd);
|
||||
|
||||
if(!exactMatch)
|
||||
{
|
||||
// handle off-screen rendering where there are no device/window pairs in
|
||||
// m_WindowFrameCapturers, instead we use the first matching device frame capturer
|
||||
@@ -356,6 +374,14 @@ IFrameCapturer *RenderDoc::MatchFrameCapturer(void *dev, void *wnd)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
auto it = m_WindowFrameCapturers.find(dw);
|
||||
|
||||
if(it == m_WindowFrameCapturers.end())
|
||||
{
|
||||
RDCERR("Couldn't find frame capturer after exact match!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return it->second.FrameCapturer;
|
||||
}
|
||||
|
||||
|
||||
@@ -258,6 +258,8 @@ class RenderDoc
|
||||
void SetActiveWindow(void *dev, void *wnd);
|
||||
bool EndFrameCapture(void *dev, void *wnd);
|
||||
|
||||
bool MatchClosestWindow(void *&dev, void *&wnd);
|
||||
|
||||
bool IsActiveWindow(void *dev, void *wnd) { return dev == m_ActiveWindow.dev && wnd == m_ActiveWindow.wnd; }
|
||||
|
||||
void TriggerCapture() { m_Cap = true; }
|
||||
|
||||
@@ -133,6 +133,12 @@ static void SetActiveWindow(void *device, void *wndHandle)
|
||||
static void StartFrameCapture(void *device, void *wndHandle)
|
||||
{
|
||||
RenderDoc::Inst().StartFrameCapture(device, wndHandle);
|
||||
|
||||
if(device == NULL || wndHandle == NULL)
|
||||
RenderDoc::Inst().MatchClosestWindow(device, wndHandle);
|
||||
|
||||
if(device != NULL && wndHandle != NULL)
|
||||
RenderDoc::Inst().SetActiveWindow(device, wndHandle);
|
||||
}
|
||||
|
||||
static uint32_t IsFrameCapturing()
|
||||
|
||||
Reference in New Issue
Block a user