From 01e3acfab09737f49135fa314a03c2460bcf79dc Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Tue, 25 Jun 2019 13:34:59 +0900 Subject: [PATCH] Revert "[Tizen] Fix FrameBuffer sync issue, etc." This reverts commit 6705d5406c29a85df3cf63523b8613d58824b4a3. Change-Id: Iaf7a5b236812124ade04e8eb491b29d0fd510f5a --- dali/integration-api/render-surface.h | 12 ++++ dali/integration-api/scene.cpp | 10 ---- dali/integration-api/scene.h | 15 ----- dali/internal/common/core-impl.cpp | 2 +- dali/internal/event/common/scene-impl.cpp | 67 +++++++--------------- dali/internal/event/common/scene-impl.h | 11 +--- .../internal/event/rendering/frame-buffer-impl.cpp | 19 ------ dali/internal/event/rendering/frame-buffer-impl.h | 17 +----- .../renderers/render-surface-frame-buffer.cpp | 31 ++-------- .../render/renderers/render-surface-frame-buffer.h | 41 ------------- 10 files changed, 45 insertions(+), 180 deletions(-) diff --git a/dali/integration-api/render-surface.h b/dali/integration-api/render-surface.h index 2270fc2..17f22e9 100644 --- a/dali/integration-api/render-surface.h +++ b/dali/integration-api/render-surface.h @@ -183,6 +183,18 @@ public: */ virtual Integration::StencilBufferAvailable GetStencilBufferRequired() = 0; + /** + * @brief Sets the background color of the surface. + * @param[in] color The new background color + */ + virtual void SetBackgroundColor(Vector4 color) = 0; + + /** + * @brief Gets the background color of the surface. + * @return The background color + */ + virtual Vector4 GetBackgroundColor() = 0; + private: /** diff --git a/dali/integration-api/scene.cpp b/dali/integration-api/scene.cpp index 869bbf0..9d89f31 100644 --- a/dali/integration-api/scene.cpp +++ b/dali/integration-api/scene.cpp @@ -89,16 +89,6 @@ Vector2 Scene::GetDpi() const return GetImplementation(*this).GetDpi(); } -void Scene::SetBackgroundColor( const Vector4& color ) -{ - GetImplementation(*this).SetBackgroundColor( color ); -} - -Vector4 Scene::GetBackgroundColor() const -{ - return GetImplementation(*this).GetBackgroundColor(); -} - RenderTaskList Scene::GetRenderTaskList() const { return RenderTaskList( &GetImplementation(*this).GetRenderTaskList() ); diff --git a/dali/integration-api/scene.h b/dali/integration-api/scene.h index cf3d71b..f1b3059 100755 --- a/dali/integration-api/scene.h +++ b/dali/integration-api/scene.h @@ -21,7 +21,6 @@ // INTERNAL INCLUDES #include #include -#include namespace Dali { @@ -150,20 +149,6 @@ public: Vector2 GetDpi() const; /** - * @brief Sets the background color. - * - * @param[in] color The new background color - */ - void SetBackgroundColor( const Vector4& color ); - - /** - * @brief Gets the background color of the render surface. - * - * @return The background color - */ - Vector4 GetBackgroundColor() const; - - /** * @brief Retrieves the list of render-tasks. * * @return A valid handle to a RenderTaskList diff --git a/dali/internal/common/core-impl.cpp b/dali/internal/common/core-impl.cpp index c1e7fde..1a09947 100644 --- a/dali/internal/common/core-impl.cpp +++ b/dali/internal/common/core-impl.cpp @@ -197,7 +197,7 @@ void Core::SurfaceResized( Integration::RenderSurface* surface ) { if( (*iter)->GetSurface() == surface ) { - (*iter)->SurfaceResized(); + (*iter)->SetSurface( *surface ); } } } diff --git a/dali/internal/event/common/scene-impl.cpp b/dali/internal/event/common/scene-impl.cpp index 3e09540..30a4a0f 100644 --- a/dali/internal/event/common/scene-impl.cpp +++ b/dali/internal/event/common/scene-impl.cpp @@ -63,7 +63,6 @@ Scene::Scene( const Size& size ) mSize( size ), mSurfaceSize( Vector2::ZERO ), mDpi( Vector2::ZERO ), - mBackgroundColor( DEFAULT_BACKGROUND_COLOR ), mDepthTreeDirty( false ), mEventProcessor( *this, ThreadLocalStorage::GetInternal()->GetGestureEventProcessor() ) { @@ -199,54 +198,34 @@ void Scene::SetSurface( Integration::RenderSurface& surface ) mSurface = &surface; if ( mSurface ) { - RenderTaskPtr defaultRenderTask = mRenderTaskList->GetTask( 0u ); - - mFrameBuffer = Dali::Internal::FrameBuffer::New( surface, Dali::FrameBuffer::Attachment::NONE ); - defaultRenderTask->SetFrameBuffer( mFrameBuffer ); - - SurfaceResized(); - } -} - -void Scene::SurfaceResized() -{ - if( mSurface ) - { - const float fWidth = static_cast( mSurface->GetPositionSize().width ); - const float fHeight = static_cast( mSurface->GetPositionSize().height ); + mSurfaceSize.width = static_cast( mSurface->GetPositionSize().width ); + mSurfaceSize.height = static_cast( mSurface->GetPositionSize().height ); - if( ( fabsf( mSurfaceSize.width - fWidth ) > Math::MACHINE_EPSILON_1 ) || ( fabsf( mSurfaceSize.height - fHeight ) > Math::MACHINE_EPSILON_1 ) ) - { - Rect newSize( 0, 0, static_cast( mSurface->GetPositionSize().width ), static_cast( mSurface->GetPositionSize().height ) ); - - mSurfaceSize.width = fWidth; - mSurfaceSize.height = fHeight; - - mSize.width = mSurfaceSize.width; - mSize.height = mSurfaceSize.height; + mSize.width = mSurfaceSize.width; + mSize.height = mSurfaceSize.height; - // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position. - mDefaultCamera->SetPerspectiveProjection( mSurfaceSize ); + // Calculates the aspect ratio, near and far clipping planes, field of view and camera Z position. + mDefaultCamera->SetPerspectiveProjection( mSurfaceSize ); - mRootLayer->SetSize( mSize.width, mSize.height ); + mRootLayer->SetSize( mSize.width, mSize.height ); - ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal(); - SceneGraph::UpdateManager& updateManager = tls->GetUpdateManager(); - SetDefaultSurfaceRectMessage( updateManager, newSize ); // truncated + ThreadLocalStorage* tls = ThreadLocalStorage::GetInternal(); + SceneGraph::UpdateManager& updateManager = tls->GetUpdateManager(); + SetDefaultSurfaceRectMessage( updateManager, Rect( 0, 0, static_cast( mSurfaceSize.width ), static_cast( mSurfaceSize.height ) ) ); // truncated - RenderTaskPtr defaultRenderTask = mRenderTaskList->GetTask( 0u ); + RenderTaskPtr defaultRenderTask = mRenderTaskList->GetTask( 0u ); - // if single render task to screen then set its viewport parameters - if( 1 == mRenderTaskList->GetTaskCount() ) + // if single render task to screen then set its viewport parameters + if( 1 == mRenderTaskList->GetTaskCount() ) + { + if( !defaultRenderTask->GetTargetFrameBuffer() ) { - if( !defaultRenderTask->GetTargetFrameBuffer() ) - { - defaultRenderTask->SetViewport( newSize ); // truncated - } + defaultRenderTask->SetViewport( Viewport( 0, 0, static_cast( mSurfaceSize.width ), static_cast( mSurfaceSize.height ) ) ); // truncated } - - defaultRenderTask->GetFrameBuffer()->SetSize( static_cast( newSize.width ), static_cast( newSize.height ) ); } + + mFrameBuffer = Dali::Internal::FrameBuffer::New( surface, Dali::FrameBuffer::Attachment::NONE ); + defaultRenderTask->SetFrameBuffer( mFrameBuffer ); } } @@ -281,19 +260,17 @@ void Scene::RebuildDepthTree() } } -void Scene::SetBackgroundColor( const Vector4& color ) +void Scene::SetBackgroundColor(Vector4 color) { - mBackgroundColor = color; - if( mSurface ) { - mRenderTaskList->GetTask( 0u )->GetFrameBuffer()->SetBackgroundColor( color ); + mSurface->SetBackgroundColor( color ); } } Vector4 Scene::GetBackgroundColor() const { - return mBackgroundColor; + return mSurface ? mSurface->GetBackgroundColor() : DEFAULT_BACKGROUND_COLOR; } void Scene::EmitKeyEventSignal(const KeyEvent& event) diff --git a/dali/internal/event/common/scene-impl.h b/dali/internal/event/common/scene-impl.h index 4d97e16..634bcbd 100644 --- a/dali/internal/event/common/scene-impl.h +++ b/dali/internal/event/common/scene-impl.h @@ -120,11 +120,6 @@ public: void SetSurface( Integration::RenderSurface& surface ); /** - * Notify the surface has been resized. - */ - void SurfaceResized(); - - /** * Retrieve the render surface the scene is binded to. * @return The render surface. */ @@ -159,10 +154,10 @@ public: void RebuildDepthTree(); /** - * @brief Sets the background color of the render surface. + * @brief Sets the background color of the render surface. * @param[in] color The new background color */ - void SetBackgroundColor( const Vector4& color ); + void SetBackgroundColor(Vector4 color); /** * @brief Gets the background color of the render surface. @@ -263,8 +258,6 @@ private: Vector2 mDpi; - Vector4 mBackgroundColor; - LayerPtr mRootLayer; // Ordered list of currently on-stage layers diff --git a/dali/internal/event/rendering/frame-buffer-impl.cpp b/dali/internal/event/rendering/frame-buffer-impl.cpp index d34c0ee..fd5f4bf 100644 --- a/dali/internal/event/rendering/frame-buffer-impl.cpp +++ b/dali/internal/event/rendering/frame-buffer-impl.cpp @@ -105,25 +105,6 @@ Texture* FrameBuffer::GetColorTexture() return mIsSurfaceBacked ? nullptr : mColor.Get(); } -void FrameBuffer::SetSize( uint32_t width, uint32_t height ) -{ - mWidth = width; - mHeight = height; - - if( mRenderObject->IsSurfaceBacked() ) - { - SetFrameBufferSizeMessage( mEventThreadServices.GetUpdateManager(), static_cast( mRenderObject ), width, height ); - } -} - -void FrameBuffer::SetBackgroundColor( const Vector4& color ) -{ - if( mRenderObject->IsSurfaceBacked() ) - { - SetFrameBufferBackgroundColorMessage( mEventThreadServices.GetUpdateManager(), static_cast( mRenderObject ), color ); - } -} - FrameBuffer::~FrameBuffer() { if( EventThreadServices::IsCoreRunning() && mRenderObject ) diff --git a/dali/internal/event/rendering/frame-buffer-impl.h b/dali/internal/event/rendering/frame-buffer-impl.h index 341b284..3531c0f 100644 --- a/dali/internal/event/rendering/frame-buffer-impl.h +++ b/dali/internal/event/rendering/frame-buffer-impl.h @@ -63,8 +63,8 @@ public: /** * @brief Create a new FrameBuffer * - * @param[in] renderSurface The render surface - * @param[in] attachments The attachments comprising the format of the FrameBuffer (bit-mask) + * @param[in] renderSurface The render surface + * @param[in] attachments The attachments comprising the format of the FrameBuffer (bit-mask) * @return A smart-pointer to the newly allocated Texture. */ static FrameBufferPtr New( Dali::Integration::RenderSurface& renderSurface, Mask attachments ); @@ -91,19 +91,6 @@ public: */ Texture* GetColorTexture(); - /** - * @brief Sets the frame buffer size. - * @param[in] width The width size - * @param[in] height The height size - */ - void SetSize( uint32_t width, uint32_t height ); - - /** - * @brief Sets the background color - * @param[in] color The new background color - */ - void SetBackgroundColor( const Vector4& color ); - private: // implementation /** diff --git a/dali/internal/render/renderers/render-surface-frame-buffer.cpp b/dali/internal/render/renderers/render-surface-frame-buffer.cpp index 4b63c33..7cc38bb 100644 --- a/dali/internal/render/renderers/render-surface-frame-buffer.cpp +++ b/dali/internal/render/renderers/render-surface-frame-buffer.cpp @@ -30,11 +30,7 @@ namespace Render SurfaceFrameBuffer::SurfaceFrameBuffer( Integration::RenderSurface* surface ) : FrameBuffer(), mSurface( surface ), - mContext( nullptr ), - mWidth( mSurface->GetPositionSize().width ), - mHeight( mSurface->GetPositionSize().height ), - mBackgroundColor( 0.f, 0.f, 0.f, 1.f ), - mSizeChanged( false ) + mContext( nullptr ) { } @@ -62,26 +58,23 @@ void SurfaceFrameBuffer::Initialize(Context& context) void SurfaceFrameBuffer::Bind( Context& context ) { - mSurface->PreRender( mSizeChanged ); - + mSurface->PreRender( false ); context.BindFramebuffer( GL_FRAMEBUFFER, 0u ); } uint32_t SurfaceFrameBuffer::GetWidth() const { - return mWidth; + return mSurface->GetPositionSize().width; } uint32_t SurfaceFrameBuffer::GetHeight() const { - return mHeight; + return mSurface->GetPositionSize().height; } void SurfaceFrameBuffer::PostRender() { - mSurface->PostRender( false, false, mSizeChanged ); - - mSizeChanged = false; + mSurface->PostRender( false, false, false ); } Context* SurfaceFrameBuffer::GetContext() @@ -101,19 +94,7 @@ Integration::StencilBufferAvailable SurfaceFrameBuffer::GetStencilBufferRequired Vector4 SurfaceFrameBuffer::GetBackgroundColor() { - return mBackgroundColor; -} - -void SurfaceFrameBuffer::SetSize( uint32_t width, uint32_t height ) -{ - mWidth = width; - mHeight = height; - mSizeChanged = true; -} - -void SurfaceFrameBuffer::SetBackgroundColor( const Vector4& color ) -{ - mBackgroundColor = color; + return mSurface->GetBackgroundColor(); } } //Render diff --git a/dali/internal/render/renderers/render-surface-frame-buffer.h b/dali/internal/render/renderers/render-surface-frame-buffer.h index ebe7eb5..576ea65 100644 --- a/dali/internal/render/renderers/render-surface-frame-buffer.h +++ b/dali/internal/render/renderers/render-surface-frame-buffer.h @@ -18,7 +18,6 @@ */ // INTERNAL INCLUDES -#include #include #include @@ -83,19 +82,6 @@ public: */ bool IsSurfaceBacked() override { return true; }; - /** - * @brief Sets the frame buffer size. - * @param[in] width The width size - * @param[in] height The height size - */ - void SetSize( uint32_t width, uint32_t height ); - - /** - * @brief Sets the background color. - * @param[in] color The new background color - */ - void SetBackgroundColor( const Vector4& color ); - public: /** @@ -131,35 +117,8 @@ private: Integration::RenderSurface* mSurface; ///< The render surface Context* mContext; ///< The context holding the GL state of rendering for the surface backed frame buffer - - uint32_t mWidth; - uint32_t mHeight; - Vector4 mBackgroundColor; - bool mSizeChanged; }; -// Messages for FrameBuffer -inline void SetFrameBufferSizeMessage( SceneGraph::UpdateManager& updateManager, SurfaceFrameBuffer* surfaceFrameBuffer, uint32_t width, uint32_t height ) -{ - typedef MessageValue2< SurfaceFrameBuffer, uint32_t, uint32_t > LocalType; - - // Reserve some memory inside the message queue - uint32_t* slot = updateManager.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( surfaceFrameBuffer, &SurfaceFrameBuffer::SetSize, width, height ); -} - -inline void SetFrameBufferBackgroundColorMessage( SceneGraph::UpdateManager& updateManager, SurfaceFrameBuffer* surfaceFrameBuffer, const Vector4& color ) -{ - typedef MessageValue1< SurfaceFrameBuffer, Vector4 > LocalType; - - // Reserve some memory inside the message queue - uint32_t* slot = updateManager.ReserveMessageSlot( sizeof( LocalType ) ); - - // Construct message in the message queue memory; note that delete should not be called on the return value - new (slot) LocalType( surfaceFrameBuffer, &SurfaceFrameBuffer::SetBackgroundColor, color ); -} } // namespace Render -- 2.7.4