Commit 29a2b2a3 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Make it possible to specify KWin::GLTexture mutability

Some features will rely on it and complain that GLTexture decided to use
glTexStorage
parent ff65bec9
......@@ -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)
{
}
......
......@@ -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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment