1 #ifndef DALI_INTERNAL_CORE_H
2 #define DALI_INTERNAL_CORE_H
5 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/object/ref-object.h>
23 #include <dali/integration-api/context-notifier.h>
24 #include <dali/internal/common/owner-pointer.h>
25 #include <dali/internal/event/animation/animation-playlist-declarations.h>
26 #include <dali/internal/event/common/stage-def.h>
27 #include <dali/internal/update/resources/resource-manager-declarations.h>
28 #include <dali/public-api/common/view-mode.h>
29 #include <dali/integration-api/resource-policies.h>
36 class RenderController;
37 class PlatformAbstraction;
40 class GlSyncAbstraction;
51 class NotificationManager;
52 class AnimationPlaylist;
53 class PropertyNotificationManager;
55 class GestureEventProcessor;
56 class ResourceManager;
59 class RelayoutController;
66 class TextureCacheDispatcher;
67 class GeometryBatcher;
68 class RenderTaskProcessor;
72 * Internal class for Dali::Integration::Core
79 * Create and initialise a new Core instance
81 Core( Integration::RenderController& renderController,
82 Integration::PlatformAbstraction& platform,
83 Integration::GlAbstraction& glAbstraction,
84 Integration::GlSyncAbstraction& glSyncAbstraction,
85 Integration::GestureManager& gestureManager,
86 ResourcePolicy::DataRetention dataRetentionPolicy );
94 * @copydoc Dali::Integration::Core::GetContextNotifier()
96 Integration::ContextNotifierInterface* GetContextNotifier();
99 * @copydoc Dali::Integration::Core::ContextCreated()
101 void ContextCreated();
104 * @copydoc Dali::Integration::Core::ContextDestroyed()
106 void ContextDestroyed();
109 * @copydoc Dali::Integration::Core::RecoverFromContextLoss()
111 void RecoverFromContextLoss();
114 * @copydoc Dali::Integration::Core::SurfaceResized(unsigned int, unsigned int)
116 void SurfaceResized(unsigned int width, unsigned int height);
119 * @copydoc Dali::Integration::Core::SetTopMargin( unsigned int margin )
121 void SetTopMargin( unsigned int margin );
124 * @copydoc Dali::Integration::Core::SetDpi(unsigned int, unsigned int)
126 void SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical);
129 * @copydoc Dali::Integration::Core::SetMinimumFrameTimeInterval(unsigned int)
131 void SetMinimumFrameTimeInterval(unsigned int interval);
134 * @copydoc Dali::Integration::Core::Update()
136 void Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, Integration::UpdateStatus& status );
139 * @copydoc Dali::Integration::Core::Render()
141 void Render( Integration::RenderStatus& status );
144 * @copydoc Dali::Integration::Core::Suspend()
149 * @copydoc Dali::Integration::Core::Resume()
154 * @copydoc Dali::Integration::Core::SceneCreated()
159 * @copydoc Dali::Integration::Core::QueueEvent(const Integration::Event&)
161 void QueueEvent( const Integration::Event& event );
164 * @copydoc Dali::Integration::Core::ProcessEvents()
166 void ProcessEvents();
169 * @copydoc Dali::Integration::Core::GetMaximumUpdateCount()
171 unsigned int GetMaximumUpdateCount() const;
174 * @copydoc Dali::Integration::Core::GetSystemOverlay()
176 Integration::SystemOverlay& GetSystemOverlay();
181 * @copydoc Dali::Integration::Core::SetViewMode()
183 void SetViewMode( ViewMode viewMode );
186 * @copydoc Dali::Integration::Core::GetViewMode()
188 ViewMode GetViewMode() const;
191 * @copydoc Dali::Integration::Core::SetStereoBase()
193 void SetStereoBase( float stereoBase );
196 * @copydoc Dali::Integration::Core::GetStereoBase()
198 float GetStereoBase() const;
200 private: // for use by ThreadLocalStorage
203 * Returns the current stage.
204 * @return A smart-pointer to the current stage.
206 StagePtr GetCurrentStage();
209 * Returns the platform abstraction.
210 * @return A reference to the platform abstraction.
212 Integration::PlatformAbstraction& GetPlatform();
215 * Returns the update manager.
216 * @return A reference to the update manager.
218 SceneGraph::UpdateManager& GetUpdateManager();
221 * Returns the render manager.
222 * @return A reference to the render manager.
224 SceneGraph::RenderManager& GetRenderManager();
227 * Returns the notification manager.
228 * @return A reference to the Notification Manager.
230 NotificationManager& GetNotificationManager();
233 * Returns the Resource Manager.
234 * @return A reference to the Resource Manager.
236 ResourceManager& GetResourceManager();
239 * Returns the Shader factory
240 * @return A reference to the Shader binary factory.
242 ShaderFactory& GetShaderFactory();
245 * Returns the gesture event processor.
246 * @return A reference to the gesture event processor.
248 GestureEventProcessor& GetGestureEventProcessor();
251 * Return the relayout controller
252 * @Return Return a reference to the relayout controller
254 RelayoutController& GetRelayoutController();
259 * Undefined copy and assignment operators
261 Core(const Core& core); // No definition
262 Core& operator=(const Core& core); // No definition
265 * Create Thread local storage
267 void CreateThreadLocalStorage();
271 Integration::RenderController& mRenderController; ///< Reference to Render controller to tell it to keep rendering
272 Integration::PlatformAbstraction& mPlatform; ///< The interface providing platform specific services.
274 IntrusivePtr<Stage> mStage; ///< The current stage
275 GestureEventProcessor* mGestureEventProcessor; ///< The gesture event processor
276 EventProcessor* mEventProcessor; ///< The event processor
277 SceneGraph::UpdateManager* mUpdateManager; ///< Update manager
278 SceneGraph::RenderManager* mRenderManager; ///< Render manager
279 SceneGraph::DiscardQueue* mDiscardQueue; ///< Used to cleanup nodes & resources when no longer in use.
280 SceneGraph::TextureCacheDispatcher* mTextureCacheDispatcher; ///< Used to send messages to TextureCache
281 LockedResourceQueue* mTextureUploadedQueue; ///< Stores resource ids which require post processing after render
282 NotificationManager* mNotificationManager; ///< Notification manager
283 AnimationPlaylistOwner mAnimationPlaylist; ///< For 'Fire and forget' animation support
284 OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
285 ShaderFactory* mShaderFactory; ///< Shader resource factory
286 ResourceManager* mResourceManager; ///< Asynchronous Resource Loading
287 IntrusivePtr< RelayoutController > mRelayoutController; ///< Size negotiation relayout controller
288 SceneGraph::GeometryBatcher* mGeometryBatcher; ///< Instance of the geometry batcher
289 SceneGraph::RenderTaskProcessor* mRenderTaskProcessor; ///< Handles the processing of render tasks
290 bool mIsActive : 1; ///< Whether Core is active or suspended
291 bool mProcessingEvent : 1; ///< True during ProcessEvents()
293 friend class ThreadLocalStorage;
297 } // namespace Internal
301 #endif // DALI_INTERNAL_CORE_H