|
OWL
OptiX7 Wrapper Library
|
#include <Context.h>
Public Types | |
| typedef std::shared_ptr< Context > | SP |
Public Types inherited from owl::Object | |
| typedef std::shared_ptr< Object > | SP |
Public Member Functions | |
| 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 | enableMotionBlur () |
| void | setMaxInstancingDepth (int32_t maxInstanceDepth) |
| void | buildSBT (OWLBuildSBTFlags flags) |
| void | buildPipeline () |
| void | buildPrograms () |
| void | destroyPrograms () |
| void | buildModules () |
| void | destroyModules () |
| Texture::SP | texture2DCreate (OWLTexelFormat texelFormat, OWLTextureFilterMode filterMode, OWLTextureAddressMode addressMode, const vec2i size, uint32_t linePitchInBytes, const void *texels) |
| GeomGroup::SP | trianglesGeomGroupCreate (size_t numChildren) |
| GeomGroup::SP | userGeomGroupCreate (size_t numChildren) |
| 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) |
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 |
| int | numRayTypes { 1 } |
| bool | motionBlurEnabled = false |
| LaunchParams::SP | dummyLaunchParams |
| ObjectRegistryT< Buffer > | buffers |
| ObjectRegistryT< Texture > | textures |
| ObjectRegistryT< Group > | groups |
| ObjectRegistryT< RayGenType > | rayGenTypes |
| ObjectRegistryT< RayGen > | rayGens |
| ObjectRegistryT< MissProgType > | missProgTypes |
| ObjectRegistryT< MissProg > | missProgs |
| ObjectRegistryT< GeomType > | geomTypes |
| ObjectRegistryT< Geom > | geoms |
| ObjectRegistryT< Module > | modules |
| ObjectRegistryT< LaunchParamsType > | launchParamTypes |
| ObjectRegistryT< LaunchParams > | launchParams |
Public Attributes inherited from owl::Object | |
| const size_t | uniqueID |
| std::vector< DeviceData::SP > | deviceData |
Private Member Functions | |
| void | enablePeerAccess () |
Private Attributes | |
| std::vector< DeviceContext::SP > | devices |
Additional Inherited Members | |
Static Public Attributes inherited from owl::Object | |
| static std::atomic< uint64_t > | nextAvailableID |
the root 'context' that spans, and manages, all objects and all devices
| typedef std::shared_ptr<Context> owl::Context::SP |
| 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
|
virtual |
virtual destructor to cleanly wind down upon exit
| void owl::Context::buildHitGroupRecordsOn | ( | const DeviceContext::SP & | device | ) |
part of the SBT creation - builds the hit group array
| void owl::Context::buildMissProgRecordsOn | ( | const DeviceContext::SP & | device | ) |
part of the SBT creation - builds the miss group array
| void owl::Context::buildModules | ( | ) |
| void owl::Context::buildPipeline | ( | ) |
| void owl::Context::buildPrograms | ( | ) |
| void owl::Context::buildRayGenRecordsOn | ( | const DeviceContext::SP & | device | ) |
part of the SBT creation - builds the raygen array
| void owl::Context::buildSBT | ( | OWLBuildSBTFlags | flags | ) |
| GeomType::SP owl::Context::createGeomType | ( | OWLGeomKind | kind, |
| size_t | varStructSize, | ||
| const std::vector< OWLVarDecl > & | varDecls | ||
| ) |
creates new geometry type defitiion with given variable declarations
| LaunchParams::SP owl::Context::createLaunchParams | ( | const std::shared_ptr< LaunchParamsType > & | type | ) |
create new instance of a set of launch params of given type
| 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 (
| MissProg::SP owl::Context::createMissProg | ( | const std::shared_ptr< MissProgType > & | type | ) |
create new instance of a miss program of given type
| 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
| Module::SP owl::Context::createModule | ( | const std::string & | ptxCode | ) |
creates new module with given precompiled PTX code
| RayGen::SP owl::Context::createRayGen | ( | const std::shared_ptr< RayGenType > & | type | ) |
create new instance of a ray gen program of given type
| 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
| void owl::Context::destroyModules | ( | ) |
clearly destroy optix handles of all active modules
| void owl::Context::destroyPrograms | ( | ) |
clearly destroy pptix handles of all active programs
| 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
|
inline |
| void owl::Context::enableMotionBlur | ( | ) |
enables motoin blur - should be done right after context creation, and before SBT and pipeline get built
|
private |
|
inline |
|
inline |
| 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
| 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
|
inlinestatic |
returns whether logging is enabled
| 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
| 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)
| void owl::Context::setMissProg | ( | int | rayTypeToSet, |
| MissProg::SP | missProgToUse | ||
| ) |
sets miss prog to use for a given ray type
| 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
| Texture::SP owl::Context::texture2DCreate | ( | OWLTexelFormat | texelFormat, |
| OWLTextureFilterMode | filterMode, | ||
| OWLTextureAddressMode | addressMode, | ||
| 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
| GeomGroup::SP owl::Context::trianglesGeomGroupCreate | ( | size_t | numChildren | ) |
create a new triangles geometry group that will eventually create a BVH over all the trinalges in 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
| GeomGroup::SP owl::Context::userGeomGroupCreate | ( | size_t | numChildren | ) |
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_TRIANGLES" kind
| 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
|
private |
| 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
| ObjectRegistryT<Geom> owl::Context::geoms |
| ObjectRegistryT<GeomType> owl::Context::geomTypes |
| ObjectRegistryT<Group> owl::Context::groups |
| ObjectRegistryT<LaunchParams> owl::Context::launchParams |
| ObjectRegistryT<LaunchParamsType> owl::Context::launchParamTypes |
| int owl::Context::maxInstancingDepth = 1 |
maximum depth instancing tree as specified by setMaxInstancingDepth
| std::vector<MissProg::SP> owl::Context::missProgPerRayType |
one miss prog per ray type
| ObjectRegistryT<MissProg> owl::Context::missProgs |
| ObjectRegistryT<MissProgType> owl::Context::missProgTypes |
| ObjectRegistryT<Module> owl::Context::modules |
| bool owl::Context::motionBlurEnabled = false |
by default motion blur is off, as it costs performacne - set via enableMotimBlur()
| int owl::Context::numRayTypes { 1 } |
number of ray types - change via setRayTypeCount()
| ObjectRegistryT<RayGen> owl::Context::rayGens |
| ObjectRegistryT<RayGenType> owl::Context::rayGenTypes |
| RangeAllocator owl::Context::sbtRangeAllocator |
| ObjectRegistryT<Texture> owl::Context::textures |