OptiX  3.9
NVIDIA OptiX Acceleration Engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
Public Member Functions | Static Public Member Functions | Friends | List of all members
optix::ContextObj Class Reference

Detailed Description

Context object wraps the OptiX C API RTcontext opaque type and its associated function set.

Inheritance diagram for optix::ContextObj:
optix::ScopedObj optix::DestroyableObj optix::APIObj

Public Member Functions

void destroy ()
 
void validate ()
 
Context getContext () const
 
void compile ()
 
void setRemoteDevice (RemoteDevice remote_device)
 
int getRunningState () const
 
RTcontext get ()
 
void checkError (RTresult code) const
 
std::string getErrorString (RTresult code) const
 
Acceleration createAcceleration (const char *builder, const char *traverser)
 
Buffer createBuffer (unsigned int type)
 
Buffer createBuffer (unsigned int type, RTformat format)
 
Buffer createBuffer (unsigned int type, RTformat format, RTsize width)
 
Buffer createMipmappedBuffer (unsigned int type, RTformat format, RTsize width, unsigned int levels)
 
Buffer createBuffer (unsigned int type, RTformat format, RTsize width, RTsize height)
 
Buffer createMipmappedBuffer (unsigned int type, RTformat format, RTsize width, RTsize height, unsigned int levels)
 
Buffer createBuffer (unsigned int type, RTformat format, RTsize width, RTsize height, RTsize depth)
 
Buffer createMipmappedBuffer (unsigned int type, RTformat format, RTsize width, RTsize height, RTsize depth, unsigned int levels)
 
Buffer create1DLayeredBuffer (unsigned int type, RTformat format, RTsize width, RTsize layers, unsigned int levels)
 
Buffer create2DLayeredBuffer (unsigned int type, RTformat format, RTsize width, RTsize height, RTsize layers, unsigned int levels)
 
Buffer createCubeBuffer (unsigned int type, RTformat format, RTsize width, RTsize height, unsigned int levels)
 
Buffer createCubeLayeredBuffer (unsigned int type, RTformat format, RTsize width, RTsize height, RTsize faces, unsigned int levels)
 
Buffer createBufferForCUDA (unsigned int type)
 
Buffer createBufferForCUDA (unsigned int type, RTformat format)
 
Buffer createBufferForCUDA (unsigned int type, RTformat format, RTsize width)
 
Buffer createBufferForCUDA (unsigned int type, RTformat format, RTsize width, RTsize height)
 
Buffer createBufferForCUDA (unsigned int type, RTformat format, RTsize width, RTsize height, RTsize depth)
 
Buffer createBufferFromGLBO (unsigned int type, unsigned int vbo)
 
TextureSampler createTextureSamplerFromGLImage (unsigned int id, RTgltarget target)
 
Buffer createBufferFromD3D9Resource (unsigned int type, IDirect3DResource9 *pResource)
 
Buffer createBufferFromD3D10Resource (unsigned int type, ID3D10Resource *pResource)
 
Buffer createBufferFromD3D11Resource (unsigned int type, ID3D11Resource *pResource)
 
TextureSampler createTextureSamplerFromD3D9Resource (IDirect3DResource9 *pResource)
 
TextureSampler createTextureSamplerFromD3D10Resource (ID3D10Resource *pResource)
 
TextureSampler createTextureSamplerFromD3D11Resource (ID3D11Resource *pResource)
 
Buffer getBufferFromId (int buffer_id)
 
Program getProgramFromId (int program_id)
 
TextureSampler getTextureSamplerFromId (int sampler_id)
 
Geometry createGeometry ()
 
GeometryInstance createGeometryInstance ()
 
template<class Iterator >
GeometryInstance createGeometryInstance (Geometry geometry, Iterator matlbegin, Iterator matlend)
 
Group createGroup ()
 
template<class Iterator >
Group createGroup (Iterator childbegin, Iterator childend)
 
GeometryGroup createGeometryGroup ()
 
template<class Iterator >
GeometryGroup createGeometryGroup (Iterator childbegin, Iterator childend)
 
Transform createTransform ()
 
Material createMaterial ()
 
Program createProgramFromPTXFile (const std::string &ptx, const std::string &program_name)
 
Program createProgramFromPTXString (const std::string &ptx, const std::string &program_name)
 
Selector createSelector ()
 
TextureSampler createTextureSampler ()
 
template<class Iterator >
void setDevices (Iterator begin, Iterator end)
 
void setD3D9Device (IDirect3DDevice9 *device)
 
void setD3D10Device (ID3D10Device *device)
 
void setD3D11Device (ID3D11Device *device)
 
std::vector< int > getEnabledDevices () const
 
unsigned int getEnabledDeviceCount () const
 
int getMaxTextureCount () const
 
int getCPUNumThreads () const
 
RTsize getUsedHostMemory () const
 
int getGPUPagingActive () const
 
int getGPUPagingForcedOff () const
 
RTsize getAvailableDeviceMemory (int ordinal) const
 
void setCPUNumThreads (int cpu_num_threads)
 
void setGPUPagingForcedOff (int gpu_paging_forced_off)
 
template<class T >
void setAttribute (RTcontextattribute attribute, const T &val)
 
void setStackSize (RTsize stack_size_bytes)
 
RTsize getStackSize () const
 
void setTimeoutCallback (RTtimeoutcallback callback, double min_polling_seconds)
 
void setEntryPointCount (unsigned int num_entry_points)
 
unsigned int getEntryPointCount () const
 
void setRayTypeCount (unsigned int num_ray_types)
 
unsigned int getRayTypeCount () const
 
void setRayGenerationProgram (unsigned int entry_point_index, Program program)
 
Program getRayGenerationProgram (unsigned int entry_point_index) const
 
void setExceptionProgram (unsigned int entry_point_index, Program program)
 
Program getExceptionProgram (unsigned int entry_point_index) const
 
void setExceptionEnabled (RTexception exception, bool enabled)
 
bool getExceptionEnabled (RTexception exception) const
 
void setMissProgram (unsigned int ray_type_index, Program program)
 
Program getMissProgram (unsigned int ray_type_index) const
 
void launch (unsigned int entry_point_index, RTsize image_width)
 
void launch (unsigned int entry_point_index, RTsize image_width, RTsize image_height)
 
void launch (unsigned int entry_point_index, RTsize image_width, RTsize image_height, RTsize image_depth)
 
void launchProgressive (unsigned int entry_point_index, RTsize image_width, RTsize image_height, unsigned int max_subframes)
 
void stopProgressive ()
 
void setPrintEnabled (bool enabled)
 
bool getPrintEnabled () const
 
void setPrintBufferSize (RTsize buffer_size_bytes)
 
RTsize getPrintBufferSize () const
 
void setPrintLaunchIndex (int x, int y=-1, int z=-1)
 
optix::int3 getPrintLaunchIndex () const
 
Variable declareVariable (const std::string &name)
 
Variable queryVariable (const std::string &name) const
 
void removeVariable (Variable v)
 
unsigned int getVariableCount () const
 
Variable getVariable (unsigned int index) const
 
- Public Member Functions inherited from optix::APIObj
void addReference ()
 
int removeReference ()
 
virtual void checkError (RTresult code, Context context) const
 
void checkErrorNoGetContext (RTresult code) const
 

Static Public Member Functions

static unsigned int getDeviceCount ()
 
static std::string getDeviceName (int ordinal)
 
static void getDeviceAttribute (int ordinal, RTdeviceattribute attrib, RTsize size, void *p)
 
static Context create ()
 
- Static Public Member Functions inherited from optix::APIObj
static Exception makeException (RTresult code, RTcontext context)
 

Friends

class Handle< ContextObj >
 

Member Function Documentation

void optix::ContextObj::checkError ( RTresult  code) const
inlinevirtual

See APIObj::checkError

Reimplemented from optix::APIObj.

Buffer optix::ContextObj::create1DLayeredBuffer ( unsigned int  type,
RTformat  format,
RTsize  width,
RTsize  layers,
unsigned int  levels 
)
inline

Create a 1D layered mipmapped buffer with given RTbuffertype, RTformat and dimension. See rtBufferCreate, rtBufferSetFormat, rtBufferSetMipLevelCount, and rtBufferSetSize3D.

