#include <dali/integration-api/thread-synchronization-interface.h>
#include <dali/internal/graphics/gles/egl-implementation.h>
#include <dali/internal/adaptor/common/adaptor-impl.h>
+#include <dali/internal/adaptor/common/adaptor-internal-services.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>
mRenderNotification( NULL ),
mRotationTrigger( NULL ),
mGraphics( nullptr ),
+ mEGLSurface( nullptr ),
+ mEGLContext( nullptr ),
mColorDepth( isTransparent ? COLOR_DEPTH_32 : COLOR_DEPTH_24 ),
mOutputTransformedSignal(),
mRotationAngle( 0 ),
mWindowBase->GetDpi( dpiHorizontal, dpiVertical );
}
-void WindowRenderSurface::InitializeGraphics( GraphicsInterface& graphics, Dali::DisplayConnection& displayConnection )
+void WindowRenderSurface::InitializeGraphics()
{
- mGraphics = &graphics;
- auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
-
- EglInterface* mEGL = eglGraphics->Create();
-
- // Initialize EGL & OpenGL
- displayConnection.Initialize();
+ mGraphics = &mAdaptor->GetGraphicsInterface();
- Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>(*mEGL);
- eglImpl.ChooseConfig(true, mColorDepth);
-
- // Create the OpenGL context
- mEGL->CreateContext();
+ auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
+ mEGL = &eglGraphics->GetEglInterface();
- // Create the OpenGL surface
- CreateSurface();
+ if ( mEGLContext == NULL )
+ {
+ // Create the OpenGL context for this window
+ Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>(*mEGL);
+ eglImpl.ChooseConfig(true, mColorDepth);
+ eglImpl.CreateWindowContext( mEGLContext );
- // Make it current
- mEGL->MakeContextCurrent();
+ // Create the OpenGL surface
+ CreateSurface();
+ }
}
void WindowRenderSurface::CreateSurface()
auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
- eglImpl.CreateSurfaceWindow( window, mColorDepth );
+ mEGLSurface = eglImpl.CreateSurfaceWindow( window, mColorDepth );
// Check rotation capability
mRotationSupported = mWindowBase->IsEglWindowRotationSupported();
auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
- eglImpl.DestroySurface();
+ eglImpl.DestroySurface( mEGLSurface );
mWindowBase->DestroyEglWindow();
}
auto eglGraphics = static_cast<EglGraphics *>(mGraphics);
Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
- return eglImpl.ReplaceSurfaceWindow( window );
+ return eglImpl.ReplaceSurfaceWindow( window, mEGLSurface, mEGLContext );
}
void WindowRenderSurface::MoveResize( Dali::PositionSize positionSize )
bool WindowRenderSurface::PreRender( bool resizingSurface )
{
+ MakeContextCurrent();
+
if( resizingSurface )
{
#ifdef OVER_TIZEN_VERSION_4
}
Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
- eglImpl.SwapBuffers();
+ eglImpl.SwapBuffers( mEGLSurface );
if( mRenderNotification )
{
// Nothing to do.
}
-RenderSurface::Type WindowRenderSurface::GetSurfaceType()
+Integration::RenderSurface::Type WindowRenderSurface::GetSurfaceType()
{
return RenderSurface::WINDOW_RENDER_SURFACE;
}
+void WindowRenderSurface::MakeContextCurrent()
+{
+ if ( mEGL != nullptr )
+ {
+ mEGL->MakeContextCurrent( mEGLSurface, mEGLContext );
+ }
+}
+
+Integration::DepthBufferAvailable WindowRenderSurface::GetDepthBufferRequired()
+{
+ return mGraphics ? mGraphics->GetDepthBufferRequired() : Integration::DepthBufferAvailable::FALSE;
+}
+
+Integration::StencilBufferAvailable WindowRenderSurface::GetStencilBufferRequired()
+{
+ return mGraphics ? mGraphics->GetStencilBufferRequired() : Integration::StencilBufferAvailable::FALSE;
+}
+
void WindowRenderSurface::OutputTransformed()
{
int screenRotationAngle = mWindowBase->GetScreenRotationAngle();