const std::string SYSTEM_CACHE_FILE = "gpu-environment.conf";
const std::string DALI_ENV_MULTIPLE_WINDOW_SUPPORT = "DALI_ENV_MULTIPLE_WINDOW_SUPPORT";
+const std::string DALI_BLEND_EQUATION_ADVANCED_SUPPORT = "DALI_BLEND_EQUATION_ADVANCED_SUPPORT";
+const std::string DALI_GLSL_VERSION = "DALI_GLSL_VERSION";
bool RetrieveKeyFromConfigFile( std::iostream& stream, const std::string& key, std::string& value )
{
mThreadController( threadController ),
mMaxTextureSize( 0u ),
mIsMultipleWindowSupported( true ),
- mMaxTextureSizeCached( false ) ,
- mIsMultipleWindowSupportedCached( false )
+ mIsAdvancedBlendEquationSupported( true ),
+ mMaxTextureSizeCached( false ),
+ mIsMultipleWindowSupportedCached( false ),
+ mIsAdvancedBlendEquationSupportedCached( false ),
+ mGlslVersionCached( false )
{
}
mMaxTextureSizeCached = true;
}
+ if( !mGlslVersionCached &&
+ RetrieveKeyFromConfigFile( stream, DALI_GLSL_VERSION, value ) )
+ {
+ mGlslVersion = std::atoi( value.c_str() );
+ mGlslVersionCached = true;
+ }
+
if( !mIsMultipleWindowSupportedCached &&
RetrieveKeyFromConfigFile( stream, DALI_ENV_MULTIPLE_WINDOW_SUPPORT, value ) )
{
mIsMultipleWindowSupported = std::atoi( value.c_str() );
mIsMultipleWindowSupportedCached = true;
}
+
+ if( !mIsAdvancedBlendEquationSupportedCached &&
+ RetrieveKeyFromConfigFile( stream, DALI_BLEND_EQUATION_ADVANCED_SUPPORT, value ) )
+ {
+ mIsAdvancedBlendEquationSupported = std::atoi( value.c_str() );
+ mIsAdvancedBlendEquationSupportedCached = true;
+ }
}
}
-unsigned int ConfigurationManager::GetMaxTextureSize()
+uint32_t ConfigurationManager::GetMaxTextureSize()
{
if( !mMaxTextureSizeCached )
{
return mMaxTextureSize;
}
+uint32_t ConfigurationManager::GetShadingLanguageVersion()
+{
+ if ( !mGlslVersionCached )
+ {
+ RetrieveKeysFromConfigFile( mSystemCacheFilePath );
+
+ if ( !mGlslVersionCached )
+ {
+ EglImplementation& eglImpl = mEglGraphics->GetEglImplementation();
+ if ( !eglImpl.IsGlesInitialized() )
+ {
+ // Wait until GLES is initialised, but this will happen once.
+ // This method blocks until the render thread has initialised the graphics.
+ mThreadController->WaitForGraphicsInitialization();
+ }
+
+ // Query from GLES and save the cache
+ mGlslVersion = mEglGraphics->GetGlesInterface().GetShadingLanguageVersion();
+ DALI_LOG_ERROR("mGlslVersion : %d\n", mGlslVersion);
+ mGlslVersionCached = true;
+
+ Dali::FileStream configFile( mSystemCacheFilePath, Dali::FileStream::READ | Dali::FileStream::APPEND | Dali::FileStream::TEXT );
+ std::fstream& stream = dynamic_cast<std::fstream&>( configFile.GetStream() );
+ if ( stream.is_open() )
+ {
+ stream << DALI_GLSL_VERSION << " " << mGlslVersion << std::endl;
+ }
+ else
+ {
+ DALI_LOG_ERROR( "Fail to open file : %s\n", mSystemCacheFilePath.c_str() );
+ }
+ }
+ }
+
+ return mGlslVersion;
+}
+
bool ConfigurationManager::IsMultipleWindowSupported()
{
if ( !mIsMultipleWindowSupportedCached )
return mIsMultipleWindowSupported;
}
+bool ConfigurationManager::IsAdvancedBlendEquationSupported()
+{
+ if ( !mIsAdvancedBlendEquationSupportedCached )
+ {
+ RetrieveKeysFromConfigFile( mSystemCacheFilePath );
+
+ if ( !mIsAdvancedBlendEquationSupportedCached )
+ {
+ EglImplementation& eglImpl = mEglGraphics->GetEglImplementation();
+ if ( !eglImpl.IsGlesInitialized() )
+ {
+ // Wait until GLES is initialised, but this will happen once.
+ // This method blocks until the render thread has initialised the graphics.
+ mThreadController->WaitForGraphicsInitialization();
+ }
+
+ // Query from GLES and save the cache
+ mIsAdvancedBlendEquationSupported = mEglGraphics->GetGlesInterface().IsAdvancedBlendEquationSupported();
+ mIsAdvancedBlendEquationSupportedCached = true;
+
+ Dali::FileStream configFile( mSystemCacheFilePath, Dali::FileStream::READ | Dali::FileStream::APPEND | Dali::FileStream::TEXT );
+ std::fstream& stream = dynamic_cast<std::fstream&>( configFile.GetStream() );
+ if ( stream.is_open() )
+ {
+ stream << DALI_BLEND_EQUATION_ADVANCED_SUPPORT << " " << mIsAdvancedBlendEquationSupported << std::endl;
+ }
+ else
+ {
+ DALI_LOG_ERROR( "Fail to open file : %s\n", mSystemCacheFilePath.c_str() );
+ }
+ }
+ }
+
+ return mIsAdvancedBlendEquationSupported;
+}
+
} // Adaptor
} // Internal