summaryrefslogtreecommitdiffstats
path: root/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2014-08-20 15:03:56 +0200
committerGunnar Sletta <gunnar.sletta@jollamobile.com>2014-08-20 16:36:34 +0200
commitfce861bd01d7698ff180dd62ed0e59f65f4b1556 (patch)
treef3484677e68ebf712f4ab3b757f59859a03dbc51 /src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
parentf2219eb6b7148186df00966df30684fc0f3feba5 (diff)
Avoid allocating and (failing to) manage our own texture cache
There is no reason we should be allocating and managing our own set of window decorations. This is only going to add to the total texture memory used and because it is managed as a shared GL resource, it would have needed some care during cleanup to clean it up correctly. Change-Id: I19651837da6b3dfde0f78a964982f3f67e577493 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Diffstat (limited to 'src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp')
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
index dffd812c..071686c7 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
@@ -63,7 +63,6 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat
, m_config(q_configFromGLFormat(m_eglDisplay, format, true))
, m_format(q_glFormatFromConfig(m_eglDisplay, m_config))
, m_blitProgram(0)
- , m_textureCache(0)
, mUseNativeDefaultFbo(false)
{
m_shareEGLContext = share ? static_cast<QWaylandGLContext *>(share)->eglContext() : EGL_NO_CONTEXT;
@@ -102,7 +101,6 @@ QWaylandGLContext::QWaylandGLContext(EGLDisplay eglDisplay, const QSurfaceFormat
QWaylandGLContext::~QWaylandGLContext()
{
delete m_blitProgram;
- delete m_textureCache;
eglDestroyContext(m_eglDisplay, m_context);
}
@@ -164,9 +162,7 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
}
}
- if (!m_textureCache) {
- m_textureCache = new QOpenGLTextureCache(this->context());
- }
+ QOpenGLTextureCache *cache = QOpenGLTextureCache::cacheForContext(context());
QRect windowRect = window->window()->frameGeometry();
glViewport(0, 0, windowRect.width(), windowRect.height());
@@ -211,7 +207,7 @@ void QWaylandGLContext::swapBuffers(QPlatformSurface *surface)
//Draw Decoration
m_blitProgram->setAttributeArray("position", inverseSquareVertices, 2);
QImage decorationImage = window->decoration()->contentImage();
- m_textureCache->bindTexture(context(), decorationImage);
+ cache->bindTexture(context(), decorationImage);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
if (!context()->functions()->hasOpenGLFeature(QOpenGLFunctions::NPOTTextureRepeat)) {