[Bf-blender-cvs] [a8a89db9c82] master: Preferences: always do GPU accelerated mipmapping, remove preference.

Brecht Van Lommel noreply at git.blender.org
Wed Jan 16 16:24:13 CET 2019


Commit: a8a89db9c8217a21cc8463fe6e113709bc79be67
Author: Brecht Van Lommel
Date:   Wed Jan 16 15:10:19 2019 +0100
Branches: master
https://developer.blender.org/rBa8a89db9c8217a21cc8463fe6e113709bc79be67

Preferences: always do GPU accelerated mipmapping, remove preference.

This setting was added long ago to be cautious in case some GPUs did not
support this propertly, no reason to have it anymore.

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

M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/gpu/GPU_draw.h
M	source/blender/gpu/intern/gpu_draw.c
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_userdef.c
M	source/blender/windowmanager/intern/wm_init_exit.c

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

diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index a4feabf7254..115d9d27107 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -657,7 +657,6 @@ class USERPREF_PT_system_opengl_textures(PreferencePanel):
         flow.prop(system, "image_draw_method", text="Image Display Method")
 
         flow.prop(system, "use_16bit_textures")
-        flow.prop(system, "use_gpu_mipmap")
 
 
 class USERPREF_PT_system_opengl_selection(PreferencePanel):
diff --git a/source/blender/gpu/GPU_draw.h b/source/blender/gpu/GPU_draw.h
index 008f4199b02..4b94b79022b 100644
--- a/source/blender/gpu/GPU_draw.h
+++ b/source/blender/gpu/GPU_draw.h
@@ -80,9 +80,6 @@ void GPU_paint_set_mipmap(struct Main *bmain, bool mipmap);
 void GPU_set_anisotropic(struct Main *bmain, float value);
 float GPU_get_anisotropic(void);
 
-/* enable gpu mipmapping */
-void GPU_set_gpu_mipmapping(struct Main *bmain, int gpu_mipmap);
-
 /* Image updates and free
  * - these deal with images bound as opengl textures */
 
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 6f939261729..cf9cbc8ca89 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -125,23 +125,10 @@ static struct GPUTextureState {
 	bool texpaint;
 
 	float anisotropic;
-	int gpu_mipmap;
-} GTS = {1, 0, 0, 1.0f, 0};
+} GTS = {1, 0, 0, 1.0f};
 
 /* Mipmap settings */
 
