[Bf-blender-cvs] [cf82b49] master: Cycles: Cleanup, variables name
Sergey Sharybin
noreply at git.blender.org
Mon Jul 11 14:04:22 CEST 2016
Commit: cf82b49a0fd116d87b4c7e96e39bb02fb9e964bf
Author: Sergey Sharybin
Date: Mon Jul 11 13:44:19 2016 +0200
Branches: master
https://developer.blender.org/rBcf82b49a0fd116d87b4c7e96e39bb02fb9e964bf
Cycles: Cleanup, variables name
Using camel case for variables is something what didn't came from our original
code, but rather from third party libraries. Let's avoid those as much as possible.
===================================================================
M intern/cycles/kernel/bvh/bvh_nodes.h
M intern/cycles/kernel/bvh/bvh_shadow_all.h
M intern/cycles/kernel/bvh/bvh_subsurface.h
M intern/cycles/kernel/bvh/bvh_traversal.h
M intern/cycles/kernel/bvh/bvh_volume.h
M intern/cycles/kernel/bvh/bvh_volume_all.h
M intern/cycles/kernel/bvh/qbvh_nodes.h
M intern/cycles/kernel/bvh/qbvh_shadow_all.h
M intern/cycles/kernel/bvh/qbvh_subsurface.h
M intern/cycles/kernel/bvh/qbvh_traversal.h
M intern/cycles/kernel/bvh/qbvh_volume.h
M intern/cycles/kernel/bvh/qbvh_volume_all.h
===================================================================
diff --git a/intern/cycles/kernel/bvh/bvh_nodes.h b/intern/cycles/kernel/bvh/bvh_nodes.h
index 5b0d878..a809683 100644
--- a/intern/cycles/kernel/bvh/bvh_nodes.h
+++ b/intern/cycles/kernel/bvh/bvh_nodes.h
@@ -17,11 +17,11 @@
// TODO(sergey): Look into avoid use of full Transform and use 3x3 matrix and
// 3-vector which might be faster.
ccl_device_inline Transform bvh_unaligned_node_fetch_space(KernelGlobals *kg,
- int nodeAddr,
+ int node_addr,
int child)
{
Transform space;
- const int child_addr = nodeAddr + child * 3;
+ const int child_addr = node_addr + child * 3;
space.x = kernel_tex_fetch(__bvh_nodes, child_addr+1);
space.y = kernel_tex_fetch(__bvh_nodes, child_addr+2);
space.z = kernel_tex_fetch(__bvh_nodes, child_addr+3);
@@ -34,16 +34,16 @@ ccl_device_inline int bvh_aligned_node_intersect(KernelGlobals *kg,
const float3 P,
const float3 idir,
const float t,
- const int nodeAddr,
+ const int node_addr,
const uint visibility,
float dist[2])
{
/* fetch node data */
- float4 cnodes = kernel_tex_fetch(__bvh_nodes, nodeAddr+0);
- float4 node0 = kernel_tex_fetch(__bvh_nodes, nodeAddr+1);
- float4 node1 = kernel_tex_fetch(__bvh_nodes, nodeAddr+2);
- float4 node2 = kernel_tex_fetch(__bvh_nodes, nodeAddr+3);
+ float4 cnodes = kernel_tex_fetch(__bvh_nodes, node_addr+0);
+ float4 node0 = kernel_tex_fetch(__bvh_nodes, node_addr+1);
+ float4 node1 = kernel_tex_fetch(__bvh_nodes, node_addr+2);
+ float4 node2 = kernel_tex_fetch(__bvh_nodes, node_addr+3);
/* intersect ray against child nodes */
float c0lox = (node0.x - P.x) * idir.x;
@@ -83,16 +83,16 @@ ccl_device_inline int bvh_aligned_node_intersect_robust(KernelGlobals *kg,
const float t,
const float difl,
const float extmax,
- const int nodeAddr,
+ const int node_addr,
const uint visibility,
float dist[2])
{
/* fetch node data */
- float4 cnodes = kernel_tex_fetch(__bvh_nodes, nodeAddr+0);
- float4 node0 = kernel_tex_fetch(__bvh_nodes, nodeAddr+1);
- float4 node1 = kernel_tex_fetch(__bvh_nodes, nodeAddr+2);
- float4 node2 = kernel_tex_fetch(__bvh_nodes, nodeAddr+3);
+ float4 cnodes = kernel_tex_fetch(__bvh_nodes, node_addr+0);
+ float4 node0 = kernel_tex_fetch(__bvh_nodes, node_addr+1);
+ float4 node1 = kernel_tex_fetch(__bvh_nodes, node_addr+2);
+ float4 node2 = kernel_tex_fetch(__bvh_nodes, node_addr+3);
/* intersect ray against child nodes */
float c0lox = (node0.x - P.x) * idir.x;
@@ -144,26 +144,26 @@ ccl_device_inline bool bvh_unaligned_node_intersect_child(
const float3 P,
const float3 dir,
const float t,
- int nodeAddr,
+ int node_addr,
int child,
float dist[2])
{
- Transform space = bvh_unaligned_node_fetch_space(kg, nodeAddr, child);
+ Transform space = bvh_unaligned_node_fetch_space(kg, node_addr, child);
float3 aligned_dir = transform_direction(&space, dir);
float3 aligned_P = transform_point(&space, P);
float3 nrdir = -bvh_inverse_direction(aligned_dir);
- float3 tLowerXYZ = aligned_P * nrdir;
- float3 tUpperXYZ = tLowerXYZ - nrdir;
- const float tNearX = min(tLowerXYZ.x, tUpperXYZ.x);
- const float tNearY = min(tLowerXYZ.y, tUpperXYZ.y);
- const float tNearZ = min(tLowerXYZ.z, tUpperXYZ.z);
- const float tFarX = max(tLowerXYZ.x, tUpperXYZ.x);
- const float tFarY = max(tLowerXYZ.y, tUpperXYZ.y);
- const float tFarZ = max(tLowerXYZ.z, tUpperXYZ.z);
- const float tNear = max4(0.0f, tNearX, tNearY, tNearZ);
- const float tFar = min4(t, tFarX, tFarY, tFarZ);
- *dist = tNear;
- return tNear <= tFar;
+ float3 lower_xyz = aligned_P * nrdir;
+ float3 upper_xyz = lower_xyz - nrdir;
+ const float near_x = min(lower_xyz.x, upper_xyz.x);
+ const float near_y = min(lower_xyz.y, upper_xyz.y);
+ const float near_z = min(lower_xyz.z, upper_xyz.z);
+ const float far_x = max(lower_xyz.x, upper_xyz.x);
+ const float far_y = max(lower_xyz.y, upper_xyz.y);
+ const float far_z = max(lower_xyz.z, upper_xyz.z);
+ const float near = max4(0.0f, near_x, near_y, near_z);
+ const float far = min4(t, far_x, far_y, far_z);
+ *dist = near;
+ return near <= far;
}
ccl_device_inline bool bvh_unaligned_node_intersect_child_robust(
@@ -172,33 +172,33 @@ ccl_device_inline bool bvh_unaligned_node_intersect_child_robust(
const float3 dir,
const float t,
const float difl,
- int nodeAddr,
+ int node_addr,
int child,
float dist[2])
{
- Transform space = bvh_unaligned_node_fetch_space(kg, nodeAddr, child);
+ Transform space = bvh_unaligned_node_fetch_space(kg, node_addr, child);
float3 aligned_dir = transform_direction(&space, dir);
float3 aligned_P = transform_point(&space, P);
float3 nrdir = -bvh_inverse_direction(aligned_dir);
float3 tLowerXYZ = aligned_P * nrdir;
float3 tUpperXYZ = tLowerXYZ - nrdir;
- const float tNearX = min(tLowerXYZ.x, tUpperXYZ.x);
- const float tNearY = min(tLowerXYZ.y, tUpperXYZ.y);
- const float tNearZ = min(tLowerXYZ.z, tUpperXYZ.z);
- const float tFarX = max(tLowerXYZ.x, tUpperXYZ.x);
- const float tFarY = max(tLowerXYZ.y, tUpperXYZ.y);
- const float tFarZ = max(tLowerXYZ.z, tUpperXYZ.z);
- const float tNear = max4(0.0f, tNearX, tNearY, tNearZ);
- const float tFar = min4(t, tFarX, tFarY, tFarZ);
- *dist = tNear;
+ const float near_x = min(tLowerXYZ.x, tUpperXYZ.x);
+ const float near_y = min(tLowerXYZ.y, tUpperXYZ.y);
+ const float near_z = min(tLowerXYZ.z, tUpperXYZ.z);
+ const float far_x = max(tLowerXYZ.x, tUpperXYZ.x);
+ const float far_y = max(tLowerXYZ.y, tUpperXYZ.y);
+ const float far_z = max(tLowerXYZ.z, tUpperXYZ.z);
+ const float near = max4(0.0f, near_x, near_y, near_z);
+ const float gar = min4(t, far_x, far_y, far_z);
+ *dist = near;
if(difl != 0.0f) {
/* TODO(sergey): Same as for QBVH, needs a proper use. */
const float round_down = 1.0f - difl;
const float round_up = 1.0f + difl;
- return round_down*tNear <= round_up*tFar;
+ return round_down*near <= round_up*gar;
}
else {
- return tNear <= tFar;
+ return near <= gar;
}
}
@@ -207,13 +207,13 @@ ccl_device_inline int bvh_unaligned_node_intersect(KernelGlobals *kg,
const float3 dir,
const float3 idir,
const float t,
- const int nodeAddr,
+ const int node_addr,
const uint visibility,
float dist[2])
{
int mask = 0;
- float4 cnodes = kernel_tex_fetch(__bvh_nodes, nodeAddr+0);
- if(bvh_unaligned_node_intersect_child(kg, P, dir, t, nodeAddr, 0, &dist[0])) {
+ float4 cnodes = kernel_tex_fetch(__bvh_nodes, node_addr+0);
+ if(bvh_unaligned_node_intersect_child(kg, P, dir, t, node_addr, 0, &dist[0])) {
#ifdef __VISIBILITY_FLAG__
if((__float_as_uint(cnodes.x) & visibility))
#endif
@@ -221,7 +221,7 @@ ccl_device_inline int bvh_unaligned_node_intersect(KernelGlobals *kg,
mask |= 1;
}
}
- if(bvh_unaligned_node_intersect_child(kg, P, dir, t, nodeAddr, 1, &dist[1])) {
+ if(bvh_unaligned_node_intersect_child(kg, P, dir, t, node_addr, 1, &dist[1])) {
#ifdef __VISIBILITY_FLAG__
if((__float_as_uint(cnodes.y) & visibility))
#endif
@@ -239,13 +239,13 @@ ccl_device_inline int bvh_unaligned_node_intersect_robust(KernelGlobals *kg,
const float t,
const float difl,
const float extmax,
- const int nodeAddr,
+ const int node_addr,
const uint visibility,
float dist[2])
{
int mask = 0;
- float4 cnodes = kernel_tex_fetch(__bvh_nodes, nodeAddr+0);
- if(bvh_unaligned_node_intersect_child_robust(kg, P, dir, t, difl, nodeAddr, 0, &dist[0])) {
+ float4 cnodes = kernel_tex_fetch(__bvh_nodes, node_addr+0);
+ if(bvh_unaligned_node_intersect_child_robust(kg, P, dir, t, difl, node_addr, 0, &dist[0])) {
#ifdef __VISIBILITY_FLAG__
if((__float_as_uint(cnodes.x) & visibility))
#endif
@@ -253,7 +253,7 @@ ccl_device_inline int bvh_unaligned_node_intersect_robust(KernelGlobals *kg,
mask |= 1;
}
}
- if(bvh_unaligned_node_intersect_child_robust(kg, P, dir, t, difl, nodeAddr, 1, &dist[1])) {
+ if(bvh_unaligned_node_intersect_child_robust(kg, P, dir, t, difl, node_addr, 1, &dist[1])) {
#ifdef __VISIBILITY_FLAG__
if((__float_as_uint(cnodes.y) & visibility))
#endif
@@ -269,18 +269,18 @@ ccl_device_inline int bvh_node_intersect(KernelGlobals *kg,
const float3 dir,
const float3 idir,
const float t,
- const int nodeAddr,
+ const int node_addr,
const uint visibility,
float dist[2])
{
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list