From c4f1062cdddf85348c3b24f35fc59853f9bfbd3d Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 16 Jan 2019 12:02:30 +0000 Subject: [PATCH] Don't trash state of uniform buffer offset & size in GLPushPopState --- renderdoc/driver/gl/gl_common.cpp | 15 +++++++++------ renderdoc/driver/gl/gl_common.h | 7 ++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/renderdoc/driver/gl/gl_common.cpp b/renderdoc/driver/gl/gl_common.cpp index 5743ef7b0..d86f104d2 100644 --- a/renderdoc/driver/gl/gl_common.cpp +++ b/renderdoc/driver/gl/gl_common.cpp @@ -944,9 +944,12 @@ void GLPushPopState::Push(bool modern) // the non-indexed bind is separate from the indexed binds GL.glGetIntegerv(eGL_UNIFORM_BUFFER_BINDING, (GLint *)&ubo); - GL.glGetIntegeri_v(eGL_UNIFORM_BUFFER_BINDING, 0, (GLint *)&idxubo[0]); - GL.glGetIntegeri_v(eGL_UNIFORM_BUFFER_BINDING, 1, (GLint *)&idxubo[1]); - GL.glGetIntegeri_v(eGL_UNIFORM_BUFFER_BINDING, 2, (GLint *)&idxubo[2]); + for(size_t i = 0; i < ARRAY_COUNT(idxubo); i++) + { + GL.glGetIntegeri_v(eGL_UNIFORM_BUFFER_BINDING, (GLuint)i, (GLint *)&idxubo[i].buf); + GL.glGetInteger64i_v(eGL_UNIFORM_BUFFER_START, (GLuint)i, (GLint64 *)&idxubo[i].offs); + GL.glGetInteger64i_v(eGL_UNIFORM_BUFFER_SIZE, (GLuint)i, (GLint64 *)&idxubo[i].size); + } GL.glGetIntegerv(eGL_VERTEX_ARRAY_BINDING, (GLint *)&VAO); } @@ -1083,9 +1086,9 @@ void GLPushPopState::Pop(bool modern) if(modern) { - GL.glBindBufferBase(eGL_UNIFORM_BUFFER, 0, idxubo[0]); - GL.glBindBufferBase(eGL_UNIFORM_BUFFER, 1, idxubo[1]); - GL.glBindBufferBase(eGL_UNIFORM_BUFFER, 2, idxubo[2]); + for(size_t i = 0; i < ARRAY_COUNT(idxubo); i++) + GL.glBindBufferRange(eGL_UNIFORM_BUFFER, (GLuint)i, idxubo[i].buf, (GLintptr)idxubo[i].offs, + (GLsizeiptr)idxubo[i].size); GL.glBindBuffer(eGL_UNIFORM_BUFFER, ubo); diff --git a/renderdoc/driver/gl/gl_common.h b/renderdoc/driver/gl/gl_common.h index e8138cfc6..6df5c0a85 100644 --- a/renderdoc/driver/gl/gl_common.h +++ b/renderdoc/driver/gl/gl_common.h @@ -432,7 +432,12 @@ struct GLPushPopState GLenum ActiveTexture; GLuint tex0; GLuint arraybuf; - GLuint idxubo[3]; + struct IndexedBuffer + { + GLuint buf; + GLuint64 offs; + GLuint64 size; + } idxubo[3]; GLuint ubo; GLuint prog; GLuint pipe;