Optimize Texture 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
This commit is contained in:
LexManos 2013-04-07 21:45:49 -07:00 committed by Christian
parent dc047fcb7a
commit f755fb2ebb
1 changed files with 37 additions and 2 deletions

View File

@ -1,6 +1,41 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/texture/Texture.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/texture/Texture.java
@@ -222,7 +222,7 @@
@@ -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)
{
@ -9,7 +44,7 @@
}
for (int k1 = 0; k1 < par3Texture.getWidth(); ++k1)
@@ -232,7 +232,7 @@
@@ -232,7 +258,7 @@
if (par4)
{