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
path: root/intern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-11-25 15:38:12 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-11-25 15:43:44 +0300
commit415b5a43690b3b823506871335281df717309f72 (patch)
treee3d063ad4a9071a0e44ab3d34423dee7ff66be4d /intern
parent328208a6a646448246f002a2aa144633c67197e7 (diff)
Fix T46646: Point Cloud Density crashes on real time rendering
The issue was caused by possible use of object->derivedFinal from the render thread, The patch tries to eliminate (or at least minimize, huh) amount of access to the derivedFinal of a source object. It's still possible that in the case of particle source derived mesh will be still unsafely used, but with the patch applied we can easily change runtime part of the code and cache derived mesh on the preparation stage. Some ideas for the future: - Check whether cache() was called on the point density node when calling calc(). - Cache derivedMesh in the runtime part of point density node to avoid possible remained thread conflicts. - NULL the runtime part of the node on .blend load Reviewers: campbellbarton, plasmasolutions Reviewed By: plasmasolutions Differential Revision: https://developer.blender.org/D1614
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/blender/blender_shader.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index 5bbdeb6061b..3f4f1bb206b 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -184,6 +184,7 @@ static ShaderNode *add_node(Scene *scene,
BL::RenderEngine b_engine,
BL::BlendData b_data,
BL::Scene b_scene,
+ const bool background,
ShaderGraph *graph,
BL::ShaderNodeTree b_ntree,
BL::ShaderNode b_node)
@@ -763,6 +764,8 @@ static ShaderNode *add_node(Scene *scene,
/* TODO(sergey): Use more proper update flag. */
if(true) {
+ int settings = background ? 1 : 0; /* 1 - render settings, 0 - vewport settings. */
+ b_point_density_node.cache_point_density(b_scene, settings);
scene->image_manager->tag_reload_image(
point_density->filename,
point_density->builtin_data,
@@ -852,6 +855,7 @@ static void add_nodes(Scene *scene,
BL::RenderEngine b_engine,
BL::BlendData b_data,
BL::Scene b_scene,
+ const bool background,
ShaderGraph *graph,
BL::ShaderNodeTree b_ntree,
const ProxyMap &proxy_input_map,
@@ -937,6 +941,7 @@ static void add_nodes(Scene *scene,
b_engine,
b_data,
b_scene,
+ background,
graph,
b_group_ntree,
group_proxy_input_map,
@@ -984,6 +989,7 @@ static void add_nodes(Scene *scene,
b_engine,
b_data,
b_scene,
+ background,
graph,
b_ntree,
BL::ShaderNode(*b_node));
@@ -1046,6 +1052,7 @@ static void add_nodes(Scene *scene,
BL::RenderEngine b_engine,
BL::BlendData b_data,
BL::Scene b_scene,
+ const bool background,
ShaderGraph *graph,
BL::ShaderNodeTree b_ntree)
{
@@ -1054,6 +1061,7 @@ static void add_nodes(Scene *scene,
b_engine,
b_data,
b_scene,
+ background,
graph,
b_ntree,
empty_proxy_map,
@@ -1083,7 +1091,7 @@ void BlenderSync::sync_materials(bool update_all)
if(b_mat->use_nodes() && b_mat->node_tree()) {
BL::ShaderNodeTree b_ntree(b_mat->node_tree());
- add_nodes(scene, b_engine, b_data, b_scene, graph, b_ntree);
+ add_nodes(scene, b_engine, b_data, b_scene, !preview, graph, b_ntree);
}
else {
ShaderNode *closure, *out;
@@ -1126,7 +1134,7 @@ void BlenderSync::sync_world(bool update_all)
if(b_world && b_world.use_nodes() && b_world.node_tree()) {
BL::ShaderNodeTree b_ntree(b_world.node_tree());
- add_nodes(scene, b_engine, b_data, b_scene, graph, b_ntree);
+ add_nodes(scene, b_engine, b_data, b_scene, !preview, graph, b_ntree);
/* volume */
PointerRNA cworld = RNA_pointer_get(&b_world.ptr, "cycles");
@@ -1217,7 +1225,7 @@ void BlenderSync::sync_lamps(bool update_all)
BL::ShaderNodeTree b_ntree(b_lamp->node_tree());
- add_nodes(scene, b_engine, b_data, b_scene, graph, b_ntree);
+ add_nodes(scene, b_engine, b_data, b_scene, !preview, graph, b_ntree);
}
else {
ShaderNode *closure, *out;