NTrace
GPU ray tracing framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
CudaKDTreeTracer.hpp
Go to the documentation of this file.
1 #pragma once
2 #include "gpu/CudaCompiler.hpp"
3 #include "cuda/CudaKDTree.hpp"
4 #include "ray/RayBuffer.hpp"
5 #include "base/Timer.hpp"
7 
13 namespace FW
14 {
15 //------------------------------------------------------------------------
16 
21 {
22 public:
26  CudaKDTreeTracer (void);
27 
31  ~CudaKDTreeTracer (void);
32 
38  void setMessageWindow (Window* window) { m_compiler.setMessageWindow(window); }
39 
44  void setKernel (const String& kernelName);
45  BVHLayout getDesiredBVHLayout (void) const { return (BVHLayout)m_kernelConfig.bvhLayout; }
46 
51  void setBVH (CudaAS* kdtree) { m_kdtree = (CudaKDTree*)kdtree; m_bbox = m_kdtree->getBBox(); }
52 
58  F32 traceBatch (RayBuffer& rays); // returns launch time in seconds
59 
60 private:
65  CudaModule* compileKernel (void);
66 
67 private:
68  CudaKDTreeTracer (const CudaKDTreeTracer&); // forbidden
69  CudaKDTreeTracer& operator= (const CudaKDTreeTracer&); // forbidden
70 
71 private:
72  CudaCompiler m_compiler;
73  String m_kernelName;
74  KernelConfig m_kernelConfig;
75  CudaKDTree* m_kdtree;
76  Timer m_timer;
77  AABB m_bbox;
78 };
79 
80 //------------------------------------------------------------------------
81 }
CudaKDTreeTracer(void)
Constructor.
void setMessageWindow(Window *window)
Cuda friendly KDTree representation.
Definition: CudaKDTree.hpp:20
BVHLayout getDesiredBVHLayout(void) const
float F32
Definition: Defs.hpp:89
Ray buffer class. Stores rays.
Definition: RayBuffer.hpp:38
void setMessageWindow(Window *window)
Sets message window for the CUDA compiler.
Definitions for Cuda KDTree.
void setKernel(const String &kernelName)
Sets kernel that should perform the actual traversation of the k-d tree on the gpu.
F32 traceBatch(RayBuffer &rays)
Traces given batch of rays.
void setBVH(CudaAS *kdtree)
Sets k-d tree acceleration structure that will be traversed.
const AABB & getBBox(void) const
Returns bounding box of the CudaKDTree's source scene.
Definition: CudaKDTree.hpp:77
Interface for acceleration structure.
Definition: CudaAS.hpp:19
~CudaKDTreeTracer(void)
Destructor.
Cuda tracer for the k-d tree acceleration structure. Performs kd-tree traversal on the GPU...