FBO/Texture access synchronization for multiple contexts 98/210198/2
authorRichard Huang <r.huang@samsung.com>
Tue, 16 Jul 2019 14:15:58 +0000 (15:15 +0100)
committerRichard Huang <r.huang@samsung.com>
Wed, 17 Jul 2019 13:59:32 +0000 (14:59 +0100)
Change-Id: I959546eb2b987f257329dae514aa23c0f92f5dd3

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 [new file with mode: 0644]

index d457916..6e41c42 100644 (file)
@@ -58,6 +58,7 @@ void TestApplication::CreateCore()
                                         mPlatformAbstraction,
                                         mGlAbstraction,
                                         mGlSyncAbstraction,
+                                        mGlContextHelperAbstraction,
                                         mDataRetentionPolicy,
                                         Integration::RenderToFrameBuffer::FALSE,
                                         Integration::DepthBufferAvailable::TRUE,
@@ -156,6 +157,11 @@ TestGlSyncAbstraction& TestApplication::GetGlSyncAbstraction()
   return mGlSyncAbstraction;
 }
 
+TestGlContextHelperAbstraction& TestApplication::GetGlContextHelperAbstraction()
+{
+  return mGlContextHelperAbstraction;
+}
+
 void TestApplication::ProcessEvent(const Integration::Event& event)
 {
   mCore->QueueEvent(event);
index 32447d6..cc694df 100644 (file)
@@ -22,6 +22,7 @@
 #include <test-platform-abstraction.h>
 #include "test-gl-sync-abstraction.h"
 #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>
@@ -66,6 +67,7 @@ public:
   TestRenderController& GetRenderController();
   TestGlAbstraction& GetGlAbstraction();
   TestGlSyncAbstraction& GetGlSyncAbstraction();
+  TestGlContextHelperAbstraction& GetGlContextHelperAbstraction();
   void ProcessEvent(const Integration::Event& event);
   void SendNotification();
   bool Render( uint32_t intervalMilliseconds = DEFAULT_RENDER_INTERVAL, const char* location=NULL );
@@ -93,6 +95,7 @@ protected:
   TestRenderController      mRenderController;
   TestGlAbstraction         mGlAbstraction;
   TestGlSyncAbstraction     mGlSyncAbstraction;
+  TestGlContextHelperAbstraction mGlContextHelperAbstraction;
   TestRenderSurface*        mRenderSurface;
 
   Integration::UpdateStatus mStatus;
diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-context-helper-abstraction.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-context-helper-abstraction.h
new file mode 100644 (file)
index 0000000..0442f0d
--- /dev/null
@@ -0,0 +1,71 @@
+#ifndef TEST_GL_CONTEXT_HELPER_ABSTRACTION_H
+#define TEST_GL_CONTEXT_HELPER_ABSTRACTION_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/integration-api/gl-context-helper-abstraction.h>
+
+namespace Dali
+{
+
+/**
+ * Class to emulate the GL context helper
+ */
+class DALI_CORE_API TestGlContextHelperAbstraction: public Integration::GlContextHelperAbstraction
+{
+public:
+  /**
+   * Constructor
+   */
+  TestGlContextHelperAbstraction() {};
+
+  /**
+   * Destructor
+   */
+  ~TestGlContextHelperAbstraction() {};
+
+  /**
+   * @brief Switch to the surfaceless GL context
+   */
+  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() {};
+
+  /**
+   * @brief Wait until all GL rendering calls for the current GL context are executed
+   */
+  virtual void WaitClient() {};
+private:
+
+  TestGlContextHelperAbstraction( const TestGlContextHelperAbstraction& ); ///< Undefined
+  TestGlContextHelperAbstraction& operator=( const TestGlContextHelperAbstraction& ); ///< Undefined
+};
+
+} // Dali
+
+#endif // TEST_GL_CONTEXT_HELPER_ABSTRACTION_H