Dali 3D User Interface Engine
List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
Dali::Internal::FrameBufferStateCache Class Reference

Keeps track of color, depth and stencil buffer state within each frame buffer. More...

#include <frame-buffer-state-cache.h>

Collaboration diagram for Dali::Internal::FrameBufferStateCache:
Collaboration graph
[legend]

Classes

struct  FrameBufferState
 POD to store the status of frame buffer regarding color,depth and stencil buffers. More...
 

Public Member Functions

 FrameBufferStateCache ()
 Constructor. More...
 
 ~FrameBufferStateCache ()
 non-virtual destructor More...
 
GLbitfield GetClearMask (GLbitfield mask, bool forceClear, bool scissorTestEnabled)
 Get the bitmask to pass to glClear based on the mask requested and the current state of the frame buffer. More...
 
void SetCurrentFrameBuffer (GLuint frameBufferId)
 Set the current bound frame buffer. More...
 
void FrameBuffersDeleted (GLsizei count, const GLuint *const frameBuffers)
 Called when frame buffers are deleted. More...
 
void FrameBuffersCreated (GLsizei count, const GLuint *const frameBuffers)
 Called when frame buffers are created. More...
 
void DrawOperation (bool colorBufferUsed, bool depthBufferUsed, bool stencilBufferUsed)
 Draw operation performed on the current frame buffer. More...
 
void Reset ()
 Reset the cache. More...
 

Private Types

enum  FrameBufferStatus { COLOR_BUFFER_CLEAN = 1 << 0, DEPTH_BUFFER_CLEAN = 1 << 1, STENCIL_BUFFER_CLEAN = 1 << 2 }
 Current status of the frame buffer. More...
 
typedef Dali::Vector
< FrameBufferState
FrameBufferStateVector
 

Private Member Functions

void SetClearState (FrameBufferState *state, GLbitfield mask)
 Set the clear state. More...
 
FrameBufferStateGetFrameBufferState (GLuint frameBufferId)
 Helper. More...
 
void DeleteFrameBuffer (GLuint frameBufferId)
 Helper to delete a frame buffer state object. More...
 
unsigned int GetInitialFrameBufferState ()
 Get the default state of a frame buffer, before it's used. More...
 
 FrameBufferStateCache (const FrameBufferStateCache &)
 undefined copy constructor More...
 
FrameBufferStateCacheoperator= (const FrameBufferStateCache &)
 undefined assignment operator More...
 

Private Attributes

FrameBufferStateVector mFrameBufferStates
 state of the frame buffers More...
 
GLuint mCurrentFrameBufferId
 currently bound frame buffer More...
 

Detailed Description

Keeps track of color, depth and stencil buffer state within each frame buffer.

Used to avoid redundant glClear calls.

Definition at line 36 of file frame-buffer-state-cache.h.

Member Typedef Documentation

Definition at line 123 of file frame-buffer-state-cache.h.

Member Enumeration Documentation

Current status of the frame buffer.

Enumerator
COLOR_BUFFER_CLEAN 

color buffer clean

DEPTH_BUFFER_CLEAN 

depth buffer clean

STENCIL_BUFFER_CLEAN 

stencil buffer clean

Definition at line 99 of file frame-buffer-state-cache.h.

Constructor & Destructor Documentation

Dali::Internal::FrameBufferStateCache::FrameBufferStateCache ( )

Constructor.

Definition at line 31 of file frame-buffer-state-cache.cpp.

Dali::Internal::FrameBufferStateCache::~FrameBufferStateCache ( )

non-virtual destructor

Definition at line 36 of file frame-buffer-state-cache.cpp.

Dali::Internal::FrameBufferStateCache::FrameBufferStateCache ( const FrameBufferStateCache )
private

undefined copy constructor

Member Function Documentation

void Dali::Internal::FrameBufferStateCache::DeleteFrameBuffer ( GLuint  frameBufferId)
private

Helper to delete a frame buffer state object.

Parameters
[in]frameBufferIdframe buffer id

Definition at line 200 of file frame-buffer-state-cache.cpp.

References Dali::Vector< T, IsTrivialType >::Begin(), DALI_LOG_ERROR, Dali::Vector< T, IsTrivialType >::End(), Dali::Vector< T, IsTrivialType >::Erase(), and mFrameBufferStates.

Referenced by FrameBuffersDeleted().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::FrameBufferStateCache::DrawOperation ( bool  colorBufferUsed,
bool  depthBufferUsed,
bool  stencilBufferUsed 
)

Draw operation performed on the current frame buffer.

Parameters
[in]colorBufferUsedwhether the color buffer is being written to (glColorMask )
[in]depthBufferUsedwhether the depth buffer is being written to (glDepthMask )
[in]stencilBufferUsedwhether the stencil buffer is being written to (glStencilMask )

Definition at line 132 of file frame-buffer-state-cache.cpp.

References COLOR_BUFFER_CLEAN, DEPTH_BUFFER_CLEAN, GetFrameBufferState(), mCurrentFrameBufferId, Dali::Internal::FrameBufferStateCache::FrameBufferState::mState, and STENCIL_BUFFER_CLEAN.

Referenced by Dali::Internal::Context::DrawArrays(), Dali::Internal::Context::DrawArraysInstanced(), Dali::Internal::Context::DrawBuffers(), Dali::Internal::Context::DrawElements(), Dali::Internal::Context::DrawElementsInstanced(), and Dali::Internal::Context::DrawRangeElements().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::FrameBufferStateCache::FrameBuffersCreated ( GLsizei  count,
const GLuint *const  frameBuffers 
)

