[Bf-blender-cvs] [d2050c7c36a] blender-v3.3-release: Fix T102990: OpenVDB files load very slow from network drives

Brecht Van Lommel noreply at git.blender.org
Thu Jan 12 15:54:20 CET 2023


Commit: d2050c7c36a709b19dcf878eee63b491eb51619b
Author: Brecht Van Lommel
Date:   Mon Dec 12 18:21:34 2022 +0100
Branches: blender-v3.3-release
https://developer.blender.org/rBd2050c7c36a709b19dcf878eee63b491eb51619b

Fix T102990: OpenVDB files load very slow from network drives

The OpenVDB delay loading of voxel leaf data using mmap works poorly on network
drives. It has a mechanism to make a temporary local file copy to avoid this,
but we disabled that as it leads to other problems.

Now disable delay loading entirely. It's not clear that this has much benefit
in Blender. For rendering we need to load the entire grid to convert to NanoVDB,
and for geometry nodes there also are no cases where we only need part of grids.

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

M	intern/cycles/hydra/field.cpp
M	source/blender/blenkernel/intern/volume.cc

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

diff --git a/intern/cycles/hydra/field.cpp b/intern/cycles/hydra/field.cpp
index 67945be9d52..7cdb4c80d79 100644
--- a/intern/cycles/hydra/field.cpp
+++ b/intern/cycles/hydra/field.cpp
@@ -26,9 +26,12 @@ class HdCyclesVolumeLoader : public VDBImageLoader {
   HdCyclesVolumeLoader(const std::string &filePath, const std::string &gridName)
       : VDBImageLoader(gridName)
   {
+    /* Disably delay loading and file copying, this has poor performance
+     * on network drivers. */
+    const bool delay_load = false;
     openvdb::io::File file(filePath);
     file.setCopyMaxBytes(0);
-    if (file.open()) {
+    if (file.open(delay_load)) {
       grid = file.readGrid(gridName);
     }
   }
diff --git a/source/blender/blenkernel/intern/volume.cc b/source/blender/blenkernel/intern/volume.cc
index d7762400f64..2b71cb2c096 100644
--- a/source/blender/blenkernel/intern/volume.cc
+++ b/source/blender/blenkernel/intern/volume.cc
@@ -324,8 +324,11 @@ struct VolumeGrid {
      * holding a mutex lock. */
     blender::threading::isolate_task([&] {
       try {
+        /* Disably delay loading and file copying, this has poor performance
+         * on network drivers. */
+        const bool delay_load = false;
         file.setCopyMaxBytes(0);
-        file.open();
+        file.open(delay_load);
         openvdb::GridBase::Ptr vdb_grid = file.readGrid(name());
         entry->grid->setTree(vdb_grid->baseTreePtr());
       }
@@ -886,8 +889,11 @@ bool BKE_volume_load(const Volume *volume, const Main *bmain)
   openvdb::GridPtrVec vdb_grids;
 
   try {
+    /* Disably delay loading and file copying, this has poor performance
+     * on network drivers. */
+    const bool delay_load = false;
     file.setCopyMaxBytes(0);
-    file.open();
+    file.open(delay_load);
     vdb_grids = *(file.readAllGridMetadata());
     grids.metadata = file.getMetadata();
   }



More information about the Bf-blender-cvs mailing list