From 233808b8f06528ac7244f11a58fae7eac345e9ca Mon Sep 17 00:00:00 2001 From: baldurk Date: Sat, 6 Dec 2014 19:02:30 +0000 Subject: [PATCH] glVertexAttrib*Pointer and glBindVertexBuffer add parent dependency --- .../driver/gl/wrappers/gl_buffer_funcs.cpp | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp index dae83f370..bd40f404b 100644 --- a/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp @@ -1909,7 +1909,9 @@ void WrappedOpenGL::glVertexAttribPointer(GLuint index, GLint size, GLenum type, if(m_State >= WRITING) { - GLResourceRecord *varecord = GetCtxData().m_VertexArrayRecord; + ContextData &cd = GetCtxData(); + GLResourceRecord *bufrecord = cd.m_BufferRecord[BufferIdx(eGL_ARRAY_BUFFER)]; + GLResourceRecord *varecord = cd.m_VertexArrayRecord; GLResourceRecord *r = m_State == WRITING_CAPFRAME ? m_ContextRecord : varecord; if(r) @@ -1925,6 +1927,8 @@ void WrappedOpenGL::glVertexAttribPointer(GLuint index, GLint size, GLenum type, r->AddChunk(scope.Get()); } + + if(bufrecord) r->AddParent(bufrecord); } } } @@ -1983,8 +1987,9 @@ void WrappedOpenGL::glVertexAttribIPointer(GLuint index, GLint size, GLenum type if(m_State >= WRITING) { - GLResourceRecord *varecord = GetCtxData().m_VertexArrayRecord; - + ContextData &cd = GetCtxData(); + GLResourceRecord *bufrecord = cd.m_BufferRecord[BufferIdx(eGL_ARRAY_BUFFER)]; + GLResourceRecord *varecord = cd.m_VertexArrayRecord; GLResourceRecord *r = m_State == WRITING_CAPFRAME ? m_ContextRecord : varecord; if(r) @@ -2000,6 +2005,8 @@ void WrappedOpenGL::glVertexAttribIPointer(GLuint index, GLint size, GLenum type r->AddChunk(scope.Get()); } + + if(bufrecord) r->AddParent(bufrecord); } } } @@ -2058,8 +2065,9 @@ void WrappedOpenGL::glVertexAttribLPointer(GLuint index, GLint size, GLenum type if(m_State >= WRITING) { - GLResourceRecord *varecord = GetCtxData().m_VertexArrayRecord; - + ContextData &cd = GetCtxData(); + GLResourceRecord *bufrecord = cd.m_BufferRecord[BufferIdx(eGL_ARRAY_BUFFER)]; + GLResourceRecord *varecord = cd.m_VertexArrayRecord; GLResourceRecord *r = m_State == WRITING_CAPFRAME ? m_ContextRecord : varecord; if(r) @@ -2075,6 +2083,8 @@ void WrappedOpenGL::glVertexAttribLPointer(GLuint index, GLint size, GLenum type r->AddChunk(scope.Get()); } + + if(bufrecord) r->AddParent(bufrecord); } } } @@ -2632,6 +2642,9 @@ void WrappedOpenGL::glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLint r->AddChunk(scope.Get()); } + + if(buffer != 0) + r->AddParent(GetResourceManager()->GetResourceRecord(BufferRes(GetCtx(), buffer))); } } } @@ -2718,6 +2731,12 @@ void WrappedOpenGL::glBindVertexBuffers(GLuint first, GLsizei count, const GLuin r->AddChunk(scope.Get()); } + + for(GLsizei i=0; i < count; i++) + { + if(buffers[i] != 0) + r->AddParent(GetResourceManager()->GetResourceRecord(BufferRes(GetCtx(), buffers[i]))); + } } } }