OWL
|
#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 | |
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< 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 |
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
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::buildRayGenRecordsOn | ( | const DeviceContext::SP & | device | ) |
part of the SBT creation - builds the raygen array
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
Module::SP owl::Context::createModule | ( | const std::vector< uint8_t > & | IR | ) |
creates new module with given precompiled OptiX IR 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
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
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
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.
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
void owl::Context::enableMotionBlur | ( | ) |
enables motion blur - should be done right after context creation, and before SBT and pipeline get built
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
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
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
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
|
inlineoverridevirtual |
pretty-printer, for printf-debugging
Reimplemented from owl::Object.
Reimplemented in owl::APIContext.
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
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
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
bool owl::Context::curvesEnabled = false |
by default support for curves is off, as it costs performacne - set via owlEnableCurves()
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
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
bool owl::Context::motionBlurEnabled = false |
by default motion blur is off, as it costs performacne - set via owlEnableMotionBlur()
int owl::Context::numRayTypes { 1 } |
number of ray types - change via setRayTypeCount()
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.
RangeAllocator owl::Context::sbtRangeAllocator |
bool owl::Context::spheresEnabled = false |
by default support for spheres is off, as it costs performacne - set via owlEnableCurves()