35 bool CudaBVH::intersectTriangles<BVHLayout_AOS_AOS>(
S32 node,
Ray& ray,
RayResult& result);
37 bool CudaBVH::intersectTriangles<BVHLayout_Compact>(
S32 node,
Ray& ray,
RayResult& result);
39 bool CudaBVH::intersectTriangles<BVHLayout_CPU>(
S32 node,
Ray& ray,
RayResult& result);
43 void CudaBVH::getNodeTemplate<BVHLayout_Compact>(
S32 node,
SplitInfo *splitInfo,
AABB &child0,
AABB &child1,
S32 &child0Addr,
S32 &child1Addr);
62 createCompact(bvh,16);
68 createTriWoopBasic(bvh);
69 createTriIndexBasic(bvh);
76 in >> (
S32&)m_layout >> m_nodes >> m_triWoop >> m_triIndex;
89 out << (
S32)m_layout << m_nodes << m_triWoop << m_triIndex;
96 #if defined(VISIBLE_CUDA_TESTED) // Copy info data from the GPU
97 for(
int i = 0; i < m_triFlags.getSize()>>2; i++)
99 S32 flag = *(
S32*)m_triFlags.getPtr(i * 4);
101 (*ref) = flag>0 ? 1 : 0;
103 #elif defined(VISIBLE_RAY_HITS) // Get visibility info from the hit triangles
116 #else // Compute the visibility info by tracing the rays
119 m_references = references;
129 #ifdef VISIBLE_HIDDEN
136 trace<BVHLayout_AOS_AOS>(0, ray, result);
139 trace<BVHLayout_Compact>(0, ray, result);
142 trace<BVHLayout_CPU>(0, ray, result);
154 #if !defined(VISIBLE_TOUCHED) && !defined(VISIBLE_TOUCHED_TESTED) && !defined(VISIBLE_HIDDEN)
163 #ifdef VISIBLE_HIDDEN
166 S32 *
ref = m_references + result.
id*(*m_offset);
167 (*ref) = m_rayHidden == 0 ? 0 : m_rayHidden-1;
211 trace<BVHLayout_AOS_AOS>(1, ray, result);
212 trace<BVHLayout_AOS_AOS>(2, ray, result);
215 trace<BVHLayout_Compact>(64, ray, result);
216 trace<BVHLayout_Compact>(128, ray, result);
219 trace<BVHLayout_CPU>(1, ray, result);
220 trace<BVHLayout_CPU>(2, ray, result);
228 visib[result.
id] = 1;
250 trace<BVHLayout_AOS_AOS>(0, ray, result);
253 trace<BVHLayout_Compact>(0, ray, result);
256 trace<BVHLayout_CPU>(0, ray, result);
264 visib[result.
id] = 1;
303 trace<BVHLayout_AOS_AOS>(0, ray, result, emptyBVH);
306 trace<BVHLayout_Compact>(0, ray, result, emptyBVH);
309 trace<BVHLayout_CPU>(0, ray, result, emptyBVH);
317 visib[result.
id] = 1;
328 getNodeTemplate<BVHLayout_Compact>(node, splitInfo, child0, child1, child0Addr, child1Addr);
332 getNodeTemplate<BVHLayout_CPU>(node, splitInfo, child0, child1, child0Addr, child1Addr);
351 for(
int triAddr = (-node-1); ; triAddr += 3)
354 if(guard == 0x80000000)
369 for(
int i=lo; i<hi; i++)
386 return Vec2i((size >> 2) * idx, (size >> 2));
387 return Vec2i(0, size);
398 return Vec2i((size >> 2) * idx, (size >> 2));
399 return Vec2i(0, size);
408 m_layout = other.m_layout;
409 m_nodes = other.m_nodes;
410 m_triWoop = other.m_triWoop;
411 m_triIndex = other.m_triIndex;
418 void CudaBVH::createNodeBasic(
const BVH& bvh)
425 StackEntry(
const BVHNode*
n =
NULL,
int i = 0) : node(
n), idx(i) {}
426 int encodeIdx(
void)
const {
return (node->isLeaf()) ? ~idx : idx; }
434 while (stack.getSize())
436 StackEntry e = stack.removeLast();
444 if (e.node->isLeaf())
457 StackEntry e0 = stack.add(StackEntry(e.node->getChildNode(0), nextNodeIdx++));
458 StackEntry e1 = stack.add(StackEntry(e.node->getChildNode(1), nextNodeIdx++));
459 b0 = &e0.node->m_bounds;
460 b1 = &e1.node->m_bounds;
485 for (
int i = 0; i < 4; i++)
498 void CudaBVH::createTriWoopBasic(
const BVH& bvh)
503 for (
int i = 0; i < tidx.
getSize(); i++)
516 for (
int j = 0; j < 3; j++)
529 void CudaBVH::createTriIndexBasic(
const BVH& bvh)
534 for (
int i = 0; i < tidx.
getSize(); i++)
540 void CudaBVH::createCompact(
const BVH& bvh,
int nodeOffsetSizeDiv)
547 StackEntry(
const BVHNode*
n =
NULL,
int i = 0) : node(
n), idx(i) {}
557 while (stack.getSize())
559 StackEntry e = stack.removeLast();
560 FW_ASSERT(e.node->getNumChildNodes() == 2);
566 for (
int i = 0; i < 2; i++)
570 const BVHNode* child = e.node->getChildNode(i);
574 cidx[i] = nodeData.getNumBytes() / nodeOffsetSizeDiv;
575 stack.add(StackEntry(child, nodeData.getSize()));
576 nodeData.add(
NULL, 4);
583 cidx[i] = ~triWoopData.
getSize();
584 for (
int j = leaf->
m_lo; j < leaf->m_hi; j++)
587 if (m_woop[0].
x == 0.0
f)
597 triWoopData.
add(0x80000000);
607 dst[3] =
Vec4i(cidx[0], cidx[1], 0, 0);
613 m_nodes.
set(nodeData.getPtr(), nodeData.getNumBytes());
624 void CudaBVH::woopifyTri(
const BVH& bvh,
int idx)
629 const Vec3f&
v0 = vtxPos[inds.x];
630 const Vec3f&
v1 = vtxPos[inds.y];
631 const Vec3f&
v2 = vtxPos[inds.z];
640 m_woop[0] =
Vec4f(mtx(2,0), mtx(2,1), mtx(2,2), -mtx(2,3));
641 m_woop[1] = mtx.
getRow(0);
642 m_woop[2] = mtx.
getRow(1);
649 return a > b ? a : b;
654 template <BVHLayout LAYOUT>
661 while(stackIndex > 0)
667 bool end = intersectTriangles<LAYOUT>(node, ray, result);
679 S32 child0Addr, child1Addr;
681 getNodeTemplate<LAYOUT>(node,
NULL, child0, child1, child0Addr, child1Addr);
685 #ifdef VISIBLE_HIDDEN
686 bool intersect0, intersect1;
689 intersect0 = (tspan0[TMIN]<=tspan0[TMAX]) && (tspan0[TMAX]>=ray.tmin);
690 intersect1 = (tspan1[TMIN]<=tspan1[TMAX]) && (tspan1[TMAX]>=ray.tmin);
694 intersect0 = (tspan0[TMIN]<=tspan0[TMAX]) && (tspan0[TMAX]>=ray.tmin) && (tspan0[TMIN]<=ray.tmax);
695 intersect1 = (tspan1[TMIN]<=tspan1[TMAX]) && (tspan1[TMAX]>=ray.tmin) && (tspan1[TMIN]<=ray.tmax);
698 bool intersect0 = (tspan0[TMIN]<=tspan0[TMAX]) && (tspan0[TMAX]>=ray.tmin) && (tspan0[TMIN]<=ray.tmax);
699 bool intersect1 = (tspan1[TMIN]<=tspan1[TMAX]) && (tspan1[TMAX]>=ray.tmin) && (tspan1[TMIN]<=ray.tmax);
707 if(intersect0 && intersect1)
715 if(intersect0 && intersect1)
717 if(tspan0[TMIN] > tspan1[TMIN])
720 swap(child0Addr,child1Addr);
724 stack[stackIndex++] = child1Addr;
737 node = stack[stackIndex];
748 const F32& ma = ptr[idxA].x;
749 const F32& mb = ptr[idxB].x;
750 return (ma < mb) ?
false : (ma > mb) ?
true :
false;
755 void eSwap(
void* data,
int idxA,
int idxB)
764 template <BVHLayout LAYOUT>
776 for(
int i = 0; i < emptyBVH.
getSize(); i++)
779 if(tspan.x<tspan.y && tspan.y>ray.
tmin)
781 empty[hitCount] = tspan;
798 for(
int i = 1; i < hitCount;)
800 if(empty[i].
x < empty[i-1].
y)
802 empty[i-1].y =
max(empty[i-1].
y, empty[i].
y);
804 memmove(&empty[i], &empty[i+1], (hitCount-i)*
sizeof(
Vec2f));
813 ray.
tmin = empty[0].y;
902 while(stackIndex > 0)
908 bool end = intersectTriangles<LAYOUT>(node, ray, result);
920 S32 child0Addr, child1Addr;
922 getNodeTemplate<LAYOUT>(node,
NULL, child0, child1, child0Addr, child1Addr);
927 bool intersect0 = (tspan0[TMIN]<=tspan0[TMAX]) && (tspan0[TMAX]>=ray.tmin) && (tspan0[TMIN]<=ray.tmax);
928 bool intersect1 = (tspan1[TMIN]<=tspan1[TMAX]) && (tspan1[TMAX]>=ray.tmin) && (tspan1[TMIN]<=ray.tmax);
935 if(intersect0 && intersect1)
943 if(intersect0 && intersect1)
945 if(tspan0[TMIN] > tspan1[TMIN])
948 swap(child0Addr,child1Addr);
951 stack[stackIndex] = child1Addr;
952 if(tspan1[TMIN] > empty[emptyIndex].
x)
953 eidx[stackIndex] = emptyIndex+1;
955 eidx[stackIndex] = emptyIndex;
970 if(tspan0[TMIN] > empty[emptyIndex].
x)
972 ray.tmin =
max(ray.tmin, empty[emptyIndex].y);
979 node = stack[stackIndex];
980 emptyIndex = eidx[stackIndex];
981 ray.tmin = empty[
max(emptyIndex-1, 0)].y;
990 bool CudaBVH::intersectTriangles<BVHLayout_AOS_AOS>(
S32 node,
Ray& ray,
RayResult& result)
992 Buffer &nodes = getNodeBuffer();
993 Buffer &woop = getTriWoopBuffer();
994 Buffer &tris = getTriIndexBuffer();
1003 m_stats->numTriangleTests += m_platform->roundToTriangleBatchSize( hi-lo );
1004 result.
padB += m_platform->roundToTriangleBatchSize( hi-lo ) << 16;
1007 #ifndef MASK_TRACE_EMPTY
1015 ray.tmin = tspan[1];
1019 for(
int i=lo; i<hi; i++)
1029 bool end = updateHit(ray, result, t, index);
1040 bool CudaBVH::intersectTriangles<BVHLayout_Compact>(
S32 node,
Ray& ray,
RayResult& result)
1042 Buffer &woop = getTriWoopBuffer();
1043 Buffer &tris = getTriIndexBuffer();
1045 for(
int triAddr = (-node-1); ; triAddr += 3)
1048 if(guard == 0x80000000)
1050 #ifndef MASK_TRACE_EMPTY
1058 ray.tmin = tspan[1];
1065 m_stats->numTriangleTests ++;
1066 result.
padB += 1 << 16;
1076 bool end = updateHit(ray, result, t, index);
1087 bool CudaBVH::intersectTriangles<BVHLayout_CPU>(
S32 node,
Ray& ray,
RayResult& result)
1089 Buffer &nodes = getNodeBuffer();
1090 Buffer &tris = getTriIndexBuffer();
1099 m_stats->numTriangleTests += m_platform->roundToTriangleBatchSize( hi-lo );
1100 result.
padB += m_platform->roundToTriangleBatchSize( hi-lo ) << 16;
1103 #ifndef MASK_TRACE_EMPTY
1111 ray.tmin = tspan[1];
1115 for(
int i=lo; i<hi; i++)
1122 const Vec3i& ind = ((
Vec3i*)m_scene->getTriVtxIndexBuffer().getPtr())[index];
1123 const Vec3f& v0 = ((
Vec3f*)m_scene->getVtxPosBuffer().getPtr())[ind.x];
1124 const Vec3f& v1 = ((
Vec3f*)m_scene->getVtxPosBuffer().getPtr())[ind.y];
1125 const Vec3f& v2 = ((
Vec3f*)m_scene->getVtxPosBuffer().getPtr())[ind.z];
1129 bool end = updateHit(ray, result, t, index);
1139 bool CudaBVH::updateHit(
Ray& ray,
RayResult& result,
float t,
S32 index)
1141 #ifdef VISIBLE_TOUCHED
1145 S32 *
ref = m_references + index*(m_offset);
1151 #ifdef VISIBLE_HIDDEN
1158 #ifdef VISIBLE_TOUCHED_TESTED
1162 S32 *ref = m_references + index*(m_offset);
1167 #ifdef VISIBLE_HIDDEN
1176 if(!m_needClosestHit)
1185 template <BVHLayout LAYOUT>
1196 child0Addr = *(
S32*)nodes.getMutablePtr(node * 64 + 48);
1197 child1Addr = *(
S32*)nodes.getMutablePtr(node * 64 + 52);
1199 if(splitInfo != NULL)
1200 *splitInfo =
SplitInfo(*(
unsigned long*)nodes.getMutablePtr(node * 64 + 56));
1216 child0Addr = *(
S32*)nodes.getMutablePtr(node + 48);
1217 child1Addr = *(
S32*)nodes.getMutablePtr(node + 52);
1219 if(splitInfo != NULL)
1220 *splitInfo =
SplitInfo(*(
unsigned long*)nodes.getMutablePtr(node + 56));
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int offset
S32 getSize() const
Gets size of the buffer (number of rays).
S32 m_lo
Lower index to the BVH's triangle index array.
void set(const void *ptr)
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1
Buffer & getTriVtxIndexBuffer(void)
Returns buffer of triangle's vertex indieces.
Vec2i getNodeSubArray(int idx) const
Returns node subarray.
void sort(void *data, int start, int end, SortCompareFunc compareFunc, SortSwapFunc swapFunc, bool multicore=false)
void trace(RayBuffer &rays, Buffer &visibility, bool twoTrees, RayStats *stats=NULL)
bool eCompare(void *data, int idxA, int idxB)
FW_CUDA_FUNC const Vec3f & max(void) const
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid * data
void eSwap(void *data, int idxA, int idxB)
Buffer & getVtxPosBuffer(void)
Returns vertex position buffer.
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2
FW_CUDA_FUNC bool hit(void) const
void findVisibleTriangles(RayBuffer &rays, S32 *references, S32 offset)
S32 numRays
Total number of rays.
Vec2f RayBox(const AABB &box, const Ray &ray)
Structure holding ray statistics. Also provides print to the console. These statistics are used in a ...
const Ray & getRayForSlot(S32 slot) const
Gets a ray assigned to a given slot.
FW_CUDA_FUNC const S32 * getPtr(void) const
const U8 * getPtr(S64 ofs=0)
S32 getNumBytes(void) const
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat x
bool getNeedClosestHit() const
Returns whether the closest hit is needed.
CudaBVH & operator=(CudaBVH &other)
Assignment operator.
~CudaBVH(void)
Destructor.
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z
Array< S32 > & getTriIndices(void)
Returns an array of triangle indices to which leaf nodes are pointig. These indices point to scene's ...
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat y
Vec3f RayTriangle(const Vec3f &v0, const Vec3f &v1, const Vec3f &v2, const Ray &ray)
Scene * getScene(void) const
FW_CUDA_FUNC S invert(const MatrixBase< T, L, S > &v)
Buffer & getTriWoopBuffer(void)
Ray buffer class. Stores rays.
U8 * getMutablePtr(S64 ofs=0)
Vec3f RayTriangleWoop(const Vec4f &zpleq, const Vec4f &upleq, const Vec4f &vpleq, const Ray &ray)
FW_CUDA_FUNC T min(const VectorBase< T, L, S > &v)
FW_CUDA_FUNC T max(const VectorBase< T, L, S > &v)
BVH acceleration structure class.
Declarations for the Cuda version of the BVH.
FW_CUDA_FUNC void clear(void)
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat v0
virtual bool isLeaf() const =0
FW_CUDA_FUNC const Vec3f & min(void) const
S32 numNodeTests
Total number of ray-node tests.
CudaBVH(const BVH &bvh, BVHLayout layout)
Constructor.
void serialize(OutputStream &out)
Writes Cuda BVH to the output stream.
AABB m_bounds
Bounding box of the node.
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint index
Class holding information about a split of a BVH node.
FW_CUDA_FUNC Vector< T, L > getRow(int r) const
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction f
FW_CUDA_FUNC F32 cross(const Vec2f &a, const Vec2f &b)
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei n
const RayResult & getResultForSlot(S32 slot) const
Gets a ray result assigned to a given slot.
Buffer & getTriIndexBuffer(void)
int getSubtreeSize(BVH_STAT stat=BVH_STAT_NODE_COUNT) const
Calculates various information about the node's subtree.
FW_CUDA_FUNC void swap(T &a, T &b)
Vec2i getTriWoopSubArray(int idx) const
Returns woop triangle subarray.
BVH virtual node. Parent class of both a leaf node and an inner node.
void getTriangleIndices(S32 node, Array< S32 > &indices)
Buffer & getNodeBuffer(void)
void getNode(S32 node, SplitInfo *splitInfo, AABB &child0, AABB &child1, S32 &child0Addr, S32 &child1Addr)
const T * getPtr(S32idx=0) const
void resizeDiscard(S64 size)
FW_CUDA_FUNC void setCol(int c, const VectorBase< T, L, V > &v)
BVHNode * getRoot(void) const
Returns root node of the BVH.
RayResult & getMutableResultForSlot(S32 slot)
Gets a mutable ray assigned to a given slot.
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr size
S32 m_hi
Higher index to the BVH's triangle index array.
CUdevice int ordinal char int CUdevice dev CUdevprop CUdevice dev CUcontext ctx CUcontext ctx CUcontext pctx CUmodule const void image CUmodule const void fatCubin CUfunction CUmodule const char name void p CUfunction unsigned int bytes CUtexref pTexRef CUtexref CUarray unsigned int Flags CUtexref int CUaddress_mode am CUtexref unsigned int Flags CUaddress_mode CUtexref int dim CUarray_format int CUtexref hTexRef CUfunction unsigned int numbytes CUfunction int float value CUfunction int CUtexref hTexRef CUfunction int int grid_height CUevent unsigned int Flags CUevent hEvent CUevent hEvent CUstream unsigned int Flags CUstream hStream GLuint bufferobj unsigned int CUdevice dev CUdeviceptr unsigned int CUmodule const char name CUdeviceptr unsigned int bytesize CUdeviceptr dptr void unsigned int bytesize void CUdeviceptr unsigned int ByteCount CUarray unsigned int CUdeviceptr unsigned int ByteCount CUarray unsigned int const void unsigned int ByteCount CUarray unsigned int CUarray unsigned int unsigned int ByteCount void CUarray unsigned int unsigned int CUstream hStream const CUDA_MEMCPY2D pCopy CUdeviceptr const void unsigned int CUstream hStream const CUDA_MEMCPY2D CUstream hStream CUdeviceptr unsigned char unsigned int N CUdeviceptr unsigned int unsigned int N CUdeviceptr unsigned int unsigned short unsigned int unsigned int Height CUarray const CUDA_ARRAY_DESCRIPTOR pAllocateArray CUarray const CUDA_ARRAY3D_DESCRIPTOR pAllocateArray unsigned int CUtexref CUdeviceptr unsigned int bytes CUcontext unsigned int CUdevice device GLenum texture GLenum GLuint buffer GLenum GLuint renderbuffer GLenum GLsizeiptr const GLvoid GLenum usage GLuint shader GLenum type GLsizei const GLuint framebuffers GLsizei const GLuint renderbuffers GLuint v GLuint v GLenum GLenum GLenum GLuint GLint level GLsizei GLuint framebuffers GLuint const GLchar name GLenum GLintptr GLsizeiptr GLvoid data GLuint GLenum GLint param GLuint GLenum GLint param GLhandleARB programObj GLenum GLenum GLsizei GLsizei height GLenum GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid pixels GLint GLsizei const GLfloat value GLint GLfloat GLfloat v1 GLint GLfloat GLfloat GLfloat v2 GLint GLsizei const GLfloat value GLint GLsizei GLboolean const GLfloat value GLuint program GLuint GLfloat GLfloat GLfloat z GLuint GLint GLenum GLboolean GLsizei const GLvoid pointer GLuint GLuint const GLchar name GLenum GLsizei GLenum GLsizei GLsizei height GLenum GLuint renderbuffer GLenum GLenum GLint params GLuint GLsizei range GLuint GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLsizei GLsizei GLsizei const GLubyte GLsizei GLenum const GLvoid coords GLuint GLenum GLsizei const GLvoid pathString GLuint GLenum const GLvoid GLbitfield GLuint GLsizei GLenum GLuint GLfloat emScale GLuint GLuint srcPath GLuint GLuint GLenum const GLfloat transformValues GLuint GLenum GLint value GLuint GLenum GLfloat value GLenum GLint ref
Platform platform
Platform settings of the BVH. Set by whoever sets the stats.