OGRE 2.1
Object-Oriented Graphics Rendering Engine
Loading...
Searching...
No Matches
Ogre::GLES2VaoManager Class Reference

#include <OgreGLES2VaoManager.h>

+ Inheritance diagram for Ogre::GLES2VaoManager:

Classes

struct  Block
 
struct  StrideChanger
 

Public Types

typedef vector< Block >::type BlockVec
 
typedef vector< StrideChanger >::type StrideChangerVec
 

Public Member Functions

 GLES2VaoManager ()
 
virtual ~GLES2VaoManager ()
 
virtual void _beginFrame (void)
 
uint8 _getDynamicBufferCurrentFrameNoWait (void) const
 
void _notifyStagingBufferEnteredZeroRef (StagingBuffer *stagingBuffer)
 
void _notifyStagingBufferLeftZeroRef (StagingBuffer *stagingBuffer)
 
virtual void _update (void)
 
void bindDrawId (void)
 Binds the Draw ID to the currently bound vertex array object.
 
virtual AsyncTicketPtr createAsyncTicket (BufferPacked *creator, StagingBuffer *stagingBuffer, size_t elementStart, size_t elementCount)
 
ConstBufferPackedcreateConstBuffer (size_t sizeBytes, BufferType bufferType, void *initialData, bool keepAsShadow)
 Creates an constant buffer based on the given parameters.
 
IndexBufferPackedcreateIndexBuffer (IndexBufferPacked::IndexType indexType, size_t numIndices, BufferType bufferType, void *initialData, bool keepAsShadow)
 Creates an index buffer based on the given parameters.
 
IndirectBufferPackedcreateIndirectBuffer (size_t sizeBytes, BufferType bufferType, void *initialData, bool keepAsShadow)
 Creates an indirect buffer.
 
MultiSourceVertexBufferPoolcreateMultiSourceVertexBufferPool (const VertexElement2VecVec &vertexElementsBySource, size_t maxNumVertices, BufferType bufferType)
 
virtual StagingBuffercreateStagingBuffer (size_t sizeBytes, bool forUpload)
 Creates a new staging buffer and adds it to the pool.
 
TexBufferPackedcreateTexBuffer (PixelFormat pixelFormat, size_t sizeBytes, BufferType bufferType, void *initialData, bool keepAsShadow)
 Creates an constant buffer based on the given parameters.
 
UavBufferPackedcreateUavBuffer (size_t numElements, uint32 bytesPerElement, uint32 bindFlags, void *initialData, bool keepAsShadow)
 Creates an UAV buffer based on the given parameters.
 
VertexArrayObjectcreateVertexArrayObject (const VertexBufferPackedVec &vertexBuffers, IndexBufferPacked *indexBuffer, OperationType opType)
 Creates a VertexArrayObject that binds all the vertex buffers with their respective declarations, and the index buffers.
 
VertexBufferPackedcreateVertexBuffer (const VertexElement2Vec &vertexElements, size_t numVertices, BufferType bufferType, void *initialData, bool keepAsShadow)
 Creates a vertex buffer based on the given parameters.
 
void destroyConstBuffer (ConstBufferPacked *constBuffer)
 Destroys the given constant buffer created with createConstBuffer.
 
void destroyIndexBuffer (IndexBufferPacked *indexBuffer)
 Destroys the given index buffer created with createIndexBuffer.
 
void destroyIndirectBuffer (IndirectBufferPacked *indirectBuffer)
 Destroys the given indirect buffer created with createIndirectBuffer.
 
void destroyTexBuffer (TexBufferPacked *texBuffer)
 Destroys the given texture buffer created with createTexBuffer.
 
void destroyUavBuffer (UavBufferPacked *uavBuffer)
 Destroys the given UAV buffer created with createUavBuffer.
 
void destroyVertexArrayObject (VertexArrayObject *vao)
 Destroys the input pointer.
 
void destroyVertexBuffer (VertexBufferPacked *vertexBuffer)
 Destroys the given vertex buffer created with createVertexBuffer.
 
