# Ogre::HardwareBufferManager Class Reference
RenderSystem

Singleton wrapper for hardware buffer manager. More...

`#include <OgreHardwareBufferManager.h>`

Inheritance diagram for Ogre::HardwareBufferManager:
[legend]

List of all members.

## Public Types

enum | BufferLicenseType { BLT_MANUAL_RELEASE, BLT_AUTOMATIC_RELEASE }

## Public Member Functions

| HardwareBufferManager (HardwareBufferManagerBase *imp)
| ~HardwareBufferManager ()
HardwareVertexBufferSharedPtr | createVertexBuffer (size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage, bool useShadowBuffer=false)
HardwareIndexBufferSharedPtr | createIndexBuffer (HardwareIndexBuffer::IndexType itype, size_t numIndexes, HardwareBuffer::Usage usage, bool useShadowBuffer=false)
RenderToVertexBufferSharedPtr | createRenderToVertexBuffer ()
virtual VertexDeclaration * | createVertexDeclaration (void)
virtual void | destroyVertexDeclaration (VertexDeclaration *decl)
virtual VertexBufferBinding * | createVertexBufferBinding (void)
virtual void | destroyVertexBufferBinding (VertexBufferBinding *binding)
virtual void | registerVertexBufferSourceAndCopy (const HardwareVertexBufferSharedPtr &sourceBuffer, const HardwareVertexBufferSharedPtr &copy)
virtual HardwareVertexBufferSharedPtr | allocateVertexBufferCopy (const HardwareVertexBufferSharedPtr &sourceBuffer, BufferLicenseType licenseType, HardwareBufferLicensee *licensee, bool copyData=false)
virtual void | releaseVertexBufferCopy (const HardwareVertexBufferSharedPtr &bufferCopy)
virtual void | touchVertexBufferCopy (const HardwareVertexBufferSharedPtr &bufferCopy)
virtual void | _freeUnusedBufferCopies (void)
virtual void | _releaseBufferCopies (bool forceFreeUnused=false)
virtual void | _forceReleaseBufferCopies (const HardwareVertexBufferSharedPtr &sourceBuffer)
virtual void | _forceReleaseBufferCopies (HardwareVertexBuffer *sourceBuffer)
void | _notifyVertexBufferDestroyed (HardwareVertexBuffer *buf)
void | _notifyIndexBufferDestroyed (HardwareIndexBuffer *buf)
void * | operator new (size_t sz, const char *file, int line, const char *func)
| operator new, with debug line info
void * | operator new (size_t sz)
void * | operator new (size_t sz, void *ptr)
| placement operator new
void * | operator new[] (size_t sz, const char *file, int line, const char *func)
| array operator new, with debug line info
void * | operator new[] (size_t sz)
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 *)

## Static Public Member Functions

static HardwareBufferManager & | getSingleton (void)
| Override standard Singleton retrieval.
static HardwareBufferManager * | getSingletonPtr (void)
| Override standard Singleton retrieval.

## Protected Types

typedef set < HardwareVertexBuffer * > ::type | VertexBufferList
| WARNING: The following two members should place before all other members.
typedef set < HardwareIndexBuffer * > ::type | IndexBufferList
typedef set< VertexDeclaration * > ::type | VertexDeclarationList
typedef set < VertexBufferBinding * > ::type | VertexBufferBindingList
typedef multimap < HardwareVertexBuffer *, HardwareVertexBufferSharedPtr > ::type | FreeTemporaryVertexBufferMap
| Map from original buffer to temporary buffers.
typedef map < HardwareVertexBuffer *, VertexBufferLicense >::type | TemporaryVertexBufferLicenseMap
| Map from temporary buffer to details of a license.

## Protected Member Functions

virtual void | destroyAllDeclarations (void)
| Internal method for destroys all vertex declarations.
virtual void | destroyAllBindings (void)
| Internal method for destroys all vertex buffer bindings.
virtual VertexDeclaration * | createVertexDeclarationImpl (void)
| Internal method for creates a new vertex declaration, may be overridden by certain rendering APIs.
virtual void | destroyVertexDeclarationImpl (VertexDeclaration *decl)
| Internal method for destroys a vertex declaration, may be overridden by certain rendering APIs.
virtual VertexBufferBinding * | createVertexBufferBindingImpl (void)
| Internal method for creates a new VertexBufferBinding, may be overridden by certain rendering APIs.
virtual void | destroyVertexBufferBindingImpl (VertexBufferBinding *binding)
| Internal method for destroys a VertexBufferBinding, may be overridden by certain rendering APIs.
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.

## Protected Attributes

HardwareBufferManagerBase * | mImpl
VertexBufferList | mVertexBuffers
IndexBufferList | mIndexBuffers
VertexDeclarationList | mVertexDeclarations
VertexBufferBindingList | mVertexBufferBindings
FreeTemporaryVertexBufferMap | mFreeTempVertexBufferMap
| Map of current available temp buffers.
TemporaryVertexBufferLicenseMap | mTempVertexBufferLicenses
| Map of currently licensed temporary buffers.
size_t | mUnderUsedFrameCount
| Number of frames elapsed since temporary buffers utilization was above half the available.

## Static Protected Attributes

static const size_t | UNDER_USED_FRAME_THRESHOLD
| Number of frames to wait before free unused temporary buffers.
static const size_t | EXPIRED_DELAY_FRAME_THRESHOLD
| Frame delay for BLT_AUTOMATIC_RELEASE temporary buffers.
static HardwareBufferManager * | ms_Singleton

## Friends

class | HardwareVertexBufferSharedPtr
class | HardwareIndexBufferSharedPtr

## Detailed Description

Singleton wrapper for hardware buffer manager.

Definition at line 384 of file OgreHardwareBufferManager.h.

## Member Typedef Documentation

typedef multimap<HardwareVertexBuffer*, HardwareVertexBufferSharedPtr>::type Ogre::HardwareBufferManagerBase::FreeTemporaryVertexBufferMap`[protected, inherited]`

Map from original buffer to temporary buffers.

Definition at line 187 of file OgreHardwareBufferManager.h.

typedef set<HardwareIndexBuffer*>::type Ogre::HardwareBufferManagerBase::IndexBufferList`[protected, inherited]`

Definition at line 120 of file OgreHardwareBufferManager.h.

typedef map<HardwareVertexBuffer*, VertexBufferLicense>::type Ogre::HardwareBufferManagerBase::TemporaryVertexBufferLicenseMap`[protected, inherited]`

Map from temporary buffer to details of a license.

Definition at line 191 of file OgreHardwareBufferManager.h.

typedef set<VertexBufferBinding*>::type Ogre::HardwareBufferManagerBase::VertexBufferBindingList`[protected, inherited]`

Definition at line 126 of file OgreHardwareBufferManager.h.

typedef set<HardwareVertexBuffer*>::type Ogre::HardwareBufferManagerBase::VertexBufferList`[protected, inherited]`

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 119 of file OgreHardwareBufferManager.h.

typedef set<VertexDeclaration*>::type Ogre::HardwareBufferManagerBase::VertexDeclarationList`[protected, inherited]`

Definition at line 125 of file OgreHardwareBufferManager.h.

## Member Enumeration Documentation

