diff --git a/libkwineffects/kwingltexture.cpp b/libkwineffects/kwingltexture.cpp index c79a178061..4b685987cd 100644 --- a/libkwineffects/kwingltexture.cpp +++ b/libkwineffects/kwingltexture.cpp @@ -175,6 +175,14 @@ void GLTexturePrivate::initStatic() #endif } +void GLTexturePrivate::cleanup() +{ + sNPOTTextureSupported = false; + sFramebufferObjectSupported = false; + sSaturationSupported = false; + sTextureFormat = GL_RGBA; // custom dummy, GL_BGRA is not present on GLES +} + bool GLTexture::isNull() const { Q_D(const GLTexture); diff --git a/libkwineffects/kwingltexture_p.h b/libkwineffects/kwingltexture_p.h index f6684b0a84..cea43e38be 100644 --- a/libkwineffects/kwingltexture_p.h +++ b/libkwineffects/kwingltexture_p.h @@ -77,6 +77,8 @@ public: static uint s_fbo; static uint s_textureObjectCounter; private: + friend void KWin::cleanupGL(); + static void cleanup(); Q_DISABLE_COPY(GLTexturePrivate) }; diff --git a/libkwineffects/kwinglutils.cpp b/libkwineffects/kwinglutils.cpp index 0bf4c11e6c..11d1508feb 100644 --- a/libkwineffects/kwinglutils.cpp +++ b/libkwineffects/kwinglutils.cpp @@ -136,8 +136,19 @@ void initGL(OpenGLPlatformInterface platformInterface) void cleanupGL() { ShaderManager::cleanup(); + GLTexturePrivate::cleanup(); + GLRenderTarget::cleanup(); GLVertexBuffer::cleanup(); GLPlatform::cleanup(); + + glExtensions.clear(); + glxExtensions.clear(); + eglExtension.clear(); + + glVersion = 0; + glXVersion = 0; + eglVersion = 0; + glTextureUnitsCount = 0; } bool hasGLVersion(int major, int minor, int release) @@ -924,6 +935,13 @@ void GLRenderTarget::initStatic() #endif } +void GLRenderTarget::cleanup() +{ + Q_ASSERT(s_renderTargets.isEmpty()); + sSupported = false; + s_blitSupported = false; +} + bool GLRenderTarget::isRenderTargetBound() { return !s_renderTargets.isEmpty(); @@ -1873,6 +1891,10 @@ void GLVertexBuffer::cleanup() delete GLVertexBufferPrivate::s_indexBuffer; GLVertexBufferPrivate::s_indexBuffer = nullptr; #endif + GLVertexBufferPrivate::hasMapBufferRange = false; + GLVertexBufferPrivate::supportsIndexedQuads = false; + delete GLVertexBufferPrivate::streamingBuffer; + GLVertexBufferPrivate::streamingBuffer = nullptr; } GLVertexBuffer *GLVertexBuffer::streamingBuffer() diff --git a/libkwineffects/kwinglutils.h b/libkwineffects/kwinglutils.h index f41506ec1e..bca217a682 100644 --- a/libkwineffects/kwinglutils.h +++ b/libkwineffects/kwinglutils.h @@ -511,6 +511,8 @@ protected: private: + friend void KWin::cleanupGL(); + static void cleanup(); static bool sSupported; static bool s_blitSupported; static QStack s_renderTargets;