OptiX  3.9
NVIDIA OptiX Acceleration Engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
optix_primepp.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 proprietary
6  * rights in and to this software, related documentation and any modifications thereto.
7  * Any use, reproduction, disclosure or distribution of this software and related
8  * documentation without an express license agreement from NVIDIA Corporation is strictly
9  * prohibited.
10  *
11  * TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS*
12  * AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED,
13  * INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
14  * PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY
15  * SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT
16  * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF
17  * BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
18  * INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF
19  * SUCH DAMAGES
20  */
21 
26 
27 #ifndef __optix_optix_primepp_h__
28 #define __optix_optix_primepp_h__
29 
30 #include <string>
31 #include <vector>
32 
33 #include "optix_prime.h"
34 #include "internal/Handle.h"
35 
36 namespace optix {
37  namespace prime {
38 
39  /****************************************
40  *
41  * FORWARD DECLARATIONS
42  *
43  ****************************************/
44 
45  class BufferDescObj;
46  class ContextObj;
47  class ModelObj;
48  class QueryObj;
49 
50  /****************************************
51  *
52  * HANDLE - TYPEDEFS
53  *
54  ****************************************/
55 
58  typedef Handle<BufferDescObj> BufferDesc;
59  typedef Handle<ContextObj> Context;
60  typedef Handle<ModelObj> Model;
61  typedef Handle<QueryObj> Query;
62 
64 
65  /****************************************
66  *
67  * GLOBAL FUNCTIONS
68  *
69  ****************************************/
70 
72  std::string getVersionString();
73 
74  /****************************************
75  *
76  * REFERENCE COUNTED API - OBJECTS
77  *
78  ****************************************/
79 
84  class ContextObj : public RefCountedObj {
85  public:
86  //
87  // OBJECT CREATION - FUNCTIONS
88  //
89 
91  static Context create( RTPcontexttype type );
92 
95 
98 
99  //
100  // API-FUNCTIONS
101  //
102 
104  void setCudaDeviceNumbers( const std::vector<unsigned>& deviceNumbers );
105 
107  void setCudaDeviceNumbers( unsigned deviceCount, const unsigned* deviceNumbers );
108 
110  void setCpuThreads( unsigned numThreads );
111 
113  std::string getLastErrorString();
114 
117 
118  private:
119 
120  friend class QueryObj;
121  friend class ModelObj;
122  friend class BufferDescObj;
123 
124  Context getContext();
125 
126  ContextObj( RTPcontexttype type );
127  ~ContextObj();
128  operator Context();
129 
130  RTPcontext m_ctx;
131  };
132 
137  class BufferDescObj : public RefCountedObj {
138  public:
139  //
140  // API-FUNCTIONS
141  //
142 
145 
147  void setRange( RTPsize begin, RTPsize end );
148 
150  void setStride( unsigned strideBytes );
151 
153  void setCudaDeviceNumber( unsigned deviceNumber );
154 
157 
158  private:
159 
160  friend class ContextObj;
161  friend class ModelObj;
162  friend class QueryObj;
163 
164  BufferDescObj( const Context& ctx, RTPbufferformat format, RTPbuffertype type, void* buffer );
165  ~BufferDescObj();
166 
167  RTPbufferdesc m_desc;
168 
169  Context m_ctx;
170  };
171 
175  class ModelObj : public RefCountedObj {
176  public:
177  //
178  // OBJECT CREATION - FUNCTIONS
179  //
180 
182  Query createQuery( RTPquerytype queryType );
183 
184  //
185  // API-FUNCTIONS
186  //
187 
190 
192  void finish();
193 
195  int isFinished();
196 
198  void update( unsigned hints );
199 
201  void copy( const Model& srcModel );
202 
205  void setTriangles( RTPsize triCount, RTPbuffertype type, const void* vertPtr, unsigned stride=0 );
206 
209  void setTriangles( RTPsize triCount, RTPbuffertype type, const void* indexPtr, RTPsize vertCount, RTPbuffertype vertType, const void* vertPtr, unsigned stride=0 );
210 
213  void setTriangles( const BufferDesc& vertices );
214 
217  void setTriangles( const BufferDesc& indices, const BufferDesc& vertices );
218 
221  void setInstances(RTPsize count, RTPbuffertype instanceType, const RTPmodel* instanceList, RTPbufferformat transformFormat, RTPbuffertype transformType, const void* transformList);
222 
225  void setInstances( const BufferDesc& instances, const BufferDesc& transforms );
226 
229  void setBuilderParameter( RTPbuilderparam param, RTPsize size, const void* p );
230 
233  template<typename T>
234  void setBuilderParameter( RTPbuilderparam param, const T& val );
235 
237  RTPmodel getRTPmodel() { return m_model; }
238 
239  private:
240 
241  friend class ContextObj;
242  friend class QueryObj;
243 
244  ModelObj( const Context& ctx );
245  ~ModelObj();
246  operator Model();
247 
248  Context m_ctx;
249  RTPmodel m_model;
250  };
251 
252 
253 
257  class QueryObj : public RefCountedObj {
258  public:
259  //
260  // API-FUNCTIONS
261  //
262 
265 
267  void finish();
269  int isFinished();
270 
272  void setCudaStream( cudaStream_t stream );
273 
275  void setRays( RTPsize count, RTPbufferformat format, RTPbuffertype type, void* rays );
276 
278  void setRays( const BufferDesc& rays );
279 
281  void setHits( RTPsize count, RTPbufferformat format, RTPbuffertype type, void* hits );
282 
284  void setHits( const BufferDesc& hits );
285 
287  void execute( unsigned hint );
288 
290  RTPquery getRTPquery() { return m_query; }
291 
292  private:
293 
294  friend class ContextObj;
295  friend class ModelObj;
296 
297  QueryObj( const Model& model, RTPquerytype queryType );
298  ~QueryObj();
299 
300  Model m_model;
301  RTPquery m_query;
302  };
303 
304  /****************************************
305  *
306  * EXCEPTION
307  *
308  ****************************************/
309 
313  class Exception : public std::exception {
314  public:
316  static Exception makeException( RTPresult code );
317 
319  static Exception makeException( RTPresult code, RTPcontext context );
320 
321  virtual ~Exception() throw() {}
322 
324  RTPresult getErrorCode() const;
325 
327  const std::string& getErrorString() const;
328 
329  virtual const char* what() const throw();
330 
331  private:
332  Exception( const std::string& message, RTPresult error_code = RTP_ERROR_UNKNOWN );
333 
334  std::string m_errorMessage;
335  RTPresult m_errorCode;
336  };
337 
339  // //
340  // IMPLEMENTATION //
341  // //
343 
344  //
345  // HELPER - FUNCTIONS AND MACROS
346  //
347 
349  void checkError( RTPresult code );
350  void checkError( RTPresult code, RTPcontext context );
351  #define CHK( code ) checkError( code, getContext()->getRTPcontext() )
352 
353  //
354  // GLOBALS
355  //
356 
357  inline std::string getVersionString()
358  {
359  const char* versionString;
360  checkError( rtpGetVersionString( &versionString ) );
361  return versionString;
362  }
363 
364 
365  //
366  // CONTEXT
367  //
368 
370  {
371  Context h( new ContextObj(type) );
372  return h;
373  }
374 
376  {
377  BufferDesc h( new BufferDescObj(*this, format, type, buffer) );
378  return h;
379  }
380 
382  {
383  Model h( new ModelObj(*this) );
384  return h;
385  }
386 
387  inline ContextObj::ContextObj( RTPcontexttype type ) : m_ctx(0) {
388  RTPresult r = rtpContextCreate( type, &m_ctx );
389  if( r!=RTP_SUCCESS )
390  m_ctx = 0;
391 
392  checkError( r, m_ctx );
393  }
394 
395  inline ContextObj::~ContextObj() {
396  if( m_ctx ) {
397  RTPresult r = rtpContextDestroy( m_ctx );
398  if( r!=RTP_SUCCESS )
399  m_ctx = 0;
400  }
401  }
402 
403  inline void ContextObj::setCudaDeviceNumbers( const std::vector<unsigned>& deviceNumbers )
404  {
405  if( deviceNumbers.size()==0 ) {
406  CHK( rtpContextSetCudaDeviceNumbers(m_ctx, 0, NULL) );
407  } else {
408  CHK( rtpContextSetCudaDeviceNumbers(m_ctx, (unsigned int)deviceNumbers.size(), &deviceNumbers[0]) );
409  }
410  }
411 
412  inline void ContextObj::setCudaDeviceNumbers( unsigned deviceCount, const unsigned* deviceNumbers )
413  {
414  CHK( rtpContextSetCudaDeviceNumbers(m_ctx, deviceCount, deviceNumbers) );
415  }
416 
417  inline void ContextObj::setCpuThreads( unsigned numThreads )
418  {
419  CHK( rtpContextSetCpuThreads(m_ctx, numThreads) );
420  }
421 
422  inline std::string ContextObj::getLastErrorString()
423  {
424  const char* str;
425  rtpContextGetLastErrorString( m_ctx, &str );
426  return str;
427  }
428 
430  {
431  return m_ctx;
432  }
433 
434  inline ContextObj::operator Context()
435  {
436  Context context( this ); context->ref();
437  return context;
438  }
439 
440  inline Context ContextObj::getContext()
441  {
442  return Context( *this );
443  }
444 
445  //
446  // BUFFERDESC
447  //
448 
449  inline BufferDescObj::BufferDescObj( const Context& ctx, RTPbufferformat format, RTPbuffertype type, void* buffer ) : m_desc(0) {
450  m_ctx = ctx;
451 
452  CHK( rtpBufferDescCreate(m_ctx->getRTPcontext(), format, type, buffer, &m_desc) );
453  }
454 
455  inline BufferDescObj::~BufferDescObj() {
456  if( m_desc ) {
457  rtpBufferDescDestroy(m_desc);
458  }
459  }
460 
462  {
463  return m_ctx;
464  }
465 
466  inline void BufferDescObj::setRange( RTPsize begin, RTPsize end )
467  {
468  CHK( rtpBufferDescSetRange(m_desc, begin, end) );
469  }
470 
471  inline void BufferDescObj::setStride( unsigned strideBytes )
472  {
473  CHK( rtpBufferDescSetStride(m_desc, strideBytes) );
474  }
475 
476  inline void BufferDescObj::setCudaDeviceNumber( unsigned deviceNumber )
477  {
478  CHK( rtpBufferDescSetCudaDeviceNumber(m_desc, deviceNumber) );
479  }
480 
482  {
483  return m_desc;
484  }
485 
486  //
487  // MODEL
488  //
489 
490  inline ModelObj::ModelObj( const Context& ctx ) : m_model(0) {
491  m_ctx = ctx;
492 
493  CHK( rtpModelCreate(m_ctx->getRTPcontext(), &m_model) );
494  }
495 
496  inline ModelObj::~ModelObj() {
497  if( m_model ) {
498  rtpModelDestroy(m_model);
499  }
500  }
501 
503  {
504  return m_ctx;
505  }
506 
507  inline void ModelObj::setTriangles( const BufferDesc& indices, const BufferDesc& vertices )
508  {
509  if( indices.isValid() ) {
510  CHK( rtpModelSetTriangles(m_model, indices->getRTPbufferdesc(), vertices->getRTPbufferdesc()) );
511  } else {
512  CHK( rtpModelSetTriangles(m_model, 0, vertices->getRTPbufferdesc()) );
513  }
514  }
515 
516  inline void ModelObj::setTriangles( const BufferDesc& vertices )
517  {
518  CHK( rtpModelSetTriangles(m_model, 0, vertices->getRTPbufferdesc()) );
519  }
520 
521  inline void ModelObj::setTriangles( RTPsize triCount, RTPbuffertype type, const void* vertPtr, unsigned stride/*=0 */ )
522  {
523  BufferDesc vtxBufDesc( m_ctx->createBufferDesc(RTP_BUFFER_FORMAT_VERTEX_FLOAT3, type, const_cast<void*>( vertPtr ) ) );
524  vtxBufDesc->setRange( 0, 3*triCount );
525 
526  if( stride ) {
527  vtxBufDesc->setStride( stride );
528  }
529 
530  BufferDesc idxBufDesc;
531  setTriangles( idxBufDesc, vtxBufDesc );
532  }
533 
534  inline void ModelObj::setTriangles( RTPsize triCount, RTPbuffertype indexType, const void* indexPtr, RTPsize vertCount, RTPbuffertype vertType, const void* vertPtr, unsigned stride/*=0 */ )
535  {
536  BufferDesc idxBufDesc( m_ctx->createBufferDesc(RTP_BUFFER_FORMAT_INDICES_INT3, indexType, const_cast<void*>( indexPtr ) ) );
537  BufferDesc vtxBufDesc( m_ctx->createBufferDesc(RTP_BUFFER_FORMAT_VERTEX_FLOAT3, vertType, const_cast<void*>( vertPtr ) ) );
538 
539  idxBufDesc->setRange( 0, triCount );
540  vtxBufDesc->setRange( 0, vertCount );
541 
542  if( stride ) {
543  vtxBufDesc->setStride( stride );
544  }
545 
546  setTriangles( idxBufDesc, vtxBufDesc );
547  }
548 
549 
550  inline void ModelObj::setInstances(RTPsize count, RTPbuffertype instanceType, const RTPmodel* instanceList, RTPbufferformat transformFormat, RTPbuffertype transformType, const void* transformList)
551  {
552  BufferDesc instances(m_ctx->createBufferDesc(RTP_BUFFER_FORMAT_INSTANCE_MODEL, instanceType, const_cast<RTPmodel*>(instanceList)));
553  instances->setRange(0, count);
554  BufferDesc transforms(m_ctx->createBufferDesc(transformFormat, transformType, const_cast<void*>(transformList)));
555  transforms->setRange(0, count);
556 
557  CHK(rtpModelSetInstances(m_model, instances->getRTPbufferdesc(), transforms->getRTPbufferdesc()));
558  }
559 
560  inline void ModelObj::setInstances( const BufferDesc& instances, const BufferDesc& transforms )
561  {
562  CHK( rtpModelSetInstances(m_model, instances->getRTPbufferdesc(), transforms->getRTPbufferdesc()) );
563  }
564 
565  inline void ModelObj::update( unsigned hints )
566  {
567  CHK( rtpModelUpdate(m_model, hints) );
568  }
569 
570  inline void ModelObj::finish()
571  {
572  CHK( rtpModelFinish(m_model) );
573  }
574 
575  inline int ModelObj::isFinished()
576  {
577  int finished = 0;
578  CHK( rtpModelGetFinished(m_model, &finished) );
579 
580  return finished;
581  }
582 
583  inline void ModelObj::copy( const Model& srcModel )
584  {
585  CHK( rtpModelCopy(m_model, srcModel->getRTPmodel()) );
586  }
587 
588  inline ModelObj::operator Model()
589  {
590  Model model( this ); model->ref();
591  return model;
592  }
593 
595  {
596  Query h( new QueryObj(*this, queryType) );
597  return h;
598  }
599 
600  inline void ModelObj::setBuilderParameter( RTPbuilderparam param, RTPsize size, const void* p )
601  {
602  CHK( rtpModelSetBuilderParameter(m_model, param, size, p) );
603  }
604 
605  template<typename T>
607  {
608  setBuilderParameter( param, sizeof(T), &val );
609  }
610 
611  //
612  // QUERY
613  //
614 
615  inline QueryObj::QueryObj( const Model& model, RTPquerytype queryType ) : m_query(0) {
616  m_model = model;
617 
618  CHK( rtpQueryCreate(model->getRTPmodel(), queryType, &m_query) );
619  }
620 
621  inline QueryObj::~QueryObj() {
622  if( m_query ) {
623  rtpQueryDestroy(m_query);
624  }
625  }
626 
628  {
629  return m_model->getContext();
630  }
631 
632  inline void QueryObj::setRays( const BufferDesc& rays )
633  {
634  CHK( rtpQuerySetRays(m_query, rays->getRTPbufferdesc()) );
635  }
636 
637  inline void QueryObj::setRays( RTPsize count, RTPbufferformat format, RTPbuffertype type, void* rays )
638  {
639  BufferDesc desc(m_model->m_ctx->createBufferDesc(format, type, rays) );
640  desc->setRange( 0, count );
641 
642  setRays( desc );
643  }
644 
645  inline void QueryObj::setHits( const BufferDesc& hits )
646  {
647  CHK( rtpQuerySetHits(m_query, hits->getRTPbufferdesc()) );
648  }
649 
650  inline void QueryObj::setHits( RTPsize count, RTPbufferformat format, RTPbuffertype type, void* hits )
651  {
652  BufferDesc desc(m_model->m_ctx->createBufferDesc(format, type, hits) );
653  desc->setRange( 0, count );
654 
655  setHits( desc );
656  }
657 
658  inline void QueryObj::execute( unsigned hint )
659  {
660  CHK( rtpQueryExecute(m_query, hint) );
661  }
662 
663  inline void QueryObj::finish()
664  {
665  CHK( rtpQueryFinish(m_query) );
666  }
667 
668  inline int QueryObj::isFinished()
669  {
670  int finished = 0;
671  CHK( rtpQueryGetFinished(m_query, &finished) );
672 
673  return finished;
674  }
675 
676  inline void QueryObj::setCudaStream( cudaStream_t stream )
677  {
678  CHK( rtpQuerySetCudaStream(m_query, stream) );
679  }
680 
681  //
682  // EXCEPTION
683  //
684 
686  {
687  const char* str;
688  rtpGetErrorString( code, &str );
689  Exception h( std::string(str), code );
690 
691  return h;
692  }
693 
695  {
696  const char* str;
697  rtpContextGetLastErrorString( ctx, &str );
698  Exception h( std::string(str), code );
699 
700  return h;
701  }
702 
703  inline Exception::Exception( const std::string& message, RTPresult error_code )
704  : m_errorMessage(message), m_errorCode( error_code )
705  {
706  }
707 
709  {
710  return m_errorCode;
711  }
712 
713  inline const std::string& Exception::getErrorString() const
714  {
715  return m_errorMessage;
716  }
717 
718  inline const char* Exception::what() const throw()
719  {
720  return m_errorMessage.c_str();
721  }
722 
723  //
724  // HELPER - FUNCTIONS
725  //
726 
727  inline void checkError( RTPresult code )
728  {
729  if( code != RTP_SUCCESS ) {
730  throw Exception::makeException( code );
731  }
732  }
733 
734  inline void checkError( RTPresult code, RTPcontext context )
735  {
736  if( code != RTP_SUCCESS ) {
737  throw Exception::makeException( code, context );
738  }
739  }
740 
741 
742  } // end namespace prime
743 } // end namespace optix
744 
745 #endif // #ifndef __optix_optix_primepp_h__
Definition: optix_prime_declarations.h:89
Definition: optix_device.h:417
Context getContext()
Returns the context associated within this object.
Definition: optix_primepp.h:461
RTPresult RTPAPI rtpQueryCreate(RTPmodel model, RTPquerytype queryType, RTPquery *query)
Creates a query on a model.
void setCudaDeviceNumber(unsigned deviceNumber)
Sets the CUDA device number for a buffer. See rtpBufferDescSetCudaDeviceNumber.
Definition: optix_primepp.h:476
int isFinished()
Polls the status of a model update. See rtpModelGetFinished.
Definition: optix_primepp.h:575
RTPresult RTPAPI rtpBufferDescDestroy(RTPbufferdesc desc)
Destroys a buffer descriptor.
void setHits(RTPsize count, RTPbufferformat format, RTPbuffertype type, void *hits)
Sets a hit buffer for the query. See rtpQuerySetHits.
Definition: optix_primepp.h:650
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.
void setRays(RTPsize count, RTPbufferformat format, RTPbuffertype type, void *rays)
Creates a buffer descriptor and sets the rays of a query. See rtpQuerySetRays.
Definition: optix_primepp.h:637
OptiX Prime public API.
RTPresult RTPAPI rtpQueryExecute(RTPquery query, unsigned hints)
Executes a raytracing query.
Definition: optix_prime_declarations.h:67
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.
Context getContext()
Returns the context associated within this object.
Definition: optix_primepp.h:502
void setRange(RTPsize begin, RTPsize end)
Sets the range of a buffer to be used. See rtpBufferDescSetRange.
Definition: optix_primepp.h:466
void update(unsigned hints)
Creates the acceleration structure over the triangles. See rtpModelUpdate.
Definition: optix_primepp.h:565
void setCudaDeviceNumbers(const std::vector< unsigned > &deviceNumbers)
Sets the CUDA devices used by a context. See rtpContextSetCudaDeviceNumbers.
Definition: optix_primepp.h:403
RTPresult RTPAPI rtpModelSetTriangles(RTPmodel model, RTPbufferdesc indices, RTPbufferdesc vertices)
Sets the triangle data for a model.
void setCudaStream(cudaStream_t stream)
Sets a stream for a query. See rtpQuerySetCudaStream.
Definition: optix_primepp.h:676
RTPquerytype
Definition: optix_prime_declarations.h:97
Model createModel()
Creates a Model object. See rtpModelCreate.
Definition: optix_primepp.h:381
void setInstances(RTPsize count, RTPbuffertype instanceType, const RTPmodel *instanceList, RTPbufferformat transformFormat, RTPbuffertype transformType, const void *transformList)
Definition: optix_primepp.h:550
std::string getLastErrorString()
Returns a string describing last error encountered. See rtpContextGetLastErrorString.
Definition: optix_primepp.h:422
void setTriangles(RTPsize triCount, RTPbuffertype type, const void *vertPtr, unsigned stride=0)
Definition: optix_primepp.h:521
RTPresult RTPAPI rtpQueryFinish(RTPquery query)
Blocks current thread until query is finished.
RTPresult RTPAPI rtpModelDestroy(RTPmodel model)
Destroys a model.
Definition: optix_prime_declarations.h:36
RTPbufferdesc getRTPbufferdesc()
Returns the RTPbufferdesc descriptor stored within this object.
Definition: optix_primepp.h:481
void setCpuThreads(unsigned numThreads)
Sets the number of CPU threads used by a CPU context. See rtpContextSetCpuThreads.
Definition: optix_primepp.h:417
Encapsulates an OptiX Prime model. The purpose of a model is to represent a set of triangles and an a...
Definition: optix_primepp.h:175
RTPresult RTPAPI rtpQueryGetFinished(RTPquery query, int *isFinished)
Polls the status of a query.
RTPbuilderparam
Definition: optix_prime_declarations.h:121
Definition: optix_prime_declarations.h:46
void finish()
Blocks current thread until model update is finished. See rtpModelFinish.
Definition: optix_primepp.h:570
RTPresult RTPAPI rtpQuerySetHits(RTPquery query, RTPbufferdesc hits)
Sets the hits buffer for a query.
RTPbufferformat
Definition: optix_prime_declarations.h:64
void setBuilderParameter(RTPbuilderparam param, RTPsize size, const void *p)
Definition: optix_primepp.h:600
static Context create(RTPcontexttype type)
Creates a Context object. See rtpContextCreate.
Definition: optix_primepp.h:369
RTPresult RTPAPI rtpContextGetLastErrorString(RTPcontext context, const char **return_string)
Returns a string describing last error encountered.
BufferDesc createBufferDesc(RTPbufferformat format, RTPbuffertype type, void *buffer)
Creates a BufferDesc object. See rtpBufferDescCreate.
Definition: optix_primepp.h:375
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
int isFinished()
Polls the status of a query. See rtpQueryGetFinished.
Definition: optix_primepp.h:668
RTPresult RTPAPI rtpModelSetBuilderParameter(RTPmodel model_api, RTPbuilderparam param, RTPsize size, const void *ptr)
Specifies a builder parameter for a model.
Encapsulates an OptiX Prime exception.
Definition: optix_primepp.h:313
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.
void setStride(unsigned strideBytes)
Sets the stride for elements in a buffer. See rtpBufferDescSetStride.
Definition: optix_primepp.h:471
struct RTPquery_api * RTPquery
Definition: optix_prime.h:67
Definition: optix_prime_declarations.h:71
RTPresult RTPAPI rtpModelCreate(RTPcontext context, RTPmodel *model)
Creates a model.
RTPresult RTPAPI rtpModelFinish(RTPmodel model)
Blocks current thread until model update is finished.
RTPmodel getRTPmodel()
Returns the RTPmodel model stored within this object.
Definition: optix_primepp.h:237
void execute(unsigned hint)
Executes a raytracing query. See rtpQueryExecute.
Definition: optix_primepp.h:658
RTPresult RTPAPI rtpContextDestroy(RTPcontext context)
Destroys an OptiX Prime context.
RTPresult
Definition: optix_prime_declarations.h:34
RTPresult getErrorCode() const
Stores the RTPresult error code for this exception.
Definition: optix_primepp.h:708
Encapsulates an OptiX Prime buffer descriptor. The purpose of a buffer descriptor is to provide infor...
Definition: optix_primepp.h:137
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.
Query createQuery(RTPquerytype queryType)
Creates a Query object. See rtpQueryCreate.
Definition: optix_primepp.h:594
RTPresult RTPAPI rtpModelSetInstances(RTPmodel model, RTPbufferdesc instances, RTPbufferdesc transforms)
Sets the instance data for a model.
Context getContext()
Returns the context associated within this object.
Definition: optix_primepp.h:627
void finish()
Blocks current thread until query is finished. See rtpQueryFinish.
Definition: optix_primepp.h:663
RTPresult RTPAPI rtpContextSetCudaDeviceNumbers(RTPcontext context, unsigned deviceCount, const unsigned *deviceNumbers)
Sets the CUDA devices used by a context.
Wraps the OptiX Prime C API RTPcontext opaque type and its associated function set representing an Op...
Definition: optix_primepp.h:84
void copy(const Model &srcModel)
Copies one model to another. See rtpModelCopy.
Definition: optix_primepp.h:583
static Exception makeException(RTPresult code)
Returns a string describing last error encountered. See rtpGetErrorString.
Definition: optix_primepp.h:685
RTPquery getRTPquery()
Returns the RTPquery query stored within this object.
Definition: optix_primepp.h:290
Encapsulates an OptiX Prime query. The purpose of a query is to coordinate the intersection of rays w...
Definition: optix_primepp.h:257
RTPcontext getRTPcontext()
Returns the RTPcontext context stored within this object.
Definition: optix_primepp.h:429
const std::string & getErrorString() const
Stores the human-readable error string associated with this exception.
Definition: optix_primepp.h:713
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.