Cleanup: avoid applying offset to null pointer

Based on D9069 by @ankitm.
This commit is contained in:
Campbell Barton 2020-10-01 15:00:30 +10:00
parent 99fb853734
commit a4e14c3bfd
1 changed files with 3 additions and 2 deletions

View File

@ -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
} // namespace blender::gpu