File indexing completed on 2024-05-12 05:31:43

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 "opengl/glutils.h"
0015 
0016 #include <QImage>
0017 #include <QMatrix4x4>
0018 #include <QSharedData>
0019 #include <QSize>
0020 #include <epoxy/gl.h>
0021 
0022 namespace KWin
0023 {
0024 // forward declarations
0025 class GLVertexBuffer;
0026 
0027 class KWIN_EXPORT GLTexturePrivate
0028     : public QSharedData
0029 {
0030 public:
0031     GLTexturePrivate();
0032     virtual ~GLTexturePrivate();
0033 
0034     void updateMatrix();
0035 
0036     GLuint m_texture;
0037     GLenum m_target;
0038     GLenum m_internalFormat;
0039     GLenum m_filter;
0040     GLenum m_wrapMode;
0041     QSize m_size;
0042     QSizeF m_scale; // to un-normalize GL_TEXTURE_2D
0043     QMatrix4x4 m_matrix[2];
0044     OutputTransform m_textureToBufferTransform;
0045     bool m_canUseMipmaps;
0046     bool m_markedDirty;
0047     bool m_filterChanged;
0048     bool m_wrapModeChanged;
0049     bool m_owning;
0050     int m_mipLevels;
0051 
0052     int m_unnormalizeActive; // 0 - no, otherwise refcount
0053     int m_normalizeActive; // 0 - no, otherwise refcount
0054     std::unique_ptr<GLVertexBuffer> m_vbo;
0055     QSizeF m_cachedSize;
0056     QRectF m_cachedSource;
0057 
0058     static void initStatic();
0059 
0060     static bool s_supportsFramebufferObjects;
0061     static bool s_supportsARGB32;
0062     static bool s_supportsUnpack;
0063     static bool s_supportsTextureStorage;
0064     static bool s_supportsTextureSwizzle;
0065     static bool s_supportsTextureFormatRG;
0066     static bool s_supportsTexture16Bit;
0067     static GLuint s_fbo;
0068 
0069 private:
0070     friend void KWin::cleanupGL();
0071     static void cleanup();
0072     Q_DISABLE_COPY(GLTexturePrivate)
0073 };
0074 
0075 } // namespace