mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-11-14 14:33:57 +01:00
No one can hear you free
- Silence empty model warning behind a system property - Fix gpu memory leak from light/matrix buffers on indirect
This commit is contained in:
parent
6709682785
commit
868a263c28
@ -28,6 +28,8 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import net.minecraft.client.resources.model.ModelBakery;
|
||||
|
||||
public abstract class DrawManager<N extends AbstractInstancer<?>> {
|
||||
private static final boolean WARN_EMPTY_MODELS = Boolean.getBoolean("flywheel.warnEmptyModels");
|
||||
|
||||
/**
|
||||
* A map of instancer keys to instancers.
|
||||
* <br>
|
||||
@ -100,15 +102,16 @@ public abstract class DrawManager<N extends AbstractInstancer<?>> {
|
||||
return true;
|
||||
}
|
||||
|
||||
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()));
|
||||
|
||||
FlwBackend.LOGGER.warn(builder.toString());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -186,6 +186,10 @@ public class IndirectDrawManager extends DrawManager<IndirectInstancer<?>> {
|
||||
programs.release();
|
||||
|
||||
depthPyramid.delete();
|
||||
|
||||
lightBuffers.delete();
|
||||
|
||||
matrixBuffer.delete();
|
||||
}
|
||||
|
||||
public void renderCrumbling(List<Engine.CrumblingBlock> crumblingBlocks) {
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user