1 /* 2 KWin - the KDE window manager 3 This file is part of the KDE project. 4 5 SPDX-FileCopyrightText: 2006-2007 Rivo Laks <rivolaks@hot.ee> 6 SPDX-FileCopyrightText: 2010, 2011 Martin Gräßlin <mgraesslin@kde.org> 7 SPDX-FileCopyrightText: 2011 Philipp Knechtges <philipp-dev@knechtges.com> 8 9 SPDX-License-Identifier: GPL-2.0-or-later 10 */ 11 12 #ifndef KWIN_GLTEXTURE_P_H 13 #define KWIN_GLTEXTURE_P_H 14 15 #include "kwinconfig.h" // KWIN_HAVE_OPENGL 16 #include "kwinglutils.h" 17 #include <kwinglutils_export.h> 18 19 #include <QSize> 20 #include <QSharedData> 21 #include <QImage> 22 #include <QMatrix4x4> 23 #include <epoxy/gl.h> 24 25 namespace KWin 26 { 27 // forward declarations 28 class GLVertexBuffer; 29 30 class KWINGLUTILS_EXPORT GLTexturePrivate 31 : public QSharedData 32 { 33 public: 34 GLTexturePrivate(); 35 virtual ~GLTexturePrivate(); 36 37 virtual void onDamage(); 38 39 void updateMatrix(); 40 41 GLuint m_texture; 42 GLenum m_target; 43 GLenum m_internalFormat; 44 GLenum m_filter; 45 GLenum m_wrapMode; 46 QSize m_size; 47 QSizeF m_scale; // to un-normalize GL_TEXTURE_2D 48 QMatrix4x4 m_matrix[2]; 49 bool m_yInverted; // texture is y-inverted 50 bool m_canUseMipmaps; 51 bool m_markedDirty; 52 bool m_filterChanged; 53 bool m_wrapModeChanged; 54 bool m_immutable; 55 bool m_foreign; 56 int m_mipLevels; 57 58 int m_unnormalizeActive; // 0 - no, otherwise refcount 59 int m_normalizeActive; // 0 - no, otherwise refcount 60 GLVertexBuffer* m_vbo; 61 QSize m_cachedSize; 62 63 static void initStatic(); 64 65 static bool s_supportsFramebufferObjects; 66 static bool s_supportsARGB32; 67 static bool s_supportsUnpack; 68 static bool s_supportsTextureStorage; 69 static bool s_supportsTextureSwizzle; 70 static bool s_supportsTextureFormatRG; 71 static GLuint s_fbo; 72 private: 73 friend void KWin::cleanupGL(); 74 static void cleanup(); 75 Q_DISABLE_COPY(GLTexturePrivate) 76 }; 77 78 } // namespace 79 80 #endif 81