/*
- * 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.
{
}
-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);
void EglGraphics::ActivateResourceContext()
{
- mGraphicsController.ActivateResourceContext();
-
if(mEglImplementation && mEglImplementation->IsSurfacelessContextSupported())
{
// Make the shared surfaceless context as current before rendering
mEglImplementation->MakeContextCurrent(EGL_NO_SURFACE, mEglImplementation->GetContext());
}
+
+ mGraphicsController.ActivateResourceContext();
}
void EglGraphics::ActivateSurfaceContext(Dali::RenderSurfaceInterface* surface)
{
- mGraphicsController.ActivateSurfaceContext(surface);
-
if(surface)
{
surface->InitializeGraphics();
surface->MakeContextCurrent();
}
+
+ mGraphicsController.ActivateSurfaceContext(surface);
+}
+
+void EglGraphics::PostRender()
+{
+ ActivateResourceContext();
+
+ if(mGraphicsController.GetCurrentContext())
+ {
+ mGraphicsController.GetCurrentContext()->InvalidateDepthStencilBuffers();
+ }
+
+ mGraphicsController.PostRender();
}
void EglGraphics::SetFirstFrameAfterResume()
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);
}
{
// Create a surfaceless OpenGL context for shared resources
mEglImplementation->CreateContext();
- mEglImplementation->MakeContextCurrent(EGL_NO_SURFACE, mEglImplementation->GetContext());
+ ActivateResourceContext();
}
else
{
currentSurface = surface;
if(currentSurface)
{
- currentSurface->InitializeGraphics();
- currentSurface->MakeContextCurrent();
+ ActivateSurfaceContext(currentSurface);
}
}
- 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()
void EglGraphics::CacheConfigurations(ConfigurationManager& configurationManager)
{
mGLES->SetIsAdvancedBlendEquationSupported(configurationManager.IsAdvancedBlendEquationSupported());
+ mGLES->SetIsMultisampledRenderToTextureSupported(configurationManager.IsMultisampledRenderToTextureSupported());
mGLES->SetShadingLanguageVersion(configurationManager.GetShadingLanguageVersion());
}