#include <dali/public-api/dali-core.h>
#include <dali/integration-api/events/hover-event-integ.h>
#include <dali/integration-api/system-overlay.h>
+#include <dali/integration-api/render-task-list-integ.h>
#include <dali-test-suite-utils.h>
using namespace Dali;
TestApplication application;
Dali::Integration::Core& core( application.GetCore() );
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
+
+ Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
+ Dali::Actor overlayRootActor = systemOverlay.GetDefaultRootActor();
+ Dali::CameraActor overlayCameraActor = systemOverlay.GetDefaultCameraActor();
+ Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
+ systemOverlay.SetOverlayRenderTasks( overlayRenderTaskList );
// Create an actor and add it to the system overlay.
Actor systemActor = Actor::New();
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/long-press-gesture-event.h>
#include <dali/integration-api/system-overlay.h>
+#include <dali/integration-api/render-task-list-integ.h>
#include <dali-test-suite-utils.h>
#include <test-touch-utils.h>
TestApplication application;
Dali::Integration::Core& core = application.GetCore();
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
+
+ Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
+ Dali::Actor overlayRootActor = systemOverlay.GetDefaultRootActor();
+ Dali::CameraActor overlayCameraActor = systemOverlay.GetDefaultCameraActor();
+ Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
+ systemOverlay.SetOverlayRenderTasks( overlayRenderTaskList );
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
TestApplication application;
Dali::Integration::Core& core = application.GetCore();
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
+
+ Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
+ Dali::Actor overlayRootActor = systemOverlay.GetDefaultRootActor();
+ Dali::CameraActor overlayCameraActor = systemOverlay.GetDefaultCameraActor();
+ Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
+ systemOverlay.SetOverlayRenderTasks( overlayRenderTaskList );
// SystemOverlay actor
Actor systemOverlayActor = Actor::New();
TestApplication application;
Dali::Integration::Core& core = application.GetCore();
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
+
+ Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
+ Dali::Actor overlayRootActor = systemOverlay.GetDefaultRootActor();
+ Dali::CameraActor overlayCameraActor = systemOverlay.GetDefaultCameraActor();
+ Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
+ systemOverlay.SetOverlayRenderTasks( overlayRenderTaskList );
// SystemOverlay actor
Actor systemOverlayActor = Actor::New();
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/pan-gesture-event.h>
#include <dali/integration-api/system-overlay.h>
+#include <dali/integration-api/render-task-list-integ.h>
#include <dali/integration-api/profiling.h>
#include <dali/integration-api/input-options.h>
#include <dali-test-suite-utils.h>
TestApplication application;
Dali::Integration::Core& core = application.GetCore();
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
+
+ Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
+ Dali::Actor overlayRootActor = systemOverlay.GetDefaultRootActor();
+ Dali::CameraActor overlayCameraActor = systemOverlay.GetDefaultCameraActor();
+ Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
+ systemOverlay.SetOverlayRenderTasks( overlayRenderTaskList );
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
TestApplication application;
Dali::Integration::Core& core = application.GetCore();
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
+
+ Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
+ Dali::Actor overlayRootActor = systemOverlay.GetDefaultRootActor();
+ Dali::CameraActor overlayCameraActor = systemOverlay.GetDefaultCameraActor();
+ Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
+ systemOverlay.SetOverlayRenderTasks( overlayRenderTaskList );
// SystemOverlay actor
Actor systemOverlayActor = Actor::New();
TestApplication application;
Dali::Integration::Core& core = application.GetCore();
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
+
+ Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
+ Dali::Actor overlayRootActor = systemOverlay.GetDefaultRootActor();
+ Dali::CameraActor overlayCameraActor = systemOverlay.GetDefaultCameraActor();
+ Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
+ systemOverlay.SetOverlayRenderTasks( overlayRenderTaskList );
// SystemOverlay actor
Actor systemOverlayActor = Actor::New();
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/pinch-gesture-event.h>
#include <dali/integration-api/system-overlay.h>
+#include <dali/integration-api/render-task-list-integ.h>
#include <dali-test-suite-utils.h>
#include <test-touch-utils.h>
TestApplication application;
Dali::Integration::Core& core = application.GetCore();
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
+
+ Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
+ Dali::Actor overlayRootActor = systemOverlay.GetDefaultRootActor();
+ Dali::CameraActor overlayCameraActor = systemOverlay.GetDefaultCameraActor();
+ Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
+ systemOverlay.SetOverlayRenderTasks( overlayRenderTaskList );
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
TestApplication application;
Dali::Integration::Core& core = application.GetCore();
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
+
+ Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
+ Dali::Actor overlayRootActor = systemOverlay.GetDefaultRootActor();
+ Dali::CameraActor overlayCameraActor = systemOverlay.GetDefaultCameraActor();
+ Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
+ systemOverlay.SetOverlayRenderTasks( overlayRenderTaskList );
// SystemOverlay actor
Actor systemOverlayActor = Actor::New();
TestApplication application;
Dali::Integration::Core& core = application.GetCore();
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
+
+ Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
+ Dali::Actor overlayRootActor = systemOverlay.GetDefaultRootActor();
+ Dali::CameraActor overlayCameraActor = systemOverlay.GetDefaultCameraActor();
+ Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
+ systemOverlay.SetOverlayRenderTasks( overlayRenderTaskList );
// SystemOverlay actor
Actor systemOverlayActor = Actor::New();
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/events/tap-gesture-event.h>
#include <dali/integration-api/system-overlay.h>
+#include <dali/integration-api/render-task-list-integ.h>
#include <dali-test-suite-utils.h>
#include <test-touch-utils.h>
TestApplication application;
Dali::Integration::Core& core = application.GetCore();
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
+
+ Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
+ Dali::Actor overlayRootActor = systemOverlay.GetDefaultRootActor();
+ Dali::CameraActor overlayCameraActor = systemOverlay.GetDefaultCameraActor();
+ Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
+ systemOverlay.SetOverlayRenderTasks( overlayRenderTaskList );
Actor actor = Actor::New();
actor.SetSize(100.0f, 100.0f);
TestApplication application;
Dali::Integration::Core& core = application.GetCore();
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
+
+ Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
+ Dali::Actor overlayRootActor = systemOverlay.GetDefaultRootActor();
+ Dali::CameraActor overlayCameraActor = systemOverlay.GetDefaultCameraActor();
+ Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
+ systemOverlay.SetOverlayRenderTasks( overlayRenderTaskList );
// SystemOverlay actor
Actor systemOverlayActor = Actor::New();
TestApplication application;
Dali::Integration::Core& core = application.GetCore();
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
+
+ Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
+ Dali::Actor overlayRootActor = systemOverlay.GetDefaultRootActor();
+ Dali::CameraActor overlayCameraActor = systemOverlay.GetDefaultCameraActor();
+ Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
+ systemOverlay.SetOverlayRenderTasks( overlayRenderTaskList );
// SystemOverlay actor
Actor systemOverlayActor = Actor::New();
#include <dali/public-api/dali-core.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/system-overlay.h>
+#include <dali/integration-api/render-task-list-integ.h>
#include <dali-test-suite-utils.h>
using namespace Dali;
TestApplication application;
Dali::Integration::Core& core( application.GetCore() );
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
+
+ Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
+ Dali::Actor overlayRootActor = systemOverlay.GetDefaultRootActor();
+ Dali::CameraActor overlayCameraActor = systemOverlay.GetDefaultCameraActor();
+ Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
+ systemOverlay.SetOverlayRenderTasks( overlayRenderTaskList );
// Create an actor and add it to the system overlay.
Actor systemActor = Actor::New();
#include <dali/public-api/dali-core.h>
#include <dali/integration-api/events/touch-event-integ.h>
#include <dali/integration-api/system-overlay.h>
+#include <dali/integration-api/render-task-list-integ.h>
#include <dali-test-suite-utils.h>
using namespace Dali;
TestApplication application;
Dali::Integration::Core& core( application.GetCore() );
Dali::Integration::SystemOverlay& systemOverlay( core.GetSystemOverlay() );
- systemOverlay.GetOverlayRenderTasks().CreateTask();
+
+ Dali::RenderTaskList overlayRenderTaskList = Integration::RenderTaskList::New();
+ Dali::Actor overlayRootActor = systemOverlay.GetDefaultRootActor();
+ Dali::CameraActor overlayCameraActor = systemOverlay.GetDefaultCameraActor();
+ Integration::RenderTaskList::CreateTask( overlayRenderTaskList, overlayRootActor, overlayCameraActor );
+ systemOverlay.SetOverlayRenderTasks( overlayRenderTaskList );
// Create an actor and add it to the system overlay.
Actor systemActor = Actor::New();
${CMAKE_CURRENT_SOURCE_DIR}/input-options.cpp
${CMAKE_CURRENT_SOURCE_DIR}/system-overlay.cpp
${CMAKE_CURRENT_SOURCE_DIR}/lockless-buffer.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/render-task-list-integ.cpp
${CMAKE_CURRENT_SOURCE_DIR}/events/event.cpp
${CMAKE_CURRENT_SOURCE_DIR}/events/gesture-event.cpp
${CMAKE_CURRENT_SOURCE_DIR}/events/hover-event-integ.cpp
${CMAKE_CURRENT_SOURCE_DIR}/platform-abstraction.h
${CMAKE_CURRENT_SOURCE_DIR}/system-overlay.h
${CMAKE_CURRENT_SOURCE_DIR}/lockless-buffer.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/render-task-list-integ.h
${CMAKE_CURRENT_SOURCE_DIR}/events/event.h
${CMAKE_CURRENT_SOURCE_DIR}/events/gesture-event.h
$(platform_abstraction_src_dir)/input-options.cpp \
$(platform_abstraction_src_dir)/system-overlay.cpp \
$(platform_abstraction_src_dir)/lockless-buffer.cpp \
+ $(platform_abstraction_src_dir)/render-task-list-integ.cpp \
$(platform_abstraction_src_dir)/events/event.cpp \
$(platform_abstraction_src_dir)/events/gesture-event.cpp \
$(platform_abstraction_src_dir)/events/hover-event-integ.cpp \
$(platform_abstraction_src_dir)/render-controller.h \
$(platform_abstraction_src_dir)/platform-abstraction.h \
$(platform_abstraction_src_dir)/system-overlay.h \
- $(platform_abstraction_src_dir)/lockless-buffer.h
+ $(platform_abstraction_src_dir)/lockless-buffer.h \
+ $(platform_abstraction_src_dir)/render-task-list-integ.h
platform_abstraction_events_header_files = \
$(platform_abstraction_src_dir)/events/event.h \
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/integration-api/render-task-list-integ.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/event/render-tasks/render-task-list-impl.h>
+#include <dali/internal/event/actors/actor-impl.h>
+#include <dali/internal/event/actors/camera-actor-impl.h>
+
+namespace Dali
+{
+
+namespace Integration
+{
+
+namespace RenderTaskList
+{
+
+Dali::RenderTaskList New()
+{
+ Dali::Internal::RenderTaskListPtr renderTaskList = Dali::Internal::RenderTaskList::New();
+ return Dali::RenderTaskList( renderTaskList.Get() );
+}
+
+Dali::RenderTask CreateTask( Dali::RenderTaskList& taskList, Dali::Actor& sourceActor, Dali::CameraActor& cameraActor)
+{
+ return GetImplementation(taskList).CreateTask( &GetImplementation( sourceActor), &GetImplementation(cameraActor) );
+}
+
+} // namespace RenderTaskList
+
+} // namespace Integration
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_INTEGRATION_RENDER_TASK_LIST_H__
+#define __DALI_INTEGRATION_RENDER_TASK_LIST_H__
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/render-tasks/render-task-list.h>
+
+namespace Dali
+{
+
+class Actor;
+class CameraActor;
+
+namespace Integration
+{
+
+namespace RenderTaskList
+{
+
+ /**
+ * @brief Helper function to create a new RenderTaskList object.
+ *
+ * A RenderTaskList is an ordered list of render tasks that describes
+ * how the Dali scene should be rendered.
+ *
+ * @return A handle to a newly allocated RenderTaskList
+ */
+ DALI_CORE_API Dali::RenderTaskList New();
+
+ /**
+ * @brief Helper function to create a new RenderTask.
+ *
+ * The created task will be appended to the list of render-tasks.
+ *
+ * @param[in] taskList    The render task list containing all the render-tasks.
+ * @param[in] sourceActor The actor and its children to be rendered for this render task.
+ * @param[in] cameraActor The actor from which the scene is viewed for this render task.
+ * @return A valid handle to a new RenderTask
+ */
+ DALI_CORE_API Dali::RenderTask CreateTask( Dali::RenderTaskList& taskList, Dali::Actor& sourceActor, Dali::CameraActor& cameraActor);
+
+} // namespace RenderTaskList
+
+} // namespace Integration
+
+} // namespace Dali
+
+#endif // __DALI_INTEGRATION_RENDER_TASK_LIST_H__
// INTERNAL INCLUDES
#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/actors/camera-actor.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/common/system-overlay-impl.h>
+#include <dali/internal/event/render-tasks/render-task-list-impl.h>
namespace Dali
{
mImpl->Remove( GetImplementation(actor) );
}
+void SystemOverlay::SetOverlayRenderTasks(RenderTaskList& taskList)
+{
+ mImpl->SetOverlayRenderTasks( GetImplementation( taskList ) );
+}
+
RenderTaskList SystemOverlay::GetOverlayRenderTasks()
{
return RenderTaskList( &mImpl->GetOverlayRenderTasks() );
}
+Actor SystemOverlay::GetDefaultRootActor()
+{
+ return Actor( &mImpl->GetDefaultRootActor() );
+}
+
+CameraActor SystemOverlay::GetDefaultCameraActor()
+{
+ return CameraActor( &mImpl->GetDefaultCameraActor() );
+}
+
SystemOverlay::SystemOverlay( Internal::SystemOverlay* impl )
: mImpl( impl )
{
{
class Actor;
+class CameraActor;
class RenderTaskList;
namespace Internal
*/
void Remove( Actor actor );
+ /**
+ * Set the list of render-tasks for system-level overlays.
+ * This is a separate list, processed after the render-tasks provided by Stage::GetRenderTaskList().
+ * @param[in] taskList The list of overlay render-tasks.
+ */
+ void SetOverlayRenderTasks(RenderTaskList& taskList);
+
/**
* Retrieve the list of render-tasks for system-level overlays.
- * This is a seperate list, processed after the render-tasks provided by Stage::GetRenderTaskList().
+ * This is a separate list, processed after the render-tasks provided by Stage::GetRenderTaskList().
* @return The list of overlay render-tasks.
*/
RenderTaskList GetOverlayRenderTasks();
+ /**
+ * Retrieve the default SystemOverlay root actor.
+ * @note This is different to the root actor provided by Dali::Stage.
+ */
+ Actor GetDefaultRootActor();
+
+ /**
+ * Retrieve the default SystemOverlay camera actor.
+ * @note This is different to the default camera actor provided by Dali::Stage.
+ */
+ CameraActor GetDefaultCameraActor();
+
/**
* Create the SystemOverlay entrance.
* This is not intended for adaptor implementors; see also Dali::Integration::Core::GetSystemOverlay().
return layer;
}
-LayerPtr Layer::NewRoot( LayerList& layerList, UpdateManager& manager, bool systemLevel )
+LayerPtr Layer::NewRoot( LayerList& layerList, UpdateManager& manager )
{
LayerPtr root( new Layer( Actor::ROOT_LAYER ) );
SceneGraph::Layer* rootLayer = static_cast<SceneGraph::Layer*>( root->CreateNode() );
root->mNode = rootLayer;
OwnerPointer< SceneGraph::Layer > transferOwnership( rootLayer );
- InstallRootMessage( manager, transferOwnership, systemLevel );
+ InstallRootMessage( manager, transferOwnership );
// root actor is immediately considered to be on-stage
root->mIsOnStage = true;
// layer-list must be set for the root layer
root->mLayerList = &layerList;
+ layerList.SetRootLayer( &(*root) );
layerList.RegisterLayer( *root );
return root;
* Create a new root layer; this is typically owned by the stage.
* @param[in] layerList The layer will be added to this ordered list.
* @param[in] manager The update manager to install a root node with.
- * @param[in] systemLevel True if using the SystemOverlay API; see Integration::GetSystemOverlay() for more details.
* @return A smart-pointer to the newly allocated Actor.
*/
- static LayerPtr NewRoot( LayerList& layerList, SceneGraph::UpdateManager& manager, bool systemLevel );
+ static LayerPtr NewRoot( LayerList& layerList, SceneGraph::UpdateManager& manager );
/**
* @copydoc Dali::Internal::Actor::OnInitialize
} // unnamed namespace
-LayerList* LayerList::New( SceneGraph::UpdateManager& updateManager, bool systemLevel )
+LayerList* LayerList::New( SceneGraph::UpdateManager& updateManager )
{
- return new LayerList( updateManager, systemLevel );
+ return new LayerList( updateManager );
}
LayerList::~LayerList()
}
}
-LayerList::LayerList( SceneGraph::UpdateManager& updateManager, bool systemLevel )
+LayerList::LayerList( SceneGraph::UpdateManager& updateManager )
: mUpdateManager( updateManager ),
- mIsSystemLevel( systemLevel )
+ mRoot( NULL )
{
}
}
// Layers are being used in a separate thread; queue a message to set order
- SetLayerDepthsMessage( mUpdateManager, layers, mIsSystemLevel );
+ SetLayerDepthsMessage( mUpdateManager, layers, &( mRoot->GetSceneLayerOnStage() ) );
+}
+
+void LayerList::SetRootLayer(Layer* rootLayer)
+{
+ mRoot = rootLayer;
+
+ SetLayerDepths();
}
} // namespace Internal
/**
* Create a new list of layers.
* @param[in] updateManager A reference to the update manager.
- * @param[in] systemLevel True if the layers are added via the SystemOverlay API.
*/
- static LayerList* New( SceneGraph::UpdateManager& updateManager, bool systemLevel );
+ static LayerList* New( SceneGraph::UpdateManager& updateManager );
/**
* Non-virtual destructor; not suitable as a base class.
*/
void MoveLayerBelow( const Layer& layer, const Layer& target );
+ /**
+ * Sets the root layer that this layer list belongs to
+ * @pre the root layer is created
+ * @param rootLayer The root layer
+ */
+ void SetRootLayer(Layer* rootLayer);
+
private:
/**
* Protected constructor; see also LayerList::New().
* @param[in] updateManager to send messages.
- * @param[in] systemLevel True if the layers are added via the SystemOverlay API.
*/
- LayerList( SceneGraph::UpdateManager& updateManager, bool systemLevel );
+ LayerList( SceneGraph::UpdateManager& updateManager );
/**
* A private helper method to set the depth for each layer.
SceneGraph::UpdateManager& mUpdateManager;
- bool mIsSystemLevel; ///< True if the layers are added via the SystemOverlay API.
+ Layer* mRoot; ///< The root layer that this ordered list of layers belong to
typedef std::vector<Layer*> LayerContainer;
mObjectRegistry = ObjectRegistry::New();
// Create the ordered list of layers
- mLayerList = LayerList::New( mUpdateManager, false/*not system-level*/ );
+ mLayerList = LayerList::New( mUpdateManager );
// The stage owns the default layer
- mRootLayer = Layer::NewRoot( *mLayerList, mUpdateManager, false/*not system-level*/ );
+ mRootLayer = Layer::NewRoot( *mLayerList, mUpdateManager );
mRootLayer->SetName("RootLayer");
// The root layer needs to have a fixed resize policy (as opposed to the default USE_NATURAL_SIZE).
// This stops actors parented to the stage having their relayout requests propagating
CreateDefaultCameraActor();
// Create the list of render-tasks
- mRenderTaskList = RenderTaskList::New( *this, *this, false/*not system-level*/ );
+ mRenderTaskList = RenderTaskList::New();
// Create the default render-task
- Dali::RenderTask defaultRenderTask = mRenderTaskList->CreateTask();
+ Dali::RenderTask defaultRenderTask = mRenderTaskList->CreateTask( mRootLayer.Get(), mDefaultCamera.Get() );
}
void Stage::Uninitialize()
// signals or send messages to update
mRootLayer.Reset();
}
+
+ if( mRenderTaskList )
+ {
+ mRenderTaskList.Reset();
+ }
}
StagePtr Stage::GetCurrent()
/*
- * Copyright (c) 2016 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.
}
}
-RenderTaskList& SystemOverlay::GetOverlayRenderTasks()
+void SystemOverlay::SetOverlayRenderTasks(RenderTaskList& taskList)
{
- if ( !mOverlayRenderTaskList )
- {
- mOverlayRenderTaskList = RenderTaskList::New( mEventThreadServices, *this, true/*system-overlay*/ );
- }
+ mOverlayRenderTaskList = &taskList;
+}
+RenderTaskList& SystemOverlay::GetOverlayRenderTasks()
+{
return *mOverlayRenderTaskList;
}
void SystemOverlay::Initialize()
{
// Create the ordered list of layers
- mLayerList = LayerList::New( mEventThreadServices.GetUpdateManager(), true/*system layers*/ );
+ mLayerList = LayerList::New( mEventThreadServices.GetUpdateManager() );
}
void SystemOverlay::CreateRootLayer()
// Lazy initialization; SystemOverlay may never be used
if ( !mRootLayer )
{
- mRootLayer = Layer::NewRoot( *mLayerList, mEventThreadServices.GetUpdateManager(), true/*system layer*/ );
+ mRootLayer = Layer::NewRoot( *mLayerList, mEventThreadServices.GetUpdateManager() );
mRootLayer->SetName("SystemOverlayRoot");
mRootLayer->SetSize( mSize.width, mSize.height );
}
*/
void Remove( Actor& actor );
+ /**
+ * @copydoc Dali::Integration::SystemOverlay::SetOverlayRenderTasks()
+ */
+ void SetOverlayRenderTasks(RenderTaskList& taskList);
+
/**
* @copydoc Dali::Integration::SystemOverlay::GetOverlayRenderTasks()
*/
} // Unnamed namespace
-RenderTask* RenderTask::New( bool isSystemLevel )
+RenderTask* RenderTask::New()
{
- RenderTask* task( new RenderTask( isSystemLevel ) );
+ RenderTask* task( new RenderTask() );
return task;
}
return inside;
}
-bool RenderTask::IsSystemLevel() const
-{
- return mIsSystemLevel;
-}
-
bool RenderTask::WorldToViewport(const Vector3 &position, float& viewportX, float& viewportY) const
{
CameraActor* cam = GetCameraActor();
return connected;
}
-RenderTask::RenderTask( bool isSystemLevel )
+RenderTask::RenderTask()
: mSceneObject( NULL ),
mSourceConnector( Connector::SOURCE_CONNECTOR, *this ),
mCameraConnector( Connector::CAMERA_CONNECTOR, *this ),
mInputEnabled( Dali::RenderTask::DEFAULT_INPUT_ENABLED ),
mClearEnabled( Dali::RenderTask::DEFAULT_CLEAR_ENABLED ),
mCullMode( Dali::RenderTask::DEFAULT_CULL_MODE ),
- mIsSystemLevel( isSystemLevel ),
mRequiresSync( false )
{
DALI_LOG_INFO(gLogRender, Debug::General, "RenderTask::RenderTask(this:%p)\n", this);
/**
* Creates a new RenderTask.
- * @param[in] isSystemLevel Whether the render-task is on the system level task list.
*/
- static RenderTask* New( bool isSystemLevel );
+ static RenderTask* New();
/**
* @copydoc Dali::RenderTask::SetSourceActor()
*/
bool TranslateCoordinates( Vector2& screenCoords ) const;
- /**
- * Query whether the RenderTask is on the system level render-task list.
- * @return true, if on the system level task list, false otherwise.
- */
- bool IsSystemLevel() const;
-
/**
* @copydoc Dali::RenderTask::WorldToViewport()
*/
/**
* Construct a new RenderTask.
- * @param[in] isSystemLevel Whether the RenderTask is on the system level task list.
*/
- RenderTask( bool isSystemLevel );
+ RenderTask();
/**
* A reference counted object may only be deleted by calling Unreference()
bool mInputEnabled : 1; ///< True if the render-task should be considered for input handling.
bool mClearEnabled : 1; ///< True if the render-task should be clear the color buffer.
bool mCullMode : 1; ///< True if the render-task's actors should be culled
- bool mIsSystemLevel : 1; ///< True if the render-task is on the system level task list.
bool mRequiresSync : 1; ///< True if the GL sync is required to track the render of.
//Signals
#include <dali/public-api/common/dali-common.h>
#include <dali/internal/event/common/event-thread-services.h>
#include <dali/internal/event/common/thread-local-storage.h>
+#include <dali/internal/event/common/stage-impl.h>
#include <dali/internal/event/render-tasks/render-task-defaults.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
#include <dali/internal/event/actors/camera-actor-impl.h>
namespace Internal
{
-RenderTaskList* RenderTaskList::New( EventThreadServices& eventServices, RenderTaskDefaults& defaults, bool systemLevel )
+RenderTaskListPtr RenderTaskList::New()
{
- RenderTaskList* taskList = new RenderTaskList( eventServices, defaults, systemLevel );
+ RenderTaskListPtr taskList = new RenderTaskList();
- taskList->Initialize( eventServices.GetUpdateManager() );
+ taskList->Initialize();
return taskList;
}
Dali::RenderTask RenderTaskList::CreateTask()
{
- RenderTask* taskImpl = RenderTask::New( mIsSystemLevel );
+ return CreateTask( &mDefaults.GetDefaultRootActor(), &mDefaults.GetDefaultCameraActor() );
+}
+
+Dali::RenderTask RenderTaskList::CreateTask( Actor* sourceActor, CameraActor* cameraActor)
+{
+ RenderTask* taskImpl = RenderTask::New();
Dali::RenderTask newTask( taskImpl );
mTasks.push_back( newTask );
}
// Set the default source & camera actors
- taskImpl->SetSourceActor( &mDefaults.GetDefaultRootActor() );
- taskImpl->SetCameraActor( &mDefaults.GetDefaultCameraActor() );
+ taskImpl->SetSourceActor( sourceActor );
+ taskImpl->SetCameraActor( cameraActor );
return newTask;
}
}
}
-RenderTaskList::RenderTaskList( EventThreadServices& eventThreadServices, RenderTaskDefaults& defaults, bool systemLevel )
-: mEventThreadServices( eventThreadServices ),
- mDefaults( defaults ),
- mIsSystemLevel( systemLevel ),
+RenderTaskList::RenderTaskList()
+: mEventThreadServices( *Stage::GetCurrent() ),
+ mDefaults( *Stage::GetCurrent() ),
mSceneObject( NULL )
{
}
RenderTaskList::~RenderTaskList()
{
+ if( EventThreadServices::IsCoreRunning() )
+ {
+ DestroySceneObject();
+ }
}
-void RenderTaskList::Initialize( UpdateManager& updateManager )
+void RenderTaskList::Initialize()
{
// This should only be called once, with no existing scene-object
DALI_ASSERT_DEBUG( NULL == mSceneObject );
- // Get raw-pointer to render task list
- mSceneObject = updateManager.GetRenderTaskList( mIsSystemLevel );
+ CreateSceneObject();
+
// set the callback to call us back when tasks are completed
mSceneObject->SetCompleteNotificationInterface( this );
}
+void RenderTaskList::CreateSceneObject()
+{
+ DALI_ASSERT_DEBUG( mSceneObject == NULL );
+
+ // Create a new render task list, Keep a const pointer to the render task list.
+ mSceneObject = SceneGraph::RenderTaskList::New();
+
+ OwnerPointer< SceneGraph::RenderTaskList > transferOwnership( const_cast< SceneGraph::RenderTaskList* >( mSceneObject ) );
+ AddRenderTaskListMessage( mEventThreadServices.GetUpdateManager(), transferOwnership );
+}
+
+void RenderTaskList::DestroySceneObject()
+{
+ if ( mSceneObject != NULL )
+ {
+ // Remove the render task list using a message to the update manager
+ RemoveRenderTaskListMessage( mEventThreadServices.GetUpdateManager(), *mSceneObject );
+ mSceneObject = NULL;
+ }
+}
+
void RenderTaskList::NotifyCompleted()
{
DALI_LOG_TRACE_METHOD(gLogRenderList);
class EventThreadServices;
class RenderTaskDefaults;
class Actor;
+class CameraActor;
+
+class RenderTaskList;
+typedef IntrusivePtr<RenderTaskList> RenderTaskListPtr;
namespace SceneGraph
{
/**
* Create a RenderTaskList.
- * @param[in] eventServices Used for sending message to the scene graph.
- * @param[in] defaults Provides the default source & camera actors.
- * @param[in] systemLevel True if this is the LayerList for actors added via the SystemLevel::Add().
* @return A newly allocated RenderTaskList; the caller takes ownership.
*/
- static RenderTaskList* New( EventThreadServices& eventServices, RenderTaskDefaults& defaults, bool systemLevel );
+ static RenderTaskListPtr New();
/**
* @copydoc Dali::RenderTaskList::CreateTask()
*/
Dali::RenderTask CreateTask();
+ /**
+ * @brief Creates a new RenderTask.
+ *
+ * This will be appended to the list of render-tasks.
+ *
+ * @param[in] sourceActor The actor and its children to be rendered for this render task.
+ * @param[in] cameraActor The actor from which the scene is viewed for this render task.
+ * @return A valid handle to a new RenderTask
+ */
+ Dali::RenderTask CreateTask( Actor* sourceActor, CameraActor* cameraActor);
+
/**
* @copydoc Dali::RenderTaskList::RemoveTask()
*/
/**
* Construct a new RenderTaskList.
- * @param[in] eventThreadServices Used for creating render-tasks in the scene graph.
- * @param[in] defaults Provides the default source & camera actors.
- * @param[in] systemLevel True if this is the system-level list.
*/
- RenderTaskList( EventThreadServices& eventThreadServices, RenderTaskDefaults& defaults, bool systemLevel );
+ RenderTaskList();
/**
* A reference counted object may only be deleted by calling Unreference()
/**
* 2nd-phase construction
*/
- void Initialize( SceneGraph::UpdateManager& updateManager );
+ void Initialize();
+
+ /**
+ * Helper to create a scene-graph render task list
+ */
+ void CreateSceneObject();
+
+ /**
+ * Helper to destroy a scene-graph render task list
+ */
+ void DestroySceneObject();
private: // from CompleteNotificationInterface
EventThreadServices& mEventThreadServices;
RenderTaskDefaults& mDefaults;
- bool mIsSystemLevel; ///< True if the layers are added via the SystemLevel API
-
SceneGraph::RenderTaskList* mSceneObject; ///< Raw-pointer to the scene-graph object; not owned.
RenderTaskContainer mTasks; ///< Reference counted render-tasks
const uint32_t FRAME_COUNT_TRIGGER = 16;\
if( mImpl->frameCounter >= FRAME_COUNT_TRIGGER )\
{\
- if ( NULL != mImpl->root )\
+ for( auto root : mImpl->roots )
{\
- mImpl->frameCounter = 0;\
- PrintNodeTree( *mImpl->root, mSceneGraphBuffers.GetUpdateBufferIndex(), "" );\
+ if ( NULL != root )\
+ {\
+ mImpl->frameCounter = 0;\
+ PrintNodeTree( *root, mSceneGraphBuffers.GetUpdateBufferIndex(), "" );\
+ }\
}\
}\
mImpl->frameCounter++;
renderInstructions( renderManager.GetRenderInstructionContainer() ),
renderTaskProcessor( renderTaskProcessor ),
backgroundColor( Dali::Stage::DEFAULT_BACKGROUND_COLOR ),
- taskList( renderMessageDispatcher ),
- systemLevelTaskList( renderMessageDispatcher ),
- root( NULL ),
- systemLevelRoot( NULL ),
renderers(),
textureSets(),
shaders(),
~Impl()
{
// Disconnect render tasks from nodes, before destroying the nodes
- RenderTaskList::RenderTaskContainer& tasks = taskList.GetTasks();
- for ( auto&& iter : tasks )
+ for( auto taskList : taskLists )
{
- iter->SetSourceNode( NULL );
- }
- // ..repeat for system level RenderTasks
- RenderTaskList::RenderTaskContainer& systemLevelTasks = systemLevelTaskList.GetTasks();
- for ( auto&& iter : systemLevelTasks )
- {
- iter->SetSourceNode( NULL );
+ RenderTaskList::RenderTaskContainer& tasks = taskList->GetTasks();
+ for ( auto&& task : tasks )
+ {
+ task->SetSourceNode( NULL );
+ }
}
// UpdateManager owns the Nodes. Although Nodes are pool allocated they contain heap allocated parts
Node::Delete(*iter);
}
- // If there is root, reset it, otherwise do nothing as rendering was never started
- if( root )
+ for( auto root : roots )
{
root->OnDestroy();
-
- Node::Delete( root );
- root = NULL;
- }
-
- if( systemLevelRoot )
- {
- systemLevelRoot->OnDestroy();
-
- Node::Delete( systemLevelRoot );
- systemLevelRoot = NULL;
}
delete sceneController;
Vector4 backgroundColor; ///< The glClear color used at the beginning of each frame.
- RenderTaskList taskList; ///< The list of scene graph render-tasks
- RenderTaskList systemLevelTaskList; ///< Separate render-tasks for system-level content
+ OwnerContainer<RenderTaskList*> taskLists; ///< A container of scene graph render task lists
- Layer* root; ///< The root node (root is a layer)
- Layer* systemLevelRoot; ///< A separate root-node for system-level content
+ OwnerContainer<Layer*> roots; ///< A container of root nodes (root is a layer). The layers are not stored in the node memory pool.
Vector<Node*> nodes; ///< A container of all instantiated nodes
- SortedLayerPointers sortedLayers; ///< A container of Layer pointers sorted by depth
- SortedLayerPointers systemLevelSortedLayers; ///< A separate container of system-level Layers
+ std::vector<SortedLayerPointers> sortedLayerLists; ///< A container of lists of Layer pointers sorted by depth (one list of sorted layers per root)
OwnerContainer< Camera* > cameras; ///< A container of cameras
OwnerContainer< PropertyOwner* > customObjects; ///< A container of owned objects (with custom properties)
delete mImpl;
}
-void UpdateManager::InstallRoot( OwnerPointer<Layer>& layer, bool systemLevel )
+void UpdateManager::InstallRoot( OwnerPointer<Layer>& layer )
{
DALI_ASSERT_DEBUG( layer->IsLayer() );
DALI_ASSERT_DEBUG( layer->GetParent() == NULL);
- if ( !systemLevel )
- {
- DALI_ASSERT_DEBUG( mImpl->root == NULL && "Root Node already installed" );
- mImpl->root = layer.Release();
- mImpl->root->CreateTransform( &mImpl->transformManager );
- mImpl->root->SetRoot(true);
- }
- else
- {
- DALI_ASSERT_DEBUG( mImpl->systemLevelRoot == NULL && "System-level Root Node already installed" );
- mImpl->systemLevelRoot = layer.Release();
- mImpl->systemLevelRoot->CreateTransform( &mImpl->transformManager );
- mImpl->systemLevelRoot->SetRoot(true);
- }
+ Layer* rootLayer = layer.Release();
+
+ DALI_ASSERT_DEBUG( std::find( mImpl->roots.begin(), mImpl->roots.end(), rootLayer ) == mImpl->roots.end() && "Root Node already installed" );
+ rootLayer->CreateTransform( &mImpl->transformManager );
+ rootLayer->SetRoot(true);
+ mImpl->roots.PushBack( rootLayer );
}
void UpdateManager::AddNode( OwnerPointer<Node>& node )
mImpl->customObjects.EraseObject( object );
}
+void UpdateManager::AddRenderTaskList( OwnerPointer<RenderTaskList>& taskList )
+{
+ RenderTaskList* taskListPointer = taskList.Release();
+ taskListPointer->SetRenderMessageDispatcher( &mImpl->renderMessageDispatcher );
+ mImpl->taskLists.PushBack( taskListPointer );
+}
+
+void UpdateManager::RemoveRenderTaskList( RenderTaskList* taskList )
+{
+ mImpl->taskLists.EraseObject( taskList );
+}
+
void UpdateManager::AddAnimation( OwnerPointer< SceneGraph::Animation >& animation )
{
mImpl->animations.PushBack( animation.Release() );
mImpl->textureSets.EraseObject( textureSet );
}
-RenderTaskList* UpdateManager::GetRenderTaskList( bool systemLevel )
-{
- if ( !systemLevel )
- {
- // copy the list, this is only likely to happen once in application life cycle
- return &(mImpl->taskList);
- }
- else
- {
- // copy the list, this is only likely to happen once in application life cycle
- return &(mImpl->systemLevelTaskList);
- }
-}
-
uint32_t* UpdateManager::ReserveMessageSlot( uint32_t size, bool updateScene )
{
return mImpl->messageQueue.ReserveMessageSlot( size, updateScene );
void UpdateManager::ConstrainRenderTasks( BufferIndex bufferIndex )
{
- // Constrain system-level render-tasks
- const RenderTaskList::RenderTaskContainer& systemLevelTasks = mImpl->systemLevelTaskList.GetTasks();
- for ( auto&& task : systemLevelTasks )
- {
- ConstrainPropertyOwner( *task, bufferIndex );
- }
-
// Constrain render-tasks
- const RenderTaskList::RenderTaskContainer& tasks = mImpl->taskList.GetTasks();
- for ( auto&& task : tasks )
+ for( auto taskList : mImpl->taskLists )
{
- ConstrainPropertyOwner( *task, bufferIndex );
+ RenderTaskList::RenderTaskContainer& tasks = taskList->GetTasks();
+ for ( auto&& task : tasks )
+ {
+ ConstrainPropertyOwner( *task, bufferIndex );
+ }
}
}
{
mImpl->nodeDirtyFlags = NodePropertyFlags::NOTHING;
- if ( !mImpl->root )
+ for( auto&& rootLayer : mImpl->roots )
{
- return;
- }
-
- // Prepare resources, update shaders, for each node
- // And add the renderers to the sorted layers. Start from root, which is also a layer
- mImpl->nodeDirtyFlags = UpdateNodeTree( *( mImpl->root ),
- bufferIndex,
- mImpl->renderQueue );
-
- if ( mImpl->systemLevelRoot )
- {
- mImpl->nodeDirtyFlags |= UpdateNodeTree( *( mImpl->systemLevelRoot ),
- bufferIndex,
- mImpl->renderQueue );
+ // Prepare resources, update shaders, for each node
+ // And add the renderers to the sorted layers. Start from root, which is also a layer
+ mImpl->nodeDirtyFlags |= UpdateNodeTree( *rootLayer,
+ bufferIndex,
+ mImpl->renderQueue );
}
}
ConstrainCustomObjects( bufferIndex );
//Clear the lists of renderers from the previous update
- for( auto&& layer : mImpl->sortedLayers )
+ for( auto sortedLayers : mImpl->sortedLayerLists )
{
- layer->ClearRenderables();
- }
-
- for( auto&& layer : mImpl->systemLevelSortedLayers )
- {
- layer->ClearRenderables();
+ for( auto&& layer : sortedLayers )
+ {
+ layer->ClearRenderables();
+ }
}
//Update node hierarchy, apply constraints and perform sorting / culling.
//reset the update buffer index and make sure there is enough room in the instruction container
if( mImpl->renderersAdded )
{
- mImpl->renderInstructions.ResetAndReserve( bufferIndex, mImpl->taskList.GetTaskCount() + mImpl->systemLevelTaskList.GetTaskCount() );
+ // Calculate how many render tasks we have in total
+ VectorBase::SizeType numberOfRenderTasks = 0;
+
+ const VectorBase::SizeType taskListCount = mImpl->taskLists.Count();
+ for ( VectorBase::SizeType index = 0u; index < taskListCount; index++ )
+ {
+ numberOfRenderTasks += mImpl->taskLists[index]->GetTasks().Count();
+ }
- if ( NULL != mImpl->root )
+ mImpl->renderInstructions.ResetAndReserve( bufferIndex,
+ static_cast<uint32_t>( numberOfRenderTasks ) );
+
+ for ( VectorBase::SizeType index = 0u; index < taskListCount; index++ )
{
- mImpl->renderTaskProcessor.Process( bufferIndex,
- mImpl->taskList,
- *mImpl->root,
- mImpl->sortedLayers,
- mImpl->renderInstructions,
- renderToFboEnabled,
- isRenderingToFbo );
-
- // Process the system-level RenderTasks last
- if ( NULL != mImpl->systemLevelRoot )
+ if ( NULL != mImpl->roots[index] )
{
mImpl->renderTaskProcessor.Process( bufferIndex,
- mImpl->systemLevelTaskList,
- *mImpl->systemLevelRoot,
- mImpl->systemLevelSortedLayers,
+ *mImpl->taskLists[index],
+ *mImpl->roots[index],
+ mImpl->sortedLayerLists[index],
mImpl->renderInstructions,
renderToFboEnabled,
isRenderingToFbo );
}
}
- // check the countdown and notify (note, at the moment this is only done for normal tasks, not for systemlevel tasks)
- bool doRenderOnceNotify = false;
- mImpl->renderTaskWaiting = false;
- for ( auto&& renderTask : mImpl->taskList.GetTasks() )
+ for( auto taskList : mImpl->taskLists )
{
- renderTask->UpdateState();
+ RenderTaskList::RenderTaskContainer& tasks = taskList->GetTasks();
- if( renderTask->IsWaitingToRender() &&
- renderTask->ReadyToRender( bufferIndex ) /*avoid updating forever when source actor is off-stage*/ )
+ // check the countdown and notify
+ bool doRenderOnceNotify = false;
+ mImpl->renderTaskWaiting = false;
+ for ( auto&& renderTask : tasks )
{
- mImpl->renderTaskWaiting = true; // keep update/render threads alive
+ renderTask->UpdateState();
+
+ if( renderTask->IsWaitingToRender() &&
+ renderTask->ReadyToRender( bufferIndex ) /*avoid updating forever when source actor is off-stage*/ )
+ {
+ mImpl->renderTaskWaiting = true; // keep update/render threads alive
+ }
+
+ if( renderTask->HasRendered() )
+ {
+ doRenderOnceNotify = true;
+ }
}
- if( renderTask->HasRendered() )
+ if( doRenderOnceNotify )
{
- doRenderOnceNotify = true;
+ DALI_LOG_INFO(gRenderTaskLogFilter, Debug::General, "Notify a render task has finished\n");
+ mImpl->notificationManager.QueueCompleteNotification( taskList->GetCompleteNotificationInterface() );
}
}
- if( doRenderOnceNotify )
- {
- DALI_LOG_INFO(gRenderTaskLogFilter, Debug::General, "Notify a render task has finished\n");
- mImpl->notificationManager.QueueCompleteNotification( mImpl->taskList.GetCompleteNotificationInterface() );
- }
-
// Macro is undefined in release build.
SNAPSHOT_NODE_LOGGING;
mImpl->renderingBehavior = renderingBehavior;
}
-void UpdateManager::SetLayerDepths( const SortedLayerPointers& layers, bool systemLevel )
+void UpdateManager::SetLayerDepths( const SortedLayerPointers& layers, const Layer* rootLayer )
{
- if ( !systemLevel )
- {
- // just copy the vector of pointers
- mImpl->sortedLayers = layers;
- }
- else
+ const VectorBase::SizeType rootCount = mImpl->roots.Count();
+
+ // Make sure we reserve the correct size for the container so that
+ // we can save the sorted layers in the same order as the root layer
+ mImpl->sortedLayerLists.resize( rootCount );
+
+ for ( VectorBase::SizeType rootIndex = 0u; rootIndex < rootCount; rootIndex++ )
{
- mImpl->systemLevelSortedLayers = layers;
+ Layer* root = mImpl->roots[rootIndex];
+ if ( root == rootLayer )
+ {
+ mImpl->sortedLayerLists[rootIndex] = layers;
+ break;
+ }
}
}
iter.node->SetDepthIndex( iter.sortedDepth );
}
- // Go through node hierarchy and rearrange siblings according to depth-index
- SortSiblingNodesRecursively( *( mImpl->root ) );
+ for( auto root : mImpl->roots )
+ {
+ // Go through node hierarchy and rearrange siblings according to depth-index
+ SortSiblingNodesRecursively( *root );
+ }
}
bool UpdateManager::IsDefaultSurfaceRectChanged()
#include <dali/internal/update/rendering/scene-graph-texture-set.h> // for OwnerPointer< TextureSet >
#include <dali/internal/update/gestures/scene-graph-pan-gesture.h>
#include <dali/internal/update/render-tasks/scene-graph-camera.h>
+#include <dali/internal/update/render-tasks/scene-graph-render-task-list.h>
#include <dali/internal/render/shaders/scene-graph-shader.h> // for OwnerPointer< Shader >
#include <dali/internal/render/renderers/render-property-buffer.h>
#include <dali/internal/event/rendering/texture-impl.h>
* @pre The layer is of derived Node type Layer.
* @pre The layer does not have a parent.
* @param[in] layer The new root node.
- * @param[in] systemLevel True if using the system-level overlay.
* @post The node is owned by UpdateManager.
*/
- void InstallRoot( OwnerPointer<Layer>& layer, bool systemLevel );
+ void InstallRoot( OwnerPointer<Layer>& layer );
/**
* Add a Node; UpdateManager takes ownership.
*/
void RemoveObject( PropertyOwner* object );
+ /**
+ * Add a newly created render task list.
+ * @param[in] taskList The render task list to add.
+ * @post The render task list is owned by UpdateManager.
+ */
+ void AddRenderTaskList( OwnerPointer<RenderTaskList>& taskList );
+
+ /**
+ * Remove a render task list.
+ * @param[in] taskList The render task list to remove.
+ */
+ void RemoveRenderTaskList( RenderTaskList* taskList );
+
// Animations
/**
/**
* Sets the depths of all layers.
* @param layers The layers in depth order.
- * @param[in] systemLevel True if using the system-level overlay.
+ * @param[in] rootLayer The root layer of the sorted layers.
*/
- void SetLayerDepths( const std::vector< Layer* >& layers, bool systemLevel );
+ void SetLayerDepths( const std::vector< Layer* >& layers, const Layer* rootLayer );
/**
* Set the depth indices of all nodes (in LayerUI's)
// Messages for UpdateManager
-inline void InstallRootMessage( UpdateManager& manager, OwnerPointer<Layer>& root, bool systemLevel )
+inline void InstallRootMessage( UpdateManager& manager, OwnerPointer<Layer>& root )
{
// Message has ownership of Layer while in transit from event -> update
- typedef MessageValue2< UpdateManager, OwnerPointer<Layer>, bool > LocalType;
+ typedef MessageValue1< UpdateManager, OwnerPointer<Layer> > LocalType;
// Reserve some memory inside the message queue
uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::InstallRoot, root, systemLevel );
+ new (slot) LocalType( &manager, &UpdateManager::InstallRoot, root );
}
inline void AddNodeMessage( UpdateManager& manager, OwnerPointer<Node>& node )
new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
}
+inline void AddRenderTaskListMessage( UpdateManager& manager, OwnerPointer< SceneGraph::RenderTaskList >& taskList )
+{
+ typedef MessageValue1< UpdateManager, OwnerPointer< SceneGraph::RenderTaskList > > LocalType;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &manager, &UpdateManager::AddRenderTaskList, taskList );
+}
+
+inline void RemoveRenderTaskListMessage( UpdateManager& manager, const RenderTaskList& constTaskList )
+{
+ // The scene-graph thread owns this object so it can safely edit it.
+ RenderTaskList& taskList = const_cast< RenderTaskList& >( constTaskList );
+
+ typedef MessageValue1< UpdateManager, RenderTaskList* > LocalType;
+
+ // Reserve some memory inside the message queue
+ uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
+
+ // Construct message in the message queue memory; note that delete should not be called on the return value
+ new (slot) LocalType( &manager, &UpdateManager::RemoveRenderTaskList, &taskList );
+}
+
inline void AddPropertyNotificationMessage( UpdateManager& manager, OwnerPointer< PropertyNotification >& propertyNotification )
{
// Message has ownership of PropertyNotification while in transit from event -> update
* Create a message for setting the depth of a layer
* @param[in] manager The update manager
* @param[in] layers list of layers
- * @param[in] systemLevel True if the layers are added via the SystemOverlay API
+ * @param[in] rootLayer True if the layers are added via the SystemOverlay API
*/
-inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, bool systemLevel )
+inline void SetLayerDepthsMessage( UpdateManager& manager, const std::vector< Layer* >& layers, const Layer* rootLayer )
{
- typedef MessageValue2< UpdateManager, std::vector< Layer* >, bool > LocalType;
+ typedef MessageValue2< UpdateManager, std::vector< Layer* >, const Layer* > LocalType;
// Reserve some memory inside the message queue
uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, systemLevel );
+ new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, rootLayer );
}
inline void AddRendererMessage( UpdateManager& manager, OwnerPointer< Renderer >& object )
*/
static SceneGraph::Layer* New( uint32_t id );
+ /**
+ * Virtual destructor
+ */
+ virtual ~Layer();
+
/**
* From Node, to convert a node to a layer.
* @return The layer.
// Undefined
Layer(const Layer&);
- /**
- * Virtual destructor
- */
- virtual ~Layer();
-
// Undefined
Layer& operator=(const Layer& rhs);
#include <dali/internal/update/render-tasks/scene-graph-render-task-list.h>
// INTERNAL INCLUDES
-#include <dali/internal/update/render-tasks/scene-graph-render-task.h>
+#include <dali/internal/common/memory-pool-object-allocator.h>
+
+namespace //Unnamed namespace
+{
+
+//Memory pool used to allocate new RenderTaskLists. Memory used by this pool will be released when shutting down DALi
+Dali::Internal::MemoryPoolObjectAllocator<Dali::Internal::SceneGraph::RenderTaskList> gRenderTaskListMemoryPool;
+
+} // unnamed namespace
namespace Dali
{
namespace SceneGraph
{
-RenderTaskList::RenderTaskList( RenderMessageDispatcher& renderMessageDispatcher )
+RenderTaskList* RenderTaskList::New()
+{
+ return new ( gRenderTaskListMemoryPool.AllocateRawThreadSafe() ) RenderTaskList();
+}
+
+RenderTaskList::RenderTaskList()
: mNotificationObject( NULL ),
- mRenderMessageDispatcher( renderMessageDispatcher )
+ mRenderMessageDispatcher( NULL )
{
}
{
}
+void RenderTaskList::operator delete( void* ptr )
+{
+ gRenderTaskListMemoryPool.FreeThreadSafe( static_cast<RenderTaskList*>( ptr ) );
+}
+
+void RenderTaskList::SetRenderMessageDispatcher( RenderMessageDispatcher* renderMessageDispatcher )
+{
+ mRenderMessageDispatcher = renderMessageDispatcher;
+}
+
void RenderTaskList::AddTask( OwnerPointer< RenderTask >& newTask )
{
DALI_ASSERT_DEBUG( newTask != NULL && "SceneGraph RenderTask is null");
+ DALI_ASSERT_DEBUG( mRenderMessageDispatcher != NULL && "RenderMessageDispatcher is null");
- newTask->Initialize( mRenderMessageDispatcher );
+ newTask->Initialize( *mRenderMessageDispatcher );
// mRenderTasks container takes ownership
mRenderTasks.PushBack( newTask.Release() );
}
#include <dali/devel-api/common/owner-container.h>
#include <dali/internal/common/message.h>
#include <dali/internal/event/common/event-thread-services.h>
+#include <dali/internal/update/render-tasks/scene-graph-render-task.h>
namespace Dali
{
typedef OwnerContainer< RenderTask* > RenderTaskContainer;
/**
- * Constructor
- * @param renderMessageDispatcher to send messages
+ * Construct a new RenderTaskList.
+ * @return A new RenderTaskList
*/
- RenderTaskList( RenderMessageDispatcher& renderMessageDispatcher );
+ static RenderTaskList* New();
/**
* Destructor
*/
~RenderTaskList();
+ /**
+ * Overriden delete operator
+ * Deletes the RenderTaskList from its global memory pool
+ */
+ void operator delete( void* ptr );
+
+ /**
+ * Set the renderMessageDispatcher to send message.
+ * @param[in] renderMessageDispatcher The renderMessageDispatcher to send messages.
+ */
+ void SetRenderMessageDispatcher( RenderMessageDispatcher* renderMessageDispatcher );
+
/**
* Add a new RenderTask to the list.
* @param[in] newTask The RenderTaskList takes ownership of this task.
*/
CompleteNotificationInterface* GetCompleteNotificationInterface();
+protected:
+
+ /**
+ * Protected constructor. See New()
+ */
+ RenderTaskList();
+
private:
// Undefined
private:
CompleteNotificationInterface* mNotificationObject; ///< object to pass in to the complete notification
- RenderMessageDispatcher& mRenderMessageDispatcher; ///< for sending messages to render thread
+ RenderMessageDispatcher* mRenderMessageDispatcher; ///< for sending messages to render thread
RenderTaskContainer mRenderTasks; ///< A container of owned RenderTasks
};