Scaling non-power-of-two (NPOT) textures to powers of two is really time consuming and not necessary on graphics cards that can support NPOT textures. So, if the graphics card has NPOT texture support, don't bother scaling. If this patch causes issues, it can always be reverted and applied to Swiss instead.

This commit is contained in:
Mitchell Stokes 2012-07-10 19:23:57 +00:00
parent f279576f1a
commit 831ae18622
2 changed files with 4 additions and 3 deletions

@ -638,8 +638,9 @@ void GPU_create_gl_tex(unsigned int *bind, unsigned int *pix, float * frect, int
int tpy = recth; int tpy = recth;
/* scale if not a power of two. this is not strictly necessary for newer /* scale if not a power of two. this is not strictly necessary for newer
* GPUs (OpenGL version >= 2.0) since they support non-power-of-two-textures */ * GPUs (OpenGL version >= 2.0) since they support non-power-of-two-textures
if (!is_pow2_limit(rectw) || !is_pow2_limit(recth)) { * Then don't bother scaling for hardware that supports NPOT textures! */
if (!GLEW_ARB_texture_non_power_of_two && (!is_pow2_limit(rectw) || !is_pow2_limit(recth))) {
rectw= smaller_pow2_limit(rectw); rectw= smaller_pow2_limit(rectw);
recth= smaller_pow2_limit(recth); recth= smaller_pow2_limit(recth);

@ -169,7 +169,7 @@ bool BL_Texture::InitFromImage(int unit, Image *img, bool mipmap)
void BL_Texture::InitGLTex(unsigned int *pix,int x,int y,bool mipmap) void BL_Texture::InitGLTex(unsigned int *pix,int x,int y,bool mipmap)
{ {
if (!is_power_of_2_i(x) || !is_power_of_2_i(y) ) { if (!GLEW_ARB_texture_non_power_of_two && (!is_power_of_2_i(x) || !is_power_of_2_i(y)) ) {
InitNonPow2Tex(pix, x,y,mipmap); InitNonPow2Tex(pix, x,y,mipmap);
return; return;
} }