diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-08-01 16:19:34 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-09-14 08:15:39 +0000 |
commit | f1e2b2d80366b43ba638290bca55272b000b3ce1 (patch) | |
tree | 9b3d4708f0cd80a1c73aeacdbf3b5640c7fa80ab /src/core/gl_surface_qt.cpp | |
parent | baaab31631dcff6075418c95f0220e8fb207dd50 (diff) |
Adaptations to Chromium 53
Change-Id: I15053486edfd42ee607250b4f14fb6eaa325c959
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/core/gl_surface_qt.cpp')
-rw-r--r-- | src/core/gl_surface_qt.cpp | 72 |
1 files changed, 41 insertions, 31 deletions
diff --git a/src/core/gl_surface_qt.cpp b/src/core/gl_surface_qt.cpp index 027d3dd45..e88a26715 100644 --- a/src/core/gl_surface_qt.cpp +++ b/src/core/gl_surface_qt.cpp @@ -55,6 +55,8 @@ #include "ui/gl/gl_context.h" #include "ui/gl/gl_implementation.h" #include "ui/gl/gl_surface_egl.h" +#include "ui/gl/init/gl_initializer.h" +#include "ui/gl/init/gl_factory.h" #if defined(USE_X11) #include "ui/gl/gl_surface_glx.h" @@ -67,6 +69,7 @@ extern "C" { #if defined(OS_WIN) #include "ui/gl/gl_surface_wgl.h" #include "ui/gl/gl_context_wgl.h" +#include "ui/gl/vsync_provider_win.h" #endif // From ANGLE's egl/eglext.h. @@ -77,7 +80,7 @@ extern "C" { using ui::GetLastEGLErrorString; -namespace gfx { +namespace gl { namespace { @@ -309,7 +312,7 @@ bool GLSurfaceQtWGL::Initialize() { m_surfaceBuffer = new PbufferGLSurfaceWGL(m_size); - return m_surfaceBuffer->Initialize(gfx::GLSurface::SURFACE_DEFAULT); + return m_surfaceBuffer->Initialize(gl::GLSurface::SURFACE_DEFAULT); } void GLSurfaceQtWGL::Destroy() @@ -364,8 +367,8 @@ bool GLSurfaceQtEGL::InitializeOneOff() g_egl_surfaceless_context_supported = ExtensionsContain(g_extensions, "EGL_KHR_surfaceless_context"); if (g_egl_surfaceless_context_supported) { - scoped_refptr<GLSurface> surface = new GLSurfacelessQtEGL(Size(1, 1)); - scoped_refptr<GLContext> context = GLContext::CreateGLContext( + scoped_refptr<GLSurface> surface = new GLSurfacelessQtEGL(gfx::Size(1, 1)); + scoped_refptr<GLContext> context = init::CreateGLContext( NULL, surface.get(), PreferIntegratedGpu); if (!context->MakeCurrent(surface.get())) @@ -383,25 +386,6 @@ bool GLSurfaceQtEGL::InitializeOneOff() return true; } -bool GLSurface::InitializeOneOffInternal() -{ - if (GetGLImplementation() == kGLImplementationOSMesaGL) - return false; - - if (GetGLImplementation() == kGLImplementationEGLGLES2) - return GLSurfaceQtEGL::InitializeOneOff(); - - if (GetGLImplementation() == kGLImplementationDesktopGL) { -#if defined(USE_X11) - return GLSurfaceQtGLX::InitializeOneOff(); -#elif defined(OS_WIN) - return GLSurfaceQtWGL::InitializeOneOff(); -#endif - } - - return false; -} - EGLDisplay GLSurfaceEGL::GetHardwareDisplay() { return static_cast<EGLDisplay>(g_display); @@ -574,11 +558,36 @@ void* GLSurfacelessQtEGL::GetShareHandle() return NULL; } -// static +namespace init { + +bool InitializeGLOneOffPlatform() +{ +#if defined(OS_WIN) + VSyncProviderWin::InitializeOneOff(); +#endif + + if (GetGLImplementation() == kGLImplementationOSMesaGL) + return false; + + if (GetGLImplementation() == kGLImplementationEGLGLES2) + return GLSurfaceQtEGL::InitializeOneOff(); + + if (GetGLImplementation() == kGLImplementationDesktopGL) { +#if defined(USE_X11) + return GLSurfaceQtGLX::InitializeOneOff(); +#elif defined(OS_WIN) + return GLSurfaceQtWGL::InitializeOneOff(); +#endif + } + + return false; +} + scoped_refptr<GLSurface> -GLSurface::CreateOffscreenGLSurface(const gfx::Size& size) +CreateOffscreenGLSurface(const gfx::Size& size) { switch (GetGLImplementation()) { + case kGLImplementationDesktopGLCoreProfile: case kGLImplementationDesktopGL: { #if defined(USE_X11) scoped_refptr<GLSurface> surface = new GLSurfaceQtGLX(size); @@ -613,14 +622,15 @@ GLSurface::CreateOffscreenGLSurface(const gfx::Size& size) } } -// static scoped_refptr<GLSurface> -GLSurface::CreateViewGLSurface(gfx::AcceleratedWidget window) +CreateViewGLSurface(gfx::AcceleratedWidget window) { QT_NOT_USED return NULL; } +} // namespace init + std::string DriverEGL::GetPlatformExtensions() { EGLDisplay display = GLContextHelper::getEGLDisplay(); @@ -632,16 +642,16 @@ std::string DriverEGL::GetPlatformExtensions() return str ? std::string(str) : ""; } -} // namespace gfx +} // namespace gl namespace gpu { class GpuCommandBufferStub; class GpuChannelManager; -scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface(GpuChannelManager*, GpuCommandBufferStub*, - SurfaceHandle, gfx::GLSurface::Format) +scoped_refptr<gl::GLSurface> ImageTransportSurface::CreateNativeSurface(GpuChannelManager*, GpuCommandBufferStub*, + SurfaceHandle, gl::GLSurface::Format) { QT_NOT_USED - return scoped_refptr<gfx::GLSurface>(); + return scoped_refptr<gl::GLSurface>(); } } |