[Bf-blender-cvs] [0ea4baa94d8] tmp-worbench-rewrite2-optimizations: Revert "Experimental bbox cache"

Miguel Pozo noreply at git.blender.org
Tue Jan 17 16:15:31 CET 2023


Commit: 0ea4baa94d8c0720693310614c05366457a99fbe
Author: Miguel Pozo
Date:   Wed Jan 11 17:28:29 2023 +0100
Branches: tmp-worbench-rewrite2-optimizations
https://developer.blender.org/rB0ea4baa94d8c0720693310614c05366457a99fbe

Revert "Experimental bbox cache"

This reverts commit 49e9d105f0e9d97fe2ff76ae6e4da04d94740a7b.

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

M	source/blender/draw/intern/draw_manager_data.cc
M	source/blender/draw/intern/draw_resource.hh

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

diff --git a/source/blender/draw/intern/draw_manager_data.cc b/source/blender/draw/intern/draw_manager_data.cc
index 01cdf785a05..5b4e0792577 100644
--- a/source/blender/draw/intern/draw_manager_data.cc
+++ b/source/blender/draw/intern/draw_manager_data.cc
@@ -719,18 +719,8 @@ static void drw_call_obinfos_init(DRWObjectInfos *ob_infos, Object *ob)
 
 static void drw_call_culling_init(DRWCullingState *cull, Object *ob)
 {
-  /* WORKAROUND (Experimental):
-   * Store the last retrieved bbox so each object instance doesn't have to malloc a new one */
-  static const BoundBox *bbox_cache = nullptr;
-  static const void *object_data_cache = nullptr;
-
-  if (ob != nullptr && ob->data != object_data_cache) {
-    // object_data_cache = ob->data;
-    bbox_cache = BKE_object_boundbox_get(ob);
-  }
-  const BoundBox *bbox = bbox_cache;
-
-  if (ob != nullptr && bbox != nullptr) {
+  const BoundBox *bbox;
+  if (ob != nullptr && (bbox = BKE_object_boundbox_get(ob))) {
     float corner[3];
     /* Get BoundSphere center and radius from the BoundBox. */
     mid_v3_v3v3(cull->bsphere.center, bbox->vec[0], bbox->vec[6]);
diff --git a/source/blender/draw/intern/draw_resource.hh b/source/blender/draw/intern/draw_resource.hh
index d1a6b2a5468..a2de084b900 100644
--- a/source/blender/draw/intern/draw_resource.hh
+++ b/source/blender/draw/intern/draw_resource.hh
@@ -151,17 +151,7 @@ inline void ObjectBounds::sync()
 
 inline void ObjectBounds::sync(Object &ob)
 {
-  /* WORKAROUND (Experimental):
-   * Store the last retrieved bbox so each object instance doesn't have to malloc a new one */
-  static const BoundBox *bbox_cache = nullptr;
-  static const void *object_data_cache = nullptr;
-
-  if (ob.data != object_data_cache) {
-    // object_data_cache = ob.data;
-    bbox_cache = BKE_object_boundbox_get(&ob);
-  }
-
-  const BoundBox *bbox = bbox_cache;
+  const BoundBox *bbox = BKE_object_boundbox_get(&ob);
   if (bbox == nullptr) {
     bounding_sphere.w = -1.0f; /* Disable test. */
     return;



More information about the Bf-blender-cvs mailing list