9 #ifndef hifi_gpu_Sysmem_h
10 #define hifi_gpu_Sysmem_h
20 static const Size NOT_ALLOCATED = INVALID_SIZE;
28 Sysmem(Size size,
const Byte* bytes);
62 Size
setData(Size size,
const Byte* bytes);
74 Size
setSubData(Size offset, Size size,
const Byte* bytes);
87 Size
append(Size size,
const Byte* data);
105 template<
typename T >
const T*
read()
const {
return reinterpret_cast< T*
> (_data); }
111 template<
typename T > T*
edit() {
return reinterpret_cast< T*
> (_data); }
127 static Size allocateMemory(Byte** memAllocated, Size size);
134 static void deallocateMemory(Byte* memDeallocated, Size size);
139 bool isAvailable()
const {
return (_data !=
nullptr); }
144 Byte* _data{
nullptr };
Sysmem is the underneath cache for the data of a resource in CPU RAM.
Definition: Sysmem.h:18
Byte * editData()
Access the byte array for reading and writing.
Definition: Sysmem.h:99
Size setSubData(Size offset, Size size, const Byte *bytes)
Update a subset of buffer data,.
Definition: Sysmem.cpp:126
Size getSize() const
Definition: Sysmem.h:36
Size setData(Size size, const Byte *bytes)
Assign data bytes and size (allocate for size, then copy bytes if exists).
Definition: Sysmem.cpp:117
const T * read() const
Definition: Sysmem.h:105
Size append(Size size, const Byte *data)
Append new data at the end of the current buffer.
Definition: Sysmem.cpp:134
Size allocate(Size pSize)
Allocate the byte array.
Definition: Sysmem.cpp:70
const Byte * readData() const
Access the byte array.
Definition: Sysmem.h:93
Stamp getStamp() const
Definition: Sysmem.h:118
Size resize(Size pSize)
Resize the byte array.
Definition: Sysmem.cpp:91
T * edit()
Definition: Sysmem.h:111