From d3d85fff1f03db3981d666a824ea00adbf3c3a94 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 14 May 2019 15:28:50 +0100 Subject: [PATCH] glUniformBlockBinding should be serialised mid-frame only, not in init * glUniformBlockBinding can be changed at runtime and previously pushing all instances of it into the resource record means it would be overwritten by any bindings retrieved by the initial contents. That's fine (if redundant) if they aren't changed afterwards, but if they are changed then this will be wrong. --- .../driver/gl/wrappers/gl_shader_funcs.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp index 1a58e25e3..b7bc6391f 100644 --- a/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_shader_funcs.cpp @@ -955,19 +955,15 @@ void WrappedOpenGL::glUniformBlockBinding(GLuint program, GLuint uniformBlockInd { SERIALISE_TIME_CALL(GL.glUniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding)); - if(IsCaptureMode(m_State)) + // we should only capture this while active, since the initial states will grab everything at the + // start of the frame and we only want to pick up dynamic changes after that. + if(IsActiveCapturing(m_State)) { - GLResourceRecord *record = GetResourceManager()->GetResourceRecord(ProgramRes(GetCtx(), program)); - RDCASSERTMSG("Couldn't identify object passed to function. Mismatched or bad GLuint?", record, - program); - if(record) - { - USE_SCRATCH_SERIALISER(); - SCOPED_SERIALISE_CHUNK(gl_CurChunk); - Serialise_glUniformBlockBinding(ser, program, uniformBlockIndex, uniformBlockBinding); + USE_SCRATCH_SERIALISER(); + SCOPED_SERIALISE_CHUNK(gl_CurChunk); + Serialise_glUniformBlockBinding(ser, program, uniformBlockIndex, uniformBlockBinding); - record->AddChunk(scope.Get()); - } + GetContextRecord()->AddChunk(scope.Get()); } }