2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include <dali/internal/graphics/gles/egl-graphics.h>
23 #include <dali/internal/window-system/common/display-utils.h> // For Utils::MakeUnique
32 EglGraphics::EglGraphics( )
33 : mMultiSamplingLevel( 0 )
37 EglGraphics::~EglGraphics()
42 void EglGraphics::Initialize( EnvironmentOptions* environmentOptions )
44 if( environmentOptions->GetGlesCallTime() > 0 )
46 mGLES = Utils::MakeUnique< GlProxyImplementation >( *environmentOptions );
50 mGLES.reset ( new GlImplementation() );
53 mDepthBufferRequired = static_cast< Integration::DepthBufferAvailable >( environmentOptions->DepthBufferRequired() );
54 mStencilBufferRequired = static_cast< Integration::StencilBufferAvailable >( environmentOptions->StencilBufferRequired() );
56 mMultiSamplingLevel = environmentOptions->GetMultiSamplingLevel();
58 mEglSync = Utils::MakeUnique< EglSyncImplementation >();
61 EglInterface* EglGraphics::Create()
63 mEglImplementation = Utils::MakeUnique< EglImplementation >( mMultiSamplingLevel, mDepthBufferRequired, mStencilBufferRequired );
64 mEglImageExtensions = Utils::MakeUnique< EglImageExtensions >( mEglImplementation.get() );
66 mEglSync->Initialize( mEglImplementation.get() ); // The sync impl needs the EglDisplay
68 return mEglImplementation.get();
71 void EglGraphics::Destroy()
75 GlImplementation& EglGraphics::GetGlesInterface()
80 Integration::GlAbstraction& EglGraphics::GetGlAbstraction() const
82 DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
86 EglImplementation& EglGraphics::GetEglImplementation() const
88 DALI_ASSERT_DEBUG( mEglImplementation && "EGLImplementation not created" );
89 return *mEglImplementation;
92 EglInterface& EglGraphics::GetEglInterface() const
94 DALI_ASSERT_DEBUG( mEglImplementation && "EGLImplementation not created" );
95 EglInterface* eglInterface = mEglImplementation.get();
99 EglSyncImplementation& EglGraphics::GetSyncImplementation()
101 DALI_ASSERT_DEBUG( mEglSync && "EglSyncImplementation not created" );
105 EglImageExtensions* EglGraphics::GetImageExtensions()
107 DALI_ASSERT_DEBUG( mEglImageExtensions && "EglImageExtensions not created" );
108 return mEglImageExtensions.get();