Implementation of HardwareBufferManager for OpenGL ES. More...
#include <OgreGLESHardwareBufferManager.h>
Public Types | |
enum | BufferLicenseType { BLT_MANUAL_RELEASE, BLT_AUTOMATIC_RELEASE } |
Public Member Functions | |
GLESHardwareBufferManagerBase () | |
virtual | ~GLESHardwareBufferManagerBase () |
virtual void | _forceReleaseBufferCopies (const HardwareVertexBufferSharedPtr &sourceBuffer) |
Internal method that forces the release of copies of a given buffer. More... | |
virtual void | _forceReleaseBufferCopies (HardwareVertexBuffer *sourceBuffer) |
Internal method that forces the release of copies of a given buffer. More... | |
virtual void | _freeUnusedBufferCopies (void) |
Free all unused vertex buffer copies. More... | |
void | _notifyIndexBufferDestroyed (HardwareIndexBuffer *buf) |
Notification that a hardware index buffer has been destroyed. More... | |
void | _notifyVertexBufferDestroyed (HardwareVertexBuffer *buf) |
Notification that a hardware vertex buffer has been destroyed. More... | |
virtual void | _releaseBufferCopies (bool forceFreeUnused=false) |
Internal method for releasing all temporary buffers which have been allocated using BLT_AUTOMATIC_RELEASE; is called by OGRE. More... | |
void * | allocateScratch (uint32 size) |
Allocator method to allow us to use a pool of memory as a scratch area for hardware buffers. More... | |
virtual HardwareVertexBufferSharedPtr | allocateVertexBufferCopy (const HardwareVertexBufferSharedPtr &sourceBuffer, BufferLicenseType licenseType, HardwareBufferLicensee *licensee, bool copyData=false) |
Allocates a copy of a given vertex buffer. More... | |
HardwareIndexBufferSharedPtr | createIndexBuffer (HardwareIndexBuffer::IndexType itype, size_t numIndexes, HardwareBuffer::Usage usage, bool useShadowBuffer=false) |
Create a hardware vertex buffer. More... | |
RenderToVertexBufferSharedPtr | createRenderToVertexBuffer () |
Create a render to vertex buffer. More... | |
HardwareVertexBufferSharedPtr | createVertexBuffer (size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage, bool useShadowBuffer=false) |
Creates a vertex buffer. More... | |
virtual VertexBufferBinding * | createVertexBufferBinding (void) |
Creates a new VertexBufferBinding. More... | |
virtual VertexDeclaration * | createVertexDeclaration (void) |
Creates a new vertex declaration. More... | |
void | deallocateScratch (void *ptr) |
virtual void | destroyVertexBufferBinding (VertexBufferBinding *binding) |
Destroys a VertexBufferBinding. More... | |
virtual void | destroyVertexDeclaration (VertexDeclaration *decl) |
Destroys a vertex declaration. More... | |
size_t | getGLMapBufferThreshold () const |
Threshold after which glMapBuffer is used and not glBufferSubData. More... | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr, const char *, int, const char *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr, const char *, int, const char *) |
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 * | operator new (size_t sz, void *ptr) |
placement operator new More... | |
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
array operator new, with debug line info More... | |
void * | operator new[] (size_t sz) |
virtual void | registerVertexBufferSourceAndCopy (const HardwareVertexBufferSharedPtr &sourceBuffer, const HardwareVertexBufferSharedPtr ©) |
Registers a vertex buffer as a copy of another. More... | |
virtual void | releaseVertexBufferCopy (const HardwareVertexBufferSharedPtr &bufferCopy) |
Manually release a vertex buffer copy for others to subsequently use. More... | |
void | setGLMapBufferThreshold (const size_t value) |
virtual void | touchVertexBufferCopy (const HardwareVertexBufferSharedPtr &bufferCopy) |
Tell engine that the vertex buffer copy intent to reuse. More... | |
Static Public Member Functions | |
static GLenum | getGLType (unsigned int type) |
Utility function to get the correct GL type based on VET's. More... | |
static GLenum | getGLUsage (unsigned int usage) |
Utility function to get the correct GL usage based on HBU's. More... | |
Protected Types | |
typedef multimap < HardwareVertexBuffer *, HardwareVertexBufferSharedPtr > ::type | FreeTemporaryVertexBufferMap |
Map from original buffer to temporary buffers. More... | |
typedef set < HardwareIndexBuffer * > ::type | IndexBufferList |
typedef map < HardwareVertexBuffer *, VertexBufferLicense >::type | TemporaryVertexBufferLicenseMap |
Map from temporary buffer to details of a license. More... | |
typedef set < VertexBufferBinding * > ::type | VertexBufferBindingList |
typedef set < HardwareVertexBuffer * > ::type | VertexBufferList |
WARNING: The following two members should place before all other members. More... | |
typedef set< VertexDeclaration * > ::type | VertexDeclarationList |
Protected Member Functions | |
virtual VertexBufferBinding * | createVertexBufferBindingImpl (void) |
Internal method for creates a new VertexBufferBinding, may be overridden by certain rendering APIs. More... | |
virtual VertexDeclaration * | createVertexDeclarationImpl (void) |
Internal method for creates a new vertex declaration, may be overridden by certain rendering APIs. More... | |
virtual void | destroyAllBindings (void) |
Internal method for destroys all vertex buffer bindings. More... | |
virtual void | destroyAllDeclarations (void) |
Internal method for destroys all vertex declarations. More... | |
virtual void | destroyVertexBufferBindingImpl (VertexBufferBinding *binding) |
Internal method for destroys a VertexBufferBinding, may be overridden by certain rendering APIs. More... | |
virtual void | destroyVertexDeclarationImpl (VertexDeclaration *decl) |
Internal method for destroys a vertex declaration, may be overridden by certain rendering APIs. More... | |
virtual HardwareVertexBufferSharedPtr | makeBufferCopy (const HardwareVertexBufferSharedPtr &source, HardwareBuffer::Usage usage, bool useShadowBuffer) |
Creates a new buffer as a copy of the source, does not copy data. More... | |
Protected Attributes | |
FreeTemporaryVertexBufferMap | mFreeTempVertexBufferMap |
Map of current available temp buffers. More... | |
IndexBufferList | mIndexBuffers |
size_t | mMapBufferThreshold |
char * | mScratchBufferPool |
TemporaryVertexBufferLicenseMap | mTempVertexBufferLicenses |
Map of currently licensed temporary buffers. More... | |
size_t | mUnderUsedFrameCount |
Number of frames elapsed since temporary buffers utilization was above half the available. More... | |
VertexBufferBindingList | mVertexBufferBindings |
VertexBufferList | mVertexBuffers |
VertexDeclarationList | mVertexDeclarations |
Static Protected Attributes | |
static const size_t | EXPIRED_DELAY_FRAME_THRESHOLD |
Frame delay for BLT_AUTOMATIC_RELEASE temporary buffers. More... | |
static const size_t | UNDER_USED_FRAME_THRESHOLD |
Number of frames to wait before free unused temporary buffers. More... | |
Implementation of HardwareBufferManager for OpenGL ES.
Definition at line 41 of file OgreGLESHardwareBufferManager.h.
|
protectedinherited |
Map from original buffer to temporary buffers.
Definition at line 188 of file OgreHardwareBufferManager.h.
|
protectedinherited |
Definition at line 121 of file OgreHardwareBufferManager.h.
|
protectedinherited |
Map from temporary buffer to details of a license.
Definition at line 192 of file OgreHardwareBufferManager.h.
|
protectedinherited |
Definition at line 127 of file OgreHardwareBufferManager.h.
|
protectedinherited |
WARNING: The following two members should place before all other members.
Members destruct order is very important here, because destructing other members will cause notify back to this class, and then will access to this two members.
Definition at line 120 of file OgreHardwareBufferManager.h.
|
protectedinherited |
Definition at line 126 of file OgreHardwareBufferManager.h.
|
inherited |
Enumerator | |
---|---|
BLT_MANUAL_RELEASE |
Licensee will only release buffer when it says so. |
BLT_AUTOMATIC_RELEASE |
Licensee can have license revoked. |
Definition at line 154 of file OgreHardwareBufferManager.h.
Ogre::GLESHardwareBufferManagerBase::GLESHardwareBufferManagerBase | ( | ) |
|
virtual |
|
virtualinherited |
Internal method that forces the release of copies of a given buffer.
sourceBuffer | the source buffer as a shared pointer. Any buffer copies created from the source buffer are deleted. |
Reimplemented in Ogre::HardwareBufferManager.
Referenced by Ogre::HardwareBufferManager::_forceReleaseBufferCopies().
|
virtualinherited |
Internal method that forces the release of copies of a given buffer.
sourceBuffer | the source buffer as a pointer. Any buffer copies created from the source buffer are deleted. |
Reimplemented in Ogre::HardwareBufferManager.
|
virtualinherited |
Free all unused vertex buffer copies.
Reimplemented in Ogre::HardwareBufferManager.
Referenced by Ogre::HardwareBufferManager::_freeUnusedBufferCopies().
|
inherited |
Notification that a hardware index buffer has been destroyed.
Referenced by Ogre::HardwareBufferManager::_notifyIndexBufferDestroyed().
|
inherited |
Notification that a hardware vertex buffer has been destroyed.
Referenced by Ogre::HardwareBufferManager::_notifyVertexBufferDestroyed().
|
virtualinherited |
Internal method for releasing all temporary buffers which have been allocated using BLT_AUTOMATIC_RELEASE; is called by OGRE.
forceFreeUnused | If true, free all unused temporary buffers. If false, auto detect and free all unused temporary buffers based on temporary buffers utilization. |
Reimplemented in Ogre::HardwareBufferManager.
Referenced by Ogre::HardwareBufferManager::_releaseBufferCopies().
void* Ogre::GLESHardwareBufferManagerBase::allocateScratch | ( | uint32 | size | ) |
Allocator method to allow us to use a pool of memory as a scratch area for hardware buffers.
This is because glMapBuffer is incredibly inefficient, seemingly no matter what options we give it. So for the period of lock/unlock, we will instead allocate a section of a local memory pool, and use glBufferSubDataARB / glGetBufferSubDataARB instead.
|
virtualinherited |
Allocates a copy of a given vertex buffer.
sourceBuffer | The source buffer to use as a copy |
licenseType | The type of license required on this buffer - automatic release causes this class to release licenses every frame so that they can be reallocated anew. |
licensee | Pointer back to the class requesting the copy, which must implement HardwareBufferLicense in order to be notified when the license expires. |
copyData | If true, the current data is copied as well as the structure of the buffer |
Reimplemented in Ogre::HardwareBufferManager.
Referenced by Ogre::HardwareBufferManager::allocateVertexBufferCopy().
|
virtual |
Create a hardware vertex buffer.
Implements Ogre::HardwareBufferManagerBase.
|
virtual |
Create a render to vertex buffer.
Implements Ogre::HardwareBufferManagerBase.
|
virtual |
Creates a vertex buffer.
Implements Ogre::HardwareBufferManagerBase.
|
virtualinherited |
Creates a new VertexBufferBinding.
Reimplemented in Ogre::HardwareBufferManager.
Referenced by Ogre::HardwareBufferManager::createVertexBufferBinding().
|
protectedvirtualinherited |
Internal method for creates a new VertexBufferBinding, may be overridden by certain rendering APIs.
|
virtualinherited |
Creates a new vertex declaration.
Reimplemented in Ogre::HardwareBufferManager.
Referenced by Ogre::HardwareBufferManager::createVertexDeclaration().
|
protectedvirtualinherited |
Internal method for creates a new vertex declaration, may be overridden by certain rendering APIs.
Reimplemented in Ogre::D3D11HardwareBufferManagerBase, and Ogre::D3D9HardwareBufferManagerBase.
void Ogre::GLESHardwareBufferManagerBase::deallocateScratch | ( | void * | ptr | ) |
|
protectedvirtualinherited |
Internal method for destroys all vertex buffer bindings.
|
protectedvirtualinherited |
Internal method for destroys all vertex declarations.
|
virtualinherited |
Destroys a VertexBufferBinding.
Reimplemented in Ogre::HardwareBufferManager.
Referenced by Ogre::HardwareBufferManager::destroyVertexBufferBinding().
|
protectedvirtualinherited |
Internal method for destroys a VertexBufferBinding, may be overridden by certain rendering APIs.
|
virtualinherited |
Destroys a vertex declaration.
Reimplemented in Ogre::HardwareBufferManager.
Referenced by Ogre::HardwareBufferManager::destroyVertexDeclaration().
|
protectedvirtualinherited |
Internal method for destroys a vertex declaration, may be overridden by certain rendering APIs.
Reimplemented in Ogre::D3D11HardwareBufferManagerBase, and Ogre::D3D9HardwareBufferManagerBase.
size_t Ogre::GLESHardwareBufferManagerBase::getGLMapBufferThreshold | ( | ) | const |
Threshold after which glMapBuffer is used and not glBufferSubData.
|
static |
Utility function to get the correct GL type based on VET's.
Referenced by Ogre::GLESHardwareBufferManager::getGLType().
|
static |
Utility function to get the correct GL usage based on HBU's.
Referenced by Ogre::GLESHardwareBufferManager::getGLUsage().
|
protectedvirtualinherited |
Creates a new buffer as a copy of the source, does not copy data.
|
inlineinherited |
Definition at line 95 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 101 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 107 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 112 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 118 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
operator new, with debug line info
Definition at line 67 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 72 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
placement operator new
Definition at line 78 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
array operator new, with debug line info
Definition at line 85 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 90 of file OgreMemoryAllocatedObject.h.
|
virtualinherited |
Registers a vertex buffer as a copy of another.
Reimplemented in Ogre::HardwareBufferManager.
Referenced by Ogre::HardwareBufferManager::registerVertexBufferSourceAndCopy().
|
virtualinherited |
Manually release a vertex buffer copy for others to subsequently use.
bufferCopy | The buffer copy. The caller is expected to delete or at least no longer use this reference, since another user may well begin to modify the contents of the buffer. |
Reimplemented in Ogre::HardwareBufferManager.
Referenced by Ogre::HardwareBufferManager::releaseVertexBufferCopy().
void Ogre::GLESHardwareBufferManagerBase::setGLMapBufferThreshold | ( | const size_t | value | ) |
|
virtualinherited |
Tell engine that the vertex buffer copy intent to reuse.
bufferCopy | The buffer copy. The caller is expected to keep this buffer copy for use. |
Reimplemented in Ogre::HardwareBufferManager.
Referenced by Ogre::HardwareBufferManager::touchVertexBufferCopy().
|
staticprotectedinherited |
Frame delay for BLT_AUTOMATIC_RELEASE temporary buffers.
Definition at line 200 of file OgreHardwareBufferManager.h.
|
protectedinherited |
Map of current available temp buffers.
Definition at line 190 of file OgreHardwareBufferManager.h.
|
protectedinherited |
Definition at line 123 of file OgreHardwareBufferManager.h.
|
protected |
Definition at line 46 of file OgreGLESHardwareBufferManager.h.
|
protected |
Definition at line 44 of file OgreGLESHardwareBufferManager.h.
|
protectedinherited |
Map of currently licensed temporary buffers.
Definition at line 194 of file OgreHardwareBufferManager.h.
|
protectedinherited |
Number of frames elapsed since temporary buffers utilization was above half the available.
Definition at line 196 of file OgreHardwareBufferManager.h.
|
protectedinherited |
Definition at line 129 of file OgreHardwareBufferManager.h.
|
protectedinherited |
Definition at line 122 of file OgreHardwareBufferManager.h.
|
protectedinherited |
Definition at line 128 of file OgreHardwareBufferManager.h.
|
staticprotectedinherited |
Number of frames to wait before free unused temporary buffers.
Definition at line 198 of file OgreHardwareBufferManager.h.