File indexing completed on 2025-04-20 10:57:37

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2021 Xaver Hugl <xaver.hugl@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 
0011 #include <QSize>
0012 #include <kwinglutils.h>
0013 
0014 #include "drm_egl_backend.h"
0015 #include "drm_plane.h"
0016 
0017 namespace KWin
0018 {
0019 
0020 class ShadowBuffer
0021 {
0022 public:
0023     ShadowBuffer(const QSize &size, const GbmFormat &format);
0024     ~ShadowBuffer();
0025 
0026     bool isComplete() const;
0027     void render(DrmPlane::Transformations transform);
0028 
0029     GLFramebuffer *fbo() const;
0030     std::shared_ptr<GLTexture> texture() const;
0031     uint32_t drmFormat() const;
0032 
0033 private:
0034     GLint internalFormat(const GbmFormat &format) const;
0035     std::shared_ptr<GLTexture> m_texture;
0036     std::unique_ptr<GLFramebuffer> m_fbo;
0037     std::unique_ptr<GLVertexBuffer> m_vbo;
0038     const QSize m_size;
0039     const uint32_t m_drmFormat;
0040 };
0041 
0042 }