diff options
author | FalsePattern <me@falsepattern.com> | 2023-12-05 19:48:02 +0100 |
---|---|---|
committer | makamys <makamys@outlook.com> | 2024-01-08 22:49:40 +0100 |
commit | 180dee59e103dc94d17a4c4121f7963bc33c3ad6 (patch) | |
tree | 8e4316410ca99bb0a4a3daaedf08c317d03e2232 /src/main/java/makamys/neodymium | |
parent | a0dcf0ac417cd2c18ad44ae6bda4309c381a0f64 (diff) | |
download | Neodymium-180dee59e103dc94d17a4c4121f7963bc33c3ad6.tar.gz Neodymium-180dee59e103dc94d17a4c4121f7963bc33c3ad6.tar.bz2 Neodymium-180dee59e103dc94d17a4c4121f7963bc33c3ad6.zip |
shaders detection
Diffstat (limited to 'src/main/java/makamys/neodymium')
-rw-r--r-- | src/main/java/makamys/neodymium/Compat.java | 40 | ||||
-rw-r--r-- | src/main/java/makamys/neodymium/renderer/NeoRenderer.java | 2 |
2 files changed, 25 insertions, 17 deletions
diff --git a/src/main/java/makamys/neodymium/Compat.java b/src/main/java/makamys/neodymium/Compat.java index acb76ca..6343e14 100644 --- a/src/main/java/makamys/neodymium/Compat.java +++ b/src/main/java/makamys/neodymium/Compat.java @@ -44,8 +44,29 @@ public class Compat { return RPLE; } + private static boolean shadersEnabled; + public static boolean isShaders() { - return false; + return shadersEnabled; + } + + public static void updateShadersState() { + try { + Class<?> shaders = Class.forName("shadersmod.client.Shaders"); + try { + String shaderPack = (String)shaders.getMethod("getShaderPackName").invoke(null); + if(shaderPack != null) { + shadersEnabled = true; + return; + } + } catch(Exception e) { + LOGGER.warn("Failed to get shader pack name"); + e.printStackTrace(); + } + } catch (ClassNotFoundException e) { + + } + shadersEnabled = false; } private static void disableTriangulator() { @@ -57,21 +78,6 @@ public class Compat { warns.add(new Warning("Advanced OpenGL is enabled, performance may be poor." + (statusCommand ? " Click here to disable it." : "")).chatAction("neodymium disable_advanced_opengl")); } -// try { -// Class<?> shaders = Class.forName("shadersmod.client.Shaders"); -// try { -// String shaderPack = (String)shaders.getMethod("getShaderPackName").invoke(null); -// if(shaderPack != null) { -// criticalWarns.add(new Warning("A shader pack is enabled, this is not supported.")); -// } -// } catch(Exception e) { -// LOGGER.warn("Failed to get shader pack name"); -// e.printStackTrace(); -// } -// } catch (ClassNotFoundException e) { -// -// } - if(!isGL33Supported) { criticalWarns.add(new Warning("OpenGL 3.3 is not supported.")); } @@ -122,7 +128,7 @@ public class Compat { } return false; } - + private static class OptiFineStubVirtualJar implements IVirtualJar { @Override diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java index fcd4c67..ff13dd7 100644 --- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java +++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java @@ -412,6 +412,8 @@ public class NeoRenderer { // This means 1 MB of index data per 512 MB of VRAM. MAX_MESHES = Config.VRAMSize * 128; + Compat.updateShadersState(); + attributes = new AttributeSet(); attributes.addAttribute("POS", 3, 4, GL_FLOAT); if (Config.shortUV) { |