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.
This commit is contained in:
Brecht Van Lommel 2022-12-12 18:21:34 +01:00
parent 95a792a633
commit e4f9c50928
Notes: blender-bot 2023-02-14 02:13:08 +01:00
Referenced by issue #100749, Blender LTS: Maintenance Task 3.3
Referenced by issue #102990, VDB volumes super slow to start rendering (data on network share)
2 changed files with 12 additions and 3 deletions

View File

@ -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);
}
}

View File

@ -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();
}