aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/makamys/neodymium/renderer/GPUMemoryManager.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/makamys/neodymium/renderer/GPUMemoryManager.java b/src/main/java/makamys/neodymium/renderer/GPUMemoryManager.java
index 9dd9b04..156f5ce 100644
--- a/src/main/java/makamys/neodymium/renderer/GPUMemoryManager.java
+++ b/src/main/java/makamys/neodymium/renderer/GPUMemoryManager.java
@@ -24,6 +24,8 @@ public class GPUMemoryManager {
private List<Mesh> sentMeshes = new ArrayList<>();
+ private int usedRAM;
+
public GPUMemoryManager() {
VBO = glGenBuffers();
@@ -65,6 +67,7 @@ public class GPUMemoryManager {
mesh.gpuStatus = GPUStatus.UNSENT;
sentMeshes.remove(nextMesh);
+ usedRAM -= mesh.bufferSize();
mesh.destroyBuffer();
@@ -162,6 +165,7 @@ public class GPUMemoryManager {
sentMeshes.add(insertIndex, mesh);
nextMesh = insertIndex;
}
+ usedRAM += mesh.bufferSize();
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
@@ -181,7 +185,7 @@ public class GPUMemoryManager {
}
public List<String> getDebugText() {
- return Arrays.asList("VRAM: " + (end() / 1024 / 1024) + "MB / " + (bufferSize / 1024 / 1024) + "MB");
+ return Arrays.asList("VRAM: " + (usedRAM / 1024 / 1024) + "MB / " + (bufferSize / 1024 / 1024) + "MB");
}
public void drawInfo() {