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:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-01-19 12:59:58 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-01-22 19:19:20 +0300
commit2f79d1c0584f4d72984e56db1f5878be3360e044 (patch)
treef2385b9834d7a9e0c15be92ca5356f4bc91aa247 /intern/cycles/render/mesh.cpp
parent0f69026b1c3c07b203aeba658048f1129e41b116 (diff)
Cycles: Replace use_qbvh boolean flag with an enum-based property
This was we can introduce other types of BVH, for example, wider ones, without causing too much mess around boolean flags. Thoughs: - Ideally device info should probably return bitflag of what BVH types it supports. It is possible to implement based on simple logic in device/ and mesh.cpp, rest of the changes will stay the same. - Not happy with workarounds in util_debug and duplicated enum in kernel. Maybe enbum should be stores in kernel, but then it's kind of weird to include kernel types from utils. Soudns some cyclkic dependency. Reviewers: brecht, maxim_d33 Reviewed By: brecht Differential Revision: https://developer.blender.org/D3011
Diffstat (limited to 'intern/cycles/render/mesh.cpp')
-rw-r--r--intern/cycles/render/mesh.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp
index 5d5a416e293..4bf5b60a737 100644
--- a/intern/cycles/render/mesh.cpp
+++ b/intern/cycles/render/mesh.cpp
@@ -1058,7 +1058,9 @@ void Mesh::compute_bvh(Device *device,
BVHParams bparams;
bparams.use_spatial_split = params->use_bvh_spatial_split;
- bparams.use_qbvh = params->use_qbvh && device->info.has_qbvh;
+ bparams.bvh_layout = BVHParams::best_bvh_layout(
+ params->bvh_layout,
+ device->info.bvh_layout_mask);
bparams.use_unaligned_nodes = dscene->data.bvh.have_curves &&
params->use_bvh_unaligned_nodes;
bparams.num_motion_triangle_steps = params->num_bvh_time_steps;
@@ -1817,15 +1819,17 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene *
BVHParams bparams;
bparams.top_level = true;
- bparams.use_qbvh = scene->params.use_qbvh && device->info.has_qbvh;
+ bparams.bvh_layout = BVHParams::best_bvh_layout(
+ scene->params.bvh_layout,
+ device->info.bvh_layout_mask);
bparams.use_spatial_split = scene->params.use_bvh_spatial_split;
bparams.use_unaligned_nodes = dscene->data.bvh.have_curves &&
scene->params.use_bvh_unaligned_nodes;
bparams.num_motion_triangle_steps = scene->params.num_bvh_time_steps;
bparams.num_motion_curve_steps = scene->params.num_bvh_time_steps;
- VLOG(1) << (bparams.use_qbvh ? "Using QBVH optimization structure"
- : "Using regular BVH optimization structure");
+ VLOG(1) << "Using " << bvh_layout_name(bparams.bvh_layout)
+ << " layout.";
BVH *bvh = BVH::create(bparams, scene->objects);
bvh->build(progress);
@@ -1882,7 +1886,7 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene *
}
dscene->data.bvh.root = pack.root_index;
- dscene->data.bvh.use_qbvh = bparams.use_qbvh;
+ dscene->data.bvh.bvh_layout = bparams.bvh_layout;
dscene->data.bvh.use_bvh_steps = (scene->params.num_bvh_time_steps != 0);
delete bvh;