|
Nameless Engine
|
#include <UploadBuffer.h>
Public Member Functions | |
| UploadBuffer (std::unique_ptr< GpuResource > pGpuResourceToUse, size_t iElementSizeInBytes, size_t iElementCount) | |
| UploadBuffer (UploadBuffer &)=delete | |
| UploadBuffer & | operator= (UploadBuffer &)=delete |
| void | copyDataToElement (size_t iElementIndex, const void *pData, size_t iDataSize) |
| size_t | getElementCount () const |
| size_t | getElementSizeInBytes () const |
| GpuResource * | getInternalResource () const |
Private Attributes | |
| std::unique_ptr< GpuResource > | pGpuResource |
| unsigned char * | pMappedResourceData = nullptr |
| size_t | iElementSizeInBytes = 0 |
| size_t | iElementCount = 0 |
Wrapper class with handy functions that takes ownership of a GPU resource with available CPU write access, typically used when a buffer needs to be frequently updated from the CPU side.
| ne::UploadBuffer::UploadBuffer | ( | std::unique_ptr< GpuResource > | pGpuResourceToUse, |
| size_t | iElementSizeInBytes, | ||
| size_t | iElementCount | ||
| ) |
Initializes the wrapper with data to use.
| pGpuResourceToUse | GPU resource with available CPU access. |
| iElementSizeInBytes | Size of one buffer element in bytes (already padded if needed). |
| iElementCount | Amount of elements in the resource. |
|
inline |
Copies the specified data to the element in the resource.
| iElementIndex | Index of the element to copy the data to (see getElementCount). |
| pData | Data to copy. |
| iDataSize | Size in bytes of data to copy. |
| size_t ne::UploadBuffer::getElementCount | ( | ) | const |
Returns the number of elements stored in the buffer.
| size_t ne::UploadBuffer::getElementSizeInBytes | ( | ) | const |
Returns the size of one element (includes padding if it was needed) stored in the buffer.
| GpuResource * ne::UploadBuffer::getInternalResource | ( | ) | const |
Returns GPU resource that this object wraps.
|
private |
Amount of elements in pGpuResource.
|
private |
Size of one buffer element in bytes (see iElementCount).
|
private |
GPU resource with available CPU access.
Unmap it.
|
private |
CPU pointer to the data located in pGpuResource.