OWL
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
owl::Context Struct Reference

#include <Context.h>

Inheritance diagram for owl::Context:
owl::Object owl::APIContext

Public Types

typedef std::shared_ptr< ContextSP
 
- Public Types inherited from owl::Object
typedef std::shared_ptr< ObjectSP
 

Public Member Functions

virtual std::string toString () const override
 
 Context (int32_t *requestedDeviceIDs, int numRequestedDevices)
 
virtual ~Context ()
 
size_t deviceCount () const
 
const std::vector< DeviceContext::SP > & getDevices () const
 
DeviceContext::SP getDevice (int ID) const
 
void buildHitGroupRecordsOn (const DeviceContext::SP &device)
 
void buildRayGenRecordsOn (const DeviceContext::SP &device)
 
void buildMissProgRecordsOn (const DeviceContext::SP &device)
 
void setRayTypeCount (size_t rayTypeCount)
 
void setBoundLaunchParamValues (const std::vector< OWLBoundValueDecl > &boundValues)
 
void enableMotionBlur ()
 
void enableCurves ()
 
void enableSpheres ()
 
void disablePerGeometrySBTRecords ()
 
void setMaxInstancingDepth (int32_t maxInstanceDepth)
 
void setNumAttributeValues (size_t numAttributeValues)
 
void setNumPayloadValues (size_t numPayloadValues)
 
void buildSBT (OWLBuildSBTFlags flags)
 
void buildPipeline ()
 
void buildPrograms (bool debug=false)
 
void destroyPrograms ()
 
void buildModules (bool debug=false)
 
void destroyModules ()
 
Texture::SP texture2DCreate (OWLTexelFormat texelFormat, OWLTextureFilterMode filterMode, OWLTextureAddressMode addressMode, OWLTextureColorSpace colorSpace, const vec2i size, uint32_t linePitchInBytes, const void *texels)
 
GeomGroup::SP trianglesGeomGroupCreate (size_t numChildren, unsigned int buildFlags)
 
GeomGroup::SP curvesGeomGroupCreate (size_t numChildren, unsigned int buildFlags)
 
GeomGroup::SP userGeomGroupCreate (size_t numChildren, unsigned int buildFlags)
 
GeomGroup::SP sphereGeomGroupCreate (size_t numChildren, unsigned int buildFlags)
 
Buffer::SP deviceBufferCreate (OWLDataType type, size_t count, const void *init)
 
Buffer::SP hostPinnedBufferCreate (OWLDataType type, size_t count)
 
Buffer::SP managedMemoryBufferCreate (OWLDataType type, size_t count, const void *init)
 
Buffer::SP graphicsBufferCreate (OWLDataType type, size_t count, cudaGraphicsResource_t resource)
 
RayGenType::SP createRayGenType (Module::SP module, const std::string &progName, size_t varStructSize, const std::vector< OWLVarDecl > &varDecls)
 
RayGen::SP createRayGen (const std::shared_ptr< RayGenType > &type)
 
LaunchParamsType::SP createLaunchParamsType (size_t varStructSize, const std::vector< OWLVarDecl > &varDecls)
 
LaunchParams::SP createLaunchParams (const std::shared_ptr< LaunchParamsType > &type)
 
MissProgType::SP createMissProgType (Module::SP module, const std::string &progName, size_t varStructSize, const std::vector< OWLVarDecl > &varDecls)
 
MissProg::SP createMissProg (const std::shared_ptr< MissProgType > &type)
 
void setMissProg (int rayTypeToSet, MissProg::SP missProgToUse)
 
GeomType::SP createGeomType (OWLGeomKind kind, size_t varStructSize, const std::vector< OWLVarDecl > &varDecls)
 
Module::SP createModule (const std::string &ptxCode)
 
Module::SP createModule (const std::vector< uint8_t > &IR)
 
- Public Member Functions inherited from owl::Object
 Object ()
 
virtual std::string toString () const
 
virtual DeviceData::SP createOn (const std::shared_ptr< DeviceContext > &device)
 
void createDeviceData (const std::vector< std::shared_ptr< DeviceContext > > &devices)
 
