NVIDIA OptiX 7.1 API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
optix_7_device.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
3 *
4 * NVIDIA Corporation and its licensors retain all intellectual property and proprietary
5 * rights in and to this software, related documentation and any modifications thereto.
6 * Any use, reproduction, disclosure or distribution of this software and related
7 * documentation without an express license agreement from NVIDIA Corporation is strictly
8 * prohibited.
9 *
10 * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
11 * AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
12 * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
13 * PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
14 * SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
15 * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
16 * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
17 * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
18 * SUCH DAMAGES
19 */
20 
26 
27 #if !defined( __OPTIX_INCLUDE_INTERNAL_HEADERS__ )
28 #error("optix_7_device.h is an internal header file and must not be used directly. Please use optix_device.h or optix.h instead.")
29 #endif
30 
31 
32 #ifndef __optix_optix_7_device_h__
33 #define __optix_optix_7_device_h__
34 
35 #if defined( __cplusplus ) && ( __cplusplus < 201103L ) && !defined( _WIN32 )
36 #error Device code for OptiX requires at least C++11. Consider adding "--std c++11" to the nvcc command-line.
37 #endif
38 
39 #include "optix_7_types.h"
40 
43 
48 static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle,
62  float3 rayOrigin,
63  float3 rayDirection,
64  float tmin,
65  float tmax,
66  float rayTime,
67  OptixVisibilityMask visibilityMask,
68  unsigned int rayFlags,
69  unsigned int SBToffset,
70  unsigned int SBTstride,
71  unsigned int missSBTIndex );
72 
76 static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle,
77  float3 rayOrigin,
78  float3 rayDirection,
79  float tmin,
80  float tmax,
81  float rayTime,
82  OptixVisibilityMask visibilityMask,
83  unsigned int rayFlags,
84  unsigned int SBToffset,
85  unsigned int SBTstride,
86  unsigned int missSBTIndex,
87  unsigned int& p0 );
88 
92 static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle,
93  float3 rayOrigin,
94  float3 rayDirection,
95  float tmin,
96  float tmax,
97  float rayTime,
98  OptixVisibilityMask visibilityMask,
99  unsigned int rayFlags,
100  unsigned int SBToffset,
101  unsigned int SBTstride,
102  unsigned int missSBTIndex,
103  unsigned int& p0,
104  unsigned int& p1 );
105 
109 static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle,
110  float3 rayOrigin,
111  float3 rayDirection,
112  float tmin,
113  float tmax,
114  float rayTime,
115  OptixVisibilityMask visibilityMask,
116  unsigned int rayFlags,
117  unsigned int SBToffset,
118  unsigned int SBTstride,
119  unsigned int missSBTIndex,
120  unsigned int& p0,
121  unsigned int& p1,
122  unsigned int& p2 );
123 
127 static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle,
128  float3 rayOrigin,
129  float3 rayDirection,
130  float tmin,
131  float tmax,
132  float rayTime,
133  OptixVisibilityMask visibilityMask,
134  unsigned int rayFlags,
135  unsigned int SBToffset,
136  unsigned int SBTstride,
137  unsigned int missSBTIndex,
138  unsigned int& p0,
139  unsigned int& p1,
140  unsigned int& p2,
141  unsigned int& p3 );
142 
146 static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle,
147  float3 rayOrigin,
148  float3 rayDirection,
149  float tmin,
150  float tmax,
151  float rayTime,
152  OptixVisibilityMask visibilityMask,
153  unsigned int rayFlags,
154  unsigned int SBToffset,
155  unsigned int SBTstride,
156  unsigned int missSBTIndex,
157  unsigned int& p0,
158  unsigned int& p1,
159  unsigned int& p2,
160  unsigned int& p3,
161  unsigned int& p4 );
162 
166 static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle,
167  float3 rayOrigin,
168  float3 rayDirection,
169  float tmin,
170  float tmax,
171  float rayTime,
172  OptixVisibilityMask visibilityMask,
173  unsigned int rayFlags,
174  unsigned int SBToffset,
175  unsigned int SBTstride,
176  unsigned int missSBTIndex,
177  unsigned int& p0,
178  unsigned int& p1,
179  unsigned int& p2,
180  unsigned int& p3,
181  unsigned int& p4,
182  unsigned int& p5 );
183 
187 static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle,
188  float3 rayOrigin,
189  float3 rayDirection,
190  float tmin,
191  float tmax,
192  float rayTime,
193  OptixVisibilityMask visibilityMask,
194  unsigned int rayFlags,
195  unsigned int SBToffset,
196  unsigned int SBTstride,
197  unsigned int missSBTIndex,
198  unsigned int& p0,
199  unsigned int& p1,
200  unsigned int& p2,
201  unsigned int& p3,
202  unsigned int& p4,
203  unsigned int& p5,
204  unsigned int& p6 );
205 
209 static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle,
210  float3 rayOrigin,
211  float3 rayDirection,
212  float tmin,
213  float tmax,
214  float rayTime,
215  OptixVisibilityMask visibilityMask,
216  unsigned int rayFlags,
217  unsigned int SBToffset,
218  unsigned int SBTstride,
219  unsigned int missSBTIndex,
220  unsigned int& p0,
221  unsigned int& p1,
222  unsigned int& p2,
223  unsigned int& p3,
224  unsigned int& p4,
225  unsigned int& p5,
226  unsigned int& p6,
227  unsigned int& p7 );
228 
230 static __forceinline__ __device__ void optixSetPayload_0( unsigned int p );
232 static __forceinline__ __device__ void optixSetPayload_1( unsigned int p );
234 static __forceinline__ __device__ void optixSetPayload_2( unsigned int p );
236 static __forceinline__ __device__ void optixSetPayload_3( unsigned int p );
238 static __forceinline__ __device__ void optixSetPayload_4( unsigned int p );
240 static __forceinline__ __device__ void optixSetPayload_5( unsigned int p );
242 static __forceinline__ __device__ void optixSetPayload_6( unsigned int p );
244 static __forceinline__ __device__ void optixSetPayload_7( unsigned int p );
245 
247 static __forceinline__ __device__ unsigned int optixGetPayload_0();
249 static __forceinline__ __device__ unsigned int optixGetPayload_1();
251 static __forceinline__ __device__ unsigned int optixGetPayload_2();
253 static __forceinline__ __device__ unsigned int optixGetPayload_3();
255 static __forceinline__ __device__ unsigned int optixGetPayload_4();
257 static __forceinline__ __device__ unsigned int optixGetPayload_5();
259 static __forceinline__ __device__ unsigned int optixGetPayload_6();
261 static __forceinline__ __device__ unsigned int optixGetPayload_7();
262 
264 static __forceinline__ __device__ unsigned int optixUndefinedValue();
265 
271 static __forceinline__ __device__ float3 optixGetWorldRayOrigin();
272 
278 static __forceinline__ __device__ float3 optixGetWorldRayDirection();
279 
283 static __forceinline__ __device__ float3 optixGetObjectRayOrigin();
284 
288 static __forceinline__ __device__ float3 optixGetObjectRayDirection();
289 
293 static __forceinline__ __device__ float optixGetRayTmin();
294 
299 static __forceinline__ __device__ float optixGetRayTmax();
300 
305 static __forceinline__ __device__ float optixGetRayTime();
306 
310 static __forceinline__ __device__ unsigned int optixGetRayFlags();
311 
315 static __forceinline__ __device__ unsigned int optixGetRayVisibilityMask();
316 
322 static __forceinline__ __device__ void optixGetTriangleVertexData( OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float3 data[3]);
323 
330 static __forceinline__ __device__ void optixGetLinearCurveVertexData( OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float4 data[2] );
331 
338 static __forceinline__ __device__ void optixGetQuadraticBSplineVertexData( OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float4 data[3] );
339 
346 static __forceinline__ __device__ void optixGetCubicBSplineVertexData( OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float4 data[4] );
347 
350 static __forceinline__ __device__ OptixTraversableHandle optixGetGASTraversableHandle();
351 
353 static __forceinline__ __device__ float optixGetGASMotionTimeBegin( OptixTraversableHandle gas );
354 
356 static __forceinline__ __device__ float optixGetGASMotionTimeEnd( OptixTraversableHandle gas );
357 
359 static __forceinline__ __device__ unsigned int optixGetGASMotionStepCount( OptixTraversableHandle gas );
360 
364 static __forceinline__ __device__ void optixGetWorldToObjectTransformMatrix( float m[12] );
365 
369 static __forceinline__ __device__ void optixGetObjectToWorldTransformMatrix( float m[12] );
370 
375 static __forceinline__ __device__ float3 optixTransformPointFromWorldToObjectSpace( float3 point );
376 
381 static __forceinline__ __device__ float3 optixTransformVectorFromWorldToObjectSpace( float3 vec );
382 
387 static __forceinline__ __device__ float3 optixTransformNormalFromWorldToObjectSpace( float3 normal );
388 
393 static __forceinline__ __device__ float3 optixTransformPointFromObjectToWorldSpace( float3 point );
394 
399 static __forceinline__ __device__ float3 optixTransformVectorFromObjectToWorldSpace( float3 vec );
400 
405 static __forceinline__ __device__ float3 optixTransformNormalFromObjectToWorldSpace( float3 normal );
406 
410 static __forceinline__ __device__ unsigned int optixGetTransformListSize();
411 
415 static __forceinline__ __device__ OptixTraversableHandle optixGetTransformListHandle( unsigned int index );
416 
417 
419 static __forceinline__ __device__ OptixTransformType optixGetTransformTypeFromHandle( OptixTraversableHandle handle );
420 
424 static __forceinline__ __device__ const OptixStaticTransform* optixGetStaticTransformFromHandle( OptixTraversableHandle handle );
425 
429 static __forceinline__ __device__ const OptixSRTMotionTransform* optixGetSRTMotionTransformFromHandle( OptixTraversableHandle handle );
430 
434 static __forceinline__ __device__ const OptixMatrixMotionTransform* optixGetMatrixMotionTransformFromHandle( OptixTraversableHandle handle );
435 
439 static __forceinline__ __device__ unsigned int optixGetInstanceIdFromHandle( OptixTraversableHandle handle );
440 
444 static __forceinline__ __device__ const float4* optixGetInstanceTransformFromHandle( OptixTraversableHandle handle );
445 
449 static __forceinline__ __device__ const float4* optixGetInstanceInverseTransformFromHandle( OptixTraversableHandle handle );
450 
467 static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind );
468 
472 static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0 );
473 
477 static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0, unsigned int a1 );
478 
482 static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0, unsigned int a1, unsigned int a2 );
483 
487 static __forceinline__ __device__ bool optixReportIntersection( float hitT,
488  unsigned int hitKind,
489  unsigned int a0,
490  unsigned int a1,
491  unsigned int a2,
492  unsigned int a3 );
493 
497 static __forceinline__ __device__ bool optixReportIntersection( float hitT,
498  unsigned int hitKind,
499  unsigned int a0,
500  unsigned int a1,
501  unsigned int a2,
502  unsigned int a3,
503  unsigned int a4 );
504 
508 static __forceinline__ __device__ bool optixReportIntersection( float hitT,
509  unsigned int hitKind,
510  unsigned int a0,
511  unsigned int a1,
512  unsigned int a2,
513  unsigned int a3,
514  unsigned int a4,
515  unsigned int a5 );
516 
520 static __forceinline__ __device__ bool optixReportIntersection( float hitT,
521  unsigned int hitKind,
522  unsigned int a0,
523  unsigned int a1,
524  unsigned int a2,
525  unsigned int a3,
526  unsigned int a4,
527  unsigned int a5,
528  unsigned int a6 );
529 
533 static __forceinline__ __device__ bool optixReportIntersection( float hitT,
534  unsigned int hitKind,
535  unsigned int a0,
536  unsigned int a1,
537  unsigned int a2,
538  unsigned int a3,
539  unsigned int a4,
540  unsigned int a5,
541  unsigned int a6,
542  unsigned int a7 );
543 
545 static __forceinline__ __device__ unsigned int optixGetAttribute_0();
547 static __forceinline__ __device__ unsigned int optixGetAttribute_1();
549 static __forceinline__ __device__ unsigned int optixGetAttribute_2();
551 static __forceinline__ __device__ unsigned int optixGetAttribute_3();
553 static __forceinline__ __device__ unsigned int optixGetAttribute_4();
555 static __forceinline__ __device__ unsigned int optixGetAttribute_5();
557 static __forceinline__ __device__ unsigned int optixGetAttribute_6();
559 static __forceinline__ __device__ unsigned int optixGetAttribute_7();
560 
564 static __forceinline__ __device__ void optixTerminateRay();
565 
569 static __forceinline__ __device__ void optixIgnoreIntersection();
570 
571 
583 static __forceinline__ __device__ unsigned int optixGetPrimitiveIndex();
584 
590 static __forceinline__ __device__ unsigned int optixGetSbtGASIndex();
591 
592 
600 static __forceinline__ __device__ unsigned int optixGetInstanceId();
601 
607 static __forceinline__ __device__ unsigned int optixGetInstanceIndex();
608 
617 static __forceinline__ __device__ unsigned int optixGetHitKind();
618 
620 static __forceinline__ __device__ OptixPrimitiveType optixGetPrimitiveType( unsigned int hitKind );
621 
623 static __forceinline__ __device__ bool optixIsFrontFaceHit( unsigned int hitKind );
624 
626 static __forceinline__ __device__ bool optixIsBackFaceHit( unsigned int hitKind );
627 
629 static __forceinline__ __device__ OptixPrimitiveType optixGetPrimitiveType();
630 
632 static __forceinline__ __device__ bool optixIsFrontFaceHit();
633 
635 static __forceinline__ __device__ bool optixIsBackFaceHit();
636 
638 static __forceinline__ __device__ bool optixIsTriangleHit();
639 
641 static __forceinline__ __device__ bool optixIsTriangleFrontFaceHit();
642 
644 static __forceinline__ __device__ bool optixIsTriangleBackFaceHit();
645 
650 static __forceinline__ __device__ float2 optixGetTriangleBarycentrics();
651 
656 static __forceinline__ __device__ float optixGetCurveParameter();
657 
661 static __forceinline__ __device__ uint3 optixGetLaunchIndex();
662 
664 static __forceinline__ __device__ uint3 optixGetLaunchDimensions();
665 
667 static __forceinline__ __device__ CUdeviceptr optixGetSbtDataPointer();
668 
680 static __forceinline__ __device__ void optixThrowException( int exceptionCode );
681 
685 static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0 );
686 
690 static __forceinline__ __device__ void optixThrowException( int exceptionCode,
691  unsigned int exceptionDetail0,
692  unsigned int exceptionDetail1 );
693 
697 static __forceinline__ __device__ void optixThrowException( int exceptionCode,
698  unsigned int exceptionDetail0,
699  unsigned int exceptionDetail1,
700  unsigned int exceptionDetail2 );
701 
705 static __forceinline__ __device__ void optixThrowException( int exceptionCode,
706  unsigned int exceptionDetail0,
707  unsigned int exceptionDetail1,
708  unsigned int exceptionDetail2,
709  unsigned int exceptionDetail3 );
710 
714 static __forceinline__ __device__ void optixThrowException( int exceptionCode,
715  unsigned int exceptionDetail0,
716  unsigned int exceptionDetail1,
717  unsigned int exceptionDetail2,
718  unsigned int exceptionDetail3,
719  unsigned int exceptionDetail4 );
720 
724 static __forceinline__ __device__ void optixThrowException( int exceptionCode,
725  unsigned int exceptionDetail0,
726  unsigned int exceptionDetail1,
727  unsigned int exceptionDetail2,
728  unsigned int exceptionDetail3,
729  unsigned int exceptionDetail4,
730  unsigned int exceptionDetail5 );
731 
735 static __forceinline__ __device__ void optixThrowException( int exceptionCode,
736  unsigned int exceptionDetail0,
737  unsigned int exceptionDetail1,
738  unsigned int exceptionDetail2,
739  unsigned int exceptionDetail3,
740  unsigned int exceptionDetail4,
741  unsigned int exceptionDetail5,
742  unsigned int exceptionDetail6 );
743 
747 static __forceinline__ __device__ void optixThrowException( int exceptionCode,
748  unsigned int exceptionDetail0,
749  unsigned int exceptionDetail1,
750  unsigned int exceptionDetail2,
751  unsigned int exceptionDetail3,
752  unsigned int exceptionDetail4,
753  unsigned int exceptionDetail5,
754  unsigned int exceptionDetail6,
755  unsigned int exceptionDetail7 );
756 
760 static __forceinline__ __device__ int optixGetExceptionCode();
761 
768 static __forceinline__ __device__ unsigned int optixGetExceptionDetail_0();
769 
773 static __forceinline__ __device__ unsigned int optixGetExceptionDetail_1();
774 
778 static __forceinline__ __device__ unsigned int optixGetExceptionDetail_2();
779 
783 static __forceinline__ __device__ unsigned int optixGetExceptionDetail_3();
784 
788 static __forceinline__ __device__ unsigned int optixGetExceptionDetail_4();
789 
793 static __forceinline__ __device__ unsigned int optixGetExceptionDetail_5();
794 
798 static __forceinline__ __device__ unsigned int optixGetExceptionDetail_6();
799 
803 static __forceinline__ __device__ unsigned int optixGetExceptionDetail_7();
804 
810 static __forceinline__ __device__ OptixTraversableHandle optixGetExceptionInvalidTraversable();
811 
817 static __forceinline__ __device__ int optixGetExceptionInvalidSbtOffset();
818 
827 static __forceinline__ __device__ OptixInvalidRayExceptionDetails optixGetExceptionInvalidRay();
828 
841 static __forceinline__ __device__ OptixParameterMismatchExceptionDetails optixGetExceptionParameterMismatch();
842 
853 static __forceinline__ __device__ char* optixGetExceptionLineInfo();
854 
869 template <typename ReturnT, typename... ArgTypes>
870 static __forceinline__ __device__ ReturnT optixDirectCall( unsigned int sbtIndex, ArgTypes... args );
871 
872 
888 template <typename ReturnT, typename... ArgTypes>
889 static __forceinline__ __device__ ReturnT optixContinuationCall( unsigned int sbtIndex, ArgTypes... args );
890  // end group optix_device_api
892 
894 
895 #endif // __optix_optix_7_device_h__
896