From e9bd9ef4979f10c954d83d8feeabcc1303a4ad39 Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 6 Dec 2014 18:41:52 +0000 Subject: [PATCH] Serialise out calls to MakeCurrent mid-frame-capture. * We need to serialise out the new state vector that's applied when we change context. * Note we still have very hacky incomplete support of contexts, and no support of true threading. We currently assume all contexts share with all others, and if any actual parallel rendering happened it would break. --- renderdoc/driver/gl/gl_driver.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/renderdoc/driver/gl/gl_driver.cpp b/renderdoc/driver/gl/gl_driver.cpp index b5cbc21c8..4cfc890ed 100644 --- a/renderdoc/driver/gl/gl_driver.cpp +++ b/renderdoc/driver/gl/gl_driver.cpp @@ -678,6 +678,14 @@ void WrappedOpenGL::ActivateContext(void *windowHandle, void *contextHandle) if(contextHandle) { + // if we're capturing, we need to serialise out the changed state vector + if(m_State == WRITING_CAPFRAME) + { + SCOPED_SERIALISE_CONTEXT(CONTEXT_CAPTURE_HEADER); + Serialise_BeginCaptureFrame(false); + m_ContextRecord->AddChunk(scope.Get()); + } + ContextData &font = m_ContextData[contextHandle]; if(!font.built) @@ -2408,6 +2416,12 @@ void WrappedOpenGL::ProcessChunk(uint64_t offset, GLChunkType context) case CAPTURE_SCOPE: Serialise_CaptureScope(offset); break; + case CONTEXT_CAPTURE_HEADER: + // normally this would be handled as a special case when we start processing the frame, + // but it can be emitted mid-frame if MakeCurrent is called on a different context. + // when processed here, we always want to apply the contents + Serialise_BeginCaptureFrame(true); + break; case CONTEXT_CAPTURE_FOOTER: { bool HasCallstack = false;