diff --git a/libkwineffects/kwinglutils_funcs.cpp b/libkwineffects/kwinglutils_funcs.cpp index 65585b1709..234c62c4d6 100644 --- a/libkwineffects/kwinglutils_funcs.cpp +++ b/libkwineffects/kwinglutils_funcs.cpp @@ -52,6 +52,11 @@ along with this program. If not, see . namespace KWin { +static GLenum GetGraphicsResetStatus(); +static void ReadnPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, + GLenum type, GLsizei bufSize, GLvoid *data); +static void GetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params); + #ifndef KWIN_HAVE_OPENGLES // Function pointers glXGetProcAddress_func glXGetProcAddress; @@ -188,6 +193,11 @@ glUniform1uiv_func glUniform1uiv; glUniform2uiv_func glUniform2uiv; glUniform3uiv_func glUniform3uiv; +// GL_ARB_robustness +glGetGraphicsResetStatus_func glGetGraphicsResetStatus; +glReadnPixels_func glReadnPixels; +glGetnUniformfv_func glGetnUniformfv; + static glXFuncPtr getProcAddress(const char* name) { @@ -667,6 +677,17 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) glFlushMappedBufferRange = NULL; } + if (hasGLExtension("GL_ARB_robustness")) { + // See http://www.opengl.org/registry/specs/ARB/robustness.txt + GL_RESOLVE_WITH_EXT(glGetGraphicsResetStatus, glGetGraphicsResetStatusARB); + GL_RESOLVE_WITH_EXT(glReadnPixels, glReadnPixelsARB); + GL_RESOLVE_WITH_EXT(glGetnUniformfv, glGetnUniformfvARB); + } else { + glGetGraphicsResetStatus = KWin::GetGraphicsResetStatus; + glReadnPixels = KWin::ReadnPixels; + glGetnUniformfv = KWin::GetnUniformfv; + } + #else if (hasGLExtension("GL_OES_mapbuffer")) { @@ -702,4 +723,22 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface) #endif } +static GLenum GetGraphicsResetStatus() +{ + return GL_NO_ERROR; +} + +static void ReadnPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, + GLenum type, GLsizei bufSize, GLvoid *data) +{ + Q_UNUSED(bufSize) + glReadPixels(x, y, width, height, format, type, data); +} + +static void GetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params) +{ + Q_UNUSED(bufSize) + glGetUniformfv(program, location, params); +} + } // namespace diff --git a/libkwineffects/kwinglutils_funcs.h b/libkwineffects/kwinglutils_funcs.h index 5b306be64c..9e68a5eb0a 100644 --- a/libkwineffects/kwinglutils_funcs.h +++ b/libkwineffects/kwinglutils_funcs.h @@ -444,6 +444,15 @@ typedef void (*glFlushMappedBufferRange_func)(GLenum target, GLintptr offset, GL extern KWIN_EXPORT glMapBufferRange_func glMapBufferRange; extern KWIN_EXPORT glFlushMappedBufferRange_func glFlushMappedBufferRange; +// GL_ARB_robustness +typedef GLenum (*glGetGraphicsResetStatus_func)(); +typedef void (*glReadnPixels_func)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, GLvoid *data); +typedef void (*glGetnUniformfv_func)(GLuint program, GLint location, GLsizei bufSize, GLfloat *params); + +extern KWIN_EXPORT glGetGraphicsResetStatus_func glGetGraphicsResetStatus; +extern KWIN_EXPORT glReadnPixels_func glReadnPixels; +extern KWIN_EXPORT glGetnUniformfv_func glGetnUniformfv; + } // namespace #endif // not KWIN_HAVE_OPENGLES