[Bf-blender-cvs] [6bc78f071ce] cycles_procedural_api: Merge branch 'master' into cycles_procedural_api

Kévin Dietrich noreply at git.blender.org
Sat Oct 3 04:18:23 CEST 2020


Commit: 6bc78f071ced44734534b1356febbc85a1414606
Author: Kévin Dietrich
Date:   Fri Oct 2 05:02:40 2020 +0200
Branches: cycles_procedural_api
https://developer.blender.org/rB6bc78f071ced44734534b1356febbc85a1414606

Merge branch 'master' into cycles_procedural_api

===================================================================



===================================================================

diff --cc intern/cycles/render/background.cpp
index 9769ec464ca,d2463454522..7bdcb1578c3
--- a/intern/cycles/render/background.cpp
+++ b/intern/cycles/render/background.cpp
@@@ -61,9 -64,15 +63,15 @@@ Background::~Background(
  
  void Background::device_update(Device *device, DeviceScene *dscene, Scene *scene)
  {
 -  if (!need_update)
 +  if (!is_modified())
      return;
  
+   scoped_callback_timer timer([scene](double time) {
+     if (scene->update_stats) {
+       scene->update_stats->background.times.add_entry({"device_update", time});
+     }
+   });
+ 
    device_free(device, dscene);
  
    Shader *bg_shader = get_shader(scene);
diff --cc intern/cycles/render/camera.cpp
index ebfa6ff02ca,ee68c9ede22..599685b4bc9
--- a/intern/cycles/render/camera.cpp
+++ b/intern/cycles/render/camera.cpp
@@@ -237,9 -230,15 +239,15 @@@ void Camera::update(Scene *scene
      need_device_update = true;
    }
  
 -  if (!need_update)
 +  if (!is_modified())
      return;
  
+   scoped_callback_timer timer([scene](double time) {
+     if (scene->update_stats) {
+       scene->update_stats->camera.times.add_entry({"update", time});
+     }
+   });
+ 
    /* Full viewport to camera border in the viewport. */
    Transform fulltoborder = transform_from_viewplane(viewport_camera_border);
    Transform bordertofull = transform_inverse(fulltoborder);
diff --cc intern/cycles/render/film.cpp
index c280a1ab8b5,e4c1e452bd5..53e7a341618
--- a/intern/cycles/render/film.cpp
+++ b/intern/cycles/render/film.cpp
@@@ -424,9 -407,15 +426,15 @@@ void Film::add_default(Scene *scene
  
  void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene)
  {
 -  if (!need_update)
 +  if (!is_modified())
      return;
  
+   scoped_callback_timer timer([scene](double time) {
+     if (scene->update_stats) {
+       scene->update_stats->film.times.add_entry({"update", time});
+     }
+   });
+ 
    device_free(device, dscene, scene);
  
    KernelFilm *kfilm = &dscene->data.film;
diff --cc intern/cycles/render/geometry.cpp
index 5c43178ad73,d96dc15f400..6a4bf0e7d6b
--- a/intern/cycles/render/geometry.cpp
+++ b/intern/cycles/render/geometry.cpp
@@@ -1241,38 -1237,44 +1247,46 @@@ void GeometryManager::device_update(Dev
    bool true_displacement_used = false;
    size_t total_tess_needed = 0;
  
-   foreach (Geometry *geom, scene->geometry) {
-     foreach (Node *node, geom->get_used_shaders()) {
-       Shader *shader = static_cast<Shader *>(node);
-       if (shader->need_update_geometry)
-         geom->tag_modified();
-     }
+   {
+     scoped_callback_timer timer([scene](double time) {
+       if (scene->update_stats) {
+         scene->update_stats->geometry.times.add_entry({"device_update (normals)", time});
+       }
+     });
  
-     if (geom->is_modified() &&
-         (geom->geometry_type == Geometry::MESH || geom->geometry_type == Geometry::VOLUME)) {
-       Mesh *mesh = static_cast<Mesh *>(geom);
+     foreach (Geometry *geom, scene->geometry) {
 -      foreach (Shader *shader, geom->used_shaders) {
++      foreach (Node *node, geom->get_used_shaders()) {
++        Shader *shader = static_cast<Shader *>(node);
+         if (shader->need_update_geometry)
 -          geom->need_update = true;
++          geom->tag_modified();
+       }
  
-       /* Update normals. */
-       mesh->add_face_normals();
-       mesh->add_vertex_normals();
 -      if (geom->need_update && (geom->type == Geometry::MESH || geom->type == Geometry::VOLUME)) {
++      if (geom->is_modified() &&
++          (geom->geometry_type == Geometry::MESH || geom->geometry_type == Geometry::VOLUME)) {
+         Mesh *mesh = static_cast<Mesh *>(geom);
  
-       if (mesh->need_attribute(scene, ATTR_STD_POSITION_UNDISPLACED)) {
-         mesh->add_undisplaced();
-       }
+         /* Update normals. */
+         mesh->add_face_normals();
+         mesh->add_vertex_normals();
  
-       /* Test if we need tessellation. */
-       if (mesh->subdivision_type != Mesh::SUBDIVISION_NONE && mesh->num_subd_verts == 0 &&
-           mesh->subd_params) {
-         total_tess_needed++;
-       }
+         if (mesh->need_attribute(scene, ATTR_STD_POSITION_UNDISPLACED)) {
+           mesh->add_undisplaced();
+         }
  
-       /* Test if we need displacement. */
-       if (mesh->has_true_displacement()) {
-         true_displacement_used = true;
-       }
+         /* Test if we need tessellation. */
+         if (mesh->subdivision_type != Mesh::SUBDIVISION_NONE && mesh->num_subd_verts == 0 &&
+             mesh->subd_params) {
+           total_tess_needed++;
+         }
  
-       if (progress.get_cancel())
-         return;
+         /* Test if we need displacement. */
+         if (mesh->has_true_displacement()) {
+           true_displacement_used = true;
+         }
+ 
+         if (progress.get_cancel())
+           return;
+       }
      }
    }
  
@@@ -1330,32 -1350,47 +1362,47 @@@
    if (progress.get_cancel())
      return;
  
-   device_update_attributes(device, dscene, scene, progress);
-   if (progress.get_cancel())
-     return;
+   {
+     scoped_callback_timer timer([scene](double time) {
+       if (scene->update_stats) {
+         scene->update_stats->geometry.times.add_entry({"device_update (attributes)", time});
+       }
+     });
+     device_update_attributes(device, dscene, scene, progress);
+     if (progress.get_cancel())
+       return;
+   }
  
    /* Update displacement. */
-   bool displacement_done = false;
-   size_t num_bvh = 0;
    BVHLayout bvh_layout = BVHParams::best_bvh_layout(scene->params.bvh_layout,
                                                      device->get_bvh_layout_mask());
+   bool displacement_done = false;
+   size_t num_bvh = 0;
  
-   foreach (Geometry *geom, scene->geometry) {
-     if (geom->is_modified()) {
-       if (geom->is_mesh()) {
-         Mesh *mesh = static_cast<Mesh *>(geom);
-         if (displace(device, dscene, scene, mesh, progress)) {
-           displacement_done = true;
-         }
+   {
+     scoped_callback_timer timer([scene](double time) {
+       if (scene->update_stats) {
+         scene->update_stats->geometry.times.add_entry({"device_update (displacement)", time});
        }
+     });
  
-       if (geom->need_build_bvh(bvh_layout)) {
-         num_bvh++;
+     foreach (Geometry *geom, scene->geometry) {
 -      if (geom->need_update) {
 -        if (geom->type == Geometry::MESH) {
++      if (geom->is_modified()) {
++        if (geom->is_mesh()) {
+           Mesh *mesh = static_cast<Mesh *>(geom);
+           if (displace(device, dscene, scene, mesh, progress)) {
+             displacement_done = true;
+           }
+         }
+ 
+         if (geom->need_build_bvh(bvh_layout)) {
+           num_bvh++;
+         }
        }
-     }
  
-     if (progress.get_cancel())
-       return;
+       if (progress.get_cancel())
+         return;
+     }
    }
  
    /* Device re-update after displacement. */
@@@ -1367,22 -1408,29 +1420,29 @@@
        return;
    }
  
-   TaskPool pool;
+   {
+     scoped_callback_timer timer([scene](double time) {
+       if (scene->update_stats) {
+         scene->update_stats->geometry.times.add_entry({"device_update (build object BVHs)", time});
+       }
+     });
+     TaskPool pool;
  
-   size_t i = 0;
-   foreach (Geometry *geom, scene->geometry) {
-     if (geom->is_modified()) {
-       pool.push(function_bind(
-           &Geometry::compute_bvh, geom, device, dscene, &scene->params, &progress, i, num_bvh));
-       if (geom->need_build_bvh(bvh_layout)) {
-         i++;
+     size_t i = 0;
+     foreach (Geometry *geom, scene->geometry) {
 -      if (geom->need_update) {
++      if (geom->is_modified()) {
+         pool.push(function_bind(
+             &Geometry::compute_bvh, geom, device, dscene, &scene->params, &progress, i, num_bvh));
+         if (geom->need_build_bvh(bvh_layout)) {
+           i++;
+         }
        }
      }
-   }
  
-   TaskPool::Summary summary;
-   pool.wait_work(&summary);
-   VLOG(2) << "Objects BVH build pool statistics:\n" << summary.full_report();
+     TaskPool::Summary summary;
+     pool.wait_work(&summary);
+     VLOG(2) << "Objects BVH build pool statistics:\n" << summary.full_report();
+   }
  
    foreach (Shader *shader, scene->shaders) {
      shader->need_update_geometry = false;
diff --cc intern/cycles/render/integrator.cpp
index 3d6db992a7a,cc085af20a0..3dc4b2fd4c5
--- a/intern/cycles/render/integrator.cpp
+++ b/intern/cycles/render/integrator.cpp
@@@ -102,9 -105,15 +104,15 @@@ Integrator::~Integrator(
  
  void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene)
  {
 -  if (!need_update)
 +  if (!is_modified())
      return;
  
+   scoped_callback_timer timer([scene](double time) {
+     if (scene->update_stats) {
+       scene->update_stats->integrator.times.add_entry({"device_update", time});
+     }
+   });
+ 
    device_free(device, dscene);
  
    KernelIntegrator *kintegrator = &dscene->data.integrator;
diff --cc intern/cycles/render/scene.cpp
index 4e8d8241431,e98b2c76e88..d844efce7ea
--- a/intern/cycles/render/scene.cpp
+++ b/intern/cycles/render/scene.cpp
@@@ -194,7 -189,7 +195,8 @@@ void Scene::free_memory(bool final
      delete particle_system_manager;
      delete image_manager;
      delete bake_manager;
+     delete update_stats;
 +    delete procedural_manager;
    }
  }



More information about the Bf-blender-cvs mailing list