uint32 getConstBufferAlignment (void) const
 
size_t getConstBufferMaxSize (void) const
 
uint32 getDefaultStagingBufferLifetime (void) const
 
uint32 getDefaultStagingBufferUnfencedTime (void) const
 
uint8 getDynamicBufferMultiplier (void) const
 
uint32 getFrameCount (void)
 
GLint getMaxVertexAttribs (void) const
 
StagingBuffergetStagingBuffer (size_t minSizeBytes, bool forUpload)
 Retrieves a staging buffer for use.
 
uint32 getTexBufferAlignment (void) const
 
size_t getTexBufferMaxSize (void) const
 
TimergetTimer (void)
 
uint32 getUavBufferAlignment (void) const
 
size_t getUavBufferMaxSize (void) const
 
virtual bool isFrameFinished (uint32 frameCount)
 See VaoManager::isFrameFinished.
 
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 *)
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info
 
voidoperator new (size_t sz, void *ptr)
 placement operator new
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info
 
void setDefaultStagingBufferlifetime (uint32 lifetime, uint32 unfencedTime)
 Sets the default time for staging buffers.
 
bool supportsArbBufferStorage (void) const
 
bool supportsBaseInstance (void) const
 
bool supportsIndirectBuffers (void) const
 When false, IndirectBufferPacked will emulate the mapping behavior, and we need to use the emulated calls in RenderSystem.
 
bool supportsPersistentMapping (void) const
 
virtual void waitForSpecificFrameToFinish (uint32 frameCount)
 See VaoManager::waitForSpecificFrameToFinish.
 
virtual uint8 waitForTailFrameToFinish (void)
 See VaoManager::waitForTailFrameToFinish.
 

Static Public Member Functions

static uint32 calculateVertexSize (const VertexElement2Vec &vertexElements)
 Returns the size of a single vertex buffer source with the given declaration, in bytes.
 
static GLuint getAttributeIndexFor (VertexElementSemantic semantic)
 
static void mergeContiguousBlocks (BlockVec::iterator blockToMerge, BlockVec &blocks)
 
static GLsync waitFor (GLsync fenceName)
 Will stall undefinitely until GPU finishes (signals the sync object).
 

Member Typedef Documentation

◆ BlockVec

◆ StrideChangerVec

Constructor & Destructor Documentation

◆ GLES2VaoManager()

Ogre::GLES2VaoManager::GLES2VaoManager ( )

◆ ~GLES2VaoManager()

virtual Ogre::GLES2VaoManager::~GLES2VaoManager ( )
virtual

Member Function Documentation

◆ _beginFrame()

virtual void Ogre::VaoManager::_beginFrame ( void  )
inlinevirtualinherited

Reimplemented in Ogre::D3D11VaoManager.

◆ _getDynamicBufferCurrentFrameNoWait()

uint8 Ogre::VaoManager::_getDynamicBufferCurrentFrameNoWait ( void  ) const
inlineinherited

◆ _notifyStagingBufferEnteredZeroRef()

void Ogre::VaoManager::_notifyStagingBufferEnteredZeroRef ( StagingBuffer stagingBuffer)
inherited

◆ _notifyStagingBufferLeftZeroRef()

void Ogre::VaoManager::_notifyStagingBufferLeftZeroRef ( StagingBuffer stagingBuffer)
inherited

◆ _update()

virtual void Ogre::GLES2VaoManager::_update ( void  )
virtual

Reimplemented from Ogre::VaoManager.

◆ bindDrawId()

void Ogre::GLES2VaoManager::bindDrawId ( void  )

Binds the Draw ID to the currently bound vertex array object.

◆ calculateVertexSize()

static uint32 Ogre::VaoManager::calculateVertexSize ( const VertexElement2Vec vertexElements)
staticinherited

Returns the size of a single vertex buffer source with the given declaration, in bytes.

◆ createAsyncTicket()

