Game Development Community

Torque 3D Beta 2 Bug: validateTextureQuality

by Stephane Conde · in Torque 3D Professional · 06/06/2009 (9:16 pm) · 2 replies

Just noticed an issue with the GFXTextureManager::validateTextureQuality function. First, it seems to do the opposite of what it looks like it's supposed to do. In the following code, getBitmapScalePower returns the value of gTextureReductionLevel which is the number of powers of reduction to apply to the texture. It seems to end up increasing textures sizes rather than decreasing them... should it not be doing a right shift in the following code instead of a left shift?

bool GFXTextureManager::validateTextureQuality(GFXTextureProfile *profile, U32 &width, U32 &height)
{
   U32 scaleFactor;
   if((scaleFactor = getBitmapScalePower(profile)) == 0)
      return true;

   // Otherwise apply the appropriate scale...
   width  <<= scaleFactor;
   height <<= scaleFactor;

   return true;
}

Also, this seems to get applied to any texture that does not have the PreserveSize flag set, which seems to be a lot of textures that probably shouldn't have their sizes modified. For example, both the layer and detail textures owned by the terrain renderer end up getting scaled which seems like a bad thing.

Anyway, this isn't a terribly big bug because the threshold of 64MB of required VRAM before texture quality starts to get reduced is quite low and probably not going to trigger anything to happen on any current video cards. I just happened to accidentally set that threshold to 60GB and noticed my terrain got all messed up as a result. It took awhile to track down, but ended up being because the layer and detail texture sizes were being doubled.

Just thought I would bring it to your attention.

Stephane

#1
06/07/2009 (12:17 pm)

Good catch. Thanks for reporting. Fixed for B3.
#2
10/23/2011 (2:19 am)
Exists in TGEA 171 also. Thanks for the confirmation that this is backwards.