Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2020-11-04 15:57:28 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2020-11-04 16:03:35 +0300
commit17ccda4fe1c4bcc206024af3244c44678791a685 (patch)
tree8c77c4e7f2bae35e7ce60bcd85d6eb16412be808 /intern/cycles/blender
parented4855ecb4094bffc43287eb0dc0dfcfb342dd06 (diff)
Cycles: fix multithreading issue introduced in previous commit
The issue is that the shaders are stolen from the original Geometry by the temporary Geometry used to accumulate data, but the main thread still needs them for syncing the attributes. So make a copy of the shader array to preserve the data on the original Geometry.
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r--intern/cycles/blender/blender_curves.cpp6
-rw-r--r--intern/cycles/blender/blender_mesh.cpp6
2 files changed, 10 insertions, 2 deletions
diff --git a/intern/cycles/blender/blender_curves.cpp b/intern/cycles/blender/blender_curves.cpp
index b27de2081ae..9070c093492 100644
--- a/intern/cycles/blender/blender_curves.cpp
+++ b/intern/cycles/blender/blender_curves.cpp
@@ -819,8 +819,12 @@ void BlenderSync::sync_hair(Hair *hair, BL::Object &b_ob, bool motion, int motio
void BlenderSync::sync_hair(BL::Depsgraph b_depsgraph, BL::Object b_ob, Hair *hair)
{
+ /* make a copy of the shaders as the caller in the main thread still need them for syncing the
+ * attributes */
+ array<Node *> used_shaders = hair->get_used_shaders();
+
Hair new_hair;
- new_hair.set_used_shaders(hair->get_used_shaders());
+ new_hair.set_used_shaders(used_shaders);
if (view_layer.use_hair) {
if (b_ob.type() == BL::Object::type_HAIR) {
diff --git a/intern/cycles/blender/blender_mesh.cpp b/intern/cycles/blender/blender_mesh.cpp
index 079e087ffb6..d84433ecd27 100644
--- a/intern/cycles/blender/blender_mesh.cpp
+++ b/intern/cycles/blender/blender_mesh.cpp
@@ -1019,8 +1019,12 @@ static void sync_mesh_fluid_motion(BL::Object &b_ob, Scene *scene, Mesh *mesh)
void BlenderSync::sync_mesh(BL::Depsgraph b_depsgraph, BL::Object b_ob, Mesh *mesh)
{
+ /* make a copy of the shaders as the caller in the main thread still need them for syncing the
+ * attributes */
+ array<Node *> used_shaders = mesh->get_used_shaders();
+
Mesh new_mesh;
- new_mesh.set_used_shaders(mesh->get_used_shaders());
+ new_mesh.set_used_shaders(used_shaders);
if (view_layer.use_surfaces) {
/* Adaptive subdivision setup. Not for baking since that requires