#define DALI_TEST_GRAPHICS_APPLICATION_H
/*
- * Copyright (c) 2022 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.
return 32768u;
}
+ uint32_t GetMaxCombinedTextureUnits() override
+ {
+ return 96;
+ }
+
/**
* @return the maximum texture samples when we use multisampled texture
*/
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <dali/devel-api/adaptor-framework/graphics-capabilities.h>
+#include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/system/common/configuration-manager.h>
+
+namespace Dali::GraphicsCapabilities
+{
+uint32_t GetMaxCombinedTextureUnits()
+{
+ Dali::Adaptor& adaptor = Adaptor::Get();
+ Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation(adaptor);
+ const Dali::Internal::Adaptor::ConfigurationManager* configurationManager = adaptorImpl.GetConfigurationManager();
+ if(configurationManager)
+ {
+ return const_cast<Dali::Internal::Adaptor::ConfigurationManager*>(configurationManager)->GetMaxCombinedTextureUnits();
+ }
+ return 8; // Gles2 max.
+}
+
+} // namespace Dali::GraphicsCapabilities
--- /dev/null
+#ifndef DALI_DEVEL_API_ADAPTOR_GRAPHICS_CAPABILITIES_H
+#define DALI_DEVEL_API_ADAPTOR_GRAPHICS_CAPABILITIES_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
+
+// EXTERNAL INCLUDES
+#include <cstdint>
+
+namespace Dali::GraphicsCapabilities
+{
+/**
+ * @brief Get the total number of combined texture units that can be used by
+ * all the shaders in a given program.
+ *
+ * @return the maximum number of texture units
+ */
+DALI_ADAPTOR_API uint32_t GetMaxCombinedTextureUnits();
+
+} // namespace Dali::GraphicsCapabilities
+
+#endif //DALI_DEVEL_API_ADAPTOR_GRAPHICS_CAPABILITIES_H
${adaptor_devel_api_dir}/adaptor-framework/feedback-player.cpp
${adaptor_devel_api_dir}/adaptor-framework/file-loader.cpp
${adaptor_devel_api_dir}/adaptor-framework/file-stream.cpp
+ ${adaptor_devel_api_dir}/adaptor-framework/graphics-capabilities.cpp
${adaptor_devel_api_dir}/adaptor-framework/image-loading.cpp
${adaptor_devel_api_dir}/adaptor-framework/input-method-context.cpp
${adaptor_devel_api_dir}/adaptor-framework/input-method-options.cpp
${adaptor_devel_api_dir}/adaptor-framework/feedback-player.h
${adaptor_devel_api_dir}/adaptor-framework/file-loader.h
${adaptor_devel_api_dir}/adaptor-framework/file-stream.h
+ ${adaptor_devel_api_dir}/adaptor-framework/graphics-capabilities.h
${adaptor_devel_api_dir}/adaptor-framework/image-loader-input.h
${adaptor_devel_api_dir}/adaptor-framework/image-loader-plugin.h
${adaptor_devel_api_dir}/adaptor-framework/image-loading.h
#define DALI_INTERNAL_ADAPTOR_IMPL_H
/*
- * Copyright (c) 2022 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.
*/
void GetWindowContainerInterface(WindowContainer& windows) override;
+ /**
+ * @brief Get the configuration manager
+ * @return The configuration manager, or null if it hasn't been created yet
+ */
+ const ConfigurationManager* GetConfigurationManager() const
+ {
+ return mConfigurationManager.get();
+ }
+
public: // Signals
/**
* @copydoc Dali::Adaptor::SignalResized
#define DALI_INTERNAL_BASE_GRAPHICS_INTERFACE_H
/*
- * Copyright (c) 2022 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.
virtual uint32_t GetMaxTextureSize() = 0;
/**
+ * @return the maximum number of combined texture units
+ */
+ virtual uint32_t GetMaxCombinedTextureUnits() = 0;
+
+ /**
* @return the maximum texture samples when we use multisampled texture
*/
virtual uint8_t GetMaxTextureSamples() = 0;
memset(&mGlStateCache.mBoundTextureId, 0, sizeof(mGlStateCache.mBoundTextureId));
mGlStateCache.mFrameBufferStateCache.Reset();
+
+ GLint maxTextures;
+ gl.GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &maxTextures);
+ DALI_LOG_RELEASE_INFO("GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: %d\n", maxTextures);
}
/**
/*
- * 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.
char output[4096];
GLsizei size{0u};
gl->GetShaderInfoLog(shader, 4096, &size, output);
- DALI_LOG_RELEASE_INFO("Code: %s\n", reinterpret_cast<const char*>(GetCreateInfo().sourceData));
- DALI_LOG_RELEASE_INFO("Log: %s\n", output);
+ DALI_LOG_RENDER_INFO("Code: %s\n", reinterpret_cast<const char*>(GetCreateInfo().sourceData));
+ DALI_LOG_RENDER_INFO("Log: %s\n", output);
gl->DeleteShader(shader);
return false;
}
return mGLES->GetMaxTextureSize();
}
+ uint32_t GetMaxCombinedTextureUnits() override
+ {
+ return mGLES->GetMaxCombinedTextureUnits();
+ }
+
uint8_t GetMaxTextureSamples() override
{
return mGLES->GetMaxTextureSamples();
: mGlExtensionSupportedCacheList(),
mContextCreatedWaitCondition(),
mMaxTextureSize(0),
+ mMaxCombinedTextureUnits(0),
mMaxTextureSamples(0),
mVertexShaderPrefix(""),
mGlesVersion(INITIAL_GLES_VERSION),
void ContextCreated()
{
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
+ glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &mMaxCombinedTextureUnits);
// Since gles 2.0 didn't return well for GL_MAJOR_VERSION and GL_MINOR_VERSION,
// Only change gles version for the device that support above gles 3.0.
return mMaxTextureSize;
}
+ int GetMaxCombinedTextureUnits()
+ {
+ ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
+ if(!mIsContextCreated)
+ {
+ mContextCreatedWaitCondition.Wait(lock);
+ }
+ return mMaxCombinedTextureUnits;
+ }
+
int GetMaxTextureSamples()
{
ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
ConditionalWait mContextCreatedWaitCondition;
GLint mMaxTextureSize;
+ GLint mMaxCombinedTextureUnits;
GLint mMaxTextureSamples;
std::string mShaderVersionPrefix;
std::string mVertexShaderPrefix;
mGraphics(graphics),
mThreadController(threadController),
mMaxTextureSize(0u),
+ mMaxCombinedTextureUnits(0u),
mShaderLanguageVersion(0u),
mIsMultipleWindowSupported(true),
mIsAdvancedBlendEquationSupported(true),
mIsMultipleWindowSupportedCached(false),
mIsAdvancedBlendEquationSupportedCached(false),
mIsMultisampledRenderToTextureSupportedCached(false),
- mShaderLanguageVersionCached(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);
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)
#define DALI_INTERNAL_ENVIRONMENT_CONFIGURATION_MANAGER_H
/*
- * Copyright (c) 2022 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.
uint32_t GetMaxTextureSize();
/**
+ * @brief Get the maximum number of combined texture units (across all shaders in program)
+ * @return the number of combined texture units
+ */
+ uint32_t GetMaxCombinedTextureUnits();
+
+ /**
* @brief Get the shader language version that the system supports
* @return the shader language version.
*/
GraphicsInterface* mGraphics; ///< Graphics interface
ThreadController* mThreadController; ///< The thread controller
unsigned int mMaxTextureSize; ///< The largest texture that the GL can handle
+ unsigned int mMaxCombinedTextureUnits; ///< The maximum number of combined texture units
unsigned int mShaderLanguageVersion; ///< The shader language version that the system supports.
bool mIsMultipleWindowSupported : 1; ///< Whether multiple window is supported by the GLES
bool mIsAdvancedBlendEquationSupported : 1; ///< Whether blend equation advanced (extension) is supported by the GLES
bool mIsAdvancedBlendEquationSupportedCached : 1; ///< Whether we have checked the support of blend equation advanced (extension)
bool mIsMultisampledRenderToTextureSupportedCached : 1; ///< Whether we have checked the support of multisampled render to texture (extension)
bool mShaderLanguageVersionCached : 1; ///< Whether we have checked the shader language version
+ bool mMaxCombinedTextureUnitsCached : 1; ///< Whether we have checked the maximum number of combined texture units
};
} // namespace Adaptor
#define DALI_INTERNAL_ADAPTOR_ENVIRONMENT_VARIABLES_H
/*
- * Copyright (c) 2022 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.
#define DALI_ENV_MAX_TEXTURE_SIZE "DALI_MAX_TEXTURE_SIZE"
+#define DALI_ENV_MAX_COMBINED_TEXTURE_UNITS "DALI_MAX_COMBINED_TEXTURE_UNITS"
+
#define DALI_RENDER_TO_FBO "DALI_RENDER_TO_FBO"
#define DALI_ENV_DISABLE_DEPTH_BUFFER "DALI_DISABLE_DEPTH_BUFFER"