From 2de6f297e1df257afb3b48905d6c0a922e92cd4c Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 7 Apr 2013 21:44:07 -0700 Subject: [PATCH] Small optimization for usages of Minecraft.getGLMaximumTextureSize(), only need to calculate it once. --- .../net/minecraft/client/Minecraft.java.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index f3fce2a45..18e39477e 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -167,3 +167,30 @@ if (flag) { +@@ -2539,11 +2466,18 @@ + par1PlayerUsageSnooper.addData("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize())); + } + ++ //Forge: Adds a optimization to the getGLMaximumTextureSize, only calculate it once. ++ private static int max_texture_size = -1; + /** + * Used in the usage snooper. + */ + public static int getGLMaximumTextureSize() + { ++ if (max_texture_size != -1) ++ { ++ return max_texture_size; ++ } ++ + for (int i = 16384; i > 0; i >>= 1) + { + GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); +@@ -2551,6 +2485,7 @@ + + if (j != 0) + { ++ max_texture_size = i; + return i; + } + }