Merge "Remove RenderSurface from Core" into devel/master
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 30 Mar 2020 14:41:01 +0000 (14:41 +0000)
committerGerrit Code Review <gerrit@review>
Mon, 30 Mar 2020 14:41:01 +0000 (14:41 +0000)
15 files changed:
automated-tests/src/dali-toolkit-internal/CMakeLists.txt
automated-tests/src/dali-toolkit-styling/CMakeLists.txt
automated-tests/src/dali-toolkit-third-party/CMakeLists.txt
automated-tests/src/dali-toolkit/CMakeLists.txt
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-context-helper-abstraction.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-render-surface.cpp [deleted file]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-render-surface.h [deleted file]
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-adaptor.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder-impl.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-test-application.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-window.h

index 650bbee..22c9a90 100755 (executable)
@@ -66,7 +66,6 @@ LIST(APPEND TC_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
-   ../dali-toolkit/dali-toolkit-test-utils/test-render-surface.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-native-image.cpp
    dali-toolkit-test-utils/toolkit-text-utils.cpp
index b4414fe..32b7233 100644 (file)
@@ -48,7 +48,6 @@ LIST(APPEND TC_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/test-gl-abstraction.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
-   ../dali-toolkit/dali-toolkit-test-utils/test-render-surface.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-native-image.cpp
 )
index dfbe07f..3a9f9b2 100644 (file)
@@ -23,7 +23,6 @@ LIST(APPEND TC_SOURCES
    ../dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
-   ../dali-toolkit/dali-toolkit-test-utils/test-render-surface.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
    ../dali-toolkit/dali-toolkit-test-utils/test-native-image.cpp
 )
index 76492c3..2db3264 100755 (executable)
@@ -110,7 +110,6 @@ LIST(APPEND TC_SOURCES
   dali-toolkit-test-utils/test-gl-sync-abstraction.cpp
   dali-toolkit-test-utils/test-platform-abstraction.cpp
   dali-toolkit-test-utils/test-render-controller.cpp
-  dali-toolkit-test-utils/test-render-surface.cpp
   dali-toolkit-test-utils/test-trace-call-stack.cpp
   dali-toolkit-test-utils/test-native-image.cpp
 )
index f5d670d..f85f14d 100644 (file)
@@ -27,8 +27,7 @@ TestApplication::TestApplication( uint32_t surfaceWidth,
                                   uint32_t  horizontalDpi,
                                   uint32_t  verticalDpi,
                                   bool initialize )
-: mRenderSurface( NULL ),
-  mCore( NULL ),
+: mCore( NULL ),
   mSurfaceWidth( surfaceWidth ),
   mSurfaceHeight( surfaceHeight ),
   mFrame( 0u ),
@@ -75,8 +74,7 @@ void TestApplication::CreateCore()
 
 void TestApplication::CreateScene()
 {
-  mRenderSurface = new TestRenderSurface( Dali::PositionSize( 0, 0, mSurfaceWidth, mSurfaceHeight ) );
-  mScene = Dali::Integration::Scene::New( *mRenderSurface );
+  mScene = Dali::Integration::Scene::New( Size( static_cast<float>( mSurfaceWidth ), static_cast<float>( mSurfaceHeight ) ) );
   mScene.SetDpi( Vector2( static_cast<float>( mDpi.x ), static_cast<float>( mDpi.y ) ) );
 }
 
@@ -89,7 +87,6 @@ void TestApplication::InitializeCore()
 TestApplication::~TestApplication()
 {
   Dali::Integration::Log::UninstallLogFunction();
-  delete mRenderSurface;
   delete mCore;
 }
 
@@ -190,7 +187,11 @@ void TestApplication::DoUpdate( uint32_t intervalMilliseconds, const char* locat
 bool TestApplication::Render( uint32_t intervalMilliseconds, const char* location )
 {
   DoUpdate( intervalMilliseconds, location );
-  mCore->Render( mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ );
+
+  mCore->PreRender( mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ );
+  mCore->RenderScene( mScene, true /*render the off-screen buffers*/);
+  mCore->RenderScene( mScene, false /*render the surface*/);
+  mCore->PostRender( false /*do not skip rendering*/ );
 
   mFrame++;
 
@@ -216,7 +217,10 @@ bool TestApplication::GetRenderNeedsUpdate()
 bool TestApplication::RenderOnly( )
 {
   // Update Time values
-  mCore->Render( mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ );
+  mCore->PreRender( mRenderStatus, false /*do not force clear*/, false /*do not skip rendering*/ );
+  mCore->RenderScene( mScene, true /*render the off-screen buffers*/);
+  mCore->RenderScene( mScene, false /*render the surface*/);
+  mCore->PostRender( false /*do not skip rendering*/ );
 
   mFrame++;
 
index 2606a56..a922e23 100644 (file)
@@ -24,7 +24,6 @@
 #include "test-gl-abstraction.h"
 #include "test-gl-context-helper-abstraction.h"
 #include "test-render-controller.h"
-#include "test-render-surface.h"
 #include <dali/public-api/common/dali-common.h>
 #include <dali/integration-api/resource-policies.h>
 #include <dali/integration-api/trace.h>
@@ -95,7 +94,6 @@ protected:
   TestGlAbstraction         mGlAbstraction;
   TestGlSyncAbstraction     mGlSyncAbstraction;
   TestGlContextHelperAbstraction mGlContextHelperAbstraction;
-  TestRenderSurface*        mRenderSurface;
 
   Integration::UpdateStatus mStatus;
   Integration::RenderStatus mRenderStatus;
index 0442f0d..ce150d1 100644 (file)
@@ -2,7 +2,7 @@
 #define TEST_GL_CONTEXT_HELPER_ABSTRACTION_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -46,12 +46,6 @@ public:
   virtual void MakeSurfacelessContextCurrent() {};
 
   /**
-   * @brief Switch to the GL context of the specific render surface
-   * @param[in] surface The render surface
-   */
-  virtual void MakeContextCurrent( Integration::RenderSurface* surface ) {};
-
-  /**
    * @brief Clear the GL context
    */
   virtual void MakeContextNull() {};
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-render-surface.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-render-surface.cpp
deleted file mode 100644 (file)
index 332d77e..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2019 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "test-render-surface.h"
-
-namespace Dali
-{
-
-TestRenderSurface::TestRenderSurface( Dali::PositionSize positionSize )
-: mPositionSize( positionSize ),
-  mBackgroundColor()
-{
-}
-
-TestRenderSurface::~TestRenderSurface()
-{
-}
-
-Dali::PositionSize TestRenderSurface::GetPositionSize() const
-{
-  return mPositionSize;
-};
-
-void TestRenderSurface::GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical )
-{
-  dpiHorizontal = dpiVertical = 96;
-};
-
-void TestRenderSurface::InitializeGraphics()
-{
-}
-
-void TestRenderSurface::CreateSurface()
-{
-}
-
-void TestRenderSurface::DestroySurface()
-{
-}
-
-bool TestRenderSurface::ReplaceGraphicsSurface()
-{
-  return false;
-}
-
-void TestRenderSurface::MoveResize( Dali::PositionSize positionSize )
-{
-  mPositionSize = positionSize;
-}
-
-void TestRenderSurface::StartRender()
-{
-}
-
-bool TestRenderSurface::PreRender( bool resizingSurface )
-{
-  return true;
-}
-
-void TestRenderSurface::PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface )
-{
-}
-
-void TestRenderSurface::StopRender()
-{
-}
-
-void TestRenderSurface::ReleaseLock()
-{
-}
-
-Dali::Integration::RenderSurface::Type TestRenderSurface::GetSurfaceType()
-{
-  return WINDOW_RENDER_SURFACE;
-}
-
-void TestRenderSurface::MakeContextCurrent()
-{
-}
-
-Integration::DepthBufferAvailable TestRenderSurface::GetDepthBufferRequired()
-{
-  return Integration::DepthBufferAvailable::TRUE;
-}
-
-Integration::StencilBufferAvailable TestRenderSurface::GetStencilBufferRequired()
-{
-  return Integration::StencilBufferAvailable::TRUE;
-}
-
-void TestRenderSurface::SetBackgroundColor( Vector4 color )
-{
-  mBackgroundColor = color;
-}
-
-Vector4 TestRenderSurface::GetBackgroundColor()
-{
-  return mBackgroundColor;
-}
-
-} // Namespace dali
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-render-surface.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-render-surface.h
deleted file mode 100644 (file)
index fba89c2..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-#ifndef TEST_REENDER_SURFACE_H
-#define TEST_REENDER_SURFACE_H
-
-/*
- * Copyright (c) 2019 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-#include <dali/integration-api/render-surface.h>
-
-namespace Dali
-{
-
-/**
- * Concrete implementation of the RenderSurface class.
- */
-class DALI_CORE_API TestRenderSurface : public Dali::Integration::RenderSurface
-{
-public:
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::RenderSurface
-   */
-  TestRenderSurface( Dali::PositionSize positionSize );
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::~RenderSurface
-   */
-  virtual ~TestRenderSurface();
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::GetPositionSize
-   */
-  virtual Dali::PositionSize GetPositionSize() const;
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::GetDpi
-   */
-  virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical );
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::InitializeGraphics
-   */
-  virtual void InitializeGraphics();
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::CreateSurface
-   */
-  virtual void CreateSurface();
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::DestroySurface
-   */
-  virtual void DestroySurface();
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::ReplaceGraphicsSurface
-   */
-  virtual bool ReplaceGraphicsSurface();
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::MoveResize
-   */
-  virtual void MoveResize( Dali::PositionSize positionSize );
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::StartRender
-   */
-  virtual void StartRender();
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::PreRender
-   */
-  virtual bool PreRender( bool resizingSurface );
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::PostRender
-   */
-  virtual void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface );
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::StopRender
-   */
-  virtual void StopRender();
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::ReleaseLock
-   */
-  virtual void ReleaseLock();
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::GetSurfaceType
-   */
-  virtual Dali::Integration::RenderSurface::Type GetSurfaceType();
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::MakeContextCurrent
-   */
-  virtual void MakeContextCurrent();
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::GetDepthBufferRequired
-   */
-  virtual Integration::DepthBufferAvailable GetDepthBufferRequired();
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::GetStencilBufferRequired
-   */
-  virtual Integration::StencilBufferAvailable GetStencilBufferRequired();
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::SetBackgroundColor
-   */
-  virtual void SetBackgroundColor( Vector4 color );
-
-  /**
-   * @copydoc Dali::Integration::RenderSurface::GetBackgroundColor
-   */
-  virtual Vector4 GetBackgroundColor();
-
-private:
-
-  /**
-   * @brief Undefined copy constructor. RenderSurface cannot be copied
-   */
-  TestRenderSurface( const TestRenderSurface& rhs );
-
-  /**
-   * @brief Undefined assignment operator. RenderSurface cannot be copied
-   */
-  TestRenderSurface& operator=( const TestRenderSurface& rhs );
-
-private:
-
-  Dali::PositionSize mPositionSize;
-  Vector4 mBackgroundColor;                                     ///< The background color of the surface
-};
-
-} // Dali
-
-#endif
index 5890d58..7c50cc7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -29,7 +29,6 @@
 #include <dali/integration-api/debug.h>
 #include <dali/integration-api/scene.h>
 #include <test-application.h>
-#include <test-render-surface.h>
 
 namespace Dali
 {
index a937262..b466cfc 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_SCENE_HOLDER_IMPL_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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 <test-render-surface.h>
+#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
 
 #include <dali/integration-api/scene.h>
 #include <dali/public-api/actors/layer.h>
 namespace Dali
 {
 
+class TestRenderSurface : public Dali::RenderSurfaceInterface
+{
+public:
+
+  TestRenderSurface( PositionSize positionSize ) {};
+
+  virtual PositionSize GetPositionSize() const { PositionSize size; return size; };
+
+  virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) { dpiHorizontal = dpiVertical = 96; }
+
+  virtual void InitializeGraphics() {};
+
+  virtual void CreateSurface() {};
+
+  virtual void DestroySurface() {};
+
+  virtual bool ReplaceGraphicsSurface() { return false; };
+
+  virtual void MoveResize( Dali::PositionSize positionSize ) {};
+
+  virtual void StartRender() {};
+
+  virtual bool PreRender( bool resizingSurface ) { return false; };
+
+  virtual void PostRender( bool renderToFbo, bool replacingSurface, bool resizingSurface ) {};
+
+  virtual void StopRender() {};
+
+  virtual void ReleaseLock() {};
+
+  virtual void SetThreadSynchronization( ThreadSynchronizationInterface& threadSynchronization ) {};
+
+  virtual RenderSurfaceInterface::Type GetSurfaceType() { return RenderSurfaceInterface::WINDOW_RENDER_SURFACE; };
+
+  virtual void MakeContextCurrent() {};
+
+  virtual Integration::DepthBufferAvailable GetDepthBufferRequired() { return Integration::DepthBufferAvailable::FALSE; };
+
+  virtual Integration::StencilBufferAvailable GetStencilBufferRequired() { return Integration::StencilBufferAvailable::FALSE; };
+
+  virtual void SetBackgroundColor( Vector4 color ) {};
+
+  virtual Vector4 GetBackgroundColor() { return Color::WHITE; };
+};
+
 namespace Internal
 {
 
@@ -67,7 +112,7 @@ public:
 
   Integration::Scene GetScene();
 
-  Integration::RenderSurface& GetRenderSurface();
+  Dali::RenderSurfaceInterface& GetRenderSurface();
 
 private:
 
index 1075778..320c859 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -47,7 +47,7 @@ namespace Adaptor
 
 SceneHolder::SceneHolder( const Dali::Rect<int>& positionSize )
 : mRenderSurface( positionSize ),
-  mScene( Dali::Integration::Scene::New( mRenderSurface ) )
+  mScene( Dali::Integration::Scene::New( Dali::Size( static_cast<float>( positionSize.width ), static_cast<float>( positionSize.height ) ) ) )
 {
 }
 
@@ -121,7 +121,7 @@ Integration::Scene SceneHolder::GetScene()
   return mScene;
 }
 
-Integration::RenderSurface& SceneHolder::GetRenderSurface()
+Dali::RenderSurfaceInterface& SceneHolder::GetRenderSurface()
 {
   return mRenderSurface;
 }
index 07c6ad8..d3bdd42 100644 (file)
@@ -42,7 +42,6 @@ ToolkitTestApplication::ToolkitTestApplication( size_t surfaceWidth, size_t surf
   // The window will create a Scene & surface and set up the scene's surface appropriately.
   *mMainWindow = Window::New( PositionSize( 0, 0, surfaceWidth, surfaceHeight ), "" );
   mScene = AdaptorImpl::GetScene( *mMainWindow );
-  mRenderSurface = dynamic_cast< TestRenderSurface* >( mScene.GetSurface() );
   mScene.SetDpi( Vector2( horizontalDpi, verticalDpi ) );
 
   // Core needs to be initialized next before we start the adaptor
@@ -67,9 +66,6 @@ ToolkitTestApplication::~ToolkitTestApplication()
   // Need to delete core before we delete the adaptor.
   delete mCore;
   mCore = NULL;
-
-  // Set mRenderSurface to null, it will be deleted by the window that owns it
-  mRenderSurface = nullptr;
 }
 
 void ToolkitTestApplication::RunIdles()
index e1ad7f2..d7878e3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -28,9 +28,6 @@
 #include <dali/integration-api/adaptor-framework/adaptor.h>
 #include <toolkit-adaptor-impl.h>
 
-// INTERNAL INCLUDES
-#include "test-render-surface.h"
-
 using AdaptorImpl = Dali::Internal::Adaptor::Adaptor;
 
 namespace Dali
@@ -122,7 +119,7 @@ Integration::Scene Window::GetScene()
   return GetImplementation( *this ).GetScene();
 }
 
-Integration::RenderSurface& Window::GetRenderSurface()
+Dali::RenderSurfaceInterface& Window::GetRenderSurface()
 {
   return GetImplementation( *this ).GetRenderSurface();
 }
index 271f885..68ed472 100644 (file)
@@ -2,7 +2,7 @@
 #define TOOLKIT_WINDOW_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
@@ -30,6 +30,7 @@ namespace Dali
 
 class Actor;
 class Layer;
+class RenderSurfaceInterface;
 struct KeyEvent;
 class TouchData;
 struct WheelEvent;
@@ -60,7 +61,7 @@ public:
   Window& operator=(const Window& rhs);
 
   Integration::Scene GetScene();
-  Integration::RenderSurface& GetRenderSurface();
+  Dali::RenderSurfaceInterface& GetRenderSurface();
   void Add( Dali::Actor actor );
   void Remove( Dali::Actor actor );
   Dali::Layer GetRootLayer() const;