12 #ifndef __GA_CEAttribute__
13 #define __GA_CEAttribute__
39 GA_Size tuplesize,
bool isarray,
41 bool leave_on_gpu =
false);
45 GA_Size tuplesize,
bool isarray);
74 return isOnGPU() || isOnCPU();
86 int64 getDeviceMemoryUsage()
const;
87 int64 getMemoryUsage(
bool inclusive=
false)
const;
120 tuplesize, isarray, docopy);
131 if (!gdp)
return false;
137 return attributeToOCL(attrib, storage, precision, tuplesize, isarray, docopy);
161 bool packedIntArrayToOCL(
173 if (!gdp)
return false;
179 return oclToAttribute(attrib);
219 return myBuffer.get() ==
nullptr;
224 return myBuffer.get() && !myBuffer->isEmpty();
251 template <
typename OP>
280 template <
typename OP>
312 void loadToGPU(
bool docopy);
342 bool myIsArray =
false;
359 bool myOnCPU =
false;
360 bool myOnGPU =
false;
364 bool myWriteBackRequired =
false;
389 if (!myCEAttrib)
return false;
390 if (!myBuffer())
return false;
396 int tupleSize()
const {
return myCEAttrib ? myCEAttrib->tupleSize() : 0; }
399 bool isArray()
const {
return myCEAttrib ? myCEAttrib->isArray() :
false; }
410 bool myWrite =
false;
UT_SharedPtr< GA_CEAttribute > GA_CEAttributePtr
bool attributeToOCL(const GA_Detail *gdp, GA_AttributeOwner owner, const char *aname, GA_StorageClass storage, int &tuplesize, bool isarray, bool docopy=true)
Definition of a geometry attribute.
void copyToCPU()
Ensures the CPU version of the attribute is valid.
UT_SharedPtr< UT_Array< cl_long > > myInt64Array
UT_SharedPtr< UT_Array< cl_int > > myInt32Array
void poolShallowCopyGPUBuffer(const CE_HotSwapPoolEntry *srcbase) override
Shallow copy.
getFileOption("OpenEXR:storage") storage
bool poolSwapGPUBuffer(CE_HotSwapPoolEntry *otherbase) override
True if the swap does something.
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
bool attributeToOCL(const GA_Detail *gdp, GA_AttributeOwner owner, const char *aname, GA_StorageClass storage, GA_Precision precision, int &tuplesize, bool isarray, bool docopy=true)
UT_SharedPtr< UT_Array< fpreal16 > > myFloat16Array
UT_SharedPtr< UT_Array< cl_char > > myInt8Array
static GA_CEAttributeAccessorPtr makeAccessorR(GA_CEAttributeConstPtr attrib)
cl::Buffer bufferR() const
GA_Precision precision() const
void swap(T &lhs, T &rhs)
EntryType poolTypeID() const override
GLuint GLsizei GLsizei * length
cl::Buffer bufferR() const
JSON reader class which handles parsing of JSON or bJSON files.
Class which writes ASCII or binary JSON streams.
SYS_FORCE_INLINE TO_T UTverify_cast(FROM_T from)
UT_SharedPtr< CE_BufferDeviceByte > myIndexBuffer
UT_UniquePtr< GA_CEAttribute > GA_CEAttributeUPtr
exint GA_Size
Defines the bit width for index and offset types in GA.
cl::Buffer indexBufferR() const
GA_CEAttribute(const GA_CEAttribute &other)
GA_CEAttribute & operator=(GA_CEAttribute &&other)
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
GA_StorageClass storage() const
static GA_CEAttributeAccessorPtr makeAccessorW(GA_CEAttributePtr attrib)
GA_CEAttribute & operator=(const GA_CEAttribute &other)
bool poolIsGPUBufferValid() const override
True if the gpu buffer is not null and valid.
std::shared_ptr< T > UT_SharedPtr
Wrapper around std::shared_ptr.
bool isWriteBackRequired() const
UT_SharedPtr< UT_Array< cl_int > > myIndexArray
GA_CEAttribute(GA_CEAttribute &&other) noexcept
GA_CEAttributePtr myCEAttrib
UT_SharedPtr< const GA_CEAttribute > GA_CEAttributeConstPtr
cl::Buffer bufferW() const
GA_AttributeSet & getAttributes()
EntryType
To avoid the need for dynamic casts:
UT_SharedPtr< UT_Array< cl_float > > myFloat32Array
bool poolIsGPUBufferEmpty() const override
True if the gpu buffer is null.
GA_StorageClass storage() const
void swap(GA_CEAttribute &other)
UT_SharedPtr< GA_CEAttributeAccessor > GA_CEAttributeAccessorPtr
GLenum GLint GLint * precision
void dispatchToArray(const OP &op)
GA_Precision precision() const
void poolSetOnGPU(bool ongpu) override
Update OnGPU.
cl::Buffer indexBufferR() const
Index buffer is immutable, so no writable variant:
LeafData & operator=(const LeafData &)=delete
void poolResetGPUBuffer() override
SYS_FORCE_INLINE bool UTisstring(const char *s)
UT_SharedPtr< CE_BufferDeviceByte > myBuffer
UT_SharedPtr< UT_Array< cl_double > > myFloat64Array
Container class for all geometry.
GLubyte GLubyte GLubyte GLubyte w
bool oclToAttribute(GA_Detail *gdp, GA_AttributeOwner owner, const char *aname)
cl::Buffer bufferRW() const
UT_SharedPtr< UT_Array< cl_short > > myInt16Array
SYS_FORCE_INLINE const GA_Attribute * findAttribute(GA_AttributeScope scope, const UT_StringRef &name, const GA_AttributeOwner search_order[], int search_order_size) const
static GA_CEAttributeAccessorPtr makeAccessorRW(GA_CEAttributePtr attrib)
void dispatchToArray(const OP &op) const
virtual void unloadFromGPU()=0
void setWriteBackRequired(bool isrequired)