template<typename T >
std::shared_ptr< T > as ()
 

Static Public Member Functions

static bool logging ()
 

Public Attributes

RangeAllocator sbtRangeAllocator
 
std::vector< MissProg::SP > missProgPerRayType
 
int maxInstancingDepth = 1
 
bool perGeometrySBTRecordsDisabled = false
 
int numRayTypes { 1 }
 
bool motionBlurEnabled = false
 
bool curvesEnabled = false
 
bool spheresEnabled = false
 
int numAttributeValues = 2
 
int numPayloadValues = 2
 
LaunchParams::SP dummyLaunchParams
 
ObjectRegistryT< Bufferbuffers
 
ObjectRegistryT< Texturetextures
 
ObjectRegistryT< Groupgroups
 
ObjectRegistryT< RayGenTyperayGenTypes
 
ObjectRegistryT< RayGenrayGens
 
ObjectRegistryT< MissProgTypemissProgTypes
 
ObjectRegistryT< MissProgmissProgs
 
ObjectRegistryT< GeomTypegeomTypes
 
ObjectRegistryT< Geomgeoms
 
ObjectRegistryT< Modulemodules
 
ObjectRegistryT< LaunchParamsTypelaunchParamTypes
 
ObjectRegistryT< LaunchParamslaunchParams
 
- Public Attributes inherited from owl::Object
const size_t uniqueID
 
std::vector< DeviceData::SP > deviceData
 

Additional Inherited Members

- Static Public Attributes inherited from owl::Object
static std::atomic< uint64_t > nextAvailableID
 

Detailed Description

the root 'context' that spans, and manages, all objects and all devices

Constructor & Destructor Documentation

◆ Context()

owl::Context::Context ( int32_t *  requestedDeviceIDs,
int  numRequestedDevices 
)

creates a context with the given device IDs. If list of device is nullptr, and number requested devices is > 1, then the first N devices will get used; invalid device IDs in the list will automatically get dropped

◆ ~Context()

owl::Context::~Context ( )
virtual

virtual destructor to cleanly wind down upon exit

Member Function Documentation

◆ buildHitGroupRecordsOn()

void owl::Context::buildHitGroupRecordsOn ( const DeviceContext::SP &  device)

part of the SBT creation - builds the hit group array

◆ buildMissProgRecordsOn()

void owl::Context::buildMissProgRecordsOn ( const DeviceContext::SP &  device)

part of the SBT creation - builds the miss group array

◆ buildRayGenRecordsOn()

void owl::Context::buildRayGenRecordsOn ( const DeviceContext::SP &  device)

part of the SBT creation - builds the raygen array

◆ createGeomType()

GeomType::SP owl::Context::createGeomType ( OWLGeomKind  kind,
size_t  varStructSize,
const std::vector< OWLVarDecl > &  varDecls 
)

creates new geometry type defitiion with given variable declarations

◆ createLaunchParams()

LaunchParams::SP owl::Context::createLaunchParams ( const std::shared_ptr< LaunchParamsType > &  type)

create new instance of a set of launch params of given type

◆ createLaunchParamsType()

LaunchParamsType::SP owl::Context::createLaunchParamsType ( size_t  varStructSize,
const std::vector< OWLVarDecl > &  varDecls 
)

create a new launch param type descriptor with given variables; this can then be used to create actual launch param instances (

See also
createLaunchParams)

◆ createMissProg()

MissProg::SP owl::Context::createMissProg ( const std::shared_ptr< MissProgType > &  type)

create new instance of a miss program of given type

◆ createMissProgType()

MissProgType::SP owl::Context::createMissProgType ( Module::SP  module,
const std::string &  progName,
size_t  varStructSize,
const std::vector< OWLVarDecl > &  varDecls 
)

creates new miss program type with given program name (in given module), and the given variable declarations that describe this type's variables

◆ createModule() [1/2]

Module::SP owl::Context::createModule ( const std::string &  ptxCode)

creates new module with given precompiled PTX code

◆ createModule() [2/2]

Module::SP owl::Context::createModule ( const std::vector< uint8_t > &  IR)

creates new module with given precompiled OptiX IR code

◆ createRayGen()

