[Bf-blender-cvs] [ed3f05aca9a] master: DRW: Fix threading hazard when rendering and using auto depth

Clément Foucault noreply at git.blender.org
Tue May 14 11:01:31 CEST 2019


Commit: ed3f05aca9a9cb66c166d3f9531268b389386cdf
Author: Clément Foucault
Date:   Sat May 11 19:13:54 2019 +0200
Branches: master
https://developer.blender.org/rBed3f05aca9a9cb66c166d3f9531268b389386cdf

DRW: Fix threading hazard when rendering and using auto depth

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

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

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

diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 4010d922c84..1d215dcefe1 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -2453,8 +2453,6 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
  */
 static void drw_draw_depth_loop_imp(void)
 {
-  DRW_opengl_context_enable();
-
   /* Setup framebuffer */
   DefaultFramebufferList *fbl = (DefaultFramebufferList *)GPU_viewport_framebuffer_list_get(
       DST.viewport);
@@ -2517,9 +2515,6 @@ static void drw_draw_depth_loop_imp(void)
   /* TODO: Reading depth for operators should be done here. */
 
   GPU_framebuffer_restore();
-
-  /* Changin context */
-  DRW_opengl_context_disable();
 }
 
 /**
@@ -2535,6 +2530,8 @@ void DRW_draw_depth_loop(struct Depsgraph *depsgraph,
   ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
   RegionView3D *rv3d = ar->regiondata;
 
+  DRW_opengl_context_enable();
+
   /* Reset before using it. */
   drw_state_prepare_clean_for_draw(&DST);
 
@@ -2569,6 +2566,9 @@ void DRW_draw_depth_loop(struct Depsgraph *depsgraph,
   /* Avoid accidental reuse. */
   drw_state_ensure_not_reused(&DST);
 #endif
+
+  /* Changin context */
+  DRW_opengl_context_disable();
 }
 
 /**
@@ -2583,6 +2583,8 @@ void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph,
   ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph);
   RegionView3D *rv3d = ar->regiondata;
 
+  DRW_opengl_context_enable();
+
   /* Reset before using it. */
   drw_state_prepare_clean_for_draw(&DST);
 
@@ -2608,6 +2610,9 @@ void DRW_draw_depth_loop_gpencil(struct Depsgraph *depsgraph,
   /* Avoid accidental reuse. */
   drw_state_ensure_not_reused(&DST);
 #endif
+
+  /* Changin context */
+  DRW_opengl_context_disable();
 }
 
 /**



More information about the Bf-blender-cvs mailing list