From cefcd8aee6f458cf1a7ebb2114ceb4c890f138f4 Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 9 Apr 2013 20:33:40 -0400 Subject: [PATCH] Fix performance of texture uploads Updated FML: MinecraftForge/FML@00c788308881a07a683e17e2e9382313f3719b45 Very significant improvement in performance by using glSubImage to upload data. Inspired by frequent complaints about performance of hires texture packs. They probably still need a beefy system but should work. Hopefully I can figure out why the subImage GL side copy isn't working properly for an even more significant speed boost. But this gets things started. MinecraftForge/FML@57ad221cc6d9605b9d521f86620c2a31f922ac24 And add the patches *sigh* --- fml | 2 +- .../renderer/texture/Texture.java.patch | 55 ------------------- .../texture/TextureStitched.java.patch | 8 +-- 3 files changed, 5 insertions(+), 60 deletions(-) delete mode 100644 patches/minecraft/net/minecraft/client/renderer/texture/Texture.java.patch diff --git a/fml b/fml index 1de89525c..57ad221cc 160000 --- a/fml +++ b/fml @@ -1 +1 @@ -Subproject commit 1de89525cc2265bdce8704d9bd0d31c57bca4d97 +Subproject commit 57ad221cc6d9605b9d521f86620c2a31f922ac24 diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/Texture.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/Texture.java.patch deleted file mode 100644 index 68ef8630a..000000000 --- a/patches/minecraft/net/minecraft/client/renderer/texture/Texture.java.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- ../src_base/minecraft/net/minecraft/client/renderer/texture/Texture.java -+++ ../src_work/minecraft/net/minecraft/client/renderer/texture/Texture.java -@@ -214,7 +214,33 @@ - this.textureData.position(0); - bytebuffer.position(0); - -- for (int k = 0; k < par3Texture.getHeight(); ++k) -+ /* Forge: -+ * -+ * Optimize these loops a bit for non-rotated textures. -+ * Should help the FPS loss on higher resolution texture packs. -+ * If it becomes a major issue we may have to look into a more -+ * optimized animation system. -+ * -+ * https://mojang.atlassian.net/browse/MC-13206 -+ */ -+ if (!par4) -+ { -+ int scanSize = par3Texture.getWidth() * 4; -+ int w4 = width * 4; -+ int targetY = (par2 * w4) + (par1 * 4); -+ -+ for (int y = 0; y < par3Texture.getHeight(); y++) -+ { -+ textureData.position(targetY); -+ for (int x = 0; x < scanSize; x++) -+ { -+ textureData.put(bytebuffer.get()); -+ } -+ targetY += w4; -+ } -+ } -+ -+ for (int k = 0; par4 && k < par3Texture.getHeight(); ++k) - { - int l = par2 + k; - int i1 = k * par3Texture.getWidth() * 4; -@@ -222,7 +248,7 @@ - - if (par4) - { -- l = par2 + (par3Texture.getHeight() - k); -+ l = par1 + (par3Texture.getHeight() - k - 1); //BUGFIX: targetY -> targetX and -1 - } - - for (int k1 = 0; k1 < par3Texture.getWidth(); ++k1) -@@ -232,7 +258,7 @@ - - if (par4) - { -- l1 = par1 + k1 * this.width * 4 + l * 4; -+ l1 = (par2 + k1) * this.width * 4 + l * 4; //BUGFIX: targetX -> targetY and parens - } - - this.textureData.put(l1 + 0, bytebuffer.get(i2 + 0)); diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java.patch index 1322061c3..2337b1ecd 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java.patch @@ -1,7 +1,7 @@ --- ../src_base/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java +++ ../src_work/minecraft/net/minecraft/client/renderer/texture/TextureStitched.java -@@ -2,9 +2,13 @@ - +@@ -3,9 +3,13 @@ + import cpw.mods.fml.client.TextureFXManager; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; + @@ -14,8 +14,8 @@ import net.minecraft.util.Icon; import net.minecraft.util.Tuple; -@@ -238,4 +242,28 @@ - this.listAnimationTuples = arraylist; +@@ -252,4 +256,28 @@ + t.createAndUploadTexture(); } } +