From d5b3337522e670549a38abef66cd3a9d7527982a Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 25 Feb 2015 22:57:46 +0000 Subject: [PATCH] forcing all glBufferData calls into resource record isn't right * glBufferData isn't only used for creation, it is often used to upload new data to a buffer, which means that during the captured frame any 're-create' type calls should go into the context record. --- .../driver/gl/wrappers/gl_buffer_funcs.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp index 96b6067cd..0c455b0c1 100644 --- a/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp @@ -529,6 +529,16 @@ void WrappedOpenGL::glNamedBufferDataEXT(GLuint buffer, GLsizeiptr size, const v Chunk *chunk = scope.Get(); + // if we've already created this is a renaming/data updating call. It should go in + // the frame record so we can 'update' the buffer as it goes in the frame. + // if we haven't created the buffer at all, it could be a mid-frame create and we + // should place it in the resource record, to happen before the frame. + if(m_State == WRITING_CAPFRAME && record->GetDataPtr()) + { + // we could perhaps substitute this for a 'fake' glBufferSubData chunk? + m_ContextRecord->AddChunk(chunk); + } + else { record->AddChunk(chunk); record->SetDataPtr(chunk->GetData()); @@ -634,6 +644,16 @@ void WrappedOpenGL::glBufferData(GLenum target, GLsizeiptr size, const void *dat Chunk *chunk = scope.Get(); + // if we've already created this is a renaming/data updating call. It should go in + // the frame record so we can 'update' the buffer as it goes in the frame. + // if we haven't created the buffer at all, it could be a mid-frame create and we + // should place it in the resource record, to happen before the frame. + if(m_State == WRITING_CAPFRAME && record->GetDataPtr()) + { + // we could perhaps substitute this for a 'fake' glBufferSubData chunk? + m_ContextRecord->AddChunk(chunk); + } + else { record->AddChunk(chunk); record->SetDataPtr(chunk->GetData());