*/
// INTERNAL INCLUDES
+#include <dali/integration-api/gl-defines.h>
#include <dali/public-api/common/map-wrapper.h>
-#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/actors/renderable-actor.h>
#include <dali/integration-api/debug.h>
#include <dali/integration-api/gl-abstraction.h>
class Context
{
public:
-
/**
* Size of the VertexAttributeArray enables
* GLES specification states that there's minimum of 8
*/
static const unsigned int MAX_ATTRIBUTE_CACHE_SIZE = 8;
+ static const unsigned int MAX_TEXTURE_UNITS = 8; // for GLES 2.0 its 8, which is more than DALi uses anyways
+
/**
* Creates the Dali Context object.
* This method does not create an OpenGL context i.e. that is done from outside dali-core.
void GlContextCreated();
/**
- * Called when the GL context is about to be destroyed.
+ * Called when the GL context has been destroyed.
*/
void GlContextDestroyed();
*/
void DeleteBuffers(GLsizei n, const GLuint* buffers)
{
- // TODO: this is to prevent mesh destructor from doing GL calls when DALi core is being deleted
+ // @todo: this is to prevent mesh destructor from doing GL calls when DALi core is being deleted
// can be taken out once render manages either knows about meshes or gpubuffers and can tell them directly that context is lost
if( this->IsGlContextCreated() )
{
// reset the cached texture id's incase the driver re-uses them
// when creating new textures
- for( int i=0; i < mMaxTextureUnits; ++i )
+ for( unsigned int i=0; i < MAX_TEXTURE_UNITS; ++i )
{
mBound2dTextureId[ i ] = 0;
}
*/
GLint CachedNumberOfProgramBinaryFormats() const
{
- return mProgramBinaryFormats.size();
+ return mProgramBinaryFormats.Count();
}
/**
*/
GLint CachedProgramBinaryFormat( const unsigned int formatIndex = 0 ) const
{
- DALI_ASSERT_ALWAYS( formatIndex < mProgramBinaryFormats.size() && "formatIndex out of bounds");
+ DALI_ASSERT_ALWAYS( formatIndex < mProgramBinaryFormats.Count() && "formatIndex out of bounds");
return mProgramBinaryFormats[ formatIndex ];
}
}
/**
+ * Reset the program matrices
+ */
+ void ResetProgramMatrices();
+
+ /**
* Get a cached program
* @param [in] hash value
* @return pointer to the program
#endif // DEBUG_ENABLED
+
+ /**
+ * Set the frame count of render thread
+ */
+ inline void SetFrameCount(unsigned int frameCount)
+ {
+ mFrameCount = frameCount;
+ }
+
+ /**
+ * Get the frame count
+ */
+ inline unsigned int GetFrameCount()
+ {
+ return mFrameCount;
+ }
+
+ /**
+ * Increment the count of culled renderers
+ */
+ inline void IncrementCulledCount()
+ {
+ mCulledCount++;
+ }
+
+ /**
+ * Clear the count of culled renderers
+ */
+ inline void ClearCulledCount()
+ {
+ mCulledCount = 0;
+ }
+
+ /**
+ * Get the count of culled renderers in this frame
+ */
+ inline unsigned int GetCulledCount()
+ {
+ return mCulledCount;
+ }
+
+ /**
+ * Increment the count of culled renderers
+ */
+ inline void IncrementRendererCount()
+ {
+ mRendererCount++;
+ }
+
+ /**
+ * Clear the count of image renderers
+ */
+ inline void ClearRendererCount()
+ {
+ mRendererCount = 0;
+ }
+
+ /**
+ * Get the count of image renderers in this frame
+ */
+ inline unsigned int GetRendererCount()
+ {
+ return mRendererCount;
+ }
+
+
private: // Implementation
/**
// glBindTexture() state
unsigned int mActiveTextureUnit;
- std::vector<GLuint> mBound2dTextureId; ///< The ID passed to glBindTexture(GL_TEXTURE_2D)
+ GLuint mBound2dTextureId[ MAX_TEXTURE_UNITS ]; ///< The ID passed to glBindTexture(GL_TEXTURE_2D)
// glBlendColor() state
bool mUsingDefaultBlendColor;
GLenum mBlendEquationSeparateModeAlpha; ///< Controls Alpha blend mode
GLint mMaxTextureSize; ///< return value from GetIntegerv(GL_MAX_TEXTURE_SIZE)
- GLint mMaxTextureUnits; ///< return value from GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS)
Vector4 mClearColor; ///< clear color
- std::vector<GLint> mProgramBinaryFormats; ///< array of supported program binary formats
+ Dali::Vector<GLint> mProgramBinaryFormats; ///< array of supported program binary formats
// Face culling mode
CullFaceMode mCullFaceMode;
Program* mCurrentProgram;
typedef std::map< std::size_t, Program* > ProgramContainer;
- ProgramContainer mProgramCache; /// program cache
-
+ ProgramContainer mProgramCache; ///< Cache of shader programs
+ unsigned int mFrameCount; ///< Number of render frames
+ unsigned int mCulledCount; ///< Number of culled renderers per frame
+ unsigned int mRendererCount; ///< Number of image renderers per frame
};
} // namespace Internal