Buffer optix::ContextObj::create2DLayeredBuffer ( unsigned int  type,
RTformat  format,
RTsize  width,
RTsize  height,
RTsize  layers,
unsigned int  levels 
)
inline

Create a 2D layered mipmapped buffer with given RTbuffertype, RTformat and dimension. See rtBufferCreate, rtBufferSetFormat, rtBufferSetMipLevelCount, and rtBufferSetSize3D.

Acceleration optix::ContextObj::createAcceleration ( const char *  builder,
const char *  traverser 
)
inline
Buffer optix::ContextObj::createBuffer ( unsigned int  type,
RTformat  format,
RTsize  width 
)
inline

Create a buffer with given RTbuffertype, RTformat and dimension. See rtBufferCreate, rtBufferSetFormat and rtBufferSetSize1D.

Buffer optix::ContextObj::createBuffer ( unsigned int  type,
RTformat  format,
RTsize  width,
RTsize  height 
)
inline

Create a buffer with given RTbuffertype, RTformat and dimension. See rtBufferCreate, rtBufferSetFormat and rtBufferSetSize2D.

Buffer optix::ContextObj::createBuffer ( unsigned int  type,
RTformat  format,
RTsize  width,
RTsize  height,
RTsize  depth 
)
inline

Create a buffer with given RTbuffertype, RTformat and dimension. See rtBufferCreate, rtBufferSetFormat and rtBufferSetSize3D.

Buffer optix::ContextObj::createBufferForCUDA ( unsigned int  type,
RTformat  format,
RTsize  width 
)
inline

Create a buffer for CUDA with given RTbuffertype, RTformat and dimension. See rtBufferCreate, rtBufferSetFormat and rtBufferSetSize1D.

Buffer optix::ContextObj::createBufferForCUDA ( unsigned int  type,
RTformat  format,
RTsize  width,
RTsize  height 
)
inline

Create a buffer for CUDA with given RTbuffertype, RTformat and dimension. See rtBufferCreate, rtBufferSetFormat and rtBufferSetSize2D.

Buffer optix::ContextObj::createBufferForCUDA ( unsigned int  type,
RTformat  format,
RTsize  width,
RTsize  height,
RTsize  depth 
)
inline

Create a buffer for CUDA with given RTbuffertype, RTformat and dimension. See rtBufferCreate, rtBufferSetFormat and rtBufferSetSize3D.

Buffer optix::ContextObj::createCubeBuffer ( unsigned int  type,
RTformat  format,
RTsize  width,
RTsize  height,
unsigned int  levels 
)
inline

Create a cube mipmapped buffer with given RTbuffertype, RTformat and dimension. See rtBufferCreate, rtBufferSetFormat, rtBufferSetMipLevelCount, and rtBufferSetSize3D.

Buffer optix::ContextObj::createCubeLayeredBuffer ( unsigned int  type,
RTformat  format,
RTsize  width,
RTsize  height,
RTsize  faces,
unsigned int  levels 
)
inline

Create a cube layered mipmapped buffer with given RTbuffertype, RTformat and dimension. See rtBufferCreate, rtBufferSetFormat, rtBufferSetMipLevelCount, and rtBufferSetSize3D.

template<class Iterator >
GeometryGroup optix::ContextObj::createGeometryGroup ( Iterator  childbegin,
Iterator  childend 
)
inline

Create a GeometryGroup with a set of child nodes. See rtGeometryGroupCreate, rtGeometryGroupSetChildCount and rtGeometryGroupSetChild

template<class Iterator >
GeometryInstance optix::ContextObj::createGeometryInstance ( Geometry  geometry,
Iterator  matlbegin,
Iterator  matlend 
)

Create a geometry instance with a Geometry object and a set of associated materials. See rtGeometryInstanceCreate, rtGeometryInstanceSetMaterialCount, and rtGeometryInstanceSetMaterial

template<class Iterator >
Group optix::ContextObj::createGroup ( Iterator  childbegin,
Iterator  childend 
)
inline

Create a Group with a set of child nodes. See rtGroupCreate, rtGroupSetChildCount and rtGroupSetChild

