From af14d2f0ce66190b9f8f6375a4ef8b7ec50ed846 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 14 May 2019 15:30:08 +0100 Subject: [PATCH] If a program is linked mid-capture, inject new initial contents chunk * This is only intended to handle the case where a new program is created mid frame and linked for the first time, and we need the initial contents chunk to get location translation among other things. We don't yet handle programs being re-linked multiple times mid-frame. --- renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp index b7bc6391f..7045fc93c 100644 --- a/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp @@ -887,6 +887,15 @@ void WrappedOpenGL::glLinkProgram(GLuint program) record->AddChunk(scope.Get()); } + + // we need initial contents for programs to know any initial bindings potentially if they change + // over the frame, and for uniform location remapping. + // We just inject a call to prepare the initial contents now, any other post-link data setting + // will be replayed as expected. + if(IsActiveCapturing(m_State)) + { + GetResourceManager()->ContextPrepare_InitialState(ProgramRes(GetCtx(), program)); + } } {