summaryrefslogtreecommitdiff
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
parentf2219eb6b7148186df00966df30684fc0f3feba5 (diff)
downloadqtwayland-fce861bd01d7698ff180dd62ed0e59f65f4b1556.tar.gz
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>
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp8
-rw-r--r--src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h1
2 files changed, 2 insertions, 7 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)) {
diff --git a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h
index 38548ac8..9a1dda01 100644
--- a/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h
+++ b/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h
@@ -87,7 +87,6 @@ private:
EGLConfig m_config;
QSurfaceFormat m_format;
QOpenGLShaderProgram *m_blitProgram;
- QOpenGLTextureCache *m_textureCache;
bool mUseNativeDefaultFbo;
};