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
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
*
* @SINCE_2_2.45
* @param[in] shaders shader data for precompile
- */
+ */
void GetPrecompileShaderList(std::vector<RawShaderData>& shaders);
/**
*
* @SINCE_2_2.45
* @param[in] shaders shader data for precompile
- */
+ */
void SavePrecomipleShaderList(std::vector<RawShaderData>& shaders);
/**
*
* @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();
/**
*/
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.
*/
static std::once_flag mOnceFlag;
std::vector<RawShaderData> mRawShaderList;
ConditionalWait mConditionalWait;
- Dali::Mutex mMutex;
bool mPrecompiled;
bool mEnabled;
- bool mNeedsSleep{true};
};
} // namespace Integration