From 3ae475be9b76e63f1be14c7a139494cf9a13a277 Mon Sep 17 00:00:00 2001 From: makamys Date: Sun, 17 Jul 2022 05:06:33 +0200 Subject: Scale mesh index arrays by amount of allocated VRAM --- src/main/java/makamys/neodymium/renderer/NeoRenderer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main/java/makamys/neodymium') diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java index 3762dea..e70a12c 100644 --- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java +++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java @@ -58,7 +58,7 @@ public class NeoRenderer { public boolean forceRenderFog; public boolean hasIncompatibilities; - private static int MAX_MESHES = 100000; + private static int MAX_MESHES; private int VAO; private int[] shaderProgramsFog = {0, 0}; @@ -364,6 +364,10 @@ public class NeoRenderer { } public boolean init() { + // The average mesh is 60 KB. Let's be safe and assume 8 KB per mesh. + // This means 1 MB of index data per 512 MB of VRAM. + MAX_MESHES = Config.VRAMSize * 128; + reloadShader(); VAO = glGenVertexArrays(); -- cgit