[Bf-blender-cvs] [c8e764ccbf3] master: Cycles: Fix race condition in shader attribute for real now
Sergey Sharybin
noreply at git.blender.org
Mon Apr 10 16:56:13 CEST 2017
Commit: c8e764ccbf3a19df143601fb2391fea2f9839581
Author: Sergey Sharybin
Date: Mon Apr 10 16:53:01 2017 +0200
Branches: master
https://developer.blender.org/rBc8e764ccbf3a19df143601fb2391fea2f9839581
Cycles: Fix race condition in shader attribute for real now
Ended up moving lock in the more centralized space since multiple shaders
can access this map.
===================================================================
M intern/cycles/render/shader.cpp
M intern/cycles/render/shader.h
M intern/cycles/render/svm.cpp
M intern/cycles/render/svm.h
===================================================================
diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp
index 12d3c6cf832..23eee1916bd 100644
--- a/intern/cycles/render/shader.cpp
+++ b/intern/cycles/render/shader.cpp
@@ -332,6 +332,8 @@ ShaderManager *ShaderManager::create(Scene *scene, int shadingsystem)
uint ShaderManager::get_attribute_id(ustring name)
{
+ thread_scoped_spin_lock lock(attribute_lock_);
+
/* get a unique id for each name, for SVM attribute lookup */
AttributeIDMap::iterator it = unique_attribute_id.find(name);
diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h
index 87fef19c592..a8018231f1a 100644
--- a/intern/cycles/render/shader.h
+++ b/intern/cycles/render/shader.h
@@ -202,6 +202,8 @@ protected:
void get_requested_graph_features(ShaderGraph *graph,
DeviceRequestedFeatures *requested_features);
+
+ thread_spin_lock attribute_lock_;
};
CCL_NAMESPACE_END
diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp
index 9cf3f4cb0b2..48287d872d4 100644
--- a/intern/cycles/render/svm.cpp
+++ b/intern/cycles/render/svm.cpp
@@ -393,13 +393,11 @@ void SVMCompiler::add_node(const float4& f)
uint SVMCompiler::attribute(ustring name)
{
- thread_scoped_spin_lock lock(attribute_lock_);
return shader_manager->get_attribute_id(name);
}
uint SVMCompiler::attribute(AttributeStandard std)
{
- thread_scoped_spin_lock lock(attribute_lock_);
return shader_manager->get_attribute_id(std);
}
diff --git a/intern/cycles/render/svm.h b/intern/cycles/render/svm.h
index eef344a506e..abbd9e50610 100644
--- a/intern/cycles/render/svm.h
+++ b/intern/cycles/render/svm.h
@@ -218,8 +218,6 @@ protected:
int max_stack_use;
uint mix_weight_offset;
bool compile_failed;
-
- thread_spin_lock attribute_lock_;
};
CCL_NAMESPACE_END
More information about the Bf-blender-cvs
mailing list