|
HDK
|
#include <GA_CEAttribute.h>
Inheritance diagram for GA_CEAttribute:Static Public Member Functions | |
| static GA_CEAttributeUPtr | loadJSON (UT_JSONParser &p) |
| static GA_CEAttributeAccessorPtr | makeAccessor (GA_CEAttributePtr attrib, bool read, bool write) |
| static GA_CEAttributeAccessorPtr | makeAccessorR (GA_CEAttributeConstPtr attrib) |
| static GA_CEAttributeAccessorPtr | makeAccessorRW (GA_CEAttributePtr attrib) |
| static GA_CEAttributeAccessorPtr | makeAccessorW (GA_CEAttributePtr attrib) |
Protected Member Functions | |
| cl::Buffer | bufferW () |
| cl::Buffer | bufferRW () |
| cl::Buffer | bufferR () const |
| cl::Buffer | buffer (bool read, bool write) |
| cl::Buffer | indexBufferR () const |
| Index buffer is immutable, so no writable variant: More... | |
| 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 |
| template<typename OP > | |
| void | dispatchToArray (const OP &op) |
| template<typename OP > | |
| void | dispatchToArray (const OP &op) const |
| void | loadToGPU (bool docopy) |
Protected Attributes | |
| UT_SharedPtr< CE_BufferDeviceByte > | myBuffer |
| UT_SharedPtr< CE_BufferDeviceByte > | myIndexBuffer |
| UT_SharedPtr< UT_Array< cl_int > > | myIndexArray |
| UT_SharedPtr< UT_Array < fpreal16 > > | myFloat16Array |
| UT_SharedPtr< UT_Array < cl_float > > | myFloat32Array |
| UT_SharedPtr< UT_Array < cl_double > > | myFloat64Array |
| UT_SharedPtr< UT_Array< cl_char > > | myInt8Array |
| UT_SharedPtr< UT_Array < cl_short > > | myInt16Array |
| UT_SharedPtr< UT_Array< cl_int > > | myInt32Array |
| UT_SharedPtr< UT_Array< cl_long > > | myInt64Array |
| GA_Size | myEntries = 0 |
| GA_Size | myDataEntries = 0 |
| GA_Size | myTupleSize = 0 |
| GA_StorageClass | myStorage = GA_STORECLASS_INVALID |
| GA_Precision | myPrecision = GA_PRECISION_INVALID |
| bool | myIsArray = false |
| bool | myOnCPU = false |
| bool | myOnGPU = false |
| bool | myWriteBackRequired = false |
Friends | |
| class | GA_CEAttributeAccessor |
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... | |
Definition at line 32 of file GA_CEAttribute.h.
| GA_CEAttribute::GA_CEAttribute | ( | ) |
| GA_CEAttribute::GA_CEAttribute | ( | GA_Size | entries, |
| GA_StorageClass | storage, | ||
| GA_Precision | precision, | ||
| GA_Size | tuplesize, | ||
| bool | isarray, | ||
| cl::Buffer | buffer, | ||
| cl::Buffer | indexbuffer, | ||
| bool | leave_on_gpu = false |
||
| ) |
Create an attribute from existing buffers.
| GA_CEAttribute::GA_CEAttribute | ( | GA_Size | entries, |
| GA_StorageClass | storage, | ||
| GA_Precision | precision, | ||
| GA_Size | tuplesize, | ||
| bool | isarray | ||
| ) |
Construct unallocated array of this size and type.
|
inline |
Definition at line 47 of file GA_CEAttribute.h.
|
inlinenoexcept |
Definition at line 48 of file GA_CEAttribute.h.
|
overridevirtual |
|
inline |
attributeToOCL populates our own data from the attribute. It will be loaded onto the GPU. If it fails, returns false.
Definition at line 111 of file GA_CEAttribute.h.
|
inline |
Definition at line 122 of file GA_CEAttribute.h.
| bool GA_CEAttribute::attributeToOCL | ( | const GA_Attribute * | attrib, |
| GA_StorageClass | storage, | ||
| GA_Precision | precision, | ||
| int & | tuplesize, | ||
| bool | isarray, | ||
| bool | docopy = true |
||
| ) |
|
protected |
|
inlineprotected |
Definition at line 199 of file GA_CEAttribute.h.
|
inlineprotected |
Definition at line 198 of file GA_CEAttribute.h.
|
inlineprotected |
bufferRW() will ensure COW is respected and create a new GPU buffer if this was shared. It also resets the OnCPU flag as it is assumed the data will be written to. bufferW() ensures the GPU buffer is unique, but does not copy the data when doing so. bufferR() will return a shared buffer without uniquing. Caution should be taken to ensure you don't get both a read & write buffer, as your read buffer may be then orphaned (If you hold onto the cl::Buffer object it is safe other than out of date data. NOTE: binding to a kernel does NOT preserve the cl::Buffer object)
Definition at line 197 of file GA_CEAttribute.h.
| void GA_CEAttribute::clearBuffers | ( | ) |
| void GA_CEAttribute::copy | ( | const GA_CEAttribute & | other | ) |
|
inline |
Ensures the CPU version of the attribute is valid.
Definition at line 83 of file GA_CEAttribute.h.
|
inlineprotected |
Definition at line 252 of file GA_CEAttribute.h.
|
inlineprotected |
Definition at line 281 of file GA_CEAttribute.h.
|
inline |
Definition at line 100 of file GA_CEAttribute.h.
| int64 GA_CEAttribute::getDeviceMemoryUsage | ( | ) | const |
| int64 GA_CEAttribute::getMemoryUsage | ( | bool | inclusive = false | ) | const |
|
inlineprotected |
Index buffer is immutable, so no writable variant:
Definition at line 203 of file GA_CEAttribute.h.
| bool GA_CEAttribute::intArrayToOCL | ( | const UT_Array< UT_Array< int64 >> & | data, |
| GA_StorageClass | storage, | ||
| GA_Precision | precision, | ||
| bool | docopy = true |
||
| ) |
| bool GA_CEAttribute::intToOCL | ( | const UT_Array< int64 > & | data, |
| GA_StorageClass | storage, | ||
| GA_Precision | precision, | ||
| bool | docopy = true |
||
| ) |
The int*ToOCL copy integer data into our own data. It will beloaded onto the GPU. If it fails, returns false.
|
inline |
Definition at line 104 of file GA_CEAttribute.h.
|
inline |
Definition at line 79 of file GA_CEAttribute.h.
|
inline |
Definition at line 77 of file GA_CEAttribute.h.
|
inline |
Definition at line 71 of file GA_CEAttribute.h.
|
inline |
Definition at line 183 of file GA_CEAttribute.h.
|
static |
Returns a newly created VDB loaded from the stream, or null if load failure.
|
protected |
Transfers this CPU data onto the GPU. Will set myOnGPu true on success, if docopy is false we only allocate the gpu buffer.
|
static |
Acquire accessors to the GPU data. Extend the liftetime of these until any kernels they are bound to are dispatched. These handle pinning the GPU buffer from eviction from the hot swap pool, and also extending the cl::Buffer lifetime. You must test to see if these are null. If they are non-null, they will be isValid().
|
inlinestatic |
Definition at line 96 of file GA_CEAttribute.h.
|
inlinestatic |
Definition at line 97 of file GA_CEAttribute.h.
|
inlinestatic |
Definition at line 98 of file GA_CEAttribute.h.
|
inline |
oclToAttribute writes back our data to the specified attribute. If it is not compatible, returns false.
Definition at line 171 of file GA_CEAttribute.h.
| bool GA_CEAttribute::oclToAttribute | ( | GA_Attribute * | attrib | ) |
|
inline |
Definition at line 55 of file GA_CEAttribute.h.
|
inline |
Definition at line 58 of file GA_CEAttribute.h.
| bool GA_CEAttribute::packedIntArrayToOCL | ( | const UT_PackedArrayOfArrays< int64 > & | data, |
| GA_StorageClass | storage, | ||
| GA_Precision | precision, | ||
| bool | docopy = true |
||
| ) |
|
inlineoverrideprotectedvirtual |
True if the gpu buffer is null.
Implements CE_HotSwapPoolEntry.
Definition at line 217 of file GA_CEAttribute.h.
|
inlineoverrideprotectedvirtual |
True if the gpu buffer is not null and valid.
Implements CE_HotSwapPoolEntry.
Definition at line 222 of file GA_CEAttribute.h.
|
inlineoverrideprotectedvirtual |
These implement methods required by the pool. Resets the GPU Buffer pointer.
Implements CE_HotSwapPoolEntry.
Definition at line 207 of file GA_CEAttribute.h.
|
inlineoverrideprotectedvirtual |
|
inlineoverrideprotectedvirtual |
|
inlineoverrideprotectedvirtual |
True if the swap does something.
Implements CE_HotSwapPoolEntry.
Definition at line 227 of file GA_CEAttribute.h.
|
inlineoverridevirtual |
Implements CE_HotSwapPoolEntry.
Definition at line 52 of file GA_CEAttribute.h.
|
inline |
Definition at line 103 of file GA_CEAttribute.h.
| bool GA_CEAttribute::rawData | ( | UT_WorkBuffer & | data | ) | const |
| bool GA_CEAttribute::saveJSON | ( | UT_JSONWriter & | w | ) | const |
Returns true for successful save.
| bool GA_CEAttribute::setRawData | ( | const char * | data, |
| exint | length | ||
| ) |
|
inline |
Definition at line 184 of file GA_CEAttribute.h.
|
inline |
Definition at line 102 of file GA_CEAttribute.h.
| void GA_CEAttribute::swap | ( | GA_CEAttribute & | other | ) |
|
inline |
Definition at line 101 of file GA_CEAttribute.h.
|
overrideprotectedvirtual |
Queues up commands that transfer this buffer's GPU storage to main memory.
Implements CE_HotSwapPoolEntry.
|
friend |
Definition at line 366 of file GA_CEAttribute.h.
|
protected |
All changes to this member (the shared pointer) must be done by the memory pool!!!
Definition at line 317 of file GA_CEAttribute.h.
|
protected |
Definition at line 338 of file GA_CEAttribute.h.
|
protected |
Definition at line 337 of file GA_CEAttribute.h.
|
protected |
Definition at line 328 of file GA_CEAttribute.h.
|
protected |
Definition at line 329 of file GA_CEAttribute.h.
|
protected |
Definition at line 330 of file GA_CEAttribute.h.
|
protected |
Definition at line 324 of file GA_CEAttribute.h.
|
protected |
Definition at line 319 of file GA_CEAttribute.h.
|
protected |
Definition at line 332 of file GA_CEAttribute.h.
|
protected |
Definition at line 333 of file GA_CEAttribute.h.
|
protected |
Definition at line 334 of file GA_CEAttribute.h.
|
protected |
Definition at line 331 of file GA_CEAttribute.h.
|
protected |
Definition at line 342 of file GA_CEAttribute.h.
|
protected |
This pair stores whether correct data is on the CPU or GPU buffers or both.
Definition at line 359 of file GA_CEAttribute.h.
|
protected |
Definition at line 360 of file GA_CEAttribute.h.
|
protected |
Definition at line 341 of file GA_CEAttribute.h.
|
protected |
Definition at line 340 of file GA_CEAttribute.h.
|
protected |
Definition at line 339 of file GA_CEAttribute.h.
|
protected |
Whether the buffer has been written to by CE. This implies GA_Attribute is out of date.
Definition at line 364 of file GA_CEAttribute.h.