X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Frender-tasks%2Fscene-graph-render-task.h;h=b66077ef42e0352da457bbb443700f4ac519c91a;hb=refs%2Fchanges%2F06%2F168606%2F1;hp=698abe6dcccb6155d66c0986829d965f0958633c;hpb=956396a07f6ab262893ac0636119a5f3878da083;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/update/render-tasks/scene-graph-render-task.h b/dali/internal/update/render-tasks/scene-graph-render-task.h index 698abe6..b66077e 100644 --- a/dali/internal/update/render-tasks/scene-graph-render-task.h +++ b/dali/internal/update/render-tasks/scene-graph-render-task.h @@ -1,8 +1,8 @@ -#ifndef __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_H__ -#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_H__ +#ifndef DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_H +#define DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_H /* - * Copyright (c) 2014 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. @@ -26,14 +26,13 @@ #include #include #include +#include namespace Dali { namespace Internal { -class FrameBufferTexture; -class ResourceManager; namespace Render { @@ -43,7 +42,7 @@ class RenderTracker; namespace SceneGraph { class Node; -class CameraAttachment; +class Camera; class RenderInstruction; class RenderMessageDispatcher; @@ -75,9 +74,8 @@ public: /** * Initialize the render task. Called in update thread * @param[in] renderMessageDispatcher to send messages to render thread - * @param[in] resourceManager to check and update status of FBOs */ - void Initialize( RenderMessageDispatcher& renderMessageDispatcher, ResourceManager& resourceManager ); + void Initialize( RenderMessageDispatcher& renderMessageDispatcher ); /** * Set the nodes to be rendered. @@ -104,23 +102,23 @@ public: bool IsExclusive() const; /** - * Set the node from which the scene is viewed. - * @param[in] node The scene is viewed from the perspective of this node. + * Set the camera from which the scene is viewed. + * @param[in] cameraNode that camera is connected with + * @param[in] camera to use. */ - void SetCameraNode( Node* node ); + void SetCamera( Node* cameraNode, Camera* camera ); /** * Set the frame-buffer used as a render target. - * @param[in] resourceId The resource ID of the frame-buffer, or zero if not rendering off-screen. - * @param[in] isNativeFBO if this render task is targeting a native FBO + * @param[in] frameBuffer The framebuffer */ - void SetFrameBufferId( unsigned int resourceId, bool isNativeFBO ); + void SetFrameBuffer( Render::FrameBuffer* frameBuffer ); /** * Retrieve the resource ID of the frame-buffer. * @return The resource ID, or zero if not rendering off-screen. */ - unsigned int GetFrameBufferId() const; + Render::FrameBuffer* GetFrameBuffer(); /** * Set the value of property viewportPosition @@ -257,12 +255,6 @@ public: bool IsRenderRequired(); /** - * Set whether all resources were available when the render-task was processed - * @param[in] resourcesComplete True if the resources of the source tree are completely loaded. - */ - void SetResourcesFinished( bool resourcesFinished ); - - /** * Process a frame. This method is called each frame for every ready render task, regardless * of whether it needs to render (so that the frame counter can be updated). */ @@ -289,23 +281,23 @@ public: /** * Retrieve the view-matrix; this is double buffered for input handling. - * @pre GetCameraNode() returns a node with valid CameraAttachment. + * @pre GetCameraNode() returns a node with valid Camera. * @param[in] bufferIndex The buffer to read from. * @return The view-matrix. */ const Matrix& GetViewMatrix( BufferIndex bufferIndex ) const; /** - * @brief Retrieve the camera attachment. - * @pre GetCameraNode() returns a node with valid CameraAttachment. + * @brief Retrieve the camera. + * @pre GetCameraNode() returns a node with valid Camera. * - * @return The camera attachment. + * @return The camera. */ - SceneGraph::CameraAttachment& GetCameraAttachment() const; + SceneGraph::Camera& GetCamera() const; /** * Retrieve the projection-matrix; this is double buffered for input handling. - * @pre GetCameraNode() returns a node with valid CameraAttachment. + * @pre GetCameraNode() returns a node with valid Camera. * @param[in] bufferIndex The buffer to read from. * @return The projection-matrix. */ @@ -329,9 +321,10 @@ public: bool ViewMatrixUpdated(); /** - * @return A pointer to the camera used by the RenderTask + * Indicate whether GL sync is required for native render target. + * @param[in] requiresSync whether GL sync is required for native render target */ - Node* GetCamera() const; + void SetSyncRequired( bool requiresSync ); private: @@ -346,9 +339,6 @@ private: // Undefined RenderTask& operator=(const RenderTask&); -private: // PropertyOwner - - virtual void ResetDefaultProperties( BufferIndex currentBufferIndex ); public: // Animatable Properties AnimatableProperty< Vector2 > mViewportPosition; ///< viewportPosition @@ -357,43 +347,37 @@ public: // Animatable Properties private: RenderMessageDispatcher* mRenderMessageDispatcher; - ResourceManager* mResourceManager; Render::RenderTracker* mRenderSyncTracker; Node* mSourceNode; Node* mCameraNode; - CameraAttachment* mCameraAttachment; - unsigned int mFrameBufferResourceId; + SceneGraph::Camera* mCamera; + Render::FrameBuffer* mFrameBuffer; - bool mResourcesFinished:1; ///< True if all resources were available when the render-task was processed bool mWaitingToRender:1; ///< True when an render once to FBO is waiting bool mNotifyTrigger:1; ///< True if a render once render task has finished renderering bool mExclusive: 1; ///< Whether the render task has exclusive access to the source actor (node in the scene graph implementation). bool mClearEnabled: 1; ///< Whether previous results are cleared. bool mCullMode: 1; ///< Whether renderers should be frustum culled - FrameBufferTexture* mRenderTarget; - Viewport mViewport; - State mState; ///< Render state. unsigned int mRefreshRate; ///< REFRESH_ONCE, REFRESH_ALWAYS or render every N frames unsigned int mFrameCounter; ///< counter for rendering every N frames unsigned int mRenderedOnceCounter; ///< Incremented whenever state changes to RENDERED_ONCE_AND_NOTIFIED - bool mTargetIsNativeFramebuffer; ///< Tells if our target is a native framebuffer + bool mRequiresSync; ///< Whether sync is needed to track the render }; // Messages for RenderTask - -inline void SetFrameBufferIdMessage( EventThreadServices& eventThreadServices, RenderTask& task, unsigned int resourceId, bool isNativeFBO ) +inline void SetFrameBufferMessage( EventThreadServices& eventThreadServices, RenderTask& task, Render::FrameBuffer* frameBuffer ) { - typedef MessageValue2< RenderTask, unsigned int, bool > LocalType; + typedef MessageValue1< RenderTask, Render::FrameBuffer*> LocalType; // Reserve some memory inside the message queue unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &task, &RenderTask::SetFrameBufferId, resourceId, isNativeFBO ); + new (slot) LocalType( &task, &RenderTask::SetFrameBuffer, frameBuffer ); } inline void SetClearColorMessage( EventThreadServices& eventThreadServices, RenderTask& task, const Vector4& value ) @@ -465,21 +449,31 @@ inline void SetSourceNodeMessage( EventThreadServices& eventThreadServices, Rend new (slot) LocalType( &task, &RenderTask::SetSourceNode, node ); } -inline void SetCameraNodeMessage( EventThreadServices& eventThreadServices, RenderTask& task, const Node* constNode ) +inline void SetCameraMessage( EventThreadServices& eventThreadServices, RenderTask& task, const Node* constNode, const Camera* constCamera ) { - // Scene graph thread can destroy this object. + typedef MessageValue2< RenderTask, Node*, Camera* > LocalType; + Node* node = const_cast< Node* >( constNode ); + Camera* camera = const_cast< Camera* >( constCamera ); + // Reserve memory inside the message queue + unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); - typedef MessageValue1< RenderTask, Node* > LocalType; + // Construct message in the message queue memory; note that delete should not be called on the return value + new (slot) LocalType( &task, &RenderTask::SetCamera, node, camera ); +} + +inline void SetExclusiveMessage( EventThreadServices& eventThreadServices, RenderTask& task, bool exclusive ) +{ + typedef MessageValue1< RenderTask, bool > LocalType; // Reserve some memory inside the message queue unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &task, &RenderTask::SetCameraNode, node ); + new (slot) LocalType( &task, &RenderTask::SetExclusive, exclusive ); } -inline void SetExclusiveMessage( EventThreadServices& eventThreadServices, RenderTask& task, bool exclusive ) +inline void SetSyncRequiredMessage(EventThreadServices& eventThreadServices, RenderTask& task, bool requiresSync ) { typedef MessageValue1< RenderTask, bool > LocalType; @@ -487,7 +481,7 @@ inline void SetExclusiveMessage( EventThreadServices& eventThreadServices, Rende unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) ); // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( &task, &RenderTask::SetExclusive, exclusive ); + new (slot) LocalType( &task, &RenderTask::SetSyncRequired, requiresSync ); } inline void BakeViewportPositionMessage( EventThreadServices& eventThreadServices, const RenderTask& task, const Vector2& value ) @@ -518,4 +512,4 @@ inline void BakeViewportSizeMessage( EventThreadServices& eventThreadServices, c } // namespace Dali -#endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_H__ +#endif // DALI_INTERNAL_SCENE_GRAPH_RENDER_TASK_H