On shader changes, make sure these are uploaded in the cases where an expensive object rebuild isn't required #6

Open
Alex Fuller wants to merge 1 commits from boberfly/cycles:volume_shader into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
3 changed files with 28 additions and 12 deletions

View File

@ -435,19 +435,24 @@ void GeometryManager::device_update_preprocess(Device *device, Scene *scene, Pro
/* Re-create volume mesh if we will rebuild or refit the BVH. Note we
* should only do it in that case, otherwise the BVH and mesh can go
* out of sync. */
if (geom->is_modified() && geom->geometry_type == Geometry::VOLUME) {
/* Create volume meshes if there is voxel data. */
if (!volume_images_updated) {
progress.set_status("Updating Meshes Volume Bounds");
device_update_volume_images(device, scene, progress);
volume_images_updated = true;
if (geom->is_volume()) {
if (geom->need_update_rebuild) {
/* Create volume meshes if there is voxel data. */
if (!volume_images_updated) {
progress.set_status("Updating Meshes Volume Bounds");
device_update_volume_images(device, scene, progress);
volume_images_updated = true;
}
Volume *volume = static_cast<Volume *>(geom);
create_volume_mesh(scene, volume, progress);
/* always reallocate when we have a volume, as we need to rebuild the BVH */
device_update_flags |= DEVICE_MESH_DATA_NEEDS_REALLOC;
}
else if (geom->is_modified()) {
device_update_flags |= DEVICE_MESH_DATA_MODIFIED;
}
Volume *volume = static_cast<Volume *>(geom);
create_volume_mesh(scene, volume, progress);
/* always reallocate when we have a volume, as we need to rebuild the BVH */
device_update_flags |= DEVICE_MESH_DATA_NEEDS_REALLOC;
}
if (geom->is_hair()) {

View File

@ -265,4 +265,13 @@ openvdb::GridBase::ConstPtr VDBImageLoader::get_grid()
}
#endif
int VDBImageLoader::get_precision() const
{
#ifdef WITH_NANOVDB
return precision;
#else
return 0;
#endif
}
CCL_NAMESPACE_END

View File

@ -40,6 +40,8 @@ class VDBImageLoader : public ImageLoader {
virtual bool is_vdb_loader() const override;
int get_precision() const;
#ifdef WITH_OPENVDB
openvdb::GridBase::ConstPtr get_grid();
#endif