Make it possible to specify KWin::GLTexture mutability

Some features will rely on it and complain that GLTexture decided to use
glTexStorage
This commit is contained in:
Aleix Pol 2020-07-22 19:11:10 +02:00
parent ff65bec92c
commit 29a2b2a355
2 changed files with 6 additions and 6 deletions

View file

@ -190,7 +190,7 @@ GLTexture::GLTexture(const QString& fileName)
{
}
GLTexture::GLTexture(GLenum internalFormat, int width, int height, int levels)
GLTexture::GLTexture(GLenum internalFormat, int width, int height, int levels, bool needsMutability)
: d_ptr(new GLTexturePrivate())
{
Q_D(GLTexture);
@ -209,7 +209,7 @@ GLTexture::GLTexture(GLenum internalFormat, int width, int height, int levels)
bind();
if (!GLPlatform::instance()->isGLES()) {
if (d->s_supportsTextureStorage) {
if (d->s_supportsTextureStorage && !needsMutability) {
glTexStorage2D(d->m_target, levels, internalFormat, width, height);
d->m_immutable = true;
} else {
@ -234,8 +234,8 @@ GLTexture::GLTexture(GLenum internalFormat, int width, int height, int levels)
unbind();
}
GLTexture::GLTexture(GLenum internalFormat, const QSize &size, int levels)
: GLTexture(internalFormat, size.width(), size.height(), levels)
GLTexture::GLTexture(GLenum internalFormat, const QSize &size, int levels, bool needsMutability)
: GLTexture(internalFormat, size.width(), size.height(), levels, needsMutability)
{
}

View file

@ -57,8 +57,8 @@ public:
explicit GLTexture(const QImage& image, GLenum target = GL_TEXTURE_2D);
explicit GLTexture(const QPixmap& pixmap, GLenum target = GL_TEXTURE_2D);
explicit GLTexture(const QString& fileName);
GLTexture(GLenum internalFormat, int width, int height, int levels = 1);
explicit GLTexture(GLenum internalFormat, const QSize &size, int levels = 1);
GLTexture(GLenum internalFormat, int width, int height, int levels = 1, bool needsMutability = false);
explicit GLTexture(GLenum internalFormat, const QSize &size, int levels = 1, bool needsMutability = false);
/**
* Create a GLTexture wrapper around an existing texture.