[Bf-blender-cvs] [0626de2033c] blender2.8: GPU: consistenly use mipmap on/off in all draw modes.

Brecht Van Lommel noreply at git.blender.org
Thu Jun 14 15:51:24 CEST 2018


Commit: 0626de2033c45c1973f5233ab137098db4b38be3
Author: Brecht Van Lommel
Date:   Thu Jun 14 12:58:30 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB0626de2033c45c1973f5233ab137098db4b38be3

GPU: consistenly use mipmap on/off in all draw modes.

This is important for good texture paint performance.

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

M	source/blender/draw/engines/workbench/workbench_deferred.c
M	source/blender/draw/engines/workbench/workbench_forward.c
M	source/blender/draw/intern/draw_manager_data.c
M	source/blender/draw/modes/object_mode.c
M	source/blender/draw/modes/paint_texture_mode.c
M	source/blender/gpu/GPU_texture.h
M	source/blender/gpu/intern/gpu_draw.c

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

diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c
index 98cdda51e35..623d6b51412 100644
--- a/source/blender/draw/engines/workbench/workbench_deferred.c
+++ b/source/blender/draw/engines/workbench/workbench_deferred.c
@@ -568,7 +568,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
 
 			case OB_TEXTURE:
 			{
-				GPUTexture *tex = GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, false, false);
+				GPUTexture *tex = GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, 0.0);
 				DRW_shgroup_uniform_texture(material->shgrp, "image", tex);
 				break;
 			}
@@ -631,7 +631,7 @@ static void workbench_cache_populate_particles(WORKBENCH_Data *vedata, Object *o
 			DRW_shgroup_uniform_int(shgrp, "object_id", &material->object_id, 1);
 			DRW_shgroup_uniform_block(shgrp, "material_block", material->material_ubo);
 			if (image) {
-				GPUTexture *tex = GPU_texture_from_blender(image, NULL, GL_TEXTURE_2D, false, false, false);
+				GPUTexture *tex = GPU_texture_from_blender(image, NULL, GL_TEXTURE_2D, false, 0.0f);
 				DRW_shgroup_uniform_texture(shgrp, "image", tex);
 			}
 		}
diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c
index 58bd6a65866..3912494d9db 100644
--- a/source/blender/draw/engines/workbench/workbench_forward.c
+++ b/source/blender/draw/engines/workbench/workbench_forward.c
@@ -193,7 +193,7 @@ static WORKBENCH_MaterialData *get_or_create_material_data(
 
 			case OB_TEXTURE:
 			{
-				GPUTexture *tex = GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, false, false);
+				GPUTexture *tex = GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, 0.0f);
 				DRW_shgroup_uniform_texture(grp, "image", tex);
 				break;
 			}
