Fix performance of texture uploads

Updated FML:
MinecraftForge/FML@00c7883088 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@57ad221cc6 And add the patches *sigh*
This commit is contained in:
Christian 2013-04-09 20:33:40 -04:00
parent f755fb2ebb
commit cefcd8aee6
3 changed files with 5 additions and 60 deletions

2
fml

@ -1 +1 @@
Subproject commit 1de89525cc2265bdce8704d9bd0d31c57bca4d97
Subproject commit 57ad221cc6d9605b9d521f86620c2a31f922ac24

View File

@ -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));

View File

@ -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();
}
}
+