summaryrefslogtreecommitdiff
path: root/src/render/OpenGL.hpp
diff options
context:
space:
mode:
authorUjinT34 <41110182+UjinT34@users.noreply.github.com>2025-03-29 03:19:35 +0300
committerGitHub <noreply@github.com>2025-03-29 01:19:35 +0100
commit7374a023eff964817c9e5fbe75a661540516f798 (patch)
treee20baf1be8b1affbda443e34126da15f116b4d64 /src/render/OpenGL.hpp
parenta46576afc32d7fbad6c358cc72ead7f4489d8ea8 (diff)
renderer/opengl: Extract shaders from source (#9600)
--------- Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
Diffstat (limited to 'src/render/OpenGL.hpp')
-rw-r--r--src/render/OpenGL.hpp46
1 files changed, 28 insertions, 18 deletions
diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp
index 34bb7e9c..c3091f15 100644
--- a/src/render/OpenGL.hpp
+++ b/src/render/OpenGL.hpp
@@ -9,6 +9,7 @@
#include "../helpers/sync/SyncTimeline.hpp"
#include <cstdint>
#include <list>
+#include <string>
#include <unordered_map>
#include <map>
@@ -78,6 +79,26 @@ enum eMonitorExtraRenderFBs : uint8_t {
FB_MONITOR_RENDER_EXTRA_BLUR,
};
+struct SPreparedShaders {
+ std::string TEXVERTSRC;
+ std::string TEXVERTSRC300;
+ std::string TEXVERTSRC320;
+ CShader m_shQUAD;
+ CShader m_shRGBA;
+ CShader m_shPASSTHRURGBA;
+ CShader m_shMATTE;
+ CShader m_shRGBX;
+ CShader m_shEXT;
+ CShader m_shBLUR1;
+ CShader m_shBLUR2;
+ CShader m_shBLURPREPARE;
+ CShader m_shBLURFINISH;
+ CShader m_shSHADOW;
+ CShader m_shBORDER1;
+ CShader m_shGLITCH;
+ CShader m_shCM;
+};
+
struct SMonitorRenderData {
CFramebuffer offloadFB;
CFramebuffer mirrorFB; // these are used for some effects,
@@ -90,23 +111,6 @@ struct SMonitorRenderData {
bool blurFBDirty = true;
bool blurFBShouldRender = false;
-
- // Shaders
- bool m_bShadersInitialized = false;
- CShader m_shQUAD;
- CShader m_shRGBA;
- CShader m_shPASSTHRURGBA;
- CShader m_shMATTE;
- CShader m_shRGBX;
- CShader m_shEXT;
- CShader m_shBLUR1;
- CShader m_shBLUR2;
- CShader m_shBLURPREPARE;
- CShader m_shBLURFINISH;
- CShader m_shSHADOW;
- CShader m_shBORDER1;
- CShader m_shGLITCH;
- CShader m_shCM;
};
struct SCurrentRenderData {
@@ -232,6 +236,10 @@ class CHyprOpenGLImpl {
EGLImageKHR createEGLImage(const Aquamarine::SDMABUFAttrs& attrs);
SP<CEGLSync> createEGLSync(int fence = -1);
+ bool initShaders();
+ bool m_bShadersInitialized = false;
+ SP<SPreparedShaders> m_shaders;
+
SCurrentRenderData m_RenderData;
Hyprutils::OS::CFileDescriptor m_iGBMFD;
@@ -309,7 +317,6 @@ class CHyprOpenGLImpl {
GLuint createProgram(const std::string&, const std::string&, bool dynamic = false, bool silent = false);
GLuint compileShader(const GLuint&, std::string, bool dynamic = false, bool silent = false);
void createBGTextureForMonitor(PHLMONITOR);
- void initShaders();
void initDRMFormats();
void initEGL(bool gbm);
EGLDeviceEXT eglDeviceFromDRMFD(int drmFD);
@@ -322,6 +329,9 @@ class CHyprOpenGLImpl {
// returns the out FB, can be either Mirror or MirrorSwap
CFramebuffer* blurMainFramebufferWithDamage(float a, CRegion* damage);
+ void passCMUniforms(const CShader&, const NColorManagement::SImageDescription& imageDescription, const NColorManagement::SImageDescription& targetImageDescription,
+ bool modifySDR = false);
+ void passCMUniforms(const CShader&, const NColorManagement::SImageDescription& imageDescription);
void renderTextureInternalWithDamage(SP<CTexture>, const CBox& box, float a, const CRegion& damage, int round = 0, float roundingPower = 2.0f, bool discardOpaque = false,
bool noAA = false, bool allowCustomUV = false, bool allowDim = false);
void renderTexturePrimitive(SP<CTexture> tex, const CBox& box);