diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-06-01 21:59:23 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-06-01 22:04:30 +0300 |
commit | 27c1262e21070d8f4dc63d739b41b205f60e3318 (patch) | |
tree | db80ad49414c32c554895abb8560d9ac839bd8f8 /intern/cycles/render/object.cpp | |
parent | a73d4b859ab967729a8c1d6bd1e4d505f7a45d49 (diff) |
Fix T44908: Blender crashes when trying to use cycles experimental displacement
The issue was caused by the reshuffle needed to make objects flags have proper
object's bounding box to solve regressions in SSS objects intersecting volumes.
There's actually a feedback loop happening here, which is now solved in quite
naive way -- for the true displacement we consider all objects are capable of
intersecting volumes, synchronize object flags prior to displacement shader
tasks runs and then re-update object flags for proper bounding box.
Not sure what will be the proper solution here, we can't do preliminary check
of intersection for displacement shader, but on the other hand we don't really
need this flag for displacement shader anyway.
Diffstat (limited to 'intern/cycles/render/object.cpp')
-rw-r--r-- | intern/cycles/render/object.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/intern/cycles/render/object.cpp b/intern/cycles/render/object.cpp index da9bc23ccc4..ae72d728c8c 100644 --- a/intern/cycles/render/object.cpp +++ b/intern/cycles/render/object.cpp @@ -410,7 +410,8 @@ void ObjectManager::device_update(Device *device, DeviceScene *dscene, Scene *sc void ObjectManager::device_update_flags(Device *device, DeviceScene *dscene, Scene *scene, - Progress& /*progress*/) + Progress& /*progress*/, + bool bounds_valid) { if(!need_update && !need_flags_update) return; @@ -425,9 +426,13 @@ void ObjectManager::device_update_flags(Device *device, uint *object_flag = dscene->object_flag.get_data(); vector<Object *> volume_objects; + bool has_volume_objects = false; foreach(Object *object, scene->objects) { if(object->mesh->has_volume) { - volume_objects.push_back(object); + if(bounds_valid) { + volume_objects.push_back(object); + } + has_volume_objects = true; } } @@ -440,15 +445,23 @@ void ObjectManager::device_update_flags(Device *device, object_flag[object_index] &= ~SD_OBJECT_HAS_VOLUME; } - foreach(Object *volume_object, volume_objects) { - if(object == volume_object) { - continue; - } - if(object->bounds.intersects(volume_object->bounds)) { - object_flag[object_index] |= SD_OBJECT_INTERSECTS_VOLUME; - break; + if(bounds_valid) { + foreach(Object *volume_object, volume_objects) { + if(object == volume_object) { + continue; + } + if(object->bounds.intersects(volume_object->bounds)) { + object_flag[object_index] |= SD_OBJECT_INTERSECTS_VOLUME; + break; + } } } + else if(has_volume_objects) { + /* Not really valid, but can't make more reliable in the case + * of bounds not being up to date. + */ + object_flag[object_index] |= SD_OBJECT_INTERSECTS_VOLUME; + } ++object_index; } |