From d8f66e0dbfa21ea8469cd36d4bbe8339bc940e66 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Thu, 30 Nov 2023 11:32:13 +0900 Subject: [PATCH] [Tizen] Revert "[Tizen] Add lock for shader-precompiler" This reverts commit 623df491cac29b40393f599acff704191bff74e6. Change-Id: I18528eb8c634119fce235758c7d5c5933b689854 --- dali/integration-api/shader-precompiler.cpp | 33 +++++++++-------------------- dali/integration-api/shader-precompiler.h | 22 ++++--------------- 2 files changed, 14 insertions(+), 41 deletions(-) diff --git a/dali/integration-api/shader-precompiler.cpp b/dali/integration-api/shader-precompiler.cpp index 7ebc35c..f897a70 100644 --- a/dali/integration-api/shader-precompiler.cpp +++ b/dali/integration-api/shader-precompiler.cpp @@ -46,15 +46,24 @@ ShaderPrecompiler& ShaderPrecompiler::Get() void ShaderPrecompiler::GetPrecompileShaderList(std::vector& shaderList) { + ConditionalWait::ScopedLock lock(mConditionalWait); + if(!IsReady()) + { + DALI_LOG_RELEASE_INFO("Precompiled shader list is not ready yet, need to wait \n"); + mConditionalWait.Wait(lock); + } + // move shader list shaderList = mRawShaderList; } void ShaderPrecompiler::SavePrecomipleShaderList(std::vector& shaderList) { + ConditionalWait::ScopedLock lock(mConditionalWait); + mRawShaderList = shaderList; mPrecompiled = true; - StopPrecompile(); + mConditionalWait.Notify(lock); } bool ShaderPrecompiler::IsReady() const @@ -72,28 +81,6 @@ bool ShaderPrecompiler::IsEnable() return mEnabled; } -void ShaderPrecompiler::WaitPrecompileList() -{ - ConditionalWait::ScopedLock lock(mConditionalWait); - { - Dali::Mutex::ScopedLock mutexLock(mMutex); - if(!mNeedsSleep) - { - return; - } - } - - mConditionalWait.Wait(lock); -} - -void ShaderPrecompiler::StopPrecompile() -{ - ConditionalWait::ScopedLock lock(mConditionalWait); - Dali::Mutex::ScopedLock mutexLock(mMutex); - mNeedsSleep = false; - mConditionalWait.Notify(lock); -} - } // namespace Integration } // namespace Dali diff --git a/dali/integration-api/shader-precompiler.h b/dali/integration-api/shader-precompiler.h index e4a0774..1ad5ba7 100644 --- a/dali/integration-api/shader-precompiler.h +++ b/dali/integration-api/shader-precompiler.h @@ -68,7 +68,7 @@ public: * * @SINCE_2_2.45 * @param[in] shaders shader data for precompile - */ + */ void GetPrecompileShaderList(std::vector& shaders); /** @@ -76,7 +76,7 @@ public: * * @SINCE_2_2.45 * @param[in] shaders shader data for precompile - */ + */ void SavePrecomipleShaderList(std::vector& shaders); /** @@ -84,14 +84,14 @@ public: * * @SINCE_2_2.45 * @return true if precompile list is ready - */ + */ bool IsReady() const; /** * @brief Enable the feature of precompile * * @SINCE_2_2.45 - */ + */ void Enable(); /** @@ -103,18 +103,6 @@ public: bool IsEnable(); /** - * @brief Waiting for a list of shaders to be precompiled - * - */ - void WaitPrecompileList(); - - /** - * @brief Stop waiting for a list of shaders to be precompiled - * - */ - void StopPrecompile(); - - /** * Construct a new ShaderPrecompiler. */ ShaderPrecompiler(); @@ -130,10 +118,8 @@ private: static std::once_flag mOnceFlag; std::vector mRawShaderList; ConditionalWait mConditionalWait; - Dali::Mutex mMutex; bool mPrecompiled; bool mEnabled; - bool mNeedsSleep{true}; }; } // namespace Integration -- 2.7.4