GLImmediate: Use CL_CHECK_ERROR

This provides a bit more debugging info on MacOS.
This commit is contained in:
Clément Foucault 2020-08-31 23:14:42 +02:00
parent 9d932b426f
commit 7f95d780e8
1 changed files with 8 additions and 0 deletions

View File

@ -30,6 +30,7 @@
#include "gpu_vertex_format_private.h"
#include "gl_context.hh"
#include "gl_debug.hh"
#include "gl_primitive.hh"
#include "gl_vertex_array.hh"
@ -87,6 +88,8 @@ uchar *GLImmediate::begin()
/* Does the current buffer have enough room? */
const size_t available_bytes = buffer_size() - buffer_offset();
GL_CHECK_ERROR("Immediate Pre-Begin");
glBindBuffer(GL_ARRAY_BUFFER, vbo_id());
bool recreate_buffer = false;
@ -129,6 +132,7 @@ uchar *GLImmediate::begin()
}
void *data = glMapBufferRange(GL_ARRAY_BUFFER, buffer_offset(), bytes_needed, access);
BLI_assert(data != NULL);
GL_CHECK_ERROR("Immediate Post-Begin");
bytes_mapped_ = bytes_needed;
return (uchar *)data;
@ -150,6 +154,8 @@ void GLImmediate::end(void)
}
glUnmapBuffer(GL_ARRAY_BUFFER);
GL_CHECK_ERROR("Immediate Post-Unmap");
if (vertex_len > 0) {
GPU_context_active_get()->state_manager->apply_state();
@ -173,6 +179,8 @@ void GLImmediate::end(void)
* They are not required so just comment them. (T55722) */
// glBindBuffer(GL_ARRAY_BUFFER, 0);
// glBindVertexArray(0);
GL_CHECK_ERROR("Immediate Post-drawing");
}
buffer_offset() += buffer_bytes_used;