From e6b7b67933bcd7090cbfd25a81bdaa3c9982e8ae Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 13 Jun 2017 17:49:38 +0100 Subject: [PATCH] Don't trample over captures if there are multiple in a frame. Refs #645 --- renderdoc/core/core.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/renderdoc/core/core.cpp b/renderdoc/core/core.cpp index da9dda75e..ae9fc7820 100644 --- a/renderdoc/core/core.cpp +++ b/renderdoc/core/core.cpp @@ -726,6 +726,18 @@ Serialiser *RenderDoc::OpenWriteSerialiser(uint32_t frameNum, RDCInitParams *par m_CurrentLogFile = StringFormat::Fmt("%s_frame%u.rdc", m_LogFile.c_str(), frameNum); + // make sure we don't stomp another capture if we make multiple captures in the same frame. + { + SCOPED_LOCK(m_CaptureLock); + int altnum = 2; + while(std::find_if(m_Captures.begin(), m_Captures.end(), [this](const CaptureData &o) { + return o.path == m_CurrentLogFile; + }) != m_Captures.end()) + { + m_CurrentLogFile = StringFormat::Fmt("%s_frame%u_%d.rdc", m_LogFile.c_str(), frameNum, altnum); + } + } + Serialiser *fileSerialiser = new Serialiser(m_CurrentLogFile.c_str(), Serialiser::WRITING, debugSerialiser);