/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
{
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)
-{
- bool keyFound = false;
-
- std::string line;
- while(std::getline(stream, line))
- {
- line.erase(line.find_last_not_of(" \t\r\n") + 1);
- line.erase(0, line.find_first_not_of(" \t\r\n"));
- if('#' == *(line.cbegin()) || line == "")
- {
- continue;
- }
-
- std::istringstream stream(line);
- std::string name;
- std::getline(stream, name, ' ');
- if(name == key)
- {
- std::getline(stream, value);
- keyFound = true;
- break;
- }
- }
-
- return keyFound;
-}
+const char* SYSTEM_CACHE_FILE = "gpu-environment.conf";
+const char* DALI_ENV_MULTIPLE_WINDOW_SUPPORT = "DALI_ENV_MULTIPLE_WINDOW_SUPPORT";
+const char* DALI_BLEND_EQUATION_ADVANCED_SUPPORT = "DALI_BLEND_EQUATION_ADVANCED_SUPPORT";
+const char* DALI_MULTISAMPLED_RENDER_TO_TEXTURE_SUPPORT = "DALI_MULTISAMPLED_RENDER_TO_TEXTURE_SUPPORT";
+const char* DALI_GLSL_VERSION = "DALI_GLSL_VERSION";
} // unnamed namespace
mShaderLanguageVersion(0u),
mIsMultipleWindowSupported(true),
mIsAdvancedBlendEquationSupported(true),
+ mIsMultisampledRenderToTextureSupported(true),
mMaxTextureSizeCached(false),
mIsMultipleWindowSupportedCached(false),
mIsAdvancedBlendEquationSupportedCached(false),
+ mIsMultisampledRenderToTextureSupportedCached(false),
mShaderLanguageVersionCached(false)
{
}
std::iostream& stream = configFile.GetStream();
if(stream.rdbuf()->in_avail())
{
- std::string value;
- if(!mMaxTextureSizeCached &&
- RetrieveKeyFromConfigFile(stream, DALI_ENV_MAX_TEXTURE_SIZE, value))
- {
- mMaxTextureSize = std::atoi(value.c_str());
- mMaxTextureSizeCached = true;
- }
-
- if(!mShaderLanguageVersionCached &&
- RetrieveKeyFromConfigFile(stream, DALI_GLSL_VERSION, value))
- {
- mShaderLanguageVersion = std::atoi(value.c_str());
- mShaderLanguageVersionCached = true;
- }
-
- if(!mIsMultipleWindowSupportedCached &&
- RetrieveKeyFromConfigFile(stream, DALI_ENV_MULTIPLE_WINDOW_SUPPORT, value))
+ std::string line;
+ while(std::getline(stream, line))
{
- mIsMultipleWindowSupported = std::atoi(value.c_str());
- mIsMultipleWindowSupportedCached = true;
- }
+ line.erase(line.find_last_not_of(" \t\r\n") + 1);
+ line.erase(0, line.find_first_not_of(" \t\r\n"));
+ if('#' == *(line.cbegin()) || line == "")
+ {
+ continue;
+ }
- if(!mIsAdvancedBlendEquationSupportedCached &&
- RetrieveKeyFromConfigFile(stream, DALI_BLEND_EQUATION_ADVANCED_SUPPORT, value))
- {
- mIsAdvancedBlendEquationSupported = std::atoi(value.c_str());
- mIsAdvancedBlendEquationSupportedCached = true;
+ std::istringstream subStream(line);
+ std::string name;
+ std::string value;
+ std::getline(subStream, name, ' ');
+ if(!mMaxTextureSizeCached && name == DALI_ENV_MAX_TEXTURE_SIZE)
+ {
+ std::getline(subStream, value);
+ mMaxTextureSize = std::atoi(value.c_str());
+ mMaxTextureSizeCached = true;
+ }
+ else if(!mIsAdvancedBlendEquationSupportedCached && name == DALI_BLEND_EQUATION_ADVANCED_SUPPORT)
+ {
+ std::getline(subStream, value);
+ mIsAdvancedBlendEquationSupported = std::atoi(value.c_str());
+ mIsAdvancedBlendEquationSupportedCached = true;
+ }
+ else if(!mIsMultisampledRenderToTextureSupportedCached && name == DALI_MULTISAMPLED_RENDER_TO_TEXTURE_SUPPORT)
+ {
+ std::getline(subStream, value);
+ mIsMultisampledRenderToTextureSupported = std::atoi(value.c_str());
+ mIsMultisampledRenderToTextureSupportedCached = true;
+ }
+ else if(!mShaderLanguageVersionCached && name == DALI_GLSL_VERSION)
+ {
+ std::getline(subStream, value);
+ mShaderLanguageVersion = std::atoi(value.c_str());
+ mShaderLanguageVersionCached = true;
+ }
+ else if(!mIsMultipleWindowSupportedCached && name == DALI_ENV_MULTIPLE_WINDOW_SUPPORT)
+ {
+ std::getline(subStream, value);
+ mIsMultipleWindowSupported = std::atoi(value.c_str());
+ mIsMultipleWindowSupportedCached = true;
+ }
}
}
}
if(!mMaxTextureSizeCached)
{
+ if(!mGraphics->IsInitialized())
+ {
+ // Wait until Graphics Subsystem is initialised, but this will happen once.
+ // This method blocks until the render thread has initialised the graphics.
+ mThreadController->WaitForGraphicsInitialization();
+ }
+
mMaxTextureSize = mGraphics->GetMaxTextureSize();
mMaxTextureSizeCached = true;
}
// Query from graphics and save the cache
- mShaderLanguageVersion = mGraphics->GetShaderLanguageVersion();
- DALI_LOG_ERROR("mShaderLanguageVersion : %d\n", mShaderLanguageVersion);
+ mShaderLanguageVersion = mGraphics->GetShaderLanguageVersion();
mShaderLanguageVersionCached = true;
Dali::FileStream configFile(mSystemCacheFilePath, Dali::FileStream::READ | Dali::FileStream::APPEND | Dali::FileStream::TEXT);
return mIsAdvancedBlendEquationSupported;
}
+bool ConfigurationManager::IsMultisampledRenderToTextureSupported()
+{
+ if(!mIsMultisampledRenderToTextureSupportedCached)
+ {
+ RetrieveKeysFromConfigFile(mSystemCacheFilePath);
+
+ if(!mIsMultisampledRenderToTextureSupportedCached)
+ {
+ if(!mGraphics->IsInitialized())
+ {
+ // Wait until graphics subsystem is initialised, but this will happen once per factory reset.
+ // This method blocks until the render thread has initialised the graphics.
+ mThreadController->WaitForGraphicsInitialization();
+ }
+
+ // Query from Graphics Subsystem and save the cache
+ mIsMultisampledRenderToTextureSupported = mGraphics->IsMultisampledRenderToTextureSupported();
+ mIsMultisampledRenderToTextureSupportedCached = 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_MULTISAMPLED_RENDER_TO_TEXTURE_SUPPORT << " " << mIsMultisampledRenderToTextureSupported << std::endl;
+ }
+ else
+ {
+ DALI_LOG_ERROR("Fail to open file : %s\n", mSystemCacheFilePath.c_str());
+ }
+ }
+ }
+
+ return mIsMultisampledRenderToTextureSupported;
+}
+
} // namespace Adaptor
} // namespace Internal