virtual AsyncTicketPtr Ogre::GLES2VaoManager::createAsyncTicket ( BufferPacked creator,
StagingBuffer stagingBuffer,
size_t  elementStart,
size_t  elementCount 
)
virtual

Implements Ogre::VaoManager.

◆ createConstBuffer()

ConstBufferPacked * Ogre::VaoManager::createConstBuffer ( size_t  sizeBytes,
BufferType  bufferType,
void initialData,
bool  keepAsShadow 
)
inherited

Creates an constant buffer based on the given parameters.

Behind the scenes, the buffer is actually part of much larger buffer, in order to reduce bindings at runtime. (depends on the RenderSystem, on D3D11 we're forced to give its own buffer)

Remarks
@See createVertexBuffer for the remaining parameters not documented here.
Parameters
sizeBytesThe size in bytes of the given constant buffer. API restrictions may apply. To stay safe keep it multiple of 16, don't request more than 64kb per buffer.
Returns
The desired const buffer pointer

◆ createIndexBuffer()

IndexBufferPacked * Ogre::VaoManager::createIndexBuffer ( IndexBufferPacked::IndexType  indexType,
size_t  numIndices,
BufferType  bufferType,
void initialData,
bool  keepAsShadow 
)
inherited

Creates an index buffer based on the given parameters.

Behind the scenes, the buffer is actually part of much larger buffer, in order to reduce bindings at runtime.

Remarks
@See createVertexBuffer for the remaining parameters not documented here.
Parameters
indexTypeWhether this Index Buffer should be 16-bit (recommended) or 32-bit
numIndicesThe number of indices
Returns
The desired index buffer pointer

◆ createIndirectBuffer()

IndirectBufferPacked * Ogre::VaoManager::createIndirectBuffer ( size_t  sizeBytes,
BufferType  bufferType,
void initialData,
bool  keepAsShadow 
)
inherited

Creates an indirect buffer.

Remarks
@See createVertexBuffer for the remaining parameters not documented here.

◆ createMultiSourceVertexBufferPool()

MultiSourceVertexBufferPool * Ogre::VaoManager::createMultiSourceVertexBufferPool ( const VertexElement2VecVec vertexElementsBySource,
size_t  maxNumVertices,
BufferType  bufferType 
)
inherited

◆ createStagingBuffer()

virtual StagingBuffer * Ogre::GLES2VaoManager::createStagingBuffer ( size_t  sizeBytes,
bool  forUpload 
)
virtual

Creates a new staging buffer and adds it to the pool.

See also
getStagingBuffer.
Remarks
The returned buffer starts with a reference count of 1. You should decrease it when you're done using it.

Implements Ogre::VaoManager.

◆ createTexBuffer()

TexBufferPacked * Ogre::VaoManager::createTexBuffer ( PixelFormat  pixelFormat,
size_t  sizeBytes,
BufferType  bufferType,
void initialData,
bool  keepAsShadow 
)
inherited

Creates an constant buffer based on the given parameters.

Behind the scenes, the buffer is actually part of much larger buffer, in order to reduce bindings at runtime. (depends on the RenderSystem, on D3D11 we're forced to give its own buffer)

Remarks
@See createVertexBuffer for the remaining parameters not documented here.
Parameters
pixelFormatThe pixel format for the texture buffer.
sizeBytesThe size in bytes of the given constant buffer. API restrictions may apply.
Returns
The desired texture buffer pointer

◆ createUavBuffer()

UavBufferPacked * Ogre::VaoManager::createUavBuffer ( size_t  numElements,
uint32  bytesPerElement,
uint32  bindFlags,
void initialData,
bool  keepAsShadow 
)
inherited

Creates an UAV buffer based on the given parameters.

Behind the scenes, the buffer is actually part of much larger buffer, in order to reduce bindings at runtime. (depends on the RenderSystem, on D3D11 we're forced to give its own buffer)

Remarks
@See createVertexBuffer for the remaining parameters not documented here. There is no BufferType option as the only available one is BT_DEFAULT
Parameters
sizeBytesThe size in bytes of the given constant buffer. API restrictions may apply.
bindFlagsA combination of BufferBindFlags. BB_FLAG_UAV is implicit.
Returns
The desired UAV buffer pointer

◆ createVertexArrayObject()

VertexArrayObject * Ogre::VaoManager::createVertexArrayObject ( const VertexBufferPackedVec vertexBuffers,
IndexBufferPacked indexBuffer,
OperationType  opType 
)
inherited

Creates a VertexArrayObject that binds all the vertex buffers with their respective declarations, and the index buffers.

The returned value is immutable and thus cannot be modified.

Parameters
vertexBuffersAn array of vertex buffers to be bound to the vertex array object.
indexBufferThe index buffer to be bound.
opTypeType of operation. Cannot be changed later.
Returns
VertexArrayObject that can be rendered.

◆ createVertexBuffer()

VertexBufferPacked * Ogre::VaoManager::createVertexBuffer ( const VertexElement2Vec vertexElements,
size_t  numVertices,
BufferType  bufferType,
void initialData,
bool  keepAsShadow 
)
inherited

Creates a vertex buffer based on the given parameters.

Behind the scenes, the vertex buffer is part of much larger vertex buffer, in order to reduce bindings at runtime.

Parameters
vertexElementsA list of element bindings for this vertex buffer. Once created, changing VertexElements is not possible, you'll have to create another Vertex Buffer.
numVerticesThe number of vertices for this vertex
bufferTypeThe type of buffer for this vertex buffer. @See BufferType::BT_DYNAMIC special case.
initialDataInitial data the buffer will hold upon creation. Can be null (i.e. you plan to upload later). Cannot be null when bufferType is BT_IMMUTABLE. Must have enough room to prevent an overflow.
See also
BufferPacked::BufferPacked
Parameters
keepAsShadowWhether to keep the pointer "initialData" as a shadow copy of the contents. @See BufferPacked::BufferPacked regarding on who is responsible for freeing this pointer and what happens if an exception was raised.
Returns
The desired vertex buffer pointer

◆ destroyConstBuffer()

void Ogre::VaoManager::destroyConstBuffer ( ConstBufferPacked constBuffer)
inherited

Destroys the given constant buffer created with createConstBuffer.

Parameters
constBufferConstant Buffer created with createConstBuffer

◆ destroyIndexBuffer()

void Ogre::VaoManager::destroyIndexBuffer ( IndexBufferPacked indexBuffer)
inherited

Destroys the given index buffer created with createIndexBuffer.

Parameters
indexBufferIndex Buffer created with createIndexBuffer

◆ destroyIndirectBuffer()

void Ogre::VaoManager::destroyIndirectBuffer ( IndirectBufferPacked indirectBuffer)
inherited

Destroys the given indirect buffer created with createIndirectBuffer.

Parameters
indirectBufferIndirect Buffer created with createIndirectBuffer

◆ destroyTexBuffer()

void Ogre::VaoManager::destroyTexBuffer ( TexBufferPacked texBuffer)
inherited

Destroys the given texture buffer created with createTexBuffer.

Parameters
constBufferTexture Buffer created with createTexBuffer

◆ destroyUavBuffer()

void Ogre::VaoManager::destroyUavBuffer ( UavBufferPacked uavBuffer)
inherited

Destroys the given UAV buffer created with createUavBuffer.

Parameters
constBufferUav Buffer created with createUavBuffer

◆ destroyVertexArrayObject()

void Ogre::VaoManager::destroyVertexArrayObject ( VertexArrayObject vao)
inherited

Destroys the input pointer.

After this call, it's no longer valid

Remarks
API memory may or may not be released since VertexArrayObjects may internally share the same API constructs.
The vertex & index buffers associated with this vao are not destroyed by this function.

◆ destroyVertexBuffer()

void Ogre::VaoManager::destroyVertexBuffer ( VertexBufferPacked vertexBuffer)
inherited

Destroys the given vertex buffer created with createVertexBuffer.

NOTE: Vertex Buffers created by a MultiSourceVertexBufferPool must be freed by the pool that created it, don't use this function for those.

Remarks
Performs an O(N) lookup. Where N is the number of created vertex buffers

◆ getAttributeIndexFor()

static GLuint Ogre::GLES2VaoManager::getAttributeIndexFor ( VertexElementSemantic  semantic)
static

◆ getConstBufferAlignment()

uint32 Ogre::VaoManager::getConstBufferAlignment ( void  ) const
inlineinherited

◆ getConstBufferMaxSize()

size_t Ogre::VaoManager::getConstBufferMaxSize ( void  ) const
inlineinherited

◆ getDefaultStagingBufferLifetime()

uint32 Ogre::VaoManager::getDefaultStagingBufferLifetime ( void  ) const
inlineinherited

◆ getDefaultStagingBufferUnfencedTime()

uint32 Ogre::VaoManager::getDefaultStagingBufferUnfencedTime ( void  ) const
inlineinherited

◆ getDynamicBufferMultiplier()

uint8 Ogre::VaoManager::getDynamicBufferMultiplier ( void  ) const
inlineinherited

◆ getFrameCount()

uint32 Ogre::VaoManager::getFrameCount ( void  )
inlineinherited

◆ getMaxVertexAttribs()

GLint Ogre::GLES2VaoManager::getMaxVertexAttribs ( void  ) const
inline

◆ getStagingBuffer()

StagingBuffer * Ogre::VaoManager::getStagingBuffer ( size_t  minSizeBytes,
bool  forUpload 
)
inherited

Retrieves a staging buffer for use.

We'll search for existing ones that can hold minSizeBytes. We first prioritize those that won't cause a stall at all. Then those that will cause a partial stall, and otherwise return one that will cause full stall. If we can't find any existing buffer that can hold the requested number bytes, we'll create a new one.

Remarks
Calling this function causes the reference count of the returned pointer to be increased. You should decrease the reference count after you're done with the returned pointer. @See StagingBuffer::removeReferenceCount regarding ref. counting.
Parameters
sizeBytesMinimum size, in bytes, of the staging buffer. The returned buffer may be bigger.
forUploadTrue if it should be used to upload data to GPU, false to download.
Returns
The staging buffer.

◆ getTexBufferAlignment()

uint32 Ogre::VaoManager::getTexBufferAlignment ( void  ) const
inlineinherited

◆ getTexBufferMaxSize()

size_t Ogre::VaoManager::getTexBufferMaxSize ( void  ) const
inlineinherited

◆ getTimer()

Timer * Ogre::VaoManager::getTimer ( void  )
inlineinherited

◆ getUavBufferAlignment()

uint32 Ogre::VaoManager::getUavBufferAlignment ( void  ) const
inlineinherited

◆ getUavBufferMaxSize()

size_t Ogre::VaoManager::getUavBufferMaxSize ( void  ) const
inlineinherited

◆ isFrameFinished()

virtual bool Ogre::GLES2VaoManager::isFrameFinished ( uint32  frameCount)
virtual

◆ mergeContiguousBlocks()

static void Ogre::GLES2VaoManager::mergeContiguousBlocks ( BlockVec::iterator  blockToMerge,
BlockVec blocks 
)
static
See also
StagingBuffer::mergeContiguousBlocks

◆ operator delete() [1/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void ptr)
inlineinherited

◆ operator delete() [2/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void ptr,
const char ,
int  ,
const char  
)
inlineinherited

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void ptr,
void  
)
inlineinherited

◆ operator delete[]() [1/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void ptr)
inlineinherited

◆ operator delete[]() [2/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void ptr,
const char ,
int  ,
const char  
)
inlineinherited

◆ operator new() [1/3]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

◆ operator new() [2/3]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char file,
int  line,
const char func 
)
inlineinherited

operator new, with debug line info

◆ operator new() [3/3]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void ptr 
)
inlineinherited

