Go to the documentation of this file.
28 #ifndef __HardwareBufferManager__
29 #define __HardwareBufferManager__
90 void extractFrom(
const VertexData* sourceData);
92 void checkoutTempCopies(
bool positions =
true,
bool normals =
true);
94 void bindTempCopies(
VertexData* targetData,
bool suppressHardwareUpload);
98 bool buffersCheckedOut(
bool positions =
true,
bool normals =
true)
const;
147 virtual void destroyAllDeclarations(
void);
149 virtual void destroyAllBindings(
void);
168 BLT_AUTOMATIC_RELEASE
187 : originalBufferPtr(orig)
189 , expiredDelay(delay)
256 bool useShadowBuffer =
false) = 0;
294 bool useShadowBuffer =
false,
const String& name =
"") = 0;
302 bool useShadowBuffer =
false,
const String& name =
"") = 0;
319 virtual void registerVertexBufferSourceAndCopy(
347 bool copyData =
false);
358 virtual void releaseVertexBufferCopy(
383 virtual void _freeUnusedBufferCopies(
void);
392 virtual void _releaseBufferCopies(
bool forceFreeUnused =
false);
442 bool useShadowBuffer =
false)
507 bool copyData =
false)
608 #endif // __HardwareBufferManager__
void _notifyIndexBufferDestroyed(HardwareIndexBuffer *buf)
Notification that a hardware index buffer has been destroyed.
virtual HardwareUniformBufferSharedPtr createUniformBuffer(size_t sizeBytes, HardwareBuffer::Usage usage=HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE, bool useShadowBuffer=false, const String &name="")=0
Create uniform buffer.
Shared pointer implementation used to share counter buffers.
HardwareBufferLicensee * licensee
virtual void registerVertexBufferSourceAndCopy(const HardwareVertexBufferSharedPtr &sourceBuffer, const HardwareVertexBufferSharedPtr ©)
Registers a vertex buffer as a copy of another.
HardwareUniformBufferSharedPtr createUniformBuffer(size_t sizeBytes, HardwareBuffer::Usage usage, bool useShadowBuffer, const String &name="")
Create uniform buffer.
HardwareIndexBufferSharedPtr createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes, HardwareBuffer::Usage usage, bool useShadowBuffer=false)
Create a hardware index buffer.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
VertexDeclarationList mVertexDeclarations
set< VertexDeclaration * >::type VertexDeclarationList
virtual void releaseVertexBufferCopy(const HardwareVertexBufferSharedPtr &bufferCopy)
Manually release a vertex buffer copy for others to subsequently use.
virtual void _freeUnusedBufferCopies(void)
Free all unused vertex buffer copies.
bool posNormalShareBuffer
Both positions and normals are contained in the same buffer.
static const size_t EXPIRED_DELAY_FRAME_THRESHOLD
Frame delay for BLT_AUTOMATIC_RELEASE temporary buffers.
VertexBufferList mVertexBuffers
virtual RenderToVertexBufferSharedPtr createRenderToVertexBuffer()=0
Create a render to vertex buffer.
HardwareCounterBufferSharedPtr createCounterBuffer(size_t sizeBytes, HardwareBuffer::Usage usage, bool useShadowBuffer, const String &name="")
Create counter buffer.
TemporaryVertexBufferLicenseMap mTempVertexBufferLicenses
Map of currently licensed temporary buffers.
virtual void _releaseBufferCopies(bool forceFreeUnused=false)
Internal method for releasing all temporary buffers which have been allocated using BLT_AUTOMATIC_REL...
VertexBufferBindingList mVertexBufferBindings
set< HardwareVertexBuffer * >::type VertexBufferList
WARNING: The following two members should place before all other members.
Base definition of a hardware buffer manager.
virtual VertexDeclaration * createVertexDeclaration(void)
Creates a new vertex declaration.
IndexBufferList mIndexBuffers
set< HardwareUniformBuffer * >::type UniformBufferList
virtual VertexBufferBinding * createVertexBufferBinding(void)
Creates a new VertexBufferBinding.
HardwareVertexBufferSharedPtr srcNormalBuffer
Specialisation of HardwareBuffer for a counter buffer.
virtual HardwareCounterBufferSharedPtr createCounterBuffer(size_t sizeBytes, HardwareBuffer::Usage usage=HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE, bool useShadowBuffer=false, const String &name="")=0
Create counter buffer.
void _notifyVertexBufferDestroyed(HardwareVertexBuffer *buf)
Notification that a hardware vertex buffer has been destroyed.
multimap< HardwareVertexBuffer *, HardwareVertexBufferSharedPtr >::type FreeTemporaryVertexBufferMap
Map from original buffer to temporary buffers.
Shared pointer implementation used to share index buffers.
void _notifyIndexBufferDestroyed(HardwareIndexBuffer *buf)
Notification that a hardware index buffer has been destroyed.
virtual void _forceReleaseBufferCopies(const HardwareVertexBufferSharedPtr &sourceBuffer)
Internal method that forces the release of copies of a given buffer.
FreeTemporaryVertexBufferMap mFreeTempVertexBufferMap
Map of current available temp buffers.
map< HardwareVertexBuffer *, VertexBufferLicense >::type TemporaryVertexBufferLicenseMap
Map from temporary buffer to details of a license.
set< HardwareIndexBuffer * >::type IndexBufferList
Abstract interface representing a 'licensee' of a hardware buffer copy.
static const size_t UNDER_USED_FRAME_THRESHOLD
Number of frames to wait before free unused temporary buffers.
Summary class collecting together vertex source information.
Records the state of all the vertex buffer bindings required to provide a vertex declaration with the...
RenderToVertexBufferSharedPtr createRenderToVertexBuffer()
Create a render to vertex buffer.
Specialisation of HardwareBuffer for vertex index buffers, still abstract.
set< VertexBufferBinding * >::type VertexBufferBindingList
virtual void registerVertexBufferSourceAndCopy(const HardwareVertexBufferSharedPtr &sourceBuffer, const HardwareVertexBufferSharedPtr ©)
Registers a vertex buffer as a copy of another.
HardwareVertexBuffer * originalBufferPtr
This class declares the format of a set of vertex inputs, which can be issued to the rendering API th...
Shared pointer implementation used to share vertex buffers.
virtual HardwareVertexBufferSharedPtr allocateVertexBufferCopy(const HardwareVertexBufferSharedPtr &sourceBuffer, BufferLicenseType licenseType, HardwareBufferLicensee *licensee, bool copyData=false)
Allocates a copy of a given vertex buffer.
HardwareVertexBufferSharedPtr destPositionBuffer
virtual void _freeUnusedBufferCopies(void)
Free all unused vertex buffer copies.
virtual HardwareIndexBufferSharedPtr createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes, HardwareBuffer::Usage usage, bool useShadowBuffer=false)=0
Create a hardware index buffer.
Template class for creating single-instance global classes.
unsigned short posBindIndex
Singleton wrapper for hardware buffer manager.
HardwareVertexBufferSharedPtr buffer
UniformBufferList mUniformBuffers
virtual void destroyVertexBufferBinding(VertexBufferBinding *binding)
Destroys a VertexBufferBinding.
virtual ~HardwareBufferLicensee()
HardwareBufferManagerBase * mImpl
VertexBufferLicense(HardwareVertexBuffer *orig, BufferLicenseType ltype, size_t delay, HardwareVertexBufferSharedPtr buf, HardwareBufferLicensee *lic)
virtual VertexDeclaration * createVertexDeclaration(void)
virtual void _releaseBufferCopies(bool forceFreeUnused=false)
Internal method for releasing all temporary buffers which have been allocated using BLT_AUTOMATIC_REL...
virtual void destroyVertexBufferBinding(VertexBufferBinding *binding)
Destroys a VertexBufferBinding.
virtual void touchVertexBufferCopy(const HardwareVertexBufferSharedPtr &bufferCopy)
Tell engine that the vertex buffer copy intent to reuse.
Reference-counted shared pointer, used for objects where implicit destruction is required.
virtual void destroyVertexDeclaration(VertexDeclaration *decl)
Destroys a vertex declaration.
void _notifyUniformBufferDestroyed(HardwareUniformBuffer *buf)
unsigned short normBindIndex
Abstract class defining common features of hardware buffers.
CounterBufferList mCounterBuffers
void _notifyUniformBufferDestroyed(HardwareUniformBuffer *buf)
Notification that at hardware uniform buffer has been destroyed.
virtual void destroyVertexDeclaration(VertexDeclaration *decl)
Destroys a vertex declaration.
virtual void _forceReleaseBufferCopies(const HardwareVertexBufferSharedPtr &sourceBuffer)
Internal method that forces the release of copies of a given buffer.
Structure for recording the use of temporary blend buffers.
BufferLicenseType licenseType
Combination of HBU_DYNAMIC, HBU_WRITE_ONLY and HBU_DISCARDABLE.
Specialisation of HardwareBuffer for a vertex buffer.
void _notifyConterBufferDestroyed(HardwareCounterBuffer *buf)
virtual HardwareVertexBufferSharedPtr allocateVertexBufferCopy(const HardwareVertexBufferSharedPtr &sourceBuffer, BufferLicenseType licenseType, HardwareBufferLicensee *licensee, bool copyData=false)
Allocates a copy of a given vertex buffer.
Usage
Enums describing buffer usage; not mutually exclusive.
HardwareVertexBufferSharedPtr createVertexBuffer(size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage, bool useShadowBuffer=false)
Create a hardware vertex buffer.
HardwareVertexBufferSharedPtr destNormalBuffer
virtual void _forceReleaseBufferCopies(HardwareVertexBuffer *sourceBuffer)
Internal method that forces the release of copies of a given buffer.
virtual void touchVertexBufferCopy(const HardwareVertexBufferSharedPtr &bufferCopy)
Tell engine that the vertex buffer copy intent to reuse.
virtual HardwareVertexBufferSharedPtr createVertexBuffer(size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage, bool useShadowBuffer=false)=0
Create a hardware vertex buffer.
void _notifyVertexBufferDestroyed(HardwareVertexBuffer *buf)
Notification that a hardware vertex buffer has been destroyed.
virtual void releaseVertexBufferCopy(const HardwareVertexBufferSharedPtr &bufferCopy)
Manually release a vertex buffer copy for others to subsequently use.
size_t mUnderUsedFrameCount
Number of frames elapsed since temporary buffers utilization was above half the available.
HardwareVertexBufferSharedPtr srcPositionBuffer
Licensee will only release buffer when it says so.
void _notifyCounterBufferDestroyed(HardwareCounterBuffer *buf)
Notification that at hardware counter buffer has been destroyed.
Struct holding details of a license to use a temporary shared buffer.
virtual VertexBufferBinding * createVertexBufferBinding(void)
Creates a new VertexBufferBinding.
set< HardwareCounterBuffer * >::type CounterBufferList
Copyright © 2012 Torus Knot Software Ltd

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.