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/integration-api/resource-policies.h>
37 class RenderController;
38 class PlatformAbstraction;
41 class GlSyncAbstraction;
51 class NotificationManager;
52 class AnimationPlaylist;
53 class PropertyNotificationManager;
55 class GestureEventProcessor;
58 class RelayoutController;
65 class RenderTaskProcessor;
69 * Internal class for Dali::Integration::Core
76 * Create and initialise a new Core instance
78 Core( Integration::RenderController& renderController,
79 Integration::PlatformAbstraction& platform,
80 Integration::GlAbstraction& glAbstraction,
81 Integration::GlSyncAbstraction& glSyncAbstraction,
82 Integration::GestureManager& gestureManager,
83 ResourcePolicy::DataRetention dataRetentionPolicy,
84 Integration::RenderToFrameBuffer renderToFboEnabled,
85 Integration::DepthBufferAvailable depthBufferAvailable,
86 Integration::StencilBufferAvailable stencilBufferAvailable );
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(uint32_t, uint32_t)
116 void SurfaceResized(uint32_t width, uint32_t height);
119 * @copydoc Dali::Integration::Core::SetTopMargin( uint32_t margin )
121 void SetTopMargin( uint32_t margin );
124 * @copydoc Dali::Integration::Core::SetDpi(uint32_t, uint32_t)
126 void SetDpi(uint32_t dpiHorizontal, uint32_t dpiVertical);
129 * @copydoc Dali::Integration::Core::SetMinimumFrameTimeInterval(uint32_t)
131 void SetMinimumFrameTimeInterval(uint32_t interval);
134 * @copydoc Dali::Integration::Core::Update()
136 void Update( float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, Integration::UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo );
139 * @copydoc Dali::Integration::Core::Render()
141 void Render( Integration::RenderStatus& status, bool forceClear );
144 * @copydoc Dali::Integration::Core::SceneCreated()
149 * @copydoc Dali::Integration::Core::QueueEvent(const Integration::Event&)
151 void QueueEvent( const Integration::Event& event );
154 * @copydoc Dali::Integration::Core::ProcessEvents()
156 void ProcessEvents();
159 * @copydoc Dali::Integration::Core::GetMaximumUpdateCount()
161 uint32_t GetMaximumUpdateCount() const;
164 * @copydoc Dali::Integration::Core::RegisterProcessor
166 void RegisterProcessor( Dali::Integration::Processor& processor );
169 * @copydoc Dali::Integration::Core::UnregisterProcessor
171 void UnregisterProcessor( Dali::Integration::Processor& processor );
175 * Run each registered processor
177 void RunProcessors();
179 // for use by ThreadLocalStorage
182 * Returns the current stage.
183 * @return A smart-pointer to the current stage.
185 StagePtr GetCurrentStage();
188 * Returns the platform abstraction.
189 * @return A reference to the platform abstraction.
191 Integration::PlatformAbstraction& GetPlatform();
194 * Returns the update manager.
195 * @return A reference to the update manager.
197 SceneGraph::UpdateManager& GetUpdateManager();
200 * Returns the render manager.
201 * @return A reference to the render manager.
203 SceneGraph::RenderManager& GetRenderManager();
206 * Returns the notification manager.
207 * @return A reference to the Notification Manager.
209 NotificationManager& GetNotificationManager();
212 * Returns the Shader factory
213 * @return A reference to the Shader binary factory.
215 ShaderFactory& GetShaderFactory();
218 * Returns the gesture event processor.
219 * @return A reference to the gesture event processor.
221 GestureEventProcessor& GetGestureEventProcessor();
224 * Return the relayout controller
225 * @Return Return a reference to the relayout controller
227 RelayoutController& GetRelayoutController();
232 * Undefined copy and assignment operators
234 Core(const Core& core); // No definition
235 Core& operator=(const Core& core); // No definition
238 * Create Thread local storage
240 void CreateThreadLocalStorage();
244 Integration::RenderController& mRenderController; ///< Reference to Render controller to tell it to keep rendering
245 Integration::PlatformAbstraction& mPlatform; ///< The interface providing platform specific services.
247 IntrusivePtr<Stage> mStage; ///< The current stage
248 AnimationPlaylistOwner mAnimationPlaylist; ///< For 'Fire and forget' animation support
249 OwnerPointer<PropertyNotificationManager> mPropertyNotificationManager; ///< For safe signal emmision of property changed notifications
250 IntrusivePtr< RelayoutController > mRelayoutController; ///< Size negotiation relayout controller
251 bool mProcessingEvent : 1; ///< True during ProcessEvents()
253 OwnerPointer<SceneGraph::RenderTaskProcessor> mRenderTaskProcessor; ///< Handles the processing of render tasks
254 OwnerPointer<SceneGraph::RenderManager> mRenderManager; ///< Render manager
255 OwnerPointer<SceneGraph::UpdateManager> mUpdateManager; ///< Update manager
256 OwnerPointer<SceneGraph::DiscardQueue> mDiscardQueue; ///< Used to cleanup nodes & resources when no longer in use.
257 OwnerPointer<ShaderFactory> mShaderFactory; ///< Shader resource factory
258 OwnerPointer<NotificationManager> mNotificationManager; ///< Notification manager
259 OwnerPointer<GestureEventProcessor> mGestureEventProcessor; ///< The gesture event processor
260 OwnerPointer<EventProcessor> mEventProcessor; ///< The event processor
261 Dali::Vector<Integration::Processor*> mProcessors; ///< Registered processors (not owned)
263 friend class ThreadLocalStorage;
267 } // namespace Internal
271 #endif // DALI_INTERNAL_CORE_H