NVIDIA OptiX 7.7 nvidia_logo_transpbg.gif Up
optix_device_impl.h
Go to the documentation of this file.
1/*
2* Copyright (c) 2021 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
29#if !defined( __OPTIX_INCLUDE_INTERNAL_HEADERS__ )
30#error("optix_device_impl.h is an internal header file and must not be used directly. Please use optix_device.h or optix.h instead.")
31#endif
32
33#ifndef OPTIX_OPTIX_DEVICE_IMPL_H
34#define OPTIX_OPTIX_DEVICE_IMPL_H
35
38
39#ifndef __CUDACC_RTC__
40#include <initializer_list>
41#include <type_traits>
42#endif
43
44namespace optix_internal {
45template <typename...>
46struct TypePack{};
47} // namespace optix_internal
48
49template <typename... Payload>
50static __forceinline__ __device__ void optixTrace( OptixTraversableHandle handle,
51 float3 rayOrigin,
52 float3 rayDirection,
53 float tmin,
54 float tmax,
55 float rayTime,
56 OptixVisibilityMask visibilityMask,
57 unsigned int rayFlags,
58 unsigned int SBToffset,
59 unsigned int SBTstride,
60 unsigned int missSBTIndex,
61 Payload&... payload )
62{
63 static_assert( sizeof...( Payload ) <= 32, "Only up to 32 payload values are allowed." );
64 // std::is_same compares each type in the two TypePacks to make sure that all types are unsigned int.
65 // TypePack 1 unsigned int T0 T1 T2 ... Tn-1 Tn
66 // TypePack 2 T0 T1 T2 T3 ... Tn unsigned int
67#ifndef __CUDACC_RTC__
68 static_assert( std::is_same<optix_internal::TypePack<unsigned int, Payload...>, optix_internal::TypePack<Payload..., unsigned int>>::value,
69 "All payload parameters need to be unsigned int." );
70#endif
71
73 float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z;
74 float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z;
75 unsigned int p[33] = { 0, payload... };
76 int payloadSize = (int)sizeof...( Payload );
77 asm volatile(
78 "call"
79 "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%26,%27,%28,%"
80 "29,%30,%31),"
81 "_optix_trace_typed_32,"
82 "(%32,%33,%34,%35,%36,%37,%38,%39,%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%50,%51,%52,%53,%54,%55,%56,%57,%58,%"
83 "59,%60,%61,%62,%63,%64,%65,%66,%67,%68,%69,%70,%71,%72,%73,%74,%75,%76,%77,%78,%79,%80);"
84 : "=r"( p[1] ), "=r"( p[2] ), "=r"( p[3] ), "=r"( p[4] ), "=r"( p[5] ), "=r"( p[6] ), "=r"( p[7] ),
85 "=r"( p[8] ), "=r"( p[9] ), "=r"( p[10] ), "=r"( p[11] ), "=r"( p[12] ), "=r"( p[13] ), "=r"( p[14] ),
86 "=r"( p[15] ), "=r"( p[16] ), "=r"( p[17] ), "=r"( p[18] ), "=r"( p[19] ), "=r"( p[20] ), "=r"( p[21] ),
87 "=r"( p[22] ), "=r"( p[23] ), "=r"( p[24] ), "=r"( p[25] ), "=r"( p[26] ), "=r"( p[27] ), "=r"( p[28] ),
88 "=r"( p[29] ), "=r"( p[30] ), "=r"( p[31] ), "=r"( p[32] )
89 : "r"( type ), "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ),
90 "f"( tmax ), "f"( rayTime ), "r"( visibilityMask ), "r"( rayFlags ), "r"( SBToffset ), "r"( SBTstride ),
91 "r"( missSBTIndex ), "r"( payloadSize ), "r"( p[1] ), "r"( p[2] ), "r"( p[3] ), "r"( p[4] ), "r"( p[5] ),
92 "r"( p[6] ), "r"( p[7] ), "r"( p[8] ), "r"( p[9] ), "r"( p[10] ), "r"( p[11] ), "r"( p[12] ), "r"( p[13] ),
93 "r"( p[14] ), "r"( p[15] ), "r"( p[16] ), "r"( p[17] ), "r"( p[18] ), "r"( p[19] ), "r"( p[20] ),
94 "r"( p[21] ), "r"( p[22] ), "r"( p[23] ), "r"( p[24] ), "r"( p[25] ), "r"( p[26] ), "r"( p[27] ),
95 "r"( p[28] ), "r"( p[29] ), "r"( p[30] ), "r"( p[31] ), "r"( p[32] )
96 : );
97 unsigned int index = 1;
98 (void)std::initializer_list<unsigned int>{index, ( payload = p[index++] )...};
99}
100
101
102template <typename... Payload>
103static __forceinline__ __device__ void optixTrace( OptixPayloadTypeID type,
105 float3 rayOrigin,
106 float3 rayDirection,
107 float tmin,
108 float tmax,
109 float rayTime,
110 OptixVisibilityMask visibilityMask,
111 unsigned int rayFlags,
112 unsigned int SBToffset,
113 unsigned int SBTstride,
114 unsigned int missSBTIndex,
115 Payload&... payload )
116{
117 // std::is_same compares each type in the two TypePacks to make sure that all types are unsigned int.
118 // TypePack 1 unsigned int T0 T1 T2 ... Tn-1 Tn
119 // TypePack 2 T0 T1 T2 T3 ... Tn unsigned int
120 static_assert( sizeof...( Payload ) <= 32, "Only up to 32 payload values are allowed." );
121#ifndef __CUDACC_RTC__
122 static_assert( std::is_same<optix_internal::TypePack<unsigned int, Payload...>, optix_internal::TypePack<Payload..., unsigned int>>::value,
123 "All payload parameters need to be unsigned int." );
124#endif
125
126 float ox = rayOrigin.x, oy = rayOrigin.y, oz = rayOrigin.z;
127 float dx = rayDirection.x, dy = rayDirection.y, dz = rayDirection.z;
128 unsigned int p[33] = {0, payload...};
129 int payloadSize = (int)sizeof...( Payload );
130
131 asm volatile(
132 "call"
133 "(%0,%1,%2,%3,%4,%5,%6,%7,%8,%9,%10,%11,%12,%13,%14,%15,%16,%17,%18,%19,%20,%21,%22,%23,%24,%25,%26,%27,%28,%"
134 "29,%30,%31),"
135 "_optix_trace_typed_32,"
136 "(%32,%33,%34,%35,%36,%37,%38,%39,%40,%41,%42,%43,%44,%45,%46,%47,%48,%49,%50,%51,%52,%53,%54,%55,%56,%57,%58,%"
137 "59,%60,%61,%62,%63,%64,%65,%66,%67,%68,%69,%70,%71,%72,%73,%74,%75,%76,%77,%78,%79,%80);"
138 : "=r"( p[1] ), "=r"( p[2] ), "=r"( p[3] ), "=r"( p[4] ), "=r"( p[5] ), "=r"( p[6] ), "=r"( p[7] ),
139 "=r"( p[8] ), "=r"( p[9] ), "=r"( p[10] ), "=r"( p[11] ), "=r"( p[12] ), "=r"( p[13] ), "=r"( p[14] ),
140 "=r"( p[15] ), "=r"( p[16] ), "=r"( p[17] ), "=r"( p[18] ), "=r"( p[19] ), "=r"( p[20] ), "=r"( p[21] ),
141 "=r"( p[22] ), "=r"( p[23] ), "=r"( p[24] ), "=r"( p[25] ), "=r"( p[26] ), "=r"( p[27] ), "=r"( p[28] ),
142 "=r"( p[29] ), "=r"( p[30] ), "=r"( p[31] ), "=r"( p[32] )
143 : "r"( type ), "l"( handle ), "f"( ox ), "f"( oy ), "f"( oz ), "f"( dx ), "f"( dy ), "f"( dz ), "f"( tmin ),
144 "f"( tmax ), "f"( rayTime ), "r"( visibilityMask ), "r"( rayFlags ), "r"( SBToffset ), "r"( SBTstride ),
145 "r"( missSBTIndex ), "r"( payloadSize ), "r"( p[1] ), "r"( p[2] ), "r"( p[3] ), "r"( p[4] ), "r"( p[5] ),
146 "r"( p[6] ), "r"( p[7] ), "r"( p[8] ), "r"( p[9] ), "r"( p[10] ), "r"( p[11] ), "r"( p[12] ), "r"( p[13] ),
147 "r"( p[14] ), "r"( p[15] ), "r"( p[16] ), "r"( p[17] ), "r"( p[18] ), "r"( p[19] ), "r"( p[20] ),
148 "r"( p[21] ), "r"( p[22] ), "r"( p[23] ), "r"( p[24] ), "r"( p[25] ), "r"( p[26] ), "r"( p[27] ),
149 "r"( p[28] ), "r"( p[29] ), "r"( p[30] ), "r"( p[31] ), "r"( p[32] )
150 : );
151 unsigned int index = 1;
152 (void)std::initializer_list<unsigned int>{index, ( payload = p[index++] )...};
153}
154
155
156static __forceinline__ __device__ void optixSetPayload_0( unsigned int p )
157{
158 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 0 ), "r"( p ) : );
159}
160
161static __forceinline__ __device__ void optixSetPayload_1( unsigned int p )
162{
163 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 1 ), "r"( p ) : );
164}
165
166static __forceinline__ __device__ void optixSetPayload_2( unsigned int p )
167{
168 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 2 ), "r"( p ) : );
169}
170
171static __forceinline__ __device__ void optixSetPayload_3( unsigned int p )
172{
173 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 3 ), "r"( p ) : );
174}
175
176static __forceinline__ __device__ void optixSetPayload_4( unsigned int p )
177{
178 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 4 ), "r"( p ) : );
179}
180
181static __forceinline__ __device__ void optixSetPayload_5( unsigned int p )
182{
183 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 5 ), "r"( p ) : );
184}
185
186static __forceinline__ __device__ void optixSetPayload_6( unsigned int p )
187{
188 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 6 ), "r"( p ) : );
189}
190
191static __forceinline__ __device__ void optixSetPayload_7( unsigned int p )
192{
193 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 7 ), "r"( p ) : );
194}
195
196static __forceinline__ __device__ void optixSetPayload_8( unsigned int p )
197{
198 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 8 ), "r"( p ) : );
199}
200
201static __forceinline__ __device__ void optixSetPayload_9( unsigned int p )
202{
203 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 9 ), "r"( p ) : );
204}
205
206static __forceinline__ __device__ void optixSetPayload_10( unsigned int p )
207{
208 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 10 ), "r"( p ) : );
209}
210
211static __forceinline__ __device__ void optixSetPayload_11( unsigned int p )
212{
213 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 11 ), "r"( p ) : );
214}
215
216static __forceinline__ __device__ void optixSetPayload_12( unsigned int p )
217{
218 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 12 ), "r"( p ) : );
219}
220
221static __forceinline__ __device__ void optixSetPayload_13( unsigned int p )
222{
223 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 13 ), "r"( p ) : );
224}
225
226static __forceinline__ __device__ void optixSetPayload_14( unsigned int p )
227{
228 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 14 ), "r"( p ) : );
229}
230
231static __forceinline__ __device__ void optixSetPayload_15( unsigned int p )
232{
233 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 15 ), "r"( p ) : );
234}
235
236static __forceinline__ __device__ void optixSetPayload_16( unsigned int p )
237{
238 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 16 ), "r"( p ) : );
239}
240
241static __forceinline__ __device__ void optixSetPayload_17( unsigned int p )
242{
243 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 17 ), "r"( p ) : );
244}
245
246static __forceinline__ __device__ void optixSetPayload_18( unsigned int p )
247{
248 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 18 ), "r"( p ) : );
249}
250
251static __forceinline__ __device__ void optixSetPayload_19( unsigned int p )
252{
253 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 19 ), "r"( p ) : );
254}
255
256static __forceinline__ __device__ void optixSetPayload_20( unsigned int p )
257{
258 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 20 ), "r"( p ) : );
259}
260
261static __forceinline__ __device__ void optixSetPayload_21( unsigned int p )
262{
263 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 21 ), "r"( p ) : );
264}
265
266static __forceinline__ __device__ void optixSetPayload_22( unsigned int p )
267{
268 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 22 ), "r"( p ) : );
269}
270
271static __forceinline__ __device__ void optixSetPayload_23( unsigned int p )
272{
273 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 23 ), "r"( p ) : );
274}
275
276static __forceinline__ __device__ void optixSetPayload_24( unsigned int p )
277{
278 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 24 ), "r"( p ) : );
279}
280
281static __forceinline__ __device__ void optixSetPayload_25( unsigned int p )
282{
283 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 25 ), "r"( p ) : );
284}
285
286static __forceinline__ __device__ void optixSetPayload_26( unsigned int p )
287{
288 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 26 ), "r"( p ) : );
289}
290
291static __forceinline__ __device__ void optixSetPayload_27( unsigned int p )
292{
293 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 27 ), "r"( p ) : );
294}
295
296static __forceinline__ __device__ void optixSetPayload_28( unsigned int p )
297{
298 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 28 ), "r"( p ) : );
299}
300
301static __forceinline__ __device__ void optixSetPayload_29( unsigned int p )
302{
303 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 29 ), "r"( p ) : );
304}
305
306static __forceinline__ __device__ void optixSetPayload_30( unsigned int p )
307{
308 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 30 ), "r"( p ) : );
309}
310
311static __forceinline__ __device__ void optixSetPayload_31( unsigned int p )
312{
313 asm volatile( "call _optix_set_payload, (%0, %1);" : : "r"( 31 ), "r"( p ) : );
314}
315
316static __forceinline__ __device__ unsigned int optixGetPayload_0()
317{
318 unsigned int result;
319 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 0 ) : );
320 return result;
321}
322
323static __forceinline__ __device__ unsigned int optixGetPayload_1()
324{
325 unsigned int result;
326 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 1 ) : );
327 return result;
328}
329
330static __forceinline__ __device__ unsigned int optixGetPayload_2()
331{
332 unsigned int result;
333 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 2 ) : );
334 return result;
335}
336
337static __forceinline__ __device__ unsigned int optixGetPayload_3()
338{
339 unsigned int result;
340 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 3 ) : );
341 return result;
342}
343
344static __forceinline__ __device__ unsigned int optixGetPayload_4()
345{
346 unsigned int result;
347 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 4 ) : );
348 return result;
349}
350
351static __forceinline__ __device__ unsigned int optixGetPayload_5()
352{
353 unsigned int result;
354 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 5 ) : );
355 return result;
356}
357
358static __forceinline__ __device__ unsigned int optixGetPayload_6()
359{
360 unsigned int result;
361 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 6 ) : );
362 return result;
363}
364
365static __forceinline__ __device__ unsigned int optixGetPayload_7()
366{
367 unsigned int result;
368 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 7 ) : );
369 return result;
370}
371
372static __forceinline__ __device__ unsigned int optixGetPayload_8()
373{
374 unsigned int result;
375 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 8 ) : );
376 return result;
377}
378
379static __forceinline__ __device__ unsigned int optixGetPayload_9()
380{
381 unsigned int result;
382 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 9 ) : );
383 return result;
384}
385
386static __forceinline__ __device__ unsigned int optixGetPayload_10()
387{
388 unsigned int result;
389 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 10 ) : );
390 return result;
391}
392
393static __forceinline__ __device__ unsigned int optixGetPayload_11()
394{
395 unsigned int result;
396 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 11 ) : );
397 return result;
398}
399
400static __forceinline__ __device__ unsigned int optixGetPayload_12()
401{
402 unsigned int result;
403 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 12 ) : );
404 return result;
405}
406
407static __forceinline__ __device__ unsigned int optixGetPayload_13()
408{
409 unsigned int result;
410 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 13 ) : );
411 return result;
412}
413
414static __forceinline__ __device__ unsigned int optixGetPayload_14()
415{
416 unsigned int result;
417 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 14 ) : );
418 return result;
419}
420
421static __forceinline__ __device__ unsigned int optixGetPayload_15()
422{
423 unsigned int result;
424 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 15 ) : );
425 return result;
426}
427
428static __forceinline__ __device__ unsigned int optixGetPayload_16()
429{
430 unsigned int result;
431 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 16 ) : );
432 return result;
433}
434
435static __forceinline__ __device__ unsigned int optixGetPayload_17()
436{
437 unsigned int result;
438 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 17 ) : );
439 return result;
440}
441
442static __forceinline__ __device__ unsigned int optixGetPayload_18()
443{
444 unsigned int result;
445 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 18 ) : );
446 return result;
447}
448
449static __forceinline__ __device__ unsigned int optixGetPayload_19()
450{
451 unsigned int result;
452 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 19 ) : );
453 return result;
454}
455
456static __forceinline__ __device__ unsigned int optixGetPayload_20()
457{
458 unsigned int result;
459 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 20 ) : );
460 return result;
461}
462
463static __forceinline__ __device__ unsigned int optixGetPayload_21()
464{
465 unsigned int result;
466 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 21 ) : );
467 return result;
468}
469
470static __forceinline__ __device__ unsigned int optixGetPayload_22()
471{
472 unsigned int result;
473 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 22 ) : );
474 return result;
475}
476
477static __forceinline__ __device__ unsigned int optixGetPayload_23()
478{
479 unsigned int result;
480 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 23 ) : );
481 return result;
482}
483
484static __forceinline__ __device__ unsigned int optixGetPayload_24()
485{
486 unsigned int result;
487 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 24 ) : );
488 return result;
489}
490
491static __forceinline__ __device__ unsigned int optixGetPayload_25()
492{
493 unsigned int result;
494 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 25 ) : );
495 return result;
496}
497
498static __forceinline__ __device__ unsigned int optixGetPayload_26()
499{
500 unsigned int result;
501 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 26 ) : );
502 return result;
503}
504
505static __forceinline__ __device__ unsigned int optixGetPayload_27()
506{
507 unsigned int result;
508 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 27 ) : );
509 return result;
510}
511
512static __forceinline__ __device__ unsigned int optixGetPayload_28()
513{
514 unsigned int result;
515 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 28 ) : );
516 return result;
517}
518
519static __forceinline__ __device__ unsigned int optixGetPayload_29()
520{
521 unsigned int result;
522 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 29 ) : );
523 return result;
524}
525
526static __forceinline__ __device__ unsigned int optixGetPayload_30()
527{
528 unsigned int result;
529 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 30 ) : );
530 return result;
531}
532
533static __forceinline__ __device__ unsigned int optixGetPayload_31()
534{
535 unsigned int result;
536 asm volatile( "call (%0), _optix_get_payload, (%1);" : "=r"( result ) : "r"( 31 ) : );
537 return result;
538}
539
540static __forceinline__ __device__ void optixSetPayloadTypes( unsigned int types )
541{
542 asm volatile( "call _optix_set_payload_types, (%0);" : : "r"( types ) : );
543}
544
545static __forceinline__ __device__ unsigned int optixUndefinedValue()
546{
547 unsigned int u0;
548 asm( "call (%0), _optix_undef_value, ();" : "=r"( u0 ) : );
549 return u0;
550}
551
552static __forceinline__ __device__ float3 optixGetWorldRayOrigin()
553{
554 float f0, f1, f2;
555 asm( "call (%0), _optix_get_world_ray_origin_x, ();" : "=f"( f0 ) : );
556 asm( "call (%0), _optix_get_world_ray_origin_y, ();" : "=f"( f1 ) : );
557 asm( "call (%0), _optix_get_world_ray_origin_z, ();" : "=f"( f2 ) : );
558 return make_float3( f0, f1, f2 );
559}
560
561static __forceinline__ __device__ float3 optixGetWorldRayDirection()
562{
563 float f0, f1, f2;
564 asm( "call (%0), _optix_get_world_ray_direction_x, ();" : "=f"( f0 ) : );
565 asm( "call (%0), _optix_get_world_ray_direction_y, ();" : "=f"( f1 ) : );
566 asm( "call (%0), _optix_get_world_ray_direction_z, ();" : "=f"( f2 ) : );
567 return make_float3( f0, f1, f2 );
568}
569
570static __forceinline__ __device__ float3 optixGetObjectRayOrigin()
571{
572 float f0, f1, f2;
573 asm( "call (%0), _optix_get_object_ray_origin_x, ();" : "=f"( f0 ) : );
574 asm( "call (%0), _optix_get_object_ray_origin_y, ();" : "=f"( f1 ) : );
575 asm( "call (%0), _optix_get_object_ray_origin_z, ();" : "=f"( f2 ) : );
576 return make_float3( f0, f1, f2 );
577}
578
579static __forceinline__ __device__ float3 optixGetObjectRayDirection()
580{
581 float f0, f1, f2;
582 asm( "call (%0), _optix_get_object_ray_direction_x, ();" : "=f"( f0 ) : );
583 asm( "call (%0), _optix_get_object_ray_direction_y, ();" : "=f"( f1 ) : );
584 asm( "call (%0), _optix_get_object_ray_direction_z, ();" : "=f"( f2 ) : );
585 return make_float3( f0, f1, f2 );
586}
587
588static __forceinline__ __device__ float optixGetRayTmin()
589{
590 float f0;
591 asm( "call (%0), _optix_get_ray_tmin, ();" : "=f"( f0 ) : );
592 return f0;
593}
594
595static __forceinline__ __device__ float optixGetRayTmax()
596{
597 float f0;
598 asm( "call (%0), _optix_get_ray_tmax, ();" : "=f"( f0 ) : );
599 return f0;
600}
601
602static __forceinline__ __device__ float optixGetRayTime()
603{
604 float f0;
605 asm( "call (%0), _optix_get_ray_time, ();" : "=f"( f0 ) : );
606 return f0;
607}
608
609static __forceinline__ __device__ unsigned int optixGetRayFlags()
610{
611 unsigned int u0;
612 asm( "call (%0), _optix_get_ray_flags, ();" : "=r"( u0 ) : );
613 return u0;
614}
615
616static __forceinline__ __device__ unsigned int optixGetRayVisibilityMask()
617{
618 unsigned int u0;
619 asm( "call (%0), _optix_get_ray_visibility_mask, ();" : "=r"( u0 ) : );
620 return u0;
621}
622
624 unsigned int instIdx )
625{
626 unsigned long long handle;
627 asm( "call (%0), _optix_get_instance_traversable_from_ias, (%1, %2);"
628 : "=l"( handle ) : "l"( ias ), "r"( instIdx ) );
629 return (OptixTraversableHandle)handle;
630}
631
632
633static __forceinline__ __device__ void optixGetTriangleVertexData( OptixTraversableHandle gas,
634 unsigned int primIdx,
635 unsigned int sbtGASIndex,
636 float time,
637 float3 data[3] )
638{
639 asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8), _optix_get_triangle_vertex_data, "
640 "(%9, %10, %11, %12);"
641 : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[1].x ), "=f"( data[1].y ),
642 "=f"( data[1].z ), "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z )
643 : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time )
644 : );
645}
646
647static __forceinline__ __device__ void optixGetMicroTriangleVertexData( float3 data[3] )
648{
649 asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8), _optix_get_microtriangle_vertex_data, "
650 "();"
651 : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[1].x ), "=f"( data[1].y ),
652 "=f"( data[1].z ), "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z )
653 : );
654}
655static __forceinline__ __device__ void optixGetMicroTriangleBarycentricsData( float2 data[3] )
656{
657 asm( "call (%0, %1, %2, %3, %4, %5), _optix_get_microtriangle_barycentrics_data, "
658 "();"
659 : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[2].x ), "=f"( data[2].y )
660 : );
661}
662
663static __forceinline__ __device__ void optixGetLinearCurveVertexData( OptixTraversableHandle gas,
664 unsigned int primIdx,
665 unsigned int sbtGASIndex,
666 float time,
667 float4 data[2] )
668{
669 asm( "call (%0, %1, %2, %3, %4, %5, %6, %7), _optix_get_linear_curve_vertex_data, "
670 "(%8, %9, %10, %11);"
671 : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ),
672 "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w )
673 : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time )
674 : );
675}
676
677static __forceinline__ __device__ void optixGetQuadraticBSplineVertexData( OptixTraversableHandle gas,
678 unsigned int primIdx,
679 unsigned int sbtGASIndex,
680 float time,
681 float4 data[3] )
682{
683 asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11), _optix_get_quadratic_bspline_vertex_data, "
684 "(%12, %13, %14, %15);"
685 : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ),
686 "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ),
687 "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w )
688 : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time )
689 : );
690}
691
692static __forceinline__ __device__ void optixGetCubicBSplineVertexData( OptixTraversableHandle gas,
693 unsigned int primIdx,
694 unsigned int sbtGASIndex,
695 float time,
696 float4 data[4] )
697{
698 asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), "
699 "_optix_get_cubic_bspline_vertex_data, "
700 "(%16, %17, %18, %19);"
701 : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ),
702 "=f"( data[1].x ), "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ),
703 "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w ),
704 "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w )
705 : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time )
706 : );
707}
708
709static __forceinline__ __device__ void optixGetCatmullRomVertexData( OptixTraversableHandle gas,
710 unsigned int primIdx,
711 unsigned int sbtGASIndex,
712 float time,
713 float4 data[4] )
714{
715 asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), "
716 "_optix_get_catmullrom_vertex_data, "
717 "(%16, %17, %18, %19);"
718 : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ),
719 "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ),
720 "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w )
721 : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time )
722 : );
723}
724
725static __forceinline__ __device__ void optixGetCubicBezierVertexData( OptixTraversableHandle gas,
726 unsigned int primIdx,
727 unsigned int sbtGASIndex,
728 float time,
729 float4 data[4] )
730{
731 asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15), "
732 "_optix_get_cubic_bezier_vertex_data, "
733 "(%16, %17, %18, %19);"
734 : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ),
735 "=f"( data[1].y ), "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ),
736 "=f"( data[2].z ), "=f"( data[2].w ), "=f"( data[3].x ), "=f"( data[3].y ), "=f"( data[3].z ), "=f"( data[3].w )
737 : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time )
738 : );
739}
740
741static __forceinline__ __device__ void optixGetRibbonVertexData( OptixTraversableHandle gas,
742 unsigned int primIdx,
743 unsigned int sbtGASIndex,
744 float time,
745 float4 data[3] )
746{
747 asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11), _optix_get_ribbon_vertex_data, "
748 "(%12, %13, %14, %15);"
749 : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w ), "=f"( data[1].x ), "=f"( data[1].y ),
750 "=f"( data[1].z ), "=f"( data[1].w ), "=f"( data[2].x ), "=f"( data[2].y ), "=f"( data[2].z ), "=f"( data[2].w )
751 : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time )
752 : );
753}
754
755static __forceinline__ __device__ float3 optixGetRibbonNormal( OptixTraversableHandle gas,
756 unsigned int primIdx,
757 unsigned int sbtGASIndex,
758 float time,
759 float2 ribbonParameters )
760{
761 float3 normal;
762 asm( "call (%0, %1, %2), _optix_get_ribbon_normal, "
763 "(%3, %4, %5, %6, %7, %8);"
764 : "=f"( normal.x ), "=f"( normal.y ), "=f"( normal.z )
765 : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time ),
766 "f"( ribbonParameters.x ), "f"( ribbonParameters.y )
767 : );
768 return normal;
769}
770
771static __forceinline__ __device__ void optixGetSphereData( OptixTraversableHandle gas,
772 unsigned int primIdx,
773 unsigned int sbtGASIndex,
774 float time,
775 float4 data[1] )
776{
777 asm( "call (%0, %1, %2, %3), "
778 "_optix_get_sphere_data, "
779 "(%4, %5, %6, %7);"
780 : "=f"( data[0].x ), "=f"( data[0].y ), "=f"( data[0].z ), "=f"( data[0].w )
781 : "l"( gas ), "r"( primIdx ), "r"( sbtGASIndex ), "f"( time )
782 : );
783}
784
785static __forceinline__ __device__ OptixTraversableHandle optixGetGASTraversableHandle()
786{
787 unsigned long long handle;
788 asm( "call (%0), _optix_get_gas_traversable_handle, ();" : "=l"( handle ) : );
789 return (OptixTraversableHandle)handle;
790}
791
792static __forceinline__ __device__ float optixGetGASMotionTimeBegin( OptixTraversableHandle handle )
793{
794 float f0;
795 asm( "call (%0), _optix_get_gas_motion_time_begin, (%1);" : "=f"( f0 ) : "l"( handle ) : );
796 return f0;
797}
798
799static __forceinline__ __device__ float optixGetGASMotionTimeEnd( OptixTraversableHandle handle )
800{
801 float f0;
802 asm( "call (%0), _optix_get_gas_motion_time_end, (%1);" : "=f"( f0 ) : "l"( handle ) : );
803 return f0;
804}
805
806static __forceinline__ __device__ unsigned int optixGetGASMotionStepCount( OptixTraversableHandle handle )
807{
808 unsigned int u0;
809 asm( "call (%0), _optix_get_gas_motion_step_count, (%1);" : "=r"( u0 ) : "l"( handle ) : );
810 return u0;
811}
812
813static __forceinline__ __device__ void optixGetWorldToObjectTransformMatrix( float m[12] )
814{
815 if( optixGetTransformListSize() == 0 )
816 {
817 m[0] = 1.0f;
818 m[1] = 0.0f;
819 m[2] = 0.0f;
820 m[3] = 0.0f;
821 m[4] = 0.0f;
822 m[5] = 1.0f;
823 m[6] = 0.0f;
824 m[7] = 0.0f;
825 m[8] = 0.0f;
826 m[9] = 0.0f;
827 m[10] = 1.0f;
828 m[11] = 0.0f;
829 return;
830 }
831
832 float4 m0, m1, m2;
834 m[0] = m0.x;
835 m[1] = m0.y;
836 m[2] = m0.z;
837 m[3] = m0.w;
838 m[4] = m1.x;
839 m[5] = m1.y;
840 m[6] = m1.z;
841 m[7] = m1.w;
842 m[8] = m2.x;
843 m[9] = m2.y;
844 m[10] = m2.z;
845 m[11] = m2.w;
846}
847
848static __forceinline__ __device__ void optixGetObjectToWorldTransformMatrix( float m[12] )
849{
850 if( optixGetTransformListSize() == 0 )
851 {
852 m[0] = 1.0f;
853 m[1] = 0.0f;
854 m[2] = 0.0f;
855 m[3] = 0.0f;
856 m[4] = 0.0f;
857 m[5] = 1.0f;
858 m[6] = 0.0f;
859 m[7] = 0.0f;
860 m[8] = 0.0f;
861 m[9] = 0.0f;
862 m[10] = 1.0f;
863 m[11] = 0.0f;
864 return;
865 }
866
867 float4 m0, m1, m2;
869 m[0] = m0.x;
870 m[1] = m0.y;
871 m[2] = m0.z;
872 m[3] = m0.w;
873 m[4] = m1.x;
874 m[5] = m1.y;
875 m[6] = m1.z;
876 m[7] = m1.w;
877 m[8] = m2.x;
878 m[9] = m2.y;
879 m[10] = m2.z;
880 m[11] = m2.w;
881}
882
883static __forceinline__ __device__ float3 optixTransformPointFromWorldToObjectSpace( float3 point )
884{
885 if( optixGetTransformListSize() == 0 )
886 return point;
887
888 float4 m0, m1, m2;
890 return optix_impl::optixTransformPoint( m0, m1, m2, point );
891}
892
893static __forceinline__ __device__ float3 optixTransformVectorFromWorldToObjectSpace( float3 vec )
894{
895 if( optixGetTransformListSize() == 0 )
896 return vec;
897
898 float4 m0, m1, m2;
900 return optix_impl::optixTransformVector( m0, m1, m2, vec );
901}
902
903static __forceinline__ __device__ float3 optixTransformNormalFromWorldToObjectSpace( float3 normal )
904{
905 if( optixGetTransformListSize() == 0 )
906 return normal;
907
908 float4 m0, m1, m2;
909 optix_impl::optixGetObjectToWorldTransformMatrix( m0, m1, m2 ); // inverse of optixGetWorldToObjectTransformMatrix()
910 return optix_impl::optixTransformNormal( m0, m1, m2, normal );
911}
912
913static __forceinline__ __device__ float3 optixTransformPointFromObjectToWorldSpace( float3 point )
914{
915 if( optixGetTransformListSize() == 0 )
916 return point;
917
918 float4 m0, m1, m2;
920 return optix_impl::optixTransformPoint( m0, m1, m2, point );
921}
922
923static __forceinline__ __device__ float3 optixTransformVectorFromObjectToWorldSpace( float3 vec )
924{
925 if( optixGetTransformListSize() == 0 )
926 return vec;
927
928 float4 m0, m1, m2;
930 return optix_impl::optixTransformVector( m0, m1, m2, vec );
931}
932
933static __forceinline__ __device__ float3 optixTransformNormalFromObjectToWorldSpace( float3 normal )
934{
935 if( optixGetTransformListSize() == 0 )
936 return normal;
937
938 float4 m0, m1, m2;
939 optix_impl::optixGetWorldToObjectTransformMatrix( m0, m1, m2 ); // inverse of optixGetObjectToWorldTransformMatrix()
940 return optix_impl::optixTransformNormal( m0, m1, m2, normal );
941}
942
943static __forceinline__ __device__ unsigned int optixGetTransformListSize()
944{
945 unsigned int u0;
946 asm( "call (%0), _optix_get_transform_list_size, ();" : "=r"( u0 ) : );
947 return u0;
948}
949
950static __forceinline__ __device__ OptixTraversableHandle optixGetTransformListHandle( unsigned int index )
951{
952 unsigned long long u0;
953 asm( "call (%0), _optix_get_transform_list_handle, (%1);" : "=l"( u0 ) : "r"( index ) : );
954 return u0;
955}
956
958{
959 int i0;
960 asm( "call (%0), _optix_get_transform_type_from_handle, (%1);" : "=r"( i0 ) : "l"( handle ) : );
961 return (OptixTransformType)i0;
962}
963
964static __forceinline__ __device__ const OptixStaticTransform* optixGetStaticTransformFromHandle( OptixTraversableHandle handle )
965{
966 unsigned long long ptr;
967 asm( "call (%0), _optix_get_static_transform_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : );
968 return (const OptixStaticTransform*)ptr;
969}
970
972{
973 unsigned long long ptr;
974 asm( "call (%0), _optix_get_srt_motion_transform_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : );
975 return (const OptixSRTMotionTransform*)ptr;
976}
977
979{
980 unsigned long long ptr;
981 asm( "call (%0), _optix_get_matrix_motion_transform_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : );
982 return (const OptixMatrixMotionTransform*)ptr;
983}
984
985static __forceinline__ __device__ unsigned int optixGetInstanceIdFromHandle( OptixTraversableHandle handle )
986{
987 int i0;
988 asm( "call (%0), _optix_get_instance_id_from_handle, (%1);" : "=r"( i0 ) : "l"( handle ) : );
989 return i0;
990}
991
993{
994 unsigned long long i0;
995 asm( "call (%0), _optix_get_instance_child_from_handle, (%1);" : "=l"( i0 ) : "l"( handle ) : );
996 return (OptixTraversableHandle)i0;
997}
998
999static __forceinline__ __device__ const float4* optixGetInstanceTransformFromHandle( OptixTraversableHandle handle )
1000{
1001 unsigned long long ptr;
1002 asm( "call (%0), _optix_get_instance_transform_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : );
1003 return (const float4*)ptr;
1004}
1005
1006static __forceinline__ __device__ const float4* optixGetInstanceInverseTransformFromHandle( OptixTraversableHandle handle )
1007{
1008 unsigned long long ptr;
1009 asm( "call (%0), _optix_get_instance_inverse_transform_from_handle, (%1);" : "=l"( ptr ) : "l"( handle ) : );
1010 return (const float4*)ptr;
1011}
1012
1013static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind )
1014{
1015 int ret;
1016 asm volatile(
1017 "call (%0), _optix_report_intersection_0"
1018 ", (%1, %2);"
1019 : "=r"( ret )
1020 : "f"( hitT ), "r"( hitKind )
1021 : );
1022 return ret;
1023}
1024
1025static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0 )
1026{
1027 int ret;
1028 asm volatile(
1029 "call (%0), _optix_report_intersection_1"
1030 ", (%1, %2, %3);"
1031 : "=r"( ret )
1032 : "f"( hitT ), "r"( hitKind ), "r"( a0 )
1033 : );
1034 return ret;
1035}
1036
1037static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0, unsigned int a1 )
1038{
1039 int ret;
1040 asm volatile(
1041 "call (%0), _optix_report_intersection_2"
1042 ", (%1, %2, %3, %4);"
1043 : "=r"( ret )
1044 : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 )
1045 : );
1046 return ret;
1047}
1048
1049static __forceinline__ __device__ bool optixReportIntersection( float hitT, unsigned int hitKind, unsigned int a0, unsigned int a1, unsigned int a2 )
1050{
1051 int ret;
1052 asm volatile(
1053 "call (%0), _optix_report_intersection_3"
1054 ", (%1, %2, %3, %4, %5);"
1055 : "=r"( ret )
1056 : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 )
1057 : );
1058 return ret;
1059}
1060
1061static __forceinline__ __device__ bool optixReportIntersection( float hitT,
1062 unsigned int hitKind,
1063 unsigned int a0,
1064 unsigned int a1,
1065 unsigned int a2,
1066 unsigned int a3 )
1067{
1068 int ret;
1069 asm volatile(
1070 "call (%0), _optix_report_intersection_4"
1071 ", (%1, %2, %3, %4, %5, %6);"
1072 : "=r"( ret )
1073 : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ), "r"( a3 )
1074 : );
1075 return ret;
1076}
1077
1078static __forceinline__ __device__ bool optixReportIntersection( float hitT,
1079 unsigned int hitKind,
1080 unsigned int a0,
1081 unsigned int a1,
1082 unsigned int a2,
1083 unsigned int a3,
1084 unsigned int a4 )
1085{
1086 int ret;
1087 asm volatile(
1088 "call (%0), _optix_report_intersection_5"
1089 ", (%1, %2, %3, %4, %5, %6, %7);"
1090 : "=r"( ret )
1091 : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ), "r"( a3 ), "r"( a4 )
1092 : );
1093 return ret;
1094}
1095
1096static __forceinline__ __device__ bool optixReportIntersection( float hitT,
1097 unsigned int hitKind,
1098 unsigned int a0,
1099 unsigned int a1,
1100 unsigned int a2,
1101 unsigned int a3,
1102 unsigned int a4,
1103 unsigned int a5 )
1104{
1105 int ret;
1106 asm volatile(
1107 "call (%0), _optix_report_intersection_6"
1108 ", (%1, %2, %3, %4, %5, %6, %7, %8);"
1109 : "=r"( ret )
1110 : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ), "r"( a3 ), "r"( a4 ), "r"( a5 )
1111 : );
1112 return ret;
1113}
1114
1115static __forceinline__ __device__ bool optixReportIntersection( float hitT,
1116 unsigned int hitKind,
1117 unsigned int a0,
1118 unsigned int a1,
1119 unsigned int a2,
1120 unsigned int a3,
1121 unsigned int a4,
1122 unsigned int a5,
1123 unsigned int a6 )
1124{
1125 int ret;
1126 asm volatile(
1127 "call (%0), _optix_report_intersection_7"
1128 ", (%1, %2, %3, %4, %5, %6, %7, %8, %9);"
1129 : "=r"( ret )
1130 : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ), "r"( a3 ), "r"( a4 ), "r"( a5 ), "r"( a6 )
1131 : );
1132 return ret;
1133}
1134
1135static __forceinline__ __device__ bool optixReportIntersection( float hitT,
1136 unsigned int hitKind,
1137 unsigned int a0,
1138 unsigned int a1,
1139 unsigned int a2,
1140 unsigned int a3,
1141 unsigned int a4,
1142 unsigned int a5,
1143 unsigned int a6,
1144 unsigned int a7 )
1145{
1146 int ret;
1147 asm volatile(
1148 "call (%0), _optix_report_intersection_8"
1149 ", (%1, %2, %3, %4, %5, %6, %7, %8, %9, %10);"
1150 : "=r"( ret )
1151 : "f"( hitT ), "r"( hitKind ), "r"( a0 ), "r"( a1 ), "r"( a2 ), "r"( a3 ), "r"( a4 ), "r"( a5 ), "r"( a6 ), "r"( a7 )
1152 : );
1153 return ret;
1154}
1155
1156#define OPTIX_DEFINE_optixGetAttribute_BODY( which ) \
1157 unsigned int ret; \
1158 asm( "call (%0), _optix_get_attribute_" #which ", ();" : "=r"( ret ) : ); \
1159 return ret;
1160
1161static __forceinline__ __device__ unsigned int optixGetAttribute_0()
1162{
1164}
1165
1166static __forceinline__ __device__ unsigned int optixGetAttribute_1()
1167{
1169}
1170
1171static __forceinline__ __device__ unsigned int optixGetAttribute_2()
1172{
1174}
1175
1176static __forceinline__ __device__ unsigned int optixGetAttribute_3()
1177{
1179}
1180
1181static __forceinline__ __device__ unsigned int optixGetAttribute_4()
1182{
1184}
1185
1186static __forceinline__ __device__ unsigned int optixGetAttribute_5()
1187{
1189}
1190
1191static __forceinline__ __device__ unsigned int optixGetAttribute_6()
1192{
1194}
1195
1196static __forceinline__ __device__ unsigned int optixGetAttribute_7()
1197{
1199}
1200
1201#undef OPTIX_DEFINE_optixGetAttribute_BODY
1202
1203static __forceinline__ __device__ void optixTerminateRay()
1204{
1205 asm volatile( "call _optix_terminate_ray, ();" );
1206}
1207
1208static __forceinline__ __device__ void optixIgnoreIntersection()
1209{
1210 asm volatile( "call _optix_ignore_intersection, ();" );
1211}
1212
1213static __forceinline__ __device__ unsigned int optixGetPrimitiveIndex()
1214{
1215 unsigned int u0;
1216 asm( "call (%0), _optix_read_primitive_idx, ();" : "=r"( u0 ) : );
1217 return u0;
1218}
1219
1220static __forceinline__ __device__ unsigned int optixGetSbtGASIndex()
1221{
1222 unsigned int u0;
1223 asm( "call (%0), _optix_read_sbt_gas_idx, ();" : "=r"( u0 ) : );
1224 return u0;
1225}
1226
1227static __forceinline__ __device__ unsigned int optixGetInstanceId()
1228{
1229 unsigned int u0;
1230 asm( "call (%0), _optix_read_instance_id, ();" : "=r"( u0 ) : );
1231 return u0;
1232}
1233
1234static __forceinline__ __device__ unsigned int optixGetInstanceIndex()
1235{
1236 unsigned int u0;
1237 asm( "call (%0), _optix_read_instance_idx, ();" : "=r"( u0 ) : );
1238 return u0;
1239}
1240
1241static __forceinline__ __device__ unsigned int optixGetHitKind()
1242{
1243 unsigned int u0;
1244 asm( "call (%0), _optix_get_hit_kind, ();" : "=r"( u0 ) : );
1245 return u0;
1246}
1247
1248static __forceinline__ __device__ OptixPrimitiveType optixGetPrimitiveType(unsigned int hitKind)
1249{
1250 unsigned int u0;
1251 asm( "call (%0), _optix_get_primitive_type_from_hit_kind, (%1);" : "=r"( u0 ) : "r"( hitKind ) );
1252 return (OptixPrimitiveType)u0;
1253}
1254
1255static __forceinline__ __device__ bool optixIsBackFaceHit( unsigned int hitKind )
1256{
1257 unsigned int u0;
1258 asm( "call (%0), _optix_get_backface_from_hit_kind, (%1);" : "=r"( u0 ) : "r"( hitKind ) );
1259 return (u0 == 0x1);
1260}
1261
1262static __forceinline__ __device__ bool optixIsFrontFaceHit( unsigned int hitKind )
1263{
1264 return !optixIsBackFaceHit( hitKind );
1265}
1266
1267
1268static __forceinline__ __device__ OptixPrimitiveType optixGetPrimitiveType()
1269{
1271}
1272
1273static __forceinline__ __device__ bool optixIsBackFaceHit()
1274{
1276}
1277
1278static __forceinline__ __device__ bool optixIsFrontFaceHit()
1279{
1281}
1282
1283static __forceinline__ __device__ bool optixIsTriangleHit()
1284{
1286}
1287
1288static __forceinline__ __device__ bool optixIsTriangleFrontFaceHit()
1289{
1291}
1292
1293static __forceinline__ __device__ bool optixIsTriangleBackFaceHit()
1294{
1296}
1297
1298static __forceinline__ __device__ bool optixIsDisplacedMicromeshTriangleHit()
1299{
1301}
1302
1303static __forceinline__ __device__ bool optixIsDisplacedMicromeshTriangleFrontFaceHit()
1304{
1306}
1307
1308static __forceinline__ __device__ bool optixIsDisplacedMicromeshTriangleBackFaceHit()
1309{
1311}
1312
1313static __forceinline__ __device__ float optixGetCurveParameter()
1314{
1315 float f0;
1316 asm( "call (%0), _optix_get_curve_parameter, ();" : "=f"(f0) : );
1317 return f0;
1318}
1319
1320static __forceinline__ __device__ float2 optixGetRibbonParameters()
1321{
1322 float f0, f1;
1323 asm( "call (%0, %1), _optix_get_ribbon_parameters, ();" : "=f"( f0 ), "=f"( f1 ) : );
1324 return make_float2( f0, f1 );
1325}
1326
1327static __forceinline__ __device__ float2 optixGetTriangleBarycentrics()
1328{
1329 float f0, f1;
1330 asm( "call (%0, %1), _optix_get_triangle_barycentrics, ();" : "=f"( f0 ), "=f"( f1 ) : );
1331 return make_float2( f0, f1 );
1332}
1333
1334static __forceinline__ __device__ uint3 optixGetLaunchIndex()
1335{
1336 unsigned int u0, u1, u2;
1337 asm( "call (%0), _optix_get_launch_index_x, ();" : "=r"( u0 ) : );
1338 asm( "call (%0), _optix_get_launch_index_y, ();" : "=r"( u1 ) : );
1339 asm( "call (%0), _optix_get_launch_index_z, ();" : "=r"( u2 ) : );
1340 return make_uint3( u0, u1, u2 );
1341}
1342
1343static __forceinline__ __device__ uint3 optixGetLaunchDimensions()
1344{
1345 unsigned int u0, u1, u2;
1346 asm( "call (%0), _optix_get_launch_dimension_x, ();" : "=r"( u0 ) : );
1347 asm( "call (%0), _optix_get_launch_dimension_y, ();" : "=r"( u1 ) : );
1348 asm( "call (%0), _optix_get_launch_dimension_z, ();" : "=r"( u2 ) : );
1349 return make_uint3( u0, u1, u2 );
1350}
1351
1352static __forceinline__ __device__ CUdeviceptr optixGetSbtDataPointer()
1353{
1354 unsigned long long ptr;
1355 asm( "call (%0), _optix_get_sbt_data_ptr_64, ();" : "=l"( ptr ) : );
1356 return (CUdeviceptr)ptr;
1357}
1358
1359static __forceinline__ __device__ void optixThrowException( int exceptionCode )
1360{
1361 asm volatile(
1362 "call _optix_throw_exception_0, (%0);"
1363 : /* no return value */
1364 : "r"( exceptionCode )
1365 : );
1366}
1367
1368static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0 )
1369{
1370 asm volatile(
1371 "call _optix_throw_exception_1, (%0, %1);"
1372 : /* no return value */
1373 : "r"( exceptionCode ), "r"( exceptionDetail0 )
1374 : );
1375}
1376
1377static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1 )
1378{
1379 asm volatile(
1380 "call _optix_throw_exception_2, (%0, %1, %2);"
1381 : /* no return value */
1382 : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 )
1383 : );
1384}
1385
1386static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2 )
1387{
1388 asm volatile(
1389 "call _optix_throw_exception_3, (%0, %1, %2, %3);"
1390 : /* no return value */
1391 : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 )
1392 : );
1393}
1394
1395static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2, unsigned int exceptionDetail3 )
1396{
1397 asm volatile(
1398 "call _optix_throw_exception_4, (%0, %1, %2, %3, %4);"
1399 : /* no return value */
1400 : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ), "r"( exceptionDetail3 )
1401 : );
1402}
1403
1404static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2, unsigned int exceptionDetail3, unsigned int exceptionDetail4 )
1405{
1406 asm volatile(
1407 "call _optix_throw_exception_5, (%0, %1, %2, %3, %4, %5);"
1408 : /* no return value */
1409 : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ), "r"( exceptionDetail3 ), "r"( exceptionDetail4 )
1410 : );
1411}
1412
1413static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2, unsigned int exceptionDetail3, unsigned int exceptionDetail4, unsigned int exceptionDetail5 )
1414{
1415 asm volatile(
1416 "call _optix_throw_exception_6, (%0, %1, %2, %3, %4, %5, %6);"
1417 : /* no return value */
1418 : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ), "r"( exceptionDetail3 ), "r"( exceptionDetail4 ), "r"( exceptionDetail5 )
1419 : );
1420}
1421
1422static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2, unsigned int exceptionDetail3, unsigned int exceptionDetail4, unsigned int exceptionDetail5, unsigned int exceptionDetail6 )
1423{
1424 asm volatile(
1425 "call _optix_throw_exception_7, (%0, %1, %2, %3, %4, %5, %6, %7);"
1426 : /* no return value */
1427 : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ), "r"( exceptionDetail3 ), "r"( exceptionDetail4 ), "r"( exceptionDetail5 ), "r"( exceptionDetail6 )
1428 : );
1429}
1430
1431static __forceinline__ __device__ void optixThrowException( int exceptionCode, unsigned int exceptionDetail0, unsigned int exceptionDetail1, unsigned int exceptionDetail2, unsigned int exceptionDetail3, unsigned int exceptionDetail4, unsigned int exceptionDetail5, unsigned int exceptionDetail6, unsigned int exceptionDetail7 )
1432{
1433 asm volatile(
1434 "call _optix_throw_exception_8, (%0, %1, %2, %3, %4, %5, %6, %7, %8);"
1435 : /* no return value */
1436 : "r"( exceptionCode ), "r"( exceptionDetail0 ), "r"( exceptionDetail1 ), "r"( exceptionDetail2 ), "r"( exceptionDetail3 ), "r"( exceptionDetail4 ), "r"( exceptionDetail5 ), "r"( exceptionDetail6 ), "r"( exceptionDetail7 )
1437 : );
1438}
1439
1440static __forceinline__ __device__ int optixGetExceptionCode()
1441{
1442 int s0;
1443 asm( "call (%0), _optix_get_exception_code, ();" : "=r"( s0 ) : );
1444 return s0;
1445}
1446
1447#define OPTIX_DEFINE_optixGetExceptionDetail_BODY( which ) \
1448 unsigned int ret; \
1449 asm( "call (%0), _optix_get_exception_detail_" #which ", ();" : "=r"( ret ) : ); \
1450 return ret;
1451
1452static __forceinline__ __device__ unsigned int optixGetExceptionDetail_0()
1453{
1455}
1456
1457static __forceinline__ __device__ unsigned int optixGetExceptionDetail_1()
1458{
1460}
1461
1462static __forceinline__ __device__ unsigned int optixGetExceptionDetail_2()
1463{
1465}
1466
1467static __forceinline__ __device__ unsigned int optixGetExceptionDetail_3()
1468{
1470}
1471
1472static __forceinline__ __device__ unsigned int optixGetExceptionDetail_4()
1473{
1475}
1476
1477static __forceinline__ __device__ unsigned int optixGetExceptionDetail_5()
1478{
1480}
1481
1482static __forceinline__ __device__ unsigned int optixGetExceptionDetail_6()
1483{
1485}
1486
1487static __forceinline__ __device__ unsigned int optixGetExceptionDetail_7()
1488{
1490}
1491
1492#undef OPTIX_DEFINE_optixGetExceptionDetail_BODY
1493
1495{
1496 unsigned long long handle;
1497 asm( "call (%0), _optix_get_exception_invalid_traversable, ();" : "=l"( handle ) : );
1498 return (OptixTraversableHandle)handle;
1499}
1500
1501static __forceinline__ __device__ int optixGetExceptionInvalidSbtOffset()
1502{
1503 int s0;
1504 asm( "call (%0), _optix_get_exception_invalid_sbt_offset, ();" : "=r"( s0 ) : );
1505 return s0;
1506}
1507
1508static __forceinline__ __device__ OptixInvalidRayExceptionDetails optixGetExceptionInvalidRay()
1509{
1510 float rayOriginX, rayOriginY, rayOriginZ, rayDirectionX, rayDirectionY, rayDirectionZ, tmin, tmax, rayTime;
1511 asm( "call (%0, %1, %2, %3, %4, %5, %6, %7, %8), _optix_get_exception_invalid_ray, ();"
1512 : "=f"( rayOriginX ), "=f"( rayOriginY ), "=f"( rayOriginZ ), "=f"( rayDirectionX ), "=f"( rayDirectionY ),
1513 "=f"( rayDirectionZ ), "=f"( tmin ), "=f"( tmax ), "=f"( rayTime )
1514 : );
1515 OptixInvalidRayExceptionDetails ray;
1516 ray.origin = make_float3( rayOriginX, rayOriginY, rayOriginZ );
1517 ray.direction = make_float3( rayDirectionX, rayDirectionY, rayDirectionZ );
1518 ray.tmin = tmin;
1519 ray.tmax = tmax;
1520 ray.time = rayTime;
1521 return ray;
1522}
1523
1524static __forceinline__ __device__ OptixParameterMismatchExceptionDetails optixGetExceptionParameterMismatch()
1525{
1526 unsigned int expected, actual, sbtIdx;
1527 unsigned long long calleeName;
1528 asm(
1529 "call (%0, %1, %2, %3), _optix_get_exception_parameter_mismatch, ();"
1530 : "=r"(expected), "=r"(actual), "=r"(sbtIdx), "=l"(calleeName) : );
1531 OptixParameterMismatchExceptionDetails details;
1532 details.expectedParameterCount = expected;
1533 details.passedArgumentCount = actual;
1534 details.sbtIndex = sbtIdx;
1535 details.callableName = (char*)calleeName;
1536 return details;
1537}
1538
1539static __forceinline__ __device__ char* optixGetExceptionLineInfo()
1540{
1541 unsigned long long ptr;
1542 asm( "call (%0), _optix_get_exception_line_info, ();" : "=l"(ptr) : );
1543 return (char*)ptr;
1544}
1545
1546template <typename ReturnT, typename... ArgTypes>
1547static __forceinline__ __device__ ReturnT optixDirectCall( unsigned int sbtIndex, ArgTypes... args )
1548{
1549 unsigned long long func;
1550 asm( "call (%0), _optix_call_direct_callable,(%1);" : "=l"( func ) : "r"( sbtIndex ) : );
1551 using funcT = ReturnT ( * )( ArgTypes... );
1552 funcT call = ( funcT )( func );
1553 return call( args... );
1554}
1555
1556template <typename ReturnT, typename... ArgTypes>
1557static __forceinline__ __device__ ReturnT optixContinuationCall( unsigned int sbtIndex, ArgTypes... args )
1558{
1559 unsigned long long func;
1560 asm( "call (%0), _optix_call_continuation_callable,(%1);" : "=l"( func ) : "r"( sbtIndex ) : );
1561 using funcT = ReturnT ( * )( ArgTypes... );
1562 funcT call = ( funcT )( func );
1563 return call( args... );
1564}
1565
1566static __forceinline__ __device__ uint4 optixTexFootprint2D( unsigned long long tex, unsigned int texInfo, float x, float y, unsigned int* singleMipLevel )
1567{
1568 uint4 result;
1569 unsigned long long resultPtr = reinterpret_cast<unsigned long long>( &result );
1570 unsigned long long singleMipLevelPtr = reinterpret_cast<unsigned long long>( singleMipLevel );
1571 // Cast float args to integers, because the intrinics take .b32 arguments when compiled to PTX.
1572 asm volatile(
1573 "call _optix_tex_footprint_2d_v2"
1574 ", (%0, %1, %2, %3, %4, %5);"
1575 :
1576 : "l"( tex ), "r"( texInfo ), "r"( __float_as_uint( x ) ), "r"( __float_as_uint( y ) ),
1577 "l"( singleMipLevelPtr ), "l"( resultPtr )
1578 : );
1579 return result;
1580}
1581
1582static __forceinline__ __device__ uint4 optixTexFootprint2DGrad( unsigned long long tex,
1583 unsigned int texInfo,
1584 float x,
1585 float y,
1586 float dPdx_x,
1587 float dPdx_y,
1588 float dPdy_x,
1589 float dPdy_y,
1590 bool coarse,
1591 unsigned int* singleMipLevel )
1592{
1593 uint4 result;
1594 unsigned long long resultPtr = reinterpret_cast<unsigned long long>( &result );
1595 unsigned long long singleMipLevelPtr = reinterpret_cast<unsigned long long>( singleMipLevel );
1596 // Cast float args to integers, because the intrinics take .b32 arguments when compiled to PTX.
1597 asm volatile(
1598 "call _optix_tex_footprint_2d_grad_v2"
1599 ", (%0, %1, %2, %3, %4, %5, %6, %7, %8, %9, %10);"
1600 :
1601 : "l"( tex ), "r"( texInfo ), "r"( __float_as_uint( x ) ), "r"( __float_as_uint( y ) ),
1602 "r"( __float_as_uint( dPdx_x ) ), "r"( __float_as_uint( dPdx_y ) ), "r"( __float_as_uint( dPdy_x ) ),
1603 "r"( __float_as_uint( dPdy_y ) ), "r"( static_cast<unsigned int>( coarse ) ), "l"( singleMipLevelPtr ), "l"( resultPtr )
1604 : );
1605
1606 return result;
1607}
1608
1609static __forceinline__ __device__ uint4
1610optixTexFootprint2DLod( unsigned long long tex, unsigned int texInfo, float x, float y, float level, bool coarse, unsigned int* singleMipLevel )
1611{
1612 uint4 result;
1613 unsigned long long resultPtr = reinterpret_cast<unsigned long long>( &result );
1614 unsigned long long singleMipLevelPtr = reinterpret_cast<unsigned long long>( singleMipLevel );
1615 // Cast float args to integers, because the intrinics take .b32 arguments when compiled to PTX.
1616 asm volatile(
1617 "call _optix_tex_footprint_2d_lod_v2"
1618 ", (%0, %1, %2, %3, %4, %5, %6, %7);"
1619 :
1620 : "l"( tex ), "r"( texInfo ), "r"( __float_as_uint( x ) ), "r"( __float_as_uint( y ) ),
1621 "r"( __float_as_uint( level ) ), "r"( static_cast<unsigned int>( coarse ) ), "l"( singleMipLevelPtr ), "l"( resultPtr )
1622 : );
1623 return result;
1624}
1625
1626#endif // OPTIX_OPTIX_DEVICE_IMPL_H
OptixTransformType
Transform.
Definition: optix_types.h:1831
unsigned long long CUdeviceptr
CUDA device pointer.
Definition: optix_types.h:52
unsigned int OptixVisibilityMask
Visibility mask.
Definition: optix_types.h:80
unsigned long long OptixTraversableHandle
Traversable handle.
Definition: optix_types.h:77
OptixPrimitiveType
Builtin primitive types.
Definition: optix_types.h:708
OptixPayloadTypeID
Payload type identifiers.
Definition: optix_types.h:1958
@ OPTIX_HIT_KIND_TRIANGLE_BACK_FACE
Ray hit the triangle on the back face.
Definition: optix_types.h:323
@ OPTIX_HIT_KIND_TRIANGLE_FRONT_FACE
Ray hit the triangle on the front face.
Definition: optix_types.h:321
@ OPTIX_PRIMITIVE_TYPE_DISPLACED_MICROMESH_TRIANGLE
Triangle with an applied displacement micromap.
Definition: optix_types.h:728
@ OPTIX_PAYLOAD_TYPE_DEFAULT
Definition: optix_types.h:1959
static __forceinline__ __device__ void optixGetObjectToWorldTransformMatrix(float4 &m0, float4 &m1, float4 &m2)
Definition: optix_device_impl_transformations.h:361
static __forceinline__ __device__ float3 optixTransformPoint(const float4 &m0, const float4 &m1, const float4 &m2, const float3 &p)
Definition: optix_device_impl_transformations.h:392
static __forceinline__ __device__ float3 optixTransformVector(const float4 &m0, const float4 &m1, const float4 &m2, const float3 &v)
Definition: optix_device_impl_transformations.h:402
static __forceinline__ __device__ float3 optixTransformNormal(const float4 &m0, const float4 &m1, const float4 &m2, const float3 &n)
Definition: optix_device_impl_transformations.h:413
static __forceinline__ __device__ void optixGetWorldToObjectTransformMatrix(float4 &m0, float4 &m1, float4 &m2)
Definition: optix_device_impl_transformations.h:330
Definition: optix_device_impl.h:44
static __forceinline__ __device__ unsigned int optixGetExceptionDetail_7()
Definition: optix_device_impl.h:1487
static __forceinline__ __device__ ReturnT optixContinuationCall(unsigned int sbtIndex, ArgTypes... args)
Definition: optix_device_impl.h:1557
static __forceinline__ __device__ void optixThrowException(int exceptionCode)
Definition: optix_device_impl.h:1359
static __forceinline__ __device__ unsigned int optixGetPayload_2()
Definition: optix_device_impl.h:330
static __forceinline__ __device__ void optixSetPayload_16(unsigned int p)
Definition: optix_device_impl.h:236
static __forceinline__ __device__ float3 optixTransformNormalFromWorldToObjectSpace(float3 normal)
Definition: optix_device_impl.h:903
static __forceinline__ __device__ unsigned int optixGetPayload_25()
Definition: optix_device_impl.h:491
static __forceinline__ __device__ unsigned int optixGetPayload_1()
Definition: optix_device_impl.h:323
static __forceinline__ __device__ unsigned int optixGetPayload_15()
Definition: optix_device_impl.h:421
static __forceinline__ __device__ OptixTraversableHandle optixGetGASTraversableHandle()
Definition: optix_device_impl.h:785
static __forceinline__ __device__ uint3 optixGetLaunchDimensions()
Definition: optix_device_impl.h:1343
static __forceinline__ __device__ void optixSetPayload_11(unsigned int p)
Definition: optix_device_impl.h:211
static __forceinline__ __device__ void optixSetPayloadTypes(unsigned int types)
Definition: optix_device_impl.h:540
static __forceinline__ __device__ void optixSetPayload_8(unsigned int p)
Definition: optix_device_impl.h:196
static __forceinline__ __device__ void optixSetPayload_5(unsigned int p)
Definition: optix_device_impl.h:181
static __forceinline__ __device__ unsigned int optixGetPayload_9()
Definition: optix_device_impl.h:379
static __forceinline__ __device__ void optixSetPayload_29(unsigned int p)
Definition: optix_device_impl.h:301
static __forceinline__ __device__ void optixSetPayload_14(unsigned int p)
Definition: optix_device_impl.h:226
static __forceinline__ __device__ unsigned int optixGetExceptionDetail_2()
Definition: optix_device_impl.h:1462
static __forceinline__ __device__ unsigned int optixGetGASMotionStepCount(OptixTraversableHandle handle)
Definition: optix_device_impl.h:806
static __forceinline__ __device__ const OptixStaticTransform * optixGetStaticTransformFromHandle(OptixTraversableHandle handle)
Definition: optix_device_impl.h:964
static __forceinline__ __device__ void optixSetPayload_19(unsigned int p)
Definition: optix_device_impl.h:251
static __forceinline__ __device__ float3 optixGetWorldRayDirection()
Definition: optix_device_impl.h:561
static __forceinline__ __device__ float3 optixGetObjectRayOrigin()
Definition: optix_device_impl.h:570
static __forceinline__ __device__ OptixParameterMismatchExceptionDetails optixGetExceptionParameterMismatch()
Definition: optix_device_impl.h:1524
static __forceinline__ __device__ bool optixIsFrontFaceHit(unsigned int hitKind)
Definition: optix_device_impl.h:1262
static __forceinline__ __device__ unsigned int optixGetAttribute_4()
Definition: optix_device_impl.h:1181
static __forceinline__ __device__ unsigned int optixGetPayload_4()
Definition: optix_device_impl.h:344
static __forceinline__ __device__ void optixSetPayload_10(unsigned int p)
Definition: optix_device_impl.h:206
static __forceinline__ __device__ unsigned int optixGetPayload_18()
Definition: optix_device_impl.h:442
static __forceinline__ __device__ unsigned int optixGetAttribute_6()
Definition: optix_device_impl.h:1191
static __forceinline__ __device__ unsigned int optixGetAttribute_3()
Definition: optix_device_impl.h:1176
static __forceinline__ __device__ void optixSetPayload_20(unsigned int p)
Definition: optix_device_impl.h:256
static __forceinline__ __device__ void optixSetPayload_4(unsigned int p)
Definition: optix_device_impl.h:176
static __forceinline__ __device__ unsigned int optixGetPayload_5()
Definition: optix_device_impl.h:351
static __forceinline__ __device__ unsigned int optixGetPayload_22()
Definition: optix_device_impl.h:470
static __forceinline__ __device__ bool optixIsTriangleHit()
Definition: optix_device_impl.h:1283
static __forceinline__ __device__ void optixGetCubicBSplineVertexData(OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float4 data[4])
Definition: optix_device_impl.h:692
static __forceinline__ __device__ unsigned int optixGetPayload_27()
Definition: optix_device_impl.h:505
static __forceinline__ __device__ uint4 optixTexFootprint2DGrad(unsigned long long tex, unsigned int texInfo, float x, float y, float dPdx_x, float dPdx_y, float dPdy_x, float dPdy_y, bool coarse, unsigned int *singleMipLevel)
Definition: optix_device_impl.h:1582
static __forceinline__ __device__ void optixSetPayload_6(unsigned int p)
Definition: optix_device_impl.h:186
static __forceinline__ __device__ unsigned int optixGetAttribute_1()
Definition: optix_device_impl.h:1166
static __forceinline__ __device__ bool optixIsTriangleBackFaceHit()
Definition: optix_device_impl.h:1293
static __forceinline__ __device__ unsigned int optixGetAttribute_5()
Definition: optix_device_impl.h:1186
static __forceinline__ __device__ void optixGetRibbonVertexData(OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float4 data[3])
Definition: optix_device_impl.h:741
static __forceinline__ __device__ void optixSetPayload_25(unsigned int p)
Definition: optix_device_impl.h:281
static __forceinline__ __device__ unsigned int optixGetRayFlags()
Definition: optix_device_impl.h:609
static __forceinline__ __device__ float3 optixTransformPointFromObjectToWorldSpace(float3 point)
Definition: optix_device_impl.h:913
static __forceinline__ __device__ unsigned int optixGetPayload_26()
Definition: optix_device_impl.h:498
static __forceinline__ __device__ void optixSetPayload_17(unsigned int p)
Definition: optix_device_impl.h:241
static __forceinline__ __device__ void optixSetPayload_7(unsigned int p)
Definition: optix_device_impl.h:191
static __forceinline__ __device__ ReturnT optixDirectCall(unsigned int sbtIndex, ArgTypes... args)
Definition: optix_device_impl.h:1547
static __forceinline__ __device__ unsigned int optixGetPayload_30()
Definition: optix_device_impl.h:526
static __forceinline__ __device__ void optixSetPayload_28(unsigned int p)
Definition: optix_device_impl.h:296
static __forceinline__ __device__ OptixPrimitiveType optixGetPrimitiveType(unsigned int hitKind)
Definition: optix_device_impl.h:1248
static __forceinline__ __device__ float3 optixTransformVectorFromObjectToWorldSpace(float3 vec)
Definition: optix_device_impl.h:923
static __forceinline__ __device__ unsigned int optixGetInstanceId()
Definition: optix_device_impl.h:1227
static __forceinline__ __device__ char * optixGetExceptionLineInfo()
Definition: optix_device_impl.h:1539
static __forceinline__ __device__ void optixSetPayload_27(unsigned int p)
Definition: optix_device_impl.h:291
static __forceinline__ __device__ void optixSetPayload_2(unsigned int p)
Definition: optix_device_impl.h:166
static __forceinline__ __device__ void optixGetCatmullRomVertexData(OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float4 data[4])
Definition: optix_device_impl.h:709
static __forceinline__ __device__ int optixGetExceptionCode()
Definition: optix_device_impl.h:1440
static __forceinline__ __device__ void optixSetPayload_12(unsigned int p)
Definition: optix_device_impl.h:216
static __forceinline__ __device__ void optixGetObjectToWorldTransformMatrix(float m[12])
Definition: optix_device_impl.h:848
static __forceinline__ __device__ unsigned int optixGetPayload_24()
Definition: optix_device_impl.h:484
static __forceinline__ __device__ unsigned int optixGetPayload_17()
Definition: optix_device_impl.h:435
static __forceinline__ __device__ float optixGetGASMotionTimeBegin(OptixTraversableHandle handle)
Definition: optix_device_impl.h:792
static __forceinline__ __device__ const OptixMatrixMotionTransform * optixGetMatrixMotionTransformFromHandle(OptixTraversableHandle handle)
Definition: optix_device_impl.h:978
static __forceinline__ __device__ void optixGetSphereData(OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float4 data[1])
Definition: optix_device_impl.h:771
static __forceinline__ __device__ unsigned int optixGetPayload_13()
Definition: optix_device_impl.h:407
static __forceinline__ __device__ uint4 optixTexFootprint2D(unsigned long long tex, unsigned int texInfo, float x, float y, unsigned int *singleMipLevel)
Definition: optix_device_impl.h:1566
static __forceinline__ __device__ void optixSetPayload_23(unsigned int p)
Definition: optix_device_impl.h:271
static __forceinline__ __device__ unsigned int optixGetAttribute_0()
Definition: optix_device_impl.h:1161
static __forceinline__ __device__ unsigned int optixGetPayload_10()
Definition: optix_device_impl.h:386
static __forceinline__ __device__ void optixGetQuadraticBSplineVertexData(OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float4 data[3])
Definition: optix_device_impl.h:677
static __forceinline__ __device__ uint3 optixGetLaunchIndex()
Definition: optix_device_impl.h:1334
static __forceinline__ __device__ unsigned int optixGetPayload_31()
Definition: optix_device_impl.h:533
static __forceinline__ __device__ void optixSetPayload_24(unsigned int p)
Definition: optix_device_impl.h:276
static __forceinline__ __device__ void optixTerminateRay()
Definition: optix_device_impl.h:1203
static __forceinline__ __device__ OptixTraversableHandle optixGetInstanceTraversableFromIAS(OptixTraversableHandle ias, unsigned int instIdx)
Definition: optix_device_impl.h:623
static __forceinline__ __device__ int optixGetExceptionInvalidSbtOffset()
Definition: optix_device_impl.h:1501
static __forceinline__ __device__ unsigned int optixGetExceptionDetail_6()
Definition: optix_device_impl.h:1482
static __forceinline__ __device__ unsigned int optixGetAttribute_7()
Definition: optix_device_impl.h:1196
static __forceinline__ __device__ unsigned int optixGetRayVisibilityMask()
Definition: optix_device_impl.h:616
static __forceinline__ __device__ void optixSetPayload_30(unsigned int p)
Definition: optix_device_impl.h:306
static __forceinline__ __device__ unsigned int optixGetInstanceIdFromHandle(OptixTraversableHandle handle)
Definition: optix_device_impl.h:985
static __forceinline__ __device__ void optixGetLinearCurveVertexData(OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float4 data[2])
Definition: optix_device_impl.h:663
static __forceinline__ __device__ unsigned int optixGetPayload_3()
Definition: optix_device_impl.h:337
static __forceinline__ __device__ bool optixReportIntersection(float hitT, unsigned int hitKind)
Definition: optix_device_impl.h:1013
static __forceinline__ __device__ unsigned int optixGetPayload_23()
Definition: optix_device_impl.h:477
static __forceinline__ __device__ unsigned int optixGetPayload_20()
Definition: optix_device_impl.h:456
static __forceinline__ __device__ OptixTraversableHandle optixGetTransformListHandle(unsigned int index)
Definition: optix_device_impl.h:950
static __forceinline__ __device__ unsigned int optixGetExceptionDetail_0()
Definition: optix_device_impl.h:1452
static __forceinline__ __device__ unsigned int optixUndefinedValue()
Definition: optix_device_impl.h:545
#define OPTIX_DEFINE_optixGetAttribute_BODY(which)
Definition: optix_device_impl.h:1156
static __forceinline__ __device__ float2 optixGetRibbonParameters()
Definition: optix_device_impl.h:1320
static __forceinline__ __device__ void optixIgnoreIntersection()
Definition: optix_device_impl.h:1208
static __forceinline__ __device__ OptixInvalidRayExceptionDetails optixGetExceptionInvalidRay()
Definition: optix_device_impl.h:1508
static __forceinline__ __device__ float optixGetRayTmax()
Definition: optix_device_impl.h:595
static __forceinline__ __device__ float3 optixTransformNormalFromObjectToWorldSpace(float3 normal)
Definition: optix_device_impl.h:933
static __forceinline__ __device__ void optixGetCubicBezierVertexData(OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float4 data[4])
Definition: optix_device_impl.h:725
static __forceinline__ __device__ unsigned int optixGetExceptionDetail_1()
Definition: optix_device_impl.h:1457
static __forceinline__ __device__ float2 optixGetTriangleBarycentrics()
Definition: optix_device_impl.h:1327
static __forceinline__ __device__ float3 optixGetObjectRayDirection()
Definition: optix_device_impl.h:579
static __forceinline__ __device__ unsigned int optixGetPayload_6()
Definition: optix_device_impl.h:358
static __forceinline__ __device__ void optixSetPayload_9(unsigned int p)
Definition: optix_device_impl.h:201
static __forceinline__ __device__ void optixSetPayload_26(unsigned int p)
Definition: optix_device_impl.h:286
static __forceinline__ __device__ unsigned int optixGetPayload_11()
Definition: optix_device_impl.h:393
static __forceinline__ __device__ void optixGetMicroTriangleVertexData(float3 data[3])
Definition: optix_device_impl.h:647
static __forceinline__ __device__ void optixGetWorldToObjectTransformMatrix(float m[12])
Definition: optix_device_impl.h:813
static __forceinline__ __device__ unsigned int optixGetInstanceIndex()
Definition: optix_device_impl.h:1234
static __forceinline__ __device__ bool optixIsDisplacedMicromeshTriangleFrontFaceHit()
Definition: optix_device_impl.h:1303
static __forceinline__ __device__ float3 optixGetWorldRayOrigin()
Definition: optix_device_impl.h:552
static __forceinline__ __device__ void optixSetPayload_22(unsigned int p)
Definition: optix_device_impl.h:266
static __forceinline__ __device__ void optixTrace(OptixTraversableHandle handle, float3 rayOrigin, float3 rayDirection, float tmin, float tmax, float rayTime, OptixVisibilityMask visibilityMask, unsigned int rayFlags, unsigned int SBToffset, unsigned int SBTstride, unsigned int missSBTIndex, Payload &... payload)
Definition: optix_device_impl.h:50
static __forceinline__ __device__ uint4 optixTexFootprint2DLod(unsigned long long tex, unsigned int texInfo, float x, float y, float level, bool coarse, unsigned int *singleMipLevel)
Definition: optix_device_impl.h:1610
static __forceinline__ __device__ unsigned int optixGetPrimitiveIndex()
Definition: optix_device_impl.h:1213
static __forceinline__ __device__ const float4 * optixGetInstanceTransformFromHandle(OptixTraversableHandle handle)
Definition: optix_device_impl.h:999
static __forceinline__ __device__ void optixSetPayload_3(unsigned int p)
Definition: optix_device_impl.h:171
static __forceinline__ __device__ bool optixIsBackFaceHit(unsigned int hitKind)
Definition: optix_device_impl.h:1255
static __forceinline__ __device__ unsigned int optixGetTransformListSize()
Definition: optix_device_impl.h:943
static __forceinline__ __device__ void optixSetPayload_18(unsigned int p)
Definition: optix_device_impl.h:246
static __forceinline__ __device__ bool optixIsDisplacedMicromeshTriangleHit()
Definition: optix_device_impl.h:1298
static __forceinline__ __device__ unsigned int optixGetSbtGASIndex()
Definition: optix_device_impl.h:1220
static __forceinline__ __device__ void optixSetPayload_21(unsigned int p)
Definition: optix_device_impl.h:261
static __forceinline__ __device__ bool optixIsDisplacedMicromeshTriangleBackFaceHit()
Definition: optix_device_impl.h:1308
static __forceinline__ __device__ void optixSetPayload_0(unsigned int p)
Definition: optix_device_impl.h:156
static __forceinline__ __device__ const OptixSRTMotionTransform * optixGetSRTMotionTransformFromHandle(OptixTraversableHandle handle)
Definition: optix_device_impl.h:971
static __forceinline__ __device__ unsigned int optixGetPayload_14()
Definition: optix_device_impl.h:414
static __forceinline__ __device__ CUdeviceptr optixGetSbtDataPointer()
Definition: optix_device_impl.h:1352
static __forceinline__ __device__ float3 optixGetRibbonNormal(OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float2 ribbonParameters)
Definition: optix_device_impl.h:755
static __forceinline__ __device__ void optixGetMicroTriangleBarycentricsData(float2 data[3])
Definition: optix_device_impl.h:655
static __forceinline__ __device__ void optixSetPayload_1(unsigned int p)
Definition: optix_device_impl.h:161
static __forceinline__ __device__ void optixSetPayload_13(unsigned int p)
Definition: optix_device_impl.h:221
#define OPTIX_DEFINE_optixGetExceptionDetail_BODY(which)
Definition: optix_device_impl.h:1447
static __forceinline__ __device__ unsigned int optixGetPayload_21()
Definition: optix_device_impl.h:463
static __forceinline__ __device__ unsigned int optixGetPayload_8()
Definition: optix_device_impl.h:372
static __forceinline__ __device__ float optixGetCurveParameter()
Definition: optix_device_impl.h:1313
static __forceinline__ __device__ unsigned int optixGetPayload_19()
Definition: optix_device_impl.h:449
static __forceinline__ __device__ unsigned int optixGetExceptionDetail_4()
Definition: optix_device_impl.h:1472
static __forceinline__ __device__ float3 optixTransformVectorFromWorldToObjectSpace(float3 vec)
Definition: optix_device_impl.h:893
static __forceinline__ __device__ void optixSetPayload_15(unsigned int p)
Definition: optix_device_impl.h:231
static __forceinline__ __device__ bool optixIsTriangleFrontFaceHit()
Definition: optix_device_impl.h:1288
static __forceinline__ __device__ unsigned int optixGetPayload_0()
Definition: optix_device_impl.h:316
static __forceinline__ __device__ float3 optixTransformPointFromWorldToObjectSpace(float3 point)
Definition: optix_device_impl.h:883
static __forceinline__ __device__ OptixTraversableHandle optixGetExceptionInvalidTraversable()
Definition: optix_device_impl.h:1494
static __forceinline__ __device__ unsigned int optixGetAttribute_2()
Definition: optix_device_impl.h:1171
static __forceinline__ __device__ unsigned int optixGetHitKind()
Definition: optix_device_impl.h:1241
static __forceinline__ __device__ unsigned int optixGetPayload_28()
Definition: optix_device_impl.h:512
static __forceinline__ __device__ unsigned int optixGetPayload_7()
Definition: optix_device_impl.h:365
static __forceinline__ __device__ void optixGetTriangleVertexData(OptixTraversableHandle gas, unsigned int primIdx, unsigned int sbtGASIndex, float time, float3 data[3])
Definition: optix_device_impl.h:633
static __forceinline__ __device__ float optixGetGASMotionTimeEnd(OptixTraversableHandle handle)
Definition: optix_device_impl.h:799
static __forceinline__ __device__ float optixGetRayTmin()
Definition: optix_device_impl.h:588
static __forceinline__ __device__ float optixGetRayTime()
Definition: optix_device_impl.h:602
static __forceinline__ __device__ void optixSetPayload_31(unsigned int p)
Definition: optix_device_impl.h:311
static __forceinline__ __device__ unsigned int optixGetPayload_16()
Definition: optix_device_impl.h:428
static __forceinline__ __device__ OptixTransformType optixGetTransformTypeFromHandle(OptixTraversableHandle handle)
Definition: optix_device_impl.h:957
static __forceinline__ __device__ const float4 * optixGetInstanceInverseTransformFromHandle(OptixTraversableHandle handle)
Definition: optix_device_impl.h:1006
static __forceinline__ __device__ unsigned int optixGetPayload_12()
Definition: optix_device_impl.h:400
static __forceinline__ __device__ unsigned int optixGetExceptionDetail_5()
Definition: optix_device_impl.h:1477
static __forceinline__ __device__ unsigned int optixGetPayload_29()
Definition: optix_device_impl.h:519
static __forceinline__ __device__ OptixTraversableHandle optixGetInstanceChildFromHandle(OptixTraversableHandle handle)
Definition: optix_device_impl.h:992
static __forceinline__ __device__ unsigned int optixGetExceptionDetail_3()
Definition: optix_device_impl.h:1467
Represents a matrix motion transformation.
Definition: optix_types.h:1435
Represents an SRT motion transformation.
Definition: optix_types.h:1518
Static transform.
Definition: optix_types.h:1395
Definition: optix_device_impl.h:46