Called when frame buffers are created.

Parameters
[in]countnumber of frame buffers
[in]framebuffersarray of frame buffer ids

Definition at line 111 of file frame-buffer-state-cache.cpp.

References DALI_LOG_ERROR, GetFrameBufferState(), GetInitialFrameBufferState(), mFrameBufferStates, Dali::Internal::FrameBufferStateCache::FrameBufferState::mState, and Dali::Vector< T, IsTrivialType >::PushBack().

Referenced by Dali::Internal::Context::GenFramebuffers(), and Reset().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::FrameBufferStateCache::FrameBuffersDeleted ( GLsizei  count,
const GLuint *const  frameBuffers 
)

Called when frame buffers are deleted.

Parameters
[in]countnumber of frame buffers
[in]framebuffersarray of frame buffer ids

Definition at line 104 of file frame-buffer-state-cache.cpp.

References DeleteFrameBuffer().

Referenced by Dali::Internal::Context::DeleteFramebuffers().

Here is the call graph for this function:

Here is the caller graph for this function:

GLbitfield Dali::Internal::FrameBufferStateCache::GetClearMask ( GLbitfield  mask,
bool  forceClear,
bool  scissorTestEnabled 
)

Get the bitmask to pass to glClear based on the mask requested and the current state of the frame buffer.

Parameters
[in]maskglClear bit mask
[in]forceClearwhether to force the clear ( ignore cached state)
[in]scissorTestEnabledwhether scissor test is enabled
Returns
new bitmask to pass to glClear

Definition at line 40 of file frame-buffer-state-cache.cpp.

References COLOR_BUFFER_CLEAN, DALI_LOG_ERROR, DEPTH_BUFFER_CLEAN, GetFrameBufferState(), GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT, mCurrentFrameBufferId, Dali::Internal::FrameBufferStateCache::FrameBufferState::mState, SetClearState(), and STENCIL_BUFFER_CLEAN.

Referenced by Dali::Internal::Context::Clear().

Here is the call graph for this function:

Here is the caller graph for this function:

FrameBufferStateCache::FrameBufferState * Dali::Internal::FrameBufferStateCache::GetFrameBufferState ( GLuint  frameBufferId)
private

Helper.

Parameters
[in]frameBufferIdframe buffer id
Returns
pointer to frame buffer state object ( NULL if it doesn't exist)

Definition at line 187 of file frame-buffer-state-cache.cpp.

References Dali::VectorBase::Count(), mFrameBufferStates, and Dali::Internal::FrameBufferStateCache::FrameBufferState::mId.

Referenced by DrawOperation(), FrameBuffersCreated(), and GetClearMask().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int Dali::Internal::FrameBufferStateCache::GetInitialFrameBufferState ( )
private

Get the default state of a frame buffer, before it's used.

Returns
initial state

Definition at line 216 of file frame-buffer-state-cache.cpp.

References COLOR_BUFFER_CLEAN, DEPTH_BUFFER_CLEAN, and STENCIL_BUFFER_CLEAN.

Referenced by FrameBuffersCreated().

Here is the caller graph for this function:

FrameBufferStateCache& Dali::Internal::FrameBufferStateCache::operator= ( const FrameBufferStateCache )
private

undefined assignment operator

void Dali::Internal::FrameBufferStateCache::Reset ( )

Reset the cache.

Definition at line 159 of file frame-buffer-state-cache.cpp.

References Dali::Vector< T, IsTrivialType >::Clear(), FrameBuffersCreated(), and mFrameBufferStates.

Referenced by Dali::Internal::Context::InitializeGlState().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::FrameBufferStateCache::SetClearState ( FrameBufferState state,
GLbitfield  mask 
)
private

Set the clear state.

Parameters
[in]pointerto frame buffer state object
[in]maskclear mask

Definition at line 168 of file frame-buffer-state-cache.cpp.

References COLOR_BUFFER_CLEAN, DEPTH_BUFFER_CLEAN, GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT, GL_STENCIL_BUFFER_BIT, Dali::Internal::FrameBufferStateCache::FrameBufferState::mState, and STENCIL_BUFFER_CLEAN.

Referenced by GetClearMask().

Here is the caller graph for this function:

void Dali::Internal::FrameBufferStateCache::SetCurrentFrameBuffer ( GLuint  frameBufferId)

Set the current bound frame buffer.

Parameters
[in]frameBufferIdframe buffer id

Definition at line 99 of file frame-buffer-state-cache.cpp.

References mCurrentFrameBufferId.

Referenced by Dali::Internal::Context::BindFramebuffer().

Here is the caller graph for this function:

Member Data Documentation

GLuint Dali::Internal::FrameBufferStateCache::mCurrentFrameBufferId
private

currently bound frame buffer

Definition at line 158 of file frame-buffer-state-cache.h.

Referenced by DrawOperation(), GetClearMask(), and SetCurrentFrameBuffer().

FrameBufferStateVector Dali::Internal::FrameBufferStateCache::mFrameBufferStates
private

state of the frame buffers

Definition at line 157 of file frame-buffer-state-cache.h.

Referenced by DeleteFrameBuffer(), FrameBuffersCreated(), GetFrameBufferState(), and Reset().


The documentation for this class was generated from the following files:
Dali Docs Home
Read more about Dali