Revert "Fix T63588: Cycles unnecessarily updates background importance sampling map"

This reverts commit 33ce0cb5a1.

Fix T77273: crash enabling portal lights. The optimization for background
updates can be added back later for 2.90 and 2.83.1.
This commit is contained in:
Brecht Van Lommel
2020-06-02 18:44:43 +02:00
parent eba3aa1837
commit 52cc412e0f
3 changed files with 11 additions and 24 deletions

View File

@@ -181,7 +181,6 @@ bool Light::has_contribution(Scene *scene)
LightManager::LightManager() LightManager::LightManager()
{ {
need_update = true; need_update = true;
need_update_background = true;
use_light_visibility = false; use_light_visibility = false;
} }
@@ -902,7 +901,7 @@ void LightManager::device_update(Device *device,
VLOG(1) << "Total " << scene->lights.size() << " lights."; VLOG(1) << "Total " << scene->lights.size() << " lights.";
device_free(device, dscene, need_update_background); device_free(device, dscene);
use_light_visibility = false; use_light_visibility = false;
@@ -916,11 +915,9 @@ void LightManager::device_update(Device *device,
if (progress.get_cancel()) if (progress.get_cancel())
return; return;
if (need_update_background) {
device_update_background(device, dscene, scene, progress); device_update_background(device, dscene, scene, progress);
if (progress.get_cancel()) if (progress.get_cancel())
return; return;
}
device_update_ies(dscene); device_update_ies(dscene);
if (progress.get_cancel()) if (progress.get_cancel())
@@ -932,17 +929,14 @@ void LightManager::device_update(Device *device,
} }
need_update = false; need_update = false;
need_update_background = false;
} }
void LightManager::device_free(Device *, DeviceScene *dscene, const bool free_background) void LightManager::device_free(Device *, DeviceScene *dscene)
{ {
dscene->light_distribution.free(); dscene->light_distribution.free();
dscene->lights.free(); dscene->lights.free();
if (free_background) {
dscene->light_background_marginal_cdf.free(); dscene->light_background_marginal_cdf.free();
dscene->light_background_conditional_cdf.free(); dscene->light_background_conditional_cdf.free();
}
dscene->ies_lights.free(); dscene->ies_lights.free();
} }
@@ -995,7 +989,6 @@ int LightManager::add_ies(const string &content)
ies_slots[slot]->hash = hash; ies_slots[slot]->hash = hash;
need_update = true; need_update = true;
need_update_background = true;
return slot; return slot;
} }
@@ -1014,7 +1007,6 @@ void LightManager::remove_ies(int slot)
/* If the slot has no more users, update the device to remove it. */ /* If the slot has no more users, update the device to remove it. */
need_update |= (ies_slots[slot]->users == 0); need_update |= (ies_slots[slot]->users == 0);
need_update_background |= need_update;
} }
void LightManager::device_update_ies(DeviceScene *dscene) void LightManager::device_update_ies(DeviceScene *dscene)

View File

@@ -88,9 +88,6 @@ class LightManager {
bool use_light_visibility; bool use_light_visibility;
bool need_update; bool need_update;
/* Need to update background (including multiple importance map) */
bool need_update_background;
LightManager(); LightManager();
~LightManager(); ~LightManager();
@@ -100,7 +97,7 @@ class LightManager {
void remove_ies(int slot); void remove_ies(int slot);
void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress); void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress &progress);
void device_free(Device *device, DeviceScene *dscene, const bool free_background = true); void device_free(Device *device, DeviceScene *dscene);
void tag_update(Scene *scene); void tag_update(Scene *scene);

View File

@@ -318,12 +318,10 @@ void Shader::tag_update(Scene *scene)
* has use_mis set to false. We are quite close to release now, so * has use_mis set to false. We are quite close to release now, so
* better to be safe. * better to be safe.
*/ */
if (this == scene->background->get_shader(scene)) { if (this == scene->background->get_shader(scene) &&
scene->light_manager->need_update_background = true; scene->light_manager->has_background_light(scene)) {
if (scene->light_manager->has_background_light(scene)) {
scene->light_manager->need_update = true; scene->light_manager->need_update = true;
} }
}
/* quick detection of which kind of shaders we have to avoid loading /* quick detection of which kind of shaders we have to avoid loading
* e.g. surface attributes when there is only a volume shader. this could * e.g. surface attributes when there is only a volume shader. this could