File indexing completed on 2024-11-10 04:56:30

0001 /*
0002     SPDX-FileCopyrightText: 2023 Xaver Hugl <xaver.hugl@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #pragma once
0007 
0008 #include <QMatrix4x4>
0009 #include <QSizeF>
0010 #include <memory>
0011 
0012 namespace KWin
0013 {
0014 
0015 class IccProfile;
0016 class GLShader;
0017 class GlLookUpTable;
0018 class GlLookUpTable3D;
0019 class GLTexture;
0020 
0021 class IccShader
0022 {
0023 public:
0024     explicit IccShader();
0025     ~IccShader();
0026 
0027     GLShader *shader() const;
0028     void setUniforms(const std::shared_ptr<IccProfile> &profile, float sdrBrightness, const QVector3D &channelFactors);
0029 
0030 private:
0031     bool setProfile(const std::shared_ptr<IccProfile> &profile);
0032 
0033     std::unique_ptr<GLShader> m_shader;
0034     std::shared_ptr<IccProfile> m_profile;
0035 
0036     QMatrix4x4 m_toXYZD50;
0037     std::unique_ptr<GlLookUpTable> m_B;
0038     QMatrix4x4 m_matrix2;
0039     std::unique_ptr<GlLookUpTable> m_M;
0040     std::unique_ptr<GlLookUpTable3D> m_C;
0041     std::unique_ptr<GlLookUpTable> m_A;
0042     struct Locations
0043     {
0044         int src;
0045         int sdrBrightness;
0046         int toXYZD50;
0047         int bsize;
0048         int bsampler;
0049         int matrix2;
0050         int msize;
0051         int msampler;
0052         int csize;
0053         int csampler;
0054         int asize;
0055         int asampler;
0056     };
0057     Locations m_locations;
0058 };
0059 
0060 }