RayGen::SP owl::Context::createRayGen ( const std::shared_ptr< RayGenType > &  type)

create new instance of a ray gen program of given type

◆ createRayGenType()

RayGenType::SP owl::Context::createRayGenType ( Module::SP  module,
const std::string &  progName,
size_t  varStructSize,
const std::vector< OWLVarDecl > &  varDecls 
)

creates new ray gen program type with given program name (in given module), and the given variable declarations that describe this type's variables

◆ curvesGeomGroupCreate()

GeomGroup::SP owl::Context::curvesGeomGroupCreate ( size_t  numChildren,
unsigned int  buildFlags 
)

create a new curves geometry group that will eventually create a BVH over all the curve segments across all its child geometries. only CurvesGeoms can be added to this group. These curves geoms can all have different types, different programs, etc, but must all be of "OWL_CURVES" kind

◆ destroyModules()

void owl::Context::destroyModules ( )

clearly destroy optix handles of all active modules

◆ destroyPrograms()

void owl::Context::destroyPrograms ( )

clearly destroy pptix handles of all active programs

◆ deviceBufferCreate()

Buffer::SP owl::Context::deviceBufferCreate ( OWLDataType  type,
size_t  count,
const void *  init 
)

create a new device buffer of given data type and count; if init is non-null it will be used to populoate this buffer. Note that for certain non-trivial types (OWLTexture, OWLGroup, etc) you may have to specify the content upon creation

◆ disablePerGeometrySBTRecords()

void owl::Context::disablePerGeometrySBTRecords ( )

disables the geometry's contribution to hit record generation. If set, we assume that the first geometry's record is representative of all geometry in an owl group.

◆ enableCurves()

void owl::Context::enableCurves ( )

enables support for curves; has to be called before creating any curves geometries get created, and before the pipeline gets built, whichever comes first

◆ enableMotionBlur()

void owl::Context::enableMotionBlur ( )

enables motion blur - should be done right after context creation, and before SBT and pipeline get built

◆ enableSpheres()

void owl::Context::enableSpheres ( )

enables support for spheres; has to be called before creating any curves geometries get created, and before the pipeline gets built, whichever comes first

◆ graphicsBufferCreate()

Buffer::SP owl::Context::graphicsBufferCreate ( OWLDataType  type,
size_t  count,
cudaGraphicsResource_t  resource 
)

creates a buffer that wraps a CUDA graphics resource that can be, for instance, an OpenGL texture

◆ hostPinnedBufferCreate()

Buffer::SP owl::Context::hostPinnedBufferCreate ( OWLDataType  type,
size_t  count 
)

creates a buffer that uses CUDA host pinned memory; that memory is pinned on the host and accessive to all devices in the device group

◆ logging()

static bool owl::Context::logging ( )
inlinestatic

returns whether logging is enabled

◆ managedMemoryBufferCreate()

Buffer::SP owl::Context::managedMemoryBufferCreate ( OWLDataType  type,
size_t  count,
const void *  init 
)

creates a buffer that uses CUDA managed memory; that memory is managed by CUDA (see CUDAs documentation on managed memory) and accessive to all devices in the deviec group

creates a buffer that uses CUDA managed memory; that memory is managed by CUDA (see CUDAs documentatoin on managed memory) and accessive to all devices in the deviec group

◆ setMaxInstancingDepth()

void owl::Context::setMaxInstancingDepth ( int32_t  maxInstanceDepth)

sets maximum instancing depth for the given context:

'0' means 'no instancing allowed, only bottom-level accels;

'1' means 'at most one layer of instances' (ie, a two-level scene), where the 'root' world rays are traced against can be an instance group, but every child in that inscne group is a geometry group.

'N>1" means "up to N layers of instances are allowed.

The default instancing depth is 1 (ie, a two-level scene), since this allows for most use cases of instancing and is still hardware-accelerated. Using a node graph with instancing deeper than the configured value will result in wrong results; but be aware that using any value > 1 here will come with a cost. It is recommended to, if at all possible, leave this value to one and convert the input scene to a two-level scene layout (ie, with only one level of instances)

◆ setMissProg()

void owl::Context::setMissProg ( int  rayTypeToSet,
MissProg::SP  missProgToUse 
)

sets miss prog to use for a given ray type

◆ setRayTypeCount()

void owl::Context::setRayTypeCount ( size_t  rayTypeCount)

sets number of ray types to be used - should be done right after context creation, and before SBT and pipeline get built

◆ sphereGeomGroupCreate()

GeomGroup::SP owl::Context::sphereGeomGroupCreate ( size_t  numChildren,
unsigned int  buildFlags 
)

create a new user geometry group that will eventually create a BVH over all the sphere geoms in all its child geometries. only SphereGeom's can be added to this group. These user geoms can all have different types, different programs, etc, but must all be of "OWL_GEOMETRY_USER" kind

◆ texture2DCreate()

Texture::SP owl::Context::texture2DCreate ( OWLTexelFormat  texelFormat,
OWLTextureFilterMode  filterMode,
OWLTextureAddressMode  addressMode,
OWLTextureColorSpace  colorSpace,
const vec2i  size,
uint32_t  linePitchInBytes,
const void *  texels 
)

creates a 2D texture object with given parameters; this will internally be mapped to a cuda texture object, and uploaded as such to the device

◆ toString()

virtual std::string owl::Context::toString ( ) const
inlineoverridevirtual

pretty-printer, for printf-debugging

Reimplemented from owl::Object.

Reimplemented in owl::APIContext.

◆ trianglesGeomGroupCreate()

GeomGroup::SP owl::Context::trianglesGeomGroupCreate ( size_t  numChildren,
unsigned int  buildFlags 
)

create a new triangles geometry group that will eventually create a BVH over all the trianlges across all its child geometries. only TrianglesGeoms can be added to this group. These triangle geoms can all have different types, different programs, etc, but must all be of "OWL_TRIANGLES" kind

◆ userGeomGroupCreate()

GeomGroup::SP owl::Context::userGeomGroupCreate ( size_t  numChildren,
unsigned int  buildFlags 
)

create a new user geometry group that will eventually create a BVH over all the user geoms / custom prims in all its child geometries. only UserGeom's can be added to this group. These user geoms can all have different types, different programs, etc, but must all be of "OWL_GEOMETRY_USER" kind

Member Data Documentation

◆ buffers

ObjectRegistryT<Buffer> owl::Context::buffers

registries for all the different object types within this context. allows for keeping track what's alive, and what has to be compiled, put into SBTs, etc

◆ curvesEnabled

bool owl::Context::curvesEnabled = false

by default support for curves is off, as it costs performacne - set via owlEnableCurves()

◆ dummyLaunchParams

LaunchParams::SP owl::Context::dummyLaunchParams

a set of dummy (ie, empty) launch params. allows us for always using the same launch code, with launch params, even if th user didn't specify any during launch

◆ maxInstancingDepth

int owl::Context::maxInstancingDepth = 1

maximum depth instancing tree as specified by setMaxInstancingDepth

◆ missProgPerRayType

std::vector<MissProg::SP> owl::Context::missProgPerRayType

one miss prog per ray type

◆ motionBlurEnabled

bool owl::Context::motionBlurEnabled = false

by default motion blur is off, as it costs performacne - set via owlEnableMotionBlur()

◆ numRayTypes

int owl::Context::numRayTypes { 1 }

number of ray types - change via setRayTypeCount()

◆ perGeometrySBTRecordsDisabled

bool owl::Context::perGeometrySBTRecordsDisabled = false

Whether or not to let the geometry change the SBT record. If false, only the first hit given hit record will be used. Useful for scenarios like realtime instance manipulation over many instances where creating a record per geometry isn't practical.

◆ sbtRangeAllocator

RangeAllocator owl::Context::sbtRangeAllocator

tracks which ID regions in the SBT have already been used - newly created groups allocate ranges of IDs in the SBT (to allow its geometries to be in successive SBT regions), and this struct keeps track of whats already used, and what is available

◆ spheresEnabled

bool owl::Context::spheresEnabled = false

by default support for spheres is off, as it costs performacne - set via owlEnableCurves()


The documentation for this struct was generated from the following files: