Share bucket indices (#1358)

Co-authored-by: Stefan Karschti <stefan.karschti@gmail.com>
This commit is contained in:
Tim Sylvester
2023-07-13 12:45:54 -07:00
committed by Bart Louwers
parent 996b388601
commit 7f862cd8ff
26 changed files with 159 additions and 94 deletions

View File

@@ -35,9 +35,12 @@ void DrawableGLBuilder::init() {
drawableGL.setVertices(std::move(raw), verts.size(), gfx::AttributeDataType::Short2);
}
drawableGL.setIndexData(std::move(impl->indexes), std::move(impl->segments));
if (!impl->sharedIndexes && !impl->buildIndexes.empty()) {
impl->sharedIndexes = std::make_shared<gfx::IndexVectorBase>(std::move(impl->buildIndexes));
}
drawableGL.setIndexData(std::move(impl->sharedIndexes), std::move(impl->segments));
impl->indexes.clear();
impl->buildIndexes.clear();
impl->segments.clear();
impl->vertices.clear();
}