Clean up PLBVH construction, add comments.
This commit is contained in:
@@ -418,6 +418,7 @@ static const char* parallelLinearBvhCL= \
|
||||
" \n"
|
||||
" return sharedBits & bitmask;\n"
|
||||
"}\n"
|
||||
"//Same as computeCommonPrefixLength(), but allows for prefixes with different lengths\n"
|
||||
"int getSharedPrefixLength(b3Int64 prefixA, int prefixLengthA, b3Int64 prefixB, int prefixLengthB)\n"
|
||||
"{\n"
|
||||
" return b3Min( computeCommonPrefixLength(prefixA, prefixB), b3Min(prefixLengthA, prefixLengthB) );\n"
|
||||
@@ -487,8 +488,6 @@ static const char* parallelLinearBvhCL= \
|
||||
"__kernel void buildBinaryRadixTreeInternalNodes(__global b3Int64* commonPrefixes, __global int* commonPrefixLengths,\n"
|
||||
" __global int2* out_childNodes,\n"
|
||||
" __global int* out_internalNodeParentNodes, __global int* out_rootNodeIndex,\n"
|
||||
" __global int* TEMP_out_leftLowerPrefix, __global int* TEMP_out_rightLowerPrefix,\n"
|
||||
" __global int* TEMP_spl_left, __global int* TEMP_spl_right,\n"
|
||||
" int numInternalNodes)\n"
|
||||
"{\n"
|
||||
" int internalNodeIndex = get_group_id(0) * get_local_size(0) + get_local_id(0);\n"
|
||||
@@ -502,6 +501,7 @@ static const char* parallelLinearBvhCL= \
|
||||
" int leftIndex = -1;\n"
|
||||
" int rightIndex = -1;\n"
|
||||
" \n"
|
||||
" //Find nearest element to left with a lower common prefix\n"
|
||||
" for(int i = internalNodeIndex - 1; i >= 0; --i)\n"
|
||||
" {\n"
|
||||
" int nodeLeftSharedPrefixLength = getSharedPrefixLength(nodePrefix, nodePrefixLength, commonPrefixes[i], commonPrefixLengths[i]);\n"
|
||||
@@ -512,6 +512,7 @@ static const char* parallelLinearBvhCL= \
|
||||
" }\n"
|
||||
" }\n"
|
||||
" \n"
|
||||
" //Find nearest element to right with a lower common prefix\n"
|
||||
" for(int i = internalNodeIndex + 1; i < numInternalNodes; ++i)\n"
|
||||
" {\n"
|
||||
" int nodeRightSharedPrefixLength = getSharedPrefixLength(nodePrefix, nodePrefixLength, commonPrefixes[i], commonPrefixLengths[i]);\n"
|
||||
@@ -610,11 +611,6 @@ static const char* parallelLinearBvhCL= \
|
||||
" }\n"
|
||||
"#endif\n"
|
||||
" \n"
|
||||
" TEMP_out_leftLowerPrefix[internalNodeIndex] = leftIndex;\n"
|
||||
" TEMP_out_rightLowerPrefix[internalNodeIndex] = rightIndex;\n"
|
||||
" TEMP_spl_left[internalNodeIndex] = (leftIndex != -1) ? getSharedPrefixLength(nodePrefix, nodePrefixLength, commonPrefixes[leftIndex], commonPrefixLengths[leftIndex]) : -1;\n"
|
||||
" TEMP_spl_right[internalNodeIndex] = (rightIndex != -1) ? getSharedPrefixLength(nodePrefix, nodePrefixLength, commonPrefixes[rightIndex], commonPrefixLengths[rightIndex]) : -1;\n"
|
||||
" \n"
|
||||
" //Select parent\n"
|
||||
" {\n"
|
||||
" int leftPrefixLength = (leftIndex != -1) ? commonPrefixLengths[leftIndex] : B3_PLBVH_INVALID_COMMON_PREFIX;\n"
|
||||
|
||||
Reference in New Issue
Block a user