#include <OgreBufferPacked.h>
|
| BufferPacked (size_t internalBufferStartBytes, size_t numElements, uint32 bytesPerElement, uint32 numElementsPadding, BufferType bufferType, void *initialData, bool keepAsShadow, VaoManager *vaoManager, BufferInterface *bufferInterface) |
| Generic constructor.
|
|
virtual | ~BufferPacked () |
|
size_t | _getFinalBufferStart () const |
|
size_t | _getInternalBufferStart () const |
|
size_t | _getInternalNumElements () const |
|
size_t | _getInternalTotalSizeBytes () const |
|
void | _setBufferInterface (BufferInterface *bufferInterface) |
| For internal use.
|
|
void | _setShadowCopy (void *copy) |
| This will not delete the existing shadow copy so it can be used for other purposes if it is not needed call OGRE_FREE_SIMD( m->getShadowCopy(), MEMCATEGORY_GEOMETRY ) before calling this function.
|
|
void | advanceFrame () |
|
void | copyTo (BufferPacked *dstBuffer, size_t dstElemStart=0, size_t srcElemStart=0, size_t srcNumElems=std::numeric_limits< size_t >::max()) |
| Copies the contents of this buffer to another, using GPU -> GPU transfers.
|
|
BufferInterface * | getBufferInterface () const |
|
virtual BufferPackedTypes | getBufferPackedType () const =0 |
| Useful to query which one is the derived class.
|
|
BufferType | getBufferType () const |
|
uint32 | getBytesPerElement () const |
|
MappingState | getMappingState () const |
| Returns the mapping state.
|
|
size_t | getNumElements () const |
|
virtual BufferPacked * | getOriginalBufferType () |
| If this buffer has been reinterpreted from an UavBufferPacked, returns the original version, otherwise returns 'this'.
|
|
const void * | getShadowCopy () const |
|
size_t | getTotalSizeBytes () const |
|
bool | isCurrentlyMapped () const |
| Returns whether the buffer is currently mapped.
|
|
void *RESTRICT_ALIAS_RETURN | map (size_t elementStart, size_t elementCount, bool bAdvanceFrame=true) |
| Maps the specified region to a pointer the CPU can access.
|
|
AsyncTicketPtr | readRequest (size_t elementStart, size_t elementCount) |
| Async data read request.
|
|
void | regressFrame () |
| Performs the opposite of.
|
|
void | unmap (UnmapOptions unmapOption, size_t flushStartElem=0, size_t flushSizeElem=0) |
| Unmaps or flushes the region mapped with.
|
|
virtual void | upload (const void *data, size_t elementStart, size_t elementCount) |
| Sends the provided data to the GPU.
|
|
virtual | ~GpuTrackedResource () |
|
virtual bool | isTextureGpu () const |
|
◆ BufferPacked()
Generic constructor.
- Parameters
-
initialData | Initial data to populate. If bufferType == BT_IMMUTABLE, can't be null. |
keepAsShadow | Keeps "intialData" as a shadow copy for reading from CPU without querying the GPU (can be useful for reconstructing buffers on device/context loss or for efficient reading of the data without streaming back from GPU.) |
If keepAsShadow is false, caller is responsible for freeing the data
If keepAsShadow is true, we're responsible for freeing the pointer. We will free the pointer using OGRE_FREE_SIMD( MEMCATEGORY_GEOMETRY ), in which case the pointer must* have been allocated using OGRE_MALLOC_SIMD( MEMCATEGORY_GEOMETRY )
If the constructor throws, then data will NOT be freed, and caller will have to do it.
- See also
- FreeOnDestructor to help you with exceptions and correctly freeing the data.
Must be false if bufferType >= BT_DYNAMIC
◆ ~BufferPacked()
virtual Ogre::BufferPacked::~BufferPacked |
( |
| ) |
|
|
virtual |
◆ _getFinalBufferStart()
size_t Ogre::BufferPacked::_getFinalBufferStart |
( |
| ) |
const |
|
inline |
◆ _getInternalBufferStart()
size_t Ogre::BufferPacked::_getInternalBufferStart |
( |
| ) |
const |
|
inline |
◆ _getInternalNumElements()
size_t Ogre::BufferPacked::_getInternalNumElements |
( |
| ) |
const |
|
inline |
◆ _getInternalTotalSizeBytes()
size_t Ogre::BufferPacked::_getInternalTotalSizeBytes |
( |
| ) |
const |
|
inline |
◆ _setBufferInterface()
◆ _setShadowCopy()
void Ogre::BufferPacked::_setShadowCopy |
( |
void * |
copy | ) |
|
This will not delete the existing shadow copy so it can be used for other purposes if it is not needed call OGRE_FREE_SIMD( m->getShadowCopy(), MEMCATEGORY_GEOMETRY ) before calling this function.
This will also not automatically upload the shadow data to the GPU. The user must call upload or use a staging buffer themselves to achieve this.
◆ advanceFrame()
void Ogre::BufferPacked::advanceFrame |
( |
| ) |
|
◆ copyTo()
Copies the contents of this buffer to another, using GPU -> GPU transfers.
In simple terms it is similar to doing: memcpy( dstBuffer + dstElemStart, this + srcElemStart, srcNumElems );
If dst has a shadow buffer, then src must have it too.
- Parameters
-
dstBuffer | Buffer to copy to. Must be of type BT_DEFAULT |
dstElemStart | The offset for dstBuffer. It must be in the unit of measure of dstBuffer. e.g. actual offset in bytes is dstElemStart * dstBuffer->getBytesPerElement() |
srcElemStart | The offset of this buffer to start from |
srcNumElems | The number of elements to copy, in units of measure of srcBuffer. When this value is out of bounds, it gets clamped. See remarks. |
◆ getBufferInterface()
◆ getBufferPackedType()
◆ getBufferType()
BufferType Ogre::BufferPacked::getBufferType |
( |
| ) |
const |
|
inline |
◆ getBytesPerElement()
uint32 Ogre::BufferPacked::getBytesPerElement |
( |
| ) |
const |
|
inline |
◆ getMappingState()
Returns the mapping state.
Note that if you call map with MS_PERSISTENT_INCOHERENT or MS_PERSISTENT_COHERENT, then call unmap( UO_KEEP_PERSISTENT ); the returned value will still be MS_PERSISTENT_INCOHERENT/_COHERENT when persistent mapping is supported. This differs from isCurrentlyMapped
◆ getNumElements()
size_t Ogre::BufferPacked::getNumElements |
( |
| ) |
const |
|
inline |
◆ getOriginalBufferType()
If this buffer has been reinterpreted from an UavBufferPacked, returns the original version, otherwise returns 'this'.
◆ getShadowCopy()
const void * Ogre::BufferPacked::getShadowCopy |
( |
| ) |
const |
|
inline |
◆ getTotalSizeBytes()
size_t Ogre::BufferPacked::getTotalSizeBytes |
( |
| ) |
const |
|
inline |
◆ isCurrentlyMapped()
bool Ogre::BufferPacked::isCurrentlyMapped |
( |
| ) |
const |
Returns whether the buffer is currently mapped.
If you've persistently mapped the buffer and then called unmap( UO_KEEP_PERSISTENT ); this function will return false; which differs from getMappingState's behavior.
◆ map()
void *RESTRICT_ALIAS_RETURN Ogre::BufferPacked::map |
( |
size_t |
elementStart, |
|
|
size_t |
elementCount, |
|
|
bool |
bAdvanceFrame = true |
|
) |
| |
Maps the specified region to a pointer the CPU can access.
Only dynamic buffers can use this function. The region [elementStart; elementStart + elementCount) will be mapped.
- Note that even if you use persistent mapping, you still need to call
- See also
- unmap.
- Parameters
-
elementStart | Start of the region to be mapped, in elements. Normally you want this to be 0. |
elementCount | Length of the region to map, in elements. |
- See also
- getNumElements to map the whole range. Can't be 0.
- Parameters
-
bAdvanceFrame | When true, the Buffer will be usable after unmapping it (or earlier if persistent mapped). However you won't be able to call map() again until the next frame. Calling this with false allows to call map multiple times. However ater calling unmap, you must call advanceFrame. THIS IS ONLY FOR VERY ADVANCED USERS. |
◆ readRequest()
Async data read request.
A ticket will be returned. Once the async transfer finishes, you can use the ticket to read the data from CPU.
- See also
- AsyncTicket
◆ regressFrame()
void Ogre::BufferPacked::regressFrame |
( |
| ) |
|
◆ unmap()
◆ upload()
Sends the provided data to the GPU.
- Parameters
-
data | The data to transfer to the GPU. Caller is responsible for freeing the pointer. "data" starts at offset zero. i.e. dst[elementStart * mBytesPerElement] = data[0]; |
elementStart | The start region, usually zero. |
elementCount | Size, in number of elements, of data. Must be less than getNumElements() - elementStart |
The documentation for this class was generated from the following file: