[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48815] trunk/blender/source: 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 .

Mitchell Stokes mogurijin at gmail.com
Tue Jul 10 21:23:58 CEST 2012


Revision: 48815
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48815
Author:   moguri
Date:     2012-07-10 19:23:57 +0000 (Tue, 10 Jul 2012)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/gpu/intern/gpu_draw.c
    trunk/blender/source/gameengine/Ketsji/BL_Texture.cpp

Modified: trunk/blender/source/blender/gpu/intern/gpu_draw.c
===================================================================
--- trunk/blender/source/blender/gpu/intern/gpu_draw.c	2012-07-10 18:12:29 UTC (rev 48814)
+++ trunk/blender/source/blender/gpu/intern/gpu_draw.c	2012-07-10 19:23:57 UTC (rev 48815)
@@ -638,8 +638,9 @@
 	int tpy = recth;
 
 	/* 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 */
-	if (!is_pow2_limit(rectw) || !is_pow2_limit(recth)) {
+	 * GPUs (OpenGL version >= 2.0) since they support non-power-of-two-textures 
+	 * 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);
 		recth= smaller_pow2_limit(recth);
 		

Modified: trunk/blender/source/gameengine/Ketsji/BL_Texture.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/BL_Texture.cpp	2012-07-10 18:12:29 UTC (rev 48814)
+++ trunk/blender/source/gameengine/Ketsji/BL_Texture.cpp	2012-07-10 19:23:57 UTC (rev 48815)
@@ -169,7 +169,7 @@
 
 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);
 		return;
 	}




More information about the Bf-blender-cvs mailing list