kodi
GLShader.h
1 /*
2  * Copyright (C) 2005-2024 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "guilib/Shader.h"
12 
13 #include <string>
14 
16 {
17 public:
18  CGLShader(const char* shader, const std::string& prefix);
19  CGLShader(const char* vshader, const char* fshader, const std::string& prefix);
20  void OnCompiledAndLinked() override;
21  bool OnEnabled() override;
22  void Free();
23 
24  GLint GetPosLoc() {return m_hPos;}
25  GLint GetColLoc() {return m_hCol;}
26  GLint GetCord0Loc() {return m_hCord0;}
27  GLint GetCord1Loc() {return m_hCord1;}
28  GLint GetUniColLoc() {return m_hUniCol;}
29  GLint GetModelLoc() {return m_hModel; }
30  GLint GetMatrixLoc() { return m_hMatrix; }
31  GLint GetShaderClipLoc() { return m_hShaderClip; }
32  GLint GetShaderCoordStepLoc() { return m_hCoordStep; }
33  bool HardwareClipIsPossible() {return m_clipPossible; }
34  GLfloat GetClipXFactor() {return m_clipXFactor; }
35  GLfloat GetClipXOffset() {return m_clipXOffset; }
36  GLfloat GetClipYFactor() {return m_clipYFactor; }
37  GLfloat GetClipYOffset() {return m_clipYOffset; }
38 
39 protected:
40  GLint m_hTex0 = 0;
41  GLint m_hTex1 = 0;
42  GLint m_hUniCol = 0;
43  GLint m_hProj = 0;
44  GLint m_hModel = 0;
45  GLint m_hMatrix{0}; // m_hProj * m_hModel
46  GLint m_hShaderClip{0}; // clipping rect vec4(x1,y1,x2,y2)
47  GLint m_hCoordStep{0}; // step (1/resolution) for the two textures vec4(t1.x,t1.y,t2.x,t2.y)
48  GLint m_hPos = 0;
49  GLint m_hCol = 0;
50  GLint m_hCord0 = 0;
51  GLint m_hCord1 = 0;
52 
53  const GLfloat *m_proj = nullptr;
54  const GLfloat *m_model = nullptr;
55 
56  bool m_clipPossible = false;
57  GLfloat m_clipXFactor;
58  GLfloat m_clipXOffset;
59  GLfloat m_clipYFactor;
60  GLfloat m_clipYOffset;
61 };
Definition: GLShader.h:15
Definition: Shader.h:148