// INTERNAL INCLUDES
#include <ecore-x-render-surface.h>
+#include <gl/gl-implementation.h>
namespace Dali
{
mEglSurface(0),
mGlesInitialized(false),
mIsOwnSurface(true),
- mSyncMode(FULL_SYNC),
mContextCurrent(false),
mIsWindow(true),
mColorDepth(COLOR_DEPTH_24)
//@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;
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;
}
eglQueryString(mEglDisplay, EGL_VERSION),
eglQueryString(mEglDisplay, EGL_CLIENT_APIS),
eglQueryString(mEglDisplay, EGL_EXTENSIONS));
-
- if ( mIsWindow )
- {
- SetRefreshSync( mSyncMode );
- }
}
void EglImplementation::MakeContextNull()
return mGlesInitialized;
}
-bool EglImplementation::SetRefreshSync( SyncMode mode )
-{
- if ( mIsWindow == false )
- {
- return false;
- }
- mSyncMode = mode;
-
- // eglSwapInterval specifies the minimum number of video frame periods
- // per buffer swap for the window associated with the current context.
-
- if ( !mContextCurrent )
- {
- return true;
- }
-
- EGLBoolean ok = eglSwapInterval( mEglDisplay, mode );
- if ( !ok )
- {
- TEST_EGL_ERROR("eglSwapInterval");
- return false;
- }
-
- return true;
-}
-
void EglImplementation::SwapBuffers()
{
eglSwapBuffers( mEglDisplay, mEglSurface );
#else // DALI_GLES_VERSION >= 30
+ DALI_LOG_WARNING( "Using OpenGL ES 2 \n" );
configAttribs.PushBack( EGL_OPENGL_ES2_BIT );
#endif //DALI_GLES_VERSION >= 30
configAttribs.PushBack( 24 );
configAttribs.PushBack( EGL_STENCIL_SIZE );
configAttribs.PushBack( 8 );
+#ifndef DALI_PROFILE_UBUNTU
configAttribs.PushBack( EGL_SAMPLES );
configAttribs.PushBack( 4 );
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 )
{
case EGL_BAD_DISPLAY:
{
- DALI_LOG_ERROR("Display is not an EGL display connection");
+ DALI_LOG_ERROR("Display is not an EGL display connection\n");
break;
}
case EGL_BAD_ATTRIBUTE:
{
- DALI_LOG_ERROR("The parameter confirAttribs contains an invalid frame buffer configuration attribute or an attribute value that is unrecognized or out of range");
+ 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");
+ DALI_LOG_ERROR("Display has not been initialized\n");
break;
}
case EGL_BAD_PARAMETER:
{
- DALI_LOG_ERROR("The parameter numConfig is NULL");
+ DALI_LOG_ERROR("The parameter numConfig is NULL\n");
break;
}
default:
{
- DALI_LOG_ERROR("Unknown error");
+ DALI_LOG_ERROR("Unknown error.\n");
}
}
DALI_ASSERT_ALWAYS(false && "eglChooseConfig failed!");
if ( numConfigs != 1 )
{
- DALI_LOG_ERROR("No configurations found.");
+ DALI_LOG_ERROR("No configurations found.\n");
TEST_EGL_ERROR("eglChooseConfig");
}
}
-
void EglImplementation::CreateSurfaceWindow( EGLNativeWindowType window, ColorDepth depth )
{
DALI_ASSERT_ALWAYS( ( mEglSurface == 0 ) && "EGL surface already exists" );
DALI_ASSERT_ALWAYS( mEglSurface && "Create pixmap surface failed" );
}
-bool EglImplementation::ReplaceSurfaceWindow( EGLNativeWindowType window, EGLNativeDisplayType display )
+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();
- // If the display has not changed, then we can just create a new surface
- if ( display == mEglNativeDisplay )
- {
- // create the EGL surface
- CreateSurfaceWindow( window, mColorDepth );
-
- // set the context to be current with the new surface
- MakeContextCurrent();
- }
- else // the display has changed, we need to start egl with a new x-connection
- {
- // Note! this code path is untested
-
- // this will release all EGL specific resources
- eglTerminate( mEglDisplay );
-
- mGlesInitialized = false;
-
- // let the adaptor know that all resources have been lost
- contextLost = true;
-
- // re-initialise GLES with the new connection
- InitializeGles( display );
+ // create the EGL surface
+ CreateSurfaceWindow( window, mColorDepth );
- // create the EGL surface
- CreateSurfaceWindow( window, mColorDepth );
-
- // create the OpenGL context
- CreateContext();
-
- // Make it current
- MakeContextCurrent();
- }
+ // set the context to be current with the new surface
+ MakeContextCurrent();
return contextLost;
}
-bool EglImplementation::ReplaceSurfacePixmap( EGLNativePixmapType pixmap, EGLNativeDisplayType display )
+bool EglImplementation::ReplaceSurfacePixmap( EGLNativePixmapType pixmap )
{
bool contextLost = false;
// destroy the surface
DestroySurface();
- // If the display has not changed, then we can just create a new surface
- if ( display == mEglNativeDisplay )
- {
- // create the EGL surface
- CreateSurfacePixmap( pixmap, mColorDepth );
-
- // set the context to be current with the new surface
- MakeContextCurrent();
- }
- else // the display has changed, we need to start egl with a new x-connection
- {
- // Note! this code path is untested
-
- // this will release all EGL specific resources
- eglTerminate( mEglDisplay );
-
- mGlesInitialized = false;
-
- // let the adaptor know that all resources have been lost
- contextLost = true;
-
- // re-initialise GLES with the new connection
- InitializeGles( display );
+ // display connection has not changed, then we can just create a new surface
+ // create the EGL surface
+ CreateSurfacePixmap( pixmap, mColorDepth );
- // create the EGL surface
- CreateSurfacePixmap( pixmap, mColorDepth );
+ // set the context to be current with the new surface
+ MakeContextCurrent();
- // create the OpenGL context
- CreateContext();
-
- // Make it current
- MakeContextCurrent();
- }
return contextLost;
}
} // namespace Internal
} // namespace Dali
-