X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Fcommon%2Fscene-graph-scene.cpp;h=36b4049320731f6b218ccce912d396b5ad279fce;hb=5c90c8f9fc80c6802da0694710abf4e164b5360f;hp=0d80de26643d96f49fe43bba792794f3bdcebb52;hpb=d5be622593d4ab0091103b5969232c11fcf653a4;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/update/common/scene-graph-scene.cpp b/dali/internal/update/common/scene-graph-scene.cpp index 0d80de2..36b4049 100644 --- a/dali/internal/update/common/scene-graph-scene.cpp +++ b/dali/internal/update/common/scene-graph-scene.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Samsung Electronics Co., Ltd. + * Copyright (c) 2022 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. @@ -18,8 +18,8 @@ #include // INTERNAL INCLUDES +#include #include -#include namespace Dali { @@ -27,15 +27,14 @@ namespace Internal { namespace SceneGraph { - Scene::Scene() -: mContext( nullptr ), - mFrameRenderedCallbacks(), +: mFrameRenderedCallbacks(), mFramePresentedCallbacks(), - mSkipRendering( false ), + mSkipRendering(false), mSurfaceRect(), - mSurfaceOrientation( 0 ), - mSurfaceRectChanged( false ) + mSurfaceOrientation(0), + mSurfaceRectChanged(false), + mRotationCompletedAcknowledgement(false) { } @@ -45,14 +44,54 @@ Scene::~Scene() mFramePresentedCallbacks.clear(); } -void Scene::Initialize( Context& context ) +void Scene::Initialize(Graphics::Controller& graphicsController, Integration::DepthBufferAvailable depthBufferAvailable, Integration::StencilBufferAvailable stencilBufferAvailable) { - mContext = &context; -} + // Create the render pass for the surface + std::vector attachmentDescriptions; -Context* Scene::GetContext() -{ - return mContext; + // Default behaviour for color attachments is to CLEAR and STORE + mClearValues.clear(); + mClearValues.emplace_back(); + + // Assume single color attachment + Graphics::AttachmentDescription desc{}; + desc.SetLoadOp(Graphics::AttachmentLoadOp::CLEAR); + desc.SetStoreOp(Graphics::AttachmentStoreOp::STORE); + attachmentDescriptions.push_back(desc); + + if(depthBufferAvailable == Integration::DepthBufferAvailable::TRUE || + stencilBufferAvailable == Integration::StencilBufferAvailable::TRUE) + { + // Depth + desc.SetLoadOp(Graphics::AttachmentLoadOp::CLEAR); + desc.SetStoreOp(Graphics::AttachmentStoreOp::STORE); + + // Stencil + desc.SetStencilLoadOp(Graphics::AttachmentLoadOp::CLEAR); + desc.SetStencilStoreOp(Graphics::AttachmentStoreOp::STORE); + attachmentDescriptions.push_back(desc); + + mClearValues.emplace_back(); + mClearValues.back().depthStencil.depth = 0; + mClearValues.back().depthStencil.stencil = 0; + } + + Graphics::RenderPassCreateInfo rpInfo{}; + rpInfo.SetAttachments(attachmentDescriptions); + + // Add default render pass (loadOp = clear) + mRenderPass = graphicsController.CreateRenderPass(rpInfo, nullptr); // Warning: Shallow ptr + + desc.SetLoadOp(Graphics::AttachmentLoadOp::LOAD); + attachmentDescriptions[0] = desc; + if(attachmentDescriptions.size() > 1) + { + desc.SetLoadOp(Graphics::AttachmentLoadOp::LOAD); + desc.SetStencilLoadOp(Graphics::AttachmentLoadOp::LOAD); + attachmentDescriptions.back() = desc; + } + + mRenderPassNoClear = graphicsController.CreateRenderPass(rpInfo, nullptr); // Warning: Shallow ptr } RenderInstructionContainer& Scene::GetRenderInstructions() @@ -60,39 +99,39 @@ RenderInstructionContainer& Scene::GetRenderInstructions() return mInstructions; } -void Scene::AddFrameRenderedCallback( CallbackBase* callback, int32_t frameId ) +void Scene::AddFrameRenderedCallback(CallbackBase* callback, int32_t frameId) { - mFrameRenderedCallbacks.push_back( std::make_pair( std::unique_ptr< CallbackBase >( callback ), frameId ) ); + mFrameRenderedCallbacks.push_back(std::make_pair(std::unique_ptr(callback), frameId)); } -void Scene::AddFramePresentedCallback( CallbackBase* callback, int32_t frameId ) +void Scene::AddFramePresentedCallback(CallbackBase* callback, int32_t frameId) { - mFramePresentedCallbacks.push_back( std::make_pair( std::unique_ptr< CallbackBase >( callback ), frameId ) ); + mFramePresentedCallbacks.push_back(std::make_pair(std::unique_ptr(callback), frameId)); } -void Scene::GetFrameRenderedCallback( Dali::Integration::Scene::FrameCallbackContainer& callbacks ) +void Scene::GetFrameRenderedCallback(Dali::Integration::Scene::FrameCallbackContainer& callbacks) { // Transfer owership of the callbacks - for( auto&& iter : mFrameRenderedCallbacks ) + for(auto&& iter : mFrameRenderedCallbacks) { - callbacks.push_back( std::make_pair( std::move( iter.first ), iter.second ) ); + callbacks.push_back(std::make_pair(std::move(iter.first), iter.second)); } mFrameRenderedCallbacks.clear(); } -void Scene::GetFramePresentedCallback( Dali::Integration::Scene::FrameCallbackContainer& callbacks ) +void Scene::GetFramePresentedCallback(Dali::Integration::Scene::FrameCallbackContainer& callbacks) { // Transfer owership of the callbacks - for( auto&& iter : mFramePresentedCallbacks ) + for(auto&& iter : mFramePresentedCallbacks) { - callbacks.push_back( std::make_pair( std::move( iter.first ), iter.second ) ); + callbacks.push_back(std::make_pair(std::move(iter.first), iter.second)); } mFramePresentedCallbacks.clear(); } -void Scene::SetSkipRendering( bool skip ) +void Scene::SetSkipRendering(bool skip) { mSkipRendering = skip; } @@ -102,10 +141,15 @@ bool Scene::IsRenderingSkipped() const return mSkipRendering; } -void Scene::SetSurfaceRect( const Rect& rect ) +void Scene::SetSurfaceRect(const Rect& rect) { - mSurfaceRect = rect; + mSurfaceRect = rect; mSurfaceRectChanged = true; + + if(mRoot) + { + mRoot->SetUpdated(true); + } } const Rect& Scene::GetSurfaceRect() const @@ -113,9 +157,14 @@ const Rect& Scene::GetSurfaceRect() const return mSurfaceRect; } -void Scene::SetSurfaceOrientation( int32_t orientation ) +void Scene::SetSurfaceOrientation(int32_t orientation) { mSurfaceOrientation = orientation; + + if(mRoot) + { + mRoot->SetUpdated(true); + } } int32_t Scene::GetSurfaceOrientation() const @@ -126,13 +175,30 @@ int32_t Scene::GetSurfaceOrientation() const bool Scene::IsSurfaceRectChanged() { bool surfaceRectChanged = mSurfaceRectChanged; - mSurfaceRectChanged = false; + mSurfaceRectChanged = false; return surfaceRectChanged; } -} //SceneGraph +void Scene::SetRotationCompletedAcknowledgement() +{ + mRotationCompletedAcknowledgement = true; +} + +bool Scene::IsRotationCompletedAcknowledgementSet() +{ + bool setRotationCompletedAcknowledgement = mRotationCompletedAcknowledgement; + mRotationCompletedAcknowledgement = false; + return setRotationCompletedAcknowledgement; +} + +std::vector& Scene::GetItemsDirtyRects() +{ + return mItemsDirtyRects; +} + +} // namespace SceneGraph -} //Internal +} // namespace Internal -} //Dali +} // namespace Dali