$(devel_api_src_files) \
$(adaptor_devel_api_text_abstraction_src_files) \
$(adaptor_graphics_common_src_files) \
- $(adaptor_graphics_gles20_src_files) \
+ $(adaptor_graphics_gles_src_files) \
$(adaptor_graphics_ubuntu_src_files) \
$(adaptor_haptics_common_src_files) \
$(adaptor_imaging_common_src_files) \
$(devel_api_src_files) \
$(adaptor_devel_api_text_abstraction_src_files) \
$(adaptor_graphics_common_src_files) \
- $(adaptor_graphics_gles20_src_files) \
+ $(adaptor_graphics_gles_src_files) \
$(adaptor_graphics_tizen_src_files) \
$(adaptor_haptics_common_src_files) \
$(adaptor_imaging_common_src_files) \
$(devel_api_src_files) \
$(adaptor_devel_api_text_abstraction_src_files) \
$(adaptor_graphics_common_src_files) \
- $(adaptor_graphics_gles20_src_files) \
+ $(adaptor_graphics_gles_src_files) \
$(adaptor_graphics_tizen_src_files) \
$(adaptor_haptics_common_src_files) \
$(adaptor_haptics_tizen_src_files) \
$(devel_api_src_files) \
$(adaptor_devel_api_text_abstraction_src_files) \
$(adaptor_graphics_common_src_files) \
- $(adaptor_graphics_gles20_src_files) \
+ $(adaptor_graphics_gles_src_files) \
$(adaptor_graphics_tizen_src_files) \
$(adaptor_haptics_common_src_files) \
$(adaptor_imaging_common_src_files) \
$(devel_api_src_files) \
$(adaptor_devel_api_text_abstraction_src_files) \
$(adaptor_graphics_common_src_files) \
- $(adaptor_graphics_gles20_src_files) \
+ $(adaptor_graphics_gles_src_files) \
$(adaptor_graphics_tizen_src_files) \
$(adaptor_haptics_common_src_files) \
$(adaptor_imaging_common_src_files) \
$(devel_api_src_files) \
$(adaptor_devel_api_text_abstraction_src_files) \
$(adaptor_graphics_common_src_files) \
- $(adaptor_graphics_gles20_src_files) \
+ $(adaptor_graphics_gles_src_files) \
$(adaptor_graphics_tizen_src_files) \
$(adaptor_haptics_common_src_files) \
$(adaptor_imaging_common_src_files) \
// INTERNAL INCLUDES
#include <dali/public-api/dali-adaptor-common.h>
-#include <dali/internal/graphics/gles20/egl-graphics-factory.h>
+#include <dali/internal/graphics/gles/egl-graphics-factory.h>
#include <dali/internal/window-system/common/display-utils.h>
// INTERNAL INCLUDES
#include <dali/internal/system/common/environment-options.h>
-#include <dali/internal/graphics/gles20/egl-graphics-factory.h>
+#include <dali/internal/graphics/gles/egl-graphics-factory.h>
namespace Dali
#include <dali/internal/system/common/performance-interface-factory.h>
#include <dali/internal/adaptor/common/lifecycle-observer.h>
-#include <dali/internal/graphics/gles20/egl-graphics-factory.h>
-#include <dali/internal/graphics/gles20/egl-graphics.h> // Temporary until Core is abstracted
+#include <dali/internal/graphics/gles/egl-graphics-factory.h>
+#include <dali/internal/graphics/gles/egl-graphics.h> // Temporary until Core is abstracted
#include <dali/devel-api/text-abstraction/font-client.h>
#include <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
#include <dali/internal/input/common/gesture-manager.h>
#include <dali/internal/window-system/common/event-handler.h>
-#include <dali/internal/graphics/gles20/gl-proxy-implementation.h>
-#include <dali/internal/graphics/gles20/gl-implementation.h>
-#include <dali/internal/graphics/gles20/egl-sync-implementation.h>
+#include <dali/internal/graphics/gles/gl-proxy-implementation.h>
+#include <dali/internal/graphics/gles/gl-implementation.h>
+#include <dali/internal/graphics/gles/egl-sync-implementation.h>
#include <dali/internal/graphics/common/egl-image-extensions.h>
#include <dali/internal/clipboard/common/clipboard-impl.h>
#include <dali/internal/graphics/common/vsync-monitor.h>
#include <dali/integration-api/trigger-event-factory-interface.h>
#include <dali/internal/window-system/common/display-connection.h>
#include <dali/internal/graphics/common/graphics-interface.h>
-#include <dali/internal/graphics/gles20/egl-factory-interface.h>
+#include <dali/internal/graphics/gles/egl-factory-interface.h>
#include <dali/internal/network/common/socket-factory-interface.h>
#include <dali/internal/system/common/performance-interface.h>
#include <dali/internal/graphics/common/vsync-monitor-interface.h>
-# module: graphics, backend: gles20
-adaptor_graphics_gles20_src_files=\
- ${adaptor_graphics_dir}/gles20/egl-debug.cpp \
- ${adaptor_graphics_dir}/gles20/egl-implementation.cpp \
- ${adaptor_graphics_dir}/gles20/egl-sync-implementation.cpp \
- ${adaptor_graphics_dir}/gles20/gl-extensions.cpp \
- ${adaptor_graphics_dir}/gles20/gl-proxy-implementation.cpp \
- ${adaptor_graphics_dir}/gles20/egl-graphics-factory.cpp \
- ${adaptor_graphics_dir}/gles20/egl-graphics.cpp
+# module: graphics, backend: gles
+adaptor_graphics_gles_src_files=\
+ ${adaptor_graphics_dir}/gles/egl-debug.cpp \
+ ${adaptor_graphics_dir}/gles/egl-implementation.cpp \
+ ${adaptor_graphics_dir}/gles/egl-sync-implementation.cpp \
+ ${adaptor_graphics_dir}/gles/gl-extensions.cpp \
+ ${adaptor_graphics_dir}/gles/gl-proxy-implementation.cpp \
+ ${adaptor_graphics_dir}/gles/egl-graphics-factory.cpp \
+ ${adaptor_graphics_dir}/gles/egl-graphics.cpp
# module: graphics, backend: tizen
adaptor_graphics_tizen_src_files=\
--- /dev/null
+/*
+ * Copyright (c) 2014 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/internal/graphics/gles/egl-debug.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace Egl
+{
+
+void PrintError( EGLint error)
+{
+ switch (error)
+ {
+ case EGL_BAD_DISPLAY:
+ {
+ DALI_LOG_ERROR("EGL_BAD_DISPLAY : Display is not an EGL display connection\n");
+ break;
+ }
+ case EGL_NOT_INITIALIZED:
+ {
+ DALI_LOG_ERROR("EGL_NOT_INITIALIZED : Display has not been initialized\n");
+ break;
+ }
+ case EGL_BAD_SURFACE:
+ {
+ DALI_LOG_ERROR("EGL_BAD_SURFACE : Draw or read is not an EGL surface\n");
+ break;
+ }
+ case EGL_BAD_CONTEXT:
+ {
+ DALI_LOG_ERROR("EGL_BAD_CONTEXT : Context is not an EGL rendering context\n");
+ break;
+ }
+ case EGL_BAD_MATCH:
+ {
+ DALI_LOG_ERROR("EGL_BAD_MATCH : Draw or read are not compatible with context, or if context is set to EGL_NO_CONTEXT and draw or read are not set to EGL_NO_SURFACE, or if draw or read are set to EGL_NO_SURFACE and context is not set to EGL_NO_CONTEXT\n");
+ break;
+ }
+ case EGL_BAD_ACCESS:
+ {
+ DALI_LOG_ERROR("EGL_BAD_ACCESS : Context is current to some other thread\n");
+ break;
+ }
+ case EGL_BAD_NATIVE_PIXMAP:
+ {
+ DALI_LOG_ERROR("EGL_BAD_NATIVE_PIXMAP : A native pixmap underlying either draw or read is no longer valid\n");
+ break;
+ }
+ case EGL_BAD_NATIVE_WINDOW:
+ {
+ DALI_LOG_ERROR("EGL_BAD_NATIVE_WINDOW : A native window underlying either draw or read is no longer valid\n");
+ break;
+ }
+ case EGL_BAD_CURRENT_SURFACE:
+ {
+ DALI_LOG_ERROR("EGL_BAD_CURRENT_SURFACE : The previous context has unflushed commands and the previous surface is no longer valid\n");
+ break;
+ }
+ case EGL_BAD_ALLOC:
+ {
+ DALI_LOG_ERROR("EGL_BAD_ALLOC : Allocation of ancillary buffers for draw or read were delayed until eglMakeCurrent is called, and there are not enough resources to allocate them\n");
+ break;
+ }
+ case EGL_CONTEXT_LOST:
+ {
+ DALI_LOG_ERROR("EGL_CONTEXT_LOST : If a power management event has occurred. The application must destroy all contexts and reinitialise OpenGL ES state and objects to continue rendering\n");
+ break;
+ }
+ default:
+ {
+ DALI_LOG_ERROR("Unknown error with code: %d\n", error);
+ break;
+ }
+ }
+}
+
+} // namespace Egl
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_INTERNAL_EGL_DEBUG_H__
+#define __DALI_INTERNAL_EGL_DEBUG_H__
+
+/*
+ * Copyright (c) 2014 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 <EGL/egl.h>
+#include <EGL/eglext.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace Egl
+{
+
+void PrintError( EGLint error);
+
+} // namespace Egl
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif //__DALI_INTERNAL_EGL_DEBUG_H__
--- /dev/null
+#ifndef DALI_INTERNAL_BASE_EGL_FACTORY_INTERFACE_H
+#define DALI_INTERNAL_BASE_EGL_FACTORY_INTERFACE_H
+
+/*
+ * Copyright (c) 2014 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.
+ *
+ */
+
+namespace Dali
+{
+
+class EglInterface;
+
+namespace Internal
+{
+namespace Adaptor
+{
+
+/**
+ * Factory interface for creating EGL implementation
+ */
+class EglFactoryInterface
+{
+public:
+ /**
+ * Create an EGL implementation
+ * @return An implementation of the EGL interface
+ */
+ virtual EglInterface* Create() = 0;
+
+ /**
+ * Destroy the EGL implementation
+ */
+ virtual void Destroy() = 0;
+
+protected:
+ /**
+ * Virtual protected destructor - no deletion through this interface
+ */
+ virtual ~EglFactoryInterface() {};
+};
+
+} // Adaptor
+} // Internal
+} // Dali
+
+#endif // DALI_INTERNAL_BASE_EGL_FACTORY_INTERFACE_H
--- /dev/null
+/*
+ * Copyright (c) 2018 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/internal/graphics/gles/egl-graphics-factory.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
+
+// INTERNAL INCLUDES
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+GraphicsFactory::GraphicsFactory()
+{
+}
+
+GraphicsFactory::~GraphicsFactory()
+{
+ /* Deleted by Adaptor destructor */
+}
+
+GraphicsInterface& GraphicsFactory::Create()
+{
+ GraphicsInterface* eglGraphicsInterface = new EglGraphics;
+ return *eglGraphicsInterface;
+}
+
+void GraphicsFactory::Destroy()
+{
+ /* Deleted by EglGraphics */
+}
+
+} // Adaptor
+} // Internal
+} // Dali
--- /dev/null
+#ifndef DALI_INTERNAL_GRAPHICS_FACTORY_H
+#define DALI_INTERNAL_GRAPHICS_FACTORY_H
+
+/*
+ * Copyright (c) 2018 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/internal/graphics/common/graphics-factory-interface.h>
+
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class GraphicsFactory : public GraphicsFactoryInterface
+{
+public:
+
+ /**
+ * Constructor
+ */
+ GraphicsFactory();
+
+ /**
+ * Destructor
+ */
+ virtual ~GraphicsFactory();
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::GraphicsFactoryInterface::Create()
+ */
+ GraphicsInterface& Create() override;
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::GraphicsFactoryInterface::Destroy()
+ */
+ void Destroy();
+};
+
+} // Adaptor
+
+} // Internal
+
+} // Dali
+
+#endif // DALI_INTERNAL_GRAPHICS_FACTORY_H
--- /dev/null
+/*
+ * Copyright (c) 2018 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/internal/graphics/gles/egl-graphics.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/window-system/common/display-utils.h> // For Utils::MakeUnique
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+EglGraphics::EglGraphics( )
+: mMultiSamplingLevel( 0 )
+{
+}
+
+EglGraphics::~EglGraphics()
+{
+}
+
+
+void EglGraphics::Initialize( EnvironmentOptions* environmentOptions )
+{
+ if( environmentOptions->GetGlesCallTime() > 0 )
+ {
+ mGLES = Utils::MakeUnique< GlProxyImplementation >( *environmentOptions );
+ }
+ else
+ {
+ mGLES.reset ( new GlImplementation() );
+ }
+
+ mDepthBufferRequired = static_cast< Integration::DepthBufferAvailable >( environmentOptions->DepthBufferRequired() );
+ mStencilBufferRequired = static_cast< Integration::StencilBufferAvailable >( environmentOptions->StencilBufferRequired() );
+
+ mMultiSamplingLevel = environmentOptions->GetMultiSamplingLevel();
+
+ mEglSync = Utils::MakeUnique< EglSyncImplementation >();
+}
+
+EglInterface* EglGraphics::Create()
+{
+ mEglImplementation = Utils::MakeUnique< EglImplementation >( mMultiSamplingLevel, mDepthBufferRequired, mStencilBufferRequired );
+ mEglImageExtensions = Utils::MakeUnique< EglImageExtensions >( mEglImplementation.get() );
+
+ mEglSync->Initialize( mEglImplementation.get() ); // The sync impl needs the EglDisplay
+
+ return mEglImplementation.get();
+}
+
+void EglGraphics::Destroy()
+{
+}
+
+//Dali::Integration::GlAbstraction& EglGraphics::GetGlesInterface()
+GlImplementation& EglGraphics::GetGlesInterface()
+{
+ return *mGLES;
+}
+
+Integration::GlAbstraction& EglGraphics::GetGlAbstraction() const
+{
+ DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
+ return *mGLES;
+}
+
+EglImplementation& EglGraphics::GetEglImplementation() const
+{
+ DALI_ASSERT_DEBUG( mEglImplementation && "EGLImplementation not created" );
+ return *mEglImplementation;
+}
+
+EglInterface& EglGraphics::GetEglInterface() const
+{
+ DALI_ASSERT_DEBUG( mEglImplementation && "EGLImplementation not created" );
+ EglInterface* eglInterface = mEglImplementation.get();
+ return *eglInterface;
+}
+
+EglSyncImplementation& EglGraphics::GetSyncImplementation()
+{
+ DALI_ASSERT_DEBUG( mEglSync && "EglSyncImplementation not created" );
+ return *mEglSync;
+}
+
+EglImageExtensions* EglGraphics::GetImageExtensions()
+{
+ DALI_ASSERT_DEBUG( mEglImageExtensions && "EglImageExtensions not created" );
+ return mEglImageExtensions.get();
+}
+
+} // Adaptor
+} // Internal
+} // Dali
--- /dev/null
+#ifndef DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H
+#define DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H
+
+/*
+ * Copyright (c) 2018 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
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-interface.h>
+#include <dali/internal/graphics/gles/gl-proxy-implementation.h>
+#include <dali/internal/graphics/gles/gl-implementation.h>
+#include <dali/integration-api/egl-interface.h>
+
+#include <dali/internal/graphics/gles/egl-implementation.h>
+#include <dali/internal/graphics/common/egl-image-extensions.h>
+#include <dali/internal/graphics/gles/egl-sync-implementation.h>
+
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class EglGraphics : public GraphicsInterface
+{
+public:
+
+ /**
+ * Constructor
+ */
+ EglGraphics();
+
+ /**
+ * Destructor
+ */
+ virtual ~EglGraphics();
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::GraphicsInterface::Initialize()
+ */
+ void Initialize( EnvironmentOptions* environmentOptions ) override;
+
+ /**
+ * Creates the graphics interface for EGL
+ * @return The graphics interface for EGL
+ */
+ EglInterface* Create();
+
+ /**
+ * Gets the GL abstraction
+ * @return The GL abstraction
+ */
+ Integration::GlAbstraction& GetGlAbstraction() const;
+
+ /**
+ * Gets the implementation of EGL
+ * @return The implementation of EGL
+ */
+ EglImplementation& GetEglImplementation() const;
+
+ /**
+ * Gets the graphics interface for EGL
+ * @return The graphics interface for EGL
+ */
+ EglInterface& GetEglInterface() const;
+
+ /**
+ * @copydoc Dali::Integration::GlAbstraction& GetGlesInterface()
+ */
+ GlImplementation& GetGlesInterface();
+
+ /**
+ * Gets the implementation of GlSyncAbstraction for EGL.
+ * @return The implementation of GlSyncAbstraction for EGL.
+ */
+ EglSyncImplementation& GetSyncImplementation();
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::GraphicsInterface::GetDepthBufferRequired()
+ */
+ Integration::DepthBufferAvailable& GetDepthBufferRequired();
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::GraphicsInterface::GetStencilBufferRequired()
+ */
+ Integration::StencilBufferAvailable GetStencilBufferRequired();
+
+ /**
+ * Gets the EGL image extension
+ * @return The EGL image extension
+ */
+ EglImageExtensions* GetImageExtensions();
+
+ /**
+ * @copydoc Dali::Internal::Adaptor::GraphicsInterface::Destroy()
+ */
+ void Destroy() override;
+
+private:
+ // Eliminate copy and assigned operations
+ EglGraphics(const EglGraphics& rhs) = delete;
+ EglGraphics& operator=(const EglGraphics& rhs) = delete;
+
+
+private:
+ std::unique_ptr< GlImplementation > mGLES; ///< GL implementation
+ std::unique_ptr< EglImplementation > mEglImplementation; ///< EGL implementation
+ std::unique_ptr< EglImageExtensions > mEglImageExtensions; ///< EGL image extension
+ std::unique_ptr< EglSyncImplementation > mEglSync; ///< GlSyncAbstraction implementation for EGL
+
+ int mMultiSamplingLevel; ///< The multiple sampling level
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H__
--- /dev/null
+/*
+ * Copyright (c) 2018 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/internal/graphics/gles/egl-implementation.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
+#include <dali/public-api/common/dali-vector.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
+#include <dali/internal/graphics/gles/gl-implementation.h>
+#include <dali/internal/graphics/gles/egl-debug.h>
+
+// EGL constants use C style casts
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wold-style-cast"
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+#define TEST_EGL_ERROR(lastCommand) \
+{ \
+ EGLint err = eglGetError(); \
+ if (err != EGL_SUCCESS) \
+ { \
+ DALI_LOG_ERROR("EGL error after %s\n", lastCommand); \
+ Egl::PrintError(err); \
+ DALI_ASSERT_ALWAYS(0 && "EGL error"); \
+ } \
+}
+
+EglImplementation::EglImplementation( int multiSamplingLevel,
+ Integration::DepthBufferAvailable depthBufferRequired,
+ Integration::StencilBufferAvailable stencilBufferRequired )
+: mContextAttribs(),
+ mEglNativeDisplay( 0 ),
+ mEglNativeWindow( 0 ),
+ mCurrentEglNativePixmap( 0 ),
+ mEglDisplay( 0 ),
+ mEglConfig( 0 ),
+ mEglContext( 0 ),
+ mCurrentEglSurface( 0 ),
+ mMultiSamplingLevel( multiSamplingLevel ),
+ mColorDepth( COLOR_DEPTH_24 ),
+ mGlesInitialized( false ),
+ mIsOwnSurface( true ),
+ mContextCurrent( false ),
+ mIsWindow( true ),
+ mDepthBufferRequired( depthBufferRequired == Integration::DepthBufferAvailable::TRUE ),
+ mStencilBufferRequired( stencilBufferRequired == Integration::StencilBufferAvailable::TRUE )
+{
+}
+
+EglImplementation::~EglImplementation()
+{
+ TerminateGles();
+}
+
+bool EglImplementation::InitializeGles( EGLNativeDisplayType display, bool isOwnSurface )
+{
+ if ( !mGlesInitialized )
+ {
+ mEglNativeDisplay = display;
+
+ //@todo see if we can just EGL_DEFAULT_DISPLAY instead
+ mEglDisplay = eglGetDisplay(mEglNativeDisplay);
+ EGLint error = eglGetError();
+
+ if( mEglDisplay == NULL && error != EGL_SUCCESS )
+ {
+ throw Dali::DaliException( "", "OpenGL ES is not supported");
+ }
+
+ EGLint majorVersion = 0;
+ EGLint minorVersion = 0;
+ if ( !eglInitialize( mEglDisplay, &majorVersion, &minorVersion ) )
+ {
+ return false;
+ }
+ eglBindAPI(EGL_OPENGL_ES_API);
+
+ mContextAttribs.Clear();
+
+#if DALI_GLES_VERSION >= 30
+
+ mContextAttribs.Reserve(5);
+ mContextAttribs.PushBack( EGL_CONTEXT_MAJOR_VERSION_KHR );
+ mContextAttribs.PushBack( DALI_GLES_VERSION / 10 );
+ mContextAttribs.PushBack( EGL_CONTEXT_MINOR_VERSION_KHR );
+ mContextAttribs.PushBack( DALI_GLES_VERSION % 10 );
+
+#else // DALI_GLES_VERSION >= 30
+
+ mContextAttribs.Reserve(3);
+ mContextAttribs.PushBack( EGL_CONTEXT_CLIENT_VERSION );
+ mContextAttribs.PushBack( 2 );
+
+#endif // DALI_GLES_VERSION >= 30
+
+ mContextAttribs.PushBack( EGL_NONE );
+
+ mGlesInitialized = true;
+ mIsOwnSurface = isOwnSurface;
+ }
+
+ return mGlesInitialized;
+}
+
+bool EglImplementation::CreateContext()
+{
+ // make sure a context isn't created twice
+ DALI_ASSERT_ALWAYS( (mEglContext == 0) && "EGL context recreated" );
+
+ mEglContext = eglCreateContext(mEglDisplay, mEglConfig, NULL, &(mContextAttribs[0]));
+ TEST_EGL_ERROR("eglCreateContext render thread");
+
+ DALI_ASSERT_ALWAYS( EGL_NO_CONTEXT != mEglContext && "EGL context not created" );
+
+ DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_VENDOR : %s ***\n", glGetString(GL_VENDOR));
+ DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_RENDERER : %s ***\n", glGetString(GL_RENDERER));
+ DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_VERSION : %s ***\n", glGetString(GL_VERSION));
+ DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_SHADING_LANGUAGE_VERSION : %s***\n", glGetString(GL_SHADING_LANGUAGE_VERSION));
+ DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** Supported Extensions ***\n%s\n\n", glGetString(GL_EXTENSIONS));
+
+ return true;
+}
+
+void EglImplementation::DestroyContext()
+{
+ DALI_ASSERT_ALWAYS( mEglContext && "no EGL context" );
+
+ eglDestroyContext( mEglDisplay, mEglContext );
+ mEglContext = 0;
+}
+
+void EglImplementation::DestroySurface()
+{
+ if(mIsOwnSurface && mCurrentEglSurface)
+ {
+ // Make context null to prevent crash in driver side
+ MakeContextNull();
+ eglDestroySurface( mEglDisplay, mCurrentEglSurface );
+ mCurrentEglSurface = 0;
+ }
+}
+
+void EglImplementation::MakeContextCurrent()
+{
+ mContextCurrent = true;
+
+ if(mIsOwnSurface)
+ {
+ eglMakeCurrent( mEglDisplay, mCurrentEglSurface, mCurrentEglSurface, mEglContext );
+ }
+
+ EGLint error = eglGetError();
+
+ if ( error != EGL_SUCCESS )
+ {
+ Egl::PrintError(error);
+
+ DALI_ASSERT_ALWAYS(false && "MakeContextCurrent failed!");
+ }
+
+ // We want to display this information all the time, so use the LogMessage directly
+ Integration::Log::LogMessage(Integration::Log::DebugInfo, "EGL Information\n"
+ " Vendor: %s\n"
+ " Version: %s\n"
+ " Client APIs: %s\n"
+ " Extensions: %s\n",
+ eglQueryString(mEglDisplay, EGL_VENDOR),
+ eglQueryString(mEglDisplay, EGL_VERSION),
+ eglQueryString(mEglDisplay, EGL_CLIENT_APIS),
+ eglQueryString(mEglDisplay, EGL_EXTENSIONS));
+}
+
+void EglImplementation::MakeCurrent( EGLNativePixmapType pixmap, EGLSurface eglSurface )
+{
+ mCurrentEglNativePixmap = pixmap;
+ mCurrentEglSurface = eglSurface;
+
+ if(mIsOwnSurface)
+ {
+ eglMakeCurrent( mEglDisplay, mCurrentEglSurface, mCurrentEglSurface, mEglContext );
+ }
+
+ EGLint error = eglGetError();
+
+ if ( error != EGL_SUCCESS )
+ {
+ Egl::PrintError(error);
+
+ DALI_ASSERT_ALWAYS(false && "MakeCurrent failed!");
+ }
+}
+
+void EglImplementation::MakeContextNull()
+{
+ mContextCurrent = false;
+ // clear the current context
+ eglMakeCurrent( mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
+}
+
+void EglImplementation::TerminateGles()
+{
+ if ( mGlesInitialized )
+ {
+ // Make context null to prevent crash in driver side
+ MakeContextNull();
+
+ if(mIsOwnSurface && mCurrentEglSurface)
+ {
+ eglDestroySurface(mEglDisplay, mCurrentEglSurface);
+ }
+ eglDestroyContext(mEglDisplay, mEglContext);
+
+ eglTerminate(mEglDisplay);
+
+ mEglDisplay = NULL;
+ mEglConfig = NULL;
+ mEglContext = NULL;
+ mCurrentEglSurface = NULL;
+
+ mGlesInitialized = false;
+ }
+}
+
+bool EglImplementation::IsGlesInitialized() const
+{
+ return mGlesInitialized;
+}
+
+void EglImplementation::SwapBuffers()
+{
+ eglSwapBuffers( mEglDisplay, mCurrentEglSurface );
+}
+
+void EglImplementation::CopyBuffers()
+{
+ eglCopyBuffers( mEglDisplay, mCurrentEglSurface, mCurrentEglNativePixmap );
+}
+
+void EglImplementation::WaitGL()
+{
+ eglWaitGL();
+}
+
+void EglImplementation::ChooseConfig( bool isWindowType, ColorDepth depth )
+{
+ if(mEglConfig && isWindowType == mIsWindow && mColorDepth == depth)
+ {
+ return;
+ }
+
+ mIsWindow = isWindowType;
+
+ EGLint numConfigs;
+ Vector<EGLint> configAttribs;
+ configAttribs.Reserve(31);
+
+ if(isWindowType)
+ {
+ configAttribs.PushBack( EGL_SURFACE_TYPE );
+ configAttribs.PushBack( EGL_WINDOW_BIT );
+ }
+ else
+ {
+ configAttribs.PushBack( EGL_SURFACE_TYPE );
+ configAttribs.PushBack( EGL_PIXMAP_BIT );
+ }
+
+ configAttribs.PushBack( EGL_RENDERABLE_TYPE );
+
+#if DALI_GLES_VERSION >= 30
+
+#ifdef _ARCH_ARM_
+ configAttribs.PushBack( EGL_OPENGL_ES3_BIT_KHR );
+#else
+ // There is a bug in the desktop emulator
+ // Requesting for ES3 causes eglCreateContext even though it allows to ask
+ // for a configuration that supports GLES 3.0
+ configAttribs.PushBack( EGL_OPENGL_ES2_BIT );
+#endif // _ARCH_ARM_
+
+#else // DALI_GLES_VERSION >= 30
+
+ Integration::Log::LogMessage( Integration::Log::DebugInfo, "Using OpenGL ES 2 \n" );
+ configAttribs.PushBack( EGL_OPENGL_ES2_BIT );
+
+#endif //DALI_GLES_VERSION >= 30
+
+#if DALI_GLES_VERSION >= 30
+// TODO: enable this flag when it becomes supported
+// configAttribs.PushBack( EGL_CONTEXT_FLAGS_KHR );
+// configAttribs.PushBack( EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR );
+#endif //DALI_GLES_VERSION >= 30
+
+ configAttribs.PushBack( EGL_RED_SIZE );
+ configAttribs.PushBack( 8 );
+ configAttribs.PushBack( EGL_GREEN_SIZE );
+ configAttribs.PushBack( 8 );
+ configAttribs.PushBack( EGL_BLUE_SIZE );
+ configAttribs.PushBack( 8 );
+
+ configAttribs.PushBack( EGL_ALPHA_SIZE );
+#ifdef _ARCH_ARM_
+ // For underlay video playback, we also need to set the alpha value of the 24/32bit window.
+ configAttribs.PushBack( 8 );
+#else
+ // There is a bug in the desktop emulator
+ // setting EGL_ALPHA_SIZE to 8 results in eglChooseConfig failing
+ configAttribs.PushBack( 0 );
+#endif // _ARCH_ARM_
+
+ configAttribs.PushBack( EGL_DEPTH_SIZE );
+ configAttribs.PushBack( mDepthBufferRequired ? 24 : 0 );
+ configAttribs.PushBack( EGL_STENCIL_SIZE );
+ configAttribs.PushBack( mStencilBufferRequired ? 8 : 0 );
+
+#ifndef DALI_PROFILE_UBUNTU
+ if( mMultiSamplingLevel != EGL_DONT_CARE )
+ {
+ configAttribs.PushBack( EGL_SAMPLES );
+ configAttribs.PushBack( mMultiSamplingLevel );
+ configAttribs.PushBack( EGL_SAMPLE_BUFFERS );
+ configAttribs.PushBack( 1 );
+ }
+#endif // DALI_PROFILE_UBUNTU
+ configAttribs.PushBack( EGL_NONE );
+
+ if ( eglChooseConfig( mEglDisplay, &(configAttribs[0]), &mEglConfig, 1, &numConfigs ) != EGL_TRUE )
+ {
+ EGLint error = eglGetError();
+ switch (error)
+ {
+ case EGL_BAD_DISPLAY:
+ {
+ DALI_LOG_ERROR("Display is not an EGL display connection\n");
+ break;
+ }
+ case EGL_BAD_ATTRIBUTE:
+ {
+ DALI_LOG_ERROR("The parameter configAttribs contains an invalid frame buffer configuration attribute or an attribute value that is unrecognized or out of range\n");
+ break;
+ }
+ case EGL_NOT_INITIALIZED:
+ {
+ DALI_LOG_ERROR("Display has not been initialized\n");
+ break;
+ }
+ case EGL_BAD_PARAMETER:
+ {
+ DALI_LOG_ERROR("The parameter numConfig is NULL\n");
+ break;
+ }
+ default:
+ {
+ DALI_LOG_ERROR("Unknown error.\n");
+ }
+ }
+ DALI_ASSERT_ALWAYS(false && "eglChooseConfig failed!");
+ }
+
+ if ( numConfigs != 1 )
+ {
+ DALI_LOG_ERROR("No configurations found.\n");
+
+ TEST_EGL_ERROR("eglChooseConfig");
+ }
+}
+
+void EglImplementation::CreateSurfaceWindow( EGLNativeWindowType window, ColorDepth depth )
+{
+ DALI_ASSERT_ALWAYS( ( mCurrentEglSurface == 0 ) && "EGL surface already exists" );
+
+ mEglNativeWindow = window;
+ mColorDepth = depth;
+ mIsWindow = true;
+
+ // egl choose config
+ ChooseConfig(mIsWindow, mColorDepth);
+
+ mCurrentEglSurface = eglCreateWindowSurface( mEglDisplay, mEglConfig, mEglNativeWindow, NULL );
+ TEST_EGL_ERROR("eglCreateWindowSurface");
+
+ DALI_ASSERT_ALWAYS( mCurrentEglSurface && "Create window surface failed" );
+}
+
+EGLSurface EglImplementation::CreateSurfacePixmap( EGLNativePixmapType pixmap, ColorDepth depth )
+{
+ mCurrentEglNativePixmap = pixmap;
+ mColorDepth = depth;
+ mIsWindow = false;
+
+ // egl choose config
+ ChooseConfig(mIsWindow, mColorDepth);
+
+ mCurrentEglSurface = eglCreatePixmapSurface( mEglDisplay, mEglConfig, mCurrentEglNativePixmap, NULL );
+ TEST_EGL_ERROR("eglCreatePixmapSurface");
+
+ DALI_ASSERT_ALWAYS( mCurrentEglSurface && "Create pixmap surface failed" );
+
+ return mCurrentEglSurface;
+}
+
+bool EglImplementation::ReplaceSurfaceWindow( EGLNativeWindowType window )
+{
+ bool contextLost = false;
+
+ // display connection has not changed, then we can just create a new surface
+ // the surface is bound to the context, so set the context to null
+ MakeContextNull();
+
+ // destroy the surface
+ DestroySurface();
+
+ // create the EGL surface
+ CreateSurfaceWindow( window, mColorDepth );
+
+ // set the context to be current with the new surface
+ MakeContextCurrent();
+
+ return contextLost;
+}
+
+bool EglImplementation::ReplaceSurfacePixmap( EGLNativePixmapType pixmap, EGLSurface& eglSurface )
+{
+ bool contextLost = false;
+
+ // display connection has not changed, then we can just create a new surface
+ // create the EGL surface
+ eglSurface = CreateSurfacePixmap( pixmap, mColorDepth );
+
+ // set the eglSurface to be current
+ MakeCurrent( pixmap, eglSurface );
+
+ return contextLost;
+}
+
+EGLDisplay EglImplementation::GetDisplay() const
+{
+ return mEglDisplay;
+}
+
+EGLDisplay EglImplementation::GetContext() const
+{
+ return mEglContext;
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#pragma GCC diagnostic pop
--- /dev/null
+#ifndef DALI_INTERNAL_EGL_IMPLEMENTATION_H
+#define DALI_INTERNAL_EGL_IMPLEMENTATION_H
+
+/*
+ * Copyright (c) 2017 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 <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <dali/public-api/common/dali-vector.h>
+#include <dali/integration-api/core-enumerations.h>
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/egl-interface.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+namespace Adaptor
+{
+
+/**
+ * EglImplementation class provides an EGL implementation.
+ */
+class EglImplementation : public EglInterface
+{
+public:
+
+ /**
+ * Constructor
+ * @param[in] multiSamplingLevel The Multi-sampling level required
+ * @param[in] depthBufferRequired Whether the depth buffer is required
+ * @param[in] stencilBufferRequired Whether the stencil buffer is required
+ */
+ EglImplementation( int multiSamplingLevel,
+ Integration::DepthBufferAvailable depthBufferRequired,
+ Integration::StencilBufferAvailable stencilBufferRequired );
+
+ /**
+ * Destructor
+ */
+ virtual ~EglImplementation();
+
+public:
+
+ /**
+ * (Called from ECoreX::RenderSurface, not RenderThread, so not in i/f, hence, not virtual)
+ * Initialize GL
+ * @param display The display
+ * @param isOwnSurface whether the surface is own or not
+ * @return true on success, false on failure
+ */
+ bool InitializeGles( EGLNativeDisplayType display, bool isOwnSurface = true );
+
+ /**
+ * Create the OpenGL context.
+ * @return true if successful
+ */
+ virtual bool CreateContext();
+
+ /**
+ * Destroy the OpenGL context.
+ */
+ void DestroyContext();
+
+ /**
+ * Destroy the OpenGL surface.
+ */
+ void DestroySurface();
+
+ /**
+ * Make the OpenGL context current
+ */
+ virtual void MakeContextCurrent();
+
+ /**
+ * clear the OpenGL context
+ */
+ void MakeContextNull();
+
+ /**
+ * @brief Make the OpenGL surface current
+ *
+ * @param pixmap The pixmap to replace the current surface
+ * @param eglSurface The eglSurface to replace the current OpenGL surface.
+ */
+ void MakeCurrent( EGLNativePixmapType pixmap, EGLSurface eglSurface );
+
+ /**
+ * Terminate GL
+ */
+ virtual void TerminateGles();
+
+ /**
+ * Checks if GL is initialised
+ * @return true if it is
+ */
+ bool IsGlesInitialized() const;
+
+ /**
+ * Performs an OpenGL swap buffers command
+ */
+ virtual void SwapBuffers();
+
+ /**
+ * Performs an OpenGL copy buffers command
+ */
+ virtual void CopyBuffers();
+
+ /**
+ * Performs an EGL wait GL command
+ */
+ virtual void WaitGL();
+
+ /**
+ * Choose config of egl
+ * @param isWindowType whether the config for window or pixmap
+ * @param colorDepth Bit per pixel value (ex. 32 or 24)
+ */
+ void ChooseConfig( bool isWindowType, ColorDepth depth );
+
+ /**
+ * Create an OpenGL surface using a window
+ * @param window The window to create the surface on
+ * @param colorDepth Bit per pixel value (ex. 32 or 24)
+ * @return true on success, false on failure
+ */
+ void CreateSurfaceWindow( EGLNativeWindowType window, ColorDepth depth );
+
+ /**
+ * Create the OpenGL surface using a pixmap
+ * @param pixmap The pixmap to create the surface on
+ * @param colorDepth Bit per pixel value (ex. 32 or 24)
+ * @return Handle to an off-screen EGL pixmap surface (the requester has an ownership of this egl surface)
+ */
+ EGLSurface CreateSurfacePixmap( EGLNativePixmapType pixmap, ColorDepth depth );
+
+ /**
+ * Replaces the render surface
+ * @param[in] window, the window to create the new surface on
+ * @return true if the context was lost due to a change in display
+ * between old surface and new surface
+ */
+ bool ReplaceSurfaceWindow( EGLNativeWindowType window );
+
+ /**
+ * Replaces the render surface
+ * @param[in] pixmap, the pixmap to replace the new surface on
+ * @param[out] eglSurface, the eglSurface is created using a pixmap.
+ * @return true if the context was lost due to a change in x-display
+ * between old surface and new surface
+ */
+ bool ReplaceSurfacePixmap( EGLNativePixmapType pixmap, EGLSurface& eglSurface );
+
+ /**
+ * returns the display with which this object was initialized
+ * @return the EGL Display.
+ */
+ EGLDisplay GetDisplay() const;
+
+ /**
+ * Returns the EGL context
+ * @return the EGL context.
+ */
+ EGLContext GetContext() const;
+
+private:
+
+ Vector<EGLint> mContextAttribs;
+
+ EGLNativeDisplayType mEglNativeDisplay;
+
+ EGLNativeWindowType mEglNativeWindow;
+
+ EGLNativePixmapType mCurrentEglNativePixmap;
+
+ EGLDisplay mEglDisplay;
+ EGLConfig mEglConfig;
+ EGLContext mEglContext;
+ EGLSurface mCurrentEglSurface;
+
+ int mMultiSamplingLevel;
+
+ ColorDepth mColorDepth;
+
+ bool mGlesInitialized;
+ bool mIsOwnSurface;
+ bool mContextCurrent;
+ bool mIsWindow;
+ bool mDepthBufferRequired;
+ bool mStencilBufferRequired;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_EGL_IMPLEMENTATION_H
--- /dev/null
+/*
+ * Copyright (c) 2017 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/internal/graphics/gles/egl-sync-implementation.h>
+
+// EXTERNAL INCLUDES
+
+#ifdef _ARCH_ARM_
+
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include <EGL/eglext.h>
+
+#endif
+
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/gles/egl-implementation.h>
+
+#ifdef _ARCH_ARM_
+
+// function pointers
+static PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR = NULL;
+static PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR = NULL;
+static PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR = NULL;
+
+#endif
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+#ifdef _ARCH_ARM_
+
+EglSyncObject::EglSyncObject( EglImplementation& eglSyncImpl )
+: mEglSync(NULL),
+ mEglImplementation(eglSyncImpl)
+{
+ EGLDisplay display = mEglImplementation.GetDisplay();
+ mEglSync = eglCreateSyncKHR( display, EGL_SYNC_FENCE_KHR, NULL );
+ if (mEglSync == EGL_NO_SYNC_KHR)
+ {
+ DALI_LOG_ERROR("eglCreateSyncKHR failed %#0.4x\n", eglGetError());
+ mEglSync = NULL;
+ }
+}
+
+EglSyncObject::~EglSyncObject()
+{
+ if( mEglSync != NULL )
+ {
+ eglDestroySyncKHR( mEglImplementation.GetDisplay(), mEglSync );
+ EGLint error = eglGetError();
+ if( EGL_SUCCESS != error )
+ {
+ DALI_LOG_ERROR("eglDestroySyncKHR failed %#0.4x\n", error);
+ }
+ }
+}
+
+bool EglSyncObject::IsSynced()
+{
+ bool synced = false;
+
+ if( mEglSync != NULL )
+ {
+ EGLint result = eglClientWaitSyncKHR( mEglImplementation.GetDisplay(), mEglSync, 0, 0ull );
+ EGLint error = eglGetError();
+ if( EGL_SUCCESS != error )
+ {
+ DALI_LOG_ERROR("eglClientWaitSyncKHR failed %#0.4x\n", error);
+ }
+ else if( result == EGL_CONDITION_SATISFIED_KHR )
+ {
+ synced = true;
+ }
+ }
+
+ return synced;
+}
+
+EglSyncImplementation::EglSyncImplementation()
+: mEglImplementation( NULL ),
+ mSyncInitialized( false ),
+ mSyncInitializeFailed( false )
+{
+}
+
+EglSyncImplementation::~EglSyncImplementation()
+{
+}
+
+void EglSyncImplementation::Initialize( EglImplementation* eglImpl )
+{
+ mEglImplementation = eglImpl;
+}
+
+Integration::GlSyncAbstraction::SyncObject* EglSyncImplementation::CreateSyncObject()
+{
+ DALI_ASSERT_ALWAYS( mEglImplementation && "Sync Implementation not initialized" );
+ if( mSyncInitialized == false )
+ {
+ InitializeEglSync();
+ }
+
+ EglSyncObject* syncObject = new EglSyncObject(*mEglImplementation);
+ mSyncObjects.PushBack( syncObject );
+ return syncObject;
+}
+
+void EglSyncImplementation::DestroySyncObject( Integration::GlSyncAbstraction::SyncObject* syncObject )
+{
+ DALI_ASSERT_ALWAYS( mEglImplementation && "Sync Implementation not initialized" );
+
+ if( mSyncInitialized == false )
+ {
+ InitializeEglSync();
+ }
+
+ for( SyncIter iter=mSyncObjects.Begin(), end=mSyncObjects.End(); iter != end; ++iter )
+ {
+ if( *iter == syncObject )
+ {
+ mSyncObjects.Erase(iter);
+ break;
+ }
+ }
+ EglSyncObject* eglSyncObject = static_cast<EglSyncObject*>(syncObject);
+ delete eglSyncObject;
+}
+
+void EglSyncImplementation::InitializeEglSync()
+{
+ if( ! mSyncInitializeFailed )
+ {
+ eglCreateSyncKHR = reinterpret_cast< PFNEGLCREATESYNCKHRPROC >( eglGetProcAddress("eglCreateSyncKHR") );
+ eglClientWaitSyncKHR = reinterpret_cast< PFNEGLCLIENTWAITSYNCKHRPROC >( eglGetProcAddress("eglClientWaitSyncKHR") );
+ eglDestroySyncKHR = reinterpret_cast< PFNEGLDESTROYSYNCKHRPROC >( eglGetProcAddress("eglDestroySyncKHR") );
+ }
+
+ if( eglCreateSyncKHR && eglClientWaitSyncKHR && eglDestroySyncKHR )
+ {
+ mSyncInitialized = true;
+ }
+ else
+ {
+ mSyncInitializeFailed = true;
+ }
+}
+
+#else
+
+EglSyncObject::EglSyncObject( EglImplementation& eglImpl )
+: mPollCounter(3),
+ mEglImplementation(eglImpl)
+{
+}
+
+EglSyncObject::~EglSyncObject()
+{
+}
+
+bool EglSyncObject::IsSynced()
+{
+ if(mPollCounter <= 0)
+ {
+ return true;
+ }
+ --mPollCounter;
+ return false;
+}
+
+EglSyncImplementation::EglSyncImplementation()
+: mEglImplementation( NULL ),
+ mSyncInitialized( false ),
+ mSyncInitializeFailed( false )
+{
+}
+
+EglSyncImplementation::~EglSyncImplementation()
+{
+}
+
+void EglSyncImplementation::Initialize( EglImplementation* eglImpl )
+{
+ mEglImplementation = eglImpl;
+}
+
+Integration::GlSyncAbstraction::SyncObject* EglSyncImplementation::CreateSyncObject()
+{
+ DALI_ASSERT_ALWAYS( mEglImplementation && "Sync Implementation not initialized" );
+ return new EglSyncObject(*mEglImplementation);
+}
+
+void EglSyncImplementation::DestroySyncObject(Integration::GlSyncAbstraction::SyncObject* syncObject)
+{
+ DALI_ASSERT_ALWAYS( mEglImplementation && "Sync Implementation not initialized" );
+
+ // The abstraction's virtual destructor is protected, so that Core can't delete the sync objects
+ // directly (This object also needs removing from the mSyncObject container in the ARM
+ // implementation above). We therefore need to cast to the actual implementation object first.
+ EglSyncObject* eglSyncObject = static_cast<EglSyncObject*>(syncObject);
+ delete eglSyncObject;
+}
+
+void EglSyncImplementation::InitializeEglSync()
+{
+}
+
+#endif
+
+} // namespace Dali
+} // namespace Internal
+} // namespace Adaptor
--- /dev/null
+#ifndef __DALI_INTERNAL_ADAPTOR_EGL_SYNC_IMPLEMENTATION_H__
+#define __DALI_INTERNAL_ADAPTOR_EGL_SYNC_IMPLEMENTATION_H__
+
+/*
+ * Copyright (c) 2018 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 <EGL/egl.h>
+#include <EGL/eglext.h>
+#include <dali/public-api/common/dali-vector.h>
+#include <dali/integration-api/gl-sync-abstraction.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/dali-adaptor-common.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class EglImplementation;
+
+class EglSyncObject : public Integration::GlSyncAbstraction::SyncObject
+{
+public:
+ /**
+ * Constructor
+ */
+ EglSyncObject( EglImplementation& eglSyncImpl );
+
+ /**
+ * Destructor
+ */
+ virtual ~EglSyncObject();
+
+ /**
+ * @copydoc Dali::Integration::GlSyncAbstraction::SyncObject::IsSynced()
+ */
+ virtual bool IsSynced();
+
+private:
+#ifdef _ARCH_ARM_
+ EGLSyncKHR mEglSync;
+#else
+ int mPollCounter; // Implementations without fence sync use a 3 frame counter
+#endif
+ EglImplementation& mEglImplementation;
+};
+
+
+/**
+ * GlSyncImplementation is a concrete implementation for GlSyncAbstraction.
+ * It provides fence syncing for resources such as FrameBuffers using EGL extensions
+ *
+ * Sync objects are created in the render thread after a render instruction
+ * has been processed (i.e. GL draw calls have completed for a given FB), and
+ * tested in the update
+ */
+class EglSyncImplementation : public Integration::GlSyncAbstraction
+{
+public:
+ /**
+ * Constructor
+ */
+ EglSyncImplementation();
+
+ /**
+ * Destructor
+ */
+ virtual ~EglSyncImplementation();
+
+ /**
+ * Initialize the sync object with the Egl implementation.
+ * @param[in] impl The EGL implementation (to access display)
+ */
+ void Initialize( EglImplementation* impl );
+
+ /**
+ * @copydoc Dali::Integration::GlSyncAbstraction::CreateSyncObject()
+ */
+ virtual SyncObject* CreateSyncObject();
+
+ /**
+ * @copydoc Dali::Integration::GlSyncAbstraction::DestroySyncObject()
+ */
+ virtual void DestroySyncObject(SyncObject* syncObject);
+
+private:
+ /**
+ * Set up the function pointers
+ */
+ void InitializeEglSync();
+
+private:
+ typedef Vector<EglSyncObject*> SyncContainer;
+ typedef SyncContainer::Iterator SyncIter;
+
+ EglImplementation* mEglImplementation; ///< Egl implementation (to get display)
+ bool mSyncInitialized; ///< Flag to perform initialization on first use
+ bool mSyncInitializeFailed; ///< Flag to avoid reloading functions if failed once
+
+ SyncContainer mSyncObjects;
+};
+
+} // namespace Adaptor
+} // namespace Internal
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_EGL_ADAPTOR_SYNC_IMPLEMENTATION_H__
--- /dev/null
+/*
+ * Copyright (c) 2017 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/internal/graphics/gles/gl-extensions.h>
+
+// EXTERNAL INCLUDES
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
+#include <dali/integration-api/debug.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace ECoreX
+{
+
+GlExtensions::GlExtensions()
+:
+#if DALI_GLES_VERSION < 30
+#ifdef GL_EXT_discard_framebuffer
+ mGlDiscardFramebuffer( NULL ),
+#endif
+#ifdef GL_OES_get_program_binary
+ mGlGetProgramBinaryOES( NULL ),
+ mGlProgramBinaryOES( NULL ),
+#endif
+#endif // DALI_GLES_VERSION < 30
+ mInitialized( false )
+{
+}
+
+GlExtensions::~GlExtensions()
+{
+}
+
+#if DALI_GLES_VERSION < 30
+
+void GlExtensions::DiscardFrameBuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
+{
+ // initialize extension on first use as on some hw platforms a context
+ // has to be bound for the extensions to return correct pointer
+ if( !mInitialized )
+ {
+ Initialize();
+ }
+
+#ifdef GL_EXT_discard_framebuffer
+ if( mGlDiscardFramebuffer )
+ {
+ mGlDiscardFramebuffer(target, numAttachments, attachments);
+ }
+ else
+ {
+ DALI_LOG_ERROR("Error: glDiscardFramebufferEXT extension is not available\n");
+ }
+#endif
+}
+
+void GlExtensions::GetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary)
+{
+ // initialize extension on first use as on some hw platforms a context
+ // has to be bound for the extensions to return correct pointer
+ if( !mInitialized )
+ {
+ Initialize();
+ }
+
+#ifdef GL_OES_get_program_binary
+ if (mGlGetProgramBinaryOES)
+ {
+ mGlGetProgramBinaryOES(program, bufSize, length, binaryFormat, binary);
+ }
+ else
+ {
+ DALI_LOG_ERROR("Error: glGetProgramBinaryOES extension is not available\n");
+ DALI_ASSERT_DEBUG(0);
+ }
+#endif
+}
+
+void GlExtensions::ProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length)
+{
+ // initialize extension on first use as on some hw platforms a context
+ // has to be bound for the extensions to return correct pointer
+ if( !mInitialized )
+ {
+ Initialize();
+ }
+
+#ifdef GL_OES_get_program_binary
+ if (mGlProgramBinaryOES)
+ {
+ mGlProgramBinaryOES(program, binaryFormat, binary, length);
+ }
+ else
+ {
+ DALI_LOG_ERROR("Error: glProgramBinaryOES extension is not available\n");
+ DALI_ASSERT_DEBUG(0);
+ }
+#endif
+}
+
+void GlExtensions::Initialize()
+{
+ mInitialized = true;
+
+#ifdef GL_EXT_discard_framebuffer
+ mGlDiscardFramebuffer = reinterpret_cast< PFNGLDISCARDFRAMEBUFFEREXTPROC >( eglGetProcAddress("glDiscardFramebufferEXT") );
+#endif
+
+#ifdef GL_OES_get_program_binary
+ mGlGetProgramBinaryOES = reinterpret_cast< PFNGLGETPROGRAMBINARYOESPROC >( eglGetProcAddress("glGetProgramBinaryOES") );
+ mGlProgramBinaryOES = reinterpret_cast< PFNGLPROGRAMBINARYOESPROC >( eglGetProcAddress("glProgramBinaryOES") );
+#endif
+}
+
+#endif // DALI_GLES_VERSION < 30
+
+} // namespace ECoreX
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_INTERNAL_GL_EXTENSION_H__
+#define __DALI_INTERNAL_GL_EXTENSION_H__
+
+/*
+ * Copyright (c) 2014 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
+
+#if DALI_GLES_VERSION >= 30
+#include <GLES3/gl3.h>
+#else
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#endif
+
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace ECoreX
+{
+
+/**
+ * GlExtensions class provides GL extensions support
+ */
+class GlExtensions
+{
+public:
+
+ /**
+ * Constructor
+ */
+ GlExtensions();
+
+ /**
+ * Destructor
+ */
+ ~GlExtensions();
+
+
+public:
+
+#if DALI_GLES_VERSION < 30
+
+ /**
+ * If the GL extension is available this function discards specified data in attachments
+ * from being copied from the target to improve performance.
+ *
+ * Usage: GLenum attachments[] = { GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT };
+ * DiscardFrameBufferEXT(GL_FRAMEBUFFER, 2, attachments);
+ *
+ * @param target is usually GL_FRAMEBUFFER
+ * @param numAttachments is the count of attachments
+ * @param attachments is a pointer to the attachments
+ */
+ void DiscardFrameBuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);
+
+ /**
+ * GLES extension
+ * Returns the program object's executable bytecode.
+ * @param[in] program The program object's name/id
+ * @param[in] bufSize The maximum number of bytes that may be written into binary
+ * @param[out] length The actual number of bytes written into binary
+ * @param[out] binaryFormat The format of the program binary
+ * @param[out] binary The actual program bytecode
+ */
+ void GetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
+
+ /**
+ * GLES extension
+ * Loads a program object with a program binary previously returned from GetProgramBinaryOES
+ * @param[in] program The program object's name/id
+ * @param[in] binaryFormat The format of the program binary
+ * @param[in] binary The program bytecode
+ * @param[in] length The number of bytes in binary
+ */
+ void ProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
+
+#endif // DALI_GLES_VERSION < 30
+
+private:
+
+ /**
+ * Lazy Initialize extensions on first use
+ */
+ void Initialize();
+
+#if DALI_GLES_VERSION < 30
+
+#ifdef GL_EXT_discard_framebuffer
+ PFNGLDISCARDFRAMEBUFFEREXTPROC mGlDiscardFramebuffer;
+#endif
+
+#ifdef GL_OES_get_program_binary
+ PFNGLGETPROGRAMBINARYOESPROC mGlGetProgramBinaryOES;
+ PFNGLPROGRAMBINARYOESPROC mGlProgramBinaryOES;
+#endif
+
+#endif // DALI_GLES_VERSION < 30
+
+ bool mInitialized;
+
+};
+
+} // namespace ECoreX
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif /* __DALI_INTERNAL_GL_EXTENSION_H__ */
--- /dev/null
+#ifndef __DALI_INTERNAL_GL_IMPLEMENTATION_H__
+#define __DALI_INTERNAL_GL_IMPLEMENTATION_H__
+
+/*
+ * Copyright (c) 2017 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
+#ifndef DALI_GLES_VERSION
+#error "OpenGL ES version not specified"
+#endif
+
+#if DALI_GLES_VERSION >= 31
+#include <GLES3/gl31.h>
+#elif DALI_GLES_VERSION >= 30
+#include <GLES3/gl3.h>
+#else
+#include <cstdlib>
+#include <GLES2/gl2.h>
+#endif
+
+#include <dali/integration-api/gl-abstraction.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/gles/gl-extensions.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * GlImplementation is a concrete implementation for GlAbstraction.
+ * The class provides an OpenGL-ES 2.0 implementation.
+ * The class is provided when creating the Integration::Core object.
+ */
+class GlImplementation: public Dali::Integration::GlAbstraction
+{
+
+public:
+ virtual ~GlImplementation() {}
+
+ void PreRender()
+ {
+ /* Do nothing in main implementation */
+ }
+
+ void PostRender()
+ {
+ /* Do nothing in main implementation */
+ }
+
+ /* OpenGL ES 2.0 */
+
+ void ActiveTexture (GLenum texture)
+ {
+ glActiveTexture(texture);
+ }
+
+ void AttachShader (GLuint program, GLuint shader)
+ {
+ glAttachShader(program,shader);
+ }
+
+ void BindAttribLocation (GLuint program, GLuint index, const char* name)
+ {
+ glBindAttribLocation(program,index,name);
+ }
+
+ void BindBuffer (GLenum target, GLuint buffer)
+ {
+ glBindBuffer(target,buffer);
+ }
+
+ void BindFramebuffer (GLenum target, GLuint framebuffer)
+ {
+ glBindFramebuffer(target,framebuffer);
+ }
+
+ void BindRenderbuffer (GLenum target, GLuint renderbuffer)
+ {
+ glBindRenderbuffer(target,renderbuffer);
+ }
+
+ void BindTexture (GLenum target, GLuint texture)
+ {
+ glBindTexture(target,texture);
+ }
+
+ void BlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+ {
+ glBlendColor(red,green,blue,alpha);
+ }
+
+ void BlendEquation ( GLenum mode )
+ {
+ glBlendEquation(mode);
+ }
+
+ void BlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha)
+ {
+ glBlendEquationSeparate(modeRGB,modeAlpha);
+ }
+
+ void BlendFunc (GLenum sfactor, GLenum dfactor)
+ {
+ glBlendFunc(sfactor,dfactor);
+ }
+
+ void BlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+ {
+ glBlendFuncSeparate(srcRGB,dstRGB,srcAlpha,dstAlpha);
+ }
+
+ void BufferData (GLenum target, GLsizeiptr size, const void* data, GLenum usage)
+ {
+ glBufferData(target,size,data,usage);
+ }
+
+ void BufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void* data)
+ {
+ glBufferSubData(target,offset,size,data);
+ }
+
+ GLenum CheckFramebufferStatus (GLenum target)
+ {
+ return glCheckFramebufferStatus(target);
+ }
+
+ void Clear (GLbitfield mask)
+ {
+ glClear(mask);
+ }
+
+ void ClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
+ {
+ glClearColor(red,green,blue,alpha);
+ }
+
+ void ClearDepthf (GLclampf depth)
+ {
+ glClearDepthf(depth);
+ }
+
+ void ClearStencil (GLint s)
+ {
+ glClearStencil(s);
+ }
+
+ void ColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
+ {
+ glColorMask(red,green,blue,alpha);
+ }
+
+ void CompileShader (GLuint shader)
+ {
+ glCompileShader(shader);
+ }
+
+ void CompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
+ {
+ glCompressedTexImage2D(target,level,internalformat,width,height,border,imageSize,data);
+ }
+
+ void CompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
+ {
+ glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imageSize,data);
+ }
+
+ void CopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
+ {
+ glCopyTexImage2D(target,level,internalformat,x,y,width,height,border);
+ }
+
+ void CopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+ {
+ glCopyTexSubImage2D(target,level,xoffset,yoffset,x,y,width,height);
+ }
+
+ GLuint CreateProgram (void)
+ {
+ return glCreateProgram();
+ }
+
+ GLuint CreateShader (GLenum type)
+ {
+ return glCreateShader(type);
+ }
+
+ void CullFace (GLenum mode)
+ {
+ glCullFace(mode);
+ }
+
+ void DeleteBuffers (GLsizei n, const GLuint* buffers)
+ {
+ glDeleteBuffers(n,buffers);
+ }
+
+ void DeleteFramebuffers (GLsizei n, const GLuint* framebuffers)
+ {
+ glDeleteFramebuffers(n,framebuffers);
+ }
+
+ void DeleteProgram (GLuint program)
+ {
+ glDeleteProgram(program);
+ }
+
+ void DeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers)
+ {
+ glDeleteRenderbuffers(n,renderbuffers);
+ }
+
+ void DeleteShader (GLuint shader)
+ {
+ glDeleteShader(shader);
+ }
+
+ void DeleteTextures (GLsizei n, const GLuint* textures)
+ {
+ glDeleteTextures(n,textures);
+ }
+
+ void DepthFunc (GLenum func)
+ {
+ glDepthFunc(func);
+ }
+
+ void DepthMask (GLboolean flag)
+ {
+ glDepthMask(flag);
+ }
+
+ void DepthRangef (GLclampf zNear, GLclampf zFar)
+ {
+ glDepthRangef(zNear,zFar);
+ }
+
+ void DetachShader (GLuint program, GLuint shader)
+ {
+ glDetachShader(program,shader);
+ }
+
+ void Disable (GLenum cap)
+ {
+ glDisable(cap);
+ }
+
+ void DisableVertexAttribArray (GLuint index)
+ {
+ glDisableVertexAttribArray(index);
+ }
+
+ void DrawArrays (GLenum mode, GLint first, GLsizei count)
+ {
+ glDrawArrays(mode,first,count);
+ }
+
+ void DrawElements (GLenum mode, GLsizei count, GLenum type, const void* indices)
+ {
+ glDrawElements(mode,count,type,indices);
+ }
+
+ void Enable (GLenum cap)
+ {
+ glEnable(cap);
+ }
+
+ void EnableVertexAttribArray (GLuint index)
+ {
+ glEnableVertexAttribArray(index);
+ }
+
+ void Finish (void)
+ {
+ glFinish();
+ }
+
+ void Flush (void)
+ {
+ glFlush();
+ }
+
+ void FramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+ {
+ glFramebufferRenderbuffer(target,attachment,renderbuffertarget,renderbuffer);
+ }
+
+ void FramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+ {
+ glFramebufferTexture2D(target,attachment,textarget,texture,level);
+ }
+
+ void FrontFace (GLenum mode)
+ {
+ glFrontFace(mode);
+ }
+
+ void GenBuffers (GLsizei n, GLuint* buffers)
+ {
+ glGenBuffers(n,buffers);
+ }
+
+ void GenerateMipmap (GLenum target)
+ {
+ glGenerateMipmap(target);
+ }
+
+ void GenFramebuffers (GLsizei n, GLuint* framebuffers)
+ {
+ glGenFramebuffers(n,framebuffers);
+ }
+
+ void GenRenderbuffers (GLsizei n, GLuint* renderbuffers)
+ {
+ glGenRenderbuffers(n,renderbuffers);
+ }
+
+ void GenTextures (GLsizei n, GLuint* textures)
+ {
+ glGenTextures(n,textures);
+ }
+
+ void GetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+ {
+ glGetActiveAttrib(program,index,bufsize,length,size,type,name);
+ }
+
+ void GetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
+ {
+ glGetActiveUniform(program,index,bufsize,length,size,type,name);
+ }
+
+ void GetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
+ {
+ glGetAttachedShaders(program,maxcount,count,shaders);
+ }
+
+ int GetAttribLocation (GLuint program, const char* name)
+ {
+ return glGetAttribLocation(program,name);
+ }
+
+ void GetBooleanv (GLenum pname, GLboolean* params)
+ {
+ glGetBooleanv(pname,params);
+ }
+
+ void GetBufferParameteriv (GLenum target, GLenum pname, GLint* params)
+ {
+ glGetBufferParameteriv(target,pname,params);
+ }
+
+ GLenum GetError (void)
+ {
+ return glGetError();
+ }
+
+ void GetFloatv (GLenum pname, GLfloat* params)
+ {
+ glGetFloatv(pname,params);
+ }
+
+ void GetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params)
+ {
+ glGetFramebufferAttachmentParameteriv(target,attachment,pname,params);
+ }
+
+ void GetIntegerv (GLenum pname, GLint* params)
+ {
+ glGetIntegerv(pname,params);
+ }
+
+ void GetProgramiv (GLuint program, GLenum pname, GLint* params)
+ {
+ glGetProgramiv(program,pname,params);
+ }
+
+ void GetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
+ {
+ glGetProgramInfoLog(program,bufsize,length,infolog);
+ }
+
+ void GetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params)
+ {
+ glGetRenderbufferParameteriv(target,pname,params);
+ }
+
+ void GetShaderiv (GLuint shader, GLenum pname, GLint* params)
+ {
+ glGetShaderiv(shader,pname,params);
+ }
+
+ void GetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
+ {
+ glGetShaderInfoLog(shader,bufsize,length,infolog);
+ }
+
+ void GetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
+ {
+ glGetShaderPrecisionFormat(shadertype,precisiontype,range,precision);
+ }
+
+ void GetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
+ {
+ glGetShaderSource(shader,bufsize,length,source);
+ }
+
+ const GLubyte* GetString (GLenum name)
+ {
+ return glGetString(name);
+ }
+
+ void GetTexParameterfv (GLenum target, GLenum pname, GLfloat* params)
+ {
+ glGetTexParameterfv(target,pname,params);
+ }
+
+ void GetTexParameteriv (GLenum target, GLenum pname, GLint* params)
+ {
+ glGetTexParameteriv(target,pname,params);
+ }
+
+ void GetUniformfv (GLuint program, GLint location, GLfloat* params)
+ {
+ glGetUniformfv(program,location,params);
+ }
+
+ void GetUniformiv (GLuint program, GLint location, GLint* params)
+ {
+ glGetUniformiv(program,location,params);
+ }
+
+ int GetUniformLocation (GLuint program, const char* name)
+ {
+ return glGetUniformLocation(program,name);
+ }
+
+ void GetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params)
+ {
+ glGetVertexAttribfv(index,pname,params);
+ }
+
+ void GetVertexAttribiv (GLuint index, GLenum pname, GLint* params)
+ {
+ glGetVertexAttribiv(index,pname,params);
+ }
+
+ void GetVertexAttribPointerv (GLuint index, GLenum pname, void** pointer)
+ {
+ glGetVertexAttribPointerv(index,pname,pointer);
+ }
+
+ void Hint (GLenum target, GLenum mode)
+ {
+ glHint(target,mode);
+ }
+
+ GLboolean IsBuffer (GLuint buffer)
+ {
+ return glIsBuffer(buffer);
+ }
+
+ GLboolean IsEnabled (GLenum cap)
+ {
+ return glIsEnabled(cap);
+ }
+
+ GLboolean IsFramebuffer (GLuint framebuffer)
+ {
+ return glIsFramebuffer(framebuffer);
+ }
+
+ GLboolean IsProgram (GLuint program)
+ {
+ return glIsProgram(program);
+ }
+
+ GLboolean IsRenderbuffer (GLuint renderbuffer)
+ {
+ return glIsRenderbuffer(renderbuffer);
+ }
+
+ GLboolean IsShader (GLuint shader)
+ {
+ return glIsShader(shader);
+ }
+
+ GLboolean IsTexture (GLuint texture)
+ {
+ return glIsTexture(texture);
+ }
+
+ void LineWidth (GLfloat width)
+ {
+ glLineWidth(width);
+ }
+
+ void LinkProgram (GLuint program)
+ {
+ glLinkProgram(program);
+ }
+
+ void PixelStorei (GLenum pname, GLint param)
+ {
+ glPixelStorei(pname,param);
+ }
+
+ void PolygonOffset (GLfloat factor, GLfloat units)
+ {
+ glPolygonOffset(factor,units);
+ }
+
+ void ReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
+ {
+ glReadPixels(x,y,width,height,format,type,pixels);
+ }
+
+ void ReleaseShaderCompiler (void)
+ {
+ glReleaseShaderCompiler();
+ }
+
+ void RenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+ {
+ glRenderbufferStorage(target,internalformat,width,height);
+ }
+
+ void SampleCoverage (GLclampf value, GLboolean invert)
+ {
+ glSampleCoverage(value,invert);
+ }
+
+ void Scissor (GLint x, GLint y, GLsizei width, GLsizei height)
+ {
+ glScissor(x,y,width,height);
+ }
+
+ void ShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
+ {
+ glShaderBinary(n,shaders,binaryformat,binary,length);
+ }
+
+ void ShaderSource (GLuint shader, GLsizei count, const char** string, const GLint* length)
+ {
+ glShaderSource(shader,count,string,length);
+ }
+
+ void StencilFunc (GLenum func, GLint ref, GLuint mask)
+ {
+ glStencilFunc(func,ref,mask);
+ }
+
+ void StencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask)
+ {
+ glStencilFuncSeparate(face,func,ref,mask);
+ }
+
+ void StencilMask (GLuint mask)
+ {
+ glStencilMask(mask);
+ }
+
+ void StencilMaskSeparate (GLenum face, GLuint mask)
+ {
+ glStencilMaskSeparate(face,mask);
+ }
+
+ void StencilOp (GLenum fail, GLenum zfail, GLenum zpass)
+ {
+ glStencilOp(fail,zfail,zpass);
+ }
+
+ void StencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
+ {
+ glStencilOpSeparate(face,fail,zfail,zpass);
+ }
+
+ void TexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
+ {
+ glTexImage2D(target,level,internalformat,width,height,border,format,type,pixels);
+ }
+
+ void TexParameterf (GLenum target, GLenum pname, GLfloat param)
+ {
+ glTexParameterf(target,pname,param);
+ }
+
+ void TexParameterfv (GLenum target, GLenum pname, const GLfloat* params)
+ {
+ glTexParameterfv(target,pname,params);
+ }
+
+ void TexParameteri (GLenum target, GLenum pname, GLint param)
+ {
+ glTexParameteri(target,pname,param);
+ }
+
+ void TexParameteriv (GLenum target, GLenum pname, const GLint* params)
+ {
+ glTexParameteriv(target,pname,params);
+ }
+
+ void TexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
+ {
+ glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixels);
+ }
+
+ void Uniform1f (GLint location, GLfloat x)
+ {
+ glUniform1f(location,x);
+ }
+
+ void Uniform1fv (GLint location, GLsizei count, const GLfloat* v)
+ {
+ glUniform1fv(location,count,v);
+ }
+
+ void Uniform1i (GLint location, GLint x)
+ {
+ glUniform1i(location,x);
+ }
+
+ void Uniform1iv (GLint location, GLsizei count, const GLint* v)
+ {
+ glUniform1iv(location,count,v);
+ }
+
+ void Uniform2f (GLint location, GLfloat x, GLfloat y)
+ {
+ glUniform2f(location,x,y);
+ }
+
+ void Uniform2fv (GLint location, GLsizei count, const GLfloat* v)
+ {
+ glUniform2fv(location,count,v);
+ }
+
+ void Uniform2i (GLint location, GLint x, GLint y)
+ {
+ glUniform2i(location,x,y);
+ }
+
+ void Uniform2iv (GLint location, GLsizei count, const GLint* v)
+ {
+ glUniform2iv(location,count,v);
+ }
+
+ void Uniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z)
+ {
+ glUniform3f(location,x,y,z);
+ }
+
+ void Uniform3fv (GLint location, GLsizei count, const GLfloat* v)
+ {
+ glUniform3fv(location,count,v);
+ }
+
+ void Uniform3i (GLint location, GLint x, GLint y, GLint z)
+ {
+ glUniform3i(location,x,y,z);
+ }
+
+ void Uniform3iv (GLint location, GLsizei count, const GLint* v)
+ {
+ glUniform3iv(location,count,v);
+ }
+
+ void Uniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+ {
+ glUniform4f(location,x,y,z,w);
+ }
+
+ void Uniform4fv (GLint location, GLsizei count, const GLfloat* v)
+ {
+ glUniform4fv(location,count,v);
+ }
+
+ void Uniform4i (GLint location, GLint x, GLint y, GLint z, GLint w)
+ {
+ glUniform4i(location,x,y,z,w);
+ }
+
+ void Uniform4iv (GLint location, GLsizei count, const GLint* v)
+ {
+ glUniform4iv(location,count,v);
+ }
+
+ void UniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+ glUniformMatrix2fv(location,count,transpose,value);
+ }
+
+ void UniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+ glUniformMatrix3fv(location,count,transpose,value);
+ }
+
+ void UniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+ glUniformMatrix4fv(location,count,transpose,value);
+ }
+
+ void UseProgram (GLuint program)
+ {
+ glUseProgram(program);
+ }
+
+ void ValidateProgram (GLuint program)
+ {
+ glValidateProgram(program);
+ }
+
+ void VertexAttrib1f (GLuint indx, GLfloat x)
+ {
+ glVertexAttrib1f(indx,x);
+ }
+
+ void VertexAttrib1fv (GLuint indx, const GLfloat* values)
+ {
+ glVertexAttrib1fv(indx,values);
+ }
+
+ void VertexAttrib2f (GLuint indx, GLfloat x, GLfloat y)
+ {
+ glVertexAttrib2f(indx,x,y);
+ }
+
+ void VertexAttrib2fv (GLuint indx, const GLfloat* values)
+ {
+ glVertexAttrib2fv(indx,values);
+ }
+
+ void VertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z)
+ {
+ glVertexAttrib3f(indx,x,y,z);
+ }
+
+ void VertexAttrib3fv (GLuint indx, const GLfloat* values)
+ {
+ glVertexAttrib3fv(indx,values);
+ }
+
+ void VertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
+ {
+ glVertexAttrib4f(indx,x,y,z,w);
+ }
+
+ void VertexAttrib4fv (GLuint indx, const GLfloat* values)
+ {
+ glVertexAttrib4fv(indx,values);
+ }
+
+ void VertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
+ {
+ glVertexAttribPointer(indx,size,type,normalized,stride,ptr);
+ }
+
+ void Viewport (GLint x, GLint y, GLsizei width, GLsizei height)
+ {
+ glViewport(x,y,width,height);
+ }
+
+ /* OpenGL ES 3.0 */
+
+ void ReadBuffer(GLenum mode)
+ {
+#if DALI_GLES_VERSION >= 30
+ glReadBuffer(mode);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices)
+ {
+#if DALI_GLES_VERSION >= 30
+ glDrawRangeElements(mode,start,end,count,type,indices);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
+ {
+#if DALI_GLES_VERSION >= 30
+ glTexImage3D(target,level,internalformat,width,height,depth,border,format,type,pixels);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
+ {
+#if DALI_GLES_VERSION >= 30
+ glTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,type,pixels);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
+ {
+#if DALI_GLES_VERSION >= 30
+ glCopyTexSubImage3D(target,level,xoffset,yoffset,zoffset,x,y,width,height);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
+ {
+#if DALI_GLES_VERSION >= 30
+ glCompressedTexImage3D(target,level,internalformat,width,height,depth,border,imageSize,data);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
+ {
+#if DALI_GLES_VERSION >= 30
+ glCompressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imageSize,data);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GenQueries(GLsizei n, GLuint* ids)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGenQueries(n,ids);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void DeleteQueries(GLsizei n, const GLuint* ids)
+ {
+#if DALI_GLES_VERSION >= 30
+ glDeleteQueries(n,ids);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ GLboolean IsQuery(GLuint id)
+ {
+#if DALI_GLES_VERSION >= 30
+ return glIsQuery(id);
+#else
+ return 0;
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void BeginQuery(GLenum target, GLuint id)
+ {
+#if DALI_GLES_VERSION >= 30
+ glBeginQuery(target,id);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void EndQuery(GLenum target)
+ {
+#if DALI_GLES_VERSION >= 30
+ glEndQuery(target);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetQueryiv(GLenum target, GLenum pname, GLint* params)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetQueryiv(target,pname,params);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetQueryObjectuiv(id,pname,params);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ GLboolean UnmapBuffer(GLenum target)
+ {
+#if DALI_GLES_VERSION >= 30
+ return glUnmapBuffer(target);
+#else
+ return 0;
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetBufferPointerv(target,pname,params);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void DrawBuffers(GLsizei n, const GLenum* bufs)
+ {
+#if DALI_GLES_VERSION >= 30
+ glDrawBuffers(n,bufs);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+#if DALI_GLES_VERSION >= 30
+ glUniformMatrix2x3fv(location,count,transpose,value);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+#if DALI_GLES_VERSION >= 30
+ glUniformMatrix3x2fv(location,count,transpose,value);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+#if DALI_GLES_VERSION >= 30
+ glUniformMatrix2x4fv(location,count,transpose,value);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+#if DALI_GLES_VERSION >= 30
+ glUniformMatrix4x2fv(location,count,transpose,value);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+#if DALI_GLES_VERSION >= 30
+ glUniformMatrix3x4fv(location,count,transpose,value);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
+ {
+#if DALI_GLES_VERSION >= 30
+ glUniformMatrix4x3fv(location,count,transpose,value);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
+ {
+#if DALI_GLES_VERSION >= 30
+ glBlitFramebuffer(srcX0,srcY0,srcX1,srcY1,dstX0,dstY0,dstX1,dstY1,mask,filter);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+ {
+#if DALI_GLES_VERSION >= 30
+ glRenderbufferStorageMultisample(target,samples,internalformat,width,height);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
+ {
+#if DALI_GLES_VERSION >= 30
+ glFramebufferTextureLayer(target,attachment,texture,level,layer);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ GLvoid* MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
+ {
+#if DALI_GLES_VERSION >= 30
+ return glMapBufferRange(target,offset,length,access);
+#else
+ return NULL;
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
+ {
+#if DALI_GLES_VERSION >= 30
+ glFlushMappedBufferRange(target,offset,length);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void BindVertexArray(GLuint array)
+ {
+#if DALI_GLES_VERSION >= 30
+ glBindVertexArray(array);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void DeleteVertexArrays(GLsizei n, const GLuint* arrays)
+ {
+#if DALI_GLES_VERSION >= 30
+ glDeleteVertexArrays(n,arrays);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GenVertexArrays(GLsizei n, GLuint* arrays)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGenVertexArrays(n,arrays);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ GLboolean IsVertexArray(GLuint array)
+ {
+#if DALI_GLES_VERSION >= 30
+ return glIsVertexArray(array);
+#else
+ return 0;
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetIntegeri_v(GLenum target, GLuint index, GLint* data)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetIntegeri_v(target,index,data);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void BeginTransformFeedback(GLenum primitiveMode)
+ {
+#if DALI_GLES_VERSION >= 30
+ glBeginTransformFeedback(primitiveMode);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void EndTransformFeedback(void)
+ {
+#if DALI_GLES_VERSION >= 30
+ glEndTransformFeedback();
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
+ {
+#if DALI_GLES_VERSION >= 30
+ glBindBufferRange(target,index,buffer,offset,size);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void BindBufferBase(GLenum target, GLuint index, GLuint buffer)
+ {
+#if DALI_GLES_VERSION >= 30
+ glBindBufferBase(target,index,buffer);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
+ {
+#if DALI_GLES_VERSION >= 30
+ glTransformFeedbackVaryings(program,count,varyings,bufferMode);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetTransformFeedbackVarying(program,index,bufSize,length,size,type,name);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
+ {
+#if DALI_GLES_VERSION >= 30
+ glVertexAttribIPointer(index,size,type,stride,pointer);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetVertexAttribIiv(index,pname,params);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetVertexAttribIuiv(index,pname,params);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
+ {
+#if DALI_GLES_VERSION >= 30
+ glVertexAttribI4i(index,x,y,z,w);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
+ {
+#if DALI_GLES_VERSION >= 30
+ glVertexAttribI4ui(index,x,y,z,w);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void VertexAttribI4iv(GLuint index, const GLint* v)
+ {
+#if DALI_GLES_VERSION >= 30
+ glVertexAttribI4iv(index,v);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void VertexAttribI4uiv(GLuint index, const GLuint* v)
+ {
+#if DALI_GLES_VERSION >= 30
+ glVertexAttribI4uiv(index,v);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetUniformuiv(GLuint program, GLint location, GLuint* params)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetUniformuiv(program,location,params);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ GLint GetFragDataLocation(GLuint program, const GLchar *name)
+ {
+#if DALI_GLES_VERSION >= 30
+ return glGetFragDataLocation(program,name);
+#else
+ return -1;
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void Uniform1ui(GLint location, GLuint v0)
+ {
+#if DALI_GLES_VERSION >= 30
+ glUniform1ui(location,v0);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void Uniform2ui(GLint location, GLuint v0, GLuint v1)
+ {
+#if DALI_GLES_VERSION >= 30
+ glUniform2ui(location,v0,v1);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
+ {
+#if DALI_GLES_VERSION >= 30
+ glUniform3ui(location,v0,v1,v2);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
+ {
+#if DALI_GLES_VERSION >= 30
+ glUniform4ui(location,v0,v1,v2,v3);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void Uniform1uiv(GLint location, GLsizei count, const GLuint* value)
+ {
+#if DALI_GLES_VERSION >= 30
+ glUniform1uiv(location,count,value);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void Uniform2uiv(GLint location, GLsizei count, const GLuint* value)
+ {
+#if DALI_GLES_VERSION >= 30
+ glUniform2uiv(location,count,value);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void Uniform3uiv(GLint location, GLsizei count, const GLuint* value)
+ {
+#if DALI_GLES_VERSION >= 30
+ glUniform3uiv(location,count,value);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void Uniform4uiv(GLint location, GLsizei count, const GLuint* value)
+ {
+#if DALI_GLES_VERSION >= 30
+ glUniform4uiv(location,count,value);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value)
+ {
+#if DALI_GLES_VERSION >= 30
+ glClearBufferiv(buffer,drawbuffer,value);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value)
+ {
+#if DALI_GLES_VERSION >= 30
+ glClearBufferuiv(buffer,drawbuffer,value);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value)
+ {
+#if DALI_GLES_VERSION >= 30
+ glClearBufferfv(buffer,drawbuffer,value);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
+ {
+#if DALI_GLES_VERSION >= 30
+ glClearBufferfi(buffer,drawbuffer,depth,stencil);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ const GLubyte* GetStringi(GLenum name, GLuint index)
+ {
+#if DALI_GLES_VERSION >= 30
+ return glGetStringi(name,index);
+#else
+ return NULL;
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
+ {
+#if DALI_GLES_VERSION >= 30
+ glCopyBufferSubData(readTarget,writeTarget,readOffset,writeOffset,size);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetUniformIndices(program,uniformCount,uniformNames,uniformIndices);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetActiveUniformsiv(program,uniformCount,uniformIndices,pname,params);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
+ {
+#if DALI_GLES_VERSION >= 30
+ return glGetUniformBlockIndex(program,uniformBlockName);
+#else
+ return 0;
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetActiveUniformBlockiv(program,uniformBlockIndex,pname,params);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetActiveUniformBlockName(program,uniformBlockIndex,bufSize,length,uniformBlockName);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
+ {
+#if DALI_GLES_VERSION >= 30
+ glUniformBlockBinding(program,uniformBlockIndex,uniformBlockBinding);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
+ {
+#if DALI_GLES_VERSION >= 30
+ glDrawArraysInstanced(mode,first,count,instanceCount);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount)
+ {
+#if DALI_GLES_VERSION >= 30
+ glDrawElementsInstanced(mode,count,type,indices,instanceCount);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ GLsync FenceSync(GLenum condition, GLbitfield flags)
+ {
+#if DALI_GLES_VERSION >= 30
+ return glFenceSync(condition,flags);
+#else
+ return NULL;
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ GLboolean IsSync(GLsync sync)
+ {
+#if DALI_GLES_VERSION >= 30
+ return glIsSync(sync);
+#else
+ return 0;
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void DeleteSync(GLsync sync)
+ {
+#if DALI_GLES_VERSION >= 30
+ glDeleteSync(sync);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ GLenum ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+ {
+#if DALI_GLES_VERSION >= 30
+ return glClientWaitSync(sync,flags,timeout);
+#else
+ return 0;
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
+ {
+#if DALI_GLES_VERSION >= 30
+ glWaitSync(sync,flags,timeout);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetInteger64v(GLenum pname, GLint64* params)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetInteger64v(pname,params);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetSynciv(sync,pname,bufSize,length,values);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetInteger64i_v(GLenum target, GLuint index, GLint64* data)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetInteger64i_v(target,index,data);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetBufferParameteri64v(target,pname,params);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GenSamplers(GLsizei count, GLuint* samplers)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGenSamplers(count,samplers);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void DeleteSamplers(GLsizei count, const GLuint* samplers)
+ {
+#if DALI_GLES_VERSION >= 30
+ glDeleteSamplers(count,samplers);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ GLboolean IsSampler(GLuint sampler)
+ {
+#if DALI_GLES_VERSION >= 30
+ return glIsSampler(sampler);
+#else
+ return 0;
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void BindSampler(GLuint unit, GLuint sampler)
+ {
+#if DALI_GLES_VERSION >= 30
+ glBindSampler(unit,sampler);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
+ {
+#if DALI_GLES_VERSION >= 30
+ glSamplerParameteri(sampler,pname,param);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
+ {
+#if DALI_GLES_VERSION >= 30
+ glSamplerParameteriv(sampler,pname,param);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
+ {
+#if DALI_GLES_VERSION >= 30
+ glSamplerParameterf(sampler,pname,param);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
+ {
+#if DALI_GLES_VERSION >= 30
+ glSamplerParameterfv(sampler,pname,param);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetSamplerParameteriv(sampler,pname,params);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetSamplerParameterfv(sampler,pname,params);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void VertexAttribDivisor(GLuint index, GLuint divisor)
+ {
+#if DALI_GLES_VERSION >= 30
+ glVertexAttribDivisor(index,divisor);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void BindTransformFeedback(GLenum target, GLuint id)
+ {
+#if DALI_GLES_VERSION >= 30
+ glBindTransformFeedback(target,id);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void DeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
+ {
+#if DALI_GLES_VERSION >= 30
+ glDeleteTransformFeedbacks(n,ids);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GenTransformFeedbacks(GLsizei n, GLuint* ids)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGenTransformFeedbacks(n,ids);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ GLboolean IsTransformFeedback(GLuint id)
+ {
+#if DALI_GLES_VERSION >= 30
+ return glIsTransformFeedback(id);
+#else
+ return 0;
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void PauseTransformFeedback(void)
+ {
+#if DALI_GLES_VERSION >= 30
+ glPauseTransformFeedback();
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void ResumeTransformFeedback(void)
+ {
+#if DALI_GLES_VERSION >= 30
+ glResumeTransformFeedback();
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)
+ {
+#if DALI_GLES_VERSION >= 30
+ // if OpenGL ES 2.0 compatibility is need this can be implemented with
+ // glGetProgramBinaryOES
+ glGetProgramBinary(program,bufSize,length,binaryFormat,binary);
+#else
+ mGlExtensions.GetProgramBinaryOES(program, bufSize, length, binaryFormat, binary);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length)
+ {
+#if DALI_GLES_VERSION >= 30
+ // if OpenGL ES 2.0 compatibility is need this can be implemented with
+ // glProgramBinaryOES
+ glProgramBinary(program,binaryFormat,binary,length);
+#else
+ mGlExtensions.ProgramBinaryOES(program, binaryFormat, binary, length);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void ProgramParameteri(GLuint program, GLenum pname, GLint value)
+ {
+#if DALI_GLES_VERSION >= 30
+ glProgramParameteri(program,pname,value);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments)
+ {
+#if DALI_GLES_VERSION >= 30
+ glInvalidateFramebuffer(target,numAttachments,attachments);
+#else
+ mGlExtensions.DiscardFrameBuffer(target, numAttachments, attachments);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
+ {
+#if DALI_GLES_VERSION >= 30
+ glInvalidateSubFramebuffer(target,numAttachments,attachments,x,y,width,height);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
+ {
+#if DALI_GLES_VERSION >= 30
+ glTexStorage2D(target,levels,internalformat,width,height);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
+ {
+#if DALI_GLES_VERSION >= 30
+ glTexStorage3D(target,levels,internalformat,width,height,depth);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+ void GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
+ {
+#if DALI_GLES_VERSION >= 30
+ glGetInternalformativ(target,internalformat,pname,bufSize,params);
+#endif // DALI_GLES_VERSION >= 30
+ }
+
+private:
+ ECoreX::GlExtensions mGlExtensions;
+
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_GL_IMPLEMENTATION_H__
--- /dev/null
+/*
+ * Copyright (c) 2016 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/internal/graphics/gles/gl-proxy-implementation.h>
+
+// EXTERNAL INCLUDES
+#include <math.h>
+
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/system/common/environment-options.h>
+
+namespace
+{
+const int NUM_FRAMES_PER_SECOND( 60 );
+}
+
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+
+Sampler::Sampler( const char* description )
+: mDescription( description ),
+ mAccumulatedSquare( 0 ),
+ mAccumulated( 0 ),
+ mNumSamples( 0 ),
+ mMin( 0.0f ),
+ mMax( 0.0f ),
+ mCurrentFrameCount( 0 )
+{
+}
+
+void Sampler::Increment()
+{
+ mCurrentFrameCount++;
+}
+
+void Sampler::Reset()
+{
+ mAccumulatedSquare = 0;
+ mAccumulated = 0;
+ mNumSamples = 0;
+ mMin = 0.0f;
+ mMax = 0.0f;
+ mCurrentFrameCount = 0;
+}
+
+void Sampler::Accumulate()
+{
+ if( mNumSamples == 0 )
+ {
+ mMin = mCurrentFrameCount;
+ mMax = mCurrentFrameCount;
+ }
+ else
+ {
+ if( mCurrentFrameCount < mMin )
+ {
+ mMin = mCurrentFrameCount;
+ }
+ if( mCurrentFrameCount > mMax )
+ {
+ mMax = mCurrentFrameCount;
+ }
+ }
+
+ mNumSamples++;
+
+ mAccumulated += mCurrentFrameCount;
+ mAccumulatedSquare += ( mCurrentFrameCount * mCurrentFrameCount );
+ mCurrentFrameCount = 0;
+}
+const char* Sampler::GetDescription() const
+{
+ return mDescription;
+}
+
+float Sampler::GetMeanValue() const
+{
+ float meanValue = 0;
+ if( mNumSamples > 0 )
+ {
+ meanValue = static_cast<double>( mAccumulated ) / static_cast<double>( mNumSamples );
+ }
+ return meanValue;
+}
+
+float Sampler::GetStandardDeviation() const
+{
+ float standardDeviation = 0.0f;
+ if( mNumSamples > 0 )
+ {
+ standardDeviation = sqrtf( mNumSamples * mAccumulatedSquare - ( mAccumulated * mAccumulated ) ) / mNumSamples;
+ }
+ return standardDeviation;
+}
+
+float Sampler::GetMin() const
+{
+ return mMin;
+}
+
+float Sampler::GetMax() const
+{
+ return mMax;
+}
+
+uint64_t Sampler::GetCount() const
+{
+ return mAccumulated;
+}
+
+ObjectCounter::ObjectCounter( const char* description )
+: mDescription( description ),
+ mCount( 0 ),
+ mPeak( 0 )
+{}
+
+void ObjectCounter::Increment()
+{
+ ++mCount;
+ if( mCount > mPeak )
+ {
+ mPeak = mCount;
+ }
+}
+
+void ObjectCounter::Decrement()
+{
+ --mCount;
+}
+
+unsigned int ObjectCounter::GetCount() const
+{
+ return mCount;
+}
+unsigned int ObjectCounter::GetPeak() const
+{
+ return mPeak;
+}
+
+const char* ObjectCounter::GetDescription() const
+{
+ return mDescription;
+}
+
+GlProxyImplementation::GlProxyImplementation( EnvironmentOptions& environmentOptions )
+: mEnvironmentOptions( environmentOptions ),
+ mActiveTextureSampler( "ActiveTexture calls" ),
+ mClearSampler( "Clear calls" ),
+ mBindBufferSampler( "Bind buffers" ),
+ mBindTextureSampler( "Bind textures" ),
+ mDrawSampler( "Draw calls" ),
+ mUniformSampler( "Uniform sets" ),
+ mUseProgramSampler( "Used programs" ),
+ mBufferCount( "Buffer Count" ),
+ mTextureCount( "Texture Count" ),
+ mProgramCount( "Program Count" ),
+ mCurrentFrameCount( 0 ),
+ mTotalFrameCount( 0 )
+{
+}
+
+GlProxyImplementation::~GlProxyImplementation()
+{
+}
+
+void GlProxyImplementation::PreRender()
+{
+}
+
+void GlProxyImplementation::PostRender()
+{
+ // Accumulate counts in each sampler
+ AccumulateSamples();
+
+ // When we reach the desired frame count, output the averages from the samples
+ mTotalFrameCount++;
+ mCurrentFrameCount++;
+
+ if( mCurrentFrameCount >= mEnvironmentOptions.GetGlesCallTime() * NUM_FRAMES_PER_SECOND )
+ {
+ mCurrentFrameCount = 0;
+ LogResults();
+
+ if( !mEnvironmentOptions.GetGlesCallAccumulate() )
+ {
+ ResetSamplers();
+ }
+ }
+}
+
+void GlProxyImplementation::Clear( GLbitfield mask )
+{
+ mClearSampler.Increment();
+ GlImplementation::Clear(mask);
+}
+
+void GlProxyImplementation::GenBuffers(GLsizei n, GLuint* buffers)
+{
+ mBufferCount.Increment();
+ GlImplementation::GenBuffers( n, buffers );
+}
+
+void GlProxyImplementation::DeleteBuffers( GLsizei n, const GLuint* buffers )
+{
+ mBufferCount.Decrement();
+ GlImplementation::DeleteBuffers( n, buffers );
+}
+
+void GlProxyImplementation::BindBuffer( GLenum target, GLuint buffer )
+{
+ mBindBufferSampler.Increment();
+ GlImplementation::BindBuffer( target, buffer );
+}
+
+void GlProxyImplementation::GenTextures( GLsizei n, GLuint* textures )
+{
+ mTextureCount.Increment();
+ GlImplementation::GenTextures( n, textures );
+}
+
+void GlProxyImplementation::DeleteTextures( GLsizei n, const GLuint* textures )
+{
+ mTextureCount.Decrement();
+ GlImplementation::DeleteTextures( n, textures );
+}
+
+void GlProxyImplementation::ActiveTexture( GLenum texture )
+{
+ mActiveTextureSampler.Increment();
+ GlImplementation::ActiveTexture( texture );
+}
+
+void GlProxyImplementation::BindTexture( GLenum target, GLuint texture )
+{
+ mBindTextureSampler.Increment();
+ GlImplementation::BindTexture(target,texture);
+}
+
+void GlProxyImplementation::DrawArrays( GLenum mode, GLint first, GLsizei count )
+{
+ mDrawSampler.Increment();
+ GlImplementation::DrawArrays( mode, first, count );
+}
+
+void GlProxyImplementation::DrawElements( GLenum mode, GLsizei count, GLenum type, const void* indices )
+{
+ mDrawSampler.Increment();
+ GlImplementation::DrawElements( mode, count, type, indices );
+}
+
+void GlProxyImplementation::Uniform1f( GLint location, GLfloat x )
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform1f( location, x );
+}
+
+void GlProxyImplementation::Uniform1fv( GLint location, GLsizei count, const GLfloat* v )
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform1fv( location, count, v );
+}
+
+void GlProxyImplementation::Uniform1i( GLint location, GLint x )
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform1i( location, x );
+}
+
+void GlProxyImplementation::Uniform1iv( GLint location, GLsizei count, const GLint* v )
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform1iv( location, count, v );
+}
+
+void GlProxyImplementation::Uniform2f( GLint location, GLfloat x, GLfloat y)
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform2f( location, x, y );
+}
+
+void GlProxyImplementation::Uniform2fv( GLint location, GLsizei count, const GLfloat* v )
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform2fv( location, count, v );
+}
+
+void GlProxyImplementation::Uniform2i( GLint location, GLint x, GLint y )
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform2i( location, x, y );
+}
+
+void GlProxyImplementation::Uniform2iv( GLint location, GLsizei count, const GLint* v )
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform2iv( location, count, v );
+}
+
+void GlProxyImplementation::Uniform3f( GLint location, GLfloat x, GLfloat y, GLfloat z )
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform3f( location, x, y, z );
+}
+
+void GlProxyImplementation::Uniform3fv( GLint location, GLsizei count, const GLfloat* v )
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform3fv( location, count, v );
+}
+
+void GlProxyImplementation::Uniform3i( GLint location, GLint x, GLint y, GLint z )
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform3i( location, x, y, z );
+}
+
+void GlProxyImplementation::Uniform3iv( GLint location, GLsizei count, const GLint* v )
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform3iv( location, count, v );
+}
+
+void GlProxyImplementation::Uniform4f( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform4f( location, x, y, z, w );
+}
+
+void GlProxyImplementation::Uniform4fv( GLint location, GLsizei count, const GLfloat* v )
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform4fv( location, count, v );
+}
+
+void GlProxyImplementation::Uniform4i( GLint location, GLint x, GLint y, GLint z, GLint w )
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform4i( location, x, y, z, w );
+}
+
+void GlProxyImplementation::Uniform4iv( GLint location, GLsizei count, const GLint* v )
+{
+ mUniformSampler.Increment();
+ GlImplementation::Uniform4iv( location, count, v );
+}
+
+void GlProxyImplementation::UniformMatrix2fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value )
+{
+ mUniformSampler.Increment();
+ GlImplementation::UniformMatrix2fv( location, count, transpose, value );
+}
+
+void GlProxyImplementation::UniformMatrix3fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value )
+{
+ mUniformSampler.Increment();
+ GlImplementation::UniformMatrix3fv( location, count, transpose, value );
+}
+
+void GlProxyImplementation::UniformMatrix4fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value )
+{
+ mUniformSampler.Increment();
+ GlImplementation::UniformMatrix4fv( location, count, transpose, value);
+}
+
+GLuint GlProxyImplementation::CreateProgram( void )
+{
+ mProgramCount.Increment();
+ return GlImplementation::CreateProgram();
+}
+
+void GlProxyImplementation::DeleteProgram( GLuint program )
+{
+ mProgramCount.Decrement();
+ GlImplementation::DeleteProgram( program );
+}
+
+void GlProxyImplementation::UseProgram( GLuint program )
+{
+ mUseProgramSampler.Increment();
+ GlImplementation::UseProgram( program );
+}
+
+void GlProxyImplementation::AccumulateSamples()
+{
+ // Accumulate counts in each sampler
+ mActiveTextureSampler.Accumulate();
+ mClearSampler.Accumulate();
+ mBindBufferSampler.Accumulate();
+ mBindTextureSampler.Accumulate();
+ mDrawSampler.Accumulate();
+ mUniformSampler.Accumulate();
+ mUseProgramSampler.Accumulate();
+}
+
+void GlProxyImplementation::LogResults()
+{
+ Debug::LogMessage( Debug::DebugInfo, "OpenGL ES statistics sampled over %d frames) operations per frame:\n", mTotalFrameCount );
+ LogCalls( mActiveTextureSampler );
+ LogCalls( mClearSampler );
+ LogCalls( mBindBufferSampler );
+ LogCalls( mBindTextureSampler );
+ LogCalls( mDrawSampler );
+ LogCalls( mUniformSampler );
+ LogCalls( mUseProgramSampler );
+ Debug::LogMessage( Debug::DebugInfo, "OpenGL ES Object Count:\n" );
+ LogObjectCounter( mBufferCount );
+ LogObjectCounter( mTextureCount );
+ LogObjectCounter( mProgramCount );
+}
+
+void GlProxyImplementation::LogCalls( const Sampler& sampler )
+{
+ Debug::LogMessage( Debug::DebugInfo, " %s : Mean %5.2f (Min:%5.2f, Max:%5.2f, StdDev:%5.2f, Actual:%d)\n",
+ sampler.GetDescription(),
+ sampler.GetMeanValue(), sampler.GetMin(), sampler.GetMax(),
+ sampler.GetStandardDeviation(),
+ sampler.GetCount() );
+}
+
+void GlProxyImplementation::LogObjectCounter( const ObjectCounter& sampler )
+{
+ Debug::LogMessage( Debug::DebugInfo, " %s : %u (Peak:%u)\n",
+ sampler.GetDescription(),
+ sampler.GetCount(),
+ sampler.GetPeak() );
+}
+
+void GlProxyImplementation::ResetSamplers()
+{
+ mActiveTextureSampler.Reset();
+ mClearSampler.Reset();
+ mBindBufferSampler.Reset();
+ mBindTextureSampler.Reset();
+ mDrawSampler.Reset();
+ mUniformSampler.Reset();
+ mUseProgramSampler.Reset();
+ mTotalFrameCount = 0;
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_INTERNAL_GL_PROXY_IMPLEMENTATION_H__
+#define __DALI_INTERNAL_GL_PROXY_IMPLEMENTATION_H__
+
+/*
+ * Copyright (c) 2016 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/internal/graphics/gles/gl-implementation.h>
+
+namespace Dali
+{
+namespace Internal
+{
+namespace Adaptor
+{
+class EnvironmentOptions;
+
+/**
+ * Helper class to calculate the statistics for Open GLES calls
+ */
+class Sampler
+{
+public:
+
+ /**
+ * Constructor
+ * @param description to write to the log
+ */
+ Sampler( const char* description );
+
+ /**
+ * Increment the counter for this frame
+ */
+ void Increment();
+
+ /**
+ * Reset the counter
+ */
+ void Reset();
+
+ /**
+ * Accumulate the count onto statistics
+ */
+ void Accumulate();
+
+ /**
+ * @return the description of the sampler
+ */
+ const char* GetDescription() const;
+
+ /**
+ * @return the mean value
+ */
+ float GetMeanValue() const;
+
+ /**
+ * @return the standard deviation
+ */
+ float GetStandardDeviation() const;
+
+ /**
+ * @return the minimum value
+ */
+ float GetMin() const;
+
+ /**
+ * @return the maximum value
+ */
+ float GetMax() const;
+
+ /**
+ * @return the current count
+ */
+ uint64_t GetCount() const;
+
+private: // Data
+
+ const char* mDescription;
+
+ uint64_t mAccumulatedSquare;
+ uint64_t mAccumulated;
+ uint64_t mNumSamples;
+ float mMin;
+ float mMax;
+ unsigned int mCurrentFrameCount;
+};
+
+/**
+ * Helper class to calculate number of OpenGL objects
+ */
+class ObjectCounter
+{
+public:
+ ObjectCounter( const char* description );
+
+ /**
+ * Increment the counter
+ */
+ void Increment();
+
+ /**
+ * Decrement the counter
+ */
+ void Decrement();
+
+ /**
+ * @return The current number of objects
+ */
+ unsigned int GetCount() const;
+
+ /**
+ * @return The maximum number of objects created
+ */
+ unsigned int GetPeak() const;
+
+ /**
+ * @return the description of the sampler
+ */
+ const char* GetDescription() const;
+
+private:
+ const char* mDescription;
+ unsigned int mCount;
+ unsigned int mPeak;
+};
+
+/**
+ * GlProxyImplementation is a wrapper for the concrete implementation
+ * of GlAbstraction that also gathers statistical information.
+ */
+class GlProxyImplementation : public GlImplementation
+{
+public:
+
+ /**
+ * Constructor
+ * @param environmentOptions to check how often to log results
+ */
+ GlProxyImplementation( EnvironmentOptions& environmentOptions );
+
+ /**
+ * Virtual destructor
+ */
+ virtual ~GlProxyImplementation();
+
+ /**
+ * @copydoc GlAbstraction::PreRender();
+ */
+ virtual void PreRender();
+
+ /**
+ * @copydoc GlAbstraction::PostRender();
+ */
+ virtual void PostRender();
+
+ /* OpenGL ES 2.0 API */
+ virtual void Clear( GLbitfield mask );
+
+ virtual void GenBuffers( GLsizei n, GLuint* buffers );
+ virtual void DeleteBuffers( GLsizei n, const GLuint* buffers );
+ virtual void BindBuffer( GLenum target, GLuint buffer );
+
+ virtual void GenTextures( GLsizei n, GLuint* textures );
+ virtual void DeleteTextures( GLsizei n, const GLuint* textures );
+ virtual void ActiveTexture( GLenum texture );
+ virtual void BindTexture( GLenum target, GLuint texture );
+
+ virtual void DrawArrays( GLenum mode, GLint first, GLsizei count );
+ virtual void DrawElements( GLenum mode, GLsizei count, GLenum type, const void* indices );
+
+ virtual void Uniform1f ( GLint location, GLfloat x );
+ virtual void Uniform1fv( GLint location, GLsizei count, const GLfloat* v );
+ virtual void Uniform1i ( GLint location, GLint x );
+ virtual void Uniform1iv( GLint location, GLsizei count, const GLint* v );
+ virtual void Uniform2f ( GLint location, GLfloat x, GLfloat y );
+ virtual void Uniform2fv( GLint location, GLsizei count, const GLfloat* v );
+ virtual void Uniform2i ( GLint location, GLint x, GLint y );
+ virtual void Uniform2iv( GLint location, GLsizei count, const GLint* v );
+ virtual void Uniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z );
+ virtual void Uniform3fv( GLint location, GLsizei count, const GLfloat* v );
+ virtual void Uniform3i ( GLint location, GLint x, GLint y, GLint z );
+ virtual void Uniform3iv( GLint location, GLsizei count, const GLint* v );
+ virtual void Uniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
+ virtual void Uniform4fv( GLint location, GLsizei count, const GLfloat* v );
+ virtual void Uniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w );
+ virtual void Uniform4iv( GLint location, GLsizei count, const GLint* v );
+ virtual void UniformMatrix2fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value );
+ virtual void UniformMatrix3fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value );
+ virtual void UniformMatrix4fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value );
+
+ virtual GLuint CreateProgram( void );
+ virtual void DeleteProgram( GLuint program );
+ virtual void UseProgram( GLuint program );
+
+private: // Helpers
+
+ void AccumulateSamples();
+ void LogResults();
+ void LogCalls( const Sampler& sampler );
+ void LogObjectCounter( const ObjectCounter& sampler );
+ void ResetSamplers();
+
+private: // Data
+
+ EnvironmentOptions& mEnvironmentOptions;
+ Sampler mActiveTextureSampler;
+ Sampler mClearSampler;
+ Sampler mBindBufferSampler;
+ Sampler mBindTextureSampler;
+ Sampler mDrawSampler;
+ Sampler mUniformSampler;
+ Sampler mUseProgramSampler;
+ ObjectCounter mBufferCount;
+ ObjectCounter mTextureCount;
+ ObjectCounter mProgramCount;
+
+ int mCurrentFrameCount;
+ int mTotalFrameCount;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_GL_PROXY_IMPLEMENTATION_H__
+++ /dev/null
-/*
- * Copyright (c) 2014 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/internal/graphics/gles20/egl-debug.h>
-
-// EXTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-namespace Egl
-{
-
-void PrintError( EGLint error)
-{
- switch (error)
- {
- case EGL_BAD_DISPLAY:
- {
- DALI_LOG_ERROR("EGL_BAD_DISPLAY : Display is not an EGL display connection\n");
- break;
- }
- case EGL_NOT_INITIALIZED:
- {
- DALI_LOG_ERROR("EGL_NOT_INITIALIZED : Display has not been initialized\n");
- break;
- }
- case EGL_BAD_SURFACE:
- {
- DALI_LOG_ERROR("EGL_BAD_SURFACE : Draw or read is not an EGL surface\n");
- break;
- }
- case EGL_BAD_CONTEXT:
- {
- DALI_LOG_ERROR("EGL_BAD_CONTEXT : Context is not an EGL rendering context\n");
- break;
- }
- case EGL_BAD_MATCH:
- {
- DALI_LOG_ERROR("EGL_BAD_MATCH : Draw or read are not compatible with context, or if context is set to EGL_NO_CONTEXT and draw or read are not set to EGL_NO_SURFACE, or if draw or read are set to EGL_NO_SURFACE and context is not set to EGL_NO_CONTEXT\n");
- break;
- }
- case EGL_BAD_ACCESS:
- {
- DALI_LOG_ERROR("EGL_BAD_ACCESS : Context is current to some other thread\n");
- break;
- }
- case EGL_BAD_NATIVE_PIXMAP:
- {
- DALI_LOG_ERROR("EGL_BAD_NATIVE_PIXMAP : A native pixmap underlying either draw or read is no longer valid\n");
- break;
- }
- case EGL_BAD_NATIVE_WINDOW:
- {
- DALI_LOG_ERROR("EGL_BAD_NATIVE_WINDOW : A native window underlying either draw or read is no longer valid\n");
- break;
- }
- case EGL_BAD_CURRENT_SURFACE:
- {
- DALI_LOG_ERROR("EGL_BAD_CURRENT_SURFACE : The previous context has unflushed commands and the previous surface is no longer valid\n");
- break;
- }
- case EGL_BAD_ALLOC:
- {
- DALI_LOG_ERROR("EGL_BAD_ALLOC : Allocation of ancillary buffers for draw or read were delayed until eglMakeCurrent is called, and there are not enough resources to allocate them\n");
- break;
- }
- case EGL_CONTEXT_LOST:
- {
- DALI_LOG_ERROR("EGL_CONTEXT_LOST : If a power management event has occurred. The application must destroy all contexts and reinitialise OpenGL ES state and objects to continue rendering\n");
- break;
- }
- default:
- {
- DALI_LOG_ERROR("Unknown error with code: %d\n", error);
- break;
- }
- }
-}
-
-} // namespace Egl
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_EGL_DEBUG_H__
-#define __DALI_INTERNAL_EGL_DEBUG_H__
-
-/*
- * Copyright (c) 2014 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 <EGL/egl.h>
-#include <EGL/eglext.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-namespace Egl
-{
-
-void PrintError( EGLint error);
-
-} // namespace Egl
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif //__DALI_INTERNAL_EGL_DEBUG_H__
+++ /dev/null
-#ifndef DALI_INTERNAL_BASE_EGL_FACTORY_INTERFACE_H
-#define DALI_INTERNAL_BASE_EGL_FACTORY_INTERFACE_H
-
-/*
- * Copyright (c) 2014 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.
- *
- */
-
-namespace Dali
-{
-
-class EglInterface;
-
-namespace Internal
-{
-namespace Adaptor
-{
-
-/**
- * Factory interface for creating EGL implementation
- */
-class EglFactoryInterface
-{
-public:
- /**
- * Create an EGL implementation
- * @return An implementation of the EGL interface
- */
- virtual EglInterface* Create() = 0;
-
- /**
- * Destroy the EGL implementation
- */
- virtual void Destroy() = 0;
-
-protected:
- /**
- * Virtual protected destructor - no deletion through this interface
- */
- virtual ~EglFactoryInterface() {};
-};
-
-} // Adaptor
-} // Internal
-} // Dali
-
-#endif // DALI_INTERNAL_BASE_EGL_FACTORY_INTERFACE_H
+++ /dev/null
-/*
- * Copyright (c) 2018 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/internal/graphics/gles20/egl-graphics-factory.h>
-#include <dali/internal/graphics/gles20/egl-graphics.h>
-
-// INTERNAL INCLUDES
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-
-GraphicsFactory::GraphicsFactory()
-{
-}
-
-GraphicsFactory::~GraphicsFactory()
-{
- /* Deleted by Adaptor destructor */
-}
-
-GraphicsInterface& GraphicsFactory::Create()
-{
- GraphicsInterface* eglGraphicsInterface = new EglGraphics;
- return *eglGraphicsInterface;
-}
-
-void GraphicsFactory::Destroy()
-{
- /* Deleted by EglGraphics */
-}
-
-} // Adaptor
-} // Internal
-} // Dali
+++ /dev/null
-#ifndef DALI_INTERNAL_GRAPHICS_FACTORY_H
-#define DALI_INTERNAL_GRAPHICS_FACTORY_H
-
-/*
- * Copyright (c) 2018 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/internal/graphics/common/graphics-factory-interface.h>
-
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-class GraphicsFactory : public GraphicsFactoryInterface
-{
-public:
-
- /**
- * Constructor
- */
- GraphicsFactory();
-
- /**
- * Destructor
- */
- virtual ~GraphicsFactory();
-
- /**
- * @copydoc Dali::Internal::Adaptor::GraphicsFactoryInterface::Create()
- */
- GraphicsInterface& Create() override;
-
- /**
- * @copydoc Dali::Internal::Adaptor::GraphicsFactoryInterface::Destroy()
- */
- void Destroy();
-};
-
-} // Adaptor
-
-} // Internal
-
-} // Dali
-
-#endif // DALI_INTERNAL_GRAPHICS_FACTORY_H
+++ /dev/null
-/*
- * Copyright (c) 2018 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/internal/graphics/gles20/egl-graphics.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/window-system/common/display-utils.h> // For Utils::MakeUnique
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-
-EglGraphics::EglGraphics( )
-: mMultiSamplingLevel( 0 )
-{
-}
-
-EglGraphics::~EglGraphics()
-{
-}
-
-
-void EglGraphics::Initialize( EnvironmentOptions* environmentOptions )
-{
- if( environmentOptions->GetGlesCallTime() > 0 )
- {
- mGLES = Utils::MakeUnique< GlProxyImplementation >( *environmentOptions );
- }
- else
- {
- mGLES.reset ( new GlImplementation() );
- }
-
- mDepthBufferRequired = static_cast< Integration::DepthBufferAvailable >( environmentOptions->DepthBufferRequired() );
- mStencilBufferRequired = static_cast< Integration::StencilBufferAvailable >( environmentOptions->StencilBufferRequired() );
-
- mMultiSamplingLevel = environmentOptions->GetMultiSamplingLevel();
-
- mEglSync = Utils::MakeUnique< EglSyncImplementation >();
-}
-
-EglInterface* EglGraphics::Create()
-{
- mEglImplementation = Utils::MakeUnique< EglImplementation >( mMultiSamplingLevel, mDepthBufferRequired, mStencilBufferRequired );
- mEglImageExtensions = Utils::MakeUnique< EglImageExtensions >( mEglImplementation.get() );
-
- mEglSync->Initialize( mEglImplementation.get() ); // The sync impl needs the EglDisplay
-
- return mEglImplementation.get();
-}
-
-void EglGraphics::Destroy()
-{
-}
-
-//Dali::Integration::GlAbstraction& EglGraphics::GetGlesInterface()
-GlImplementation& EglGraphics::GetGlesInterface()
-{
- return *mGLES;
-}
-
-Integration::GlAbstraction& EglGraphics::GetGlAbstraction() const
-{
- DALI_ASSERT_DEBUG( mGLES && "GLImplementation not created" );
- return *mGLES;
-}
-
-EglImplementation& EglGraphics::GetEglImplementation() const
-{
- DALI_ASSERT_DEBUG( mEglImplementation && "EGLImplementation not created" );
- return *mEglImplementation;
-}
-
-EglInterface& EglGraphics::GetEglInterface() const
-{
- DALI_ASSERT_DEBUG( mEglImplementation && "EGLImplementation not created" );
- EglInterface* eglInterface = mEglImplementation.get();
- return *eglInterface;
-}
-
-EglSyncImplementation& EglGraphics::GetSyncImplementation()
-{
- DALI_ASSERT_DEBUG( mEglSync && "EglSyncImplementation not created" );
- return *mEglSync;
-}
-
-EglImageExtensions* EglGraphics::GetImageExtensions()
-{
- DALI_ASSERT_DEBUG( mEglImageExtensions && "EglImageExtensions not created" );
- return mEglImageExtensions.get();
-}
-
-} // Adaptor
-} // Internal
-} // Dali
+++ /dev/null
-#ifndef DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H
-#define DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H
-
-/*
- * Copyright (c) 2018 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
-
-// INTERNAL INCLUDES
-#include <dali/internal/graphics/common/graphics-interface.h>
-#include <dali/internal/graphics/gles20/gl-proxy-implementation.h>
-#include <dali/internal/graphics/gles20/gl-implementation.h>
-#include <dali/integration-api/egl-interface.h>
-
-#include <dali/internal/graphics/gles20/egl-implementation.h>
-#include <dali/internal/graphics/common/egl-image-extensions.h>
-#include <dali/internal/graphics/gles20/egl-sync-implementation.h>
-
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-class EglGraphics : public GraphicsInterface
-{
-public:
-
- /**
- * Constructor
- */
- EglGraphics();
-
- /**
- * Destructor
- */
- virtual ~EglGraphics();
-
- /**
- * @copydoc Dali::Internal::Adaptor::GraphicsInterface::Initialize()
- */
- void Initialize( EnvironmentOptions* environmentOptions ) override;
-
- /**
- * Creates the graphics interface for EGL
- * @return The graphics interface for EGL
- */
- EglInterface* Create();
-
- /**
- * Gets the GL abstraction
- * @return The GL abstraction
- */
- Integration::GlAbstraction& GetGlAbstraction() const;
-
- /**
- * Gets the implementation of EGL
- * @return The implementation of EGL
- */
- EglImplementation& GetEglImplementation() const;
-
- /**
- * Gets the graphics interface for EGL
- * @return The graphics interface for EGL
- */
- EglInterface& GetEglInterface() const;
-
- /**
- * @copydoc Dali::Integration::GlAbstraction& GetGlesInterface()
- */
- GlImplementation& GetGlesInterface();
-
- /**
- * Gets the implementation of GlSyncAbstraction for EGL.
- * @return The implementation of GlSyncAbstraction for EGL.
- */
- EglSyncImplementation& GetSyncImplementation();
-
- /**
- * @copydoc Dali::Internal::Adaptor::GraphicsInterface::GetDepthBufferRequired()
- */
- Integration::DepthBufferAvailable& GetDepthBufferRequired();
-
- /**
- * @copydoc Dali::Internal::Adaptor::GraphicsInterface::GetStencilBufferRequired()
- */
- Integration::StencilBufferAvailable GetStencilBufferRequired();
-
- /**
- * Gets the EGL image extension
- * @return The EGL image extension
- */
- EglImageExtensions* GetImageExtensions();
-
- /**
- * @copydoc Dali::Internal::Adaptor::GraphicsInterface::Destroy()
- */
- void Destroy() override;
-
-private:
- // Eliminate copy and assigned operations
- EglGraphics(const EglGraphics& rhs) = delete;
- EglGraphics& operator=(const EglGraphics& rhs) = delete;
-
-
-private:
- std::unique_ptr< GlImplementation > mGLES; ///< GL implementation
- std::unique_ptr< EglImplementation > mEglImplementation; ///< EGL implementation
- std::unique_ptr< EglImageExtensions > mEglImageExtensions; ///< EGL image extension
- std::unique_ptr< EglSyncImplementation > mEglSync; ///< GlSyncAbstraction implementation for EGL
-
- int mMultiSamplingLevel; ///< The multiple sampling level
-};
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_BASE_GRAPHICS_IMPLEMENTATION_H__
+++ /dev/null
-/*
- * Copyright (c) 2018 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/internal/graphics/gles20/egl-implementation.h>
-
-// EXTERNAL INCLUDES
-#include <dali/integration-api/debug.h>
-
-#include <dali/public-api/common/dali-vector.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/dali-adaptor-common.h>
-#include <dali/internal/graphics/gles20/gl-implementation.h>
-#include <dali/internal/graphics/gles20/egl-debug.h>
-
-// EGL constants use C style casts
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-#define TEST_EGL_ERROR(lastCommand) \
-{ \
- EGLint err = eglGetError(); \
- if (err != EGL_SUCCESS) \
- { \
- DALI_LOG_ERROR("EGL error after %s\n", lastCommand); \
- Egl::PrintError(err); \
- DALI_ASSERT_ALWAYS(0 && "EGL error"); \
- } \
-}
-
-EglImplementation::EglImplementation( int multiSamplingLevel,
- Integration::DepthBufferAvailable depthBufferRequired,
- Integration::StencilBufferAvailable stencilBufferRequired )
-: mContextAttribs(),
- mEglNativeDisplay( 0 ),
- mEglNativeWindow( 0 ),
- mCurrentEglNativePixmap( 0 ),
- mEglDisplay( 0 ),
- mEglConfig( 0 ),
- mEglContext( 0 ),
- mCurrentEglSurface( 0 ),
- mMultiSamplingLevel( multiSamplingLevel ),
- mColorDepth( COLOR_DEPTH_24 ),
- mGlesInitialized( false ),
- mIsOwnSurface( true ),
- mContextCurrent( false ),
- mIsWindow( true ),
- mDepthBufferRequired( depthBufferRequired == Integration::DepthBufferAvailable::TRUE ),
- mStencilBufferRequired( stencilBufferRequired == Integration::StencilBufferAvailable::TRUE )
-{
-}
-
-EglImplementation::~EglImplementation()
-{
- TerminateGles();
-}
-
-bool EglImplementation::InitializeGles( EGLNativeDisplayType display, bool isOwnSurface )
-{
- if ( !mGlesInitialized )
- {
- mEglNativeDisplay = display;
-
- //@todo see if we can just EGL_DEFAULT_DISPLAY instead
- mEglDisplay = eglGetDisplay(mEglNativeDisplay);
- EGLint error = eglGetError();
-
- if( mEglDisplay == NULL && error != EGL_SUCCESS )
- {
- throw Dali::DaliException( "", "OpenGL ES is not supported");
- }
-
- EGLint majorVersion = 0;
- EGLint minorVersion = 0;
- if ( !eglInitialize( mEglDisplay, &majorVersion, &minorVersion ) )
- {
- return false;
- }
- eglBindAPI(EGL_OPENGL_ES_API);
-
- mContextAttribs.Clear();
-
-#if DALI_GLES_VERSION >= 30
-
- mContextAttribs.Reserve(5);
- mContextAttribs.PushBack( EGL_CONTEXT_MAJOR_VERSION_KHR );
- mContextAttribs.PushBack( DALI_GLES_VERSION / 10 );
- mContextAttribs.PushBack( EGL_CONTEXT_MINOR_VERSION_KHR );
- mContextAttribs.PushBack( DALI_GLES_VERSION % 10 );
-
-#else // DALI_GLES_VERSION >= 30
-
- mContextAttribs.Reserve(3);
- mContextAttribs.PushBack( EGL_CONTEXT_CLIENT_VERSION );
- mContextAttribs.PushBack( 2 );
-
-#endif // DALI_GLES_VERSION >= 30
-
- mContextAttribs.PushBack( EGL_NONE );
-
- mGlesInitialized = true;
- mIsOwnSurface = isOwnSurface;
- }
-
- return mGlesInitialized;
-}
-
-bool EglImplementation::CreateContext()
-{
- // make sure a context isn't created twice
- DALI_ASSERT_ALWAYS( (mEglContext == 0) && "EGL context recreated" );
-
- mEglContext = eglCreateContext(mEglDisplay, mEglConfig, NULL, &(mContextAttribs[0]));
- TEST_EGL_ERROR("eglCreateContext render thread");
-
- DALI_ASSERT_ALWAYS( EGL_NO_CONTEXT != mEglContext && "EGL context not created" );
-
- DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_VENDOR : %s ***\n", glGetString(GL_VENDOR));
- DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_RENDERER : %s ***\n", glGetString(GL_RENDERER));
- DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_VERSION : %s ***\n", glGetString(GL_VERSION));
- DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_SHADING_LANGUAGE_VERSION : %s***\n", glGetString(GL_SHADING_LANGUAGE_VERSION));
- DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** Supported Extensions ***\n%s\n\n", glGetString(GL_EXTENSIONS));
-
- return true;
-}
-
-void EglImplementation::DestroyContext()
-{
- DALI_ASSERT_ALWAYS( mEglContext && "no EGL context" );
-
- eglDestroyContext( mEglDisplay, mEglContext );
- mEglContext = 0;
-}
-
-void EglImplementation::DestroySurface()
-{
- if(mIsOwnSurface && mCurrentEglSurface)
- {
- // Make context null to prevent crash in driver side
- MakeContextNull();
- eglDestroySurface( mEglDisplay, mCurrentEglSurface );
- mCurrentEglSurface = 0;
- }
-}
-
-void EglImplementation::MakeContextCurrent()
-{
- mContextCurrent = true;
-
- if(mIsOwnSurface)
- {
- eglMakeCurrent( mEglDisplay, mCurrentEglSurface, mCurrentEglSurface, mEglContext );
- }
-
- EGLint error = eglGetError();
-
- if ( error != EGL_SUCCESS )
- {
- Egl::PrintError(error);
-
- DALI_ASSERT_ALWAYS(false && "MakeContextCurrent failed!");
- }
-
- // We want to display this information all the time, so use the LogMessage directly
- Integration::Log::LogMessage(Integration::Log::DebugInfo, "EGL Information\n"
- " Vendor: %s\n"
- " Version: %s\n"
- " Client APIs: %s\n"
- " Extensions: %s\n",
- eglQueryString(mEglDisplay, EGL_VENDOR),
- eglQueryString(mEglDisplay, EGL_VERSION),
- eglQueryString(mEglDisplay, EGL_CLIENT_APIS),
- eglQueryString(mEglDisplay, EGL_EXTENSIONS));
-}
-
-void EglImplementation::MakeCurrent( EGLNativePixmapType pixmap, EGLSurface eglSurface )
-{
- mCurrentEglNativePixmap = pixmap;
- mCurrentEglSurface = eglSurface;
-
- if(mIsOwnSurface)
- {
- eglMakeCurrent( mEglDisplay, mCurrentEglSurface, mCurrentEglSurface, mEglContext );
- }
-
- EGLint error = eglGetError();
-
- if ( error != EGL_SUCCESS )
- {
- Egl::PrintError(error);
-
- DALI_ASSERT_ALWAYS(false && "MakeCurrent failed!");
- }
-}
-
-void EglImplementation::MakeContextNull()
-{
- mContextCurrent = false;
- // clear the current context
- eglMakeCurrent( mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
-}
-
-void EglImplementation::TerminateGles()
-{
- if ( mGlesInitialized )
- {
- // Make context null to prevent crash in driver side
- MakeContextNull();
-
- if(mIsOwnSurface && mCurrentEglSurface)
- {
- eglDestroySurface(mEglDisplay, mCurrentEglSurface);
- }
- eglDestroyContext(mEglDisplay, mEglContext);
-
- eglTerminate(mEglDisplay);
-
- mEglDisplay = NULL;
- mEglConfig = NULL;
- mEglContext = NULL;
- mCurrentEglSurface = NULL;
-
- mGlesInitialized = false;
- }
-}
-
-bool EglImplementation::IsGlesInitialized() const
-{
- return mGlesInitialized;
-}
-
-void EglImplementation::SwapBuffers()
-{
- eglSwapBuffers( mEglDisplay, mCurrentEglSurface );
-}
-
-void EglImplementation::CopyBuffers()
-{
- eglCopyBuffers( mEglDisplay, mCurrentEglSurface, mCurrentEglNativePixmap );
-}
-
-void EglImplementation::WaitGL()
-{
- eglWaitGL();
-}
-
-void EglImplementation::ChooseConfig( bool isWindowType, ColorDepth depth )
-{
- if(mEglConfig && isWindowType == mIsWindow && mColorDepth == depth)
- {
- return;
- }
-
- mIsWindow = isWindowType;
-
- EGLint numConfigs;
- Vector<EGLint> configAttribs;
- configAttribs.Reserve(31);
-
- if(isWindowType)
- {
- configAttribs.PushBack( EGL_SURFACE_TYPE );
- configAttribs.PushBack( EGL_WINDOW_BIT );
- }
- else
- {
- configAttribs.PushBack( EGL_SURFACE_TYPE );
- configAttribs.PushBack( EGL_PIXMAP_BIT );
- }
-
- configAttribs.PushBack( EGL_RENDERABLE_TYPE );
-
-#if DALI_GLES_VERSION >= 30
-
-#ifdef _ARCH_ARM_
- configAttribs.PushBack( EGL_OPENGL_ES3_BIT_KHR );
-#else
- // There is a bug in the desktop emulator
- // Requesting for ES3 causes eglCreateContext even though it allows to ask
- // for a configuration that supports GLES 3.0
- configAttribs.PushBack( EGL_OPENGL_ES2_BIT );
-#endif // _ARCH_ARM_
-
-#else // DALI_GLES_VERSION >= 30
-
- Integration::Log::LogMessage( Integration::Log::DebugInfo, "Using OpenGL ES 2 \n" );
- configAttribs.PushBack( EGL_OPENGL_ES2_BIT );
-
-#endif //DALI_GLES_VERSION >= 30
-
-#if DALI_GLES_VERSION >= 30
-// TODO: enable this flag when it becomes supported
-// configAttribs.PushBack( EGL_CONTEXT_FLAGS_KHR );
-// configAttribs.PushBack( EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR );
-#endif //DALI_GLES_VERSION >= 30
-
- configAttribs.PushBack( EGL_RED_SIZE );
- configAttribs.PushBack( 8 );
- configAttribs.PushBack( EGL_GREEN_SIZE );
- configAttribs.PushBack( 8 );
- configAttribs.PushBack( EGL_BLUE_SIZE );
- configAttribs.PushBack( 8 );
-
- configAttribs.PushBack( EGL_ALPHA_SIZE );
-#ifdef _ARCH_ARM_
- // For underlay video playback, we also need to set the alpha value of the 24/32bit window.
- configAttribs.PushBack( 8 );
-#else
- // There is a bug in the desktop emulator
- // setting EGL_ALPHA_SIZE to 8 results in eglChooseConfig failing
- configAttribs.PushBack( 0 );
-#endif // _ARCH_ARM_
-
- configAttribs.PushBack( EGL_DEPTH_SIZE );
- configAttribs.PushBack( mDepthBufferRequired ? 24 : 0 );
- configAttribs.PushBack( EGL_STENCIL_SIZE );
- configAttribs.PushBack( mStencilBufferRequired ? 8 : 0 );
-
-#ifndef DALI_PROFILE_UBUNTU
- if( mMultiSamplingLevel != EGL_DONT_CARE )
- {
- configAttribs.PushBack( EGL_SAMPLES );
- configAttribs.PushBack( mMultiSamplingLevel );
- configAttribs.PushBack( EGL_SAMPLE_BUFFERS );
- configAttribs.PushBack( 1 );
- }
-#endif // DALI_PROFILE_UBUNTU
- configAttribs.PushBack( EGL_NONE );
-
- if ( eglChooseConfig( mEglDisplay, &(configAttribs[0]), &mEglConfig, 1, &numConfigs ) != EGL_TRUE )
- {
- EGLint error = eglGetError();
- switch (error)
- {
- case EGL_BAD_DISPLAY:
- {
- DALI_LOG_ERROR("Display is not an EGL display connection\n");
- break;
- }
- case EGL_BAD_ATTRIBUTE:
- {
- DALI_LOG_ERROR("The parameter configAttribs contains an invalid frame buffer configuration attribute or an attribute value that is unrecognized or out of range\n");
- break;
- }
- case EGL_NOT_INITIALIZED:
- {
- DALI_LOG_ERROR("Display has not been initialized\n");
- break;
- }
- case EGL_BAD_PARAMETER:
- {
- DALI_LOG_ERROR("The parameter numConfig is NULL\n");
- break;
- }
- default:
- {
- DALI_LOG_ERROR("Unknown error.\n");
- }
- }
- DALI_ASSERT_ALWAYS(false && "eglChooseConfig failed!");
- }
-
- if ( numConfigs != 1 )
- {
- DALI_LOG_ERROR("No configurations found.\n");
-
- TEST_EGL_ERROR("eglChooseConfig");
- }
-}
-
-void EglImplementation::CreateSurfaceWindow( EGLNativeWindowType window, ColorDepth depth )
-{
- DALI_ASSERT_ALWAYS( ( mCurrentEglSurface == 0 ) && "EGL surface already exists" );
-
- mEglNativeWindow = window;
- mColorDepth = depth;
- mIsWindow = true;
-
- // egl choose config
- ChooseConfig(mIsWindow, mColorDepth);
-
- mCurrentEglSurface = eglCreateWindowSurface( mEglDisplay, mEglConfig, mEglNativeWindow, NULL );
- TEST_EGL_ERROR("eglCreateWindowSurface");
-
- DALI_ASSERT_ALWAYS( mCurrentEglSurface && "Create window surface failed" );
-}
-
-EGLSurface EglImplementation::CreateSurfacePixmap( EGLNativePixmapType pixmap, ColorDepth depth )
-{
- mCurrentEglNativePixmap = pixmap;
- mColorDepth = depth;
- mIsWindow = false;
-
- // egl choose config
- ChooseConfig(mIsWindow, mColorDepth);
-
- mCurrentEglSurface = eglCreatePixmapSurface( mEglDisplay, mEglConfig, mCurrentEglNativePixmap, NULL );
- TEST_EGL_ERROR("eglCreatePixmapSurface");
-
- DALI_ASSERT_ALWAYS( mCurrentEglSurface && "Create pixmap surface failed" );
-
- return mCurrentEglSurface;
-}
-
-bool EglImplementation::ReplaceSurfaceWindow( EGLNativeWindowType window )
-{
- bool contextLost = false;
-
- // display connection has not changed, then we can just create a new surface
- // the surface is bound to the context, so set the context to null
- MakeContextNull();
-
- // destroy the surface
- DestroySurface();
-
- // create the EGL surface
- CreateSurfaceWindow( window, mColorDepth );
-
- // set the context to be current with the new surface
- MakeContextCurrent();
-
- return contextLost;
-}
-
-bool EglImplementation::ReplaceSurfacePixmap( EGLNativePixmapType pixmap, EGLSurface& eglSurface )
-{
- bool contextLost = false;
-
- // display connection has not changed, then we can just create a new surface
- // create the EGL surface
- eglSurface = CreateSurfacePixmap( pixmap, mColorDepth );
-
- // set the eglSurface to be current
- MakeCurrent( pixmap, eglSurface );
-
- return contextLost;
-}
-
-EGLDisplay EglImplementation::GetDisplay() const
-{
- return mEglDisplay;
-}
-
-EGLDisplay EglImplementation::GetContext() const
-{
- return mEglContext;
-}
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#pragma GCC diagnostic pop
+++ /dev/null
-#ifndef DALI_INTERNAL_EGL_IMPLEMENTATION_H
-#define DALI_INTERNAL_EGL_IMPLEMENTATION_H
-
-/*
- * Copyright (c) 2017 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 <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <dali/public-api/common/dali-vector.h>
-#include <dali/integration-api/core-enumerations.h>
-
-// INTERNAL INCLUDES
-#include <dali/integration-api/egl-interface.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-namespace Adaptor
-{
-
-/**
- * EglImplementation class provides an EGL implementation.
- */
-class EglImplementation : public EglInterface
-{
-public:
-
- /**
- * Constructor
- * @param[in] multiSamplingLevel The Multi-sampling level required
- * @param[in] depthBufferRequired Whether the depth buffer is required
- * @param[in] stencilBufferRequired Whether the stencil buffer is required
- */
- EglImplementation( int multiSamplingLevel,
- Integration::DepthBufferAvailable depthBufferRequired,
- Integration::StencilBufferAvailable stencilBufferRequired );
-
- /**
- * Destructor
- */
- virtual ~EglImplementation();
-
-public:
-
- /**
- * (Called from ECoreX::RenderSurface, not RenderThread, so not in i/f, hence, not virtual)
- * Initialize GL
- * @param display The display
- * @param isOwnSurface whether the surface is own or not
- * @return true on success, false on failure
- */
- bool InitializeGles( EGLNativeDisplayType display, bool isOwnSurface = true );
-
- /**
- * Create the OpenGL context.
- * @return true if successful
- */
- virtual bool CreateContext();
-
- /**
- * Destroy the OpenGL context.
- */
- void DestroyContext();
-
- /**
- * Destroy the OpenGL surface.
- */
- void DestroySurface();
-
- /**
- * Make the OpenGL context current
- */
- virtual void MakeContextCurrent();
-
- /**
- * clear the OpenGL context
- */
- void MakeContextNull();
-
- /**
- * @brief Make the OpenGL surface current
- *
- * @param pixmap The pixmap to replace the current surface
- * @param eglSurface The eglSurface to replace the current OpenGL surface.
- */
- void MakeCurrent( EGLNativePixmapType pixmap, EGLSurface eglSurface );
-
- /**
- * Terminate GL
- */
- virtual void TerminateGles();
-
- /**
- * Checks if GL is initialised
- * @return true if it is
- */
- bool IsGlesInitialized() const;
-
- /**
- * Performs an OpenGL swap buffers command
- */
- virtual void SwapBuffers();
-
- /**
- * Performs an OpenGL copy buffers command
- */
- virtual void CopyBuffers();
-
- /**
- * Performs an EGL wait GL command
- */
- virtual void WaitGL();
-
- /**
- * Choose config of egl
- * @param isWindowType whether the config for window or pixmap
- * @param colorDepth Bit per pixel value (ex. 32 or 24)
- */
- void ChooseConfig( bool isWindowType, ColorDepth depth );
-
- /**
- * Create an OpenGL surface using a window
- * @param window The window to create the surface on
- * @param colorDepth Bit per pixel value (ex. 32 or 24)
- * @return true on success, false on failure
- */
- void CreateSurfaceWindow( EGLNativeWindowType window, ColorDepth depth );
-
- /**
- * Create the OpenGL surface using a pixmap
- * @param pixmap The pixmap to create the surface on
- * @param colorDepth Bit per pixel value (ex. 32 or 24)
- * @return Handle to an off-screen EGL pixmap surface (the requester has an ownership of this egl surface)
- */
- EGLSurface CreateSurfacePixmap( EGLNativePixmapType pixmap, ColorDepth depth );
-
- /**
- * Replaces the render surface
- * @param[in] window, the window to create the new surface on
- * @return true if the context was lost due to a change in display
- * between old surface and new surface
- */
- bool ReplaceSurfaceWindow( EGLNativeWindowType window );
-
- /**
- * Replaces the render surface
- * @param[in] pixmap, the pixmap to replace the new surface on
- * @param[out] eglSurface, the eglSurface is created using a pixmap.
- * @return true if the context was lost due to a change in x-display
- * between old surface and new surface
- */
- bool ReplaceSurfacePixmap( EGLNativePixmapType pixmap, EGLSurface& eglSurface );
-
- /**
- * returns the display with which this object was initialized
- * @return the EGL Display.
- */
- EGLDisplay GetDisplay() const;
-
- /**
- * Returns the EGL context
- * @return the EGL context.
- */
- EGLContext GetContext() const;
-
-private:
-
- Vector<EGLint> mContextAttribs;
-
- EGLNativeDisplayType mEglNativeDisplay;
-
- EGLNativeWindowType mEglNativeWindow;
-
- EGLNativePixmapType mCurrentEglNativePixmap;
-
- EGLDisplay mEglDisplay;
- EGLConfig mEglConfig;
- EGLContext mEglContext;
- EGLSurface mCurrentEglSurface;
-
- int mMultiSamplingLevel;
-
- ColorDepth mColorDepth;
-
- bool mGlesInitialized;
- bool mIsOwnSurface;
- bool mContextCurrent;
- bool mIsWindow;
- bool mDepthBufferRequired;
- bool mStencilBufferRequired;
-};
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // DALI_INTERNAL_EGL_IMPLEMENTATION_H
+++ /dev/null
-/*
- * Copyright (c) 2017 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/internal/graphics/gles20/egl-sync-implementation.h>
-
-// EXTERNAL INCLUDES
-
-#ifdef _ARCH_ARM_
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <EGL/eglext.h>
-
-#endif
-
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/graphics/gles20/egl-implementation.h>
-
-#ifdef _ARCH_ARM_
-
-// function pointers
-static PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR = NULL;
-static PFNEGLCLIENTWAITSYNCKHRPROC eglClientWaitSyncKHR = NULL;
-static PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR = NULL;
-
-#endif
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-
-#ifdef _ARCH_ARM_
-
-EglSyncObject::EglSyncObject( EglImplementation& eglSyncImpl )
-: mEglSync(NULL),
- mEglImplementation(eglSyncImpl)
-{
- EGLDisplay display = mEglImplementation.GetDisplay();
- mEglSync = eglCreateSyncKHR( display, EGL_SYNC_FENCE_KHR, NULL );
- if (mEglSync == EGL_NO_SYNC_KHR)
- {
- DALI_LOG_ERROR("eglCreateSyncKHR failed %#0.4x\n", eglGetError());
- mEglSync = NULL;
- }
-}
-
-EglSyncObject::~EglSyncObject()
-{
- if( mEglSync != NULL )
- {
- eglDestroySyncKHR( mEglImplementation.GetDisplay(), mEglSync );
- EGLint error = eglGetError();
- if( EGL_SUCCESS != error )
- {
- DALI_LOG_ERROR("eglDestroySyncKHR failed %#0.4x\n", error);
- }
- }
-}
-
-bool EglSyncObject::IsSynced()
-{
- bool synced = false;
-
- if( mEglSync != NULL )
- {
- EGLint result = eglClientWaitSyncKHR( mEglImplementation.GetDisplay(), mEglSync, 0, 0ull );
- EGLint error = eglGetError();
- if( EGL_SUCCESS != error )
- {
- DALI_LOG_ERROR("eglClientWaitSyncKHR failed %#0.4x\n", error);
- }
- else if( result == EGL_CONDITION_SATISFIED_KHR )
- {
- synced = true;
- }
- }
-
- return synced;
-}
-
-EglSyncImplementation::EglSyncImplementation()
-: mEglImplementation( NULL ),
- mSyncInitialized( false ),
- mSyncInitializeFailed( false )
-{
-}
-
-EglSyncImplementation::~EglSyncImplementation()
-{
-}
-
-void EglSyncImplementation::Initialize( EglImplementation* eglImpl )
-{
- mEglImplementation = eglImpl;
-}
-
-Integration::GlSyncAbstraction::SyncObject* EglSyncImplementation::CreateSyncObject()
-{
- DALI_ASSERT_ALWAYS( mEglImplementation && "Sync Implementation not initialized" );
- if( mSyncInitialized == false )
- {
- InitializeEglSync();
- }
-
- EglSyncObject* syncObject = new EglSyncObject(*mEglImplementation);
- mSyncObjects.PushBack( syncObject );
- return syncObject;
-}
-
-void EglSyncImplementation::DestroySyncObject( Integration::GlSyncAbstraction::SyncObject* syncObject )
-{
- DALI_ASSERT_ALWAYS( mEglImplementation && "Sync Implementation not initialized" );
-
- if( mSyncInitialized == false )
- {
- InitializeEglSync();
- }
-
- for( SyncIter iter=mSyncObjects.Begin(), end=mSyncObjects.End(); iter != end; ++iter )
- {
- if( *iter == syncObject )
- {
- mSyncObjects.Erase(iter);
- break;
- }
- }
- EglSyncObject* eglSyncObject = static_cast<EglSyncObject*>(syncObject);
- delete eglSyncObject;
-}
-
-void EglSyncImplementation::InitializeEglSync()
-{
- if( ! mSyncInitializeFailed )
- {
- eglCreateSyncKHR = reinterpret_cast< PFNEGLCREATESYNCKHRPROC >( eglGetProcAddress("eglCreateSyncKHR") );
- eglClientWaitSyncKHR = reinterpret_cast< PFNEGLCLIENTWAITSYNCKHRPROC >( eglGetProcAddress("eglClientWaitSyncKHR") );
- eglDestroySyncKHR = reinterpret_cast< PFNEGLDESTROYSYNCKHRPROC >( eglGetProcAddress("eglDestroySyncKHR") );
- }
-
- if( eglCreateSyncKHR && eglClientWaitSyncKHR && eglDestroySyncKHR )
- {
- mSyncInitialized = true;
- }
- else
- {
- mSyncInitializeFailed = true;
- }
-}
-
-#else
-
-EglSyncObject::EglSyncObject( EglImplementation& eglImpl )
-: mPollCounter(3),
- mEglImplementation(eglImpl)
-{
-}
-
-EglSyncObject::~EglSyncObject()
-{
-}
-
-bool EglSyncObject::IsSynced()
-{
- if(mPollCounter <= 0)
- {
- return true;
- }
- --mPollCounter;
- return false;
-}
-
-EglSyncImplementation::EglSyncImplementation()
-: mEglImplementation( NULL ),
- mSyncInitialized( false ),
- mSyncInitializeFailed( false )
-{
-}
-
-EglSyncImplementation::~EglSyncImplementation()
-{
-}
-
-void EglSyncImplementation::Initialize( EglImplementation* eglImpl )
-{
- mEglImplementation = eglImpl;
-}
-
-Integration::GlSyncAbstraction::SyncObject* EglSyncImplementation::CreateSyncObject()
-{
- DALI_ASSERT_ALWAYS( mEglImplementation && "Sync Implementation not initialized" );
- return new EglSyncObject(*mEglImplementation);
-}
-
-void EglSyncImplementation::DestroySyncObject(Integration::GlSyncAbstraction::SyncObject* syncObject)
-{
- DALI_ASSERT_ALWAYS( mEglImplementation && "Sync Implementation not initialized" );
-
- // The abstraction's virtual destructor is protected, so that Core can't delete the sync objects
- // directly (This object also needs removing from the mSyncObject container in the ARM
- // implementation above). We therefore need to cast to the actual implementation object first.
- EglSyncObject* eglSyncObject = static_cast<EglSyncObject*>(syncObject);
- delete eglSyncObject;
-}
-
-void EglSyncImplementation::InitializeEglSync()
-{
-}
-
-#endif
-
-} // namespace Dali
-} // namespace Internal
-} // namespace Adaptor
+++ /dev/null
-#ifndef __DALI_INTERNAL_ADAPTOR_EGL_SYNC_IMPLEMENTATION_H__
-#define __DALI_INTERNAL_ADAPTOR_EGL_SYNC_IMPLEMENTATION_H__
-
-/*
- * Copyright (c) 2018 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 <EGL/egl.h>
-#include <EGL/eglext.h>
-#include <dali/public-api/common/dali-vector.h>
-#include <dali/integration-api/gl-sync-abstraction.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/dali-adaptor-common.h>
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-class EglImplementation;
-
-class EglSyncObject : public Integration::GlSyncAbstraction::SyncObject
-{
-public:
- /**
- * Constructor
- */
- EglSyncObject( EglImplementation& eglSyncImpl );
-
- /**
- * Destructor
- */
- virtual ~EglSyncObject();
-
- /**
- * @copydoc Dali::Integration::GlSyncAbstraction::SyncObject::IsSynced()
- */
- virtual bool IsSynced();
-
-private:
-#ifdef _ARCH_ARM_
- EGLSyncKHR mEglSync;
-#else
- int mPollCounter; // Implementations without fence sync use a 3 frame counter
-#endif
- EglImplementation& mEglImplementation;
-};
-
-
-/**
- * GlSyncImplementation is a concrete implementation for GlSyncAbstraction.
- * It provides fence syncing for resources such as FrameBuffers using EGL extensions
- *
- * Sync objects are created in the render thread after a render instruction
- * has been processed (i.e. GL draw calls have completed for a given FB), and
- * tested in the update
- */
-class EglSyncImplementation : public Integration::GlSyncAbstraction
-{
-public:
- /**
- * Constructor
- */
- EglSyncImplementation();
-
- /**
- * Destructor
- */
- virtual ~EglSyncImplementation();
-
- /**
- * Initialize the sync object with the Egl implementation.
- * @param[in] impl The EGL implementation (to access display)
- */
- void Initialize( EglImplementation* impl );
-
- /**
- * @copydoc Dali::Integration::GlSyncAbstraction::CreateSyncObject()
- */
- virtual SyncObject* CreateSyncObject();
-
- /**
- * @copydoc Dali::Integration::GlSyncAbstraction::DestroySyncObject()
- */
- virtual void DestroySyncObject(SyncObject* syncObject);
-
-private:
- /**
- * Set up the function pointers
- */
- void InitializeEglSync();
-
-private:
- typedef Vector<EglSyncObject*> SyncContainer;
- typedef SyncContainer::Iterator SyncIter;
-
- EglImplementation* mEglImplementation; ///< Egl implementation (to get display)
- bool mSyncInitialized; ///< Flag to perform initialization on first use
- bool mSyncInitializeFailed; ///< Flag to avoid reloading functions if failed once
-
- SyncContainer mSyncObjects;
-};
-
-} // namespace Adaptor
-} // namespace Internal
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_EGL_ADAPTOR_SYNC_IMPLEMENTATION_H__
+++ /dev/null
-/*
- * Copyright (c) 2017 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/internal/graphics/gles20/gl-extensions.h>
-
-// EXTERNAL INCLUDES
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include <dali/integration-api/debug.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-namespace ECoreX
-{
-
-GlExtensions::GlExtensions()
-:
-#if DALI_GLES_VERSION < 30
-#ifdef GL_EXT_discard_framebuffer
- mGlDiscardFramebuffer( NULL ),
-#endif
-#ifdef GL_OES_get_program_binary
- mGlGetProgramBinaryOES( NULL ),
- mGlProgramBinaryOES( NULL ),
-#endif
-#endif // DALI_GLES_VERSION < 30
- mInitialized( false )
-{
-}
-
-GlExtensions::~GlExtensions()
-{
-}
-
-#if DALI_GLES_VERSION < 30
-
-void GlExtensions::DiscardFrameBuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
-{
- // initialize extension on first use as on some hw platforms a context
- // has to be bound for the extensions to return correct pointer
- if( !mInitialized )
- {
- Initialize();
- }
-
-#ifdef GL_EXT_discard_framebuffer
- if( mGlDiscardFramebuffer )
- {
- mGlDiscardFramebuffer(target, numAttachments, attachments);
- }
- else
- {
- DALI_LOG_ERROR("Error: glDiscardFramebufferEXT extension is not available\n");
- }
-#endif
-}
-
-void GlExtensions::GetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary)
-{
- // initialize extension on first use as on some hw platforms a context
- // has to be bound for the extensions to return correct pointer
- if( !mInitialized )
- {
- Initialize();
- }
-
-#ifdef GL_OES_get_program_binary
- if (mGlGetProgramBinaryOES)
- {
- mGlGetProgramBinaryOES(program, bufSize, length, binaryFormat, binary);
- }
- else
- {
- DALI_LOG_ERROR("Error: glGetProgramBinaryOES extension is not available\n");
- DALI_ASSERT_DEBUG(0);
- }
-#endif
-}
-
-void GlExtensions::ProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length)
-{
- // initialize extension on first use as on some hw platforms a context
- // has to be bound for the extensions to return correct pointer
- if( !mInitialized )
- {
- Initialize();
- }
-
-#ifdef GL_OES_get_program_binary
- if (mGlProgramBinaryOES)
- {
- mGlProgramBinaryOES(program, binaryFormat, binary, length);
- }
- else
- {
- DALI_LOG_ERROR("Error: glProgramBinaryOES extension is not available\n");
- DALI_ASSERT_DEBUG(0);
- }
-#endif
-}
-
-void GlExtensions::Initialize()
-{
- mInitialized = true;
-
-#ifdef GL_EXT_discard_framebuffer
- mGlDiscardFramebuffer = reinterpret_cast< PFNGLDISCARDFRAMEBUFFEREXTPROC >( eglGetProcAddress("glDiscardFramebufferEXT") );
-#endif
-
-#ifdef GL_OES_get_program_binary
- mGlGetProgramBinaryOES = reinterpret_cast< PFNGLGETPROGRAMBINARYOESPROC >( eglGetProcAddress("glGetProgramBinaryOES") );
- mGlProgramBinaryOES = reinterpret_cast< PFNGLPROGRAMBINARYOESPROC >( eglGetProcAddress("glProgramBinaryOES") );
-#endif
-}
-
-#endif // DALI_GLES_VERSION < 30
-
-} // namespace ECoreX
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_GL_EXTENSION_H__
-#define __DALI_INTERNAL_GL_EXTENSION_H__
-
-/*
- * Copyright (c) 2014 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
-
-#if DALI_GLES_VERSION >= 30
-#include <GLES3/gl3.h>
-#include <GLES3/gl3ext.h>
-#else
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#endif
-
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-namespace ECoreX
-{
-
-/**
- * GlExtensions class provides GL extensions support
- */
-class GlExtensions
-{
-public:
-
- /**
- * Constructor
- */
- GlExtensions();
-
- /**
- * Destructor
- */
- ~GlExtensions();
-
-
-public:
-
-#if DALI_GLES_VERSION < 30
-
- /**
- * If the GL extension is available this function discards specified data in attachments
- * from being copied from the target to improve performance.
- *
- * Usage: GLenum attachments[] = { GL_DEPTH_ATTACHMENT, GL_STENCIL_ATTACHMENT };
- * DiscardFrameBufferEXT(GL_FRAMEBUFFER, 2, attachments);
- *
- * @param target is usually GL_FRAMEBUFFER
- * @param numAttachments is the count of attachments
- * @param attachments is a pointer to the attachments
- */
- void DiscardFrameBuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-
- /**
- * GLES extension
- * Returns the program object's executable bytecode.
- * @param[in] program The program object's name/id
- * @param[in] bufSize The maximum number of bytes that may be written into binary
- * @param[out] length The actual number of bytes written into binary
- * @param[out] binaryFormat The format of the program binary
- * @param[out] binary The actual program bytecode
- */
- void GetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary);
-
- /**
- * GLES extension
- * Loads a program object with a program binary previously returned from GetProgramBinaryOES
- * @param[in] program The program object's name/id
- * @param[in] binaryFormat The format of the program binary
- * @param[in] binary The program bytecode
- * @param[in] length The number of bytes in binary
- */
- void ProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length);
-
-#endif // DALI_GLES_VERSION < 30
-
-private:
-
- /**
- * Lazy Initialize extensions on first use
- */
- void Initialize();
-
-#if DALI_GLES_VERSION < 30
-
-#ifdef GL_EXT_discard_framebuffer
- PFNGLDISCARDFRAMEBUFFEREXTPROC mGlDiscardFramebuffer;
-#endif
-
-#ifdef GL_OES_get_program_binary
- PFNGLGETPROGRAMBINARYOESPROC mGlGetProgramBinaryOES;
- PFNGLPROGRAMBINARYOESPROC mGlProgramBinaryOES;
-#endif
-
-#endif // DALI_GLES_VERSION < 30
-
- bool mInitialized;
-
-};
-
-} // namespace ECoreX
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif /* __DALI_INTERNAL_GL_EXTENSION_H__ */
+++ /dev/null
-#ifndef __DALI_INTERNAL_GL_IMPLEMENTATION_H__
-#define __DALI_INTERNAL_GL_IMPLEMENTATION_H__
-
-/*
- * Copyright (c) 2017 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
-#ifndef DALI_GLES_VERSION
-#error "OpenGL ES version not specified"
-#endif
-
-#if DALI_GLES_VERSION >= 31
-#include <GLES3/gl31.h>
-#elif DALI_GLES_VERSION >= 30
-#include <GLES3/gl3.h>
-#else
-#include <cstdlib>
-#include <GLES2/gl2.h>
-#endif
-
-#include <dali/integration-api/gl-abstraction.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/graphics/gles20/gl-extensions.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-/**
- * GlImplementation is a concrete implementation for GlAbstraction.
- * The class provides an OpenGL-ES 2.0 implementation.
- * The class is provided when creating the Integration::Core object.
- */
-class GlImplementation: public Dali::Integration::GlAbstraction
-{
-
-public:
- virtual ~GlImplementation() {}
-
- void PreRender()
- {
- /* Do nothing in main implementation */
- }
-
- void PostRender()
- {
- /* Do nothing in main implementation */
- }
-
- /* OpenGL ES 2.0 */
-
- void ActiveTexture (GLenum texture)
- {
- glActiveTexture(texture);
- }
-
- void AttachShader (GLuint program, GLuint shader)
- {
- glAttachShader(program,shader);
- }
-
- void BindAttribLocation (GLuint program, GLuint index, const char* name)
- {
- glBindAttribLocation(program,index,name);
- }
-
- void BindBuffer (GLenum target, GLuint buffer)
- {
- glBindBuffer(target,buffer);
- }
-
- void BindFramebuffer (GLenum target, GLuint framebuffer)
- {
- glBindFramebuffer(target,framebuffer);
- }
-
- void BindRenderbuffer (GLenum target, GLuint renderbuffer)
- {
- glBindRenderbuffer(target,renderbuffer);
- }
-
- void BindTexture (GLenum target, GLuint texture)
- {
- glBindTexture(target,texture);
- }
-
- void BlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
- {
- glBlendColor(red,green,blue,alpha);
- }
-
- void BlendEquation ( GLenum mode )
- {
- glBlendEquation(mode);
- }
-
- void BlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha)
- {
- glBlendEquationSeparate(modeRGB,modeAlpha);
- }
-
- void BlendFunc (GLenum sfactor, GLenum dfactor)
- {
- glBlendFunc(sfactor,dfactor);
- }
-
- void BlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
- {
- glBlendFuncSeparate(srcRGB,dstRGB,srcAlpha,dstAlpha);
- }
-
- void BufferData (GLenum target, GLsizeiptr size, const void* data, GLenum usage)
- {
- glBufferData(target,size,data,usage);
- }
-
- void BufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void* data)
- {
- glBufferSubData(target,offset,size,data);
- }
-
- GLenum CheckFramebufferStatus (GLenum target)
- {
- return glCheckFramebufferStatus(target);
- }
-
- void Clear (GLbitfield mask)
- {
- glClear(mask);
- }
-
- void ClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
- {
- glClearColor(red,green,blue,alpha);
- }
-
- void ClearDepthf (GLclampf depth)
- {
- glClearDepthf(depth);
- }
-
- void ClearStencil (GLint s)
- {
- glClearStencil(s);
- }
-
- void ColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
- {
- glColorMask(red,green,blue,alpha);
- }
-
- void CompileShader (GLuint shader)
- {
- glCompileShader(shader);
- }
-
- void CompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
- {
- glCompressedTexImage2D(target,level,internalformat,width,height,border,imageSize,data);
- }
-
- void CompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
- {
- glCompressedTexSubImage2D(target,level,xoffset,yoffset,width,height,format,imageSize,data);
- }
-
- void CopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
- {
- glCopyTexImage2D(target,level,internalformat,x,y,width,height,border);
- }
-
- void CopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
- {
- glCopyTexSubImage2D(target,level,xoffset,yoffset,x,y,width,height);
- }
-
- GLuint CreateProgram (void)
- {
- return glCreateProgram();
- }
-
- GLuint CreateShader (GLenum type)
- {
- return glCreateShader(type);
- }
-
- void CullFace (GLenum mode)
- {
- glCullFace(mode);
- }
-
- void DeleteBuffers (GLsizei n, const GLuint* buffers)
- {
- glDeleteBuffers(n,buffers);
- }
-
- void DeleteFramebuffers (GLsizei n, const GLuint* framebuffers)
- {
- glDeleteFramebuffers(n,framebuffers);
- }
-
- void DeleteProgram (GLuint program)
- {
- glDeleteProgram(program);
- }
-
- void DeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers)
- {
- glDeleteRenderbuffers(n,renderbuffers);
- }
-
- void DeleteShader (GLuint shader)
- {
- glDeleteShader(shader);
- }
-
- void DeleteTextures (GLsizei n, const GLuint* textures)
- {
- glDeleteTextures(n,textures);
- }
-
- void DepthFunc (GLenum func)
- {
- glDepthFunc(func);
- }
-
- void DepthMask (GLboolean flag)
- {
- glDepthMask(flag);
- }
-
- void DepthRangef (GLclampf zNear, GLclampf zFar)
- {
- glDepthRangef(zNear,zFar);
- }
-
- void DetachShader (GLuint program, GLuint shader)
- {
- glDetachShader(program,shader);
- }
-
- void Disable (GLenum cap)
- {
- glDisable(cap);
- }
-
- void DisableVertexAttribArray (GLuint index)
- {
- glDisableVertexAttribArray(index);
- }
-
- void DrawArrays (GLenum mode, GLint first, GLsizei count)
- {
- glDrawArrays(mode,first,count);
- }
-
- void DrawElements (GLenum mode, GLsizei count, GLenum type, const void* indices)
- {
- glDrawElements(mode,count,type,indices);
- }
-
- void Enable (GLenum cap)
- {
- glEnable(cap);
- }
-
- void EnableVertexAttribArray (GLuint index)
- {
- glEnableVertexAttribArray(index);
- }
-
- void Finish (void)
- {
- glFinish();
- }
-
- void Flush (void)
- {
- glFlush();
- }
-
- void FramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
- {
- glFramebufferRenderbuffer(target,attachment,renderbuffertarget,renderbuffer);
- }
-
- void FramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
- {
- glFramebufferTexture2D(target,attachment,textarget,texture,level);
- }
-
- void FrontFace (GLenum mode)
- {
- glFrontFace(mode);
- }
-
- void GenBuffers (GLsizei n, GLuint* buffers)
- {
- glGenBuffers(n,buffers);
- }
-
- void GenerateMipmap (GLenum target)
- {
- glGenerateMipmap(target);
- }
-
- void GenFramebuffers (GLsizei n, GLuint* framebuffers)
- {
- glGenFramebuffers(n,framebuffers);
- }
-
- void GenRenderbuffers (GLsizei n, GLuint* renderbuffers)
- {
- glGenRenderbuffers(n,renderbuffers);
- }
-
- void GenTextures (GLsizei n, GLuint* textures)
- {
- glGenTextures(n,textures);
- }
-
- void GetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
- {
- glGetActiveAttrib(program,index,bufsize,length,size,type,name);
- }
-
- void GetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
- {
- glGetActiveUniform(program,index,bufsize,length,size,type,name);
- }
-
- void GetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
- {
- glGetAttachedShaders(program,maxcount,count,shaders);
- }
-
- int GetAttribLocation (GLuint program, const char* name)
- {
- return glGetAttribLocation(program,name);
- }
-
- void GetBooleanv (GLenum pname, GLboolean* params)
- {
- glGetBooleanv(pname,params);
- }
-
- void GetBufferParameteriv (GLenum target, GLenum pname, GLint* params)
- {
- glGetBufferParameteriv(target,pname,params);
- }
-
- GLenum GetError (void)
- {
- return glGetError();
- }
-
- void GetFloatv (GLenum pname, GLfloat* params)
- {
- glGetFloatv(pname,params);
- }
-
- void GetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params)
- {
- glGetFramebufferAttachmentParameteriv(target,attachment,pname,params);
- }
-
- void GetIntegerv (GLenum pname, GLint* params)
- {
- glGetIntegerv(pname,params);
- }
-
- void GetProgramiv (GLuint program, GLenum pname, GLint* params)
- {
- glGetProgramiv(program,pname,params);
- }
-
- void GetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
- {
- glGetProgramInfoLog(program,bufsize,length,infolog);
- }
-
- void GetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params)
- {
- glGetRenderbufferParameteriv(target,pname,params);
- }
-
- void GetShaderiv (GLuint shader, GLenum pname, GLint* params)
- {
- glGetShaderiv(shader,pname,params);
- }
-
- void GetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
- {
- glGetShaderInfoLog(shader,bufsize,length,infolog);
- }
-
- void GetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
- {
- glGetShaderPrecisionFormat(shadertype,precisiontype,range,precision);
- }
-
- void GetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
- {
- glGetShaderSource(shader,bufsize,length,source);
- }
-
- const GLubyte* GetString (GLenum name)
- {
- return glGetString(name);
- }
-
- void GetTexParameterfv (GLenum target, GLenum pname, GLfloat* params)
- {
- glGetTexParameterfv(target,pname,params);
- }
-
- void GetTexParameteriv (GLenum target, GLenum pname, GLint* params)
- {
- glGetTexParameteriv(target,pname,params);
- }
-
- void GetUniformfv (GLuint program, GLint location, GLfloat* params)
- {
- glGetUniformfv(program,location,params);
- }
-
- void GetUniformiv (GLuint program, GLint location, GLint* params)
- {
- glGetUniformiv(program,location,params);
- }
-
- int GetUniformLocation (GLuint program, const char* name)
- {
- return glGetUniformLocation(program,name);
- }
-
- void GetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params)
- {
- glGetVertexAttribfv(index,pname,params);
- }
-
- void GetVertexAttribiv (GLuint index, GLenum pname, GLint* params)
- {
- glGetVertexAttribiv(index,pname,params);
- }
-
- void GetVertexAttribPointerv (GLuint index, GLenum pname, void** pointer)
- {
- glGetVertexAttribPointerv(index,pname,pointer);
- }
-
- void Hint (GLenum target, GLenum mode)
- {
- glHint(target,mode);
- }
-
- GLboolean IsBuffer (GLuint buffer)
- {
- return glIsBuffer(buffer);
- }
-
- GLboolean IsEnabled (GLenum cap)
- {
- return glIsEnabled(cap);
- }
-
- GLboolean IsFramebuffer (GLuint framebuffer)
- {
- return glIsFramebuffer(framebuffer);
- }
-
- GLboolean IsProgram (GLuint program)
- {
- return glIsProgram(program);
- }
-
- GLboolean IsRenderbuffer (GLuint renderbuffer)
- {
- return glIsRenderbuffer(renderbuffer);
- }
-
- GLboolean IsShader (GLuint shader)
- {
- return glIsShader(shader);
- }
-
- GLboolean IsTexture (GLuint texture)
- {
- return glIsTexture(texture);
- }
-
- void LineWidth (GLfloat width)
- {
- glLineWidth(width);
- }
-
- void LinkProgram (GLuint program)
- {
- glLinkProgram(program);
- }
-
- void PixelStorei (GLenum pname, GLint param)
- {
- glPixelStorei(pname,param);
- }
-
- void PolygonOffset (GLfloat factor, GLfloat units)
- {
- glPolygonOffset(factor,units);
- }
-
- void ReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
- {
- glReadPixels(x,y,width,height,format,type,pixels);
- }
-
- void ReleaseShaderCompiler (void)
- {
- glReleaseShaderCompiler();
- }
-
- void RenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
- {
- glRenderbufferStorage(target,internalformat,width,height);
- }
-
- void SampleCoverage (GLclampf value, GLboolean invert)
- {
- glSampleCoverage(value,invert);
- }
-
- void Scissor (GLint x, GLint y, GLsizei width, GLsizei height)
- {
- glScissor(x,y,width,height);
- }
-
- void ShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
- {
- glShaderBinary(n,shaders,binaryformat,binary,length);
- }
-
- void ShaderSource (GLuint shader, GLsizei count, const char** string, const GLint* length)
- {
- glShaderSource(shader,count,string,length);
- }
-
- void StencilFunc (GLenum func, GLint ref, GLuint mask)
- {
- glStencilFunc(func,ref,mask);
- }
-
- void StencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask)
- {
- glStencilFuncSeparate(face,func,ref,mask);
- }
-
- void StencilMask (GLuint mask)
- {
- glStencilMask(mask);
- }
-
- void StencilMaskSeparate (GLenum face, GLuint mask)
- {
- glStencilMaskSeparate(face,mask);
- }
-
- void StencilOp (GLenum fail, GLenum zfail, GLenum zpass)
- {
- glStencilOp(fail,zfail,zpass);
- }
-
- void StencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
- {
- glStencilOpSeparate(face,fail,zfail,zpass);
- }
-
- void TexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
- {
- glTexImage2D(target,level,internalformat,width,height,border,format,type,pixels);
- }
-
- void TexParameterf (GLenum target, GLenum pname, GLfloat param)
- {
- glTexParameterf(target,pname,param);
- }
-
- void TexParameterfv (GLenum target, GLenum pname, const GLfloat* params)
- {
- glTexParameterfv(target,pname,params);
- }
-
- void TexParameteri (GLenum target, GLenum pname, GLint param)
- {
- glTexParameteri(target,pname,param);
- }
-
- void TexParameteriv (GLenum target, GLenum pname, const GLint* params)
- {
- glTexParameteriv(target,pname,params);
- }
-
- void TexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
- {
- glTexSubImage2D(target,level,xoffset,yoffset,width,height,format,type,pixels);
- }
-
- void Uniform1f (GLint location, GLfloat x)
- {
- glUniform1f(location,x);
- }
-
- void Uniform1fv (GLint location, GLsizei count, const GLfloat* v)
- {
- glUniform1fv(location,count,v);
- }
-
- void Uniform1i (GLint location, GLint x)
- {
- glUniform1i(location,x);
- }
-
- void Uniform1iv (GLint location, GLsizei count, const GLint* v)
- {
- glUniform1iv(location,count,v);
- }
-
- void Uniform2f (GLint location, GLfloat x, GLfloat y)
- {
- glUniform2f(location,x,y);
- }
-
- void Uniform2fv (GLint location, GLsizei count, const GLfloat* v)
- {
- glUniform2fv(location,count,v);
- }
-
- void Uniform2i (GLint location, GLint x, GLint y)
- {
- glUniform2i(location,x,y);
- }
-
- void Uniform2iv (GLint location, GLsizei count, const GLint* v)
- {
- glUniform2iv(location,count,v);
- }
-
- void Uniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z)
- {
- glUniform3f(location,x,y,z);
- }
-
- void Uniform3fv (GLint location, GLsizei count, const GLfloat* v)
- {
- glUniform3fv(location,count,v);
- }
-
- void Uniform3i (GLint location, GLint x, GLint y, GLint z)
- {
- glUniform3i(location,x,y,z);
- }
-
- void Uniform3iv (GLint location, GLsizei count, const GLint* v)
- {
- glUniform3iv(location,count,v);
- }
-
- void Uniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
- {
- glUniform4f(location,x,y,z,w);
- }
-
- void Uniform4fv (GLint location, GLsizei count, const GLfloat* v)
- {
- glUniform4fv(location,count,v);
- }
-
- void Uniform4i (GLint location, GLint x, GLint y, GLint z, GLint w)
- {
- glUniform4i(location,x,y,z,w);
- }
-
- void Uniform4iv (GLint location, GLsizei count, const GLint* v)
- {
- glUniform4iv(location,count,v);
- }
-
- void UniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
- {
- glUniformMatrix2fv(location,count,transpose,value);
- }
-
- void UniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
- {
- glUniformMatrix3fv(location,count,transpose,value);
- }
-
- void UniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
- {
- glUniformMatrix4fv(location,count,transpose,value);
- }
-
- void UseProgram (GLuint program)
- {
- glUseProgram(program);
- }
-
- void ValidateProgram (GLuint program)
- {
- glValidateProgram(program);
- }
-
- void VertexAttrib1f (GLuint indx, GLfloat x)
- {
- glVertexAttrib1f(indx,x);
- }
-
- void VertexAttrib1fv (GLuint indx, const GLfloat* values)
- {
- glVertexAttrib1fv(indx,values);
- }
-
- void VertexAttrib2f (GLuint indx, GLfloat x, GLfloat y)
- {
- glVertexAttrib2f(indx,x,y);
- }
-
- void VertexAttrib2fv (GLuint indx, const GLfloat* values)
- {
- glVertexAttrib2fv(indx,values);
- }
-
- void VertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z)
- {
- glVertexAttrib3f(indx,x,y,z);
- }
-
- void VertexAttrib3fv (GLuint indx, const GLfloat* values)
- {
- glVertexAttrib3fv(indx,values);
- }
-
- void VertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
- {
- glVertexAttrib4f(indx,x,y,z,w);
- }
-
- void VertexAttrib4fv (GLuint indx, const GLfloat* values)
- {
- glVertexAttrib4fv(indx,values);
- }
-
- void VertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
- {
- glVertexAttribPointer(indx,size,type,normalized,stride,ptr);
- }
-
- void Viewport (GLint x, GLint y, GLsizei width, GLsizei height)
- {
- glViewport(x,y,width,height);
- }
-
- /* OpenGL ES 3.0 */
-
- void ReadBuffer(GLenum mode)
- {
-#if DALI_GLES_VERSION >= 30
- glReadBuffer(mode);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices)
- {
-#if DALI_GLES_VERSION >= 30
- glDrawRangeElements(mode,start,end,count,type,indices);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels)
- {
-#if DALI_GLES_VERSION >= 30
- glTexImage3D(target,level,internalformat,width,height,depth,border,format,type,pixels);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
- {
-#if DALI_GLES_VERSION >= 30
- glTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,type,pixels);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
- {
-#if DALI_GLES_VERSION >= 30
- glCopyTexSubImage3D(target,level,xoffset,yoffset,zoffset,x,y,width,height);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data)
- {
-#if DALI_GLES_VERSION >= 30
- glCompressedTexImage3D(target,level,internalformat,width,height,depth,border,imageSize,data);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data)
- {
-#if DALI_GLES_VERSION >= 30
- glCompressedTexSubImage3D(target,level,xoffset,yoffset,zoffset,width,height,depth,format,imageSize,data);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GenQueries(GLsizei n, GLuint* ids)
- {
-#if DALI_GLES_VERSION >= 30
- glGenQueries(n,ids);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void DeleteQueries(GLsizei n, const GLuint* ids)
- {
-#if DALI_GLES_VERSION >= 30
- glDeleteQueries(n,ids);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- GLboolean IsQuery(GLuint id)
- {
-#if DALI_GLES_VERSION >= 30
- return glIsQuery(id);
-#else
- return 0;
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void BeginQuery(GLenum target, GLuint id)
- {
-#if DALI_GLES_VERSION >= 30
- glBeginQuery(target,id);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void EndQuery(GLenum target)
- {
-#if DALI_GLES_VERSION >= 30
- glEndQuery(target);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetQueryiv(GLenum target, GLenum pname, GLint* params)
- {
-#if DALI_GLES_VERSION >= 30
- glGetQueryiv(target,pname,params);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params)
- {
-#if DALI_GLES_VERSION >= 30
- glGetQueryObjectuiv(id,pname,params);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- GLboolean UnmapBuffer(GLenum target)
- {
-#if DALI_GLES_VERSION >= 30
- return glUnmapBuffer(target);
-#else
- return 0;
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params)
- {
-#if DALI_GLES_VERSION >= 30
- glGetBufferPointerv(target,pname,params);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void DrawBuffers(GLsizei n, const GLenum* bufs)
- {
-#if DALI_GLES_VERSION >= 30
- glDrawBuffers(n,bufs);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
- {
-#if DALI_GLES_VERSION >= 30
- glUniformMatrix2x3fv(location,count,transpose,value);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
- {
-#if DALI_GLES_VERSION >= 30
- glUniformMatrix3x2fv(location,count,transpose,value);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
- {
-#if DALI_GLES_VERSION >= 30
- glUniformMatrix2x4fv(location,count,transpose,value);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
- {
-#if DALI_GLES_VERSION >= 30
- glUniformMatrix4x2fv(location,count,transpose,value);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
- {
-#if DALI_GLES_VERSION >= 30
- glUniformMatrix3x4fv(location,count,transpose,value);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
- {
-#if DALI_GLES_VERSION >= 30
- glUniformMatrix4x3fv(location,count,transpose,value);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
- {
-#if DALI_GLES_VERSION >= 30
- glBlitFramebuffer(srcX0,srcY0,srcX1,srcY1,dstX0,dstY0,dstX1,dstY1,mask,filter);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
- {
-#if DALI_GLES_VERSION >= 30
- glRenderbufferStorageMultisample(target,samples,internalformat,width,height);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
- {
-#if DALI_GLES_VERSION >= 30
- glFramebufferTextureLayer(target,attachment,texture,level,layer);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- GLvoid* MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
- {
-#if DALI_GLES_VERSION >= 30
- return glMapBufferRange(target,offset,length,access);
-#else
- return NULL;
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
- {
-#if DALI_GLES_VERSION >= 30
- glFlushMappedBufferRange(target,offset,length);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void BindVertexArray(GLuint array)
- {
-#if DALI_GLES_VERSION >= 30
- glBindVertexArray(array);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void DeleteVertexArrays(GLsizei n, const GLuint* arrays)
- {
-#if DALI_GLES_VERSION >= 30
- glDeleteVertexArrays(n,arrays);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GenVertexArrays(GLsizei n, GLuint* arrays)
- {
-#if DALI_GLES_VERSION >= 30
- glGenVertexArrays(n,arrays);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- GLboolean IsVertexArray(GLuint array)
- {
-#if DALI_GLES_VERSION >= 30
- return glIsVertexArray(array);
-#else
- return 0;
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetIntegeri_v(GLenum target, GLuint index, GLint* data)
- {
-#if DALI_GLES_VERSION >= 30
- glGetIntegeri_v(target,index,data);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void BeginTransformFeedback(GLenum primitiveMode)
- {
-#if DALI_GLES_VERSION >= 30
- glBeginTransformFeedback(primitiveMode);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void EndTransformFeedback(void)
- {
-#if DALI_GLES_VERSION >= 30
- glEndTransformFeedback();
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
- {
-#if DALI_GLES_VERSION >= 30
- glBindBufferRange(target,index,buffer,offset,size);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void BindBufferBase(GLenum target, GLuint index, GLuint buffer)
- {
-#if DALI_GLES_VERSION >= 30
- glBindBufferBase(target,index,buffer);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode)
- {
-#if DALI_GLES_VERSION >= 30
- glTransformFeedbackVaryings(program,count,varyings,bufferMode);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name)
- {
-#if DALI_GLES_VERSION >= 30
- glGetTransformFeedbackVarying(program,index,bufSize,length,size,type,name);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer)
- {
-#if DALI_GLES_VERSION >= 30
- glVertexAttribIPointer(index,size,type,stride,pointer);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params)
- {
-#if DALI_GLES_VERSION >= 30
- glGetVertexAttribIiv(index,pname,params);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params)
- {
-#if DALI_GLES_VERSION >= 30
- glGetVertexAttribIuiv(index,pname,params);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
- {
-#if DALI_GLES_VERSION >= 30
- glVertexAttribI4i(index,x,y,z,w);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
- {
-#if DALI_GLES_VERSION >= 30
- glVertexAttribI4ui(index,x,y,z,w);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void VertexAttribI4iv(GLuint index, const GLint* v)
- {
-#if DALI_GLES_VERSION >= 30
- glVertexAttribI4iv(index,v);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void VertexAttribI4uiv(GLuint index, const GLuint* v)
- {
-#if DALI_GLES_VERSION >= 30
- glVertexAttribI4uiv(index,v);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetUniformuiv(GLuint program, GLint location, GLuint* params)
- {
-#if DALI_GLES_VERSION >= 30
- glGetUniformuiv(program,location,params);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- GLint GetFragDataLocation(GLuint program, const GLchar *name)
- {
-#if DALI_GLES_VERSION >= 30
- return glGetFragDataLocation(program,name);
-#else
- return -1;
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void Uniform1ui(GLint location, GLuint v0)
- {
-#if DALI_GLES_VERSION >= 30
- glUniform1ui(location,v0);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void Uniform2ui(GLint location, GLuint v0, GLuint v1)
- {
-#if DALI_GLES_VERSION >= 30
- glUniform2ui(location,v0,v1);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
- {
-#if DALI_GLES_VERSION >= 30
- glUniform3ui(location,v0,v1,v2);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
- {
-#if DALI_GLES_VERSION >= 30
- glUniform4ui(location,v0,v1,v2,v3);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void Uniform1uiv(GLint location, GLsizei count, const GLuint* value)
- {
-#if DALI_GLES_VERSION >= 30
- glUniform1uiv(location,count,value);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void Uniform2uiv(GLint location, GLsizei count, const GLuint* value)
- {
-#if DALI_GLES_VERSION >= 30
- glUniform2uiv(location,count,value);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void Uniform3uiv(GLint location, GLsizei count, const GLuint* value)
- {
-#if DALI_GLES_VERSION >= 30
- glUniform3uiv(location,count,value);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void Uniform4uiv(GLint location, GLsizei count, const GLuint* value)
- {
-#if DALI_GLES_VERSION >= 30
- glUniform4uiv(location,count,value);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value)
- {
-#if DALI_GLES_VERSION >= 30
- glClearBufferiv(buffer,drawbuffer,value);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value)
- {
-#if DALI_GLES_VERSION >= 30
- glClearBufferuiv(buffer,drawbuffer,value);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value)
- {
-#if DALI_GLES_VERSION >= 30
- glClearBufferfv(buffer,drawbuffer,value);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
- {
-#if DALI_GLES_VERSION >= 30
- glClearBufferfi(buffer,drawbuffer,depth,stencil);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- const GLubyte* GetStringi(GLenum name, GLuint index)
- {
-#if DALI_GLES_VERSION >= 30
- return glGetStringi(name,index);
-#else
- return NULL;
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
- {
-#if DALI_GLES_VERSION >= 30
- glCopyBufferSubData(readTarget,writeTarget,readOffset,writeOffset,size);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices)
- {
-#if DALI_GLES_VERSION >= 30
- glGetUniformIndices(program,uniformCount,uniformNames,uniformIndices);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params)
- {
-#if DALI_GLES_VERSION >= 30
- glGetActiveUniformsiv(program,uniformCount,uniformIndices,pname,params);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- GLuint GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName)
- {
-#if DALI_GLES_VERSION >= 30
- return glGetUniformBlockIndex(program,uniformBlockName);
-#else
- return 0;
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params)
- {
-#if DALI_GLES_VERSION >= 30
- glGetActiveUniformBlockiv(program,uniformBlockIndex,pname,params);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName)
- {
-#if DALI_GLES_VERSION >= 30
- glGetActiveUniformBlockName(program,uniformBlockIndex,bufSize,length,uniformBlockName);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
- {
-#if DALI_GLES_VERSION >= 30
- glUniformBlockBinding(program,uniformBlockIndex,uniformBlockBinding);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
- {
-#if DALI_GLES_VERSION >= 30
- glDrawArraysInstanced(mode,first,count,instanceCount);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount)
- {
-#if DALI_GLES_VERSION >= 30
- glDrawElementsInstanced(mode,count,type,indices,instanceCount);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- GLsync FenceSync(GLenum condition, GLbitfield flags)
- {
-#if DALI_GLES_VERSION >= 30
- return glFenceSync(condition,flags);
-#else
- return NULL;
-#endif // DALI_GLES_VERSION >= 30
- }
-
- GLboolean IsSync(GLsync sync)
- {
-#if DALI_GLES_VERSION >= 30
- return glIsSync(sync);
-#else
- return 0;
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void DeleteSync(GLsync sync)
- {
-#if DALI_GLES_VERSION >= 30
- glDeleteSync(sync);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- GLenum ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
- {
-#if DALI_GLES_VERSION >= 30
- return glClientWaitSync(sync,flags,timeout);
-#else
- return 0;
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
- {
-#if DALI_GLES_VERSION >= 30
- glWaitSync(sync,flags,timeout);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetInteger64v(GLenum pname, GLint64* params)
- {
-#if DALI_GLES_VERSION >= 30
- glGetInteger64v(pname,params);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values)
- {
-#if DALI_GLES_VERSION >= 30
- glGetSynciv(sync,pname,bufSize,length,values);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetInteger64i_v(GLenum target, GLuint index, GLint64* data)
- {
-#if DALI_GLES_VERSION >= 30
- glGetInteger64i_v(target,index,data);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params)
- {
-#if DALI_GLES_VERSION >= 30
- glGetBufferParameteri64v(target,pname,params);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GenSamplers(GLsizei count, GLuint* samplers)
- {
-#if DALI_GLES_VERSION >= 30
- glGenSamplers(count,samplers);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void DeleteSamplers(GLsizei count, const GLuint* samplers)
- {
-#if DALI_GLES_VERSION >= 30
- glDeleteSamplers(count,samplers);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- GLboolean IsSampler(GLuint sampler)
- {
-#if DALI_GLES_VERSION >= 30
- return glIsSampler(sampler);
-#else
- return 0;
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void BindSampler(GLuint unit, GLuint sampler)
- {
-#if DALI_GLES_VERSION >= 30
- glBindSampler(unit,sampler);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
- {
-#if DALI_GLES_VERSION >= 30
- glSamplerParameteri(sampler,pname,param);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param)
- {
-#if DALI_GLES_VERSION >= 30
- glSamplerParameteriv(sampler,pname,param);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
- {
-#if DALI_GLES_VERSION >= 30
- glSamplerParameterf(sampler,pname,param);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param)
- {
-#if DALI_GLES_VERSION >= 30
- glSamplerParameterfv(sampler,pname,param);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params)
- {
-#if DALI_GLES_VERSION >= 30
- glGetSamplerParameteriv(sampler,pname,params);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params)
- {
-#if DALI_GLES_VERSION >= 30
- glGetSamplerParameterfv(sampler,pname,params);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void VertexAttribDivisor(GLuint index, GLuint divisor)
- {
-#if DALI_GLES_VERSION >= 30
- glVertexAttribDivisor(index,divisor);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void BindTransformFeedback(GLenum target, GLuint id)
- {
-#if DALI_GLES_VERSION >= 30
- glBindTransformFeedback(target,id);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void DeleteTransformFeedbacks(GLsizei n, const GLuint* ids)
- {
-#if DALI_GLES_VERSION >= 30
- glDeleteTransformFeedbacks(n,ids);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GenTransformFeedbacks(GLsizei n, GLuint* ids)
- {
-#if DALI_GLES_VERSION >= 30
- glGenTransformFeedbacks(n,ids);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- GLboolean IsTransformFeedback(GLuint id)
- {
-#if DALI_GLES_VERSION >= 30
- return glIsTransformFeedback(id);
-#else
- return 0;
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void PauseTransformFeedback(void)
- {
-#if DALI_GLES_VERSION >= 30
- glPauseTransformFeedback();
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void ResumeTransformFeedback(void)
- {
-#if DALI_GLES_VERSION >= 30
- glResumeTransformFeedback();
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary)
- {
-#if DALI_GLES_VERSION >= 30
- // if OpenGL ES 2.0 compatibility is need this can be implemented with
- // glGetProgramBinaryOES
- glGetProgramBinary(program,bufSize,length,binaryFormat,binary);
-#else
- mGlExtensions.GetProgramBinaryOES(program, bufSize, length, binaryFormat, binary);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length)
- {
-#if DALI_GLES_VERSION >= 30
- // if OpenGL ES 2.0 compatibility is need this can be implemented with
- // glProgramBinaryOES
- glProgramBinary(program,binaryFormat,binary,length);
-#else
- mGlExtensions.ProgramBinaryOES(program, binaryFormat, binary, length);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void ProgramParameteri(GLuint program, GLenum pname, GLint value)
- {
-#if DALI_GLES_VERSION >= 30
- glProgramParameteri(program,pname,value);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments)
- {
-#if DALI_GLES_VERSION >= 30
- glInvalidateFramebuffer(target,numAttachments,attachments);
-#else
- mGlExtensions.DiscardFrameBuffer(target, numAttachments, attachments);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height)
- {
-#if DALI_GLES_VERSION >= 30
- glInvalidateSubFramebuffer(target,numAttachments,attachments,x,y,width,height);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
- {
-#if DALI_GLES_VERSION >= 30
- glTexStorage2D(target,levels,internalformat,width,height);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
- {
-#if DALI_GLES_VERSION >= 30
- glTexStorage3D(target,levels,internalformat,width,height,depth);
-#endif // DALI_GLES_VERSION >= 30
- }
-
- void GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params)
- {
-#if DALI_GLES_VERSION >= 30
- glGetInternalformativ(target,internalformat,pname,bufSize,params);
-#endif // DALI_GLES_VERSION >= 30
- }
-
-private:
- ECoreX::GlExtensions mGlExtensions;
-
-};
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_GL_IMPLEMENTATION_H__
+++ /dev/null
-/*
- * Copyright (c) 2016 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/internal/graphics/gles20/gl-proxy-implementation.h>
-
-// EXTERNAL INCLUDES
-#include <math.h>
-
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/system/common/environment-options.h>
-
-namespace
-{
-const int NUM_FRAMES_PER_SECOND( 60 );
-}
-
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-
-Sampler::Sampler( const char* description )
-: mDescription( description ),
- mAccumulatedSquare( 0 ),
- mAccumulated( 0 ),
- mNumSamples( 0 ),
- mMin( 0.0f ),
- mMax( 0.0f ),
- mCurrentFrameCount( 0 )
-{
-}
-
-void Sampler::Increment()
-{
- mCurrentFrameCount++;
-}
-
-void Sampler::Reset()
-{
- mAccumulatedSquare = 0;
- mAccumulated = 0;
- mNumSamples = 0;
- mMin = 0.0f;
- mMax = 0.0f;
- mCurrentFrameCount = 0;
-}
-
-void Sampler::Accumulate()
-{
- if( mNumSamples == 0 )
- {
- mMin = mCurrentFrameCount;
- mMax = mCurrentFrameCount;
- }
- else
- {
- if( mCurrentFrameCount < mMin )
- {
- mMin = mCurrentFrameCount;
- }
- if( mCurrentFrameCount > mMax )
- {
- mMax = mCurrentFrameCount;
- }
- }
-
- mNumSamples++;
-
- mAccumulated += mCurrentFrameCount;
- mAccumulatedSquare += ( mCurrentFrameCount * mCurrentFrameCount );
- mCurrentFrameCount = 0;
-}
-const char* Sampler::GetDescription() const
-{
- return mDescription;
-}
-
-float Sampler::GetMeanValue() const
-{
- float meanValue = 0;
- if( mNumSamples > 0 )
- {
- meanValue = static_cast<double>( mAccumulated ) / static_cast<double>( mNumSamples );
- }
- return meanValue;
-}
-
-float Sampler::GetStandardDeviation() const
-{
- float standardDeviation = 0.0f;
- if( mNumSamples > 0 )
- {
- standardDeviation = sqrtf( mNumSamples * mAccumulatedSquare - ( mAccumulated * mAccumulated ) ) / mNumSamples;
- }
- return standardDeviation;
-}
-
-float Sampler::GetMin() const
-{
- return mMin;
-}
-
-float Sampler::GetMax() const
-{
- return mMax;
-}
-
-uint64_t Sampler::GetCount() const
-{
- return mAccumulated;
-}
-
-ObjectCounter::ObjectCounter( const char* description )
-: mDescription( description ),
- mCount( 0 ),
- mPeak( 0 )
-{}
-
-void ObjectCounter::Increment()
-{
- ++mCount;
- if( mCount > mPeak )
- {
- mPeak = mCount;
- }
-}
-
-void ObjectCounter::Decrement()
-{
- --mCount;
-}
-
-unsigned int ObjectCounter::GetCount() const
-{
- return mCount;
-}
-unsigned int ObjectCounter::GetPeak() const
-{
- return mPeak;
-}
-
-const char* ObjectCounter::GetDescription() const
-{
- return mDescription;
-}
-
-GlProxyImplementation::GlProxyImplementation( EnvironmentOptions& environmentOptions )
-: mEnvironmentOptions( environmentOptions ),
- mActiveTextureSampler( "ActiveTexture calls" ),
- mClearSampler( "Clear calls" ),
- mBindBufferSampler( "Bind buffers" ),
- mBindTextureSampler( "Bind textures" ),
- mDrawSampler( "Draw calls" ),
- mUniformSampler( "Uniform sets" ),
- mUseProgramSampler( "Used programs" ),
- mBufferCount( "Buffer Count" ),
- mTextureCount( "Texture Count" ),
- mProgramCount( "Program Count" ),
- mCurrentFrameCount( 0 ),
- mTotalFrameCount( 0 )
-{
-}
-
-GlProxyImplementation::~GlProxyImplementation()
-{
-}
-
-void GlProxyImplementation::PreRender()
-{
-}
-
-void GlProxyImplementation::PostRender()
-{
- // Accumulate counts in each sampler
- AccumulateSamples();
-
- // When we reach the desired frame count, output the averages from the samples
- mTotalFrameCount++;
- mCurrentFrameCount++;
-
- if( mCurrentFrameCount >= mEnvironmentOptions.GetGlesCallTime() * NUM_FRAMES_PER_SECOND )
- {
- mCurrentFrameCount = 0;
- LogResults();
-
- if( !mEnvironmentOptions.GetGlesCallAccumulate() )
- {
- ResetSamplers();
- }
- }
-}
-
-void GlProxyImplementation::Clear( GLbitfield mask )
-{
- mClearSampler.Increment();
- GlImplementation::Clear(mask);
-}
-
-void GlProxyImplementation::GenBuffers(GLsizei n, GLuint* buffers)
-{
- mBufferCount.Increment();
- GlImplementation::GenBuffers( n, buffers );
-}
-
-void GlProxyImplementation::DeleteBuffers( GLsizei n, const GLuint* buffers )
-{
- mBufferCount.Decrement();
- GlImplementation::DeleteBuffers( n, buffers );
-}
-
-void GlProxyImplementation::BindBuffer( GLenum target, GLuint buffer )
-{
- mBindBufferSampler.Increment();
- GlImplementation::BindBuffer( target, buffer );
-}
-
-void GlProxyImplementation::GenTextures( GLsizei n, GLuint* textures )
-{
- mTextureCount.Increment();
- GlImplementation::GenTextures( n, textures );
-}
-
-void GlProxyImplementation::DeleteTextures( GLsizei n, const GLuint* textures )
-{
- mTextureCount.Decrement();
- GlImplementation::DeleteTextures( n, textures );
-}
-
-void GlProxyImplementation::ActiveTexture( GLenum texture )
-{
- mActiveTextureSampler.Increment();
- GlImplementation::ActiveTexture( texture );
-}
-
-void GlProxyImplementation::BindTexture( GLenum target, GLuint texture )
-{
- mBindTextureSampler.Increment();
- GlImplementation::BindTexture(target,texture);
-}
-
-void GlProxyImplementation::DrawArrays( GLenum mode, GLint first, GLsizei count )
-{
- mDrawSampler.Increment();
- GlImplementation::DrawArrays( mode, first, count );
-}
-
-void GlProxyImplementation::DrawElements( GLenum mode, GLsizei count, GLenum type, const void* indices )
-{
- mDrawSampler.Increment();
- GlImplementation::DrawElements( mode, count, type, indices );
-}
-
-void GlProxyImplementation::Uniform1f( GLint location, GLfloat x )
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform1f( location, x );
-}
-
-void GlProxyImplementation::Uniform1fv( GLint location, GLsizei count, const GLfloat* v )
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform1fv( location, count, v );
-}
-
-void GlProxyImplementation::Uniform1i( GLint location, GLint x )
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform1i( location, x );
-}
-
-void GlProxyImplementation::Uniform1iv( GLint location, GLsizei count, const GLint* v )
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform1iv( location, count, v );
-}
-
-void GlProxyImplementation::Uniform2f( GLint location, GLfloat x, GLfloat y)
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform2f( location, x, y );
-}
-
-void GlProxyImplementation::Uniform2fv( GLint location, GLsizei count, const GLfloat* v )
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform2fv( location, count, v );
-}
-
-void GlProxyImplementation::Uniform2i( GLint location, GLint x, GLint y )
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform2i( location, x, y );
-}
-
-void GlProxyImplementation::Uniform2iv( GLint location, GLsizei count, const GLint* v )
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform2iv( location, count, v );
-}
-
-void GlProxyImplementation::Uniform3f( GLint location, GLfloat x, GLfloat y, GLfloat z )
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform3f( location, x, y, z );
-}
-
-void GlProxyImplementation::Uniform3fv( GLint location, GLsizei count, const GLfloat* v )
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform3fv( location, count, v );
-}
-
-void GlProxyImplementation::Uniform3i( GLint location, GLint x, GLint y, GLint z )
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform3i( location, x, y, z );
-}
-
-void GlProxyImplementation::Uniform3iv( GLint location, GLsizei count, const GLint* v )
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform3iv( location, count, v );
-}
-
-void GlProxyImplementation::Uniform4f( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w )
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform4f( location, x, y, z, w );
-}
-
-void GlProxyImplementation::Uniform4fv( GLint location, GLsizei count, const GLfloat* v )
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform4fv( location, count, v );
-}
-
-void GlProxyImplementation::Uniform4i( GLint location, GLint x, GLint y, GLint z, GLint w )
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform4i( location, x, y, z, w );
-}
-
-void GlProxyImplementation::Uniform4iv( GLint location, GLsizei count, const GLint* v )
-{
- mUniformSampler.Increment();
- GlImplementation::Uniform4iv( location, count, v );
-}
-
-void GlProxyImplementation::UniformMatrix2fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value )
-{
- mUniformSampler.Increment();
- GlImplementation::UniformMatrix2fv( location, count, transpose, value );
-}
-
-void GlProxyImplementation::UniformMatrix3fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value )
-{
- mUniformSampler.Increment();
- GlImplementation::UniformMatrix3fv( location, count, transpose, value );
-}
-
-void GlProxyImplementation::UniformMatrix4fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value )
-{
- mUniformSampler.Increment();
- GlImplementation::UniformMatrix4fv( location, count, transpose, value);
-}
-
-GLuint GlProxyImplementation::CreateProgram( void )
-{
- mProgramCount.Increment();
- return GlImplementation::CreateProgram();
-}
-
-void GlProxyImplementation::DeleteProgram( GLuint program )
-{
- mProgramCount.Decrement();
- GlImplementation::DeleteProgram( program );
-}
-
-void GlProxyImplementation::UseProgram( GLuint program )
-{
- mUseProgramSampler.Increment();
- GlImplementation::UseProgram( program );
-}
-
-void GlProxyImplementation::AccumulateSamples()
-{
- // Accumulate counts in each sampler
- mActiveTextureSampler.Accumulate();
- mClearSampler.Accumulate();
- mBindBufferSampler.Accumulate();
- mBindTextureSampler.Accumulate();
- mDrawSampler.Accumulate();
- mUniformSampler.Accumulate();
- mUseProgramSampler.Accumulate();
-}
-
-void GlProxyImplementation::LogResults()
-{
- Debug::LogMessage( Debug::DebugInfo, "OpenGL ES statistics sampled over %d frames) operations per frame:\n", mTotalFrameCount );
- LogCalls( mActiveTextureSampler );
- LogCalls( mClearSampler );
- LogCalls( mBindBufferSampler );
- LogCalls( mBindTextureSampler );
- LogCalls( mDrawSampler );
- LogCalls( mUniformSampler );
- LogCalls( mUseProgramSampler );
- Debug::LogMessage( Debug::DebugInfo, "OpenGL ES Object Count:\n" );
- LogObjectCounter( mBufferCount );
- LogObjectCounter( mTextureCount );
- LogObjectCounter( mProgramCount );
-}
-
-void GlProxyImplementation::LogCalls( const Sampler& sampler )
-{
- Debug::LogMessage( Debug::DebugInfo, " %s : Mean %5.2f (Min:%5.2f, Max:%5.2f, StdDev:%5.2f, Actual:%d)\n",
- sampler.GetDescription(),
- sampler.GetMeanValue(), sampler.GetMin(), sampler.GetMax(),
- sampler.GetStandardDeviation(),
- sampler.GetCount() );
-}
-
-void GlProxyImplementation::LogObjectCounter( const ObjectCounter& sampler )
-{
- Debug::LogMessage( Debug::DebugInfo, " %s : %u (Peak:%u)\n",
- sampler.GetDescription(),
- sampler.GetCount(),
- sampler.GetPeak() );
-}
-
-void GlProxyImplementation::ResetSamplers()
-{
- mActiveTextureSampler.Reset();
- mClearSampler.Reset();
- mBindBufferSampler.Reset();
- mBindTextureSampler.Reset();
- mDrawSampler.Reset();
- mUniformSampler.Reset();
- mUseProgramSampler.Reset();
- mTotalFrameCount = 0;
-}
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_GL_PROXY_IMPLEMENTATION_H__
-#define __DALI_INTERNAL_GL_PROXY_IMPLEMENTATION_H__
-
-/*
- * Copyright (c) 2016 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/internal/graphics/gles20/gl-implementation.h>
-
-namespace Dali
-{
-namespace Internal
-{
-namespace Adaptor
-{
-class EnvironmentOptions;
-
-/**
- * Helper class to calculate the statistics for Open GLES calls
- */
-class Sampler
-{
-public:
-
- /**
- * Constructor
- * @param description to write to the log
- */
- Sampler( const char* description );
-
- /**
- * Increment the counter for this frame
- */
- void Increment();
-
- /**
- * Reset the counter
- */
- void Reset();
-
- /**
- * Accumulate the count onto statistics
- */
- void Accumulate();
-
- /**
- * @return the description of the sampler
- */
- const char* GetDescription() const;
-
- /**
- * @return the mean value
- */
- float GetMeanValue() const;
-
- /**
- * @return the standard deviation
- */
- float GetStandardDeviation() const;
-
- /**
- * @return the minimum value
- */
- float GetMin() const;
-
- /**
- * @return the maximum value
- */
- float GetMax() const;
-
- /**
- * @return the current count
- */
- uint64_t GetCount() const;
-
-private: // Data
-
- const char* mDescription;
-
- uint64_t mAccumulatedSquare;
- uint64_t mAccumulated;
- uint64_t mNumSamples;
- float mMin;
- float mMax;
- unsigned int mCurrentFrameCount;
-};
-
-/**
- * Helper class to calculate number of OpenGL objects
- */
-class ObjectCounter
-{
-public:
- ObjectCounter( const char* description );
-
- /**
- * Increment the counter
- */
- void Increment();
-
- /**
- * Decrement the counter
- */
- void Decrement();
-
- /**
- * @return The current number of objects
- */
- unsigned int GetCount() const;
-
- /**
- * @return The maximum number of objects created
- */
- unsigned int GetPeak() const;
-
- /**
- * @return the description of the sampler
- */
- const char* GetDescription() const;
-
-private:
- const char* mDescription;
- unsigned int mCount;
- unsigned int mPeak;
-};
-
-/**
- * GlProxyImplementation is a wrapper for the concrete implementation
- * of GlAbstraction that also gathers statistical information.
- */
-class GlProxyImplementation : public GlImplementation
-{
-public:
-
- /**
- * Constructor
- * @param environmentOptions to check how often to log results
- */
- GlProxyImplementation( EnvironmentOptions& environmentOptions );
-
- /**
- * Virtual destructor
- */
- virtual ~GlProxyImplementation();
-
- /**
- * @copydoc GlAbstraction::PreRender();
- */
- virtual void PreRender();
-
- /**
- * @copydoc GlAbstraction::PostRender();
- */
- virtual void PostRender();
-
- /* OpenGL ES 2.0 API */
- virtual void Clear( GLbitfield mask );
-
- virtual void GenBuffers( GLsizei n, GLuint* buffers );
- virtual void DeleteBuffers( GLsizei n, const GLuint* buffers );
- virtual void BindBuffer( GLenum target, GLuint buffer );
-
- virtual void GenTextures( GLsizei n, GLuint* textures );
- virtual void DeleteTextures( GLsizei n, const GLuint* textures );
- virtual void ActiveTexture( GLenum texture );
- virtual void BindTexture( GLenum target, GLuint texture );
-
- virtual void DrawArrays( GLenum mode, GLint first, GLsizei count );
- virtual void DrawElements( GLenum mode, GLsizei count, GLenum type, const void* indices );
-
- virtual void Uniform1f ( GLint location, GLfloat x );
- virtual void Uniform1fv( GLint location, GLsizei count, const GLfloat* v );
- virtual void Uniform1i ( GLint location, GLint x );
- virtual void Uniform1iv( GLint location, GLsizei count, const GLint* v );
- virtual void Uniform2f ( GLint location, GLfloat x, GLfloat y );
- virtual void Uniform2fv( GLint location, GLsizei count, const GLfloat* v );
- virtual void Uniform2i ( GLint location, GLint x, GLint y );
- virtual void Uniform2iv( GLint location, GLsizei count, const GLint* v );
- virtual void Uniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z );
- virtual void Uniform3fv( GLint location, GLsizei count, const GLfloat* v );
- virtual void Uniform3i ( GLint location, GLint x, GLint y, GLint z );
- virtual void Uniform3iv( GLint location, GLsizei count, const GLint* v );
- virtual void Uniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w );
- virtual void Uniform4fv( GLint location, GLsizei count, const GLfloat* v );
- virtual void Uniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w );
- virtual void Uniform4iv( GLint location, GLsizei count, const GLint* v );
- virtual void UniformMatrix2fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value );
- virtual void UniformMatrix3fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value );
- virtual void UniformMatrix4fv( GLint location, GLsizei count, GLboolean transpose, const GLfloat* value );
-
- virtual GLuint CreateProgram( void );
- virtual void DeleteProgram( GLuint program );
- virtual void UseProgram( GLuint program );
-
-private: // Helpers
-
- void AccumulateSamples();
- void LogResults();
- void LogCalls( const Sampler& sampler );
- void LogObjectCounter( const ObjectCounter& sampler );
- void ResetSamplers();
-
-private: // Data
-
- EnvironmentOptions& mEnvironmentOptions;
- Sampler mActiveTextureSampler;
- Sampler mClearSampler;
- Sampler mBindBufferSampler;
- Sampler mBindTextureSampler;
- Sampler mDrawSampler;
- Sampler mUniformSampler;
- Sampler mUseProgramSampler;
- ObjectCounter mBufferCount;
- ObjectCounter mTextureCount;
- ObjectCounter mProgramCount;
-
- int mCurrentFrameCount;
- int mTotalFrameCount;
-};
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_GL_PROXY_IMPLEMENTATION_H__
// EXTERNAL INCLUDES
#if DALI_GLES_VERSION >= 30
#include <GLES3/gl3.h>
-#include <GLES3/gl3ext.h>
#else
#include <GLES2/gl2.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
-#include <dali/internal/graphics/gles20/egl-implementation.h>
+#include <dali/internal/graphics/gles/egl-implementation.h>
// TBM surface support
#ifndef EGL_NATIVE_SURFACE_TIZEN
// EXTERNAL INCLUDES
#if DALI_GLES_VERSION >= 30
#include <GLES3/gl3.h>
-#include <GLES3/gl3ext.h>
#else
#include <GLES2/gl2.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
-#include <dali/internal/graphics/gles20/egl-implementation.h>
+#include <dali/internal/graphics/gles/egl-implementation.h>
namespace
#include <dali/integration-api/bitmap.h>
// INTERNAL HEADERS
-#include <dali/internal/graphics/gles20/gl-implementation.h>
-#include <dali/internal/graphics/gles20/egl-graphics.h>
+#include <dali/internal/graphics/gles/gl-implementation.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
namespace Dali
{
// INTERNAL INCLUDES
#include <dali/internal/graphics/common/egl-image-extensions.h>
-#include <dali/internal/graphics/gles20/egl-graphics.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
#include <dali/internal/adaptor/common/adaptor-impl.h>
#include <dali/integration-api/render-surface.h>
// INTERNAL INCLUDES
#include <dali/internal/graphics/common/egl-image-extensions.h>
-#include <dali/internal/graphics/gles20/egl-graphics.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
#include <dali/internal/adaptor/common/adaptor-impl.h>
namespace Dali
// INTERNAL INCLUDES
#include <dali/internal/graphics/common/egl-image-extensions.h>
-#include <dali/internal/graphics/gles20/egl-graphics.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
#include <dali/internal/adaptor/common/adaptor-impl.h>
#include <dali/devel-api/adaptor-framework/bitmap-saver.h>
#include <dali/integration-api/render-surface.h>
// INTERNAL INCLUDES
#include <dali/internal/graphics/common/egl-image-extensions.h>
-#include <dali/internal/graphics/gles20/egl-graphics.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
#include <dali/internal/adaptor/common/adaptor-impl.h>
namespace Dali
// INTERNAL INCLUDES
#include <dali/internal/window-system/common/display-connection.h>
#include <dali/public-api/object/base-object.h>
-#include <dali/internal/graphics/gles20/egl-implementation.h>
+#include <dali/internal/graphics/gles/egl-implementation.h>
namespace Dali
#include <dali/internal/window-system/common/indicator-interface.h>
#include <dali/internal/window-system/common/damage-observer.h>
#include <dali/internal/window-system/common/rotation-observer.h>
-#include <dali/internal/graphics/gles20/egl-implementation.h>
+#include <dali/internal/graphics/gles/egl-implementation.h>
// EXTERNAL INCLUDES
#include <dali/integration-api/events/key-event-integ.h>
// INTERNAL INCLUDES
#include <dali/integration-api/trigger-event-factory-interface.h>
#include <dali/integration-api/thread-synchronization-interface.h>
-#include <dali/internal/graphics/gles20/egl-implementation.h>
+#include <dali/internal/graphics/gles/egl-implementation.h>
#include <dali/internal/adaptor/common/adaptor-impl.h>
#include <dali/internal/window-system/common/window-base.h>
#include <dali/internal/window-system/common/window-factory.h>
#include <dali/internal/window-system/common/window-system.h>
-#include <dali/internal/graphics/gles20/egl-graphics.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
namespace Dali
// CLASS HEADER
#include <dali/internal/window-system/tizen-wayland/display-connection-impl-ecore-wl.h>
-#include <dali/internal/graphics/gles20/egl-graphics.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
// EXTERNAL_HEADERS
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali/internal/system/common/trigger-event.h>
-#include <dali/internal/graphics/gles20/egl-implementation.h>
-#include <dali/internal/graphics/gles20/egl-graphics.h>
+#include <dali/internal/graphics/gles/egl-implementation.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
#include <dali/internal/window-system/common/display-connection.h>
#include <dali/internal/window-system/common/window-system.h>
#include <dali/integration-api/thread-synchronization-interface.h>
// INTERNAL HEADERS
#include <dali/internal/window-system/ubuntu-x11/pixmap-render-surface-ecore-x.h>
-#include <dali/internal/graphics/gles20/egl-graphics.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
namespace Dali
{
#include <dali/integration-api/thread-synchronization-interface.h>
#include <dali/internal/system/common/trigger-event.h>
#include <dali/internal/window-system/common/display-connection.h>
-#include <dali/internal/graphics/gles20/egl-graphics.h>
+#include <dali/internal/graphics/gles/egl-graphics.h>
namespace Dali
// INTERNAL INCLUDES
#include <dali/integration-api/egl-interface.h>
-#include <dali/internal/graphics/gles20/egl-implementation.h>
+#include <dali/internal/graphics/gles/egl-implementation.h>
#include <dali/internal/window-system/common/pixmap-render-surface.h>
#include <dali/internal/window-system/ubuntu-x11/ecore-x-types.h>
#include <dali/public-api/dali-adaptor-common.h>