Commit: 4d0f7c320c29bcb5dcf4435a0740822d00d35493
Author: Sergey Sharybin
Date:   Tue Nov 8 17:54:14 2016 +0100
Branches: master
https://developer.blender.org/rB4d0f7c320c29bcb5dcf4435a0740822d00d35493

Depsgraph: Use atomics to tag ID when evaluating driver

This is required since new dependency graph evaluates drivers in threads
so it was possible to have some partially written ID tag there.

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

M       source/blender/blenkernel/BKE_library.h
M       source/blender/blenkernel/intern/anim_sys.c
M       source/blender/blenkernel/intern/library.c

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

diff --git a/source/blender/blenkernel/BKE_library.h 
b/source/blender/blenkernel/BKE_library.h
index 79373e3..1cc7014 100644
--- a/source/blender/blenkernel/BKE_library.h
+++ b/source/blender/blenkernel/BKE_library.h
@@ -129,6 +129,8 @@ void BKE_library_make_local(
         struct Main *bmain, const struct Library *lib, struct GHash 
*old_to_new_ids,
         const bool untagged_only, const bool set_fake);
 
+void BKE_id_tag_set_atomic(struct ID *id, int tag);
+void BKE_id_tag_clear_atomic(struct ID *id, int tag);
 
 /* use when "" is given to new_id() */
 #define ID_FALLBACK_NAME N_("Untitled")
diff --git a/source/blender/blenkernel/intern/anim_sys.c 
b/source/blender/blenkernel/intern/anim_sys.c
index e3764ad..a5abc6b 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1657,7 +1657,7 @@ static bool animsys_write_rna_setting(PathResolvedRNA 
*anim_rna, const float val
                /* for cases like duplifarmes it's only a temporary so don't
                 * notify anyone of updates */
                if (!(id->tag & LIB_TAG_ANIM_NO_RECALC)) {
-                       id->tag |= LIB_TAG_ID_RECALC;
+                       BKE_id_tag_set_atomic(id, LIB_TAG_ID_RECALC);
                        DAG_id_type_tag(G.main, GS(id->name));
                }
        }
diff --git a/source/blender/blenkernel/intern/library.c 
b/source/blender/blenkernel/intern/library.c
index 5d28a84..5d23788 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -129,6 +129,8 @@
 #include "IMB_imbuf.h"
 #include "IMB_imbuf_types.h"
 
+#include "atomic_ops.h"
+
 /* GS reads the memory pointed at in a specific ordering. 
  * only use this definition, makes little and big endian systems
  * work fine, in conjunction with MAKE_ID */
@@ -1895,3 +1897,13 @@ void BKE_library_filepath_set(Library *lib, const char 
*filepath)
                BLI_path_abs(lib->filepath, basepath);
        }
 }
+
+void BKE_id_tag_set_atomic(ID *id, int tag)
+{
+       atomic_fetch_and_or_uint32((uint32_t *)&id->tag, tag);
+}
+
+void BKE_id_tag_clear_atomic(ID *id, int tag)
+{
+       atomic_fetch_and_and_uint32((uint32_t *)&id->tag, ~tag);
+}

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to