-void GPU_set_gpu_mipmapping(Main *bmain, int gpu_mipmap)
-{
-	int old_value = GTS.gpu_mipmap;
-
-	/* only actually enable if it's supported */
-	GTS.gpu_mipmap = gpu_mipmap;
-
-	if (old_value != GTS.gpu_mipmap) {
-		GPU_free_images(bmain);
-	}
-}
-
 void GPU_set_mipmap(Main *bmain, bool mipmap)
 {
 	if (GTS.domipmap != mipmap) {
@@ -479,31 +466,7 @@ void GPU_create_gl_tex(
 		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
 
 		if (GPU_get_mipmap() && mipmap) {
-			if (GTS.gpu_mipmap) {
-				glGenerateMipmap(GL_TEXTURE_2D);
-			}
-			else {
-				int i;
-				if (!ibuf) {
-					if (use_high_bit_depth) {
-						ibuf = IMB_allocFromBuffer(NULL, frect, tpx, tpy);
-					}
-					else {
-						ibuf = IMB_allocFromBuffer(rect, NULL, tpx, tpy);
-					}
-				}
-				IMB_makemipmap(ibuf, true);
-
-				for (i = 1; i < ibuf->miptot; i++) {
-					ImBuf *mip = ibuf->mipmap[i - 1];
-					if (use_high_bit_depth) {
-						glTexImage2D(GL_TEXTURE_2D, i, GL_RGBA16F, mip->x, mip->y, 0, GL_RGBA, GL_FLOAT, mip->rect_float);
-					}
-					else {
-						glTexImage2D(GL_TEXTURE_2D, i, GL_RGBA8, mip->x, mip->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, mip->rect);
-					}
-				}
-			}
+			glGenerateMipmap(GL_TEXTURE_2D);
 			glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
 			if (ima)
 				ima->tpageflag |= IMA_MIPMAP_COMPLETE;
@@ -527,38 +490,7 @@ void GPU_create_gl_tex(
 			glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, gpu_get_mipmap_filter(1));
 
 			if (GPU_get_mipmap() && mipmap) {
-				if (GTS.gpu_mipmap) {
-					glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
-				}
-				else {
-					if (!ibuf) {
-						if (use_high_bit_depth) {
-							ibuf = IMB_allocFromBuffer(NULL, frect, tpx, tpy);
-						}
-						else {
-							ibuf = IMB_allocFromBuffer(rect, NULL, tpx, tpy);
-						}
-					}
-
-					IMB_makemipmap(ibuf, true);
-
-					for (int i = 1; i < ibuf->miptot; i++) {
-						ImBuf *mip = ibuf->mipmap[i - 1];
-						void **mip_cube_map = gpu_gen_cube_map(
-						        mip->rect, mip->rect_float,
-						        mip->x, mip->y, use_high_bit_depth);
-						int mipw = mip->x / 3, miph = mip->y / 2;
-
-						if (mip_cube_map) {
-							for (int j = 0; j < 6; j++) {
-								glTexImage2D(
-								        GL_TEXTURE_CUBE_MAP_POSITIVE_X + j, i,
-								        informat, mipw, miph, 0, GL_RGBA, type, mip_cube_map[j]);
-							}
-						}
-						gpu_del_cube_map(mip_cube_map);
-					}
-				}
+				glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
 				glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
 
 				if (ima)
@@ -799,8 +731,7 @@ void GPU_paint_update_image(Image *ima, ImageUser *iuser, int x, int y, int w, i
 {
 	ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL);
 
-	if ((!GTS.gpu_mipmap && GPU_get_mipmap()) ||
-	    (ima->gputexture[TEXTARGET_TEXTURE_2D] == NULL) ||
+	if ((ima->gputexture[TEXTARGET_TEXTURE_2D] == NULL) ||
 	    (ibuf == NULL) ||
 	    (w == 0) || (h == 0))
 	{
@@ -829,8 +760,6 @@ void GPU_paint_update_image(Image *ima, ImageUser *iuser, int x, int y, int w, i
 
 			MEM_freeN(buffer);
 
-			/* we have already accounted for the case where GTS.gpu_mipmap is false
-			 * so we will be using GPU mipmap generation here */
 			if (GPU_get_mipmap()) {
 				glGenerateMipmap(GL_TEXTURE_2D);
 			}
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 996cfeb76b4..854b7b7afc8 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -694,12 +694,12 @@ typedef struct UserDef {
 	/** Seconds to zoom around current frame. */
 	float view_frame_seconds;
 
-	char _pad1[2];
+	char _pad1[4];
 
 	/** Private, defaults to 20 for 72 DPI setting. */
 	short widget_unit;
 	short anisotropic_filter;
-	short use_16bit_textures, use_gpu_mipmap;
+	short use_16bit_textures;
 
 	/** Tablet API to use (Windows only). */
 	short tablet_api;
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index eea2595d2a7..8f8b42faf70 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -185,12 +185,6 @@ static void rna_userdef_anisotropic_update(Main *bmain, Scene *scene, PointerRNA
 	rna_userdef_update(bmain, scene, ptr);
 }
 
-static void rna_userdef_gl_gpu_mipmaps(Main *bmain, Scene *scene, PointerRNA *ptr)
-{
-	GPU_set_gpu_mipmapping(bmain, U.use_gpu_mipmap);
-	rna_userdef_update(bmain, scene, ptr);
-}
-
 static void rna_userdef_gl_texture_limit_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
 	GPU_free_images(bmain);
@@ -4484,11 +4478,6 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "16 Bit Float Textures", "Use 16 bit per component texture for float images");
 	RNA_def_property_update(prop, 0, "rna_userdef_gl_use_16bit_textures");
 
-	prop = RNA_def_property(srna, "use_gpu_mipmap", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "use_gpu_mipmap", 1);
-	RNA_def_property_ui_text(prop, "GPU Mipmap Generation", "Generate Image Mipmaps on the GPU");
-	RNA_def_property_update(prop, 0, "rna_userdef_gl_gpu_mipmaps");
-
 	prop = RNA_def_property(srna, "image_draw_method", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_items(prop, image_draw_methods);
 	RNA_def_property_enum_sdna(prop, NULL, "image_draw_method");
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 2a99d06e9f9..134a1e31fce 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -187,7 +187,6 @@ void WM_init_opengl(Main *bmain)
 	GPU_set_mipmap(bmain, true);
 	GPU_set_linear_mipmap(true);
 	GPU_set_anisotropic(bmain, U.anisotropic_filter);
-	GPU_set_gpu_mipmapping(bmain, U.use_gpu_mipmap);
 
 	GPU_pass_cache_init();



More information about the Bf-blender-cvs mailing list