/*
- * 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";
+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
mGraphics(graphics),
mThreadController(threadController),
mMaxTextureSize(0u),
+ mMaxCombinedTextureUnits(0u),
mShaderLanguageVersion(0u),
mIsMultipleWindowSupported(true),
mIsAdvancedBlendEquationSupported(true),
+ mIsMultisampledRenderToTextureSupported(true),
mMaxTextureSizeCached(false),
mIsMultipleWindowSupportedCached(false),
mIsAdvancedBlendEquationSupportedCached(false),
- mShaderLanguageVersionCached(false)
+ mIsMultisampledRenderToTextureSupportedCached(false),
+ mShaderLanguageVersionCached(false),
+ mMaxCombinedTextureUnitsCached(false)
{
}
mMaxTextureSize = std::atoi(value.c_str());
mMaxTextureSizeCached = true;
}
+ if(!mMaxCombinedTextureUnitsCached && name == DALI_ENV_MAX_COMBINED_TEXTURE_UNITS)
+ {
+ std::getline(subStream, value);
+ mMaxCombinedTextureUnits = std::atoi(value.c_str());
+ mMaxCombinedTextureUnitsCached = 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);
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;
return mMaxTextureSize;
}
+uint32_t ConfigurationManager::GetMaxCombinedTextureUnits()
+{
+ if(!mMaxCombinedTextureUnitsCached)
+ {
+ RetrieveKeysFromConfigFile(mSystemCacheFilePath);
+
+ if(!mMaxCombinedTextureUnitsCached)
+ {
+ 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();
+ }
+
+ mMaxCombinedTextureUnits = mGraphics->GetMaxCombinedTextureUnits();
+ mMaxCombinedTextureUnitsCached = true;
+ DALI_LOG_RENDER_INFO("MaxCombinedTextureUnits = %d\n", mMaxCombinedTextureUnits);
+
+ 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_ENV_MAX_COMBINED_TEXTURE_UNITS << " " << mMaxCombinedTextureUnits << std::endl;
+ }
+ else
+ {
+ DALI_LOG_ERROR("Fail to open file : %s\n", mSystemCacheFilePath.c_str());
+ }
+ }
+ }
+
+ return mMaxCombinedTextureUnits;
+}
+
uint32_t ConfigurationManager::GetShadingLanguageVersion()
{
if(!mShaderLanguageVersionCached)
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