OWL
OptiX7 Wrapper Library
|
Go to the documentation of this file.
30 # error "this file should only ever get included on the device side"
39 return (vec2i)optixGetLaunchIndex();
46 return (vec2i)optixGetLaunchDimensions();
55 return (
const void*)optixGetSbtDataPointer();
73 if (x <= 0.0031308f) {
76 return 1.055f * pow(x, 1.f/2.4f) - 0.055f;
81 return min(255,max(0,
int(f*256.f)));
84 inline __device__ uint32_t
make_rgba(
const vec3f color)
92 inline __device__ uint32_t
make_rgba(
const vec4f color)
102 static __forceinline__ __device__
void*
unpackPointer( uint32_t i0, uint32_t i1 )
104 const uint64_t uptr =
static_cast<uint64_t
>( i0 ) << 32 | i1;
105 void* ptr =
reinterpret_cast<void*
>( uptr );
110 static __forceinline__ __device__
void packPointer(
void* ptr, uint32_t& i0, uint32_t& i1 )
112 const uint64_t uptr =
reinterpret_cast<uint64_t
>( ptr );
114 i1 = uptr & 0x00000000ffffffff;
120 const uint32_t u0 = optixGetPayload_0();
121 const uint32_t u1 = optixGetPayload_1();
126 static __forceinline__ __device__ T &
getPRD()
129 template<
int _rayType=0,
int _numRayTypes=1>
131 enum { rayType = _rayType };
132 enum { numRayTypes = _numRayTypes };
134 inline __device__
RayT(
const vec3f &origin,
135 const vec3f &direction,
139 direction(direction),
145 float tmin=0.f,tmax=1e30f,time=0.f;
150 template<
typename RayType,
typename PRD>
155 uint32_t rayFlags = 0u)
161 optixTrace(traversable,
162 (
const float3&)ray.origin,
163 (
const float3&)ray.direction,
167 (OptixVisibilityMask)-1,
176 template<
typename PRD>
178 void trace(OptixTraversableHandle traversable,
188 optixTrace(traversable,
189 (
const float3&)ray.
origin,
194 (OptixVisibilityMask)-1,
196 ray.
rayType + numRayTypes*sbtOffset,
205 #define OPTIX_RAYGEN_PROGRAM(programName) \
206 extern "C" __global__ \
207 void __raygen__##programName
209 #define OPTIX_CLOSEST_HIT_PROGRAM(programName) \
210 extern "C" __global__ \
211 void __closesthit__##programName
213 #define OPTIX_ANY_HIT_PROGRAM(programName) \
214 extern "C" __global__ \
215 void __anyhit__##programName
217 #define OPTIX_INTERSECT_PROGRAM(programName) \
218 extern "C" __global__ \
219 void __intersection__##programName
221 #define OPTIX_MISS_PROGRAM(programName) \
222 extern "C" __global__ \
223 void __miss__##programName
229 #define OPTIX_BOUNDS_PROGRAM(progName) \
232 void __boundsFunc__##progName(const void *geomData, \
234 const int32_t primID); \
237 extern "C" __global__ \
238 void __boundsFuncKernel__##progName(const void *geomData, \
239 box3f *const boundsArray, \
240 const uint32_t numPrims) \
242 uint32_t blockIndex \
244 + blockIdx.y * gridDim.x \
245 + blockIdx.z * gridDim.x * gridDim.y; \
247 = threadIdx.x + blockDim.x*threadIdx.y \
248 + blockDim.x*blockDim.y*blockIndex; \
249 if (primID < numPrims) { \
250 __boundsFunc__##progName(geomData,boundsArray[primID],primID); \
255 inline __device__ void __boundsFunc__##progName \
__device__ const T & getProgramData()
Definition: owl_device.h:63
static __forceinline__ __device__ void * unpackPointer(uint32_t i0, uint32_t i1)
Definition: owl_device.h:102
__device__ void traceRay(OptixTraversableHandle traversable, const RayType &ray, PRD &prd, uint32_t rayFlags=0u)
Definition: owl_device.h:152
__device__ uint32_t make_rgba(const vec3f color)
Definition: owl_device.h:84
float tmax
Definition: owl_device.h:145
static __forceinline__ __device__ void packPointer(void *ptr, uint32_t &i0, uint32_t &i1)
Definition: owl_device.h:110
static __forceinline__ __device__ void * getPRDPointer()
Definition: owl_device.h:118
__device__ RayT()
Definition: owl_device.h:133
Definition: owl_device.h:130
float time
Definition: owl_device.h:145
vec3f direction
Definition: owl_device.h:144
__device__ vec2i getLaunchDims()
Definition: owl_device.h:44
__device__ float linear_to_srgb(float x)
Definition: owl_device.h:72
RayT< 0, 1 > Ray
Definition: owl_device.h:147
__device__ RayT(const vec3f &origin, const vec3f &direction, float tmin, float tmax)
Definition: owl_device.h:134
__device__ void trace(OptixTraversableHandle traversable, const Ray &ray, int numRayTypes, PRD &prd, int sbtOffset=0)
Definition: owl_device.h:178
__device__ uint32_t make_8bit(const float f)
Definition: owl_device.h:79
vec3f origin
Definition: owl_device.h:144
Definition: APIContext.cpp:36
__device__ vec2i getLaunchIndex()
Definition: owl_device.h:37
__device__ const void * getProgramDataPointer()
Definition: owl_device.h:53
static __forceinline__ __device__ T & getPRD()
Definition: owl_device.h:126
@ rayType
Definition: owl_device.h:131
float tmin
Definition: owl_device.h:145