/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace
{
// The Update for frame N+1 may be processed whilst frame N is being rendered.
-const unsigned int MAXIMUM_UPDATE_COUNT = 2u;
+const uint32_t MAXIMUM_UPDATE_COUNT = 2u;
#if defined(DEBUG_ENABLED)
Debug::Filter* gCoreFilter = Debug::Filter::New(Debug::Concise, false, "LOG_CORE");
GlSyncAbstraction& glSyncAbstraction,
GestureManager& gestureManager,
ResourcePolicy::DataRetention dataRetentionPolicy,
- bool renderToFboEnabled )
+ Integration::RenderToFrameBuffer renderToFboEnabled,
+ Integration::DepthBufferAvailable depthBufferAvailable,
+ Integration::StencilBufferAvailable stencilBufferAvailable )
: mRenderController( renderController ),
mPlatform(platform),
mProcessingEvent(false)
mRenderTaskProcessor = new SceneGraph::RenderTaskProcessor();
- mRenderManager = RenderManager::New( glAbstraction, glSyncAbstraction );
+ mRenderManager = RenderManager::New( glAbstraction, glSyncAbstraction, depthBufferAvailable, stencilBufferAvailable );
RenderQueue& renderQueue = mRenderManager->GetRenderQueue();
// This must be called after stage is created but before stage initialization
mRelayoutController = IntrusivePtr< RelayoutController >( new RelayoutController( mRenderController ) );
- mStage->Initialize( renderToFboEnabled );
+ mStage->Initialize( renderToFboEnabled == Integration::RenderToFrameBuffer::TRUE );
mGestureEventProcessor = new GestureEventProcessor( *mStage, *mUpdateManager, gestureManager, mRenderController );
mEventProcessor = new EventProcessor( *mStage, *mNotificationManager, *mGestureEventProcessor );
mRenderManager->ContextDestroyed();
}
-void Core::SurfaceResized( unsigned int width, unsigned int height )
+void Core::SurfaceResized( uint32_t width, uint32_t height )
{
- mStage->SurfaceResized( width, height );
+ mStage->SurfaceResized( static_cast<float>( width ), static_cast<float>( height ) );
// The stage-size may be less than surface-size (reduced by top-margin)
Vector2 size = mStage->GetSize();
- mRelayoutController->SetStageSize( size.width, size.height );
+ mRelayoutController->SetStageSize( static_cast<uint32_t>( size.width ), static_cast<uint32_t>( size.height ) ); // values get truncated
}
-void Core::SetTopMargin( unsigned int margin )
+void Core::SetTopMargin( uint32_t margin )
{
mStage->SetTopMargin( margin );
// The stage-size may be less than surface-size (reduced by top-margin)
Vector2 size = mStage->GetSize();
- mRelayoutController->SetStageSize( size.width, size.height );
+ mRelayoutController->SetStageSize( static_cast<uint32_t>( size.width ), static_cast<uint32_t>( size.height ) ); // values get truncated
}
-void Core::SetDpi( unsigned int dpiHorizontal, unsigned int dpiVertical )
+void Core::SetDpi( uint32_t dpiHorizontal, uint32_t dpiVertical )
{
- mStage->SetDpi( Vector2( dpiHorizontal , dpiVertical) );
+ mStage->SetDpi( Vector2( static_cast<float>( dpiHorizontal ), static_cast<float>( dpiVertical ) ) );
}
-void Core::Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo )
+void Core::Update( float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo )
{
// set the time delta so adaptor can easily print FPS with a release build with 0 as
// it is cached by frametime
// Check the Notification Manager message queue to set needsNotification
status.needsNotification = mNotificationManager->MessagesToProcess();
+ // Check if the default surface is changed
+ status.surfaceRectChanged = mUpdateManager->IsDefaultSurfaceRectChanged();
+
// No need to keep update running if there are notifications to process.
// Any message to update will wake it up anyways
}
-void Core::Render( RenderStatus& status )
+void Core::Render( RenderStatus& status, bool forceClear )
{
- mRenderManager->Render( status );
+ mRenderManager->Render( status, forceClear );
}
void Core::SceneCreated()
// Emit signal here to inform listeners that event processing has finished.
mStage->EmitEventProcessingFinishedSignal();
+ // Run any registered processors
+ RunProcessors();
+
// Run the size negotiation after event processing finished signal
mRelayoutController->Relayout();
+
// Rebuild depth tree after event processing has finished
mStage->RebuildDepthTree();
mProcessingEvent = false;
}
-unsigned int Core::GetMaximumUpdateCount() const
+uint32_t Core::GetMaximumUpdateCount() const
{
return MAXIMUM_UPDATE_COUNT;
}
return mStage->GetSystemOverlay();
}
-void Core::SetViewMode( ViewMode viewMode )
+void Core::RegisterProcessor( Integration::Processor& processor )
{
- mStage->SetViewMode( viewMode );
+ mProcessors.PushBack(&processor);
}
-ViewMode Core::GetViewMode() const
+void Core::UnregisterProcessor( Integration::Processor& processor )
{
- return mStage->GetViewMode();
+ auto iter = std::find( mProcessors.Begin(), mProcessors.End(), &processor );
+ if( iter != mProcessors.End() )
+ {
+ mProcessors.Erase( iter );
+ }
}
-void Core::SetStereoBase( float stereoBase )
+void Core::RunProcessors()
{
- mStage->SetStereoBase( stereoBase );
-}
+ // Copy processor pointers to prevent changes to vector affecting loop iterator.
+ Dali::Vector<Integration::Processor*> processors( mProcessors );
-float Core::GetStereoBase() const
-{
- return mStage->GetStereoBase();
+ for( auto processor : processors )
+ {
+ if( processor )
+ {
+ processor->Process();
+ }
+ }
}
StagePtr Core::GetCurrentStage()