OptiX  3.9
NVIDIA OptiX Acceleration Engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
optix_prime.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright (c) 2013 NVIDIA Corporation. All rights reserved.
4  *
5  * NVIDIA Corporation and its licensors retain all intellectual property and
6  * proprietary rights in and to this software, related documentation and any
7  * modifications thereto. Any use, reproduction, disclosure or distribution of
8  * this software and related documentation without an express license agreement
9  * from NVIDIA Corporation is strictly prohibited.
10  *
11  * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
12  * *AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
13  * OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
14  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
15  * NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR
16  * CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR
17  * LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
18  * INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
19  * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE
20  * POSSIBILITY OF SUCH DAMAGES
21  */
22 
31 #ifndef __optix_optix_prime_h__
32 #define __optix_optix_prime_h__
33 
34 #define OPTIX_PRIME_VERSION 3090 /* 3.9.0 (major = OPTIX_PRIME_VERSION/1000, *
35  * minor = (OPTIX_PRIME_VERSION%1000)/10, *
36  * micro = OPTIX_PRIME_VERSION%10 */
37 
38 #ifndef RTPAPI
39 # if defined( _WIN32 )
40 # define RTPAPI __declspec(dllimport)
41 # else
42 # define RTPAPI
43 # endif
44 #endif
45 
47 
48 /****************************************
49  *
50  * PLATFORM-DEPENDENT TYPES
51  *
52  ****************************************/
53 
54 #if defined( _WIN64 )
55 typedef unsigned __int64 RTPsize;
56 #elif defined( _WIN32 )
57 typedef unsigned int RTPsize;
58 #else
59 typedef long unsigned int RTPsize;
60 #endif
61 
63 typedef struct RTPcontext_api* RTPcontext;
65 typedef struct RTPmodel_api* RTPmodel;
67 typedef struct RTPquery_api* RTPquery;
69 typedef struct RTPbufferdesc_api* RTPbufferdesc;
70 
71 /****************************************
72  *
73  * FORWARD DECLARATIONS
74  *
75  ****************************************/
76 
77 typedef struct CUstream_st *cudaStream_t;
78 
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
82 
83  /****************************************
84  *
85  * CONTEXT
86  *
87  * The context manages the creation of API objects and encapsulates a
88  * particular computational backend.
89  *
90  ****************************************/
91 
127  RTPresult RTPAPI rtpContextCreate( RTPcontexttype type, /*out*/ RTPcontext* context );
128 
157  RTPresult RTPAPI rtpContextSetCudaDeviceNumbers( RTPcontext context, unsigned deviceCount, const unsigned* deviceNumbers );
158 
159 
181  RTPresult RTPAPI rtpContextSetCpuThreads( RTPcontext context, unsigned numThreads );
182 
202  RTPresult RTPAPI rtpContextDestroy( RTPcontext context );
203 
226  RTPresult RTPAPI rtpContextGetLastErrorString( RTPcontext context, /*out*/ const char** return_string );
227 
228 
229 
230  /****************************************
231  *
232  * BUFFER DESCRIPTOR
233  *
234  * A buffer descriptor provides information about a buffer's type, format,
235  * and location. It also describes the region of the buffer to use.
236  *
237  ****************************************/
238 
269  RTPresult RTPAPI rtpBufferDescCreate( RTPcontext context, RTPbufferformat format, RTPbuffertype type, void* buffer, /*out*/ RTPbufferdesc* desc );
270 
287  RTPresult RTPAPI rtpBufferDescGetContext( RTPbufferdesc desc, /*out*/ RTPcontext* context );
288 
309  RTPresult RTPAPI rtpBufferDescSetRange( RTPbufferdesc desc, RTPsize begin, RTPsize end );
310 
346  RTPresult RTPAPI rtpBufferDescSetStride( RTPbufferdesc desc, unsigned strideBytes );
347 
368  RTPresult RTPAPI rtpBufferDescSetCudaDeviceNumber( RTPbufferdesc desc, unsigned deviceNumber );
369 
391 
392 
393 
394  /****************************************
395  *
396  * MODEL
397  *
398  * A model is a combination of a set of triangles and an acceleration
399  * structure
400  *
401  ****************************************/
402 
419  RTPresult RTPAPI rtpModelCreate( RTPcontext context, /*out*/ RTPmodel* model );
420 
437  RTPresult RTPAPI rtpModelGetContext( RTPmodel model, RTPcontext* context );
438 
462  RTPresult RTPAPI rtpModelSetTriangles( RTPmodel model, RTPbufferdesc indices, RTPbufferdesc vertices );
463 
500  RTPresult RTPAPI rtpModelSetInstances( RTPmodel model, RTPbufferdesc instances, RTPbufferdesc transforms );
501 
559  RTPresult RTPAPI rtpModelUpdate( RTPmodel model, unsigned hints );
560 
579  RTPresult RTPAPI rtpModelFinish( RTPmodel model );
580 
597  RTPresult RTPAPI rtpModelGetFinished( RTPmodel model, /*out*/ int* isFinished );
598 
625  RTPresult RTPAPI rtpModelCopy( RTPmodel model, RTPmodel srcModel );
626 
668  RTPresult RTPAPI rtpModelSetBuilderParameter( RTPmodel model_api, RTPbuilderparam param, RTPsize size, const void* ptr );
669 
688  RTPresult RTPAPI rtpModelDestroy( RTPmodel model );
689 
690 
691 
692  /****************************************
693  *
694  * QUERY
695  *
696  * A query encapsulates a ray tracing computation against a model
697  *
698  ****************************************/
699 
720  RTPresult RTPAPI rtpQueryCreate( RTPmodel model, RTPquerytype queryType, /*out*/ RTPquery* query );
721 
738  RTPresult RTPAPI rtpQueryGetContext( RTPquery query, /*out*/ RTPcontext* context );
739 
758  RTPresult RTPAPI rtpQuerySetRays( RTPquery query, RTPbufferdesc rays );
759 
779  RTPresult RTPAPI rtpQuerySetHits( RTPquery query, RTPbufferdesc hits );
780 
814  RTPresult RTPAPI rtpQueryExecute( RTPquery query, unsigned hints );
815 
834  RTPresult RTPAPI rtpQueryFinish( RTPquery query );
835 
852  RTPresult RTPAPI rtpQueryGetFinished( RTPquery query, /*out*/ int* isFinished );
853 
874  RTPresult RTPAPI rtpQuerySetCudaStream( RTPquery query, cudaStream_t stream );
875 
893  RTPresult RTPAPI rtpQueryDestroy( RTPquery query );
894 
895  /****************************************
896  *
897  * MISC
898  *
899  ****************************************/
900 
920  RTPresult RTPAPI rtpHostBufferLock( void* buffer, RTPsize size );
921 
941  RTPresult RTPAPI rtpHostBufferUnlock( void* buffer );
942 
962  RTPresult RTPAPI rtpGetErrorString( RTPresult errorCode, /*out*/ const char** errorString );
963 
981  RTPresult RTPAPI rtpGetVersion( /*out*/ unsigned* version );
982 
999  RTPresult RTPAPI rtpGetVersionString( const char** versionString );
1000 
1001 #ifdef __cplusplus
1002 }
1003 #endif
1004 
1005 #endif /* #ifndef __optix_optix_prime_h__ */
RTPresult RTPAPI rtpHostBufferLock(void *buffer, RTPsize size)
Page-locks a host buffer.
RTPresult RTPAPI rtpModelGetContext(RTPmodel model, RTPcontext *context)
Gets the context object associated with the model.
RTPresult RTPAPI rtpQueryCreate(RTPmodel model, RTPquerytype queryType, RTPquery *query)
Creates a query on a model.
RTPresult RTPAPI rtpBufferDescDestroy(RTPbufferdesc desc)
Destroys a buffer descriptor.
RTPresult RTPAPI rtpBufferDescSetRange(RTPbufferdesc desc, RTPsize begin, RTPsize end)
Sets the element range of a buffer to use.
RTPresult RTPAPI rtpBufferDescSetStride(RTPbufferdesc desc, unsigned strideBytes)
Sets the stride for elements in a buffer.
RTPresult RTPAPI rtpQueryExecute(RTPquery query, unsigned hints)
Executes a raytracing query.
RTPresult RTPAPI rtpGetErrorString(RTPresult errorCode, const char **errorString)
Translates an RTPresult error code to a string.
RTPresult RTPAPI rtpBufferDescSetCudaDeviceNumber(RTPbufferdesc desc, unsigned deviceNumber)
Sets the CUDA device number for a buffer.
RTPresult RTPAPI rtpModelCopy(RTPmodel model, RTPmodel srcModel)
Copies one model to another.
RTPresult RTPAPI rtpContextCreate(RTPcontexttype type, RTPcontext *context)
Creates an OptiX Prime context.
RTPresult RTPAPI rtpModelSetTriangles(RTPmodel model, RTPbufferdesc indices, RTPbufferdesc vertices)
Sets the triangle data for a model.
RTPquerytype
Definition: optix_prime_declarations.h:97
RTPresult RTPAPI rtpGetVersion(unsigned *version)
Gets OptiX Prime version number.
RTPresult RTPAPI rtpQueryGetContext(RTPquery query, RTPcontext *context)
Gets the context object associated with a query.
RTPresult RTPAPI rtpQueryFinish(RTPquery query)
Blocks current thread until query is finished.
RTPresult RTPAPI rtpModelDestroy(RTPmodel model)
Destroys a model.
OptiX Prime public API declarations.
RTPresult RTPAPI rtpBufferDescGetContext(RTPbufferdesc desc, RTPcontext *context)
Gets the context object associated with the provided buffer descriptor.
RTPresult RTPAPI rtpQueryGetFinished(RTPquery query, int *isFinished)
Polls the status of a query.
RTPbuilderparam
Definition: optix_prime_declarations.h:121
RTPresult RTPAPI rtpQuerySetHits(RTPquery query, RTPbufferdesc hits)
Sets the hits buffer for a query.
RTPbufferformat
Definition: optix_prime_declarations.h:64
RTPresult RTPAPI rtpContextGetLastErrorString(RTPcontext context, const char **return_string)
Returns a string describing last error encountered.
struct RTPbufferdesc_api * RTPbufferdesc
Definition: optix_prime.h:69
RTPcontexttype
Definition: optix_prime_declarations.h:50
RTPresult RTPAPI rtpBufferDescCreate(RTPcontext context, RTPbufferformat format, RTPbuffertype type, void *buffer, RTPbufferdesc *desc)
Create a buffer descriptor.
struct RTPcontext_api * RTPcontext
Definition: optix_prime.h:63
RTPbuffertype
Definition: optix_prime_declarations.h:57
RTPresult RTPAPI rtpHostBufferUnlock(void *buffer)
Unlocks a previously page-locked host buffer.
RTPresult RTPAPI rtpModelSetBuilderParameter(RTPmodel model_api, RTPbuilderparam param, RTPsize size, const void *ptr)
Specifies a builder parameter for a model.
RTPresult RTPAPI rtpContextSetCpuThreads(RTPcontext context, unsigned numThreads)
Sets the number of CPU threads used by a CPU context.
RTPresult RTPAPI rtpGetVersionString(const char **versionString)
Gets OptiX Prime version string.
struct RTPquery_api * RTPquery
Definition: optix_prime.h:67
RTPresult RTPAPI rtpModelCreate(RTPcontext context, RTPmodel *model)
Creates a model.
RTPresult RTPAPI rtpModelFinish(RTPmodel model)
Blocks current thread until model update is finished.
RTPresult RTPAPI rtpContextDestroy(RTPcontext context)
Destroys an OptiX Prime context.
RTPresult
Definition: optix_prime_declarations.h:34
struct RTPmodel_api * RTPmodel
Definition: optix_prime.h:65
RTPresult RTPAPI rtpQuerySetRays(RTPquery query, RTPbufferdesc rays)
Sets the rays buffer for a query.
RTPresult RTPAPI rtpModelGetFinished(RTPmodel model, int *isFinished)
Polls the status of a model update.
RTPresult RTPAPI rtpModelSetInstances(RTPmodel model, RTPbufferdesc instances, RTPbufferdesc transforms)
Sets the instance data for a model.
RTPresult RTPAPI rtpContextSetCudaDeviceNumbers(RTPcontext context, unsigned deviceCount, const unsigned *deviceNumbers)
Sets the CUDA devices used by a context.
RTPresult RTPAPI rtpModelUpdate(RTPmodel model, unsigned hints)
Updates data, or creates an acceleration structure over triangles or instances.
RTPresult RTPAPI rtpQuerySetCudaStream(RTPquery query, cudaStream_t stream)
Sets a sync stream for a query.
RTPresult RTPAPI rtpQueryDestroy(RTPquery query)
Destroys a query.