diff --git a/radiantcore/rendersystem/backend/GeometryRenderer.h b/radiantcore/rendersystem/backend/GeometryRenderer.h index 608fcae557..44e4e7ddee 100644 --- a/radiantcore/rendersystem/backend/GeometryRenderer.h +++ b/radiantcore/rendersystem/backend/GeometryRenderer.h @@ -180,11 +180,16 @@ class GeometryRenderer : bucket.removeSurface(slotInfo.firstVertex, slotInfo.numVertices, slotInfo.firstIndex, slotInfo.numIndices); - // Adjust all offsets in other slots + // Adjust all offsets in other slots pointing to the same bucket for (auto& slot : _slots) { - if (slot.firstVertex > slotInfo.firstVertex) + if (slot.bucketIndex == slotInfo.bucketIndex && + slot.firstVertex > slotInfo.firstVertex && + slot.firstVertex != InvalidVertexIndex) { + assert(slot.firstVertex >= slotInfo.numVertices); + assert(slot.firstIndex >= slotInfo.numIndices); + slot.firstVertex -= slotInfo.numVertices; slot.firstIndex -= slotInfo.numIndices; }