From f698bac6bfa17bdd15d370ed1bd09a5df39aa44a Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 14 May 2018 16:43:57 +0100 Subject: [PATCH] Add hack to avoid breaking VkMarkerRegion with multiple vulkan instances * This can happen when converting to structured data. We let the first WrappedVulkan 'claim' the static pointer, and ignore others. It's not perfect but avoids the need to refactor and pass in handle everywhere. --- renderdoc/driver/vulkan/vk_core.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/vulkan/vk_core.cpp b/renderdoc/driver/vulkan/vk_core.cpp index 8f1420440..7432866aa 100644 --- a/renderdoc/driver/vulkan/vk_core.cpp +++ b/renderdoc/driver/vulkan/vk_core.cpp @@ -91,7 +91,8 @@ WrappedVulkan::WrappedVulkan() : m_RenderState(this, &m_CreationInfo) { if(RenderDoc::Inst().IsReplayApp()) { - VkMarkerRegion::vk = this; + if(VkMarkerRegion::vk == NULL) + VkMarkerRegion::vk = this; m_State = CaptureState::LoadingReplaying; } @@ -170,6 +171,9 @@ WrappedVulkan::~WrappedVulkan() m_FrameCaptureRecord = NULL; } + if(VkMarkerRegion::vk == this) + VkMarkerRegion::vk = NULL; + // in case the application leaked some objects, avoid crashing trying // to release them ourselves by clearing the resource manager. // In a well-behaved application, this should be a no-op.