mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-17 20:16:31 +00:00
Fix capturing frame 0 if the first window is never presented
* The first window created becomes active, if it never presents then a frame 0 capture never finishes.
This commit is contained in:
@@ -2566,6 +2566,8 @@ void WrappedID3D11Device::FirstFrame(IDXGISwapper *swapper)
|
||||
{
|
||||
RenderDoc::Inst().StartFrameCapture(DeviceOwnedWindow((ID3D11Device *)this, swapper->GetHWND()));
|
||||
|
||||
m_FirstFrameCaptureWindow = swapper->GetHWND();
|
||||
|
||||
m_AppControlledCapture = false;
|
||||
m_CapturedFrames.back().frameNumber = 0;
|
||||
}
|
||||
@@ -2669,7 +2671,17 @@ HRESULT WrappedID3D11Device::Present(IDXGISwapper *swapper, UINT SyncInterval, U
|
||||
m_pImmediateContext->Present(SyncInterval, Flags);
|
||||
|
||||
if(!activeWindow)
|
||||
{
|
||||
// first present to *any* window, even inactive, terminates frame 0
|
||||
if(m_FirstFrameCaptureWindow != NULL && IsActiveCapturing(m_State))
|
||||
{
|
||||
RenderDoc::Inst().EndFrameCapture(
|
||||
DeviceOwnedWindow((ID3D11Device *)this, m_FirstFrameCaptureWindow));
|
||||
m_FirstFrameCaptureWindow = NULL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// kill any current capture that isn't application defined
|
||||
if(IsActiveCapturing(m_State) && !m_AppControlledCapture)
|
||||
|
||||
@@ -557,6 +557,7 @@ private:
|
||||
D3D11ResourceRecord *m_DeviceRecord;
|
||||
|
||||
CaptureState m_State;
|
||||
void *m_FirstFrameCaptureWindow = NULL;
|
||||
bool m_AppControlledCapture = false;
|
||||
|
||||
PerformanceTimer m_CaptureTimer;
|
||||
|
||||
@@ -1387,6 +1387,8 @@ void WrappedID3D12Device::FirstFrame(IDXGISwapper *swapper)
|
||||
RenderDoc::Inst().StartFrameCapture(
|
||||
DeviceOwnedWindow((ID3D12Device *)this, swapper ? swapper->GetHWND() : NULL));
|
||||
|
||||
m_FirstFrameCapture = true;
|
||||
m_FirstFrameCaptureWindow = swapper ? swapper->GetHWND() : NULL;
|
||||
m_AppControlledCapture = false;
|
||||
m_CapturedFrames.back().frameNumber = 0;
|
||||
}
|
||||
@@ -2118,7 +2120,18 @@ HRESULT WrappedID3D12Device::Present(ID3D12GraphicsCommandList *pOverlayCommandL
|
||||
}
|
||||
|
||||
if(!activeWindow)
|
||||
{
|
||||
// first present to *any* window, even inactive, terminates frame 0
|
||||
if(m_FirstFrameCapture && IsActiveCapturing(m_State))
|
||||
{
|
||||
RenderDoc::Inst().EndFrameCapture(
|
||||
DeviceOwnedWindow((ID3D12Device *)this, m_FirstFrameCaptureWindow));
|
||||
m_FirstFrameCaptureWindow = NULL;
|
||||
m_FirstFrameCapture = false;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// kill any current capture that isn't application defined
|
||||
if(IsActiveCapturing(m_State) && !m_AppControlledCapture)
|
||||
|
||||
@@ -682,6 +682,8 @@ private:
|
||||
RDResult m_FailedReplayResult = ResultCode::APIReplayFailed;
|
||||
|
||||
bool m_AppControlledCapture = false;
|
||||
bool m_FirstFrameCapture = false;
|
||||
void *m_FirstFrameCaptureWindow = NULL;
|
||||
|
||||
Threading::RWLock m_CapTransitionLock;
|
||||
CaptureState m_State;
|
||||
|
||||
@@ -2127,7 +2127,17 @@ void WrappedOpenGL::SwapBuffers(WindowingSystem winSystem, void *windowHandle)
|
||||
GetResourceManager()->CleanBackgroundFrameReferences();
|
||||
|
||||
if(!activeWindow)
|
||||
{
|
||||
// first present to *any* window, even inactive, terminates frame 0
|
||||
if(m_FirstFrameCapture && IsActiveCapturing(m_State))
|
||||
{
|
||||
RenderDoc::Inst().EndFrameCapture(DeviceOwnedWindow(m_FirstFrameCaptureContext, NULL));
|
||||
m_FirstFrameCapture = false;
|
||||
m_FirstFrameCaptureContext = NULL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// only allow capturing on 'modern' created contexts
|
||||
if(ctxdata.Legacy())
|
||||
@@ -2594,6 +2604,8 @@ void WrappedOpenGL::FirstFrame(void *ctx, void *wndHandle)
|
||||
// on the device - the very next present to any window on this context will end the capture.
|
||||
RenderDoc::Inst().StartFrameCapture(DeviceOwnedWindow(ctx, NULL));
|
||||
|
||||
m_FirstFrameCapture = true;
|
||||
m_FirstFrameCaptureContext = ctx;
|
||||
m_AppControlledCapture = false;
|
||||
m_CapturedFrames.back().frameNumber = 0;
|
||||
}
|
||||
|
||||
@@ -145,6 +145,8 @@ private:
|
||||
// internals
|
||||
CaptureState m_State;
|
||||
bool m_AppControlledCapture = false;
|
||||
bool m_FirstFrameCapture = false;
|
||||
void *m_FirstFrameCaptureContext = NULL;
|
||||
|
||||
PerformanceTimer m_CaptureTimer;
|
||||
|
||||
|
||||
@@ -1767,6 +1767,10 @@ void WrappedVulkan::FirstFrame()
|
||||
{
|
||||
RenderDoc::Inst().StartFrameCapture(DeviceOwnedWindow(LayerDisp(m_Instance), NULL));
|
||||
|
||||
RDCLOG("frame 0 cap");
|
||||
|
||||
m_FirstFrameCapture = true;
|
||||
|
||||
m_AppControlledCapture = false;
|
||||
m_CapturedFrames.back().frameNumber = 0;
|
||||
}
|
||||
@@ -2433,8 +2437,21 @@ void WrappedVulkan::Present(DeviceOwnedWindow devWnd)
|
||||
|
||||
RenderDoc::Inst().AddActiveDriver(RDCDriver::Vulkan, true);
|
||||
|
||||
RDCLOG("Present() window %p", devWnd.windowHandle);
|
||||
|
||||
if(!activeWindow)
|
||||
{
|
||||
RDCLOG("inactive");
|
||||
|
||||
// first present to *any* window, even inactive, terminates frame 0
|
||||
if(m_FirstFrameCapture && IsActiveCapturing(m_State))
|
||||
{
|
||||
RenderDoc::Inst().EndFrameCapture(DeviceOwnedWindow(LayerDisp(m_Instance), NULL));
|
||||
m_FirstFrameCapture = false;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(IsActiveCapturing(m_State) && !m_AppControlledCapture)
|
||||
RenderDoc::Inst().EndFrameCapture(devWnd);
|
||||
@@ -3745,6 +3762,8 @@ VkResourceRecord *WrappedVulkan::RegisterSurface(WindowingSystem system, void *h
|
||||
{
|
||||
Keyboard::AddInputWindow(system, handle);
|
||||
|
||||
RDCLOG("RegisterSurface() window %p", handle);
|
||||
|
||||
RenderDoc::Inst().AddFrameCapturer(DeviceOwnedWindow(LayerDisp(m_Instance), handle), this);
|
||||
|
||||
return (VkResourceRecord *)new PackedWindowHandle(system, handle);
|
||||
|
||||
@@ -299,6 +299,7 @@ private:
|
||||
RDResult m_FatalError = ResultCode::Succeeded;
|
||||
CaptureState m_State;
|
||||
bool m_AppControlledCapture = false;
|
||||
bool m_FirstFrameCapture = false;
|
||||
|
||||
int32_t m_ReuseEnabled = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user