[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55310] trunk/blender/source/blender/gpu/ intern/gpu_draw.c: Fix #34649: texture size limit user preference not working.

Brecht Van Lommel brechtvanlommel at pandora.be
Fri Mar 15 17:16:11 CET 2013


Revision: 55310
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55310
Author:   blendix
Date:     2013-03-15 16:16:11 +0000 (Fri, 15 Mar 2013)
Log Message:
-----------
Fix #34649: texture size limit user preference not working.

Modified Paths:
--------------
    trunk/blender/source/blender/gpu/intern/gpu_draw.c

Modified: trunk/blender/source/blender/gpu/intern/gpu_draw.c
===================================================================
--- trunk/blender/source/blender/gpu/intern/gpu_draw.c	2013-03-15 15:47:32 UTC (rev 55309)
+++ trunk/blender/source/blender/gpu/intern/gpu_draw.c	2013-03-15 16:16:11 UTC (rev 55310)
@@ -189,30 +189,21 @@
 
 /* Checking powers of two for images since opengl 1.x requires it */
 
-static int is_pow2_limit(int num)
+static bool is_power_of_2_resolution(int w, int h)
 {
-	/* take texture clamping into account */
+	return is_power_of_2_i(w) && is_power_of_2_i(h);
+}
 
-	/* XXX: texturepaint not global! */
-#if 0
-	if (G.f & G_TEXTUREPAINT)
-		return 1;*/
-#endif
+static bool is_over_resolution_limit(int w, int h)
+{
+	if (U.glreslimit != 0)
+		return (w > U.glreslimit || h > U.glreslimit);
 
-	if (U.glreslimit != 0 && num > U.glreslimit)
-		return 0;
-
-	return is_power_of_2_i(num);
+	return false;
 }
 
-static int smaller_pow2_limit(int num)
+static int smaller_power_of_2_limit(int num)
 {
-	/* XXX: texturepaint not global! */
-#if 0
-	if (G.f & G_TEXTUREPAINT)
-		return 1;*/
-#endif
-
 	/* take texture clamping into account */
 	if (U.glreslimit != 0 && num > U.glreslimit)
 		return U.glreslimit;
@@ -681,9 +672,10 @@
 	/* 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 
 	 * Then don't bother scaling for hardware that supports NPOT textures! */
-	if (!GPU_non_power_of_two_support() && (!is_pow2_limit(rectw) || !is_pow2_limit(recth))) {
-		rectw= smaller_pow2_limit(rectw);
-		recth= smaller_pow2_limit(recth);
+	if ((!GPU_non_power_of_two_support() && !is_power_of_2_resolution(rectw, recth)) ||
+		is_over_resolution_limit(rectw, recth)) {
+		rectw= smaller_power_of_2_limit(rectw);
+		recth= smaller_power_of_2_limit(recth);
 		
 		if (use_high_bit_depth) {
 			fscalerect= MEM_mallocN(rectw*recth*sizeof(*fscalerect)*4, "fscalerect");
@@ -772,7 +764,7 @@
 		return FALSE;
 	}
 
-	if (!is_power_of_2_i(width) || !is_power_of_2_i(height)) {
+	if (!is_power_of_2_resolution(width, height)) {
 		printf("Unable to load non-power-of-two DXT image resolution, falling back to uncompressed\n");
 		return FALSE;
 	}




More information about the Bf-blender-cvs mailing list