diff options
Diffstat (limited to 'intern/cycles/render/mesh.cpp')
-rw-r--r-- | intern/cycles/render/mesh.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index 84537bf5993..c02a5222463 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -1016,7 +1016,8 @@ void Mesh::pack_patches(uint *patch_data, uint vert_offset, uint face_offset, ui } } -void Mesh::compute_bvh(DeviceScene *dscene, +void Mesh::compute_bvh(Device *device, + DeviceScene *dscene, SceneParams *params, Progress *progress, int n, @@ -1050,7 +1051,7 @@ void Mesh::compute_bvh(DeviceScene *dscene, BVHParams bparams; bparams.use_spatial_split = params->use_bvh_spatial_split; - bparams.use_qbvh = params->use_qbvh; + bparams.use_qbvh = params->use_qbvh && device->info.has_qbvh; bparams.use_unaligned_nodes = dscene->data.bvh.have_curves && params->use_bvh_unaligned_nodes; bparams.num_motion_triangle_steps = params->num_bvh_time_steps; @@ -1814,18 +1815,18 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene * /* bvh build */ progress.set_status("Updating Scene BVH", "Building"); - VLOG(1) << (scene->params.use_qbvh ? "Using QBVH optimization structure" - : "Using regular BVH optimization structure"); - BVHParams bparams; bparams.top_level = true; - bparams.use_qbvh = scene->params.use_qbvh; + bparams.use_qbvh = scene->params.use_qbvh && device->info.has_qbvh; 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"); + delete bvh; bvh = BVH::create(bparams, scene->objects); bvh->build(progress); @@ -1879,7 +1880,7 @@ void MeshManager::device_update_bvh(Device *device, DeviceScene *dscene, Scene * } dscene->data.bvh.root = pack.root_index; - dscene->data.bvh.use_qbvh = scene->params.use_qbvh; + dscene->data.bvh.use_qbvh = bparams.use_qbvh; dscene->data.bvh.use_bvh_steps = (scene->params.num_bvh_time_steps != 0); } @@ -2084,6 +2085,7 @@ void MeshManager::device_update(Device *device, DeviceScene *dscene, Scene *scen if(mesh->need_update) { pool.push(function_bind(&Mesh::compute_bvh, mesh, + device, dscene, &scene->params, &progress, |