[Bf-blender-cvs] [b45828ebe9c] blender-v2.81-release: Fix T71123: OptiX error in Cycles viewport when adding HDRI
Patrick Mours
noreply at git.blender.org
Mon Nov 4 18:10:32 CET 2019
Commit: b45828ebe9c6e729c5d65bb23f913088f3f8672c
Author: Patrick Mours
Date: Tue Oct 29 16:32:53 2019 +0100
Branches: blender-v2.81-release
https://developer.blender.org/rBb45828ebe9c6e729c5d65bb23f913088f3f8672c
Fix T71123: OptiX error in Cycles viewport when adding HDRI
Cycles did not update the "is_enabled" flag on lights when they were synchronized again, which caused all lights disabled by "LightManager::disable_ineffective_light" to be disabled indefinitely. As a result the OptiX kernels were not reloaded with correct features when a change to a light was made. This fixes that by updating the "is_enabled" flag during synchronization.
Differential Revision: https://developer.blender.org/D6141
===================================================================
M intern/cycles/blender/blender_object.cpp
M intern/cycles/render/light.cpp
===================================================================
diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp
index 5520cfd5ecf..6981412bb88 100644
--- a/intern/cycles/blender/blender_object.cpp
+++ b/intern/cycles/blender/blender_object.cpp
@@ -269,6 +269,9 @@ void BlenderSync::sync_background_light(BL::SpaceView3D &b_v3d, bool use_portal)
light->use_mis = sample_as_light;
light->max_bounces = get_int(cworld, "max_bounces");
+ /* force enable light again when world is resynced */
+ light->is_enabled = true;
+
int samples = get_int(cworld, "samples");
if (get_boolean(cscene, "use_square_samples"))
light->samples = samples * samples;
diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp
index 8c7a21da561..dc3f7c8f8ac 100644
--- a/intern/cycles/render/light.cpp
+++ b/intern/cycles/render/light.cpp
@@ -221,13 +221,11 @@ void LightManager::disable_ineffective_light(Scene *scene)
*/
Shader *shader = (scene->background->shader) ? scene->background->shader :
scene->default_background;
- bool disable_mis = !(has_portal || shader->has_surface_spatial_varying);
- if (disable_mis) {
- VLOG(1) << "Background MIS has been disabled.\n";
- foreach (Light *light, scene->lights) {
- if (light->type == LIGHT_BACKGROUND) {
- light->is_enabled = false;
- }
+ const bool disable_mis = !(has_portal || shader->has_surface_spatial_varying);
+ VLOG_IF(1, disable_mis) << "Background MIS has been disabled.\n";
+ foreach (Light *light, scene->lights) {
+ if (light->type == LIGHT_BACKGROUND) {
+ light->is_enabled = !disable_mis;
}
}
}
More information about the Bf-blender-cvs
mailing list