[kwinglutils] Improve cleanup handling
* add static cleanup handlers to GLTexturePrivate and GLRenderTarget * revert the runtime resolved features (e.g. RenderTargets are not supported once we run the cleanup code) * clear the extension lists * reset the version variables REVIEW: 117484
This commit is contained in:
parent
c837ffddf4
commit
b8cc10ffab
4 changed files with 34 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
};
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -511,6 +511,8 @@ protected:
|
|||
|
||||
|
||||
private:
|
||||
friend void KWin::cleanupGL();
|
||||
static void cleanup();
|
||||
static bool sSupported;
|
||||
static bool s_blitSupported;
|
||||
static QStack<GLRenderTarget*> s_renderTargets;
|
||||
|
|
Loading…
Reference in a new issue