1 #ifndef DALI_INTERNAL_CORE_H
2 #define DALI_INTERNAL_CORE_H
5 * Copyright (c) 2018 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/common/dali-vector.h>
23 #include <dali/public-api/object/ref-object.h>
24 #include <dali/integration-api/context-notifier.h>
25 #include <dali/integration-api/core-enumerations.h>
26 #include <dali/internal/common/owner-pointer.h>
27 #include <dali/internal/event/animation/animation-playlist-declarations.h>
28 #include <dali/internal/event/common/stage-def.h>
29 #include <dali/public-api/common/view-mode.h>
30 #include <dali/integration-api/resource-policies.h>
38 class RenderController;
39 class PlatformAbstraction;
42 class GlSyncAbstraction;
53 class NotificationManager;
54 class AnimationPlaylist;
55 class PropertyNotificationManager;
57 class GestureEventProcessor;
60 class RelayoutController;
67 class RenderTaskProcessor;
71 * Internal class for Dali::Integration::Core
78 * Create and initialise a new Core instance
80 Core( Integration::RenderController& renderController,
81 Integration::PlatformAbstraction& platform,
82 Integration::GlAbstraction& glAbstraction,
83 Integration::GlSyncAbstraction& glSyncAbstraction,
84 Integration::GestureManager& gestureManager,
85 ResourcePolicy::DataRetention dataRetentionPolicy,
86 Integration::RenderToFrameBuffer renderToFboEnabled,
87 Integration::DepthBufferAvailable depthBufferAvailable,
88 Integration::StencilBufferAvailable stencilBufferAvailable );
96 * @copydoc Dali::Integration::Core::GetContextNotifier()
98 Integration::ContextNotifierInterface* GetContextNotifier();
101 * @copydoc Dali::Integration::Core::ContextCreated()
103 void ContextCreated();
106 * @copydoc Dali::Integration::Core::ContextDestroyed()
108 void ContextDestroyed();
111 * @copydoc Dali::Integration::Core::RecoverFromContextLoss()
113 void RecoverFromContextLoss();
116 * @copydoc Dali::Integration::Core::SurfaceResized(unsigned int, unsigned int)
118 void SurfaceResized(unsigned int width, unsigned int height);
121 * @copydoc Dali::Integration::Core::SetTopMargin( unsigned int margin )
123 void SetTopMargin( unsigned int margin );
126 * @copydoc Dali::Integration::Core::SetDpi(unsigned int, unsigned int)
128 void SetDpi(unsigned int dpiHorizontal, unsigned int dpiVertical);
131 * @copydoc Dali::Integration::Core::SetMinimumFrameTimeInterval(unsigned int)
133 void SetMinimumFrameTimeInterval(unsigned int interval);
136 * @copydoc Dali::Integration::Core::Update()
138 void Update( float elapsedSeconds, unsigned int lastVSyncTimeMilliseconds, unsigned int nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo );
141 * @copydoc Dali::Integration::Core::Render()
143 void Render( Integration::RenderStatus& status, bool forceClear );
146 * @copydoc Dali::Integration::Core::SceneCreated()
151 * @copydoc Dali::Integration::Core::QueueEvent(const Integration::Event&)
153 void QueueEvent( const Integration::Event& event );
156 * @copydoc Dali::Integration::Core::ProcessEvents()
158 void ProcessEvents();
161 * @copydoc Dali::Integration::Core::GetMaximumUpdateCount()
163 unsigned int GetMaximumUpdateCount() const;
166 * @copydoc Dali::Integration::Core::GetSystemOverlay()
168 Integration::SystemOverlay& GetSystemOverlay();
173 * @copydoc Dali::Integration::Core::SetViewMode()
175 void SetViewMode( ViewMode viewMode );
178 * @copydoc Dali::Integration::Core::GetViewMode()
180 ViewMode GetViewMode() const;
183 * @copydoc Dali::Integration::Core::SetStereoBase()
185 void SetStereoBase( float stereoBase );
188 * @copydoc Dali::Integration::Core::GetStereoBase()
190 float GetStereoBase() const;
194 * @copydoc Dali::Integration::Core::RegisterProcessor
196 void RegisterProcessor( Dali::Integration::Processor& processor );
199 * @copydoc Dali::Integration::Core::UnregisterProcessor
201 void UnregisterProcessor( Dali::Integration::Processor& processor );
205 * Run each registered processor
207 void RunProcessors();
209 // for use by ThreadLocalStorage
212 * Returns the current stage.
213 * @return A smart-pointer to the current stage.
215 StagePtr GetCurrentStage();
218 * Returns the platform abstraction.
219 * @return A reference to the platform abstraction.
221 Integration::PlatformAbstraction& GetPlatform();
224 * Returns the update manager.
225 * @return A reference to the update manager.
227 SceneGraph::UpdateManager& GetUpdateManager();
230 * Returns the render manager.
231 * @return A reference to the render manager.
233 SceneGraph::RenderManager& GetRenderManager();
236 * Returns the notification manager.
237 * @return A reference to the Notification Manager.
239 NotificationManager& GetNotificationManager();
242 * Returns the Shader factory
243 * @return A reference to the Shader binary factory.
245 ShaderFactory& GetShaderFactory();
248 * Returns the gesture event processor.
249 * @return A reference to the gesture event processor.
251 GestureEventProcessor& GetGestureEventProcessor();
254 * Return the relayout controller
255 * @Return Return a reference to the relayout controller
257 RelayoutController& GetRelayoutController();
262 * Undefined copy and assignment operators
264 Core(const Core& core); // No definition
265 Core& operator=(const Core& core); // No definition
268 * Create Thread local storage
270 void CreateThreadLocalStorage();
274 Integration::RenderController& mRenderController; ///< Reference to Render controller to tell it to keep rendering
275 Integration::PlatformAbstraction& mPlatform; ///< The interface providing platform specific services.
277 IntrusivePtr<Stage> mStage; ///< The current stage
278 AnimationPlaylistOwner mAnimationPlaylist; ///< For 'Fire and forget' animation support
279 OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
280 IntrusivePtr< RelayoutController > mRelayoutController; ///< Size negotiation relayout controller
281 bool mProcessingEvent : 1; ///< True during ProcessEvents()
283 OwnerPointer<SceneGraph::RenderTaskProcessor> mRenderTaskProcessor; ///< Handles the processing of render tasks
284 OwnerPointer<SceneGraph::RenderManager> mRenderManager; ///< Render manager
285 OwnerPointer<SceneGraph::UpdateManager> mUpdateManager; ///< Update manager
286 OwnerPointer<SceneGraph::DiscardQueue> mDiscardQueue; ///< Used to cleanup nodes & resources when no longer in use.
287 OwnerPointer<ShaderFactory> mShaderFactory; ///< Shader resource factory
288 OwnerPointer<NotificationManager> mNotificationManager; ///< Notification manager
289 OwnerPointer<GestureEventProcessor> mGestureEventProcessor; ///< The gesture event processor
290 OwnerPointer<EventProcessor> mEventProcessor; ///< The event processor
291 Dali::Vector<Integration::Processor*> mProcessors; ///< Registered processors (not owned)
293 friend class ThreadLocalStorage;
297 } // namespace Internal
301 #endif // DALI_INTERNAL_CORE_H