diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2016-07-25 14:28:30 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2016-07-25 14:35:57 +0000 |
commit | 884590333127173f19bac6871e2f2998ac0ba3fd (patch) | |
tree | ab1dbd086c8c9375e2e246bb5ee9c7830cc59f96 /vcl | |
parent | 1b7ef90fba218b27f3757d117f5e2d3c872c5da8 (diff) |
opengl: check supported texture size on first GL init
Change-Id: I27ef828a8d47d50adbbcc3fb0fd152f4f6ffc446
Reviewed-on: https://gerrit.libreoffice.org/27497
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/opengl/win/gdiimpl.cxx | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/vcl/opengl/win/gdiimpl.cxx b/vcl/opengl/win/gdiimpl.cxx index c20e755ab485..71251dfd91be 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); |