mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-09 20:29:06 +07:00
Utility class for displaying VRAM information for Nvidia cards
This commit is contained in:
parent
eae43b7885
commit
ef5e024954
@ -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()){
|
||||
|
28
core/src/mindustry/graphics/NvGpuInfo.java
Normal file
28
core/src/mindustry/graphics/NvGpuInfo.java
Normal file
@ -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;
|
||||
}
|
||||
}
|
@ -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 ? "<no mod init>" : "Mods: " + (!mods.list().contains(LoadedMod::shouldBeEnabled) ? "none (vanilla)" : mods.list().select(LoadedMod::shouldBeEnabled).toString(", ", mod -> mod.name + ":" + mod.meta.version)))
|
||||
+ "\n\n" + error;
|
||||
|
Loading…
Reference in New Issue
Block a user