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:
@@ -556,6 +556,7 @@ MeshManager::MeshManager()
|
||||
{
|
||||
bvh = NULL;
|
||||
need_update = true;
|
||||
need_flags_update = true;
|
||||
}
|
||||
|
||||
MeshManager::~MeshManager()
|
||||
@@ -1034,20 +1035,33 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene *
|
||||
dscene->data.bvh.use_qbvh = scene->params.use_qbvh;
|
||||
}
|
||||
|
||||
void MeshManager::device_update_flags(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress)
|
||||
{
|
||||
if(!need_update && !need_flags_update) {
|
||||
return;
|
||||
}
|
||||
/* update flags */
|
||||
foreach(Mesh *mesh, scene->meshes) {
|
||||
mesh->has_volume = false;
|
||||
foreach(uint shader, mesh->used_shaders) {
|
||||
if(scene->shaders[shader]->has_volume) {
|
||||
mesh->has_volume = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
need_flags_update = false;
|
||||
}
|
||||
|
||||
void MeshManager::device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress)
|
||||
{
|
||||
if(!need_update)
|
||||
return;
|
||||
|
||||
/* update normals and flags */
|
||||
/* update normals */
|
||||
foreach(Mesh *mesh, scene->meshes) {
|
||||
mesh->has_volume = false;
|
||||
foreach(uint shader, mesh->used_shaders) {
|
||||
if(scene->shaders[shader]->need_update_attributes)
|
||||
mesh->need_update = true;
|
||||
if(scene->shaders[shader]->has_volume) {
|
||||
mesh->has_volume = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(mesh->need_update) {
|
||||
|
Reference in New Issue
Block a user