Revision: 59529 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59529 Author: nazgul Date: 2013-08-26 15:10:22 +0000 (Mon, 26 Aug 2013) Log Message: ----------- Merging r59513 through r59528 from trunk into soc-2013-depsgraph_mt
Revision Links: -------------- http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59513 http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59528 Modified Paths: -------------- branches/soc-2013-depsgraph_mt/build_files/cmake/macros.cmake branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/BLI_ghash.c branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/edgehash.c branches/soc-2013-depsgraph_mt/source/blender/editors/datafiles/CMakeLists.txt branches/soc-2013-depsgraph_mt/source/blender/editors/interface/interface_widgets.c branches/soc-2013-depsgraph_mt/source/blender/editors/space_view3d/drawobject.c branches/soc-2013-depsgraph_mt/source/blender/makesdna/DNA_object_types.h branches/soc-2013-depsgraph_mt/source/blender/makesrna/intern/rna_scene.c branches/soc-2013-depsgraph_mt/source/blender/modifiers/intern/MOD_boolean_util.c branches/soc-2013-depsgraph_mt/source/blender/modifiers/intern/MOD_boolean_util.h Property Changed: ---------------- branches/soc-2013-depsgraph_mt/ branches/soc-2013-depsgraph_mt/source/blender/editors/interface/interface.c branches/soc-2013-depsgraph_mt/source/blender/editors/space_outliner/ Property changes on: branches/soc-2013-depsgraph_mt ___________________________________________________________________ Modified: svn:mergeinfo - /branches/ge_dev:58091-58422 /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794 /branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439 /branches/soc-2011-tomato:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151-44152,44229-44230,45623-45625,46037,48089,48092,48551-48552,48679,48790,48792-48793,49076,49087,49292,49294,49466,49894,50052,50126,52854-52856,54573,58822,58989 /branches/soc-2013-dingto:57424,57487,57507,57525,57599,57670,57918-57919,57981,58091,58245,58253,58587,58772,58774-58775,58828,58835,59032 /tags/blender-2.67b-release/blender:57122 /trunk/blender:57395-59512 + /branches/ge_dev:58091-58422 /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794 /branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439 /branches/soc-2011-tomato:42376,42378-42379,42383,42385,42395,42397-42400,42407,42411,42418,42443-42444,42446,42467,42472,42486,42650-42652,42654-42655,42709-42710,42733-42734,42801,43872,44130,44141,44147-44149,44151-44152,44229-44230,45623-45625,46037,48089,48092,48551-48552,48679,48790,48792-48793,49076,49087,49292,49294,49466,49894,50052,50126,52854-52856,54573,58822,58989 /branches/soc-2013-dingto:57424,57487,57507,57525,57599,57670,57918-57919,57981,58091,58245,58253,58587,58772,58774-58775,58828,58835,59032 /tags/blender-2.67b-release/blender:57122 /trunk/blender:57395-59528 Modified: branches/soc-2013-depsgraph_mt/build_files/cmake/macros.cmake =================================================================== --- branches/soc-2013-depsgraph_mt/build_files/cmake/macros.cmake 2013-08-26 15:02:17 UTC (rev 59528) +++ branches/soc-2013-depsgraph_mt/build_files/cmake/macros.cmake 2013-08-26 15:10:22 UTC (rev 59529) @@ -802,6 +802,7 @@ endmacro() +# XXX Not used for now... macro(svg_to_png file_from file_to @@ -818,6 +819,15 @@ mark_as_advanced(INKSCAPE_EXE) if(INKSCAPE_EXE) + if(APPLE) + # in OS X app bundle, the binary is a shim that doesn't take any + # command line arguments, replace it with the actual binary + string(REPLACE "MacOS/Inkscape" "Resources/bin/inkscape" INKSCAPE_REAL_EXE ${INKSCAPE_EXE}) + if(EXISTS "${INKSCAPE_REAL_EXE}") + set(INKSCAPE_EXE ${INKSCAPE_REAL_EXE}) + endif() + endif() + add_custom_command( OUTPUT ${_file_to} COMMAND ${INKSCAPE_EXE} ${_file_from} --export-dpi=${dpi} --without-gui --export-png=${_file_to} @@ -830,4 +840,4 @@ unset(_file_from) unset(_file_to) -endmacro() \ No newline at end of file +endmacro() Modified: branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/BLI_ghash.c =================================================================== --- branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/BLI_ghash.c 2013-08-26 15:02:17 UTC (rev 59528) +++ branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/BLI_ghash.c 2013-08-26 15:10:22 UTC (rev 59529) @@ -98,6 +98,14 @@ * \{ */ /** + * Get the hash for a key. + */ +BLI_INLINE unsigned int ghash_keyhash(GHash *gh, const void *key) +{ + return gh->hashfp(key) % gh->nbuckets; +} + +/** * Check if the number of items in the GHash is large enough to require more buckets. */ BLI_INLINE bool ghash_test_expand_buckets(const unsigned int nentries, const unsigned int nbuckets) @@ -106,21 +114,43 @@ } /** - * Increase initial bucket size to match a reserved ammount. + * Expand buckets to the next size up. */ -BLI_INLINE void ghash_buckets_reserve(GHash *gh, const unsigned int nentries_reserve) +BLI_INLINE void ghash_resize_buckets(GHash *gh, const unsigned int nbuckets) { - while (ghash_test_expand_buckets(nentries_reserve, gh->nbuckets)) { - gh->nbuckets = hashsizes[++gh->cursize]; + Entry **buckets_old = gh->buckets; + Entry **buckets_new; + const unsigned int nbuckets_old = gh->nbuckets; + unsigned int i; + Entry *e; + + BLI_assert(gh->nbuckets != nbuckets); + + gh->nbuckets = nbuckets; + buckets_new = (Entry **)MEM_callocN(gh->nbuckets * sizeof(*gh->buckets), "buckets"); + + for (i = 0; i < nbuckets_old; i++) { + Entry *e_next; + for (e = buckets_old[i]; e; e = e_next) { + const unsigned hash = ghash_keyhash(gh, e->key); + e_next = e->next; + e->next = buckets_new[hash]; + buckets_new[hash] = e; + } } + + gh->buckets = buckets_new; + MEM_freeN(buckets_old); } /** - * Get the hash for a key. + * Increase initial bucket size to match a reserved ammount. */ -BLI_INLINE unsigned int ghash_keyhash(GHash *gh, const void *key) +BLI_INLINE void ghash_buckets_reserve(GHash *gh, const unsigned int nentries_reserve) { - return gh->hashfp(key) % gh->nbuckets; + while (ghash_test_expand_buckets(nentries_reserve, gh->nbuckets)) { + gh->nbuckets = hashsizes[++gh->cursize]; + } } /** @@ -133,7 +163,7 @@ Entry *e; for (e = gh->buckets[hash]; e; e = e->next) { - if (gh->cmpfp(key, e->key) == 0) { + if (UNLIKELY(gh->cmpfp(key, e->key) == 0)) { return e; } } @@ -178,41 +208,45 @@ * Internal insert function. * Takes a hash argument to avoid calling #ghash_keyhash multiple times. */ -static Entry *ghash_insert_ex(GHash *gh, void *key, - unsigned int hash) +BLI_INLINE void ghash_insert_ex(GHash *gh, void *key, void *val, + unsigned int hash) { Entry *e = (Entry *)BLI_mempool_alloc(gh->entrypool); - BLI_assert((gh->flag & GHASH_FLAG_ALLOW_DUPES) || (BLI_ghash_haskey(gh, key) == 0)); + IS_GHASH_ASSERT(gh); e->next = gh->buckets[hash]; e->key = key; - /* intentionally don't set the value */ + e->val = val; gh->buckets[hash] = e; if (UNLIKELY(ghash_test_expand_buckets(++gh->nentries, gh->nbuckets))) { - Entry *e_iter; - Entry **old = gh->buckets; - const unsigned nold = gh->nbuckets; - unsigned int i; + ghash_resize_buckets(gh, hashsizes[++gh->cursize]); + } +} - gh->nbuckets = hashsizes[++gh->cursize]; - gh->buckets = (Entry **)MEM_callocN(gh->nbuckets * sizeof(*gh->buckets), "buckets"); +/** + * Insert function that doesn't set the value (use for GSet) + */ +BLI_INLINE void ghash_insert_ex_keyonly(GHash *gh, void *key, + unsigned int hash) +{ + Entry *e = (Entry *)BLI_mempool_alloc(gh->entrypool); + BLI_assert((gh->flag & GHASH_FLAG_ALLOW_DUPES) || (BLI_ghash_haskey(gh, key) == 0)); + e->next = gh->buckets[hash]; + e->key = key; + /* intentionally leave value unset */ + gh->buckets[hash] = e; - for (i = 0; i < nold; i++) { - Entry *e_next; - for (e_iter = old[i]; e_iter; e_iter = e_next) { - e_next = e_iter->next; - hash = ghash_keyhash(gh, e_iter->key); - e_iter->next = gh->buckets[hash]; - gh->buckets[hash] = e_iter; - } - } - - MEM_freeN(old); + if (UNLIKELY(ghash_test_expand_buckets(++gh->nentries, gh->nbuckets))) { + ghash_resize_buckets(gh, hashsizes[++gh->cursize]); } +} - return e; +BLI_INLINE void ghash_insert(GHash *gh, void *key, void *val) +{ + const unsigned int hash = ghash_keyhash(gh, key); + return ghash_insert_ex(gh, key, val, hash); } /** @@ -225,7 +259,7 @@ Entry *e_prev = NULL; for (e = gh->buckets[hash]; e; e = e->next) { - if (gh->cmpfp(key, e->key) == 0) { + if (UNLIKELY(gh->cmpfp(key, e->key) == 0)) { Entry *e_next = e->next; if (keyfreefp) keyfreefp(e->key); @@ -314,9 +348,7 @@ */ void BLI_ghash_insert(GHash *gh, void *key, void *val) { - const unsigned int hash = ghash_keyhash(gh, key); - Entry *e = ghash_insert_ex(gh, key, hash); - e->val = val; + ghash_insert(gh, key, val); } /** @@ -338,8 +370,7 @@ return false; } else { - e = ghash_insert_ex(gh, key, hash); - e->val = val; + ghash_insert_ex(gh, key, val, hash); return true; } } @@ -811,7 +842,7 @@ void BLI_gset_insert(GSet *gs, void *key) { const unsigned int hash = ghash_keyhash((GHash *)gs, key); - ghash_insert_ex((GHash *)gs, key, hash); + ghash_insert_ex_keyonly((GHash *)gs, key, hash); } /** @@ -830,7 +861,7 @@ return false; } else { - ghash_insert_ex((GHash *)gs, key, hash); + ghash_insert_ex_keyonly((GHash *)gs, key, hash); return true; } } Modified: branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/edgehash.c =================================================================== --- branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/edgehash.c 2013-08-26 15:02:17 UTC (rev 59528) +++ branches/soc-2013-depsgraph_mt/source/blender/blenlib/intern/edgehash.c 2013-08-26 15:10:22 UTC (rev 59529) @@ -95,12 +95,55 @@ /** \name Internal Utility API * \{ */ +/** + * Get the hash for a key. + */ +BLI_INLINE unsigned int edgehash_keyhash(EdgeHash *eh, unsigned int v0, unsigned int v1) +{ + BLI_assert(v0 < v1); + + return ((v0 * 39) ^ (v1 * 31)) % eh->nbuckets; +} + +/** + * Check if the number of items in the GHash is large enough to require more buckets. + */ BLI_INLINE bool edgehash_test_expand_buckets(const unsigned int nentries, const unsigned int nbuckets) { return (nentries > nbuckets * 3); } /** + * Expand buckets to the next size up. + */ +BLI_INLINE void edgehash_resize_buckets(EdgeHash *eh, const unsigned int nbuckets) +{ + EdgeEntry **buckets_old = eh->buckets; + EdgeEntry **buckets_new; + const unsigned int nbuckets_old = eh->nbuckets; + unsigned int i; + EdgeEntry *e; + + BLI_assert(eh->nbuckets != nbuckets); + + eh->nbuckets = nbuckets; + buckets_new = MEM_callocN(eh->nbuckets * sizeof(*eh->buckets), "eh buckets"); + + for (i = 0; i < nbuckets_old; i++) { + EdgeEntry *e_next; + for (e = buckets_old[i]; e; e = e_next) { + const unsigned hash = edgehash_keyhash(eh, e->v0, e->v1); + e_next = e->next; + e->next = buckets_new[hash]; + buckets_new[hash] = e; + } + } + + eh->buckets = buckets_new; + MEM_freeN(buckets_old); +} + +/** * Increase initial bucket size to match a reserved ammount. */ BLI_INLINE void edgehash_buckets_reserve(EdgeHash *eh, const unsigned int nentries_reserve) @@ -110,26 +153,26 @@ } } @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs