Handle conflicts between epoxy and manually resolved function pointers
For the functions from GL_FOO_robustness we want to resolve it by ourselves in order to add a custom implementation if it's not available. Unfortunately once epoxy.h is included this breaks as epoxy defines the names and so through the preprocessor epoxy always wins. So we need different names: all functions from robustness get a "kwin" prefix and the usage is changed everywhere in kwin source code. REVIEW: 125883
This commit is contained in:
parent
fa6fbbdfc1
commit
ac1dbac8b1
7 changed files with 26 additions and 26 deletions
|
@ -238,7 +238,7 @@ void EglGbmBackend::endRenderingFrame(const QRegion &renderedRegion, const QRegi
|
|||
glFlush();
|
||||
if (m_backend->saveFrames()) {
|
||||
QImage img = QImage(QSize(m_backBuffer->width(), m_backBuffer->height()), QImage::Format_ARGB32);
|
||||
glReadnPixels(0, 0, m_backBuffer->width(), m_backBuffer->height(), GL_RGBA, GL_UNSIGNED_BYTE, img.byteCount(), (GLvoid*)img.bits());
|
||||
kwinGlReadnPixels(0, 0, m_backBuffer->width(), m_backBuffer->height(), GL_RGBA, GL_UNSIGNED_BYTE, img.byteCount(), (GLvoid*)img.bits());
|
||||
convertFromGLImage(img, m_backBuffer->width(), m_backBuffer->height());
|
||||
img.save(QStringLiteral("%1/%2.png").arg(m_backend->saveFrames()).arg(QString::number(m_frameCounter++)));
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ void ScreenShotEffect::postPaintScreen()
|
|||
|
||||
// copy content from framebuffer into image
|
||||
img = QImage(QSize(width, height), QImage::Format_ARGB32);
|
||||
glReadnPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, img.byteCount(), (GLvoid*)img.bits());
|
||||
kwinGlReadnPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, img.byteCount(), (GLvoid*)img.bits());
|
||||
GLRenderTarget::popRenderTarget();
|
||||
ScreenShotEffect::convertFromGLImage(img, width, height);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ ecm_setup_version(${PROJECT_VERSION}
|
|||
VARIABLE_PREFIX KWINEFFECTS
|
||||
VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kwineffects_version.h"
|
||||
PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KWinEffectsConfigVersion.cmake"
|
||||
SOVERSION 7
|
||||
SOVERSION 8
|
||||
)
|
||||
|
||||
### xrenderutils lib ###
|
||||
|
|
|
@ -602,7 +602,7 @@ QMatrix4x4 GLShader::getUniformMatrix4x4(const char* name)
|
|||
int location = uniformLocation(name);
|
||||
if (location >= 0) {
|
||||
GLfloat m[16];
|
||||
glGetnUniformfv(mProgram, location, sizeof(m), m);
|
||||
kwinGlGetnUniformfv(mProgram, location, sizeof(m), m);
|
||||
QMatrix4x4 matrix(m[0], m[4], m[8], m[12],
|
||||
m[1], m[5], m[9], m[13],
|
||||
m[2], m[6], m[10], m[14],
|
||||
|
@ -672,7 +672,7 @@ static bool fuzzyCompare(const QVector4D &lhs, const QVector4D &rhs)
|
|||
static bool checkPixel(int x, int y, const QVector4D &expected, const char *file, int line)
|
||||
{
|
||||
uint8_t data[4];
|
||||
glReadnPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 4, data);
|
||||
kwinGlReadnPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 4, data);
|
||||
|
||||
const QVector4D pixel{data[0] / 255.f, data[1] / 255.f, data[2] / 255.f, data[3] / 255.f};
|
||||
|
||||
|
|
|
@ -53,9 +53,9 @@ static void GetnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLflo
|
|||
glXSwapIntervalMESA_func glXSwapIntervalMESA;
|
||||
|
||||
// GL_ARB_robustness / GL_EXT_robustness
|
||||
glGetGraphicsResetStatus_func glGetGraphicsResetStatus;
|
||||
glReadnPixels_func glReadnPixels;
|
||||
glGetnUniformfv_func glGetnUniformfv;
|
||||
kwinGlGetGraphicsResetStatus_func kwinGlGetGraphicsResetStatus;
|
||||
kwinGlReadnPixels_func kwinGlReadnPixels;
|
||||
kwinGlGetnUniformfv_func kwinGlGetnUniformfv;
|
||||
|
||||
typedef void (*glXFuncPtr)();
|
||||
|
||||
|
@ -86,18 +86,18 @@ void glResolveFunctions(OpenGLPlatformInterface platformInterface)
|
|||
{
|
||||
if (hasGLExtension(QByteArrayLiteral("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);
|
||||
GL_RESOLVE_WITH_EXT(kwinGlGetGraphicsResetStatus, glGetGraphicsResetStatusARB);
|
||||
GL_RESOLVE_WITH_EXT(kwinGlReadnPixels, glReadnPixelsARB);
|
||||
GL_RESOLVE_WITH_EXT(kwinGlGetnUniformfv, glGetnUniformfvARB);
|
||||
} else if (hasGLExtension(QByteArrayLiteral("GL_EXT_robustness"))) {
|
||||
// See http://www.khronos.org/registry/gles/extensions/EXT/EXT_robustness.txt
|
||||
glGetGraphicsResetStatus = (glGetGraphicsResetStatus_func) eglGetProcAddress("glGetGraphicsResetStatusEXT");
|
||||
glReadnPixels = (glReadnPixels_func) eglGetProcAddress("glReadnPixelsEXT");
|
||||
glGetnUniformfv = (glGetnUniformfv_func) eglGetProcAddress("glGetnUniformfvEXT");
|
||||
kwinGlGetGraphicsResetStatus = (kwinGlGetGraphicsResetStatus_func) eglGetProcAddress("glGetGraphicsResetStatusEXT");
|
||||
kwinGlReadnPixels = (kwinGlReadnPixels_func) eglGetProcAddress("glReadnPixelsEXT");
|
||||
kwinGlGetnUniformfv = (kwinGlGetnUniformfv_func) eglGetProcAddress("glGetnUniformfvEXT");
|
||||
} else {
|
||||
glGetGraphicsResetStatus = KWin::GetGraphicsResetStatus;
|
||||
glReadnPixels = KWin::ReadnPixels;
|
||||
glGetnUniformfv = KWin::GetnUniformfv;
|
||||
kwinGlGetGraphicsResetStatus = KWin::GetGraphicsResetStatus;
|
||||
kwinGlReadnPixels = KWin::ReadnPixels;
|
||||
kwinGlGetnUniformfv = KWin::GetnUniformfv;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,14 +58,14 @@ using glXSwapIntervalMESA_func = int (*)(unsigned int interval);
|
|||
extern KWINGLUTILS_EXPORT glXSwapIntervalMESA_func glXSwapIntervalMESA;
|
||||
|
||||
// GL_ARB_robustness / GL_EXT_robustness
|
||||
using glGetGraphicsResetStatus_func = GLenum (*)();
|
||||
using glReadnPixels_func = void (*)(GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
using kwinGlGetGraphicsResetStatus_func = GLenum (*)();
|
||||
using kwinGlReadnPixels_func = void (*)(GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, GLsizei bufSize, GLvoid *data);
|
||||
using glGetnUniformfv_func = void (*)(GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
|
||||
using kwinGlGetnUniformfv_func = void (*)(GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
|
||||
|
||||
extern KWINGLUTILS_EXPORT glGetGraphicsResetStatus_func glGetGraphicsResetStatus;
|
||||
extern KWINGLUTILS_EXPORT glReadnPixels_func glReadnPixels;
|
||||
extern KWINGLUTILS_EXPORT glGetnUniformfv_func glGetnUniformfv;
|
||||
extern KWINGLUTILS_EXPORT kwinGlGetGraphicsResetStatus_func kwinGlGetGraphicsResetStatus;
|
||||
extern KWINGLUTILS_EXPORT kwinGlReadnPixels_func kwinGlReadnPixels;
|
||||
extern KWINGLUTILS_EXPORT kwinGlGetnUniformfv_func kwinGlGetnUniformfv;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
|
|
@ -653,7 +653,7 @@ void SceneOpenGL::handleGraphicsReset(GLenum status)
|
|||
timer.start();
|
||||
|
||||
// Wait until the reset is completed or max 10 seconds
|
||||
while (timer.elapsed() < 10000 && glGetGraphicsResetStatus() != GL_NO_ERROR)
|
||||
while (timer.elapsed() < 10000 && kwinGlGetGraphicsResetStatus() != GL_NO_ERROR)
|
||||
usleep(50);
|
||||
|
||||
qCDebug(KWIN_CORE) << "Attempting to reset compositing.";
|
||||
|
@ -699,7 +699,7 @@ qint64 SceneOpenGL::paint(QRegion damage, ToplevelList toplevels)
|
|||
// prepare rendering makes context current on the output
|
||||
QRegion repaint = m_backend->prepareRenderingForScreen(i);
|
||||
|
||||
const GLenum status = glGetGraphicsResetStatus();
|
||||
const GLenum status = kwinGlGetGraphicsResetStatus();
|
||||
if (status != GL_NO_ERROR) {
|
||||
handleGraphicsReset(status);
|
||||
return 0;
|
||||
|
@ -718,7 +718,7 @@ qint64 SceneOpenGL::paint(QRegion damage, ToplevelList toplevels)
|
|||
m_backend->makeCurrent();
|
||||
QRegion repaint = m_backend->prepareRenderingFrame();
|
||||
|
||||
const GLenum status = glGetGraphicsResetStatus();
|
||||
const GLenum status = kwinGlGetGraphicsResetStatus();
|
||||
if (status != GL_NO_ERROR) {
|
||||
handleGraphicsReset(status);
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue