[Bf-blender-cvs] [a4e14c3bfdb] master: Cleanup: avoid applying offset to null pointer
Campbell Barton
noreply at git.blender.org
Thu Oct 1 07:03:39 CEST 2020
Commit: a4e14c3bfdb7dca037ae17bbd3897ef5d8a409b9
Author: Campbell Barton
Date: Thu Oct 1 15:00:30 2020 +1000
Branches: master
https://developer.blender.org/rBa4e14c3bfdb7dca037ae17bbd3897ef5d8a409b9
Cleanup: avoid applying offset to null pointer
Based on D9069 by @ankitm.
===================================================================
M source/blender/gpu/opengl/gl_vertex_array.cc
===================================================================
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<GPUVertCompType>(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
More information about the Bf-blender-cvs
mailing list