utc-Dali-Application.cpp
utc-Dali-EncodedImageBuffer.cpp
utc-Dali-Capture.cpp
+ utc-Dali-WindowData.cpp
utc-Dali-FileLoader.cpp
utc-Dali-GifLoading.cpp
utc-Dali-Gl-Window.cpp
#define TEST_GL_ABSTRACTION_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.
inline void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount) override
{
+ std::stringstream out;
+ out << mode << ", " << first << ", " << count << ", " << instanceCount;
+ TraceCallStack::NamedParams namedParams;
+ namedParams["mode"] << std::hex << mode;
+ namedParams["first"] << first;
+ namedParams["count"] << count;
+ namedParams["instanceCount"] << instanceCount;
+ mDrawTrace.PushCall("DrawArraysInstanced", out.str(), namedParams);
}
inline void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount) override
{
+ std::stringstream out;
+ out << mode << ", " << count << ", " << type << ", " << instanceCount;
+ TraceCallStack::NamedParams namedParams;
+ namedParams["mode"] << std::hex << mode;
+ namedParams["count"] << count;
+ namedParams["type"] << std::hex << type;
+ namedParams["indexCount"] << instanceCount;
+ mDrawTrace.PushCall("DrawElementsInstanced", out.str(), namedParams);
}
inline GLsync FenceSync(GLenum condition, GLbitfield flags) override
inline void VertexAttribDivisor(GLuint index, GLuint divisor) override
{
+ std::stringstream out;
+ out << index << ", " << divisor;
+ TraceCallStack::NamedParams namedParams;
+ namedParams["index"] << index;
+ namedParams["divisor"] << divisor;
+ mBufferTrace.PushCall("VertexAttribDivisor", out.str(), namedParams);
}
inline void BindTransformFeedback(GLenum target, GLuint id) override
#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
*/
{
if(currentPipeline)
{
- mGl.DrawArrays(GetTopology(currentPipeline->inputAssemblyState.topology),
- 0,
- cmd.data.draw.draw.vertexCount);
+ if(cmd.data.draw.draw.instanceCount == 0)
+ {
+ mGl.DrawArrays(GetTopology(currentPipeline->inputAssemblyState.topology),
+ 0,
+ cmd.data.draw.draw.vertexCount);
+ }
+ else
+ {
+ mGl.DrawArraysInstanced(GetTopology(currentPipeline->inputAssemblyState.topology),
+ 0,
+ cmd.data.draw.draw.vertexCount,
+ cmd.data.draw.draw.instanceCount);
+ }
}
break;
}
{
if(currentPipeline)
{
- mGl.DrawElements(GetTopology(currentPipeline->inputAssemblyState.topology),
- static_cast<GLsizei>(cmd.data.draw.drawIndexed.indexCount),
- GL_UNSIGNED_SHORT,
- reinterpret_cast<void*>(cmd.data.draw.drawIndexed.firstIndex));
+ if(cmd.data.draw.draw.instanceCount == 0)
+ {
+ mGl.DrawElements(GetTopology(currentPipeline->inputAssemblyState.topology),
+ static_cast<GLsizei>(cmd.data.draw.drawIndexed.indexCount),
+ GL_UNSIGNED_SHORT,
+ reinterpret_cast<void*>(cmd.data.draw.drawIndexed.firstIndex));
+ }
+ else
+ {
+ mGl.DrawElementsInstanced(GetTopology(currentPipeline->inputAssemblyState.topology),
+ static_cast<GLsizei>(cmd.data.draw.drawIndexed.indexCount),
+ GL_UNSIGNED_SHORT,
+ reinterpret_cast<void*>(cmd.data.draw.drawIndexed.firstIndex),
+ cmd.data.draw.drawIndexed.instanceCount);
+ }
}
break;
}
uint32_t attributeOffset = attribute.offset;
GLsizei stride = vi.bufferBindings[attribute.binding].stride;
+ auto rate = vi.bufferBindings[attribute.binding].inputRate;
+
mGl.VertexAttribPointer(attribute.location,
GetNumComponents(attribute.format),
GetGlType(attribute.format),
GL_FALSE, // Not normalized
stride,
reinterpret_cast<void*>(attributeOffset));
+ if(rate == Graphics::VertexInputRate::PER_VERTEX)
+ {
+ mGl.VertexAttribDivisor(attribute.location, 0);
+ }
+ else if(rate == Graphics::VertexInputRate::PER_INSTANCE)
+ {
+ mGl.VertexAttribDivisor(attribute.location, 1);
+ }
}
// Cull face setup
/*
- * 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.
END_TEST;
}
+int UtcDaliApplicationNew08P(void)
+{
+ int argc(1);
+ const char* argList[1] = {"program"};
+ char** argv = const_cast<char**>(argList);
+ WindowData windowData;
+
+ Application application = Application::New(&argc, &argv, "stylesheet", false, windowData);
+
+ MyTestApp testApp(application);
+
+ DALI_TEST_CHECK(application);
+
+ END_TEST;
+}
+
int UtcDaliApplicationCopyAndAssignment(void)
{
Application application = Application::New();
--- /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-test-suite-utils.h>
+#include <dali/public-api/adaptor-framework/window-data.h>
+
+using namespace Dali;
+
+int UtcDaliWindowData01(void)
+{
+ // Test default values
+ WindowData windowData;
+
+ DALI_TEST_CHECK(windowData.GetWindowType() == WindowType::NORMAL);
+ DALI_TEST_CHECK(windowData.GetTransparency() == true);
+ DALI_TEST_CHECK(windowData.GetPositionSize().x == 0);
+ DALI_TEST_CHECK(windowData.GetPositionSize().y == 0);
+ DALI_TEST_CHECK(windowData.GetPositionSize().width == 0);
+ DALI_TEST_CHECK(windowData.GetPositionSize().height == 0);
+
+ END_TEST;
+}
+
+int UtcDaliWindowData02(void)
+{
+ // Test SetTransparency and GetTransparency
+ WindowData windowData;
+ windowData.SetTransparency(false);
+
+ DALI_TEST_CHECK(windowData.GetTransparency() == false);
+
+ END_TEST;
+}
+
+int UtcDaliWindowData03(void)
+{
+ // Test SetWindowType and GetWindowType
+ WindowData windowData;
+ windowData.SetWindowType(WindowType::UTILITY);
+
+ DALI_TEST_CHECK(windowData.GetWindowType() == WindowType::UTILITY);
+
+ END_TEST;
+}
+
+int UtcDaliWindowData04(void)
+{
+ // Test SetPositionSize and GetPositionSize
+ WindowData windowData;
+ Dali::Rect<int> rect(100, 200, 300, 400);
+ windowData.SetPositionSize(rect);
+
+ DALI_TEST_CHECK(windowData.GetPositionSize().x == 100);
+ DALI_TEST_CHECK(windowData.GetPositionSize().y == 200);
+ DALI_TEST_CHECK(windowData.GetPositionSize().width == 300);
+ DALI_TEST_CHECK(windowData.GetPositionSize().height == 400);
+
+ END_TEST;
+}
#define DALI_H
/*
- * Copyright (c) 2020 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.
#include <dali/public-api/adaptor-framework/widget-application.h>
#include <dali/public-api/adaptor-framework/widget-impl.h>
#include <dali/public-api/adaptor-framework/widget.h>
+#include <dali/public-api/adaptor-framework/window-data.h>
#include <dali/public-api/dali-adaptor-version.h>
-#endif //DALI_H
+#endif // DALI_H
--- /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);
}
/**
// Map binding# to sampler location
const auto& reflection = !newProgram ? currentProgram->GetReflection() : newProgram->GetReflection();
const auto& samplers = reflection.GetSamplers();
+
+ uint32_t currentSampler = 0;
+ uint32_t currentElement = 0;
+
+ // @warning Assume that binding.binding is strictly linear in the same order as mCurrentTextureBindings
+ // elements. This avoids having to sort the bindings.
for(const auto& binding : mImpl->mCurrentTextureBindings)
{
auto texture = const_cast<GLES::Texture*>(static_cast<const GLES::Texture*>(binding.texture));
// Texture may not have been initialized yet...(tbm_surface timing issue?)
if(!texture->GetGLTexture())
{
- // Attempt to reinitialize
- // @todo need to put this somewhere else where it isn't const.
- // Maybe post it back on end of initialize queue if initialization fails?
texture->InitializeResource();
}
// Warning, this may cause glWaitSync to occur on the GPU.
dependencyChecker.CheckNeedsSync(this, texture);
-
texture->Bind(binding);
-
- texture->Prepare(); // @todo also non-const.
-
- if(binding.binding < samplers.size()) // binding maps to texture unit. (texture bindings should also be in binding order)
+ texture->Prepare();
+
+ // @warning Assume that location of array elements is sequential.
+ // @warning GL does not guarantee this, but in practice, it is.
+ gl.Uniform1i(samplers[currentSampler].location + currentElement,
+ samplers[currentSampler].offset + currentElement);
+ ++currentElement;
+ if(currentElement >= samplers[currentSampler].elementCount)
{
- // Offset is set to the lexical offset within the frag shader, map it to the texture unit
- // @todo Explicitly set the texture unit through the graphics interface
- gl.Uniform1i(samplers[binding.binding].location, samplers[binding.binding].offset);
+ ++currentSampler;
+ currentElement = 0;
+ }
+ if(currentSampler >= samplers.size())
+ {
+ // Don't bind more textures than there are active samplers.
+ break;
}
}
GL_FALSE,
bufferBinding.stride,
reinterpret_cast<void*>(attr.offset));
+
+ switch(bufferBinding.inputRate)
+ {
+ case Graphics::VertexInputRate::PER_VERTEX:
+ {
+ gl.VertexAttribDivisor(attr.location, 0);
+ break;
+ }
+ case Graphics::VertexInputRate::PER_INSTANCE:
+ {
+ //@todo Get actual instance rate...
+ gl.VertexAttribDivisor(attr.location, 1);
+ break;
+ }
+ }
}
// Resolve topology
mImpl->FlushVertexAttributeLocations();
}
- gl.DrawArrays(GLESTopology(ia->topology),
- drawCall.draw.firstVertex,
- drawCall.draw.vertexCount);
+ if(drawCall.draw.instanceCount == 0)
+ {
+ gl.DrawArrays(GLESTopology(ia->topology),
+ drawCall.draw.firstVertex,
+ drawCall.draw.vertexCount);
+ }
+ else
+ {
+ gl.DrawArraysInstanced(GLESTopology(ia->topology),
+ drawCall.draw.firstVertex,
+ drawCall.draw.vertexCount,
+ drawCall.draw.instanceCount);
+ }
break;
}
case DrawCallDescriptor::Type::DRAW_INDEXED:
}
auto indexBufferFormat = GLIndexFormat(binding.format).format;
- gl.DrawElements(GLESTopology(ia->topology),
- drawCall.drawIndexed.indexCount,
- indexBufferFormat,
- reinterpret_cast<void*>(binding.offset));
+ if(drawCall.drawIndexed.instanceCount == 0)
+ {
+ gl.DrawElements(GLESTopology(ia->topology),
+ drawCall.drawIndexed.indexCount,
+ indexBufferFormat,
+ reinterpret_cast<void*>(binding.offset));
+ }
+ else
+ {
+ gl.DrawElementsInstanced(GLESTopology(ia->topology),
+ drawCall.drawIndexed.indexCount,
+ indexBufferFormat,
+ reinterpret_cast<void*>(binding.offset),
+ drawCall.drawIndexed.instanceCount);
+ }
break;
}
case DrawCallDescriptor::Type::DRAW_INDEXED_INDIRECT:
/*
- * 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 strncmp(lhs.mString, rhs, lhs.mLength) == 0;
}
-const char* const DELIMITERS = " \t\n";
+const char* const DELIMITERS = " \t\n";
+const char* const DELIMITERS_INC_INDEX = " \t\n[]";
constexpr StringSize UNIFORM{"uniform"};
constexpr StringSize SAMPLER_PREFIX{"sampler"};
constexpr StringSize SAMPLER_TYPES[] = {"2D", "Cube", "ExternalOES"};
while(uniform)
{
+ // From "uniform" to ";", not ignoring comments.
char* outerToken = strtok_r(uniform + UNIFORM.mLength, ";", &uniform);
char* nextPtr = nullptr;
char* token = strtok_r(outerToken, DELIMITERS, &nextPtr);
while(token)
{
+ // Ignore any token up to "sampler"
if(SAMPLER_PREFIX == token)
{
token += SAMPLER_PREFIX.mLength;
if(std::find(SAMPLER_TYPES, END_SAMPLER_TYPES, token) != END_SAMPLER_TYPES)
{
bool found(false);
- token = strtok_r(nullptr, DELIMITERS, &nextPtr);
+ // We now are at next token after "samplerxxx" in outerToken token "stream"
+
+ // Does it use array notation?
+ int arraySize = 0; // 0 = No array
+ auto iter = std::string(token).find("[", 0);
+ if(iter != std::string::npos)
+ {
+ // Get Array size from source. (Warning, may be higher than GetActiveUniform suggests)
+ iter++;
+ arraySize = int(strtol(token + iter, nullptr, 0));
+ }
+
+ token = strtok_r(nullptr, DELIMITERS_INC_INDEX, &nextPtr); // " ", "\t", "\n", "[", "]"
for(uint32_t i = 0; i < static_cast<uint32_t>(uniformOpaques.size()); ++i)
{
if(samplerPositions[i] == -1 &&
strncmp(token, uniformOpaques[i].name.c_str(), uniformOpaques[i].name.size()) == 0)
{
- samplerPositions[i] = uniformOpaques[i].offset = samplerPosition++;
- found = true;
+ // We have found a matching name.
+ samplerPositions[i] = uniformOpaques[i].offset = samplerPosition;
+ if(arraySize == 0)
+ {
+ ++samplerPosition;
+ }
+ else
+ {
+ samplerPosition += arraySize;
+ }
+ found = true;
break;
}
}
GLenum type;
int written;
gl->GetActiveUniform(glProgram, i, maxLen, &written, &elementCount, &type, name);
+
int location = gl->GetUniformLocation(glProgram, name);
Dali::Graphics::UniformInfo uniformInfo;
uniformInfo.name = name;
if(elementCount > 1)
{
+ // If we have an active uniform that refers to an array, only the first element
+ // is present in this list, and is referenced as "uniform[0]", but the element
+ // count is non-zero to indicate how many uniforms there are in the array.
+
+ // Strip off the array, but store the element count
auto iter = std::string(uniformInfo.name).find("[", 0);
if(iter != std::string::npos)
{
- uniformInfo.name = std::string(name).substr(0, iter);
+ uniformInfo.name = std::string(name).substr(0, iter);
+ uniformInfo.elementCount = elementCount;
}
}
-
uniformInfo.uniformClass = IsSampler(type) ? Dali::Graphics::UniformClass::COMBINED_IMAGE_SAMPLER : Dali::Graphics::UniformClass::UNIFORM;
- uniformInfo.location = location; //IsSampler(type) ? 0 : location;
- uniformInfo.binding = 0; // IsSampler(type) ? location : 0;
+ uniformInfo.location = location; // GL doesn't guarantee that consecutive array elements have sequential locations. But, we only store location of first element.
+ uniformInfo.binding = 0;
uniformInfo.bufferIndex = 0;
uniformInfo.offset = 0;
/*
- * 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"
{
namespace Internal
{
-Dali::TextAbstraction::FontClient FontClient::gPreInitializedFontClient(NULL);
-Dali::TextAbstraction::FontClient FontClient::gPreCachedFontClient(NULL);
+Dali::TextAbstraction::FontClient FontClient::gPreCreatedFontClient(NULL);
std::thread gPreCacheThread;
/* TODO: This is to prevent duplicate calls of font pre-cache.
* We may support this later, but currently we can't guarantee the behaviour
FONT_LOG_MESSAGE(Dali::Integration::Log::INFO, "FontClient PreCache thread join\n");
}
- if(gPreInitializedFontClient)
+ if(gPreCreatedFontClient)
{
- fontClientHandle = gPreInitializedFontClient;
- gPreInitializedFontClient.Reset(); // No longer needed
- }
- else if(gPreCachedFontClient)
- {
- // TODO: Currently font pre-caching is not available in the candidate process.
- fontClientHandle = gPreCachedFontClient;
- gPreCachedFontClient.Reset(); // No longer needed
+ fontClientHandle = gPreCreatedFontClient;
+ gPreCreatedFontClient.Reset(); // No longer needed
}
else
{
Dali::TextAbstraction::FontClient FontClient::PreInitialize()
{
- gPreInitializedFontClient = Dali::TextAbstraction::FontClient(new FontClient);
+ // Pre-cached font client already exists or pre-cache thread already running.
+ // Font client pre-cache includes caching of the default font description.
+ if((gPreCreatedFontClient && !gFontPreCacheAvailable) ||
+ (gPreCacheThread.joinable()))
+ {
+ return gPreCreatedFontClient;
+ }
+
+ gPreCreatedFontClient = Dali::TextAbstraction::FontClient(new FontClient);
// Make DefaultFontDescription cached
Dali::TextAbstraction::FontDescription defaultFontDescription;
- gPreInitializedFontClient.GetDefaultPlatformFontDescription(defaultFontDescription);
+ gPreCreatedFontClient.GetDefaultPlatformFontDescription(defaultFontDescription);
- return gPreInitializedFontClient;
+ return gPreCreatedFontClient;
}
void FontClient::PreCacheRun(const FontFamilyList& fallbackFamilyList, const FontFamilyList& extraFamilyList, const FontFamily& localeFamily)
{
- if(!gPreCachedFontClient)
+ if(gFontPreCacheAvailable)
{
- FONT_LOG_MESSAGE(Dali::Integration::Log::INFO, "BEGIN: DALI_TEXT_PRECACHE_RUN\n");
- Dali::TextAbstraction::FontClient fontClient = Dali::TextAbstraction::FontClient(new FontClient);
- GetImplementation(fontClient).FontPreCache(fallbackFamilyList, extraFamilyList, localeFamily);
- gPreCachedFontClient = fontClient;
gFontPreCacheAvailable = false;
+ FONT_LOG_MESSAGE(Dali::Integration::Log::INFO, "BEGIN: DALI_TEXT_PRECACHE_RUN\n");
+ if(!gPreCreatedFontClient)
+ {
+ gPreCreatedFontClient = Dali::TextAbstraction::FontClient(new FontClient);
+ }
+ GetImplementation(gPreCreatedFontClient).FontPreCache(fallbackFamilyList, extraFamilyList, localeFamily);
FONT_LOG_MESSAGE(Dali::Integration::Log::INFO, "END: DALI_TEXT_PRECACHE_RUN\n");
}
else
unsigned int mDpiHorizontal;
unsigned int mDpiVertical;
- static Dali::TextAbstraction::FontClient gPreInitializedFontClient;
- static Dali::TextAbstraction::FontClient gPreCachedFontClient;
+ static Dali::TextAbstraction::FontClient gPreCreatedFontClient;
}; // class FontClient
return Application(internal.Get());
}
+Application Application::New(int* argc, char** argv[], const std::string& stylesheet, bool useUiThread, WindowData& windowData)
+{
+ Internal::Adaptor::ApplicationPtr internal = Internal::Adaptor::Application::GetPreInitializedApplication();
+ if(internal)
+ {
+ // pre-initialized application
+ internal->SetCommandLineOptions(argc, argv);
+ internal->SetStyleSheet(stylesheet);
+
+ // Set defaut Window type
+ internal->SetDefaultWindowType(windowData.GetWindowType());
+ internal->GetWindow().SetTransparency(windowData.GetTransparency());
+
+ // Store only the value before adaptor is created
+ internal->StoreWindowPositionSize(windowData.GetPositionSize());
+ }
+ else
+ {
+ // clang-format off
+ internal = Internal::Adaptor::Application::New(argc, argv, stylesheet,
+ windowData.GetTransparency() ? WINDOW_MODE::TRANSPARENT : WINDOW_MODE::OPAQUE,
+ windowData.GetPositionSize(), Internal::Adaptor::Framework::NORMAL,
+ windowData.GetWindowType(), useUiThread);
+ // clang-format on
+ }
+ return Application(internal.Get());
+}
+
Application::~Application()
{
}
#define DALI_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.
// INTERNAL INCLUDES
#include <dali/public-api/adaptor-framework/device-status.h>
+#include <dali/public-api/adaptor-framework/window-data.h>
#include <dali/public-api/adaptor-framework/window.h>
namespace Dali
static Application New(int* argc, char** argv[], const std::string& stylesheet, Application::WINDOW_MODE windowMode, PositionSize positionSize, bool useUiThread);
/**
+ * @brief This is the constructor for applications.
+ *
+ * @SINCE_2_2.23
+ * @PRIVLEVEL_PUBLIC
+ * @PRIVILEGE_DISPLAY
+ * @param[in,out] argc A pointer to the number of arguments
+ * @param[in,out] argv A pointer to the argument list
+ * @param[in] stylesheet The path to user defined theme file
+ * @param[in] useUiThread True if the application would create a UI thread
+ * @param[in] windowData The window data for the application
+ * @return A handle to the Application
+ * @note If the stylesheet is not specified, then the library's default stylesheet will not be overridden.<BR>
+ * UI thread is an additional thread that DALi creates for UI events.
+ * The UI thread isn't blocked from the system events(AppControl, LanguageChanged, RegionChanged, LowMemory, LowBattery task signals).
+ */
+ static Application New(int* argc, char** argv[], const std::string& stylesheet, bool useUiThread, WindowData& windowData);
+
+ /**
* @brief Constructs an empty handle.
* @SINCE_1_0.0
*/
--- /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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/public-api/adaptor-framework/window-data.h>
+
+namespace Dali
+{
+struct WindowData::Impl
+{
+ Impl()
+ : mPositionSize(0, 0, 0, 0),
+ mIsTransparent(true),
+ mWindowType(WindowType::NORMAL)
+ {
+ }
+
+ Dali::Rect<int> mPositionSize; ///< The position and size of the Window
+ bool mIsTransparent; ///< The transparency of the Window
+ WindowType mWindowType; ///< The window type of the Window
+};
+
+WindowData::WindowData()
+: mImpl(std::make_unique<Impl>())
+{
+}
+
+WindowData::~WindowData() = default;
+
+void WindowData::SetPositionSize(Dali::Rect<int>& positionSize)
+{
+ mImpl->mPositionSize = positionSize;
+}
+
+Dali::Rect<int> WindowData::GetPositionSize() const
+{
+ return mImpl->mPositionSize;
+}
+
+void WindowData::SetTransparency(bool transparent)
+{
+ mImpl->mIsTransparent = transparent;
+}
+
+bool WindowData::GetTransparency() const
+{
+ return mImpl->mIsTransparent;
+}
+
+void WindowData::SetWindowType(WindowType type)
+{
+ mImpl->mWindowType = type;
+}
+
+WindowType WindowData::GetWindowType() const
+{
+ return mImpl->mWindowType;
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_WINDOW_DATA_H
+#define DALI_WINDOW_DATA_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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/window-enumerations.h>
+#include <dali/public-api/dali-adaptor-common.h>
+#include <dali/public-api/math/rect.h>
+#include <memory>
+
+namespace Dali
+{
+/**
+ * The WindowData class is used as a parameter for the constructors of the Application class.
+ * The data from the WindowData object is used to customize the default window created by the Application class.
+ *
+ * The default values are below:
+ * PositionSize : x:0, y:0, w:0, h:0 (full-screen window)
+ * Transparency : true (Window is created with 32-bit color depth)
+ * WindowType : NORMAL
+ *
+ * If you want to customize the window, you can modify the values of the WindowData object as needed.
+ * @SINCE_2_2.23
+ */
+class DALI_ADAPTOR_API WindowData
+{
+public:
+ /**
+ * @brief Creates a WindowData object.
+ */
+ WindowData();
+
+ /**
+ * @brief Destructor.
+ */
+ ~WindowData();
+
+ /**
+ * @brief Sets the position and size
+ *
+ * @SINCE_2_2.23
+ * @param[in] positionSize Position and Size
+ */
+ void SetPositionSize(Dali::Rect<int>& positionSize);
+
+ /**
+ * @brief Gets the PositionSize
+ *
+ * @SINCE_2_2.23
+ * @return The position and size
+ */
+ Dali::Rect<int> GetPositionSize() const;
+
+ /**
+ * @brief Sets the transparency
+ *
+ * @SINCE_2_2.23
+ * @param[in] transparent transparency
+ */
+ void SetTransparency(bool transparent);
+
+ /**
+ * @brief Gets the transparency
+ *
+ * @SINCE_2_2.23
+ * @return whether transparency
+ */
+ bool GetTransparency() const;
+
+ /**
+ * @brief Sets the window type
+ *
+ * @SINCE_2_2.23
+ * @param[in] type the window type
+ */
+ void SetWindowType(WindowType type);
+
+ /**
+ * @brief Gets the window type
+ *
+ * @SINCE_2_2.23
+ * @return the window type
+ */
+ WindowType GetWindowType() const;
+
+private:
+ struct Impl;
+ std::unique_ptr<Impl> mImpl;
+};
+
+} // namespace Dali
+
+#endif // DALI_WINDOW_DATA_H
{
const unsigned int ADAPTOR_MAJOR_VERSION = 2;
const unsigned int ADAPTOR_MINOR_VERSION = 2;
-const unsigned int ADAPTOR_MICRO_VERSION = 22;
+const unsigned int ADAPTOR_MICRO_VERSION = 23;
const char* const ADAPTOR_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
${adaptor_public_api_dir}/adaptor-framework/widget-application.cpp
${adaptor_public_api_dir}/adaptor-framework/widget-impl.cpp
${adaptor_public_api_dir}/adaptor-framework/async-task-manager.cpp
+ ${adaptor_public_api_dir}/adaptor-framework/window-data.cpp
${adaptor_public_api_dir}/capture/capture.cpp
${adaptor_public_api_dir}/dali-adaptor-version.cpp
)
${adaptor_public_api_dir}/adaptor-framework/window-enumerations.h
${adaptor_public_api_dir}/adaptor-framework/round-robin-container-view.h
${adaptor_public_api_dir}/adaptor-framework/async-task-manager.h
+ ${adaptor_public_api_dir}/adaptor-framework/window-data.h
)
SET( public_dali_capture_header_files
Name: dali2-adaptor
Summary: The DALi Tizen Adaptor
-Version: 2.2.22
+Version: 2.2.23
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT