Sysmem is the underneath cache for the data of a resource in CPU RAM.
More...
#include <Sysmem.h>
|
| | Sysmem (Size size, const Byte *bytes) |
| |
| Size | getSize () const |
| |
| Size | allocate (Size pSize) |
| | Allocate the byte array. More...
|
| |
| Size | resize (Size pSize) |
| | Resize the byte array. More...
|
| |
| Size | setData (Size size, const Byte *bytes) |
| | Assign data bytes and size (allocate for size, then copy bytes if exists). More...
|
| |
| Size | setSubData (Size offset, Size size, const Byte *bytes) |
| | Update a subset of buffer data,. More...
|
| |
| Size | append (Size size, const Byte *data) |
| | Append new data at the end of the current buffer. More...
|
| |
| const Byte * | readData () const |
| | Access the byte array. More...
|
| |
| Byte * | editData () |
| | Access the byte array for reading and writing. More...
|
| |
| template<typename T > |
| const T * | read () const |
| |
| template<typename T > |
| T * | edit () |
| |
| Stamp | getStamp () const |
| |
Sysmem is the underneath cache for the data of a resource in CPU RAM.
◆ Sysmem()
| Sysmem::Sysmem |
( |
Size |
size, |
|
|
const Byte * |
bytes |
|
) |
| |
- Parameters
-
| size | Size of the sysmem buffer in bytes. |
| bytes | Pointer to the data to be copied to the buffer. |
◆ allocate()
| Size Sysmem::allocate |
( |
Size |
pSize | ) |
|
Allocate the byte array.
Previous content is not copied over to the newly allocated memory.
- Parameters
-
| pSize | Size in bytes of the new allocation. |
- Returns
- Buffer size in bytes after allocation. Zero if allocation fails.
◆ append()
| Size Sysmem::append |
( |
Size |
size, |
|
|
const Byte * |
data |
|
) |
| |
Append new data at the end of the current buffer.
Resizes buffer to (size + getSIze) and copy the new data
- Parameters
-
| size | Size in bytes of the data to append. |
| data | Pointer to the data o append. |
- Returns
- The number of bytes copied or 0 if it fails.
◆ edit()
- Template Parameters
-
- Returns
- Data as a requested type.
◆ editData()
| Byte* gpu::Sysmem::editData |
( |
| ) |
|
|
inline |
Access the byte array for reading and writing.
- Returns
- Pointer to the data.
◆ getSize()
| Size gpu::Sysmem::getSize |
( |
| ) |
const |
|
inline |
- Returns
- Size in bytes of the buffer.
◆ getStamp()
| Stamp gpu::Sysmem::getStamp |
( |
| ) |
const |
|
inline |
Stamp is a counter that is incremented when sysmem object changes size. It's not incremented when contents are edited without resizing.
- Returns
- Current stamp.
◆ read()
template<typename T >
| const T* gpu::Sysmem::read |
( |
| ) |
const |
|
inline |
- Template Parameters
-
- Returns
- Data as a requested type.
◆ readData()
| const Byte* gpu::Sysmem::readData |
( |
| ) |
const |
|
inline |
Access the byte array.
- Returns
- Pointer to the data.
◆ resize()
| Size Sysmem::resize |
( |
Size |
pSize | ) |
|
Resize the byte array.
Keeps previous data [0 to min(pSize, mSize)].
- Parameters
-
| pSize | New buffer size in bytes. |
- Returns
- Buffer size in bytes after resizing. Returns old size if allocation fails.
◆ setData()
| Size Sysmem::setData |
( |
Size |
size, |
|
|
const Byte * |
bytes |
|
) |
| |
Assign data bytes and size (allocate for size, then copy bytes if exists).
- Parameters
-
| size | Size in bytes. |
| bytes | Pointer to the data. |
- Returns
- Buffer size after setting data. If allocation fails returned size will be different from requested.
◆ setSubData()
| Size Sysmem::setSubData |
( |
Size |
offset, |
|
|
Size |
size, |
|
|
const Byte * |
bytes |
|
) |
| |
Update a subset of buffer data,.
Doesn't reallocate and only copies specified number of bytes at the offset location. Fails if the data doesn't fit in currently allocated buffer.
- Parameters
-
| offset | Offset in bytes where the subset starts. |
| size | Size of the data subset in bytes. |
| bytes | Pointer to new data to be copied. |
- Returns
- Subset size on success, zero on failure.
The documentation for this class was generated from the following files: