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>2016-06-14 15:29:09 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-07-07 18:25:48 +0300
commit1a2012145d6e7953c225b4f9873a4bc6415c7fd6 (patch)
treeb94b047c909d6d67c905411353fe208b44cd11ac /intern/cycles/kernel/geom/geom_bvh_subsurface.h
parent17e745426375fe76f5011992d582c01b682d348b (diff)
Cycles: Switch node address to absolute values in BVH tree
This seems to be straightforward way to support heterogeneous nodes in the same tree. There is some penalty related on 4gig limit of the address space now, but here's are the thing: Traversal code was already using ints to store final offset, so there can't be regressions really. This is a required commit to make it possible to encode both aligned and unaligned nodes in the same array. Also, in the future we can use this to get rid of __leaf_nodes array (which is a bit tricky to do since trickery in pack_instances().
Diffstat (limited to 'intern/cycles/kernel/geom/geom_bvh_subsurface.h')
-rw-r--r--intern/cycles/kernel/geom/geom_bvh_subsurface.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/intern/cycles/kernel/geom/geom_bvh_subsurface.h b/intern/cycles/kernel/geom/geom_bvh_subsurface.h
index a5243f079f2..e43eedad7bc 100644
--- a/intern/cycles/kernel/geom/geom_bvh_subsurface.h
+++ b/intern/cycles/kernel/geom/geom_bvh_subsurface.h
@@ -113,10 +113,10 @@ ccl_device void BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
float t = isect_t;
/* fetch node data */
- float4 node0 = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+0);
- float4 node1 = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+1);
- float4 node2 = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+2);
- float4 cnodes = kernel_tex_fetch(__bvh_nodes, nodeAddr*BVH_NODE_SIZE+3);
+ float4 node0 = kernel_tex_fetch(__bvh_nodes, nodeAddr+0);
+ float4 node1 = kernel_tex_fetch(__bvh_nodes, nodeAddr+1);
+ float4 node2 = kernel_tex_fetch(__bvh_nodes, nodeAddr+2);
+ float4 cnodes = kernel_tex_fetch(__bvh_nodes, nodeAddr+3);
/* intersect ray against child nodes */
float c0lox = (node0.x - P.x) * idir.x;
@@ -145,7 +145,7 @@ ccl_device void BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
/* Intersect two child bounding boxes, SSE3 version adapted from Embree */
/* fetch node data */
- const ssef *bvh_nodes = (ssef*)kg->__bvh_nodes.data + nodeAddr*BVH_NODE_SIZE;
+ const ssef *bvh_nodes = (ssef*)kg->__bvh_nodes.data + nodeAddr;
const float4 cnodes = ((float4*)bvh_nodes)[3];
/* intersect ray against child nodes */
@@ -199,7 +199,7 @@ ccl_device void BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
/* if node is leaf, fetch triangle list */
if(nodeAddr < 0) {
- float4 leaf = kernel_tex_fetch(__bvh_leaf_nodes, (-nodeAddr-1)*BVH_NODE_LEAF_SIZE);
+ float4 leaf = kernel_tex_fetch(__bvh_leaf_nodes, (-nodeAddr-1));
int primAddr = __float_as_int(leaf.x);
const int primAddr2 = __float_as_int(leaf.y);