Avoid some useless duplicated GLES version setter.
It will reduce complexity of gles version relative logics.
Change-Id: Ibffe2894d9fab34188861d77aad28593aea6ac54
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
format = GL_UNSIGNED_SHORT;
break;
}
+ case Format::R32_UINT:
+ {
+ format = GL_UNSIGNED_INT;
+ break;
+ }
default:
{
format = 0;
/*
- * 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 EglGraphics::SetGlesVersion(const int32_t glesVersion)
-{
- if(mEglImplementation)
- {
- mEglImplementation->SetGlesVersion(glesVersion);
- }
-
- mGLES->SetGlesVersion(glesVersion);
-
- mGraphicsController.SetGLESVersion(static_cast<Graphics::GLES::GLESVersion>(glesVersion));
-}
-
void EglGraphics::SetIsSurfacelessContextSupported(const bool isSupported)
{
mGLES->SetIsSurfacelessContextSupported(isSupported);
if(!mEglImplementation->ChooseConfig(true, COLOR_DEPTH_32))
{
// Retry to use OpenGL es 2.0
- SetGlesVersion(20);
+ mEglImplementation->SetGlesVersion(20);
+
+ // Mark gles that we will use gles 2.0 version.
+ // After this call, we will not change mGLES version anymore.
+ mGLES->SetGlesVersion(20);
+
mEglImplementation->ChooseConfig(true, COLOR_DEPTH_32);
}
}
}
- mGLES->ContextCreated();
- SetGlesVersion(mGLES->GetGlesVersion());
+ mGLES->ContextCreated(); // After this call, we can know exact gles version.
+ auto glesVersion = mGLES->GetGlesVersion();
+
+ // Set more detail GLES version to egl and graphics controller.
+ // Note. usually we don't need EGL client's minor version. So don't need to choose config one more time.
+ mEglImplementation->SetGlesVersion(glesVersion);
+ mGraphicsController.SetGLESVersion(static_cast<Graphics::GLES::GLESVersion>(glesVersion));
}
void EglGraphics::Shutdown()
#define DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_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 ConfigureSurface(Dali::RenderSurfaceInterface* surface) override;
/**
- * Set gles version
- * Default version is gles 3.0
- */
- void SetGlesVersion(const int32_t glesVersion);
-
- /**
* Set whether the surfaceless context is supported
* @param[in] isSupported Whether the surfaceless context is supported
*/
#define DALI_INTERNAL_GL_IMPLEMENTATION_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.
{
namespace
{
-static constexpr int32_t INITIAL_GLES_VERSION = 30;
-static constexpr int32_t GLES_VERSION_SUPPORT_BLEND_EQUATION_ADVANCED = 32;
-static constexpr const char* LEGACY_SHADING_LANGUAGE_VERSION = "100";
+static constexpr int32_t INITIAL_GLES_VERSION = 30;
+static constexpr int32_t GLES_VERSION_SUPPORT_BLEND_EQUATION_ADVANCED = 32;
+
+static constexpr int32_t MINIMUM_GLES_VERSION_GET_MAXIMUM_MULTISAMPLES_TO_TEXTURE = 30;
+
+static constexpr const char* LEGACY_SHADING_LANGUAGE_VERSION = "100";
static constexpr const char* DEFAULT_SAMPLER_TYPE = "sampler2D";
{
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize);
+ // 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.
if(mGlesVersion >= INITIAL_GLES_VERSION)
{
if(IsMultisampledRenderToTextureSupported())
{
- glGetIntegerv(GL_MAX_SAMPLES_EXT, &mMaxTextureSamples);
+ mMaxTextureSamples = 0;
+
+ if(mGlesVersion >= MINIMUM_GLES_VERSION_GET_MAXIMUM_MULTISAMPLES_TO_TEXTURE)
+ {
+ // Try to get maximum FBO MSAA sampling level from GL_RENDERBUFFER first.
+ // If false, than ask again to GL_MAX_SAMPLES_EXT.
+ GetInternalformativ(GL_RENDERBUFFER, GL_RGBA8, GL_SAMPLES, 1, &mMaxTextureSamples);
+ }
+ if(mMaxTextureSamples == 0)
+ {
+ glGetIntegerv(GL_MAX_SAMPLES_EXT, &mMaxTextureSamples);
+ }
}
if(!mShadingLanguageVersionCached)
return mMaxTextureSamples;
}
- int GetGlesVersion()
+ int32_t GetGlesVersion()
{
ConditionalWait::ScopedLock lock(mContextCreatedWaitCondition);
if(!mIsContextCreated)