X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Fcommon%2Fscene-graph-scene.cpp;h=2aa02878cfa544334b3f6c40cb6d1b5424ed50f7;hb=9f1204aac923ca7df1fa771959de62160074a236;hp=8779ba91d5aa0450fa3bc66783cb6af4a05a0272;hpb=c4f781ff1251d8273252e10db19cf6d3d8bee187;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 8779ba9..2aa0287 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) 2021 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,7 +18,7 @@ #include // INTERNAL INCLUDES -#include +#include #include namespace Dali @@ -28,13 +28,13 @@ namespace Internal namespace SceneGraph { Scene::Scene() -: mContext(nullptr), - mFrameRenderedCallbacks(), +: mFrameRenderedCallbacks(), mFramePresentedCallbacks(), mSkipRendering(false), mSurfaceRect(), mSurfaceOrientation(0), - mSurfaceRectChanged(false) + mSurfaceRectChanged(false), + mRotationCompletedAcknowledgement(false) { } @@ -44,14 +44,59 @@ Scene::~Scene() mFramePresentedCallbacks.clear(); } -void Scene::Initialize(Context& context) +void Scene::Initialize(Graphics::Controller& graphicsController, Integration::DepthBufferAvailable depthBufferAvailable, Integration::StencilBufferAvailable stencilBufferAvailable) { - mContext = &context; -} + mGraphicsController = &graphicsController; -Context* Scene::GetContext() -{ - return mContext; + // Create the render target for the surface. It should already have been sent via message. + mRenderTarget = graphicsController.CreateRenderTarget(mRenderTargetCreateInfo, std::move(mRenderTarget)); + + // Create the render pass for the surface + std::vector attachmentDescriptions; + + // 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() @@ -130,6 +175,42 @@ bool Scene::IsSurfaceRectChanged() return surfaceRectChanged; } +void Scene::SetRotationCompletedAcknowledgement() +{ + mRotationCompletedAcknowledgement = true; +} + +bool Scene::IsRotationCompletedAcknowledgementSet() +{ + bool setRotationCompletedAcknowledgement = mRotationCompletedAcknowledgement; + mRotationCompletedAcknowledgement = false; + return setRotationCompletedAcknowledgement; +} + +std::vector& Scene::GetItemsDirtyRects() +{ + return mItemsDirtyRects; +} + +void Scene::SetSurfaceRenderTargetCreateInfo(const Graphics::RenderTargetCreateInfo& renderTargetCreateInfo) +{ + if(mRenderTarget != nullptr && + mRenderTargetCreateInfo.surface != renderTargetCreateInfo.surface) + { + // Only recreate if the surface has changed. + mRenderTargetCreateInfo = renderTargetCreateInfo; + if(mGraphicsController) // shouldn't be null, as we can't have already set mRenderTarget unless graphics controller exists. + { + mRenderTarget = mGraphicsController->CreateRenderTarget(renderTargetCreateInfo, std::move(mRenderTarget)); + } + } + else + { + // 2nd Stage initialization happens in RenderManager, not UpdateManager, so is delayed. + mRenderTargetCreateInfo = renderTargetCreateInfo; + } +} + } // namespace SceneGraph } // namespace Internal