[Bf-blender-cvs] [586ec7588f3] blender2.8: Cleanup: Edit Surface & Curve engines unused code

Clément Foucault noreply at git.blender.org
Wed Sep 26 16:43:09 CEST 2018


Commit: 586ec7588f393d99c02605b3d6a966ef8594aff0
Author: Clément Foucault
Date:   Wed Sep 26 16:41:50 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB586ec7588f393d99c02605b3d6a966ef8594aff0

Cleanup: Edit Surface & Curve engines unused code

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

M	source/blender/draw/CMakeLists.txt
M	source/blender/draw/intern/draw_manager.c
M	source/blender/draw/modes/edit_curve_mode.c
D	source/blender/draw/modes/edit_surface_mode.c

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

diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt
index 05cc9d1cfaf..f2a8256489d 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -80,7 +80,6 @@ set(SRC
 	modes/edit_mesh_mode.c
 	modes/edit_mesh_mode_text.c
 	modes/edit_metaball_mode.c
-	modes/edit_surface_mode.c
 	modes/edit_text_mode.c
 	modes/object_mode.c
 	modes/overlay_mode.c
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index b637d2fe140..41c905337ac 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1225,12 +1225,10 @@ static void drw_engines_enable_from_mode(int mode)
 		case CTX_MODE_EDIT_MESH:
 			use_drw_engine(&draw_engine_edit_mesh_type);
 			break;
+		case CTX_MODE_EDIT_SURFACE:
 		case CTX_MODE_EDIT_CURVE:
 			use_drw_engine(&draw_engine_edit_curve_type);
 			break;
-		case CTX_MODE_EDIT_SURFACE:
-			use_drw_engine(&draw_engine_edit_surface_type);
-			break;
 		case CTX_MODE_EDIT_TEXT:
 			use_drw_engine(&draw_engine_edit_text_type);
 			break;
@@ -2475,7 +2473,6 @@ void DRW_engines_register(void)
 	DRW_engine_register(&draw_engine_edit_lattice_type);
 	DRW_engine_register(&draw_engine_edit_mesh_type);
 	DRW_engine_register(&draw_engine_edit_metaball_type);
-	DRW_engine_register(&draw_engine_edit_surface_type);
 	DRW_engine_register(&draw_engine_edit_text_type);
 	DRW_engine_register(&draw_engine_motion_path_type);
 	DRW_engine_register(&draw_engine_overlay_type);
diff --git a/source/blender/draw/modes/edit_curve_mode.c b/source/blender/draw/modes/edit_curve_mode.c
index 8f61c8db965..e5fd199b69a 100644
--- a/source/blender/draw/modes/edit_curve_mode.c
+++ b/source/blender/draw/modes/edit_curve_mode.c
@@ -50,7 +50,6 @@ extern char datatoc_edit_curve_overlay_loosevert_vert_glsl[];
 extern char datatoc_edit_curve_overlay_handle_vert_glsl[];
 extern char datatoc_edit_curve_overlay_handle_geom_glsl[];
 
-extern char datatoc_gpu_shader_3D_vert_glsl[];
 extern char datatoc_gpu_shader_point_varying_color_frag_glsl[];
 extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[];
 
@@ -62,43 +61,20 @@ extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[];
  * for EDIT_CURVE_PassList */
 
 typedef struct EDIT_CURVE_PassList {
-	/* Declare all passes here and init them in
-	 * EDIT_CURVE_cache_init().
-	 * Only contains (DRWPass *) */
 	struct DRWPass *wire_pass;
 	struct DRWPass *overlay_edge_pass;
 	struct DRWPass *overlay_vert_pass;
 } EDIT_CURVE_PassList;
 
-typedef struct EDIT_CURVE_FramebufferList {
-	/* Contains all framebuffer objects needed by this engine.
-	 * Only contains (GPUFrameBuffer *) */
-	struct GPUFrameBuffer *fb;
-} EDIT_CURVE_FramebufferList;
-
-typedef struct EDIT_CURVE_TextureList {
-	/* Contains all framebuffer textures / utility textures
-	 * needed by this engine. Only viewport specific textures
-	 * (not per object). Only contains (GPUTexture *) */
-	struct GPUTexture *texture;
-} EDIT_CURVE_TextureList;
-
 typedef struct EDIT_CURVE_StorageList {
-	/* Contains any other memory block that the engine needs.
-	 * Only directly MEM_(m/c)allocN'ed blocks because they are
-	 * free with MEM_freeN() when viewport is freed.
-	 * (not per object) */
 	struct CustomStruct *block;
 	struct EDIT_CURVE_PrivateData *g_data;
 } EDIT_CURVE_StorageList;
 
 typedef struct EDIT_CURVE_Data {
-	/* Struct returned by DRW_viewport_engine_data_ensure.
-	 * If you don't use one of these, just make it a (void *) */
-	// void *fbl;
 	void *engine_type; /* Required */
-	EDIT_CURVE_FramebufferList *fbl;
-	EDIT_CURVE_TextureList *txl;
+	DRWViewportEmptyList *fbl;
+	DRWViewportEmptyList *txl;
 	EDIT_CURVE_PassList *psl;
 	EDIT_CURVE_StorageList *stl;
 } EDIT_CURVE_Data;
@@ -106,22 +82,12 @@ typedef struct EDIT_CURVE_Data {
 /* *********** STATIC *********** */
 
 static struct {
-	/* Custom shaders :
-	 * Add sources to source/blender/draw/modes/shaders
-	 * init in EDIT_CURVE_engine_init();
-	 * free in EDIT_CURVE_engine_free(); */
-
 	GPUShader *wire_sh;
-
 	GPUShader *overlay_edge_sh;  /* handles and nurbs control cage */
 	GPUShader *overlay_vert_sh;
-
 } e_data = {NULL}; /* Engine data */
 
 typedef struct EDIT_CURVE_PrivateData {
-	/* This keeps the references of the shading groups for
-	 * easy access in EDIT_CURVE_cache_populate() */
-
 	/* resulting curve as 'wire' for curves (and optionally normals) */
 	DRWShadingGroup *wire_shgrp;
 
@@ -136,29 +102,8 @@ typedef struct EDIT_CURVE_PrivateData {
 /* Init Textures, Framebuffers, Storage and Shaders.
  * It is called for every frames.
  * (Optional) */
-static void EDIT_CURVE_engine_init(void *vedata)
+static void EDIT_CURVE_engine_init(void *UNUSED(vedata))
 {
-	EDIT_CURVE_TextureList *txl = ((EDIT_CURVE_Data *)vedata)->txl;
-	EDIT_CURVE_FramebufferList *fbl = ((EDIT_CURVE_Data *)vedata)->fbl;
-	EDIT_CURVE_StorageList *stl = ((EDIT_CURVE_Data *)vedata)->stl;
-
-	UNUSED_VARS(txl, fbl, stl);
-
-	/* Init Framebuffers like this: order is attachment order (for color texs) */
-	/*
-	 * DRWFboTexture tex[2] = {{&txl->depth, GPU_DEPTH_COMPONENT24, 0},
-	 *                         {&txl->color, GPU_RGBA8, DRW_TEX_FILTER}};
-	 */
-
-	/* DRW_framebuffer_init takes care of checking if
-	 * the framebuffer is valid and has the right size*/
-	/*
-	 * float *viewport_size = DRW_viewport_size_get();
-	 * DRW_framebuffer_init(&fbl->occlude_wire_fb,
-	 *                     (int)viewport_size[0], (int)viewport_size[1],
-	 *                     tex, 2);
-	 */
-
 	if (!e_data.wire_sh) {
 		e_data.wire_sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
 	}
@@ -227,19 +172,15 @@ static void EDIT_CURVE_cache_init(void *vedata)
 		DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1);
 		stl->g_data->overlay_vert_shgrp = grp;
 	}
-
 }
 
 /* Add geometry to shadingGroups. Execute for each objects */
 static void EDIT_CURVE_cache_populate(void *vedata, Object *ob)
 {
-	EDIT_CURVE_PassList *psl = ((EDIT_CURVE_Data *)vedata)->psl;
 	EDIT_CURVE_StorageList *stl = ((EDIT_CURVE_Data *)vedata)->stl;
 	const DRWContextState *draw_ctx = DRW_context_state_get();
 	View3D *v3d = draw_ctx->v3d;
 
-	UNUSED_VARS(psl, stl);
-
 	if (ob->type == OB_CURVE) {
 		if (BKE_object_is_in_editmode(ob)) {
 			Curve *cu = ob->data;
@@ -279,26 +220,22 @@ static void EDIT_CURVE_cache_populate(void *vedata, Object *ob)
 static void EDIT_CURVE_draw_scene(void *vedata)
 {
 	EDIT_CURVE_PassList *psl = ((EDIT_CURVE_Data *)vedata)->psl;
-	EDIT_CURVE_FramebufferList *fbl = ((EDIT_CURVE_Data *)vedata)->fbl;
 
 	/* Default framebuffer and texture */
 	DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
 	DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
 
-	UNUSED_VARS(fbl);
-
-	MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl);
+	if (!DRW_pass_is_empty(psl->wire_pass)) {
+		MULTISAMPLE_SYNC_ENABLE(dfbl, dtxl);
 
-	DRW_draw_pass(psl->wire_pass);
+		DRW_draw_pass(psl->wire_pass);
 
-	MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl)
+		MULTISAMPLE_SYNC_DISABLE(dfbl, dtxl)
+	}
 
 	/* Thoses passes don't write to depth and are AA'ed using other tricks. */
 	DRW_draw_pass(psl->overlay_edge_pass);
 	DRW_draw_pass(psl->overlay_vert_pass);
-
-	/* If you changed framebuffer, double check you rebind
-	 * the default one with its textures attached before finishing */
 }
 
 /* Cleanup when destroying the engine.
diff --git a/source/blender/draw/modes/edit_surface_mode.c b/source/blender/draw/modes/edit_surface_mode.c
deleted file mode 100644
index a011907cfcb..00000000000
--- a/source/blender/draw/modes/edit_surface_mode.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Copyright 2016, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Blender Institute
- *
- */
-
-/** \file blender/draw/modes/edit_surface_mode.c
- *  \ingroup draw
- */
-
-#include "DRW_engine.h"
-#include "DRW_render.h"
-
-/* If builtin shaders are needed */
-#include "GPU_shader.h"
-
-#include "draw_common.h"
-
-#include "draw_mode_engines.h"
-
-/* If needed, contains all global/Theme colors
- * Add needed theme colors / values to DRW_globals_update() and update UBO
- * Not needed for constant color. */
-extern struct GPUUniformBuffer *globals_ubo; /* draw_common.c */
-extern struct GlobalsUboStorage ts; /* draw_common.c */
-
-/* *********** LISTS *********** */
-/* All lists are per viewport specific datas.
- * They are all free when viewport changes engines
- * or is free itself. Use EDIT_SURFACE_engine_init() to
- * initialize most of them and EDIT_SURFACE_cache_init()
- * for EDIT_SURFACE_PassList */
-
-typedef struct EDIT_SURFACE_PassList {
-	/* Declare all passes here and init them in
-	 * EDIT_SURFACE_cache_init().
-	 * Only contains (DRWPass *) */
-	struct DRWPass *pass;
-} EDIT_SURFACE_PassList;
-
-typedef struct EDIT_SURFACE_FramebufferList {
-	/* Contains all framebuffer objects needed by this engine.
-	 * Only contains (GPUFrameBuffer *) */
-	struct GPUFrameBuffer *fb;
-} EDIT_SURFACE_FramebufferList;
-
-typedef struct EDIT_SURFACE_TextureList {
-	/* Contains all framebuffer textures / utility textures
-	 * needed by this engine. Only viewport specific textures
-	 * (not per object). Only contains (GPUTexture *) */
-	struct GPUTexture *texture;
-} EDIT_SURFACE_TextureList;
-
-typedef struct EDIT_SURFACE_StorageList {
-	/* Contains any other memory block that the engine needs.
-	 * Only directly MEM_(m/c)allocN'ed blocks because they are
-	 * free with MEM_freeN() when viewport is freed.
-	 * (not per 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list