[Issue#] N/A
[Problem] too many context observers
[Cause] observer pattern
[Solution] remove observer pattern
Change-Id: Ica8dd62613d689d97b7a9846154a589f7626450d
Signed-off-by: Ferran Sole <ferran.sole@samsung.com>
{
(*it)->GlContextCreated();
}
{
(*it)->GlContextCreated();
}
+
+ const ProgramContainer::iterator endp = mProgramCache.end();
+ for ( ProgramContainer::iterator itp = mProgramCache.begin(); itp != endp; ++itp )
+ {
+ (*itp).second->GlContextCreated();
+ }
}
void Context::GlContextToBeDestroyed()
}
void Context::GlContextToBeDestroyed()
(*it)->GlContextToBeDestroyed();
}
(*it)->GlContextToBeDestroyed();
}
+ const ProgramContainer::iterator endp = mProgramCache.end();
+ for ( ProgramContainer::iterator itp = mProgramCache.begin(); itp != endp; ++itp )
+ {
+ (*itp).second->GlContextDestroyed();
+ }
+
mGlContextCreated = false;
}
mGlContextCreated = false;
}
std::set<ContextObserver*> mObservers;
Program* mCurrentProgram;
std::set<ContextObserver*> mObservers;
Program* mCurrentProgram;
- std::map< std::size_t, Program* > mProgramCache; /// program cache
+ typedef std::map< std::size_t, Program* > ProgramContainer;
+ ProgramContainer mProgramCache; /// program cache
-void Program::GlContextToBeDestroyed()
+void Program::GlContextDestroyed()
{
// reset values
ResetAttribsUniforms();
{
// reset values
ResetAttribsUniforms();
-
- mContext.AddObserver( *this );
- mContext.RemoveObserver( *this );
-
Unload(); // Resets gCurrentProgram
}
Unload(); // Resets gCurrentProgram
}
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/ref-object.h>
#include <dali/internal/render/gl-resources/context.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/object/ref-object.h>
#include <dali/internal/render/gl-resources/context.h>
-#include <dali/internal/render/gl-resources/context-observer.h>
#include <dali/integration-api/resource-cache.h>
namespace Dali
#include <dali/integration-api/resource-cache.h>
namespace Dali
* uColor is set to the value specified by Actor::SetColor and is
* animatable through the property Actor::COLOR
*/
* uColor is set to the value specified by Actor::SetColor and is
* animatable through the property Actor::COLOR
*/
-class Program : public ContextObserver
*/
void SetUniformMatrix3fv( GLint location, GLsizei count, const GLfloat* value );
*/
void SetUniformMatrix3fv( GLint location, GLsizei count, const GLfloat* value );
-public: // From ContextObserver
-
- * @copydoc ContextObserver::GlContextCreated
+ * Needs to be called when GL context is (re)created
- virtual void GlContextCreated(); // From ContextObserver
+ void GlContextCreated();
- * @copydoc ContextObserver::GlContextToBeDestroyed
+ * Needs to be called when GL context is destroyed
- virtual void GlContextToBeDestroyed(); // From ContextObserver
+ void GlContextDestroyed();
private: // Implementation
private: // Implementation
+ * Destructor, non virtual as no virtual methods or inheritance