mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-24 15:36:33 +00:00
On D3D12 and Vulkan start first frame capture on API init. Closes #1195
* On GL/D3D11 we delay the start of the 'first frame' until a swapchain has been created for D3D11, or an attribs-created context has been created for GL. This makes it more useful and doesn't fire when creating devices/contexts for enumeration or trampolining. * On Vulkan/D3D12 the first device that's created is useful, so we can start capturing immediately once it's available.
This commit is contained in:
@@ -448,6 +448,11 @@ WrappedID3D12Device::~WrappedID3D12Device()
|
||||
|
||||
if(RenderDoc::Inst().GetCrashHandler())
|
||||
RenderDoc::Inst().GetCrashHandler()->UnregisterMemoryRegion(this);
|
||||
|
||||
if(!RenderDoc::Inst().IsReplayApp())
|
||||
{
|
||||
FirstFrame(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT WrappedID3D12Device::QueryInterface(REFIID riid, void **ppvObject)
|
||||
@@ -752,7 +757,10 @@ void WrappedID3D12Device::CheckForDeath()
|
||||
|
||||
void WrappedID3D12Device::FirstFrame(WrappedIDXGISwapChain4 *swap)
|
||||
{
|
||||
DXGI_SWAP_CHAIN_DESC swapdesc = swap->GetDescWithHWND();
|
||||
DXGI_SWAP_CHAIN_DESC swapdesc = {};
|
||||
|
||||
if(swap)
|
||||
swapdesc = swap->GetDescWithHWND();
|
||||
|
||||
// if we have to capture the first frame, begin capturing immediately
|
||||
if(IsBackgroundCapturing(m_State) && RenderDoc::Inst().ShouldTriggerCapture(0))
|
||||
|
||||
@@ -1146,14 +1146,12 @@ void WrappedVulkan::EndCaptureFrame(VkImage presentImage)
|
||||
m_FrameCaptureRecord->AddChunk(scope.Get());
|
||||
}
|
||||
|
||||
void WrappedVulkan::FirstFrame(VkSwapchainKHR swap)
|
||||
void WrappedVulkan::FirstFrame()
|
||||
{
|
||||
SwapchainInfo *swapdesc = GetRecord(swap)->swapInfo;
|
||||
|
||||
// if we have to capture the first frame, begin capturing immediately
|
||||
if(IsBackgroundCapturing(m_State) && RenderDoc::Inst().ShouldTriggerCapture(0))
|
||||
{
|
||||
RenderDoc::Inst().StartFrameCapture(LayerDisp(m_Instance), swapdesc ? swapdesc->wndHandle : NULL);
|
||||
RenderDoc::Inst().StartFrameCapture(LayerDisp(m_Instance), NULL);
|
||||
|
||||
m_AppControlledCapture = false;
|
||||
}
|
||||
|
||||
@@ -767,7 +767,7 @@ private:
|
||||
bool Serialise_BeginCaptureFrame(SerialiserType &ser);
|
||||
void EndCaptureFrame(VkImage presentImage);
|
||||
|
||||
void FirstFrame(VkSwapchainKHR swap);
|
||||
void FirstFrame();
|
||||
|
||||
bool CheckMemoryRequirements(const char *resourceName, ResourceId memId,
|
||||
VkDeviceSize memoryOffset, VkMemoryRequirements mrq);
|
||||
|
||||
@@ -2312,6 +2312,8 @@ VkResult WrappedVulkan::vkCreateDevice(VkPhysicalDevice physicalDevice,
|
||||
SAFE_DELETE_ARRAY(props);
|
||||
SAFE_DELETE_ARRAY(modQueues);
|
||||
|
||||
FirstFrame();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -594,8 +594,6 @@ void WrappedVulkan::WrapAndProcessCreatedSwapchain(VkDevice device,
|
||||
|
||||
SAFE_DELETE_ARRAY(images);
|
||||
}
|
||||
|
||||
FirstFrame(*pSwapChain);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user