#include <dali/internal/graphics/gles/egl-implementation.h>
// EXTERNAL INCLUDES
+#include <sstream>
#include <dali/integration-api/debug.h>
#include <dali/public-api/common/dali-vector.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
+namespace
+{
+ const std::string EGL_KHR_SURFACELESS_CONTEXT = "EGL_KHR_surfaceless_context";
+}
+
namespace Dali
{
mIsOwnSurface( true ),
mIsWindow( true ),
mDepthBufferRequired( depthBufferRequired == Integration::DepthBufferAvailable::TRUE ),
- mStencilBufferRequired( stencilBufferRequired == Integration::StencilBufferAvailable::TRUE )
+ mStencilBufferRequired( stencilBufferRequired == Integration::StencilBufferAvailable::TRUE ),
+ mIsSurfacelessContextSupported( false )
{
}
mIsOwnSurface = isOwnSurface;
}
+ // Query EGL extensions to check whether surfaceless context is supported
+ const char* const extensionStr = eglQueryString( mEglDisplay, EGL_EXTENSIONS );
+ std::istringstream stream(extensionStr);
+ std::string currentExtension;
+ while ( std::getline( stream, currentExtension, ' ' ) )
+ {
+ if ( currentExtension == EGL_KHR_SURFACELESS_CONTEXT )
+ {
+ mIsSurfacelessContextSupported = true;
+ break;
+ }
+ }
+
// 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"
eglQueryString( mEglDisplay, EGL_VENDOR ),
eglQueryString( mEglDisplay, EGL_VERSION ),
eglQueryString( mEglDisplay, EGL_CLIENT_APIS ),
- eglQueryString( mEglDisplay, EGL_EXTENSIONS ));
+ extensionStr);
return mGlesInitialized;
}
#endif // DALI_PROFILE_UBUNTU
configAttribs.PushBack( EGL_NONE );
- if ( eglChooseConfig( mEglDisplay, &(configAttribs[0]), &mEglConfig, 1, &numConfigs ) != EGL_TRUE )
+ // Ensure number of configs is set to 1 as on some drivers,
+ // eglChooseConfig succeeds but does not actually create a proper configuration.
+ if ( ( eglChooseConfig( mEglDisplay, &(configAttribs[0]), &mEglConfig, 1, &numConfigs ) != EGL_TRUE ) ||
+ ( numConfigs != 1 ) )
{
if( mGlesVersion >= 30 )
{
return false;
}
+ if ( numConfigs != 1 )
+ {
+ DALI_LOG_ERROR("No configurations found.\n");
+
+ TEST_EGL_ERROR("eglChooseConfig");
+ }
+
EGLint error = eglGetError();
switch (error)
{
}
mContextAttribs.PushBack( EGL_NONE );
- if ( numConfigs != 1 )
- {
- DALI_LOG_ERROR("No configurations found.\n");
-
- TEST_EGL_ERROR("eglChooseConfig");
- }
-
return true;
}
DestroySurface( eglSurface );
// create the EGL surface
- CreateSurfaceWindow( window, mColorDepth );
+ EGLSurface newEglSurface = CreateSurfaceWindow( window, mColorDepth );
// set the context to be current with the new surface
- MakeContextCurrent( eglSurface, eglContext );
+ MakeContextCurrent( newEglSurface, eglContext );
return contextLost;
}
return mGlesVersion;
}
+bool EglImplementation::IsSurfacelessContextSupported() const
+{
+ return mIsSurfacelessContextSupported;
+}
+
} // namespace Adaptor
} // namespace Internal