[Libreoffice-commits] core.git: vcl/opengl

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Mon Jul 25 14:36:31 UTC 2016


 vcl/opengl/win/gdiimpl.cxx |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

New commits:
commit 884590333127173f19bac6871e2f2998ac0ba3fd
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Mon Jul 25 14:28:30 2016 +0900

    opengl: check supported texture size on first GL init
    
    Change-Id: I27ef828a8d47d50adbbcc3fb0fd152f4f6ffc446
    Reviewed-on: https://gerrit.libreoffice.org/27497
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx
index c20e755..71251df 100644
--- a/vcl/opengl/win/gdiimpl.cxx
+++ b/vcl/opengl/win/gdiimpl.cxx
@@ -615,6 +615,37 @@ bool WinOpenGLContext::ImplInit()
         return false;
     }
 
+    if (bFirstCall)
+    {
+        // Checking texture size
+        GLint nMaxTextureSize;
+        glGetIntegerv(GL_MAX_TEXTURE_SIZE, &nMaxTextureSize);
+        if (nMaxTextureSize <= 4096)
+            SAL_WARN("vcl.opengl", "Max texture size is " << nMaxTextureSize
+                                    << ". This may not be enough for normal operation.");
+        else
+            VCL_GL_INFO("Max texture size: " << nMaxTextureSize);
+
+        // Trying to make a texture and check its size
+        for (GLint nWidthHeight = 1023; nWidthHeight < nMaxTextureSize; nWidthHeight += (nWidthHeight + 1))
+        {
+            glTexImage2D(GL_PROXY_TEXTURE_2D, 0, 4, nWidthHeight, nWidthHeight, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, nullptr);
+            CHECK_GL_ERROR();
+            if (glGetError() == GL_NO_ERROR)
+            {
+                GLint nWidth = 0;
+                GLint nHeight = 0;
+                glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &nWidth);
+                glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &nHeight);
+                VCL_GL_INFO("Created texture " << nWidthHeight << "," << nWidthHeight << " reports size: " << nWidth << ", " << nHeight);
+            }
+            else
+            {
+                SAL_WARN("vcl.opengl", "Error when creating a " << nWidthHeight << ", " << nWidthHeight << " test texture.");
+            }
+        }
+    }
+
     InitGLEWDebugging();
 
     g_vShareList.push_back(m_aGLWin.hRC);


More information about the Libreoffice-commits mailing list