X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Fcommon%2Fscene-graph-scene.h;h=f1f0f5adde8d31c69e440bbb38ee865966dc6bf3;hb=refs%2Fchanges%2F34%2F267634%2F4;hp=ab6cde41a613b116bc9e57b95aaf1b3b0a0dd227;hpb=da4ad1b400618f4663547453326cffa8a6c789cc;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/update/common/scene-graph-scene.h b/dali/internal/update/common/scene-graph-scene.h index ab6cde4..f1f0f5a 100644 --- a/dali/internal/update/common/scene-graph-scene.h +++ b/dali/internal/update/common/scene-graph-scene.h @@ -18,6 +18,8 @@ */ // INTERNAL INCLUDES +#include +#include #include #include #include @@ -28,11 +30,54 @@ namespace Dali { namespace Internal { -class Context; +namespace Render +{ +class Renderer; +} namespace SceneGraph { class RenderInstructionContainer; +class Node; + +struct DirtyRect +{ + DirtyRect(Node* node, Render::Renderer* renderer, int32_t frame, Rect& rect) + : node(node), + renderer(renderer), + frame(frame), + rect(rect), + visited(true) + { + } + + DirtyRect() = default; + + bool operator<(const DirtyRect& rhs) const + { + if(node == rhs.node) + { + if(renderer == rhs.renderer) + { + return frame > rhs.frame; // Most recent rects come first + } + else + { + return renderer < rhs.renderer; + } + } + else + { + return node < rhs.node; + } + } + + Node* node{nullptr}; + Render::Renderer* renderer{nullptr}; + int32_t frame{0}; + Rect rect{}; + bool visited{true}; +}; class Scene { @@ -50,15 +95,11 @@ public: /** * Creates a scene object in the GPU. - * @param[in] context The GL context - */ - void Initialize(Context& context); - - /** - * Gets the context holding the GL state of rendering for the scene - * @return the context + * @param[in] graphicsController The graphics controller + * @param[in] depthBufferAvailable True if there is a depth buffer + * @param[in] stencilBufferAvailable True if there is a stencil buffer */ - Context* GetContext(); + void Initialize(Graphics::Controller& graphicsController, Integration::DepthBufferAvailable depthBufferAvailable, Integration::StencilBufferAvailable stencilBufferAvailable); /** * Gets the render instructions for the scene @@ -142,7 +183,6 @@ public: /** * Set the surface orientation when surface is rotated. * - * @param[in] scene The rotated scene. * @param[in] orientation The orientation value representing the surface. */ void SetSurfaceOrientation(int32_t orientation); @@ -160,9 +200,72 @@ public: */ bool IsSurfaceRectChanged(); -private: - Context* mContext; ///< The context holding the GL state of rendering for the scene, not owned + /** + * @brief Set the internal flag to acknowledge surface rotation. + */ + void SetRotationCompletedAcknowledgement(); + + /** + * @brief Query wheter is set to acknowledge for completing surface rotation. + * @return true it should be acknowledged. + */ + bool IsRotationCompletedAcknowledgementSet(); + + /** + * Set the render target of the surface + * + * @param[in] renderTarget The render target. + */ + void SetSurfaceRenderTarget(Graphics::RenderTarget* renderTarget) + { + mRenderTarget = renderTarget; + } + + /** + * Get the render target created for the scene + * + * @return the render target + */ + [[nodiscard]] Graphics::RenderTarget* GetSurfaceRenderTarget() const + { + return mRenderTarget; + } + + /** + * Get the graphics render pass created for the scene + * + * @return the graphics render pass + */ + [[nodiscard]] Graphics::RenderPass* GetGraphicsRenderPass(Graphics::AttachmentLoadOp loadOp, Graphics::AttachmentStoreOp storeOp) const + { + if(loadOp == Graphics::AttachmentLoadOp::CLEAR) + { + return mRenderPass.get(); + } + else + { + return mRenderPassNoClear.get(); + } + } + + /** + * Get an initialized array of clear values which then can be modified and accessed to BeginRenderPass() command. + * + * @return the array of clear values + */ + [[nodiscard]] auto& GetGraphicsRenderPassClearValues() + { + return mClearValues; + } + /** + * @brief Get ItemsDirtyRects + * + * @return the ItemsDirtyRects + */ + std::vector& GetItemsDirtyRects(); + +private: // Render instructions describe what should be rendered during RenderManager::RenderScene() // Update manager updates instructions for the next frame while we render the current one @@ -173,9 +276,24 @@ private: bool mSkipRendering; ///< A flag to skip rendering - Rect mSurfaceRect; ///< The rectangle of surface which is related ot this scene. - int32_t mSurfaceOrientation; ///< The orientation of surface which is related of this scene - bool mSurfaceRectChanged; ///< The flag of surface's rectangle is changed when is resized, moved or rotated. + Rect mSurfaceRect; ///< The rectangle of surface which is related ot this scene. + int32_t mSurfaceOrientation; ///< The orientation of surface which is related of this scene + bool mSurfaceRectChanged; ///< The flag of surface's rectangle is changed when is resized, moved or rotated. + bool mRotationCompletedAcknowledgement; ///< The flag of sending the acknowledgement to complete window rotation. + + // Render pass and render target + + /** + * Render pass is created on fly depending on Load and Store operations + * The default render pass (most likely to be used) is the load = CLEAR + * and store = STORE for color attachment. + */ + Graphics::UniquePtr mRenderPass{nullptr}; ///< The render pass created to render the surface + Graphics::UniquePtr mRenderPassNoClear{nullptr}; ///< The render pass created to render the surface without clearing color + Graphics::RenderTarget* mRenderTarget{nullptr}; ///< This is created in the event thread when surface is created/resized/replaced + + std::vector mClearValues{}; ///< Clear colors + std::vector mItemsDirtyRects{}; ///< Dirty rect list }; /// Messages @@ -223,6 +341,28 @@ inline void SetSurfaceOrientationMessage(EventThreadServices& eventThreadService new(slot) LocalType(&scene, &Scene::SetSurfaceOrientation, orientation); } +inline void SetRotationCompletedAcknowledgementMessage(EventThreadServices& eventThreadServices, const Scene& scene) +{ + using LocalType = Message; + + // Reserve some memory inside the message queue + uint32_t* 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(&scene, &Scene::SetRotationCompletedAcknowledgement); +} + +inline void SetSurfaceRenderTargetMessage(EventThreadServices& eventThreadServices, const Scene& scene, Graphics::RenderTarget* renderTarget) +{ + using LocalType = MessageValue1; + + // Reserve some memory inside the message queue + uint32_t* 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(&scene, &Scene::SetSurfaceRenderTarget, renderTarget); +} + } // namespace SceneGraph } // namespace Internal