13 #ifndef __GA_PAGEHANDLE_H_INCLUDED__
14 #define __GA_PAGEHANDLE_H_INCLUDED__
36 template <
typename T,
typename TB,
bool READ,
bool WRITE,
typename EXTERNAL_ATTRIB,
typename INTERNAL_ATTRIB,
typename DETAIL>
47 EXTERNAL_ATTRIB *attrib,
51 bind(attrib, component);
65 void bind(EXTERNAL_ATTRIB *attrib,
int component = 0);
68 void bindUnsafe(EXTERNAL_ATTRIB *attrib,
int component = 0);
134 myAttrib->getData().setPageConstant(pagenum, values.data());
189 template <
typename T>
199 template <
typename T>
267 template <
typename T,
typename TB,
bool READ,
bool WRITE,
typename EXTERNAL_ATTRIB,
typename INTERNAL_ATTRIB,
typename DETAIL>
270 EXTERNAL_ATTRIB *attrib,
280 if (myAttrib->getTupleSize() < ((1+component) *
sizeof(
T)/
sizeof(TB)))
285 myComponent = component;
288 template <
typename T,
typename TB,
bool READ,
bool WRITE,
typename EXTERNAL_ATTRIB,
typename INTERNAL_ATTRIB,
typename DETAIL>
291 EXTERNAL_ATTRIB *attrib,
298 myAttrib = (INTERNAL_ATTRIB *)(attrib);
299 myComponent = component;
302 template <
typename T,
typename TB,
bool READ,
bool WRITE,
typename EXTERNAL_ATTRIB,
typename INTERNAL_ATTRIB,
typename DETAIL>
308 && pagebase >= myBaseOffset
319 myBaseOffset = pagebase;
328 myBaseOffset = pagebase;
332 auto &
src = myAttrib->getData();
334 && (
sizeof(
T) /
sizeof(TB)) ==
src.getTupleSize())
340 matchsrc.hardenPage(pagenum);
341 myDataPtr =
reinterpret_cast<T*
>(
SYSconst_cast(matchsrc.getPageData(pagenum)));
342 myIsConstant =
false;
346 const GA_PageArray<TB,(
sizeof(
T) /
sizeof(TB))> &matchsrc =
src.template castTupleSize<
sizeof(
T)/
sizeof(TB)>().template castType<TB>();
348 if (matchsrc.isPageConstant(pagenum))
351 const T *
data =
reinterpret_cast<const T*
>(matchsrc.getPageData(pagenum));
354 bool equal = myIsConstant;
359 memset(&v,0,
sizeof(
T));
362 equal = (myMarshalledData[0] == *
data);
364 UT_ASSERT_P(!equal || myDataPtr == myMarshalledData);
370 memset(myMarshalledData, 0, count*
sizeof(myMarshalledData[0]));
375 myMarshalledData[off] = *data;
377 myDataPtr = myMarshalledData;
383 myDataPtr =
reinterpret_cast<T*
>(
SYSconst_cast(matchsrc.getPageData(pagenum)));
384 myIsConstant =
false;
391 if (myComponent <= 0)
396 myMarshalledData[off] = *
reinterpret_cast<const T*
>(&
v);
401 UT_ASSERT_MSG_P((SYSisSame<T,TB>()),
"Don't currently support vector types when myComponent > 0.");
404 TB
v =
src.template get<TB>(pagebase + off, myComponent);
405 myMarshalledData[off] = *
reinterpret_cast<const T*
>(&
v);
408 myDataPtr = myMarshalledData;
409 myIsConstant =
src.isPageConstant(pagenum);
413 #endif // __GA_PAGEHANDLE_H_INCLUDED__
GA_PageHandleV< UT_Vector4D >::ROType GA_ROPageHandleV4D
GA_PageHandleV< UT_Vector2F >::ROType GA_ROPageHandleV2
void setPage(GA_Offset pagebase)
GA_PageHandleT< T, T, true, false, const GA_Attribute, const GA_ATINumeric, const GA_Detail > ROType
GA_PageHandleV< UT_QuaternionF >::RWType GA_RWPageHandleQ
GA_PageHandleV< UT_Matrix4F >::ROType GA_ROPageHandleM4
GA_PageHandleV< UT_Vector3F >::ROType GA_ROPageHandleV3
GA_PageHandleScalar< fpreal64 >::ROType GA_ROPageHandleD
GA_PageHandleV< UT_Matrix2D >::ROType GA_ROPageHandleM2D
void setRelative(GA_PageOff rel, T value)
GA_PageHandleV< UT_Matrix3D >::RWType GA_RWPageHandleM3D
GA_PageHandleV< UT_Vector3D >::RWType GA_RWPageHandleV3D
GA_PageHandleScalar< fpreal16 >::ROType GA_ROPageHandleH
GA_PageHandleV< UT_Vector4F >::ROType GA_ROPageHandleV4
SYS_FORCE_INLINE T * SYSconst_cast(const T *foo)
GA_PageHandleV< UT_Vector2D >::RWType GA_RWPageHandleV2D
GA_PageHandleV< UT_Vector3D >::ROType GA_ROPageHandleV3D
IMATH_HOSTDEVICE constexpr bool equal(T1 a, T2 b, T3 t) IMATH_NOEXCEPT
GA_PageHandleScalar< fpreal >::ROType GA_ROPageHandleR
#define UT_ASSERT_MSG_P(ZZ,...)
#define GA_INVALID_DATAID
GA_PageHandleScalar< int32 >::ROType GA_ROPageHandleI
T & valueRelative(GA_PageOff rel)
exint GA_Size
Defines the bit width for index and offset types in GA.
SYS_FORCE_INLINE GA_PageOff GAgetPageOff(GA_Offset v)
GA_PageHandleV< UT_QuaternionF >::ROType GA_ROPageHandleQ
#define GA_INVALID_OFFSET
GA_PageHandleV< UT_Vector3F >::RWType GA_RWPageHandleV3
GA_PageHandleV< UT_Vector4D >::RWType GA_RWPageHandleV4D
GA_PageHandleV< UT_Matrix2F >::ROType GA_ROPageHandleM2
T getRelative(GA_PageOff rel) const
GA_PageHandleV< UT_Matrix2D >::RWType GA_RWPageHandleM2D
SYS_FORCE_INLINE const X * cast(const InstancablePtr *o)
GA_PageHandleV< UT_Vector4F >::RWType GA_RWPageHandleV4
GA_PageHandleT(EXTERNAL_ATTRIB *attrib, int component=0)
GA_PageHandleT< T, T, true, true, GA_Attribute, GA_ATINumeric, GA_Detail > RWType
SYS_FORCE_INLINE bool isValid() const
SYS_FORCE_INLINE bool isInvalid() const
SYS_FORCE_INLINE GA_PageNum GAgetPageNum(GA_Offset v)
GA_PageHandleV< UT_Matrix3D >::ROType GA_ROPageHandleM3D
void makeConstant(T cval)
void setDefaultValue(T value)
void setPageConstant(GA_PageNum pagenum, T values)
GLuint const GLchar * name
SYS_FORCE_INLINE bool isCurrentPageConstant() const
GA_PageHandleV< UT_QuaternionD >::ROType GA_ROPageHandleQD
GA_PageHandleScalar< fpreal16 >::RWType GA_RWPageHandleH
GA_PageHandleV< UT_Matrix3F >::ROType GA_ROPageHandleM3
GA_PageHandleV< UT_QuaternionD >::RWType GA_RWPageHandleQD
GA_PageHandleScalar< fpreal64 >::RWType GA_RWPageHandleD
EXTERNAL_ATTRIB * operator->() const
void bindUnsafe(EXTERNAL_ATTRIB *attrib, int component=0)
GA_PageHandleScalar< int64 >::ROType GA_ROPageHandleID
void bind(EXTERNAL_ATTRIB *attrib, int component=0)
GA_PageHandleScalar< fpreal >::RWType GA_RWPageHandleR
GLenum GLsizei GLsizei GLint * values
GA_PageHandleV< UT_Matrix3F >::RWType GA_RWPageHandleM3
GA_PageHandleV< UT_Matrix4D >::ROType GA_ROPageHandleM4D
GA_PageHandleT< T, typename T::value_type, true, true, GA_Attribute, GA_ATINumeric, GA_Detail > RWType
GA_PageHandleT< T, typename T::value_type, true, false, const GA_Attribute, const GA_ATINumeric, const GA_Detail > ROType
GA_DataId getDataId() const
GA_PageHandleV< UT_Vector2F >::RWType GA_RWPageHandleV2
EXTERNAL_ATTRIB * getAttribute() const
GA_PageHandleV< UT_Matrix2F >::RWType GA_RWPageHandleM2
GA_PageHandleScalar< fpreal32 >::ROType GA_ROPageHandleF
Container class for all geometry.
GA_PageHandleScalar< int64 >::RWType GA_RWPageHandleID
GA_PageHandleScalar< int32 >::RWType GA_RWPageHandleI
#define WRITE(z, n, data)
GA_PageHandleV< UT_Vector2D >::ROType GA_ROPageHandleV2D
GA_PageHandleScalar< fpreal32 >::RWType GA_RWPageHandleF
T myMarshalledData[GA_PAGE_SIZE]
void set(GA_Offset off, T value)
GA_PageHandleV< UT_Matrix4D >::RWType GA_RWPageHandleM4D
void setComponent(int comp)
INTERNAL_ATTRIB * myAttrib
GA_PageHandleV< UT_Matrix4F >::RWType GA_RWPageHandleM4