Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Wed, 23 Aug 2017 15:07:09 +0000 (01:07 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 23 Aug 2017 15:07:09 +0000 (01:07 +1000)
12 files changed:
intern/atomic/atomic_ops.h
intern/atomic/intern/atomic_ops_ext.h
intern/cycles/bvh/bvh_build.cpp
intern/cycles/bvh/bvh_node.cpp
intern/cycles/bvh/bvh_node.h
intern/cycles/render/graph.cpp
intern/cycles/util/util_atomic.h
intern/cycles/util/util_stats.h
intern/guardedalloc/intern/mallocn_lockfree_impl.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/windowmanager/intern/wm_files.c
source/blenderplayer/bad_level_call_stubs/stubs.c

index 1e9528f9ed9eec093f5bbe07e80617ed22ec1ca6..72813c39ac20c672f19c78cc419a969859b9ea8a 100644 (file)
@@ -100,6 +100,7 @@ ATOMIC_INLINE size_t atomic_sub_and_fetch_z(size_t *p, size_t x);
 ATOMIC_INLINE size_t atomic_fetch_and_add_z(size_t *p, size_t x);
 ATOMIC_INLINE size_t atomic_fetch_and_sub_z(size_t *p, size_t x);
 ATOMIC_INLINE size_t atomic_cas_z(size_t *v, size_t old, size_t _new);
+ATOMIC_INLINE size_t atomic_fetch_and_update_max_z(size_t *p, size_t x); /* Uses CAS loop, see warning below. */
 
 ATOMIC_INLINE unsigned int atomic_add_and_fetch_u(unsigned int *p, unsigned int x);
 ATOMIC_INLINE unsigned int atomic_sub_and_fetch_u(unsigned int *p, unsigned int x);
index b72c94563fc5c69e5e2b5b08fcce8a3844318637..8d5f2e5dad7ca7240775674ac0a307e522453fcd 100644 (file)
@@ -111,6 +111,17 @@ ATOMIC_INLINE size_t atomic_cas_z(size_t *v, size_t old, size_t _new)
 #endif
 }
 
+ATOMIC_INLINE size_t atomic_fetch_and_update_max_z(size_t *p, size_t x)
+{
+       size_t prev_value;
+       while((prev_value = *p) < x) {
+               if(atomic_cas_z(p, prev_value, x) == prev_value) {
+                       break;
+               }
+       }
+       return prev_value;
+}
+
 /******************************************************************************/
 /* unsigned operations. */
 ATOMIC_INLINE unsigned int atomic_add_and_fetch_u(unsigned int *p, unsigned int x)
index eb1d89729fbfe30a26dba7711067e458f73d86e2..d70988065690f9fb8ba1d57acf7241269aca99c6 100644 (file)
@@ -529,7 +529,9 @@ BVHNode* BVHBuild::run()
                                << "  Allocation slop factor: "
                                       << ((prim_type.capacity() != 0)
                                               ? (float)prim_type.size() / prim_type.capacity()
-                                              : 1.0f) << "\n";
+                                              : 1.0f) << "\n"
+                               << "  Maximum depth: "
+                               << string_human_readable_number(rootnode->getSubtreeSize(BVH_STAT_DEPTH))  << "\n";
                }
        }
 
index 4237c62ab5b58b8e58de44bbe49da015dc024f12..ab6df4d265d6074944571f80bc2aede939c06333 100644 (file)
@@ -132,6 +132,17 @@ int BVHNode::getSubtreeSize(BVH_STAT stat) const
                case BVH_STAT_UNALIGNED_LEAF_COUNT:
                        cnt = (is_leaf() && is_unaligned) ? 1 : 0;
                        break;
+               case BVH_STAT_DEPTH:
+                       if(is_leaf()) {
+                               cnt = 1;
+                       }
+                       else {
+                               for(int i = 0; i < num_children(); i++) {
+                                       cnt = max(cnt, get_child(i)->getSubtreeSize(stat));
+                               }
+                               cnt += 1;
+                       }
+                       return cnt;
                default:
                        assert(0); /* unknown mode */
        }
index 1c875f5a52454de2d55d154f095d95a19b62096d..94cf5ab730c2e2353817a23243ee222c02bf515f 100644 (file)
@@ -38,6 +38,7 @@ enum BVH_STAT {
        BVH_STAT_UNALIGNED_INNER_QNODE_COUNT,
        BVH_STAT_ALIGNED_LEAF_COUNT,
        BVH_STAT_UNALIGNED_LEAF_COUNT,
+       BVH_STAT_DEPTH,
 };
 
 class BVHParams;
index 41e7e0205b00eae45e5209a8efa68cf6d2313c2c..08203163d1af6c4c1f4090cfe3bce399f78e57f1 100644 (file)
@@ -1018,6 +1018,9 @@ int ShaderGraph::get_num_closures()
                else if(CLOSURE_IS_PRINCIPLED(closure_type)) {
                        num_closures += 8;
                }
+               else if(CLOSURE_IS_VOLUME(closure_type)) {
+                       num_closures += VOLUME_STACK_SIZE;
+               }
                else {
                        ++num_closures;
                }
index 643af87a65f3c56e07ddc01f0b9fc0041d39a213..f3c7ae546a0ace4aec938eb394da306255b86fdd 100644 (file)
 /* Using atomic ops header from Blender. */
 #include "atomic_ops.h"
 
