From 9af39b831004051e7c20c56e63b2d95bffc34cfe Mon Sep 17 00:00:00 2001 From: makamys Date: Tue, 21 Jun 2022 06:49:55 +0200 Subject: Only count actually used VRAM --- src/main/java/makamys/neodymium/renderer/GPUMemoryManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main/java/makamys') 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 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 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() { -- cgit