From e536b02248f370971716b744968776f6880528be Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Sun, 22 Dec 2024 17:12:09 +0100 Subject: Renderer: rewrite render scheduling (#8683) This rewrites renderer scheduling. Occlusion is now unified in a new Pass type. --- src/render/OpenGL.hpp | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'src/render/OpenGL.hpp') diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index 51f38708..0b72d438 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -19,6 +19,7 @@ #include "Framebuffer.hpp" #include "Transformer.hpp" #include "Renderbuffer.hpp" +#include "pass/Pass.hpp" #include #include @@ -61,17 +62,31 @@ struct SRenderModifData { bool enabled = true; }; +enum eMonitorRenderFBs : uint8_t { + FB_MONITOR_RENDER_MAIN = 0, + FB_MONITOR_RENDER_CURRENT = 1, + FB_MONITOR_RENDER_OUT = 2, +}; + +enum eMonitorExtraRenderFBs : uint8_t { + FB_MONITOR_RENDER_EXTRA_OFFLOAD = 0, + FB_MONITOR_RENDER_EXTRA_MIRROR, + FB_MONITOR_RENDER_EXTRA_MIRROR_SWAP, + FB_MONITOR_RENDER_EXTRA_OFF_MAIN, + FB_MONITOR_RENDER_EXTRA_MONITOR_MIRROR, + FB_MONITOR_RENDER_EXTRA_BLUR, +}; + struct SMonitorRenderData { CFramebuffer offloadFB; CFramebuffer mirrorFB; // these are used for some effects, CFramebuffer mirrorSwapFB; // etc CFramebuffer offMainFB; - CFramebuffer monitorMirrorFB; // used for mirroring outputs, does not contain artifacts like offloadFB + CFramebuffer blurFB; SP stencilTex = makeShared(); - CFramebuffer blurFB; bool blurFBDirty = true; bool blurFBShouldRender = false; @@ -123,6 +138,9 @@ struct SCurrentRenderData { uint32_t discardMode = DISCARD_OPAQUE; float discardOpacity = 0.f; + + PHLLSREF currentLS; + PHLWINDOWREF currentWindow; }; class CEGLSync { @@ -155,9 +173,9 @@ class CHyprOpenGLImpl { void renderRect(CBox*, const CHyprColor&, int round = 0); void renderRectWithBlur(CBox*, const CHyprColor&, int round = 0, float blurA = 1.f, bool xray = false); - void renderRectWithDamage(CBox*, const CHyprColor&, CRegion* damage, int round = 0); + void renderRectWithDamage(CBox*, const CHyprColor&, const CRegion& damage, int round = 0); void renderTexture(SP, CBox*, float a, int round = 0, bool discardActive = false, bool allowCustomUV = false); - void renderTextureWithDamage(SP, CBox*, CRegion* damage, float a, int round = 0, bool discardActive = false, bool allowCustomUV = false, + void renderTextureWithDamage(SP, CBox*, const CRegion& damage, float a, int round = 0, bool discardActive = false, bool allowCustomUV = false, SP waitTimeline = nullptr, uint64_t waitPoint = 0); void renderTextureWithBlur(SP, CBox*, float a, SP pSurface, int round = 0, bool blockBlurOptimization = false, float blurA = 1.f); void renderRoundedShadow(CBox*, int round, int range, const CHyprColor& color, float a = 1.0); @@ -174,11 +192,6 @@ class CHyprOpenGLImpl { void blend(bool enabled); - void makeWindowSnapshot(PHLWINDOW); - void makeRawWindowSnapshot(PHLWINDOW, CFramebuffer*); - void makeLayerSnapshot(PHLLS); - void renderSnapshot(PHLWINDOW); - void renderSnapshot(PHLLS); bool shouldUseNewBlurOptimizations(PHLLS pLayer, PHLWINDOW pWindow); void clear(const CHyprColor&); @@ -225,9 +238,6 @@ class CHyprOpenGLImpl { bool m_bReloadScreenShader = true; // at launch it can be set - PHLWINDOWREF m_pCurrentWindow; // hack to get the current rendered window - PHLLS m_pCurrentLayer; // hack to get the current rendered layer - std::map m_mWindowFramebuffers; std::map m_mLayerFramebuffers; std::map m_mMonitorRenderResources; @@ -300,7 +310,7 @@ class CHyprOpenGLImpl { // returns the out FB, can be either Mirror or MirrorSwap CFramebuffer* blurMainFramebufferWithDamage(float a, CRegion* damage); - void renderTextureInternalWithDamage(SP, CBox* pBox, float a, CRegion* damage, int round = 0, bool discardOpaque = false, bool noAA = false, + void renderTextureInternalWithDamage(SP, CBox* pBox, float a, const CRegion& damage, int round = 0, bool discardOpaque = false, bool noAA = false, bool allowCustomUV = false, bool allowDim = false, SP = nullptr, uint64_t waitPoint = 0); void renderTexturePrimitive(SP tex, CBox* pBox); void renderSplash(cairo_t* const, cairo_surface_t* const, double offset, const Vector2D& size); @@ -310,6 +320,9 @@ class CHyprOpenGLImpl { bool passRequiresIntrospection(PHLMONITOR pMonitor); friend class CHyprRenderer; + friend class CTexPassElement; + friend class CPreBlurElement; + friend class CSurfacePassElement; }; inline std::unique_ptr g_pHyprOpenGL; -- cgit v1.2.3