-ATOMIC_INLINE void atomic_update_max_z(size_t *maximum_value, size_t value)
-{
-       size_t prev_value = *maximum_value;
-       while(prev_value < value) {
-               if(atomic_cas_z(maximum_value, prev_value, value) != prev_value) {
-                       break;
-               }
-       }
-}
-
 #define atomic_add_and_fetch_float(p, x) atomic_add_and_fetch_fl((p), (x))
 
 #define atomic_fetch_and_inc_uint32(p) atomic_fetch_and_add_uint32((p), 1)
index baba549753d03dd076e14f05be771c8e45c94966..7667f58eb7d3da070da62454d4604b2d4a409b57 100644 (file)
@@ -30,7 +30,7 @@ public:
 
        void mem_alloc(size_t size) {
                atomic_add_and_fetch_z(&mem_used, size);
-               atomic_update_max_z(&mem_peak, mem_used);
+               atomic_fetch_and_update_max_z(&mem_peak, mem_used);
        }
 
        void mem_free(size_t size) {
index b4838cdca182d12b8ac5452438697e62b1fb3423..66573b91acec813297bb65f4650727dc416b74fb 100644 (file)
@@ -76,12 +76,7 @@ enum {
 MEM_INLINE void update_maximum(size_t *maximum_value, size_t value)
 {
 #ifdef USE_ATOMIC_MAX
-       size_t prev_value = *maximum_value;
-       while (prev_value < value) {
-               if (atomic_cas_z(maximum_value, prev_value, value) != prev_value) {
-                       break;
-               }
-       }
+       atomic_fetch_and_update_max_z(maximum_value, value);
 #else
        *maximum_value = value > *maximum_value ? value : *maximum_value;
 #endif
index fd29658061efbd0b038b082a9f89637548b03437..4dda0f515227de3c8b22d0fa5f1f97f8ac3ef25a 100644 (file)
@@ -1681,7 +1681,7 @@ static int ndof_orbit_invoke(bContext *C, wmOperator *op, const wmEvent *event)
                viewops_data_alloc(C, op);
                viewops_data_create_ex(
                        C, op, event,
-                       viewops_orbit_mode_ex((U.uiflag & USER_ORBIT_SELECTION) != 0, false), false);
+                       false, viewops_orbit_mode_ex((U.uiflag & USER_ORBIT_SELECTION) != 0, false));
                vod = op->customdata;
 
                ED_view3d_smooth_view_force_finish(C, vod->v3d, vod->ar);
@@ -1750,7 +1750,7 @@ static int ndof_orbit_zoom_invoke(bContext *C, wmOperator *op, const wmEvent *ev
                viewops_data_alloc(C, op);
                viewops_data_create_ex(
                        C, op, event,
-                       viewops_orbit_mode_ex((U.uiflag & USER_ORBIT_SELECTION) != 0, false), false);
+                       false, viewops_orbit_mode_ex((U.uiflag & USER_ORBIT_SELECTION) != 0, false));
 
                vod = op->customdata;
 
index 784cdcc97dda4a63c3f7181d9769dac74fb55252..3de6824c23df669e6e2475b58235c6f4b6d53adf 100644 (file)
@@ -746,13 +746,13 @@ int wm_homefile_read(
 
        if ((app_template != NULL) && (app_template[0] != '\0')) {
                BKE_appdir_app_template_id_search(app_template, app_template_system, sizeof(app_template_system));
-               BLI_path_join(app_template_config, sizeof(app_template_config), cfgdir, app_template, NULL);
 
                /* Insert template name into startup file. */
 
                /* note that the path is being set even when 'use_factory_settings == true'
                 * this is done so we can load a templates factory-settings */
                if (!use_factory_settings) {
+                       BLI_path_join(app_template_config, sizeof(app_template_config), cfgdir, app_template, NULL);
                        BLI_path_join(filepath_startup, sizeof(filepath_startup), app_template_config, BLENDER_STARTUP_FILE, NULL);
                        if (BLI_access(filepath_startup, R_OK) != 0) {
                                filepath_startup[0] = '\0';
index 21b4b0def3955b074bd7068daa8c4482eef466a1..c847524359a9f679f239eeba88b2bb76215bf863 100644 (file)
@@ -788,6 +788,7 @@ void WM_operatortype_append_ptr(void (*opfunc)(struct wmOperatorType *, void *),
 void WM_operatortype_append_macro_ptr(void (*opfunc)(struct wmOperatorType *, void *), void *userdata) RET_NONE
 void WM_operator_bl_idname(char *to, const char *from) RET_NONE
 void WM_operator_py_idname(char *to, const char *from) RET_NONE
+bool WM_operator_py_idname_ok_or_report(struct ReportList *reports, const char *classname, const char *idname) RET_ZERO
 int WM_operator_ui_popup(struct bContext *C, struct wmOperator *op, int width, int height) RET_ZERO
 void update_autoflags_fcurve(struct FCurve *fcu, struct bContext *C, struct ReportList *reports, struct PointerRNA *ptr) RET_NONE
 short insert_keyframe(struct ReportList *reports, struct ID *id, struct bAction *act, const char group[], const char rna_path[], int array_index, float cfra, char keytype, short flag) RET_ZERO