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>2017-01-17 17:34:18 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-01-20 14:46:18 +0300
commit1ad04c7d65b0e9e3efa8563005e91d9aa419fec5 (patch)
tree99912cb1c7c6506388da1ca623f025ba985dd214 /intern/cycles/bvh/bvh.cpp
parentc4890cd354bdba341be5b5fb9cf3724ee294634b (diff)
Cycles: Store time in BVH nodes
This way we can stop traversing BVH node early on. Gives about 2-2.5x times render time improvement with 3 BVH steps. Hopefully this gives no measurable performance loss for scenes with single BVH step. Traversal is currently only implemented for QBVH, meaning old CPUs and GPU do not benefit from this change.
Diffstat (limited to 'intern/cycles/bvh/bvh.cpp')
-rw-r--r--intern/cycles/bvh/bvh.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/intern/cycles/bvh/bvh.cpp b/intern/cycles/bvh/bvh.cpp
index 4851de5b481..874a4246d1d 100644
--- a/intern/cycles/bvh/bvh.cpp
+++ b/intern/cycles/bvh/bvh.cpp
@@ -845,6 +845,8 @@ void QBVH::pack_aligned_inner(const BVHStackEntry& e,
bounds,
child,
e.node->m_visibility,
+ e.node->m_time_from,
+ e.node->m_time_to,
num);
}
@@ -852,12 +854,17 @@ void QBVH::pack_aligned_node(int idx,
const BoundBox *bounds,
const int *child,
const uint visibility,
+ const float time_from,
+ const float time_to,
const int num)
{
float4 data[BVH_QNODE_SIZE];
memset(data, 0, sizeof(data));
data[0].x = __uint_as_float(visibility & ~PATH_RAY_NODE_UNALIGNED);
+ data[0].y = time_from;
+ data[0].z = time_to;
+
for(int i = 0; i < num; i++) {
float3 bb_min = bounds[i].min;
float3 bb_max = bounds[i].max;
@@ -908,6 +915,8 @@ void QBVH::pack_unaligned_inner(const BVHStackEntry& e,
bounds,
child,
e.node->m_visibility,
+ e.node->m_time_from,
+ e.node->m_time_to,
num);
}
@@ -916,12 +925,16 @@ void QBVH::pack_unaligned_node(int idx,
const BoundBox *bounds,
const int *child,
const uint visibility,
+ const float time_from,
+ const float time_to,
const int num)
{
float4 data[BVH_UNALIGNED_QNODE_SIZE];
memset(data, 0, sizeof(data));
data[0].x = __uint_as_float(visibility | PATH_RAY_NODE_UNALIGNED);
+ data[0].y = time_from;
+ data[0].z = time_to;
for(int i = 0; i < num; i++) {
Transform space = BVHUnaligned::compute_node_transform(
@@ -1207,6 +1220,8 @@ void QBVH::refit_node(int idx, bool leaf, BoundBox& bbox, uint& visibility)
child_bbox,
&c[0],
visibility,
+ 0.0f,
+ 1.0f,
4);
}
else {
@@ -1214,6 +1229,8 @@ void QBVH::refit_node(int idx, bool leaf, BoundBox& bbox, uint& visibility)
child_bbox,
&c[0],
visibility,
+ 0.0f,
+ 1.0f,
4);
}
}