GPU: add assert for immBegin buffer size & context

This commit is contained in:
Christian Rauch 2020-04-27 15:27:53 +10:00 committed by Campbell Barton
parent 54eb701978
commit 0da05720de
2 changed files with 12 additions and 0 deletions

View File

@ -99,6 +99,10 @@ static void drw_deferred_shader_compilation_exec(void *custom_data,
DRWShaderCompiler *comp = (DRWShaderCompiler *)custom_data;
void *gl_context = comp->gl_context;
#if TRUST_NO_ONE
BLI_assert(gl_context != NULL);
#endif
WM_opengl_context_activate(gl_context);
while (true) {

View File

@ -275,6 +275,14 @@ void immBegin(GPUPrimType prim_type, uint vertex_len)
/* printf("mapping %u to %u\n", imm.buffer_offset, imm.buffer_offset + bytes_needed - 1); */
#if TRUST_NO_ONE
{
GLint bufsize;
glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &bufsize);
assert(active_buffer->buffer_offset + bytes_needed <= bufsize);
}
#endif
active_buffer->buffer_data = glMapBufferRange(
GL_ARRAY_BUFFER,
active_buffer->buffer_offset,