Cleanup: Remove some underlying code for the BVH disk cache.
Notes: - There is still some bvh cache code, but that is from the engines initial commit, we might clean this up further or keep it. - Changes in util_cache.h/.c are kept, this might be re-used in the future.
This commit is contained in:
@@ -102,7 +102,6 @@ bool BVH::cache_read(CacheData& key)
|
|||||||
CacheData value;
|
CacheData value;
|
||||||
|
|
||||||
if(Cache::global.lookup(key, value)) {
|
if(Cache::global.lookup(key, value)) {
|
||||||
cache_filename = key.get_filename();
|
|
||||||
|
|
||||||
if(!(value.read(pack.root_index) &&
|
if(!(value.read(pack.root_index) &&
|
||||||
value.read(pack.SAH) &&
|
value.read(pack.SAH) &&
|
||||||
@@ -151,26 +150,6 @@ void BVH::cache_write(CacheData& key)
|
|||||||
value.add(pack.prim_object);
|
value.add(pack.prim_object);
|
||||||
|
|
||||||
Cache::global.insert(key, value);
|
Cache::global.insert(key, value);
|
||||||
|
|
||||||
cache_filename = key.get_filename();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BVH::clear_cache_except()
|
|
||||||
{
|
|
||||||
set<string> except;
|
|
||||||
|
|
||||||
if(!cache_filename.empty())
|
|
||||||
except.insert(cache_filename);
|
|
||||||
|
|
||||||
foreach(Object *ob, objects) {
|
|
||||||
Mesh *mesh = ob->mesh;
|
|
||||||
BVH *bvh = mesh->bvh;
|
|
||||||
|
|
||||||
if(bvh && !bvh->cache_filename.empty())
|
|
||||||
except.insert(bvh->cache_filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
Cache::global.clear_except("bvh", except);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Building */
|
/* Building */
|
||||||
@@ -234,10 +213,6 @@ void BVH::build(Progress& progress)
|
|||||||
if(params.use_cache) {
|
if(params.use_cache) {
|
||||||
progress.set_substatus("Writing BVH cache");
|
progress.set_substatus("Writing BVH cache");
|
||||||
cache_write(key);
|
cache_write(key);
|
||||||
|
|
||||||
/* clear other bvh files from cache */
|
|
||||||
if(params.top_level)
|
|
||||||
clear_cache_except();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include "bvh_params.h"
|
#include "bvh_params.h"
|
||||||
|
|
||||||
#include "util_string.h"
|
|
||||||
#include "util_types.h"
|
#include "util_types.h"
|
||||||
#include "util_vector.h"
|
#include "util_vector.h"
|
||||||
|
|
||||||
@@ -87,7 +86,6 @@ public:
|
|||||||
PackedBVH pack;
|
PackedBVH pack;
|
||||||
BVHParams params;
|
BVHParams params;
|
||||||
vector<Object*> objects;
|
vector<Object*> objects;
|
||||||
string cache_filename;
|
|
||||||
|
|
||||||
static BVH *create(const BVHParams& params, const vector<Object*>& objects);
|
static BVH *create(const BVHParams& params, const vector<Object*>& objects);
|
||||||
virtual ~BVH() {}
|
virtual ~BVH() {}
|
||||||
@@ -95,8 +93,6 @@ public:
|
|||||||
void build(Progress& progress);
|
void build(Progress& progress);
|
||||||
void refit(Progress& progress);
|
void refit(Progress& progress);
|
||||||
|
|
||||||
void clear_cache_except();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BVH(const BVHParams& params, const vector<Object*>& objects);
|
BVH(const BVHParams& params, const vector<Object*>& objects);
|
||||||
|
|
||||||
|
@@ -513,7 +513,6 @@ void Mesh::compute_bvh(SceneParams *params, Progress *progress, int n, int total
|
|||||||
progress->set_status(msg, "Building BVH");
|
progress->set_status(msg, "Building BVH");
|
||||||
|
|
||||||
BVHParams bparams;
|
BVHParams bparams;
|
||||||
bparams.use_cache = params->use_bvh_cache;
|
|
||||||
bparams.use_spatial_split = params->use_bvh_spatial_split;
|
bparams.use_spatial_split = params->use_bvh_spatial_split;
|
||||||
bparams.use_qbvh = params->use_qbvh;
|
bparams.use_qbvh = params->use_qbvh;
|
||||||
|
|
||||||
@@ -1084,7 +1083,6 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene *
|
|||||||
bparams.top_level = true;
|
bparams.top_level = true;
|
||||||
bparams.use_qbvh = scene->params.use_qbvh;
|
bparams.use_qbvh = scene->params.use_qbvh;
|
||||||
bparams.use_spatial_split = scene->params.use_bvh_spatial_split;
|
bparams.use_spatial_split = scene->params.use_bvh_spatial_split;
|
||||||
bparams.use_cache = scene->params.use_bvh_cache;
|
|
||||||
|
|
||||||
delete bvh;
|
delete bvh;
|
||||||
bvh = BVH::create(bparams, scene->objects);
|
bvh = BVH::create(bparams, scene->objects);
|
||||||
|
Reference in New Issue
Block a user