Fix #132211: Overlay-Next: Drag&Drop material assets doesn't work

`GLIndexBuf::bind_as_ssbo` didn't bind subrange index buffers.

Pull Request: https://projects.blender.org/blender/blender/pulls/132712
This commit is contained in:
Miguel Pozo
2025-01-07 13:19:03 +01:00
parent 5d8ba173c4
commit 3f5fa8b65e

View File

@@ -59,8 +59,27 @@ void GLIndexBuf::bind_as_ssbo(uint binding)
glBindVertexArray(0);
bind();
}
BLI_assert(ibo_id_ != 0);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, binding, ibo_id_);
if (!is_subrange_) {
BLI_assert(ibo_id_ != 0);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, binding, ibo_id_);
}
else {
GLuint src_ibo_id = static_cast<GLIndexBuf *>(src_)->ibo_id_;
BLI_assert(src_ibo_id != 0);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, binding, src_ibo_id);
#if 0
/* TODO(pragma37): Check with @fclem.
* I think this would be the correct behavior, but
* overlay::Prepass::use_material_slot_selection_ seems to rely on binding the full index
* buffer? */
glBindBufferRange(GL_SHADER_STORAGE_BUFFER,
binding,
src_ibo_id,
index_start_,
index_len_ * to_bytesize(index_type_));
#endif
}
#ifndef NDEBUG
BLI_assert(binding < 16);