![]() |
OGRE-Next
2.3
Object-Oriented Graphics Rendering Engine
|
A staging buffer is a buffer that resides on the GPU and be written to/from both CPU & GPU However the access in both cases is limited. More...
#include <OgreGLES2StagingBuffer.h>
Public Types | |
typedef vector< Destination >::type | DestinationVec |
Public Member Functions | |
GLES2StagingBuffer (size_t internalBufferStart, size_t sizeBytes, VaoManager *vaoManager, bool uploadOnly, GLuint vboName) | |
virtual | ~GLES2StagingBuffer () |
virtual size_t | _asyncDownload (BufferPacked *source, size_t srcOffset, size_t srcLength) |
Copies the GPU data in BufferPacked to the StagingBuffer so that it can be later read by the CPU using an AsyncTicket. More... | |
virtual void | _cancelDownload (size_t offset, size_t sizeBytes) |
Releases memory assigned to a download that hasn't been mapped yet, to make space for another _asyncDownload call. More... | |
const void * | _mapForRead (size_t offset, size_t sizeBytes) |
Maps the buffer for read acces for the CPU. More... | |
void | addReferenceCount () |
Adds a reference count to the StagingBuffer. @See removeReferenceCount. More... | |
virtual bool | canDownload (size_t length) const |
Checks if this staging buffer has enough free space to use _asyncDownload. More... | |
void | cleanUnfencedHazards () |
GLuint | getBufferName () const |
uint64 | getLastUsedTimestamp () const |
Returns the time in millisecond when the ref. count became 0. More... | |
uint32 | getLifetimeThreshold () const |
Returns the time in milliseconds in which a StagingBuffer should live with a reference count of 0 before being deleted. More... | |
MappingState | getMappingState () const |
size_t | getMaxSize () |
int16 | getReferenceCount () const |
uint32 | getUnfencedTimeThreshold () const |
Returns the time in milliseconds in which a StagingBuffer should hazards unfenced while with a reference count of 0. More... | |
bool | getUploadOnly () const |
When true, this buffer can only be used for uploading to GPU. More... | |
void * | map (size_t sizeBytes) |
Maps the given amount of bytes. More... | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, const char *, int, const char *) |
void | operator delete (void *ptr, void *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr, const char *, int, const char *) |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, const char *file, int line, const char *func) |
operator new, with debug line info More... | |
void * | operator new (size_t sz, void *ptr) |
placement operator new More... | |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
array operator new, with debug line info More... | |
void | removeReferenceCount () |
Decreases the reference count by one. More... | |
void | unmap (const Destination &destination) |
Unmaps the mapped region and copies the data to the given region. @See Destination. More... | |
void | unmap (const Destination *destinations, size_t numDestinations) |
void | unmap (const DestinationVec &destinations) |
Unmaps the mapped region and copies the data to multiple buffers. More... | |
virtual StagingStallType | uploadWillStall (size_t sizeBytes) |
Returns true if our next call to @map() with the same parameters will stall. More... | |
A staging buffer is a buffer that resides on the GPU and be written to/from both CPU & GPU However the access in both cases is limited.
GPUs can only copy (i.e. memcpy) to another real buffer (can't be used directly as i.e. texture or vertex buffer) and CPUs can only map it. In other words, a staging buffer is an intermediate buffer to transfer data between CPU & GPU
|
inherited |
Ogre::GLES2StagingBuffer::GLES2StagingBuffer | ( | size_t | internalBufferStart, |
size_t | sizeBytes, | ||
VaoManager * | vaoManager, | ||
bool | uploadOnly, | ||
GLuint | vboName | ||
) |
|
virtual |
|
virtual |
Copies the GPU data in BufferPacked to the StagingBuffer so that it can be later read by the CPU using an AsyncTicket.
source | The buffer to copy from. |
srcOffset | The offset, in bytes, of the buffer to copy from. |
srcLength | The size in bytes, of the data to transfer to this staging buffer. |
Implements Ogre::StagingBuffer.
|
virtualinherited |
Releases memory assigned to a download that hasn't been mapped yet, to make space for another _asyncDownload call.
Useful when you suddenly don't intend to call _mapForRead.
Reimplemented in Ogre::MetalStagingBuffer.
|
inherited |
Maps the buffer for read acces for the CPU.
offset | The returned value from _asyncDownload. |
sizeBytes | The size in bytes of the data to map. Should be parameter 'srcLength' passed to _asyncDownload. |
|
inherited |
Adds a reference count to the StagingBuffer. @See removeReferenceCount.
|
virtualinherited |
Checks if this staging buffer has enough free space to use _asyncDownload.
Otherwise such function would raise an exception.
length | The size in bytes that need to be downloaded. |
Reimplemented in Ogre::MetalStagingBuffer.
void Ogre::GLES2StagingBuffer::cleanUnfencedHazards | ( | ) |
|
inline |
|
inlineinherited |
Returns the time in millisecond when the ref. count became 0.
|
inlineinherited |
Returns the time in milliseconds in which a StagingBuffer should live with a reference count of 0 before being deleted.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Returns the time in milliseconds in which a StagingBuffer should hazards unfenced while with a reference count of 0.
|
inlineinherited |
When true, this buffer can only be used for uploading to GPU.
When false, can only be used for downloading from GPU
|
inherited |
Maps the given amount of bytes.
May block if not ready. @See uploadWillStall if you wish to know.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
operator new, with debug line info
|
inlineinherited |
placement operator new
|
inlineinherited |
|
inlineinherited |
array operator new, with debug line info
|
inherited |
Decreases the reference count by one.
StagingBuffers are manually reference counted. The first reason is performance. The second main reason is that the pointer doesn't get immediately deleted when the reference hits 0.
|
inlineinherited |
Unmaps the mapped region and copies the data to the given region. @See Destination.
References Ogre::StagingBuffer::unmap().
Referenced by Ogre::StagingBuffer::unmap().
|
inherited |
|
inlineinherited |
Unmaps the mapped region and copies the data to multiple buffers.
Useful when loading many meshes or textures at once (i.e. from multiple threads)
|
virtual |
Returns true if our next call to @map() with the same parameters will stall.
@See StagingStallType
Reimplemented from Ogre::StagingBuffer.