Fix occasional crash when flywheel objects are loaded in

This commit is contained in:
Jozufozu 2022-02-14 20:36:35 -08:00
parent a4d3f17fb3
commit f7b8aedb95
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);
}