OGRE-Next  3.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::ConstBufferPool Class Reference

Maintains a pool of buffers grouped by hash ID. More...

#include <OgreConstBufferPool.h>


struct  BufferPool
struct  ExtraBufferParams

Public Types

enum  DirtyFlags { DirtyNone = 0u , DirtyConstBuffer = 1u << 0u , DirtyTextures = 1u << 1u , DirtySamplers = 1u << 2u }
enum  OptimizationStrategy { LowerCpuOverhead , LowerGpuOverhead }

Public Member Functions

 ConstBufferPool (uint32 bytesPerSlot, const ExtraBufferParams &extraBufferParams)
virtual ~ConstBufferPool ()
virtual void _changeRenderSystem (RenderSystem *newRs)
OptimizationStrategy getOptimizationStrategy () const
size_t getPoolIndex (ConstBufferPoolUser *user) const
 Gets an ID corresponding to the pool this user was assigned to, unique per hash. More...
void releaseSlot (ConstBufferPoolUser *user)
 Releases a slot requested with requestSlot. More...
void requestSlot (uint32 hash, ConstBufferPoolUser *user, bool wantsExtraBuffer)
 Requests a slot and fills 'user'. Automatically schedules for update. More...
void scheduleForUpdate (ConstBufferPoolUser *dirtyUser, uint8 dirtyFlags=DirtyConstBuffer)
virtual void setOptimizationStrategy (OptimizationStrategy optimizationStrategy)
 Sets the optimization strategy. More...

Detailed Description

Maintains a pool of buffers grouped by hash ID.

Keeping them separated by hash prevents mixing materials in the same buffer (which has limited space) that could never be batched together in the same draw call.

When a buffer is full and has used all of its free slots, a new buffer is allocated.

Member Enumeration Documentation

◆ DirtyFlags


◆ OptimizationStrategy


Optimize for low CPU overhead.

Use this on slow CPUs (i.e. older AMD CPU models) or if CPU is the bottleneck. This strategy is optimized for having a lot of different materials. Default on Desktop.


Optimize for low GPU overhead.

Use this if GPU is the bottleneck. This strategy performs best when you have few materials. Do not enable this mode blindly unless you've profiled and it gives you important benefits. Default on mobile.

Constructor & Destructor Documentation

◆ ConstBufferPool()

Ogre::ConstBufferPool::ConstBufferPool ( uint32  bytesPerSlot,
const ExtraBufferParams extraBufferParams 

◆ ~ConstBufferPool()

virtual Ogre::ConstBufferPool::~ConstBufferPool ( )

Member Function Documentation

◆ _changeRenderSystem()

virtual void Ogre::ConstBufferPool::_changeRenderSystem ( RenderSystem newRs)

◆ getOptimizationStrategy()

OptimizationStrategy Ogre::ConstBufferPool::getOptimizationStrategy ( ) const

◆ getPoolIndex()

size_t Ogre::ConstBufferPool::getPoolIndex ( ConstBufferPoolUser user) const

Gets an ID corresponding to the pool this user was assigned to, unique per hash.

◆ releaseSlot()

void Ogre::ConstBufferPool::releaseSlot ( ConstBufferPoolUser user)

Releases a slot requested with requestSlot.

◆ requestSlot()

void Ogre::ConstBufferPool::requestSlot ( uint32  hash,
ConstBufferPoolUser user,
bool  wantsExtraBuffer 

Requests a slot and fills 'user'. Automatically schedules for update.

◆ scheduleForUpdate()

void Ogre::ConstBufferPool::scheduleForUpdate ( ConstBufferPoolUser dirtyUser,
uint8  dirtyFlags = DirtyConstBuffer 

◆ setOptimizationStrategy()

virtual void Ogre::ConstBufferPool::setOptimizationStrategy ( OptimizationStrategy  optimizationStrategy)

Sets the optimization strategy.

See OptimizationStrategy.

Changing the optimization strategy on the fly will trigger a massive shader recompilation.
Implementations that don't support different strategies can overload this function.

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