blender/intern/cycles/render
Lukas Toenne 31ed71cb6b Performance fix for Cycles: Don't wait in the main UI thread when resetting devices.
When the scene is updated Cycles resets the renderer device, cancelling
all existing tasks. The main thread would wait for all running tasks to
finish before continuing. This is ok when tasks can actually cancel in a
timely fashion. For OSL however, this does not work, since the OSL
shader group optimization takes quite a bit of time and can not be
easily be cancelled once running (on my crappy machine in full debug
mode: ~0.12 seconds for simple node trees). This would lead to very
laggy UI behavior and make it difficult to accurately control elements
such as sliders.

This patch removes the wait condition from the device->task_cancel
method. Instead it just sets the do_cancel flag and returns. To avoid
backlog in the task pool of the device it will return early from the
BlenderSession::sync function while the reset is going on (tested in
Session::resetting). Once all existing tasks have finished the do_cancel
flag is finally cleared again (checked in TaskPool::num_decrease).

Care has to be taken to avoid race conditions on the do_cancel flag,
since it can now be modified outside the TaskPool::cancel function
itself. For this purpose the scope of the TaskPool::num_mutex locks has
been extended, in most cases the mutex is now locked by the TaskPool
itself before calling TaskScheduler methods, instead of only locking
inside the num_increase/num_decrease functions themselves. The only
occurrence of a lock outside of the TaskPool methods is in
TaskScheduler::thread_run.

This patch is most useful in combination with the OSL renderer mode, so
it can probably wait until after the 2.64 release. SVM tasks tend to be
cancelled quickly, so the effect is less noticeable.
2012-09-11 11:41:51 +00:00
..
attribute.cpp Fix for attribute lookup in OSL. This uses a map in the OSL globals instead of the device texture. 2012-09-05 17:08:56 +00:00
attribute.h Fix for Cycles (CUDA) compilation (again ...). Moved the AttributeStandard enum typedef and the attribute_standard_name mapping function to util_attribute/util_types headers, so they can properly be used by kernel and render files alike. This should avoid any std C includes which are not available in CUDA. Thanks to Sergey for help! 2012-09-07 11:06:45 +00:00
background.cpp Cycles: add render layer use environment option to disable world lighting on 2012-04-13 12:58:12 +00:00
background.h Cycles: add render layer use environment option to disable world lighting on 2012-04-13 12:58:12 +00:00
buffers.cpp Cycles: merge of changes from tomato branch. 2012-09-04 13:29:07 +00:00
buffers.h Cycles: merge of changes from tomato branch. 2012-09-04 13:29:07 +00:00
camera.cpp Cycles: merge of changes from tomato branch. 2012-09-04 13:29:07 +00:00
camera.h Cycles: merge of changes from tomato branch. 2012-09-04 13:29:07 +00:00
CMakeLists.txt Fix for #32184 and redesign of particle storage in Cycles. 2012-08-31 17:27:08 +00:00
film.cpp Fix #31883: cycles vectors pass rendering crash with some render layers using 2012-06-20 14:24:52 +00:00
film.h Fix #31883: cycles vectors pass rendering crash with some render layers using 2012-06-20 14:24:52 +00:00
filter.cpp style cleanup: assignment & indentation. 2012-06-09 18:56:12 +00:00
filter.h Cycles: 2011-08-28 13:55:59 +00:00
graph.cpp Cycles: merge of changes from tomato branch. 2012-09-04 13:29:07 +00:00
graph.h Replaced dynamic_casts for node type checks by simple 'special type' identifiers. RTTI has to be disabled in cycles for OSL. 2012-09-03 11:38:15 +00:00
image.cpp Cycles: merge of changes from tomato branch. 2012-09-04 13:29:07 +00:00
image.h Cycles: merge of changes from tomato branch. 2012-09-04 13:29:07 +00:00
integrator.cpp Cycles: first step for implementation of non-progressive sampler that handles 2012-06-13 11:44:48 +00:00
integrator.h Cycles: first step for implementation of non-progressive sampler that handles 2012-06-13 11:44:48 +00:00
light.cpp Fix #32088: cycles crash removing a lamp with non-progressive sampling. 2012-09-03 16:52:59 +00:00
light.h Cycles: first step for implementation of non-progressive sampler that handles 2012-06-13 11:44:48 +00:00
mesh_displace.cpp Cycles: support for motion vector and UV passes. 2012-04-30 12:49:26 +00:00
mesh.cpp Fix for Cycles (CUDA) compilation (again ...). Moved the AttributeStandard enum typedef and the attribute_standard_name mapping function to util_attribute/util_types headers, so they can properly be used by kernel and render files alike. This should avoid any std C includes which are not available in CUDA. Thanks to Sergey for help! 2012-09-07 11:06:45 +00:00
mesh.h Cycles: threading optimizations 2012-05-05 19:44:33 +00:00
nodes.cpp Cycles / OSL: 2012-09-04 22:33:11 +00:00
nodes.h Cycles: merge of changes from tomato branch. 2012-09-04 13:29:07 +00:00
object.cpp Fix for #32184 and redesign of particle storage in Cycles. 2012-08-31 17:27:08 +00:00
object.h Fix for #32184 and redesign of particle storage in Cycles. 2012-08-31 17:27:08 +00:00
osl.cpp Fix for OSL input parameter name mapping. When assigning input constants to shader parameters, use the compatible_name function to strip whitespace. 2012-09-04 16:47:00 +00:00
osl.h Cycles render engine, initial commit. This is the engine itself, blender modifications and build instructions will follow later. 2011-04-27 11:58:34 +00:00
particles.cpp Cycles fix: don't skip particle device update when there are no particle systems. The device texture always contains at least one dummy particle in case particle info node is used for non-instance objects, this must be initialized in any case. 2012-09-01 11:30:19 +00:00
particles.h Added a bunch of additional particle state attributes to the Cycles particle info node: 2012-08-31 19:38:59 +00:00
scene.cpp Cycles: merge of changes from tomato branch. 2012-09-04 13:29:07 +00:00
scene.h Fix for Cycles (CUDA) compilation (again ...). Moved the AttributeStandard enum typedef and the attribute_standard_name mapping function to util_attribute/util_types headers, so they can properly be used by kernel and render files alike. This should avoid any std C includes which are not available in CUDA. Thanks to Sergey for help! 2012-09-07 11:06:45 +00:00
session.cpp Performance fix for Cycles: Don't wait in the main UI thread when resetting devices. 2012-09-11 11:41:51 +00:00
session.h Performance fix for Cycles: Don't wait in the main UI thread when resetting devices. 2012-09-11 11:41:51 +00:00
shader.cpp style cleanup: block comments 2012-06-09 17:22:52 +00:00
shader.h style cleanup: block comments 2012-06-09 17:22:52 +00:00
sobol.cpp Fix #29528: crash adding subsurf modifier in a particular scene with viewport render. 2011-12-08 21:55:35 +00:00
sobol.h Fix #29528: crash adding subsurf modifier in a particular scene with viewport render. 2011-12-08 21:55:35 +00:00
svm.cpp code cleanup: removed/renamed shadow & duplicate variable definitions. 2012-06-09 18:20:40 +00:00
svm.h Cycles: support for motion vector and UV passes. 2012-04-30 12:49:26 +00:00
tile.cpp Cycles: merge of changes from tomato branch. 2012-09-04 13:29:07 +00:00
tile.h Cycles: merge of changes from tomato branch. 2012-09-04 13:29:07 +00:00