diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-05-04 02:07:03 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-05-04 02:07:03 +0300 |
commit | e6bf272abd92e0b524ac35e81599075f21537c97 (patch) | |
tree | 8851aa37bf8b7f9d35552f59183d4598798161e0 /intern/cycles | |
parent | 042df5fd6ad75868a93fbeff100c9d4eb7382e4d (diff) | |
parent | b874c152a81c6c52a17a7157ce7be57f2ee28cf4 (diff) |
Merge branch 'blender-v2.93-release'
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/blender/blender_python.cpp | 12 | ||||
-rw-r--r-- | intern/cycles/blender/blender_session.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_subsurface.h | 8 | ||||
-rw-r--r-- | intern/cycles/render/light.cpp | 2 |
4 files changed, 16 insertions, 9 deletions
diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp index 0daad310543..785ca6b4e01 100644 --- a/intern/cycles/blender/blender_python.cpp +++ b/intern/cycles/blender/blender_python.cpp @@ -35,6 +35,7 @@ #include "util/util_path.h" #include "util/util_string.h" #include "util/util_task.h" +#include "util/util_tbb.h" #include "util/util_types.h" #ifdef WITH_OSL @@ -288,9 +289,11 @@ static PyObject *render_func(PyObject * /*self*/, PyObject *args) RNA_pointer_create(NULL, &RNA_Depsgraph, (ID *)PyLong_AsVoidPtr(pydepsgraph), &depsgraphptr); BL::Depsgraph b_depsgraph(depsgraphptr); + /* Allow Blender to execute other Python scripts, and isolate TBB tasks so we + * don't get deadlocks with Blender threads accessing shared data like images. */ python_thread_state_save(&session->python_thread_state); - session->render(b_depsgraph); + tbb::this_task_arena::isolate([&] { session->render(b_depsgraph); }); python_thread_state_restore(&session->python_thread_state); @@ -327,7 +330,8 @@ static PyObject *bake_func(PyObject * /*self*/, PyObject *args) python_thread_state_save(&session->python_thread_state); - session->bake(b_depsgraph, b_object, pass_type, pass_filter, width, height); + tbb::this_task_arena::isolate( + [&] { session->bake(b_depsgraph, b_object, pass_type, pass_filter, width, height); }); python_thread_state_restore(&session->python_thread_state); @@ -373,7 +377,7 @@ static PyObject *reset_func(PyObject * /*self*/, PyObject *args) python_thread_state_save(&session->python_thread_state); - session->reset_session(b_data, b_depsgraph); + tbb::this_task_arena::isolate([&] { session->reset_session(b_data, b_depsgraph); }); python_thread_state_restore(&session->python_thread_state); @@ -395,7 +399,7 @@ static PyObject *sync_func(PyObject * /*self*/, PyObject *args) python_thread_state_save(&session->python_thread_state); - session->synchronize(b_depsgraph); + tbb::this_task_arena::isolate([&] { session->synchronize(b_depsgraph); }); python_thread_state_restore(&session->python_thread_state); diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index ab081ada3dc..89854f6a0e5 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -237,6 +237,9 @@ void BlenderSession::reset_session(BL::BlendData &b_data, BL::Depsgraph &b_depsg sync->sync_recalc(b_depsgraph, b_v3d); } + BL::Object b_camera_override(b_engine.camera_override()); + sync->sync_camera(b_render, b_camera_override, width, height, ""); + BL::SpaceView3D b_null_space_view3d(PointerRNA_NULL); BL::RegionView3D b_null_region_view3d(PointerRNA_NULL); BufferParams buffer_params = BlenderSync::get_buffer_params(b_render, diff --git a/intern/cycles/kernel/kernel_subsurface.h b/intern/cycles/kernel/kernel_subsurface.h index 0a56f867158..b70df747a73 100644 --- a/intern/cycles/kernel/kernel_subsurface.h +++ b/intern/cycles/kernel/kernel_subsurface.h @@ -606,10 +606,10 @@ ccl_device_noinline t = ray->t; } else if (bounce == 0) { - /* Restore original position if nothing was hit after the first bounce. - * Otherwise if the ray_offset() to avoid self-intersection is relatively - * large compared to the scattering radius, we go never backup high enough - * to exit the surface. */ + /* Restore original position if nothing was hit after the first bounce, + * without the ray_offset() that was added to avoid self-intersection. + * Otherwise if that offset is relatively large compared to the scattering + * radius, we never go back up high enough to exit the surface. */ ray->P = sd->P; } diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index 9b975daff0b..5290d68e75a 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -865,7 +865,7 @@ void LightManager::device_update_points(Device *, DeviceScene *dscene, Scene *sc const float min_spread_angle = 1.0f * M_PI_F / 180.0f; const float spread_angle = 0.5f * (M_PI_F - max(light->spread, min_spread_angle)); /* Normalization computed using: - * integrate cos(x) (1 - tan(x) * tan(a)) * sin(x) from x = a to pi/2. */ + * integrate cos(x) * (1 - tan(x) * tan(a)) * sin(x) from x = 0 to pi/2 - a. */ const float tan_spread = tanf(spread_angle); const float normalize_spread = 2.0f / (2.0f + (2.0f * spread_angle - M_PI_F) * tan_spread); |