|
HDK
|
#include <IMX_VDB.h>
Inheritance diagram for IMX_VDB:Classes | |
| class | Topology |
Public Member Functions | |
| IMX_VDB () | |
| An un-allocated null-VDB, but with default meta data. More... | |
| IMX_VDB (const IMX_VDB &other) | |
| IMX_VDB (IMX_VDB &&other) noexcept | |
| ~IMX_VDB () override | |
| EntryType | poolTypeID () const override |
| void | copy (const IMX_VDB &other) |
| Assignment operators. More... | |
| IMX_VDB & | operator= (const IMX_VDB &other) |
| void | swap (IMX_VDB &other) |
| IMX_VDB & | operator= (IMX_VDB &&other) |
| openvdb::GridBase::Ptr | createVDB () const |
| bool | save (std::ostream &os) const |
| Returns true for successful save. More... | |
| bool | saveJSON (UT_JSONWriter &w) const |
| void | copyMetadataToOptions (UT_Options &opt) const |
| void | updateMetadataFromOptions (const UT_Options &opt) |
| Load ourselves from the options, ignoring fields we don't know. More... | |
| void | copyFromVDB (const openvdb::GridBase &vdb, const UT_Vector3 &voxelsize, const GA_PrimVolumeXform &indexspace, bool ontocpu=true, bool ontogppu=true) |
| void | cpuCopyFromVDB (const openvdb::GridBase &vdb, const UT_Vector3 &voxelsize, const GA_PrimVolumeXform &indexspace) |
| void | gpuCopyFromVDB (const openvdb::GridBase &vdb, const UT_Vector3 &voxelsize, const GA_PrimVolumeXform &indexspace) |
| void | buildFromTopology (UT_VDBType storage, const IMX_VDB *refvdb) |
| CE_VDBGrid * | getGPUBuffer (bool read, bool write) |
| const CE_VDBGrid * | getGPUBufferR () const |
| CE_VDBGrid * | getGPUBufferW () |
| UT_VDBType | storageType () const |
| int | getChannels () const |
| bool | storesIntegers () const |
| void | setTypeInfo (IMX_TypeInfo typeinfo) |
| IMX_TypeInfo | typeInfo () const |
| UT_Vector3 | voxelSize () const |
| UT_Vector3 | origin () const |
| GA_PrimVolumeXform | indexSpace () const |
| bool | isAligned (const IMX_VDB *vdb) const |
| True if the two vdbs map the same indices to the same positions. More... | |
| void | transform (const UT_Matrix4D &m) |
| void | adoptGrid (UT_UniquePtr< CE_VDBGrid > grid, cl::Buffer tilestarts, exint leafcount, exint lowercount, exint uppercount, const UT_Vector3 &voxelsize, const GA_PrimVolumeXform &indexspace) |
| UT_SharedPtr< CE_BufferHostByte > | getCPUBufferR () const |
| CE_BufferHostByte * | getCPUBufferRW () |
| void | setFromRawNanoVDB (const void *data, exint size) |
| bool | isOnGPU () const |
| Returns true if this vdb's data is currently on the GPU. More... | |
| bool | isOnCPU () const |
| bool | stealable () const |
| void | setStealable (bool v) const |
| bool | hasTopology () const |
| exint | leafCount () const |
| exint | lowerCount () const |
| exint | upperCount () const |
| void | voxelBounds (UT_Vector3i &lower, UT_Vector3i &upper) const |
| void | buildTopology (const openvdb::GridBase &grid) |
| void | buildTopologyFromCPU (bool denseleaves) |
| Build topology from our own cpu buffer. More... | |
| cl::Buffer | getGPUTileStarts (exint &tilecount) const |
| Return a gpu version. More... | |
| UT_SharedPtr< UT_Array < UT_Vector3i > > | getCPUTileStarts () const |
| bool | denseLeaves () const |
| void | setDenseLeaves (bool dense) |
| void | setConstantV3 (UT_Vector3 v) |
| NOTE: These only set leaf values. More... | |
| void | setConstantF (fpreal32 f=0.0f) |
| void | setConstantI (int32 i=0) |
| bool | isDirty () const |
| True if there are no VDB grids on GPU or CPU. More... | |
| void | setDirty () |
| Flag all grids as dirty without freeing them. More... | |
| void | freeBuffers () |
| Frees all buffers and marks dirty. More... | |
| void | destroy () |
| Frees all the memory. More... | |
| bool | allocated () const |
| int64 | getMemoryUsage () const |
| int64 | getDeviceMemoryUsage () const |
| void | setProperties (const UT_OptionsHolder &props) |
| UT_OptionsHolder | properties () const |
| template<typename OP > | |
| void | updateProperties (const OP &op) |
| fpreal64 | computeMin (int channel=0) const |
| fpreal64 | computeMax (int channel=0) const |
| fpreal64 | computeAverage (int channel=0) const |
| fpreal64 | computeMinLength () const |
| fpreal64 | computeMaxLength () const |
Public Member Functions inherited from CE_HotSwapPoolEntry | |
| CE_HotSwapPoolEntry () | |
| Creates a new buffer. You must call setSize to make this buffer usable. More... | |
| virtual | ~CE_HotSwapPoolEntry () |
| CE_HotSwapPoolEntry (const CE_HotSwapPoolEntry &)=delete | |
| CE_HotSwapPoolEntry & | operator= (const CE_HotSwapPoolEntry &)=delete |
| bool | isInUseGPU () const |
| void | setInUseGPUFlag () const |
| void | clearInUseGPUFlag () const |
Static Public Member Functions | |
| static IMX_VDBPtr | load (UT_IStream &is) |
| static IMX_VDBPtr | loadJSON (UT_JSONParser &p) |
| static const char * | cnanovdbStorageDefine (UT_VDBType storagetype) |
| static int | registerVDB (IMX_VDBConstPtr vdb, UT_IntArray ®istered) |
| static void | unregisterVDBs (UT_IntArray ®istered) |
| static IMX_VDBConstPtr | lookupVDB (int handle) |
| Look up a registered vdb by handle. More... | |
Protected Member Functions | |
| void | poolResetGPUBuffer () override |
| void | poolSetOnGPU (bool ongpu) override |
| Update OnGPU. More... | |
| bool | poolIsGPUBufferEmpty () const override |
| True if the gpu buffer is null. More... | |
| bool | poolIsGPUBufferValid () const override |
| True if the gpu buffer is not null and valid. More... | |
| bool | poolSwapGPUBuffer (CE_HotSwapPoolEntry *otherbase) override |
| True if the swap does something. More... | |
| void | poolShallowCopyGPUBuffer (const CE_HotSwapPoolEntry *srcbase) override |
| Shallow copy. More... | |
| void | unloadFromGPU () override |
| UT_SharedPtr< CE_BufferHostByte > | getCPUBufferRInternal () |
Protected Attributes | |
| UT_SharedPtr< CE_BufferHostByte > | myCPUBuffer |
| UT_SharedPtr< Topology > | myTopology |
| UT_Vector3 | myVoxelSize |
| GA_PrimVolumeXform | myIndexSpace |
| UT_SharedPtr< CE_VDBGrid > | myGPUBuffer |
| UT_OptionsHolder | myProperties |
| IMX_TypeInfo | myTypeInfo = IMX_TypeInfo::IMX_NONE |
| UT_VDBType | myStorageType = UT_VDB_INVALID |
| bool | myOnCPU = false |
| bool | myOnGPU = false |
| bool | myStealable = true |
Friends | |
| IMX_API size_t | UTformatBuffer (char *buffer, size_t buffer_size, const IMX_VDB &v) |
Additional Inherited Members | |
Public Types inherited from CE_HotSwapPoolEntry | |
| enum | EntryType { EntryType::BUFFER = 0, EntryType::VDB, EntryType::ATTRIBUTE } |
| To avoid the need for dynamic casts: More... | |
| IMX_VDB::IMX_VDB | ( | ) |
An un-allocated null-VDB, but with default meta data.
|
override |
| void IMX_VDB::adoptGrid | ( | UT_UniquePtr< CE_VDBGrid > | grid, |
| cl::Buffer | tilestarts, | ||
| exint | leafcount, | ||
| exint | lowercount, | ||
| exint | uppercount, | ||
| const UT_Vector3 & | voxelsize, | ||
| const GA_PrimVolumeXform & | indexspace | ||
| ) |
Sets the underlying GPU buffer to provided grid, taking ownership of it.
|
inline |
| void IMX_VDB::buildFromTopology | ( | UT_VDBType | storage, |
| const IMX_VDB * | refvdb | ||
| ) |
Replaces self with a vdb using the provided source's topology. If same type this is just a copy(). Otherewise it is zeroed. Copies transform & metadata options.
| void IMX_VDB::buildTopology | ( | const openvdb::GridBase & | grid | ) |
Build topology from provided grid. These are built onto the GPU & CPU. This could be delayed since we share the topology pointer so would only upload once.
| void IMX_VDB::buildTopologyFromCPU | ( | bool | denseleaves | ) |
Build topology from our own cpu buffer.
|
static |
| fpreal64 IMX_VDB::computeMaxLength | ( | ) | const |
Compute useful aggregate properties of the layer. For integer vdb, use computeMinI() and computeMaxI().
| fpreal64 IMX_VDB::computeMinLength | ( | ) | const |
| void IMX_VDB::copyFromVDB | ( | const openvdb::GridBase & | vdb, |
| const UT_Vector3 & | voxelsize, | ||
| const GA_PrimVolumeXform & | indexspace, | ||
| bool | ontocpu = true, |
||
| bool | ontogppu = true |
||
| ) |
Copies a VDB into ourselves, creating both CPU and GPU buffers by default. Can throw CE exceptions.
| void IMX_VDB::copyMetadataToOptions | ( | UT_Options & | opt | ) | const |
Write our fields into the provided options: THis does not include properties.
|
inline |
| openvdb::GridBase::Ptr IMX_VDB::createVDB | ( | ) | const |
Conversion to/from openvdb. Can throw CE exceptions.
|
inline |
| void IMX_VDB::destroy | ( | ) |
Frees all the memory.
| void IMX_VDB::freeBuffers | ( | ) |
Frees all buffers and marks dirty.
| int IMX_VDB::getChannels | ( | ) | const |
| UT_SharedPtr<CE_BufferHostByte> IMX_VDB::getCPUBufferR | ( | ) | const |
If onCPU, returns a shared pointer to the cpu buffer If onGPU, copy to CPU and return the shared pointer, keeping GPU copy. If dirty, return null. Can throw CE exceptions.
|
protected |
| CE_BufferHostByte* IMX_VDB::getCPUBufferRW | ( | ) |
If onCPU, ensure unique and return the raw pointer that is our own buffer. If onGPU, copies to the CPU and returns that, resetting onGPU to false If dirty, return null.
|
inline |
| int64 IMX_VDB::getDeviceMemoryUsage | ( | ) | const |
| CE_VDBGrid* IMX_VDB::getGPUBuffer | ( | bool | read, |
| bool | write | ||
| ) |
Returns this vdb's GPU storage object. If read is true, isDirty must be false. If write is true then it turns off isDirty by setting isOnGPU() and turning off isOnCPU() (it is assuming caller will actually write the buffer) When using one of these methods, this buffer must be guarded with the in-use GPU flag. See setInUseGPUFlag() documentation for more information. Can throw CE exceptions.
| const CE_VDBGrid* IMX_VDB::getGPUBufferR | ( | ) | const |
|
inline |
|
inline |
| int64 IMX_VDB::getMemoryUsage | ( | ) | const |
|
inline |
| bool IMX_VDB::hasTopology | ( | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
Returns a newly created VDB loaded from the stream, or null if load failure.
|
static |
|
static |
Look up a registered vdb by handle.
|
inline |
|
inlineoverrideprotectedvirtual |
True if the gpu buffer is null.
Implements CE_HotSwapPoolEntry.
|
inlineoverrideprotectedvirtual |
True if the gpu buffer is not null and valid.
Implements CE_HotSwapPoolEntry.
|
inlineoverrideprotectedvirtual |
These implement methods required by the pool. Resets the GPU Buffer pointer.
Implements CE_HotSwapPoolEntry.
|
inlineoverrideprotectedvirtual |
|
inlineoverrideprotectedvirtual |
|
inlineoverrideprotectedvirtual |
True if the swap does something.
Implements CE_HotSwapPoolEntry.
|
inlineoverridevirtual |
Implements CE_HotSwapPoolEntry.
|
inline |
|
static |
VDB registration to allow vdbs to be converted to integers across HOM boundaries. Registers & returns the handle, adding the handle to the registered list
| bool IMX_VDB::save | ( | std::ostream & | os | ) | const |
Returns true for successful save.
| bool IMX_VDB::saveJSON | ( | UT_JSONWriter & | w | ) | const |
| void IMX_VDB::setConstantV3 | ( | UT_Vector3 | v | ) |
NOTE: These only set leaf values.
|
inline |
Replace VDB with raw NanoVDB buffer. Can throw CE exceptions for malformed or unhandled data.
|
inline |
|
inline |
Can be used to control what stealable() subsequently returns. If set to true, indicates to the verbs that this buffer may be stolen from.
|
inline |
|
inline |
|
inline |
| bool IMX_VDB::storesIntegers | ( | ) | const |
| void IMX_VDB::transform | ( | const UT_Matrix4D & | m | ) |
Transform the vdb, this REQUIRES updating the nanovdb structure so will run OpenCL.
|
inline |
|
overrideprotectedvirtual |
Queues up commands that transfer this buffer's GPU storage to main memory.
Implements CE_HotSwapPoolEntry.
|
static |
Unregister all vdbs corresponding to the provided list, erase the list afterwards. Assertion if handle wasn't regsitered
| void IMX_VDB::updateMetadataFromOptions | ( | const UT_Options & | opt | ) |
Load ourselves from the options, ignoring fields we don't know.
|
inline |
Updates the contents of the properties, first making sure it is unique. The provided operator should take a reference to a UT_Options that it will update. this->update([](UT_Options &opt) { opt.setOptionS("test", "bar"); });
|
inline |
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
mutableprotected |
|
protected |
The type of the grid so we can avoid unpacking it to find out. Note this is ALSO on the CE_VDBGrid, but that might not exist for CPU buffers so it is duplicated here.
|
protected |
|
protected |
|
protected |