placement operator new

◆ operator new[]() [1/2]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

◆ operator new[]() [2/2]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char file,
int  line,
const char func 
)
inlineinherited

array operator new, with debug line info

◆ setDefaultStagingBufferlifetime()

void Ogre::VaoManager::setDefaultStagingBufferlifetime ( uint32  lifetime,
uint32  unfencedTime 
)
inherited

Sets the default time for staging buffers.

Staging buffers are recycled/reused. When their reference count reaches 0, this VaoManager will begin to track how long since the last time they've reached ref count 0. When the time threshold is met, the staging buffer gets removed.

Remarks
See getStagingBuffer
Small explanation on StagingBuffer lifetime management (so you can make sense on what we're doing here):

StagingBuffers may produce "pops" when created (due to API/driver stalls) so we reuse them. We keep track of how long StagingBuffers have been remained unused, and delete old ones. The intention is to be able to recycle old buffers, while getting rid of the excess if a sudden spike happened. That's what the lifetime threshold controls.

We also have the "unfenced threshold". This controls something very different. StagingBuffers usages need fences to check whether we're done using the buffer. But we don't issue a fence every time you do something with them, because that could result in a lot of fences (i.e. imagine you do a 1000 uploads of 16 bytes each, in succession, we shouldn't do 1000 fences); so we fence when certain upload/download thresholds are met (i.e. you've uploaded 1MB of data). So if you've uploaded 750kb so far, no fence will be issued. But if you upload 300kb more, we will fence. But what happens if you've only uploaded 750kb and then nothing more for the last 10 minutes? Since we haven't fenced, and now you need to upload a lot more, we don't know if those 750kb are done uploading because we never fenced it. It probably ended 10 minutes ago, but we won't know. We would have to fence now and perform a full stall waiting for that fence. To solve this edge case, we fence whenever X time has elapsed without fencing (and only if there's data that remains unfenced of course). That's what the unfenced threshold is for.

