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:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-10-06 19:06:15 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-10-06 19:06:15 +0300
commit83ce02879f7c6733adc098d00a01963fc4212abd (patch)
tree8c8323120eb8ece9d06cffa66b0fdf0f3c5c0c3c /intern/cycles/render/shader.h
parent837383ac78da601a8e6bd909987169993e44f75a (diff)
Cycles: Fix possible race condition when generating Beckmann table
Two issues here: - Checking table size to be non-zero is not a proper way to go here. This is because we first resize the table and then fill it in. So it was possible that non-initialized table was used. Trickery with using temporary memory and then doing table.swap() might work, but we can not guarantee that table size will be set after the data pointer. - Mutex guard was useless, because every thread was using own mutex. Need to make mutex guard static so all threads are using same mutex.
Diffstat (limited to 'intern/cycles/render/shader.h')
-rw-r--r--intern/cycles/render/shader.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h
index 79a67d6756a..3fdcd3c0c5b 100644
--- a/intern/cycles/render/shader.h
+++ b/intern/cycles/render/shader.h
@@ -200,8 +200,9 @@ protected:
typedef unordered_map<ustring, uint, ustringHash> AttributeIDMap;
AttributeIDMap unique_attribute_id;
- thread_mutex lookup_table_mutex;
+ static thread_mutex lookup_table_mutex;
static vector<float> beckmann_table;
+ static bool beckmann_table_ready;
size_t beckmann_table_offset;