platforms/x11: Port away from GLTexture::discard()
Currently, if discard() is called, kwin will crash because EglPixmapTexture does not override the discard method. In principle, neither GlxPixmapTexture nor EglPixmapTexture should mess around with internals of the GLTexture class. It is better to have a wrapper texture with a bind method, which will re-bind the pixmap to the opengl texture if necessary.
This commit is contained in:
parent
3b8b87a663
commit
2b8453abb8
2 changed files with 8 additions and 9 deletions
|
@ -127,10 +127,10 @@ EglSurfaceTextureX11::EglSurfaceTextureX11(EglBackend *backend, SurfacePixmapX11
|
|||
bool EglSurfaceTextureX11::create()
|
||||
{
|
||||
auto texture = new EglPixmapTexture(static_cast<EglBackend *>(m_backend));
|
||||
texture->create(m_pixmap);
|
||||
|
||||
m_texture.reset(texture);
|
||||
return !m_texture->isNull();
|
||||
if (texture->create(m_pixmap)) {
|
||||
m_texture.reset(texture);
|
||||
}
|
||||
return !m_texture.isNull();
|
||||
}
|
||||
|
||||
void EglSurfaceTextureX11::update(const QRegion ®ion)
|
||||
|
@ -186,7 +186,6 @@ bool EglPixmapTexturePrivate::create(SurfacePixmapX11 *pixmap)
|
|||
if (EGL_NO_IMAGE_KHR == m_image) {
|
||||
qCDebug(KWIN_CORE) << "failed to create egl image";
|
||||
q->unbind();
|
||||
q->discard();
|
||||
return false;
|
||||
}
|
||||
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, static_cast<GLeglImageOES>(m_image));
|
||||
|
|
|
@ -797,10 +797,10 @@ GlxSurfaceTextureX11::GlxSurfaceTextureX11(GlxBackend *backend, SurfacePixmapX11
|
|||
bool GlxSurfaceTextureX11::create()
|
||||
{
|
||||
auto texture = new GlxPixmapTexture(static_cast<GlxBackend *>(m_backend));
|
||||
texture->create(m_pixmap);
|
||||
|
||||
m_texture.reset(texture);
|
||||
return !m_texture->isNull();
|
||||
if (texture->create(m_pixmap)) {
|
||||
m_texture.reset(texture);
|
||||
}
|
||||
return !m_texture.isNull();
|
||||
}
|
||||
|
||||
void GlxSurfaceTextureX11::update(const QRegion ®ion)
|
||||
|
|
Loading…
Reference in a new issue