Parameters
lifetimeTime in milliseconds. The default is 5 minutes. A staging buffer that remained at zero ref. count for lifetime milliseconds will be destroyed.
unfencedTimeFor efficiency reasons (API overhead), some staging buffers implementations will not track all hazards on fences. A staging buffer that remained at zero ref. count for unfencedTime milliseconds will be told to clean their hazards, creating the missing appropiate fences. unfencedTime can't be higher than lifetime. unfencedTime should not be too far away from lifetime, and not too soon either, to maximize the chances of no stalls when we finally destroy it and avoid excessive API overhead in keeping fences alive. The default is 4 minutes 59 seconds.

◆ supportsArbBufferStorage()

bool Ogre::GLES2VaoManager::supportsArbBufferStorage ( void  ) const
inline

◆ supportsBaseInstance()

bool Ogre::VaoManager::supportsBaseInstance ( void  ) const
inlineinherited

◆ supportsIndirectBuffers()

bool Ogre::VaoManager::supportsIndirectBuffers ( void  ) const
inlineinherited

When false, IndirectBufferPacked will emulate the mapping behavior, and we need to use the emulated calls in RenderSystem.

◆ supportsPersistentMapping()

bool Ogre::VaoManager::supportsPersistentMapping ( void  ) const
inlineinherited

◆ waitFor()

static GLsync Ogre::GLES2VaoManager::waitFor ( GLsync  fenceName)
static

Will stall undefinitely until GPU finishes (signals the sync object).

Parameters
fenceNameSync object to wait for. Will be deleted on success. On failure, throws an exception and fenceName will not be deleted.
Returns
Null ptr on success. Should throw on failure, but if this function for some strange reason doesn't throw, it is programmed to return 'fenceName'

◆ waitForSpecificFrameToFinish()

virtual void Ogre::GLES2VaoManager::waitForSpecificFrameToFinish ( uint32  frameCount)
virtual

◆ waitForTailFrameToFinish()

virtual uint8 Ogre::GLES2VaoManager::waitForTailFrameToFinish ( void  )
virtual

The documentation for this class was generated from the following file: