[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl2' - 3 commits - vcl/opengl vcl/source

Michael Meeks michael.meeks at collabora.com
Mon Dec 1 22:58:03 PST 2014


 vcl/opengl/gdiimpl.cxx              |    9 +++++++++
 vcl/opengl/texture.cxx              |    6 ++++++
 vcl/source/opengl/OpenGLContext.cxx |   16 ++++++++--------
 vcl/source/opengl/OpenGLHelper.cxx  |    1 +
 4 files changed, 24 insertions(+), 8 deletions(-)

New commits:
commit 746623aa1c914d8dca7f48a2e063d0d7cd7638cf
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Dec 2 06:54:27 2014 +0000

    vcl: use resetToReInitialize to avoid context problems on Windows.
    
    It appears that we have to do this for VirtualDevices, where we have
    freed / re-allocated the underlying resource, or we fail to switch the
    current context, and render to the wrong place, before blatting a
    blank texture over the top of it.
    
    Change-Id: I0253f216ea7dc9786374dc83ca38f4f6295e3035

diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 7cd4e50..e9ae4db 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -111,6 +111,15 @@ void OpenGLSalGraphicsImpl::Init()
         maOffscreenTex.GetHeight() != GetHeight() )
     {
         maOffscreenTex = OpenGLTexture();
+#if defined(WNT)
+        // URGH ... VirtualDevice may have destroyed the underlying resource
+        // our context is associated with - FIXME: can we do better here ?
+        if (mpContext)
+        {
+            mpContext->resetToReInitialize();
+            ReleaseContext();
+        }
+#endif
     }
 }
 
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index c4f245e..7992ffd 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -636,6 +636,14 @@ bool OpenGLContext::init(SystemChildWindow* pChildWindow)
     return ImplInit();
 }
 
+void OpenGLContext::resetToReInitialize()
+{
+    if( !mbInitialized )
+        return;
+    resetCurrent();
+    mbInitialized = false;
+}
+
 #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
 bool OpenGLContext::init(Display* dpy, Window win, int screen)
 {
@@ -656,14 +664,6 @@ bool OpenGLContext::init(Display* dpy, Window win, int screen)
     return ImplInit();
 }
 
-void OpenGLContext::resetToReInitialize()
-{
-    if( !mbInitialized )
-        return;
-    resetCurrent();
-    mbInitialized = false;
-}
-
 bool OpenGLContext::init(Display* dpy, Pixmap pix, unsigned int width, unsigned int height, int nScreen)
 {
     if(mbInitialized)
commit 45e5a87a42ba719da457fa7705ec1b806253b6b7
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Dec 2 06:30:38 2014 +0000

    vcl: OpenGL texture creation debug.
    
    Change-Id: I6a21c89329d9e9396ed16ce58b184339719adab7

diff --git a/vcl/opengl/texture.cxx b/vcl/opengl/texture.cxx
index 0c45d77..cc5be78 100644
--- a/vcl/opengl/texture.cxx
+++ b/vcl/opengl/texture.cxx
@@ -41,6 +41,8 @@ ImplOpenGLTexture::ImplOpenGLTexture( int nWidth, int nHeight, bool bAllocate )
         glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, nWidth, nHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL );
     glBindTexture( GL_TEXTURE_2D, 0 );
 
+    SAL_INFO( "vcl.opengl", "OpenGLTexture " << mnTexture << " " << nWidth << "x" << nHeight << " allocate" );
+
     CHECK_GL_ERROR();
 }
 
@@ -65,6 +67,8 @@ ImplOpenGLTexture::ImplOpenGLTexture( int nX, int nY, int nWidth, int nHeight )
     CHECK_GL_ERROR();
     glBindTexture( GL_TEXTURE_2D, 0 );
 
+    SAL_INFO( "vcl.opengl", "OpenGLTexture " << mnTexture << " " << nWidth << "x" << nHeight << " from x" << nX << ", y" << nY );
+
     CHECK_GL_ERROR();
 }
 
@@ -87,6 +91,8 @@ ImplOpenGLTexture::ImplOpenGLTexture( int nWidth, int nHeight, int nFormat, int
     glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, mnWidth, mnHeight, 0, nFormat, nType, pData );
     glBindTexture( GL_TEXTURE_2D, 0 );
 
+    SAL_INFO( "vcl.opengl", "OpenGLTexture " << mnTexture << " " << nWidth << "x" << nHeight << " from data" );
+
     CHECK_GL_ERROR();
 }
 
commit b5cfcf93b98eddbd1ca767f2928795461bf3de51
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sat Nov 29 02:16:41 2014 +0100

    request also a stencil size
    
    Change-Id: Ib3b8b70aa50dd1a42108e3e9091350bf1d315b03

diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx
index 202ac2b..1c05cfc 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -399,6 +399,7 @@ bool OpenGLHelper::GetVisualInfo(Display* pDisplay, int nScreen, XVisualInfo& rV
                       GLX_GREEN_SIZE, 8,
                       GLX_BLUE_SIZE, 8,
                       GLX_DEPTH_SIZE, 24,
+                      GLX_STENCIL_SIZE, 8,
                       None };
 
     pVI = glXChooseVisual( pDisplay, nScreen, aAttrib );


More information about the Libreoffice-commits mailing list