aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2022-06-08 13:12:38 +0200
committermakamys <makamys@outlook.com>2022-06-08 13:12:38 +0200
commit1dfdcae404d93f929b0ac602993fbef1402dfb2f (patch)
tree02f51aa31400d923e3068b4ce1bac0fb1505e7f2 /src/main/java
parent9e65d30314391bb175afe03ccef008012e05e746 (diff)
downloadNeodymium-1dfdcae404d93f929b0ac602993fbef1402dfb2f.tar.gz
Neodymium-1dfdcae404d93f929b0ac602993fbef1402dfb2f.tar.bz2
Neodymium-1dfdcae404d93f929b0ac602993fbef1402dfb2f.zip
Fix NPE when moving forward and GC runs
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/makamys/lodmod/renderer/ChunkMesh.java4
-rw-r--r--src/main/java/makamys/lodmod/renderer/Mesh.java1
2 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/makamys/lodmod/renderer/ChunkMesh.java b/src/main/java/makamys/lodmod/renderer/ChunkMesh.java
index 0bf4b60..f07a908 100644
--- a/src/main/java/makamys/lodmod/renderer/ChunkMesh.java
+++ b/src/main/java/makamys/lodmod/renderer/ChunkMesh.java
@@ -250,6 +250,10 @@ public class ChunkMesh extends Mesh {
usedRAM -= buffer.limit();
instances--;
buffer = null;
+
+ if(gpuStatus == Mesh.GPUStatus.SENT) {
+ gpuStatus = Mesh.GPUStatus.PENDING_DELETE;
+ }
}
}
diff --git a/src/main/java/makamys/lodmod/renderer/Mesh.java b/src/main/java/makamys/lodmod/renderer/Mesh.java
index 9d41960..fb1b8f1 100644
--- a/src/main/java/makamys/lodmod/renderer/Mesh.java
+++ b/src/main/java/makamys/lodmod/renderer/Mesh.java
@@ -9,6 +9,7 @@ import net.minecraft.nbt.NBTBase;
public abstract class Mesh {
+ /** Can be null, unless gpuStatus is SENT */
public ByteBuffer buffer;
public int quadCount;
public boolean visible;