diff --git a/core/src/mindustry/ClientLauncher.java b/core/src/mindustry/ClientLauncher.java index a0fe9fbdb1..3e2fbca7df 100644 --- a/core/src/mindustry/ClientLauncher.java +++ b/core/src/mindustry/ClientLauncher.java @@ -55,6 +55,9 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform Log.info("[GL] Version: @", graphics.getGLVersion()); Log.info("[GL] Max texture size: @", maxTextureSize); Log.info("[GL] Using @ context.", gl30 != null ? "OpenGL 3" : "OpenGL 2"); + if(NvGpuInfo.hasMemoryInfo()){ + Log.info("[GL] Total available VRAM: @mb", NvGpuInfo.getMaxMemoryKB()/1024); + } if(maxTextureSize < 4096) Log.warn("[GL] Your maximum texture size is below the recommended minimum of 4096. This will cause severe performance issues."); Log.info("[JAVA] Version: @", OS.javaVersion); if(Core.app.isAndroid()){ diff --git a/core/src/mindustry/graphics/NvGpuInfo.java b/core/src/mindustry/graphics/NvGpuInfo.java new file mode 100644 index 0000000000..f620680b03 --- /dev/null +++ b/core/src/mindustry/graphics/NvGpuInfo.java @@ -0,0 +1,28 @@ +package mindustry.graphics; + +import arc.*; +import arc.graphics.*; + +/** Nvidia-specific utility class for querying GPU VRAM information. */ +public class NvGpuInfo{ + private static final int GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX = 0x9048; + private static final int GL_GPU_MEM_INFO_CURRENT_AVAILABLE_MEM_NVX = 0x9049; + + private static boolean supported, initialized; + + public static int getMaxMemoryKB(){ + return hasMemoryInfo() ? Gl.getInt(GL_GPU_MEM_INFO_TOTAL_AVAILABLE_MEM_NVX) : 0; + } + + public static int getAvailableMemoryKB(){ + return hasMemoryInfo() ? Gl.getInt(GL_GPU_MEM_INFO_CURRENT_AVAILABLE_MEM_NVX) : 0; + } + + public static boolean hasMemoryInfo(){ + if(!initialized){ + supported = Core.graphics.supportsExtension("GL_NVX_gpu_memory_info"); + initialized = true; + } + return supported; + } +} \ No newline at end of file diff --git a/core/src/mindustry/net/CrashHandler.java b/core/src/mindustry/net/CrashHandler.java index cb60f4ef33..2ac952c3e6 100644 --- a/core/src/mindustry/net/CrashHandler.java +++ b/core/src/mindustry/net/CrashHandler.java @@ -34,7 +34,7 @@ public class CrashHandler{ + ((OS.isAndroid || OS.isIos) && app != null ? "Android API level: " + Core.app.getVersion() + "\n" : "") + "Java Version: " + OS.javaVersion + "\n" + "Runtime Available Memory: " + (Runtime.getRuntime().maxMemory() / 1024 / 1024) + "mb\n" - + "Cores: " + Runtime.getRuntime().availableProcessors() + "\n" + + "Cores: " + OS.cores + "\n" + (cause == null ? "" : "Likely Cause: " + cause.meta.displayName + " (" + cause.name + " v" + cause.meta.version + ")\n") + (mods == null ? "" : "Mods: " + (!mods.list().contains(LoadedMod::shouldBeEnabled) ? "none (vanilla)" : mods.list().select(LoadedMod::shouldBeEnabled).toString(", ", mod -> mod.name + ":" + mod.meta.version))) + "\n\n" + error;