File indexing completed on 2025-03-23 11:13:58
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2006-2007 Rivo Laks <rivolaks@hot.ee> 0006 SPDX-FileCopyrightText: 2010, 2011 Martin Gräßlin <mgraesslin@kde.org> 0007 SPDX-FileCopyrightText: 2011 Philipp Knechtges <philipp-dev@knechtges.com> 0008 0009 SPDX-License-Identifier: GPL-2.0-or-later 0010 */ 0011 0012 #pragma once 0013 0014 #include "kwinconfig.h" // KWIN_HAVE_OPENGL 0015 #include "kwinglutils.h" 0016 #include <kwinglutils_export.h> 0017 0018 #include <QImage> 0019 #include <QMatrix4x4> 0020 #include <QSharedData> 0021 #include <QSize> 0022 #include <epoxy/gl.h> 0023 0024 namespace KWin 0025 { 0026 // forward declarations 0027 class GLVertexBuffer; 0028 0029 class KWINGLUTILS_EXPORT GLTexturePrivate 0030 : public QSharedData 0031 { 0032 public: 0033 GLTexturePrivate(); 0034 virtual ~GLTexturePrivate(); 0035 0036 virtual void onDamage(); 0037 0038 void updateMatrix(); 0039 0040 GLuint m_texture; 0041 GLenum m_target; 0042 GLenum m_internalFormat; 0043 GLenum m_filter; 0044 GLenum m_wrapMode; 0045 QSize m_size; 0046 QSizeF m_scale; // to un-normalize GL_TEXTURE_2D 0047 QMatrix4x4 m_matrix[2]; 0048 bool m_yInverted; // texture is y-inverted 0049 bool m_canUseMipmaps; 0050 bool m_markedDirty; 0051 bool m_filterChanged; 0052 bool m_wrapModeChanged; 0053 bool m_immutable; 0054 bool m_foreign; 0055 int m_mipLevels; 0056 0057 int m_unnormalizeActive; // 0 - no, otherwise refcount 0058 int m_normalizeActive; // 0 - no, otherwise refcount 0059 std::unique_ptr<GLVertexBuffer> m_vbo; 0060 QSize m_cachedSize; 0061 0062 static void initStatic(); 0063 0064 static bool s_supportsFramebufferObjects; 0065 static bool s_supportsARGB32; 0066 static bool s_supportsUnpack; 0067 static bool s_supportsTextureStorage; 0068 static bool s_supportsTextureSwizzle; 0069 static bool s_supportsTextureFormatRG; 0070 static bool s_supportsTexture16Bit; 0071 static GLuint s_fbo; 0072 0073 private: 0074 friend void KWin::cleanupGL(); 0075 static void cleanup(); 0076 Q_DISABLE_COPY(GLTexturePrivate) 0077 }; 0078 0079 } // namespace