diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index d97c1aefc89..ae6042cef34 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -220,10 +220,16 @@ bool LightManager::object_usable_as_light(Object *object) { return false; } /* Skip if we have no emission shaders. */ - if(!mesh->has_mis_emission) { - return false; + /* TODO(sergey): Ideally we want to avoid such duplicated loop, since it'll + * iterate all mesh shaders twice (when counting and when calculating + * triangle area. + */ + foreach(const Shader *shader, mesh->used_shaders) { + if(shader->use_mis && shader->has_surface_emission) { + return true; + } } - return true; + return false; } void LightManager::device_update_distribution(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress) diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index 74880f5c192..8b0ed9f77b2 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -156,7 +156,6 @@ Mesh::Mesh() geometry_flags = GEOMETRY_NONE; has_volume = false; - has_mis_emission = false; has_surface_bssrdf = false; } @@ -1290,14 +1289,10 @@ void MeshManager::device_update_flags(Device * /*device*/, /* update flags */ foreach(Mesh *mesh, scene->meshes) { mesh->has_volume = false; - mesh->has_mis_emission = false; foreach(const Shader *shader, mesh->used_shaders) { if(shader->has_volume) { mesh->has_volume = true; } - if(shader->use_mis && shader->has_surface_emission) { - mesh->has_mis_emission = true; - } if(shader->has_surface_bssrdf) { mesh->has_surface_bssrdf = true; } diff --git a/intern/cycles/render/mesh.h b/intern/cycles/render/mesh.h index 8225463214d..0aea55544f2 100644 --- a/intern/cycles/render/mesh.h +++ b/intern/cycles/render/mesh.h @@ -122,7 +122,6 @@ public: array forms_quad; /* used to tell if triangle is part of a quad patch */ bool has_volume; /* Set in the device_update_flags(). */ - bool has_mis_emission; /* Set in the device_update_flags(). */ bool has_surface_bssrdf; /* Set in the device_update_flags(). */ array curve_keys;