From: David Steele Date: Wed, 19 May 2021 17:23:25 +0000 (+0100) Subject: Sync tests for sync X-Git-Tag: dali_2.0.28~3^2~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=refs%2Fchanges%2F19%2F258519%2F1 Sync tests for sync Change-Id: I12e0c00cbdaf1d49cf873d6f8908b8ce3a7e64fe --- diff --git a/automated-tests/src/dali-scene-loader-internal/CMakeLists.txt b/automated-tests/src/dali-scene-loader-internal/CMakeLists.txt index eee1059..0270d3d 100755 --- a/automated-tests/src/dali-scene-loader-internal/CMakeLists.txt +++ b/automated-tests/src/dali-scene-loader-internal/CMakeLists.txt @@ -42,7 +42,8 @@ SET(TEST_HARNESS_SOURCES ${TEST_HARNESS_DIR}/test-harness.cpp ${TEST_HARNESS_DIR}/test-gesture-generator.cpp ${TEST_HARNESS_DIR}/test-gl-abstraction.cpp - ${TEST_HARNESS_DIR}/test-gl-sync-abstraction.cpp + ${TEST_HARNESS_DIR}/test-graphics-sync-impl.cpp + ${TEST_HARNESS_DIR}/test-graphics-sync-object.cpp ${TEST_HARNESS_DIR}/test-graphics-buffer.cpp ${TEST_HARNESS_DIR}/test-graphics-command-buffer.cpp ${TEST_HARNESS_DIR}/test-graphics-controller.cpp diff --git a/automated-tests/src/dali-scene-loader/CMakeLists.txt b/automated-tests/src/dali-scene-loader/CMakeLists.txt index 7ac6035..60c1b22 100755 --- a/automated-tests/src/dali-scene-loader/CMakeLists.txt +++ b/automated-tests/src/dali-scene-loader/CMakeLists.txt @@ -57,7 +57,8 @@ SET(TEST_HARNESS_SOURCES ${TEST_HARNESS_DIR}/test-harness.cpp ${TEST_HARNESS_DIR}/test-gesture-generator.cpp ${TEST_HARNESS_DIR}/test-gl-abstraction.cpp - ${TEST_HARNESS_DIR}/test-gl-sync-abstraction.cpp + ${TEST_HARNESS_DIR}/test-graphics-sync-impl.cpp + ${TEST_HARNESS_DIR}/test-graphics-sync-object.cpp ${TEST_HARNESS_DIR}/test-graphics-buffer.cpp ${TEST_HARNESS_DIR}/test-graphics-command-buffer.cpp ${TEST_HARNESS_DIR}/test-graphics-framebuffer.cpp diff --git a/automated-tests/src/dali-shader-generator/CMakeLists.txt b/automated-tests/src/dali-shader-generator/CMakeLists.txt index 4ef7ac6..517b7d3 100644 --- a/automated-tests/src/dali-shader-generator/CMakeLists.txt +++ b/automated-tests/src/dali-shader-generator/CMakeLists.txt @@ -44,7 +44,8 @@ SET(TEST_HARNESS_SOURCES ${TEST_HARNESS_DIR}/test-harness.cpp ${TEST_HARNESS_DIR}/test-gesture-generator.cpp ${TEST_HARNESS_DIR}/test-gl-abstraction.cpp - ${TEST_HARNESS_DIR}/test-gl-sync-abstraction.cpp + ${TEST_HARNESS_DIR}/test-graphics-sync-impl.cpp + ${TEST_HARNESS_DIR}/test-graphics-sync-object.cpp ${TEST_HARNESS_DIR}/test-graphics-buffer.cpp ${TEST_HARNESS_DIR}/test-graphics-command-buffer.cpp ${TEST_HARNESS_DIR}/test-graphics-controller.cpp @@ -130,4 +131,3 @@ ADD_CUSTOM_TARGET( ALL COMMAND ${SHADER_GENERATOR} ${SHADER_FOLDER} ${GENERATED_FOLDER} | grep "SHADER_SHADER_DEFINE_DEF" | grep "shader-define-def.h" > /dev/null 2>&1 && echo "test_def_correct Succeeded" VERBATIM) - diff --git a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt index b914f96..0a65397 100755 --- a/automated-tests/src/dali-toolkit-internal/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-internal/CMakeLists.txt @@ -81,7 +81,8 @@ SET(TEST_HARNESS_SOURCES ../dali-toolkit/dali-toolkit-test-utils/test-button.cpp ../dali-toolkit/dali-toolkit-test-utils/test-harness.cpp ../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-graphics-sync-impl.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-graphics-sync-object.cpp ../dali-toolkit/dali-toolkit-test-utils/test-graphics-buffer.cpp ../dali-toolkit/dali-toolkit-test-utils/test-graphics-command-buffer.cpp ../dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp diff --git a/automated-tests/src/dali-toolkit-styling/CMakeLists.txt b/automated-tests/src/dali-toolkit-styling/CMakeLists.txt index e3d235b..4c211d1 100644 --- a/automated-tests/src/dali-toolkit-styling/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-styling/CMakeLists.txt @@ -45,7 +45,8 @@ SET(TEST_HARNESS_SOURCES ../dali-toolkit/dali-toolkit-test-utils/test-application.cpp ../dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp ../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-graphics-sync-impl.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-graphics-sync-object.cpp ../dali-toolkit/dali-toolkit-test-utils/test-graphics-buffer.cpp ../dali-toolkit/dali-toolkit-test-utils/test-graphics-command-buffer.cpp ../dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp diff --git a/automated-tests/src/dali-toolkit-third-party/CMakeLists.txt b/automated-tests/src/dali-toolkit-third-party/CMakeLists.txt index d8638a2..e30acba 100644 --- a/automated-tests/src/dali-toolkit-third-party/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit-third-party/CMakeLists.txt @@ -31,7 +31,8 @@ SET(TEST_HARNESS_SOURCES ../dali-toolkit/dali-toolkit-test-utils/test-button.cpp ../dali-toolkit/dali-toolkit-test-utils/test-harness.cpp ../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-graphics-sync-impl.cpp + ../dali-toolkit/dali-toolkit-test-utils/test-graphics-sync-object.cpp ../dali-toolkit/dali-toolkit-test-utils/test-graphics-buffer.cpp ../dali-toolkit/dali-toolkit-test-utils/test-graphics-command-buffer.cpp ../dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp diff --git a/automated-tests/src/dali-toolkit/CMakeLists.txt b/automated-tests/src/dali-toolkit/CMakeLists.txt index 080fd8d..2983fd7 100755 --- a/automated-tests/src/dali-toolkit/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit/CMakeLists.txt @@ -112,7 +112,8 @@ SET(TEST_HARNESS_SOURCES dali-toolkit-test-utils/test-harness.cpp dali-toolkit-test-utils/test-gesture-generator.cpp dali-toolkit-test-utils/test-gl-abstraction.cpp - dali-toolkit-test-utils/test-gl-sync-abstraction.cpp + dali-toolkit-test-utils/test-graphics-sync-impl.cpp + dali-toolkit-test-utils/test-graphics-sync-object.cpp dali-toolkit-test-utils/test-graphics-buffer.cpp dali-toolkit-test-utils/test-graphics-command-buffer.cpp dali-toolkit-test-utils/test-graphics-controller.cpp diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp index 6075c8f..5e69c95 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.cpp @@ -155,14 +155,14 @@ TestGlAbstraction& TestApplication::GetGlAbstraction() return static_cast(mGraphicsController.GetGlAbstraction()); } -TestGlSyncAbstraction& TestApplication::GetGlSyncAbstraction() +TestGlContextHelperAbstraction& TestApplication::GetGlContextHelperAbstraction() { - return static_cast(mGraphicsController.GetGlSyncAbstraction()); + return static_cast(mGraphicsController.GetGlContextHelperAbstraction()); } -TestGlContextHelperAbstraction& TestApplication::GetGlContextHelperAbstraction() +TestGraphicsSyncImplementation& TestApplication::GetGraphicsSyncImpl() { - return static_cast(mGraphicsController.GetGlContextHelperAbstraction()); + return static_cast(mGraphicsController.GetGraphicsSyncImpl()); } void TestApplication::ProcessEvent(const Integration::Event& event) diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h index ad5d198..4f32cd8 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-application.h @@ -65,8 +65,8 @@ public: TestGraphicsController& GetGraphicsController(); TestGlAbstraction& GetGlAbstraction(); - TestGlSyncAbstraction& GetGlSyncAbstraction(); TestGlContextHelperAbstraction& GetGlContextHelperAbstraction(); + TestGraphicsSyncImplementation& GetGraphicsSyncImpl(); void ProcessEvent(const Integration::Event& event); void SendNotification(); diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-command-buffer.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-command-buffer.h index b75a402..3df3219 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-command-buffer.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-command-buffer.h @@ -593,6 +593,7 @@ struct Command struct { + Graphics::SyncObject* syncObject; } endRenderPass; struct @@ -774,9 +775,16 @@ public: * dependencies (for example, to know when target texture is ready * before passing it to another render pass). */ - void EndRenderPass() override + void EndRenderPass(Graphics::SyncObject* syncObject) override { - mCallStack.PushCall("EndRenderPass", ""); + mCommands.emplace_back(CommandType::END_RENDER_PASS); + auto& cmd = mCommands.back(); + + cmd.data.endRenderPass.syncObject = syncObject; + + TraceCallStack::NamedParams namedParams; + namedParams["syncObject"] << std::hex << syncObject; + mCallStack.PushCall("EndRenderPass", namedParams.str(), namedParams); } void ExecuteCommandBuffers(std::vector&& commandBuffers) override diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp index e5db6ed..517463f 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.cpp @@ -24,6 +24,7 @@ #include "test-graphics-render-target.h" #include "test-graphics-sampler.h" #include "test-graphics-shader.h" +#include "test-graphics-sync-object.h" #include "test-graphics-texture.h" #include @@ -861,6 +862,11 @@ void TestGraphicsController::ProcessCommandBuffer(TestGraphicsCommandBuffer& com } case CommandType::END_RENDER_PASS: { + if(cmd.data.endRenderPass.syncObject != nullptr) + { + auto syncObject = Uncast(cmd.data.endRenderPass.syncObject); + syncObject->InitializeResource(); // create the sync object. + } break; } } @@ -1149,6 +1155,14 @@ Graphics::UniquePtr TestGraphicsController::CreateRender return Graphics::MakeUnique(mGl, renderTargetCreateInfo); } +Graphics::UniquePtr TestGraphicsController::CreateSyncObject( + const Graphics::SyncObjectCreateInfo& syncObjectCreateInfo, + Graphics::UniquePtr&& oldSyncObject) +{ + mCallStack.PushCall("CreateSyncObject", ""); + return Graphics::MakeUnique(mGraphicsSyncImpl, syncObjectCreateInfo); +} + Graphics::UniquePtr TestGraphicsController::MapBufferRange(const Graphics::MapBufferInfo& mapInfo) { mCallStack.PushCall("MapBufferRange", ""); diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.h index 1c62119..cabc414 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-controller.h @@ -20,10 +20,10 @@ #include #include "test-gl-abstraction.h" #include "test-gl-context-helper-abstraction.h" -#include "test-gl-sync-abstraction.h" #include "test-graphics-command-buffer.h" #include "test-graphics-program.h" #include "test-graphics-reflection.h" +#include "test-graphics-sync-impl.h" namespace Dali { @@ -85,6 +85,12 @@ T* Uncast(const Graphics::RenderTarget* object) return const_cast(static_cast(object)); } +template +T* Uncast(const Graphics::SyncObject* object) +{ + return const_cast(static_cast(object)); +} + class TestGraphicsController : public Dali::Graphics::Controller { public: @@ -102,14 +108,14 @@ public: return mGl; } - Integration::GlSyncAbstraction& GetGlSyncAbstraction() override + Integration::GlContextHelperAbstraction& GetGlContextHelperAbstraction() override { - return mGlSyncAbstraction; + return mGlContextHelperAbstraction; } - Integration::GlContextHelperAbstraction& GetGlContextHelperAbstraction() override + TestGraphicsSyncImplementation& GetGraphicsSyncImpl() { - return mGlContextHelperAbstraction; + return mGraphicsSyncImpl; } void SubmitCommandBuffers(const Graphics::SubmitInfo& submitInfo) override; @@ -274,11 +280,20 @@ public: Graphics::UniquePtr CreateRenderTarget(const Graphics::RenderTargetCreateInfo& renderTargetCreateInfo, Graphics::UniquePtr&& oldRenderTarget) override; /** + * @brief Creates new sync object + * Could add timeout etc to createinfo... but nah. + * + * @return pointer to the SyncObject + */ + Graphics::UniquePtr CreateSyncObject(const Graphics::SyncObjectCreateInfo& syncObjectCreateInfo, + Graphics::UniquePtr&& oldSyncObject) override; + + /** * @brief Maps memory associated with Buffer object * * @param[in] mapInfo Filled details of mapped resource * - * @return Returns pointer to Memory object or Graphicsnullptr on error + * @return Returns pointer to Memory object or nullptr on error */ Graphics::UniquePtr MapBufferRange(const Graphics::MapBufferInfo& mapInfo) override; @@ -397,7 +412,7 @@ public: mutable std::vector mSubmitStack; TestGlAbstraction mGl; - TestGlSyncAbstraction mGlSyncAbstraction; + TestGraphicsSyncImplementation mGraphicsSyncImpl; TestGlContextHelperAbstraction mGlContextHelperAbstraction; bool isDiscardQueueEmptyResult{true}; diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-sync-impl.cpp similarity index 66% rename from automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp rename to automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-sync-impl.cpp index f404f32..17f53a7 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-sync-impl.cpp @@ -15,18 +15,21 @@ * */ -#include "test-gl-sync-abstraction.h" +#include "test-graphics-sync-impl.h" namespace Dali { -TestSyncObject::TestSyncObject(TraceCallStack& trace) +TestSyncObject::TestSyncObject(Dali::TraceCallStack& trace) + : synced(false), mTrace(trace) { + mTrace.PushCall("TestSyncObject cons", ""); // Trace the method } TestSyncObject::~TestSyncObject() { + mTrace.PushCall("TestSyncObject dstr", ""); // Trace the method } bool TestSyncObject::IsSynced() @@ -35,7 +38,7 @@ bool TestSyncObject::IsSynced() return synced; } -TestGlSyncAbstraction::TestGlSyncAbstraction() +TestGraphicsSyncImplementation::TestGraphicsSyncImplementation() { Initialize(); } @@ -43,7 +46,7 @@ TestGlSyncAbstraction::TestGlSyncAbstraction() /** * Destructor */ -TestGlSyncAbstraction::~TestGlSyncAbstraction() +TestGraphicsSyncImplementation::~TestGraphicsSyncImplementation() { for(SyncIter iter = mSyncObjects.begin(), end = mSyncObjects.end(); iter != end; ++iter) { @@ -52,18 +55,14 @@ TestGlSyncAbstraction::~TestGlSyncAbstraction() } /** - * Initialize the sync objects - clear down the map + * Initialize the sync objects */ -void TestGlSyncAbstraction::Initialize() +void TestGraphicsSyncImplementation::Initialize() { mSyncObjects.clear(); } -/** - * Create a sync object - * @return the sync object - */ -Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::CreateSyncObject() +Integration::GraphicsSyncAbstraction::SyncObject* TestGraphicsSyncImplementation::CreateSyncObject() { mTrace.PushCall("CreateSyncObject", ""); // Trace the method @@ -76,7 +75,7 @@ Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::CreateSyncObj * Destroy a sync object * @param[in] syncObject The object to destroy */ -void TestGlSyncAbstraction::DestroySyncObject(Integration::GlSyncAbstraction::SyncObject* syncObject) +void TestGraphicsSyncImplementation::DestroySyncObject(Integration::GraphicsSyncAbstraction::SyncObject* syncObject) { std::stringstream out; out << syncObject; @@ -93,7 +92,7 @@ void TestGlSyncAbstraction::DestroySyncObject(Integration::GlSyncAbstraction::Sy } } -Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::GetLastSyncObject() +Integration::GraphicsSyncAbstraction::SyncObject* TestGraphicsSyncImplementation::GetLastSyncObject() { if(!mSyncObjects.empty()) { @@ -107,7 +106,7 @@ Integration::GlSyncAbstraction::SyncObject* TestGlSyncAbstraction::GetLastSyncOb * @param[in] * @param[in] sync The sync value to set */ -void TestGlSyncAbstraction::SetObjectSynced(Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync) +void TestGraphicsSyncImplementation::SetObjectSynced(Integration::GraphicsSyncAbstraction::SyncObject* syncObject, bool sync) { TestSyncObject* testSyncObject = static_cast(syncObject); testSyncObject->synced = sync; @@ -116,7 +115,7 @@ void TestGlSyncAbstraction::SetObjectSynced(Integration::GlSyncAbstraction::Sync /** * Turn trace on */ -void TestGlSyncAbstraction::EnableTrace(bool enable) +void TestGraphicsSyncImplementation::EnableTrace(bool enable) { mTrace.Enable(enable); } @@ -124,7 +123,7 @@ void TestGlSyncAbstraction::EnableTrace(bool enable) /** * Reset the trace callstack */ -void TestGlSyncAbstraction::ResetTrace() +void TestGraphicsSyncImplementation::ResetTrace() { mTrace.Reset(); } @@ -132,12 +131,12 @@ void TestGlSyncAbstraction::ResetTrace() /** * Get the trace object (allows test case to find methods on it) */ -TraceCallStack& TestGlSyncAbstraction::GetTrace() +TraceCallStack& TestGraphicsSyncImplementation::GetTrace() { return mTrace; } -int32_t TestGlSyncAbstraction::GetNumberOfSyncObjects() +int32_t TestGraphicsSyncImplementation::GetNumberOfSyncObjects() { return static_cast(mSyncObjects.size()); } diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-sync-impl.h similarity index 64% rename from automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.h rename to automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-sync-impl.h index 73be9ee..cbc5331 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-gl-sync-abstraction.h +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-sync-impl.h @@ -1,5 +1,5 @@ -#ifndef TEST_GL_SYNC_ABSTRACTION_H -#define TEST_GL_SYNC_ABSTRACTION_H +#ifndef TEST_SYNC_IMPLEMENTATION_H +#define TEST_SYNC_IMPLEMENTATION_H /* * Copyright (c) 2021 Samsung Electronics Co., Ltd. @@ -24,14 +24,18 @@ #include // INTERNAL INCLUDES +#include +#include #include -#include +#include #include "test-trace-call-stack.h" namespace Dali { -class DALI_CORE_API TestSyncObject : public Integration::GlSyncAbstraction::SyncObject +class TestGraphicsSyncImplementation; + +class TestSyncObject : public Integration::GraphicsSyncAbstraction::SyncObject { public: TestSyncObject(TraceCallStack& trace); @@ -42,47 +46,45 @@ public: }; /** - * Class to emulate the GL sync functions with tracing + * Class to emulate the gpu sync functions with tracing */ -class DALI_CORE_API TestGlSyncAbstraction : public Integration::GlSyncAbstraction +class TestGraphicsSyncImplementation : public Integration::GraphicsSyncAbstraction { public: /** * Constructor */ - TestGlSyncAbstraction(); + TestGraphicsSyncImplementation(); /** * Destructor */ - ~TestGlSyncAbstraction() override; + virtual ~TestGraphicsSyncImplementation(); /** - * Initialize the sync objects - clear down the map + * Initialize the sync objects */ void Initialize(); /** - * Create a sync object - * @return the sync object + * Create a sync object that can be polled */ - Integration::GlSyncAbstraction::SyncObject* CreateSyncObject() override; + GraphicsSyncAbstraction::SyncObject* CreateSyncObject() override; /** * Destroy a sync object - * @param[in] syncObject The object to destroy */ - void DestroySyncObject(Integration::GlSyncAbstraction::SyncObject* syncObject) override; + void DestroySyncObject(GraphicsSyncAbstraction::SyncObject* syncObject) override; public: // TEST FUNCTIONS - Integration::GlSyncAbstraction::SyncObject* GetLastSyncObject(); + GraphicsSyncAbstraction::SyncObject* GetLastSyncObject(); /** * Test method to trigger the object sync behaviour. * @param[in] * @param[in] sync The sync value to set */ - void SetObjectSynced(Integration::GlSyncAbstraction::SyncObject* syncObject, bool sync); + void SetObjectSynced(GraphicsSyncAbstraction::SyncObject* syncObject, bool sync); /** * Turn trace on @@ -106,10 +108,10 @@ public: // TEST FUNCTIONS */ int32_t GetNumberOfSyncObjects(); -private: - TestGlSyncAbstraction(const TestGlSyncAbstraction&); ///< Undefined - TestGlSyncAbstraction& operator=(const TestGlSyncAbstraction&); ///< Undefined + TestGraphicsSyncImplementation(const TestGraphicsSyncImplementation&) = delete; + TestGraphicsSyncImplementation& operator=(const TestGraphicsSyncImplementation&) = delete; +private: typedef std::vector SyncContainer; typedef SyncContainer::iterator SyncIter; SyncContainer mSyncObjects; ///< The sync objects diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-sync-object.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-sync-object.cpp new file mode 100644 index 0000000..cf9b3c9 --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-sync-object.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2021 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-graphics-sync-object.h" + +namespace Dali +{ +TestGraphicsSyncObject::TestGraphicsSyncObject(TestGraphicsSyncImplementation& syncImpl, const Graphics::SyncObjectCreateInfo& createInfo) +: mSyncImplementation(syncImpl), + mSyncObject(nullptr), + mCreateInfo(createInfo) +{ +} + +TestGraphicsSyncObject::~TestGraphicsSyncObject() +{ + mSyncImplementation.DestroySyncObject(mSyncObject); +} + +void TestGraphicsSyncObject::InitializeResource() +{ + mSyncObject = static_cast(mSyncImplementation.CreateSyncObject()); +} + +bool TestGraphicsSyncObject::IsSynced() +{ + bool synced = false; + if(mSyncObject) + { + synced = mSyncObject->IsSynced(); + } + return synced; +} + +} // namespace Dali diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-sync-object.h b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-sync-object.h new file mode 100644 index 0000000..c33de6c --- /dev/null +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-graphics-sync-object.h @@ -0,0 +1,43 @@ +#ifndef DALI_TEST_GRAPHICS_SYNC_OBJECT_H_ +#define DALI_TEST_GRAPHICS_SYNC_OBJECT_H_ + +/* + * Copyright (c) 2021 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 +#include + +#include + +namespace Dali +{ +class TestGraphicsSyncObject : public Graphics::SyncObject +{ +public: + TestGraphicsSyncObject(TestGraphicsSyncImplementation& syncImpl, const Graphics::SyncObjectCreateInfo& createInfo); + ~TestGraphicsSyncObject() override; + void InitializeResource(); + bool IsSynced() override; + +public: + TestGraphicsSyncImplementation& mSyncImplementation; + TestSyncObject* mSyncObject; + Graphics::SyncObjectCreateInfo mCreateInfo; +}; + +} // namespace Dali + +#endif //DALI_TEST_GRAPHICS_SYNC_OBJECT_H