[Bf-blender-cvs] [e4f9c50928d] master: Fix T102990: OpenVDB files load very slow from network drives

Brecht Van Lommel noreply at git.blender.org
Mon Dec 12 18:30:57 CET 2022


Commit: e4f9c50928d36b5eb61b36f2393439bd2d72e004
Author: Brecht Van Lommel
Date:   Mon Dec 12 18:21:34 2022 +0100
Branches: master
https://developer.blender.org/rBe4f9c50928d36b5eb61b36f2393439bd2d72e004

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 e81657f9ef0..ae921764de4 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());
       }
@@ -883,8 +886,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