[Bf-blender-cvs] [fd14d1ccebd] master: DRW: Avoid undefined behavior when running multiple iteration

Clément Foucault noreply at git.blender.org
Fri Jun 12 14:07:01 CEST 2020


Commit: fd14d1ccebd4dd8a04561cae16cd0e3e778b4377
Author: Clément Foucault
Date:   Fri Jun 12 14:06:36 2020 +0200
Branches: master
https://developer.blender.org/rBfd14d1ccebd4dd8a04561cae16cd0e3e778b4377

DRW: Avoid undefined behavior when running multiple iteration

This was caused by DST.dupli_origin not being reset properly. This had
not effect in master but has effect in EEVEE motion blur branch.

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

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 e7dff422105..2ba766f4729 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1467,6 +1467,7 @@ void DRW_draw_render_loop_ex(struct Depsgraph *depsgraph,
 
     /* Only iterate over objects for internal engines or when overlays are enabled */
     if (do_populate_loop) {
+      DST.dupli_origin = NULL;
       DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN (depsgraph, ob) {
         if ((object_type_exclude_viewport & (1 << ob->type)) != 0) {
           continue;
@@ -1864,6 +1865,7 @@ void DRW_render_object_iter(
   const int object_type_exclude_viewport = draw_ctx->v3d ?
                                                draw_ctx->v3d->object_type_exclude_viewport :
                                                0;
+  DST.dupli_origin = NULL;
   DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN (depsgraph, ob) {
     if ((object_type_exclude_viewport & (1 << ob->type)) == 0) {
       DST.dupli_parent = data_.dupli_parent;
@@ -2121,6 +2123,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
       const int object_type_exclude_select = (v3d->object_type_exclude_viewport |
                                               v3d->object_type_exclude_select);
       bool filter_exclude = false;
+      DST.dupli_origin = NULL;
       DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN (depsgraph, ob) {
         if (!BKE_object_is_visible_in_viewport(v3d, ob)) {
           continue;
@@ -2271,6 +2274,7 @@ static void drw_draw_depth_loop_imp(struct Depsgraph *depsgraph,
     drw_engines_world_update(DST.draw_ctx.scene);
 
     const int object_type_exclude_viewport = v3d->object_type_exclude_viewport;
+    DST.dupli_origin = NULL;
     DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN (DST.draw_ctx.depsgraph, ob) {
       if ((object_type_exclude_viewport & (1 << ob->type)) != 0) {
         continue;



More information about the Bf-blender-cvs mailing list