Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2016-11-13 17:14:16 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2016-11-13 17:14:16 +0300
commit235932ba2e2d33b15b436b40f48106451d34eb74 (patch)
tree0c467203ef99cc707a536644d1d7693c446e5b3a
parent736e3cd434a5d45d398878bd826a210cf342b8b3 (diff)
Fix various cleanup issues and inconsistencies.
All volumes are held in the scene volumes list now, so VolumeManager doesn't need to free them explicitly. The ImageManager reference in VoxelAttribute is an artifact from smoke rendering, this should be phased out eventually and can be assumed to be NULL for Volumes. Make sure the VolumeManager cleans up the device memory properly, in particular the ray intersector instances must be freed.
-rw-r--r--intern/cycles/render/attribute.cpp3
-rw-r--r--intern/cycles/render/scene.cpp3
-rw-r--r--intern/cycles/render/volume.cpp23
3 files changed, 18 insertions, 11 deletions
diff --git a/intern/cycles/render/attribute.cpp b/intern/cycles/render/attribute.cpp
index 97f98689132..12fa58a84e2 100644
--- a/intern/cycles/render/attribute.cpp
+++ b/intern/cycles/render/attribute.cpp
@@ -33,7 +33,8 @@ Attribute::~Attribute()
VoxelAttribute *voxel_data = data_voxel();
if(voxel_data && voxel_data->slot != -1) {
- voxel_data->manager->remove_image(voxel_data->slot);
+ if (voxel_data->manager)
+ voxel_data->manager->remove_image(voxel_data->slot);
}
}
}
diff --git a/intern/cycles/render/scene.cpp b/intern/cycles/render/scene.cpp
index cb057beb40a..bfe7fd8990d 100644
--- a/intern/cycles/render/scene.cpp
+++ b/intern/cycles/render/scene.cpp
@@ -85,12 +85,15 @@ void Scene::free_memory(bool final)
delete l;
foreach(ParticleSystem *p, particle_systems)
delete p;
+ foreach(Volume *v, volumes)
+ delete v;
shaders.clear();
meshes.clear();
objects.clear();
lights.clear();
particle_systems.clear();
+ volumes.clear();
if(device) {
camera->device_free(device, &dscene, this);
diff --git a/intern/cycles/render/volume.cpp b/intern/cycles/render/volume.cpp
index 47c9e915180..c8b4fe6379c 100644
--- a/intern/cycles/render/volume.cpp
+++ b/intern/cycles/render/volume.cpp
@@ -50,15 +50,6 @@ VolumeManager::VolumeManager()
VolumeManager::~VolumeManager()
{
- for (size_t i = 0; i < volumes.size(); ++i) {
- Volume *volume = volumes[i];
-
-#ifdef WITH_OPENVDB
- volume->scalar_grids.clear();
- volume->vector_grids.clear();
-#endif
- }
-
current_grids.clear();
}
@@ -510,8 +501,20 @@ void VolumeManager::device_update(Device *device, DeviceScene *dscene, Scene *sc
need_update = false;
}
-void VolumeManager::device_free(Device */*device*/, DeviceScene */*dscene*/)
+void VolumeManager::device_free(Device *device, DeviceScene *dscene)
{
+#ifdef WITH_OPENVDB
+ OpenVDBGlobals *vdb = device->vdb_memory();
+ for (size_t i = 0; i < vdb->scalar_main_isectors.size(); ++i) {
+ delete vdb->scalar_main_isectors[i];
+ }
+ for (size_t i = 0; i < vdb->vector_main_isectors.size(); ++i) {
+ delete vdb->vector_main_isectors[i];
+ }
+#endif
+
+ device->tex_free(dscene->vol_shader);
+ dscene->vol_shader.clear();
}
void VolumeManager::tag_update(Scene */*scene*/)