Fix occasional crash when flywheel objects are loaded in

This commit is contained in:
Jozufozu 2022-02-14 20:36:35 -08:00
parent c07c6363f9
commit 20a75321e2
2 changed files with 2 additions and 4 deletions

View file

@ -44,7 +44,7 @@ public class InstancedMaterialGroup<P extends WorldProgram> implements MaterialG
.onAMDWindows()) {
this.allocator = FallbackAllocator.INSTANCE;
} else {
this.allocator = new ModelPool(Formats.POS_TEX_NORMAL, 2048);
this.allocator = new ModelPool(Formats.POS_TEX_NORMAL);
}
}

View file

@ -35,16 +35,14 @@ public class ModelPool implements ModelAllocator {
* Create a new model pool.
*
* @param vertexType The vertex type of the models that will be stored in the pool.
* @param initialSize The initial size of the pool, in vertices.
*/
public ModelPool(VertexType vertexType, int initialSize) {
public ModelPool(VertexType vertexType) {
this.vertexType = vertexType;
int stride = vertexType.getStride();
vbo = new MappedGlBuffer(GlBufferType.ARRAY_BUFFER);
vbo.bind();
vbo.ensureCapacity((long) stride * initialSize);
vbo.setGrowthMargin(stride * 64);
}