diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-09-01 03:41:29 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-09-01 13:03:52 +0300 |
commit | 53a806f6dffb2a778e383a82c3d0cdb6e9d9d552 (patch) | |
tree | 3bfc9bb0d705a1c198c19b62fe134bda525e51ad /source/blender/gpu/opengl/gl_uniform_buffer.cc | |
parent | 5ec0250df9d8cf44d099e5b6fffca99bf9cf0c46 (diff) |
GPU: Move UBO binding validation to GL backend
This also make the validation quicker by tracking the currently
bound slots.
Diffstat (limited to 'source/blender/gpu/opengl/gl_uniform_buffer.cc')
-rw-r--r-- | source/blender/gpu/opengl/gl_uniform_buffer.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/gpu/opengl/gl_uniform_buffer.cc b/source/blender/gpu/opengl/gl_uniform_buffer.cc index 5115034639c..0e0c64e5c60 100644 --- a/source/blender/gpu/opengl/gl_uniform_buffer.cc +++ b/source/blender/gpu/opengl/gl_uniform_buffer.cc @@ -110,6 +110,11 @@ void GLUniformBuf::bind(int slot) slot_ = slot; glBindBufferBase(GL_UNIFORM_BUFFER, slot_, ubo_id_); + +#ifdef DEBUG + BLI_assert(slot < 16); + static_cast<GLContext *>(GPU_context_active_get())->bound_ubo_slots |= 1 << slot; +#endif } void GLUniformBuf::unbind(void) @@ -117,6 +122,8 @@ void GLUniformBuf::unbind(void) #ifdef DEBUG /* NOTE: This only unbinds the last bound slot. */ glBindBufferBase(GL_UNIFORM_BUFFER, slot_, 0); + /* Hope that the context did not change. */ + static_cast<GLContext *>(GPU_context_active_get())->bound_ubo_slots &= ~(1 << slot_); #endif slot_ = 0; } |