diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-01 08:00:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-01 08:03:14 +0300 |
commit | a4e14c3bfdb7dca037ae17bbd3897ef5d8a409b9 (patch) | |
tree | 026e987838bd7c30b5fc51f18b862eddf21473bc /source/blender/gpu | |
parent | 99fb853734cba8b778f9e60789ef51bd638d35da (diff) |
Cleanup: avoid applying offset to null pointer
Based on D9069 by @ankitm.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/opengl/gl_vertex_array.cc | 5 |
1 files 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<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 |