@@ -427,7 +427,7 @@ static void workbench_forward_cache_populate_particles(WORKBENCH_Data *vedata, O
 			float hair_alpha = wpd->shading.xray_alpha * 0.33f;
 			DRW_shgroup_uniform_float_copy(shgrp, "alpha", hair_alpha);
 			if (image) {
-				GPUTexture *tex = GPU_texture_from_blender(image, NULL, GL_TEXTURE_2D, false, false, false);
+				GPUTexture *tex = GPU_texture_from_blender(image, NULL, GL_TEXTURE_2D, false, 0.0f);
 				DRW_shgroup_uniform_texture(shgrp, "image", tex);
 			}
 			if (STUDIOLIGHT_ORIENTATION_VIEWNORMAL_ENABLED(wpd)) {
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c
index b49af47223f..db4e16d362a 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -768,7 +768,7 @@ static DRWShadingGroup *drw_shgroup_material_inputs(DRWShadingGroup *grp, struct
 		if (input->ima) {
 			double time = 0.0; /* TODO make time variable */
 			GPUTexture *tex = GPU_texture_from_blender(
-			        input->ima, input->iuser, input->textarget, input->image_isdata, time, 1);
+			        input->ima, input->iuser, input->textarget, input->image_isdata, time);
 
 			if (input->bindtex) {
 				DRW_shgroup_uniform_texture(grp, input->shadername, tex);
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c
index 76712783cb1..f6fc58557f2 100644
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@ -799,7 +799,7 @@ static void DRW_shgroup_empty_image(
 	struct EmptyImageShadingGroupData *empty_image_data;
 
 	GPUTexture *tex = ob->data ?
-	        GPU_texture_from_blender(ob->data, ob->iuser, GL_TEXTURE_2D, false, false, false) : NULL;
+	        GPU_texture_from_blender(ob->data, ob->iuser, GL_TEXTURE_2D, false, 0.0f) : NULL;
 	void **val_p;
 
 	/* Create on demand, 'tex' may be NULL. */
diff --git a/source/blender/draw/modes/paint_texture_mode.c b/source/blender/draw/modes/paint_texture_mode.c
index 1d7f686a51c..bd8a1c71a6a 100644
--- a/source/blender/draw/modes/paint_texture_mode.c
+++ b/source/blender/draw/modes/paint_texture_mode.c
@@ -222,7 +222,7 @@ static void PAINT_TEXTURE_cache_init(void *vedata)
 					Material *ma = give_current_material(ob, i + 1);
 					Image *ima = (ma && ma->texpaintslot) ? ma->texpaintslot[ma->paint_active_slot].ima : NULL;
 					GPUTexture *tex = ima ?
-					        GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, false, false) : NULL;
+					        GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, 0.0f) : NULL;
 
 					if (tex) {
 						DRWShadingGroup *grp = DRW_shgroup_create(e_data.image_sh, psl->image_faces);
@@ -237,7 +237,7 @@ static void PAINT_TEXTURE_cache_init(void *vedata)
 			else {
 				Image *ima = scene->toolsettings->imapaint.canvas;
 				GPUTexture *tex = ima ?
-				        GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, false, false) : NULL;
+				        GPU_texture_from_blender(ima, NULL, GL_TEXTURE_2D, false, 0.0f) : NULL;
 
 				if (tex) {
 					DRWShadingGroup *grp = DRW_shgroup_create(e_data.image_sh, psl->image_faces);
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h
index e58d5d92831..e53693e7b40 100644
--- a/source/blender/gpu/GPU_texture.h
+++ b/source/blender/gpu/GPU_texture.h
@@ -163,7 +163,7 @@ GPUTexture *GPU_texture_create_buffer(
 
 GPUTexture *GPU_texture_from_bindcode(int textarget, int bindcode);
 GPUTexture *GPU_texture_from_blender(
-        struct Image *ima, struct ImageUser *iuser, int textarget, bool is_data, double time, int mipmap);
+        struct Image *ima, struct ImageUser *iuser, int textarget, bool is_data, double time);
 GPUTexture *GPU_texture_from_preview(struct PreviewImage *prv, int mipmap);
 
 void GPU_texture_update(GPUTexture *tex, const float *pixels);
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index fdffe21b1e7..83fd689e3b7 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -288,8 +288,7 @@ GPUTexture *GPU_texture_from_blender(Image *ima,
                                      ImageUser *iuser,
                                      int textarget,
                                      bool is_data,
-                                     double UNUSED(time),
-                                     int mipmap)
+                                     double UNUSED(time))
 {
 	if (ima == NULL) {
 		return NULL;
@@ -361,6 +360,8 @@ GPUTexture *GPU_texture_from_blender(Image *ima,
 		}
 	}
 
+	const bool mipmap = GPU_get_mipmap();
+
 #ifdef WITH_DDS
 	if (ibuf->ftype == IMB_FTYPE_DDS)
 		GPU_create_gl_tex_compressed(&bindcode, rect, rectw, recth, textarget, mipmap, ima, ibuf);



More information about the Bf-blender-cvs mailing list