enum Ogre::HardwareBufferManagerBase::BufferLicenseType`[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 153 of file OgreHardwareBufferManager.h.

## Constructor & Destructor Documentation

Ogre::HardwareBufferManager::HardwareBufferManager | ( | HardwareBufferManagerBase * | imp | ) |

Ogre::HardwareBufferManager::~HardwareBufferManager | ( |  | ) |

## Member Function Documentation

virtual void Ogre::HardwareBufferManager::_forceReleaseBufferCopies | ( | const HardwareVertexBufferSharedPtr & | sourceBuffer | ) | `[virtual]`

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 477 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::_forceReleaseBufferCopies().

virtual void Ogre::HardwareBufferManager::_forceReleaseBufferCopies | ( | HardwareVertexBuffer * | sourceBuffer | ) | `[virtual]`

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 483 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::_forceReleaseBufferCopies().

virtual void Ogre::HardwareBufferManager::_freeUnusedBufferCopies | ( | void |  | ) | `[virtual]`

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 467 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::_freeUnusedBufferCopies().

void Ogre::HardwareBufferManager::_notifyIndexBufferDestroyed | ( | HardwareIndexBuffer * | buf | ) |

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 493 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::_notifyIndexBufferDestroyed().

void Ogre::HardwareBufferManager::_notifyVertexBufferDestroyed | ( | HardwareVertexBuffer * | buf | ) |

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 488 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::_notifyVertexBufferDestroyed().

virtual void Ogre::HardwareBufferManager::_releaseBufferCopies | ( | bool | forceFreeUnused = `false` | ) | `[virtual]`

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 472 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::_releaseBufferCopies().

virtual HardwareVertexBufferSharedPtr Ogre::HardwareBufferManager::allocateVertexBufferCopy | ( | const HardwareVertexBufferSharedPtr & | sourceBuffer,
|  | BufferLicenseType | licenseType,
|  | HardwareBufferLicensee * | licensee,
|  | bool | copyData = `false`
| ) |  | `[virtual]`

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 444 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::allocateVertexBufferCopy().

HardwareIndexBufferSharedPtr Ogre::HardwareBufferManager::createIndexBuffer | ( | HardwareIndexBuffer::IndexType | itype,
|  | size_t | numIndexes,
|  | HardwareBuffer::Usage | usage,
|  | bool | useShadowBuffer = `false`
| ) |  | `[virtual]`

Implements Ogre::HardwareBufferManagerBase.

Definition at line 403 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::createIndexBuffer().

RenderToVertexBufferSharedPtr Ogre::HardwareBufferManager::createRenderToVertexBuffer | ( |  | ) | `[virtual]`

Implements Ogre::HardwareBufferManagerBase.

Definition at line 410 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::createRenderToVertexBuffer().

HardwareVertexBufferSharedPtr Ogre::HardwareBufferManager::createVertexBuffer | ( | size_t | vertexSize,
|  | size_t | numVerts,
|  | HardwareBuffer::Usage | usage,
|  | bool | useShadowBuffer = `false`
| ) |  | `[virtual]`

Implements Ogre::HardwareBufferManagerBase.

Definition at line 396 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::createVertexBuffer().

virtual VertexBufferBinding* Ogre::HardwareBufferManager::createVertexBufferBinding | ( | void |  | ) | `[virtual]`

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 427 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::createVertexBufferBinding().

virtual VertexBufferBinding* Ogre::HardwareBufferManagerBase::createVertexBufferBindingImpl | ( | void |  | ) | `[protected, virtual, inherited]`

Internal method for creates a new VertexBufferBinding, may be overridden by certain rendering APIs.

virtual VertexDeclaration* Ogre::HardwareBufferManager::createVertexDeclaration | ( | void |  | ) | `[virtual]`

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 416 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::createVertexDeclaration().

virtual VertexDeclaration* Ogre::HardwareBufferManagerBase::createVertexDeclarationImpl | ( | void |  | ) | `[protected, virtual, inherited]`

Internal method for creates a new vertex declaration, may be overridden by certain rendering APIs.

virtual void Ogre::HardwareBufferManagerBase::destroyAllBindings | ( | void |  | ) | `[protected, virtual, inherited]`

Internal method for destroys all vertex buffer bindings.

virtual void Ogre::HardwareBufferManagerBase::destroyAllDeclarations | ( | void |  | ) | `[protected, virtual, inherited]`

Internal method for destroys all vertex declarations.

virtual void Ogre::HardwareBufferManager::destroyVertexBufferBinding | ( | VertexBufferBinding * | binding | ) | `[virtual]`

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 432 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::destroyVertexBufferBinding().

virtual void Ogre::HardwareBufferManagerBase::destroyVertexBufferBindingImpl | ( | VertexBufferBinding * | binding | ) | `[protected, virtual, inherited]`

Internal method for destroys a VertexBufferBinding, may be overridden by certain rendering APIs.

virtual void Ogre::HardwareBufferManager::destroyVertexDeclaration | ( | VertexDeclaration * | decl | ) | `[virtual]`

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 421 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::destroyVertexDeclaration().

virtual void Ogre::HardwareBufferManagerBase::destroyVertexDeclarationImpl | ( | VertexDeclaration * | decl | ) | `[protected, virtual, inherited]`

Internal method for destroys a vertex declaration, may be overridden by certain rendering APIs.

static HardwareBufferManager& Ogre::HardwareBufferManager::getSingleton | ( | void |  | ) | `[static]`

Override standard Singleton retrieval.

Remarks:
  Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.

  This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< HardwareBufferManager >.

static HardwareBufferManager* Ogre::HardwareBufferManager::getSingletonPtr | ( | void |  | ) | `[static]`

Override standard Singleton retrieval.

Remarks:
  Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.

  This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< HardwareBufferManager >.

virtual HardwareVertexBufferSharedPtr Ogre::HardwareBufferManagerBase::makeBufferCopy | ( | const HardwareVertexBufferSharedPtr & | source,
|  | HardwareBuffer::Usage | usage,
|  | bool | useShadowBuffer
| ) |  | `[protected, virtual, inherited]`

Creates a new buffer as a copy of the source, does not copy data.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr | ) | `[inherited]`

Definition at line 95 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |
| ) |  | `[inherited]`

Definition at line 107 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | void * |
| ) |  | `[inherited]`

Definition at line 101 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr,
|  | const char * | ,
|  | int | ,
|  | const char * |
| ) |  | `[inherited]`

Definition at line 118 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr | ) | `[inherited]`

Definition at line 112 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz | ) | `[inherited]`

Definition at line 72 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | void * | ptr
| ) |  | `[inherited]`

placement operator new

Definition at line 78 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz,
|  | const char * | file,
|  | int | line,
|  | const char * | func
| ) |  | `[inherited]`

operator new, with debug line info

Definition at line 67 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz | ) | `[inherited]`

Definition at line 90 of file OgreMemoryAllocatedObject.h.

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz,
|  | const char * | file,
|  | int | line,
|  | const char * | func
| ) |  | `[inherited]`

array operator new, with debug line info

Definition at line 85 of file OgreMemoryAllocatedObject.h.

virtual void Ogre::HardwareBufferManager::registerVertexBufferSourceAndCopy | ( | const HardwareVertexBufferSharedPtr & | sourceBuffer,
|  | const HardwareVertexBufferSharedPtr & | copy
| ) |  | `[virtual]`

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 437 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::registerVertexBufferSourceAndCopy().

virtual void Ogre::HardwareBufferManager::releaseVertexBufferCopy | ( | const HardwareVertexBufferSharedPtr & | bufferCopy | ) | `[virtual]`

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 453 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::releaseVertexBufferCopy().

virtual void Ogre::HardwareBufferManager::touchVertexBufferCopy | ( | const HardwareVertexBufferSharedPtr & | bufferCopy | ) | `[virtual]`

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 460 of file OgreHardwareBufferManager.h.

References Ogre::HardwareBufferManagerBase::touchVertexBufferCopy().

## Friends And Related Function Documentation

friend class HardwareIndexBufferSharedPtr`[friend]`

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 387 of file OgreHardwareBufferManager.h.

friend class HardwareVertexBufferSharedPtr`[friend]`

Reimplemented from Ogre::HardwareBufferManagerBase.

Definition at line 386 of file OgreHardwareBufferManager.h.

## Member Data Documentation

const size_t Ogre::HardwareBufferManagerBase::EXPIRED_DELAY_FRAME_THRESHOLD`[static, protected, inherited]`

Frame delay for BLT_AUTOMATIC_RELEASE temporary buffers.

Definition at line 199 of file OgreHardwareBufferManager.h.

FreeTemporaryVertexBufferMap Ogre::HardwareBufferManagerBase::mFreeTempVertexBufferMap`[protected, inherited]`

Map of current available temp buffers.

Definition at line 189 of file OgreHardwareBufferManager.h.

HardwareBufferManagerBase* Ogre::HardwareBufferManager::mImpl`[protected]`

Definition at line 389 of file OgreHardwareBufferManager.h.

IndexBufferList Ogre::HardwareBufferManagerBase::mIndexBuffers`[protected, inherited]`

Definition at line 122 of file OgreHardwareBufferManager.h.

HardwareBufferManager * Ogre::Singleton< HardwareBufferManager >::ms_Singleton`[static, protected, inherited]`

Definition at line 75 of file OgreSingleton.h.

TemporaryVertexBufferLicenseMap Ogre::HardwareBufferManagerBase::mTempVertexBufferLicenses`[protected, inherited]`

Map of currently licensed temporary buffers.

Definition at line 193 of file OgreHardwareBufferManager.h.

size_t Ogre::HardwareBufferManagerBase::mUnderUsedFrameCount`[protected, inherited]`

Number of frames elapsed since temporary buffers utilization was above half the available.

Definition at line 195 of file OgreHardwareBufferManager.h.

VertexBufferBindingList Ogre::HardwareBufferManagerBase::mVertexBufferBindings`[protected, inherited]`

Definition at line 128 of file OgreHardwareBufferManager.h.

VertexBufferList Ogre::HardwareBufferManagerBase::mVertexBuffers`[protected, inherited]`

Definition at line 121 of file OgreHardwareBufferManager.h.

VertexDeclarationList Ogre::HardwareBufferManagerBase::mVertexDeclarations`[protected, inherited]`

Definition at line 127 of file OgreHardwareBufferManager.h.

const size_t Ogre::HardwareBufferManagerBase::UNDER_USED_FRAME_THRESHOLD`[static, protected, inherited]`

Number of frames to wait before free unused temporary buffers.

Definition at line 197 of file OgreHardwareBufferManager.h.

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

- OgreHardwareBufferManager.h

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun May 8 2011 20:28:12