[Bf-blender-cvs] [711c4bba54b] draw-colormanagement: Cleanup: DRW: Remove unused code and redundant state changes

Clément Foucault noreply at git.blender.org
Fri Jan 31 04:22:25 CET 2020


Commit: 711c4bba54b3f07c2c5c553d7fc8678dee4a87db
Author: Clément Foucault
Date:   Fri Jan 31 04:18:28 2020 +0100
Branches: draw-colormanagement
https://developer.blender.org/rB711c4bba54b3f07c2c5c553d7fc8678dee4a87db

Cleanup: DRW: Remove unused code and redundant state changes

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

M	source/blender/draw/intern/draw_manager.c
M	source/blender/draw/intern/draw_view.c

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

diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 3271aa6bc80..39dd1a8be71 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1294,7 +1294,7 @@ void DRW_draw_callbacks_post_scene(void)
 
     GPU_depth_test(false);
     ED_region_draw_cb_draw(DST.draw_ctx.evil_C, DST.draw_ctx.ar, REGION_DRAW_POST_VIEW);
-    GPU_depth_test(true);
+
     /* Callback can be nasty and do whatever they want with the state.
      * Don't trust them! */
     DRW_state_reset();
@@ -1307,7 +1307,6 @@ void DRW_draw_callbacks_post_scene(void)
 
     GPU_depth_test(false);
     drw_engines_draw_text();
-    GPU_depth_test(true);
 
     DRW_draw_region_info();
 
@@ -1317,7 +1316,6 @@ void DRW_draw_callbacks_post_scene(void)
       GPU_depth_test(false);
       /* XXX: as scene->gpd is not copied for COW yet */
       ED_annotation_draw_view3d(DEG_get_input_scene(depsgraph), depsgraph, v3d, ar, false);
-      GPU_depth_test(true);
     }
 
     if ((v3d->gizmo_flag & V3D_GIZMO_HIDE) == 0) {
@@ -1325,7 +1323,6 @@ void DRW_draw_callbacks_post_scene(void)
        * 'DRW_draw_region_info' sets the projection in pixel-space. */
       GPU_depth_test(false);
       DRW_draw_gizmo_2d();
-      GPU_depth_test(true);
     }
 
     if (G.debug_value > 20 && G.debug_value < 30) {
@@ -1333,8 +1330,9 @@ void DRW_draw_callbacks_post_scene(void)
       /* local coordinate visible rect inside region, to accommodate overlapping ui */
       const rcti *rect = ED_region_visible_rect(DST.draw_ctx.ar);
       DRW_stats_draw(rect);
-      GPU_depth_test(true);
     }
+
+    GPU_depth_test(true);
   }
 }
 
diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c
index 6fe7f58ae69..80a7760a571 100644
--- a/source/blender/draw/intern/draw_view.c
+++ b/source/blender/draw/intern/draw_view.c
@@ -57,61 +57,6 @@ void DRW_draw_region_info(void)
   view3d_draw_region_info(draw_ctx->evil_C, ar);
 }
 
-/* ************************* Background ************************** */
-void DRW_clear_background()
-{
-  GPU_clear_color(0.0, 0.0, 0.0, 0.0);
-  GPU_clear(GPU_COLOR_BIT | GPU_DEPTH_BIT | GPU_STENCIL_BIT);
-}
-
-void DRW_draw_background(bool do_alpha_checker)
-{
-  drw_state_set(DRW_STATE_WRITE_COLOR);
-  if (do_alpha_checker) {
-    /* Transparent render, do alpha checker. */
-    GPU_matrix_push();
-    GPU_matrix_identity_set();
-    GPU_matrix_identity_projection_set();
-
-    imm_draw_box_checker_2d(-1.0f, -1.0f, 1.0f, 1.0f);
-
-    GPU_matrix_pop();
-  }
-  else {
-    float m[4][4];
-    unit_m4(m);
-
-    GPUVertFormat *format = immVertexFormat();
-    uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
-    uint color = GPU_vertformat_attr_add(
-        format, "color", GPU_COMP_U8, 3, GPU_FETCH_INT_TO_FLOAT_UNIT);
-    uchar col_hi[3], col_lo[3];
-
-    GPU_matrix_push();
-    GPU_matrix_identity_set();
-    GPU_matrix_projection_set(m);
-
-    immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR_DITHER);
-
-    UI_GetThemeColor3ubv(TH_BACK, col_hi);
-    UI_GetThemeColor3ubv(UI_GetThemeValue(TH_SHOW_BACK_GRAD) ? TH_BACK_GRAD : TH_BACK, col_lo);
-
-    immBegin(GPU_PRIM_TRI_FAN, 4);
-    immAttr3ubv(color, col_lo);
-    immVertex2f(pos, -1.0f, -1.0f);
-    immVertex2f(pos, 1.0f, -1.0f);
-
-    immAttr3ubv(color, col_hi);
-    immVertex2f(pos, 1.0f, 1.0f);
-    immVertex2f(pos, -1.0f, 1.0f);
-    immEnd();
-
-    immUnbindProgram();
-
-    GPU_matrix_pop();
-  }
-}
-
 /* **************************** 3D Cursor ******************************** */
 
 static bool is_cursor_visible(const DRWContextState *draw_ctx, Scene *scene, ViewLayer *view_layer)



More information about the Bf-blender-cvs mailing list