aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys
diff options
context:
space:
mode:
authormakamys <makamys@outlook.com>2022-06-21 06:49:55 +0200
committermakamys <makamys@outlook.com>2022-06-21 06:49:55 +0200
commit9af39b831004051e7c20c56e63b2d95bffc34cfe (patch)
tree0a21935f82ba4a75901fed9e4fd096cee6c55ab5 /src/main/java/makamys
parentaf5af6d77cbe3e113a11d9aa92571f6172bafae4 (diff)
downloadNeodymium-9af39b831004051e7c20c56e63b2d95bffc34cfe.tar.gz
Neodymium-9af39b831004051e7c20c56e63b2d95bffc34cfe.tar.bz2
Neodymium-9af39b831004051e7c20c56e63b2d95bffc34cfe.zip
Only count actually used VRAM
Diffstat (limited to 'src/main/java/makamys')
-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() {