Buffer optix::ContextObj::createMipmappedBuffer ( unsigned int  type,
RTformat  format,
RTsize  width,
unsigned int  levels 
)
inline

Create a mipmapped buffer with given RTbuffertype, RTformat and dimension. See rtBufferCreate, rtBufferSetFormat and rtBufferSetSize1DMipmapped.

Buffer optix::ContextObj::createMipmappedBuffer ( unsigned int  type,
RTformat  format,
RTsize  width,
RTsize  height,
unsigned int  levels 
)
inline

Create a mipmapped buffer with given RTbuffertype, RTformat and dimension. See rtBufferCreate, rtBufferSetFormat and rtBufferSetSize2DMipmapped.

Buffer optix::ContextObj::createMipmappedBuffer ( unsigned int  type,
RTformat  format,
RTsize  width,
RTsize  height,
RTsize  depth,
unsigned int  levels 
)
inline

Create a mipmapped buffer with given RTbuffertype, RTformat and dimension. See rtBufferCreate, rtBufferSetFormat and rtBufferSetSize3DMipmapped.

Variable optix::ContextObj::declareVariable ( const std::string &  name)
inlinevirtual

Declare a variable associated with this object. See rt[ObjectType]DeclareVariable. Note that this function is wrapped by the convenience function Handle::operator[].

Implements optix::ScopedObj.

Buffer optix::ContextObj::getBufferFromId ( int  buffer_id)
inline

Queries the Buffer object from a given buffer id obtained from a previous call to BufferObj::getId. See BufferObj::getId and rtContextGetBufferFromId.

Context optix::ContextObj::getContext ( ) const
inlinevirtual

Retrieve the Context object associated with this APIObject. In this case, simply returns itself.

Implements optix::APIObj.

unsigned int optix::ContextObj::getEnabledDeviceCount ( ) const
inline

See rtContextGetDeviceCount. As opposed to getDeviceCount, this returns only the number of enabled devices.

int optix::ContextObj::getMaxTextureCount ( ) const
inline
Program optix::ContextObj::getProgramFromId ( int  program_id)
inline

Queries the Program object from a given program id obtained from a previous call to ProgramObj::getId. See ProgramObj::getId and rtContextGetProgramFromId.

TextureSampler optix::ContextObj::getTextureSamplerFromId ( int  sampler_id)
inline

Queries the TextureSampler object from a given sampler id obtained from a previous call to TextureSamplerObj::getId. See TextureSamplerObj::getId and rtContextGetTextureSamplerFromId.

unsigned int optix::ContextObj::getVariableCount ( ) const
inlinevirtual

Query the number of variables associated with this object. Used along with ScopedObj::getVariable to iterate over variables in an object. See rt[ObjectType]GetVariableCount

Implements optix::ScopedObj.

void optix::ContextObj::launch ( unsigned int  entry_point_index,
RTsize  image_width 
)
inline

See rtContextLaunch

void optix::ContextObj::launchProgressive ( unsigned int  entry_point_index,
RTsize  image_width,
RTsize  image_height,
unsigned int  max_subframes 
)
inline
Variable optix::ContextObj::queryVariable ( const std::string &  name) const
inlinevirtual

Query a variable associated with this object by name. See rt[ObjectType]QueryVariable. Note that this function is wrapped by the convenience function Handle::operator[].

Implements optix::ScopedObj.

void optix::ContextObj::setCPUNumThreads ( int  cpu_num_threads)
inline
template<class Iterator >
void optix::ContextObj::setDevices ( Iterator  begin,
Iterator  end 
)
inline
void optix::ContextObj::setPrintEnabled ( bool  enabled)
inline
void optix::ContextObj::setRayGenerationProgram ( unsigned int  entry_point_index,
Program  program 
)
inline
void optix::ContextObj::setStackSize ( RTsize  stack_size_bytes)
inline
void optix::ContextObj::setTimeoutCallback ( RTtimeoutcallback  callback,
double  min_polling_seconds 
)
inline

See rtContextSetTimeoutCallback RTtimeoutcallback is defined as typedef int (*RTtimeoutcallback)(void).