I’m currently working on using BVH for Frustum Culling with CUDA…
For now I’m using the hierarchy nodes from global memory.
I was guessing… maybe if I used texture memory instead, I would get better performance (since traversal results in a lot of random access to the nodes)…
I’m preparing the texture memory like this :
//Prepare texture memory for hierarchy
texture<hnode_t, 1, cudaReadModeElementType> texHIERARCHY;
cutilSafeCall(cudaBindTexture(0, texHIERARCHY, thrust::raw_pointer_cast(d_HIERARCHY), sizeof(hnode_t)*LBVH_compute_hierachy_mem_size()));
while hnode_t is like this :
[codebox]//Hierarchy node structure
typedef struct hnode
unsigned int splitLevel; unsigned int primStart; unsigned int primStop; unsigned int ID; unsigned int childrenStart; unsigned int childrenStop; bool visible; aabb_t bbox;
Size of the structure is 52 bytes (got this from sizeof()).
When I execute this code… I get this error :
[codebox]First-chance exception at 0x7c812afb in TestEnvironment.exe: Microsoft C++ exception: cudaError at memory location 0x0012f9a8…[/codebox]
What am I doing wrong ?
I already used texture fetches for another project, and it was working just perfect…
Thanks for your help !