From a4e14c3bfdb7dca037ae17bbd3897ef5d8a409b9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 1 Oct 2020 15:00:30 +1000 Subject: Cleanup: avoid applying offset to null pointer Based on D9069 by @ankitm. --- source/blender/gpu/opengl/gl_vertex_array.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/gpu/opengl/gl_vertex_array.cc b/source/blender/gpu/opengl/gl_vertex_array.cc index 14a7b4deb7d..ed6699e51f3 100644 --- a/source/blender/gpu/opengl/gl_vertex_array.cc +++ b/source/blender/gpu/opengl/gl_vertex_array.cc @@ -62,7 +62,8 @@ static uint16_t vbo_bind(const ShaderInterface *interface, offset = a->offset; } - const GLvoid *pointer = (const GLubyte *)0 + offset + v_first * stride; + /* This is in fact an offset in memory. */ + const GLvoid *pointer = (const GLubyte *)(intptr_t)(offset + v_first * stride); const GLenum type = to_gl(static_cast(a->comp_type)); for (uint n_idx = 0; n_idx < a->name_len; n_idx++) { @@ -168,4 +169,4 @@ void GLVertArray::update_bindings(const GLuint vao, /** \} */ -} // namespace blender::gpu \ No newline at end of file +} // namespace blender::gpu -- cgit v1.2.3