[Bf-blender-cvs] [52029e689ce] master: Cycles: Fix race condition in attributes creation during SVM compilation

Sergey Sharybin noreply at git.blender.org
Wed Apr 5 14:59:13 CEST 2017


Commit: 52029e689ceb9fec0a873d6ed3d0c036d58be8cd
Author: Sergey Sharybin
Date:   Wed Apr 5 14:57:54 2017 +0200
Branches: master
https://developer.blender.org/rB52029e689ceb9fec0a873d6ed3d0c036d58be8cd

Cycles: Fix race condition in attributes creation during SVM compilation

===================================================================

M	intern/cycles/render/svm.cpp
M	intern/cycles/render/svm.h

===================================================================

diff --git a/intern/cycles/render/svm.cpp b/intern/cycles/render/svm.cpp
index 48287d872d4..9cf3f4cb0b2 100644
--- a/intern/cycles/render/svm.cpp
+++ b/intern/cycles/render/svm.cpp
@@ -393,11 +393,13 @@ 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 abbd9e50610..eef344a506e 100644
--- a/intern/cycles/render/svm.h
+++ b/intern/cycles/render/svm.h
@@ -218,6 +218,8 @@ 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