Revert "[Tizen] Add lock for shader-precompiler"
authorEunki, Hong <eunkiki.hong@samsung.com>
Wed, 25 Oct 2023 07:35:30 +0000 (16:35 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Wed, 25 Oct 2023 07:35:30 +0000 (16:35 +0900)
This reverts commit de24bf76431a3d6ee5e4e27f3752ff7032752e7b.

dali/integration-api/shader-precompiler.cpp
dali/integration-api/shader-precompiler.h

index 7ebc35ccb54e518bc9b5af577b6fc76086425a6a..f897a704a043b39092108d541f5ebfb4f5d3c858 100644 (file)
@@ -46,15 +46,24 @@ ShaderPrecompiler& ShaderPrecompiler::Get()
 
 void ShaderPrecompiler::GetPrecompileShaderList(std::vector<RawShaderData>& 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<RawShaderData>& 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
index e4a077441ea7333a156ca41b737dd3f87ebbccf7..1ad5ba7c1895e73280ed10574e665ef3c7d3aefe 100644 (file)
@@ -68,7 +68,7 @@ public:
    *
    *  @SINCE_2_2.45
    *  @param[in] shaders shader data for precompile
-   */
+  */
   void GetPrecompileShaderList(std::vector<RawShaderData>& shaders);
 
   /**
@@ -76,7 +76,7 @@ public:
    *
    * @SINCE_2_2.45
    * @param[in] shaders shader data for precompile
-   */
+  */
   void SavePrecomipleShaderList(std::vector<RawShaderData>& 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();
 
   /**
@@ -102,18 +102,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.
    */
@@ -130,10 +118,8 @@ private:
   static std::once_flag mOnceFlag;
   std::vector<RawShaderData> mRawShaderList;
   ConditionalWait mConditionalWait;
-  Dali::Mutex mMutex;
   bool mPrecompiled;
   bool mEnabled;
-  bool mNeedsSleep{true};
 };
 
 } // namespace Integration