Commit Graph

9031 Commits

Author SHA1 Message Date
683db783d0 Make fonts safe(r) for threading
Getting vfont data wasn't safe for threading, because it
was modifying font data which is in bmain and could be
shared by multiple objects.

For now made it so getting vfont uses critical section,
meaning vfont->data is initializing from inside a locked
mutex.
2013-07-11 09:15:19 +00:00
ac0638f681 Merging r58148 through r58165 from trunk into soc-2013-depsgraph_mt 2013-07-11 08:25:37 +00:00
991459d0ce fix [#36090] Blender displays strange symbol in edge length 2013-07-11 05:11:10 +00:00
990cad983b Fix #36082: animation playback not working after rendering of background scenes and
multiple render layer nodes. Also fixes issue with database free with vector blur
after recent thread safety changes.
2013-07-10 16:46:13 +00:00
e3a604b233 Tag object-data level boundbox as invalid rather than freeing it
Object update used to free object-data level bounding box to trigger
it's re-calculation in the future. Such a freeing performed from
object update isn't thread-safe because mesh could be shared between
multiple objects.

Rather than freeing bounding box, tag it's as invalid, this is safe
from threading point of view and also prevents unnecessary memory
re-allocation.

Object-level bounding box is still reallocating, but think we could
change this easily in the future as well.
2013-07-10 14:26:31 +00:00
9a167e37ad Remove unused bounding box from MetaBall 2013-07-10 11:36:52 +00:00
ffaffd32cb Get rid of confusing usage of cu->bb in BKE_object_minmax
Curve-type objects now always does have object'level
bounding box, meaning cu->bb wouldn't evenr used in
BKE_object_minmax.

So zapping this confusing check for whether ob->bb
exists, which is always truth. Makes it easier to
follow what cu->bb is for and what ob->bb is for.
2013-07-10 11:36:47 +00:00
48d0ebf692 Merging r58144 through r58147 form trunk into soc-2013-depsgraph_mt 2013-07-10 10:31:59 +00:00
5e1d450b90 Fix #36076: Metaballs as particles with particle texture (size influence) crashes Blender
Issue was caused by size influence affecting on object's matrix, which
is nice by it's own. But mball code was using ob->size to check whether
it's zero-sized object or not, but then was using ob->obmat to scale
the meta elements.

This lead to situation when zero-sized elements were trying to tessellate,
which is for sure a really bad idea.
2013-07-10 10:24:06 +00:00
7b77ef8a21 Merging r58125 through r58143 from trunk into soc-2013-depsgraph_mt 2013-07-10 09:13:45 +00:00
e6291ea418 fix [#36079] Use Modifier Stack Crash with Particles 2013-07-10 05:46:45 +00:00
06be19c0ec add asserts for passing in bad index values to DM_get_***_data, CustomData_get() 2013-07-10 05:38:36 +00:00
92835d3030 Merging r58112 through r58124 from trunk into soc-2013-depsgraph_mt 2013-07-09 19:22:26 +00:00
677e136e4b Partial revert of rev58110
There's one thing we didn't foresee from the beginning,
which is apparently TLS is only available in OSX starting
from version 10.7, and we still do support of 10.6.

After recent Brecht's changes about locked viewport
while initializing BI render this TLS is not needed
in trunk anymore. So reverting this chunk of base
iteration to use static variable. But leaving all the
other static variables warped into context still, it
should help a bit in the future refactor.

Real fix would be to have some kind of graph context
evaluation structure which would be passing to update
routines (which will solve threaded mballs update) and
making depsgraph responsible for getting a motherball.
But this is all for GSoC project.
2013-07-09 18:38:33 +00:00
c3c84521f1 fix [#36055] Edge/Face Info display on wrong position with key frames
display editmesh stats with deform modifiers.
2013-07-09 12:59:31 +00:00
643d709d14 Merging r58073 through r58111 from trunk into soc-2013-depsgraph_mt 2013-07-09 08:44:06 +00:00
86546ca42d Fixed more threading issues with metaballs
This time issue was caused by static variables used in
BKE_scene_base_iter_next function.

Change is not so much ultimate actually, but didn't
find more clear solution for now. So the changes are:

- Wrap almost all the static variables into own context-
  like structure, which is owned by the callee function
  and getting passed to the iteration function.

- Recursion detection wasn't possible with such approach,
  so recursion detection still uses static in_next_object
  variable, but which is now stored in thread local
  storage (TLS, or thread variable if this names are more
  clear for you).

This makes code thread-safe, but for sure final solution
shall be completely different. Ideally, dependency graph
shall be possible to answer on question "which object is
a motherball for this metaball". This will avoid iterating
via all the bases, objects and duplis just to get needed
motherball.

Further, metaball evaluation ideally will use the same
kind of depsgraph filtering, which will get result for
question like "which objects belongs to this group of
metaballs".

But this ideal things are to be solved in Joshua's and
mind GSoC projects.

Tested on linux (gcc and clang) and windows (msvc2008),
hopefully no compilation error will happen.

Thanks to Brecht for reviewing the change and getting
feedback for other possible ways we've dicussed!
2013-07-09 08:23:01 +00:00
d4ff53b760 fix [#36066] crash when Tab out text object
the way Curve.len is used at the moment is really stupid, calculate string size on save for now, but should really store the length in bytes and total number of characters.
2013-07-09 06:21:45 +00:00
0bf3e7c5c6 Workaround for crash caused by threaded dupligorup update
Some objects from scene could have dupligroup with objects
which are not in the scene. This case wasn't checked by
workaround for threaded display object free routines.

We really need to have threading issues with display
objects solved.
2013-07-08 13:56:34 +00:00
8097e9d235 Merging r57989 through r58072 from trunk into soc-2013-depsgraph_mt 2013-07-08 11:29:08 +00:00
e43f25757b only make dynamic paint tag normals as dirty if it moves vertices. 2013-07-06 01:42:45 +00:00
32e917be8d correct typo in previous commit & minor changes. 2013-07-05 00:13:14 +00:00
9747e63094 fix for [#35911] wasn't complete, while weigths would show in editmode, weights that were modified by a weight modifier wouldn't. 2013-07-04 22:24:39 +00:00
881f0b1456 Revert revision 57896 to fix Make Local > All with multi user datablocks. It's
causing problems with link/append, needs some deeper changes but it's too close
to release for that.
2013-07-04 14:11:42 +00:00
dc44fd032e Fix #36006: appending some datablock types (e.g. node groups) did not work, they
were always linked after a recent bugfix.
2013-07-04 13:03:08 +00:00
5f8d67b055 Merging r57962 through r57988 from trunk into soc-2013-depsgraph_mt 2013-07-04 09:23:21 +00:00
a51b5c676e rigidbody: Code clenup
Remove duplicate null check.
2013-07-04 08:52:27 +00:00
734e49ade6 rigidbody: Remove constraint when removing one of it's objects
This is not the nicest behaviour but trying to keep both bullet and
blender side objects in sync breaks in this case.
There might be a better soluion but this avoids crashes for now.

Fixes: [#35995] Delete crash on specific scene (Physics)
2013-07-04 08:52:24 +00:00
70dc1d8cb6 stop adding groups from changing the active group with weight transfer, add BKE_defgroup_new function. 2013-07-04 03:56:18 +00:00
9b72621958 Fix crash when getting active ID from a node tree with missing groups 2013-07-03 15:33:11 +00:00
5185a82e4d Merging r57954 through r57961 from trunk into soc-2013-depsgraph_mt 2013-07-03 12:38:30 +00:00
98ff660186 Code cleanup: more explicit list base initialization 2013-07-03 12:33:28 +00:00
2fe0981fad Made curves almost thread-safe
Now modifier stack wouldn't modify original curve's nurbs
and will operate on a copy of nurbs.

This makes it possible to process curve object update with
shared curve datablocks from multiple threads. There's no
big overhead for creating a copy of nurbs comparing to old
behavior which was allocating original vertex array and
apply coordinates on curve after all modifier are applied.

The only remained issue with curves is curve's bounding box
and texture space. It's not thread-safe, but it wouldn't
lead to crashes -- it just could lead to either memory
leak or wrong texture coordinates due to difference in
modifiers stacks of objects which shares the same curve.
2013-07-03 12:32:42 +00:00
fc4c736989 Remove unused argument from utility curve functions
So far it was harmless, but with upcoming changes
having this argument could be confusing from logic
point of view.
2013-07-03 12:32:35 +00:00
d595f9985e Wrap runtime curve members into own structure
This allows easier assignment on file loading,
keeps curve-specific runtime data grouped and
saves couple of bytes in Object for non-curve
types.
2013-07-03 12:32:29 +00:00
f49e441927 Get rid of crazy DAG nodes coloring when doing threaded update
DAG node already has got type field, so we could just check whether
type is ID_OB to distinguish whether object_handle_update need to
be called for node->ob.

This saves iterating via scene's bases when preparing threaded
update. This also will very much likely update objects which are
not in the scene base are used in dupli groups.

So now objects form dupli_groups are likely already properly updated
white traversing the DAG with threaded update and special hacks
are needed from main thread to update objects from dupli_groups
which was added in previous commit.

However, kept this hack for a while, need some more thoughts
and investigation.
2013-07-03 12:32:17 +00:00
6d9de6a72b fix [#35975] "Select Linked" = "Select All" in Weight Paint mode?
looks like this was broken since bmesh merge.
2013-07-03 09:53:06 +00:00
4e9d469dfd Merging r57934 through r57953 from trunk into soc-2013-depsgraph_mt 2013-07-03 08:31:46 +00:00
e60a33ba07 fix for own error in 57226, broke subsurf-uv 2013-07-02 21:47:42 +00:00
7c7a3f7879 Fix for dupli-groups update going wrong
Dupli-groups used to have special case for updating
which is BKE_group_handle_recalc_and_update. This
function calls BKE_object_handle_update for every
object in the group.

This isn't thread-safe, because object could be
updating in separate thread already. And what's
worse dependencies are not known for objects inside
the group, which makes it impossible to schedule
objects from the group in a safe way.

It's even impossible to schedule groups as different
tasks, because groups could share the same objects.

For now used simple but robust solution which is
updating dupli-groups in main thread, handling
groups one-by-one and updating objects from the
group one-by-one as well.

Will work on a proper solution for this later.
2013-07-02 19:23:23 +00:00
e4f7260bac Move bevel list and path from Curve to Object datablock
I know this is not so much nice to have this guys hanging
around in a general Object datablock and ideally they better
be wrapped around into a structure like DerivedMesh or
something like this. But this is pure runtime only stuff and
we could re-wrap them around later.

Main purpose of this is making curves more thread safe,
so no separate threads will ever start freeing the same path
or the same bevel list.

It also makes sense because path and bevel shall include
deformation coming from modifiers which are applying on
pre-tesselation point and different objects could have
different set of modifiers. This used to be really confusing
in the past and now dtaa which depends on object is stored
in an object, making things clear for understanding even.

This doesn't make curve code fully thread-safe due to
pre-tesselation modifiers still modifies actual nurbs and
lock is still needed in makeDispListsCurveTypes, but this
change makes usage of paths safe for threading.

Once modifiers will stop modifying actual nurbs, curves
will be fully safe for threading.
2013-07-02 19:23:19 +00:00
79c678be89 Fix issue when the same task gets added twice to the queue
Issue was caused by worker threads updating nodes valency
at the same time while we're filling the queue with "root"
nodes (leaf nodes which don't depend on others).
2013-07-02 19:23:12 +00:00
a03437cb1a Initial idea of running post-modifiers out of lock wasn't correct
The tihng here is: curve is getting modified by modifier stack
and then it's coordinates are restored. To be really safe we
need to do all this locked.
2013-07-02 19:23:06 +00:00
d50ff36d3d Add workaroud to make threaded object update stable
Added threading lock around unsafe part of do_makeDispListCurveTypes
(parts which touches Curve->bev and Curve->path). Namely it means
pre-tesselation modifiers, bevel, path and non-modified display
list will be calculated inside a locked thread.

Post-tessellation modifiers will eb calculated outside of locked
thread, which means heavy constructive or deformation modifiers
applying on tesselated spline will be nicely threaded.

This makes it possible to use threaded object update by default
in the branch, so everyone could start testing it.
2013-07-02 19:23:03 +00:00
41f0c137ba Get rid of a display list stored in Curve datablock
This display list was only used for texture space calculation,
and even there this display list was only used for bounding
box calulation.

Since we alreayd do have boundgind box in a curve datablock
there's no reason to duplicate non-modified display list
just to calculate bounding box later, let's just calculate
boundding box at the first point.

This makes code a little be more thread-safe but curves are
still not safe for threads at all because of bevel list and
path. That would be solved later.
2013-07-02 19:22:59 +00:00
e607825f6b Replace mutex lock with spinlock in threaded object update
It's not so much happening inside the lock and using spin
lock instead of mutex lock will give some speedup due to
smaller latency of resuming the thread when mutex was locked.
2013-07-02 19:22:52 +00:00
f129393408 Put debug prints in threaded debug into G.debug & G_DEBUG check. 2013-07-02 19:22:46 +00:00
8c67e9d799 Merging r57925 through r57933 from trunk into soc-2013-depsgraph_mt 2013-07-02 19:18:10 +00:00
a30dc7c74e Fix #35966: remesh modifier + particle use modifier stack option did not work
well together.
2013-07-02 19:17:34 +00:00
418011907c remove nan copyrights from code added since blender become opensource (copy paste errors), also remove BKE_script.h 2013-07-02 10:14:59 +00:00