Fix #104347: Loop Cut Tool becomes impressive with GPU Subdivision #104873

Merged
Germano Cavalcante merged 1 commits from mano-wii/blender:VAO_state_safe into main 2023-02-17 14:30:40 +01:00

View File

@ -41,7 +41,18 @@ void GLIndexBuf::bind()
void GLIndexBuf::bind_as_ssbo(uint binding)
{
bind();
if (ibo_id_ == 0 || data_ != nullptr) {
/* Calling `glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo_id_)` changes the index buffer
* of the currently bound VAO.
*
* In the OpenGL backend, the VAO state persists even after `GLVertArray::update_bindings`
* is called.
*
* NOTE: For safety, we could call `glBindVertexArray(0)` right after drawing a `GPUBatch`.
* However, for performance reasons, we have chosen not to do so. */
glBindVertexArray(0);
bind();
}
BLI_assert(ibo_id_ != 0);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, binding, ibo_id_);
}