[Bf-blender-cvs] [e7fddc0] blender2.8: OpenGL: disable checks for NPOT texture support

Mike Erwin noreply at git.blender.org
Mon Oct 17 08:37:30 CEST 2016


Commit: e7fddc077297f2f722b6eb8350ac2115f7f4a685
Author: Mike Erwin
Date:   Mon Oct 17 02:36:51 2016 -0400
Branches: blender2.8
https://developer.blender.org/rBe7fddc077297f2f722b6eb8350ac2115f7f4a685

OpenGL: disable checks for NPOT texture support

Non-power-of-two textures are always allowed. Keeping the disabled checks in the code in case we support OpenGL ES in the future. Even then it should be a compile-time check, not at run-time.

===================================================================

M	source/blender/editors/interface/interface_icons.c
M	source/blender/gpu/intern/gpu_draw.c
M	source/blender/gpu/intern/gpu_texture.c

===================================================================

diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index f96a270..f82ed82 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -728,8 +728,12 @@ static void init_internal_icons(void)
 			icongltex.id = 0;
 		}
 
+#if 0 /* should be a compile-time check (if needed at all) */
 		/* we only use a texture for cards with non-power of two */
 		if (GPU_full_non_power_of_two_support()) {
+#else
+		{
+#endif
 			glGenTextures(1, &icongltex.id);
 
 			if (icongltex.id) {
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 6717ad0..49faaef 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -852,6 +852,7 @@ void GPU_create_gl_tex(
 	int tpx = rectw;
 	int tpy = recth;
 
+#if 0 /* NPOT support should be a compile-time check */
 	/* 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! */
@@ -875,6 +876,7 @@ void GPU_create_gl_tex(
 			rect = ibuf->rect;
 		}
 	}
+#endif
 
 	/* create image */
 	glGenTextures(1, (GLuint *)bind);
@@ -1200,8 +1202,12 @@ void GPU_paint_set_mipmap(bool mipmap)
 /* check if image has been downscaled and do scaled partial update */
 static bool GPU_check_scaled_image(ImBuf *ibuf, Image *ima, float *frect, int x, int y, int w, int h)
 {
+#if 0 /* NPOT suport should be a compile-time check */
 	if ((!GPU_full_non_power_of_two_support() && !is_power_of_2_resolution(ibuf->x, ibuf->y)) ||
 	    is_over_resolution_limit(GL_TEXTURE_2D, ibuf->x, ibuf->y))
+#else
+	if (is_over_resolution_limit(GL_TEXTURE_2D, ibuf->x, ibuf->y))
+#endif
 	{
 		int x_limit = smaller_power_of_2_limit(ibuf->x);
 		int y_limit = smaller_power_of_2_limit(ibuf->y);
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c
index 7b30053..c6cf4de 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -126,10 +126,12 @@ static GPUTexture *GPU_texture_create_nD(
 		return NULL;
 	}
 
+#if 0 /* this should be a compile-time check */
 	if (!GPU_full_non_power_of_two_support()) {
 		tex->w = power_of_2_max_i(tex->w);
 		tex->h = power_of_2_max_i(tex->h);
 	}
+#endif
 
 	tex->number = 0;
 	glBindTexture(tex->target, tex->bindcode);




More information about the Bf-blender-cvs mailing list