Fix T43311: using displacement shader crashes blender

Issue was caused by wrong order of scene device update, which could
lead to missing object flags in shader kernel.

This patch solves a bit more than that making sure objects flags are
always properly updated, so adding/removing volume BSDF will properly
reflect on viewport where camera might become being in volume and so.
This commit is contained in:
Sergey Sharybin
2015-01-19 19:08:58 +05:00
parent 18ae259cc4
commit 7fd4c440ec
6 changed files with 43 additions and 9 deletions

View File

@@ -221,6 +221,7 @@ vector<float> Object::motion_times()
ObjectManager::ObjectManager()
{
need_update = true;
need_flags_update = true;
}
ObjectManager::~ObjectManager()
@@ -404,10 +405,11 @@ void ObjectManager::device_update(Device *device, DeviceScene *dscene, Scene *sc
void ObjectManager::device_update_flags(Device *device, DeviceScene *dscene,
Scene *scene, Progress& progress)
{
if(!need_update)
if(!need_update && !need_flags_update)
return;
need_update = false;
need_flags_update = false;
if(scene->objects.size() == 0)
return;
@@ -427,6 +429,9 @@ void ObjectManager::device_update_flags(Device *device, DeviceScene *dscene,
if(object->mesh->has_volume) {
object_flag[object_index] |= SD_OBJECT_HAS_VOLUME;
}
else {
object_flag[object_index] &= ~SD_OBJECT_HAS_VOLUME;
}
foreach(Object *volume_object, volume_objects) {
if(object == volume_object) {