#include <dali/internal/render/common/render-manager.h>
#include <dali/integration-api/debug.h>
-using namespace std;
-
namespace Dali
{
#ifdef DEBUG_ENABLED
Debug::Filter* Context::gGlLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_CONTEXT");
+Debug::Filter* gContextLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_CONTEXT_META");
#endif
Context::Context(Integration::GlAbstraction& glAbstraction)
mBlendEquationSeparateModeRGB( GL_FUNC_ADD ),
mBlendEquationSeparateModeAlpha( GL_FUNC_ADD ),
mMaxTextureSize(0),
- mMaxTextureUnits(0),
mClearColor(Color::WHITE), // initial color, never used until it's been set by the user
mCullFaceMode(CullNone),
mViewPort( 0, 0, 0, 0 ),
- mCurrentProgram( NULL )
+ mCurrentProgram( NULL ),
+ mFrameCount( 0 ),
+ mCulledCount( 0 ),
+ mRendererCount( 0 )
{
}
void Context::GlContextCreated()
{
+ DALI_LOG_INFO(gContextLogFilter, Debug::Verbose, "Context::GlContextCreated()\n");
+
DALI_ASSERT_DEBUG(!mGlContextCreated);
mGlContextCreated = true;
// Set the initial GL state, and check it.
ResetGlState();
- const ProgramContainer::iterator endp = mProgramCache.end();
- for ( ProgramContainer::iterator itp = mProgramCache.begin(); itp != endp; ++itp )
- {
- (*itp).second->GlContextCreated();
- }
+ // Programs now load on demand
}
void Context::GlContextDestroyed()
{
+ DALI_LOG_INFO(gContextLogFilter, Debug::Verbose, "Context::GlContextDestroyed()\n");
+ SetCurrentProgram( NULL );
+ // Inform programs they are no longer valid
const ProgramContainer::iterator endp = mProgramCache.end();
for ( ProgramContainer::iterator itp = mProgramCache.begin(); itp != endp; ++itp )
{
return "Unknown Open GLES error";
}
+void Context::ResetProgramMatrices()
+{
+ const ProgramContainer::iterator endp = mProgramCache.end();
+ for ( ProgramContainer::iterator itp = mProgramCache.begin(); itp != endp; ++itp )
+ {
+ (*itp).second->SetProjectionMatrix( NULL );
+ (*itp).second->SetViewMatrix( NULL );
+ }
+}
+
Program* Context::GetCachedProgram( std::size_t hash ) const
{
std::map< std::size_t, Program* >::const_iterator iter = mProgramCache.find(hash);
void Context::ResetGlState()
{
+ DALI_LOG_INFO(gContextLogFilter, Debug::Verbose, "Context::ResetGlState()\n");
DALI_ASSERT_DEBUG(mGlContextCreated);
mClearColorSet = false;
mGlAbstraction.FrontFace(GL_CCW);
mGlAbstraction.CullFace(GL_BACK);
- // get max texture units
- mGlAbstraction.GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &mMaxTextureUnits);
- DALI_ASSERT_DEBUG(mMaxTextureUnits > 7); // according to GLES 2.0 specification
- mBound2dTextureId.reserve(mMaxTextureUnits);
// rebind texture units
- for( int i=0; i < mMaxTextureUnits; ++i )
+ for( unsigned int i=0; i < MAX_TEXTURE_UNITS; ++i )
{
mBound2dTextureId[ i ] = 0;
// set active texture
mGlAbstraction.GetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS_OES, &numProgramBinaryFormats);
if( GL_NO_ERROR == mGlAbstraction.GetError() && 0 != numProgramBinaryFormats )
{
- mProgramBinaryFormats.resize(numProgramBinaryFormats);
+ mProgramBinaryFormats.Resize(numProgramBinaryFormats);
mGlAbstraction.GetIntegerv(GL_PROGRAM_BINARY_FORMATS_OES, &mProgramBinaryFormats[0]);
}