diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-01-23 03:45:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-01-23 03:45:39 +0300 |
commit | fc1fd2704a7b1cc448b20ed5cb596784cb764224 (patch) | |
tree | 2b24db79955d2ac49e0d45d269cec0917a387cdc /intern/cycles/render | |
parent | 367e61117907bb7507935251ecb7e396a4c91cbc (diff) | |
parent | bf7e4067663cec0a3b4d3194e89a28aa62b39773 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'intern/cycles/render')
-rw-r--r-- | intern/cycles/render/mesh.cpp | 14 | ||||
-rw-r--r-- | intern/cycles/render/scene.h | 36 |
2 files changed, 40 insertions, 10 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; diff --git a/intern/cycles/render/scene.h b/intern/cycles/render/scene.h index 5f717e93b43..ea9485ff230 100644 --- a/intern/cycles/render/scene.h +++ b/intern/cycles/render/scene.h @@ -17,6 +17,8 @@ #ifndef __SCENE_H__ #define __SCENE_H__ +#include "bvh/bvh_params.h" + #include "render/image.h" #include "render/shader.h" @@ -122,39 +124,63 @@ public: class SceneParams { public: - ShadingSystem shadingsystem; + /* Type of BVH, in terms whether it is supported dynamic updates of meshes + * or whether modifying geometry requires full BVH rebuild. + */ enum BVHType { + /* BVH supports dynamic updates of geometry. + * + * Faster for updating BVH tree when doing modifications in viewport, + * but slower for rendering. + */ BVH_DYNAMIC = 0, + /* BVH tree is calculated for specific scene, updates in geometry + * requires full tree rebuild. + * + * Slower to update BVH tree when modifying objects in viewport, also + * slower to build final BVH tree but gives best possible render speed. + */ BVH_STATIC = 1, BVH_NUM_TYPES, - } bvh_type; + }; + + ShadingSystem shadingsystem; + + /* Requested BVH layout. + * + * If it's not supported by the device, the widest one from supported ones + * will be used, but BVH wider than this one will never be used. + */ + BVHLayout bvh_layout; + + BVHType bvh_type; bool use_bvh_spatial_split; bool use_bvh_unaligned_nodes; int num_bvh_time_steps; - bool use_qbvh; + bool persistent_data; int texture_limit; SceneParams() { shadingsystem = SHADINGSYSTEM_SVM; + bvh_layout = BVH_LAYOUT_BVH2; bvh_type = BVH_DYNAMIC; use_bvh_spatial_split = false; use_bvh_unaligned_nodes = true; num_bvh_time_steps = 0; - use_qbvh = true; persistent_data = false; texture_limit = 0; } bool modified(const SceneParams& params) { return !(shadingsystem == params.shadingsystem + && bvh_layout == params.bvh_layout && bvh_type == params.bvh_type && use_bvh_spatial_split == params.use_bvh_spatial_split && use_bvh_unaligned_nodes == params.use_bvh_unaligned_nodes && num_bvh_time_steps == params.num_bvh_time_steps - && use_qbvh == params.use_qbvh && persistent_data == params.persistent_data && texture_limit == params.texture_limit); } }; |