diff --git a/core/src/mindustry/ClientLauncher.java b/core/src/mindustry/ClientLauncher.java index 8990cb0200..5866c47a2c 100644 --- a/core/src/mindustry/ClientLauncher.java +++ b/core/src/mindustry/ClientLauncher.java @@ -55,11 +55,16 @@ 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(gl30 == null) Log.warn("[GL] Your device or video drivers do not support OpenGL 3. This will cause performance issues."); - if(NvGpuInfo.hasMemoryInfo()){ - Log.info("[GL] Total available VRAM: @mb", NvGpuInfo.getMaxMemoryKB()/1024); - } + + if(GpuDetect.gpus.size > 0) Log.info("[GL] Detected GPU: @", GpuDetect.gpus.toString(", ")); + if(GpuDetect.isIntel) Log.warn("[GL] Intel GPU detected. Due to memory corruption issues, OpenGL 3 support has been disabled for Intel GPUs. See issue #11041."); + + if(gl30 == null && !GpuDetect.isIntel) Log.warn("[GL] Your device or video drivers do not support OpenGL 3. This will cause performance issues."); + + 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()){ Log.info("[ANDROID] API level: @", Core.app.getVersion()); diff --git a/core/src/mindustry/graphics/GpuDetect.java b/core/src/mindustry/graphics/GpuDetect.java new file mode 100644 index 0000000000..8b3c56ea66 --- /dev/null +++ b/core/src/mindustry/graphics/GpuDetect.java @@ -0,0 +1,28 @@ +package mindustry.graphics; + +import arc.struct.*; +import arc.util.*; + +import java.util.*; + +/** GPU detection for Windows only. All fields will be false or empty on other platforms, even if #init() is called. */ +public class GpuDetect{ + public static String rawGpuString = ""; + public static Seq gpus = new Seq<>(); + public static boolean isIntel, isNvidia, isAMD; + + public static void init(){ + if(OS.isWindows){ + try{ + rawGpuString = OS.exec("wmic", "path", "win32_VideoController", "get", "name"); + gpus = Seq.with(rawGpuString.split("\n")).map(s -> s.trim()).removeAll(s -> s.isEmpty() || s.equalsIgnoreCase("name")); + + isIntel = rawGpuString.toLowerCase(Locale.ROOT).contains("intel"); + isNvidia = rawGpuString.toLowerCase(Locale.ROOT).contains("nvidia"); + isAMD = rawGpuString.toLowerCase(Locale.ROOT).contains("amd") || rawGpuString.toLowerCase(Locale.ROOT).contains("radeon"); + }catch(Exception e){ + Log.err(e); + } + } + } +} diff --git a/desktop/src/mindustry/desktop/DesktopLauncher.java b/desktop/src/mindustry/desktop/DesktopLauncher.java index 1bbbd976f3..633361904f 100644 --- a/desktop/src/mindustry/desktop/DesktopLauncher.java +++ b/desktop/src/mindustry/desktop/DesktopLauncher.java @@ -19,6 +19,7 @@ import mindustry.core.*; import mindustry.desktop.steam.*; import mindustry.game.EventType.*; import mindustry.gen.*; +import mindustry.graphics.*; import mindustry.mod.Mods.*; import mindustry.net.*; import mindustry.net.Net.*; @@ -39,13 +40,22 @@ public class DesktopLauncher extends ClientLauncher{ public static void main(String[] arg){ try{ Vars.loadLogger(); + + //note that this only does something on Windows + GpuDetect.init(); + new SdlApplication(new DesktopLauncher(arg), new SdlConfig(){{ title = "Mindustry"; maximized = true; width = 900; height = 700; gl30Minor = 2; - gl30 = true; + + //on Windows, Intel drivers might be buggy with OpenGL 3.x, so disable it. See https://github.com/Anuken/Mindustry/issues/11041 + if(!GpuDetect.isIntel){ + gl30 = true; + } + for(int i = 0; i < arg.length; i++){ if(arg[i].charAt(0) == '-'){ String name = arg[i].substring(1);