2011-07-18 15:55:39 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2006-2007 Rivo Laks <rivolaks@hot.ee>
|
|
|
|
Copyright (C) 2010, 2011 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
Copyright (C) 2011 Philipp Knechtges <philipp-dev@knechtges.com>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
#ifndef KWIN_GLTEXTURE_P_H
|
|
|
|
#define KWIN_GLTEXTURE_P_H
|
|
|
|
|
|
|
|
#include "kwinconfig.h" // KWIN_HAVE_OPENGL
|
2017-10-01 07:54:12 +00:00
|
|
|
#include "kwinglutils.h"
|
2013-12-03 09:43:57 +00:00
|
|
|
#include <kwinglutils_export.h>
|
2011-07-18 15:55:39 +00:00
|
|
|
|
2013-02-26 08:00:51 +00:00
|
|
|
#include <QSize>
|
|
|
|
#include <QSharedData>
|
2013-02-26 07:02:27 +00:00
|
|
|
#include <QImage>
|
2017-09-08 20:30:18 +00:00
|
|
|
#include <QMatrix4x4>
|
|
|
|
#include <epoxy/gl.h>
|
2011-07-18 15:55:39 +00:00
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
2013-02-26 07:02:27 +00:00
|
|
|
// forward declarations
|
|
|
|
class GLVertexBuffer;
|
2011-07-18 15:55:39 +00:00
|
|
|
|
2013-12-03 09:43:57 +00:00
|
|
|
class KWINGLUTILS_EXPORT GLTexturePrivate
|
2011-07-18 15:55:39 +00:00
|
|
|
: public QSharedData
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GLTexturePrivate();
|
|
|
|
virtual ~GLTexturePrivate();
|
|
|
|
|
2012-01-07 11:12:29 +00:00
|
|
|
virtual void onDamage();
|
2011-07-18 15:55:39 +00:00
|
|
|
|
2012-09-27 19:22:05 +00:00
|
|
|
void updateMatrix();
|
|
|
|
|
2011-07-18 15:55:39 +00:00
|
|
|
GLuint m_texture;
|
|
|
|
GLenum m_target;
|
2014-12-13 13:28:33 +00:00
|
|
|
GLenum m_internalFormat;
|
2011-07-18 15:55:39 +00:00
|
|
|
GLenum m_filter;
|
2012-01-07 11:12:29 +00:00
|
|
|
GLenum m_wrapMode;
|
2011-07-18 15:55:39 +00:00
|
|
|
QSize m_size;
|
|
|
|
QSizeF m_scale; // to un-normalize GL_TEXTURE_2D
|
2012-09-27 19:22:05 +00:00
|
|
|
QMatrix4x4 m_matrix[2];
|
|
|
|
bool m_yInverted; // texture is y-inverted
|
2011-07-18 15:55:39 +00:00
|
|
|
bool m_canUseMipmaps;
|
2012-01-07 11:12:29 +00:00
|
|
|
bool m_markedDirty;
|
|
|
|
bool m_filterChanged;
|
|
|
|
bool m_wrapModeChanged;
|
2014-12-10 19:31:53 +00:00
|
|
|
bool m_immutable;
|
2019-09-25 13:27:40 +00:00
|
|
|
bool m_foreign;
|
2014-12-10 19:26:23 +00:00
|
|
|
int m_mipLevels;
|
2011-07-18 15:55:39 +00:00
|
|
|
|
|
|
|
int m_unnormalizeActive; // 0 - no, otherwise refcount
|
|
|
|
int m_normalizeActive; // 0 - no, otherwise refcount
|
|
|
|
GLVertexBuffer* m_vbo;
|
|
|
|
QSize m_cachedSize;
|
|
|
|
|
|
|
|
static void initStatic();
|
|
|
|
|
2014-11-22 15:24:26 +00:00
|
|
|
static bool s_supportsFramebufferObjects;
|
2014-11-22 15:44:14 +00:00
|
|
|
static bool s_supportsARGB32;
|
2014-11-22 15:17:51 +00:00
|
|
|
static bool s_supportsUnpack;
|
2014-12-10 19:31:53 +00:00
|
|
|
static bool s_supportsTextureStorage;
|
2014-12-13 13:30:59 +00:00
|
|
|
static bool s_supportsTextureSwizzle;
|
2015-02-18 08:06:37 +00:00
|
|
|
static bool s_supportsTextureFormatRG;
|
2014-11-22 15:24:26 +00:00
|
|
|
static GLuint s_fbo;
|
2013-09-05 19:10:13 +00:00
|
|
|
static uint s_textureObjectCounter;
|
2011-07-18 15:55:39 +00:00
|
|
|
private:
|
2014-04-10 16:04:54 +00:00
|
|
|
friend void KWin::cleanupGL();
|
|
|
|
static void cleanup();
|
2011-07-18 15:55:39 +00:00
|
|
|
Q_DISABLE_COPY(GLTexturePrivate)
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2011-08-31 16:16:21 +00:00
|
|
|
#endif
|