diff --git a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/DrawManager.java b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/DrawManager.java index 10562ee7f..9f5c4e2ed 100644 --- a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/DrawManager.java +++ b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/DrawManager.java @@ -28,6 +28,8 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.client.resources.model.ModelBakery; public abstract class DrawManager> { + private static final boolean WARN_EMPTY_MODELS = Boolean.getBoolean("flywheel.warnEmptyModels"); + /** * A map of instancer keys to instancers. *
@@ -100,15 +102,16 @@ public abstract class DrawManager> { return true; } - StringBuilder builder = new StringBuilder(); - builder.append("Creating an instancer for a model with no meshes! Stack trace:"); + if (WARN_EMPTY_MODELS) { + StringBuilder builder = new StringBuilder(); + builder.append("Creating an instancer for a model with no meshes! Stack trace:"); - StackWalker.getInstance() - // .walk(s -> s.skip(3)) // this causes forEach to crash for some reason - .forEach(f -> builder.append("\n\t") - .append(f.toString())); + StackWalker.getInstance() + .forEach(f -> builder.append("\n\t") + .append(f.toString())); - FlwBackend.LOGGER.warn(builder.toString()); + FlwBackend.LOGGER.warn(builder.toString()); + } return false; } diff --git a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectDrawManager.java b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectDrawManager.java index 8a6dd5e4b..65c0d4aba 100644 --- a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectDrawManager.java +++ b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/IndirectDrawManager.java @@ -186,6 +186,10 @@ public class IndirectDrawManager extends DrawManager> { programs.release(); depthPyramid.delete(); + + lightBuffers.delete(); + + matrixBuffer.delete(); } public void renderCrumbling(List crumblingBlocks) { diff --git a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/LightBuffers.java b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/LightBuffers.java index 9db63afb0..7f78c1e46 100644 --- a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/LightBuffers.java +++ b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/LightBuffers.java @@ -40,4 +40,9 @@ public class LightBuffers { GL46.glBindBufferRange(GL46.GL_SHADER_STORAGE_BUFFER, BufferBindings.LIGHT_LUT, lut.handle(), 0, lut.byteCapacity()); GL46.glBindBufferRange(GL46.GL_SHADER_STORAGE_BUFFER, BufferBindings.LIGHT_SECTION, sections.handle(), 0, sections.byteCapacity()); } + + public void delete() { + lut.delete(); + sections.delete(); + } } diff --git a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/MatrixBuffer.java b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/MatrixBuffer.java index ce579c465..7328bcb3b 100644 --- a/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/MatrixBuffer.java +++ b/common/src/backend/java/dev/engine_room/flywheel/backend/engine/indirect/MatrixBuffer.java @@ -30,4 +30,8 @@ public class MatrixBuffer { GL46.glBindBufferRange(GL46.GL_SHADER_STORAGE_BUFFER, BufferBindings.MATRICES, matrices.handle(), 0, matrices.byteCapacity()); } + + public void delete() { + matrices.delete(); + } }