X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fsystem%2Fcommon%2Fconfiguration-manager.cpp;h=8ab98aa0f7ef5994c817664e2ac1038b1bb7c3ba;hb=dc748492c6f7eba549b6fee365181ffc0b8473d3;hp=63b62dcf35a15a0a3de47f7a831d9b812994fbbc;hpb=cba512cfe082ff2d8d46b9ee2f142add17744b73;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/system/common/configuration-manager.cpp b/dali/internal/system/common/configuration-manager.cpp index 63b62dc..8ab98aa 100644 --- a/dali/internal/system/common/configuration-manager.cpp +++ b/dali/internal/system/common/configuration-manager.cpp @@ -43,6 +43,8 @@ namespace 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 ) { @@ -80,9 +82,13 @@ ConfigurationManager::ConfigurationManager( std::string systemCachePath, EglGrap mEglGraphics( eglGraphics ), mThreadController( threadController ), mMaxTextureSize( 0u ), + mGlslVersion( 0u), mIsMultipleWindowSupported( true ), - mMaxTextureSizeCached( false ) , - mIsMultipleWindowSupportedCached( false ) + mIsAdvancedBlendEquationSupported( true ), + mMaxTextureSizeCached( false ), + mIsMultipleWindowSupportedCached( false ), + mIsAdvancedBlendEquationSupportedCached( false ), + mGlslVersionCached( false ) { } @@ -104,16 +110,30 @@ void ConfigurationManager::RetrieveKeysFromConfigFile( const std::string& config 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 ) { @@ -141,6 +161,43 @@ unsigned int ConfigurationManager::GetMaxTextureSize() 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( 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 ) @@ -177,6 +234,42 @@ bool ConfigurationManager::IsMultipleWindowSupported() 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( 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