From 482d7ce61b423600b41b459eb26a2cc221cd0acf Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 25 Nov 2016 20:25:27 +0000 Subject: change from glew to epoxy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit because that works under wayland out of the box and gtk3 uses it already Change-Id: Iefaac31e325534a81a5389f752804af917c1baef Reviewed-on: https://gerrit.libreoffice.org/31213 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- vcl/source/opengl/OpenGLContext.cxx | 34 ++++++---------------------------- vcl/source/opengl/OpenGLHelper.cxx | 8 ++++---- 2 files changed, 10 insertions(+), 32 deletions(-) (limited to 'vcl/source/opengl') diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index 93bde70bcdf7..c04a0cf0c7fc 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -7,7 +7,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include #include #include @@ -205,13 +204,8 @@ extern "C" void APIENTRY #endif debug_callback(GLenum source, GLenum type, GLuint id, - GLenum severity, GLsizei , const GLchar* message, -#if HAVE_GLEW_1_12 - const GLvoid* -#else - GLvoid* -#endif - ) + GLenum severity, GLsizei , const GLchar* message, + const GLvoid*) { // ignore Nvidia's 131218: "Program/shader state performance warning: Fragment Shader is going to be recompiled because the shader key based on GL state mismatches." // the GLSL compiler is a bit too aggressive in optimizing the state based on the current OpenGL state @@ -280,30 +274,14 @@ OUString getGLString(GLenum eGlEnum) return sString; } -bool OpenGLContext::InitGLEW() +bool OpenGLContext::InitGL() { - static bool bGlewInit = false; - if(!bGlewInit) - { - OpenGLZone aZone; - - glewExperimental = GL_TRUE; - GLenum err = glewInit(); - if (err != GLEW_OK) - { - SAL_WARN("vcl.opengl", "Failed to initialize GLEW: " << glewGetErrorString(err)); - return false; - } - else - bGlewInit = true; - } - VCL_GL_INFO("OpenGLContext::ImplInit----end"); VCL_GL_INFO("Vendor: " << getGLString(GL_VENDOR) << " Renderer: " << getGLString(GL_RENDERER) << " GL version: " << OpenGLHelper::getGLVersion()); mbInitialized = true; // I think we need at least GL 3.0 - if (!GLEW_VERSION_3_0) + if (epoxy_gl_version() < 30) { SAL_WARN("vcl.opengl", "We don't have at least OpenGL 3.0"); return false; @@ -319,11 +297,11 @@ bool OpenGLContext::InitGLEW() return true; } -void OpenGLContext::InitGLEWDebugging() +void OpenGLContext::InitGLDebugging() { #ifdef DBG_UTIL // only enable debug output in dbgutil build - if( GLEW_ARB_debug_output) + if (epoxy_has_gl_extension("GL_ARB_debug_output")) { OpenGLZone aZone; diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index f07e7dcbfa8e..9b91415d2392 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -401,7 +401,7 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName, aGeometryShaderSource = getShaderSource(rGeometryShaderName); GLint bBinaryResult = GL_FALSE; - if( GLEW_ARB_get_program_binary && !rDigest.isEmpty() ) + if (epoxy_has_gl_extension("GL_ARB_get_program_binary") && !rDigest.isEmpty()) { OString aFileName = createFileName(rVertexShaderName, rFragmentShaderName, rGeometryShaderName, rDigest); @@ -473,7 +473,7 @@ GLint OpenGLHelper::LoadShaders(const OUString& rVertexShaderName, if (bHasGeometryShader) glAttachShader(ProgramID, GeometryShaderID); - if( GLEW_ARB_get_program_binary && !rDigest.isEmpty() ) + if (epoxy_has_gl_extension("GL_ARB_get_program_binary") && !rDigest.isEmpty()) { glProgramParameteri(ProgramID, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE); glLinkProgram(ProgramID); @@ -1085,14 +1085,14 @@ void OpenGLHelper::debugMsgPrint(const int nType, const char *pFormat, ...) { OpenGLZone aZone; - if (GLEW_KHR_debug) + if (epoxy_has_gl_extension("GL_KHR_debug")) glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, 1, // one[sic] id is as good as another ? // GL_DEBUG_SEVERITY_NOTIFICATION for >= GL4.3 ? GL_DEBUG_SEVERITY_LOW, strlen(pStr), pStr); - else if (GLEW_AMD_debug_output) + else if (epoxy_has_gl_extension("GL_AMD_debug_output")) glDebugMessageInsertAMD(GL_DEBUG_CATEGORY_APPLICATION_AMD, GL_DEBUG_SEVERITY_LOW_AMD, 1, // one[sic] id is as good as another ? -- cgit v1.2.3