When StartFrameCapture() is called on API, also make that wnd active

This commit is contained in:
baldurk
2016-01-21 18:21:19 +01:00
parent eb3e74db38
commit 278a9774a0
3 changed files with 36 additions and 2 deletions
+28 -2
View File
@@ -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;
}
+2
View File
@@ -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; }
+6
View File
@@ -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()