From b42931e2385af219bca3a5903fe3dd4c0636d9cf Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 24 Oct 2018 15:40:41 +0100 Subject: [PATCH] If no ARRAY_BUFFER is bound in glVertexAttrib*Pointer, sanitise pointer * This ensures we don't serialise a pointer to client memory which is non- deterministic. The value isn't used, we will readback the actual data at draw time and replace with client-memory buffer updates. --- renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp b/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp index 57e179538..de9669ea9 100644 --- a/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp +++ b/renderdoc/driver/gl/wrappers/gl_buffer_funcs.cpp @@ -3154,7 +3154,8 @@ void WrappedOpenGL::glVertexAttribPointer(GLuint index, GLint size, GLenum type, SCOPED_SERIALISE_CHUNK(gl_CurChunk); Serialise_glVertexArrayVertexAttribOffsetEXT( ser, varecord ? varecord->Resource.name : 0, bufrecord ? bufrecord->Resource.name : 0, - index, size, type, normalized, stride, (GLintptr)pointer); + index, size, type, normalized, stride, + bufrecord ? (GLintptr)pointer : GLintptr(0xDEADBEEF)); r->AddChunk(scope.Get()); } @@ -3280,9 +3281,9 @@ void WrappedOpenGL::glVertexAttribIPointer(GLuint index, GLint size, GLenum type { USE_SCRATCH_SERIALISER(); SCOPED_SERIALISE_CHUNK(gl_CurChunk); - Serialise_glVertexArrayVertexAttribIOffsetEXT(ser, varecord ? varecord->Resource.name : 0, - bufrecord ? bufrecord->Resource.name : 0, - index, size, type, stride, (GLintptr)pointer); + Serialise_glVertexArrayVertexAttribIOffsetEXT( + ser, varecord ? varecord->Resource.name : 0, bufrecord ? bufrecord->Resource.name : 0, + index, size, type, stride, bufrecord ? (GLintptr)pointer : GLintptr(0xDEADBEEF)); r->AddChunk(scope.Get()); } @@ -3408,9 +3409,9 @@ void WrappedOpenGL::glVertexAttribLPointer(GLuint index, GLint size, GLenum type { USE_SCRATCH_SERIALISER(); SCOPED_SERIALISE_CHUNK(gl_CurChunk); - Serialise_glVertexArrayVertexAttribLOffsetEXT(ser, varecord ? varecord->Resource.name : 0, - bufrecord ? bufrecord->Resource.name : 0, - index, size, type, stride, (GLintptr)pointer); + Serialise_glVertexArrayVertexAttribLOffsetEXT( + ser, varecord ? varecord->Resource.name : 0, bufrecord ? bufrecord->Resource.name : 0, + index, size, type, stride, bufrecord ? (GLintptr)pointer : GLintptr(0xDEADBEEF)); r->AddChunk(scope.Get()); }