renderer/internal: stop using box pointers

in favor of const refs
This commit is contained in:
Vaxry
2025-01-26 15:05:34 +00:00
parent 16aeb24bc1
commit e951011503
32 changed files with 252 additions and 264 deletions

View File

@@ -166,86 +166,86 @@ class CHyprOpenGLImpl {
CHyprOpenGLImpl();
~CHyprOpenGLImpl();
void begin(PHLMONITOR, const CRegion& damage, CFramebuffer* fb = nullptr, std::optional<CRegion> finalDamage = {});
void beginSimple(PHLMONITOR, const CRegion& damage, SP<CRenderbuffer> rb = nullptr, CFramebuffer* fb = nullptr);
void end();
void begin(PHLMONITOR, const CRegion& damage, CFramebuffer* fb = nullptr, std::optional<CRegion> finalDamage = {});
void beginSimple(PHLMONITOR, const CRegion& damage, SP<CRenderbuffer> rb = nullptr, CFramebuffer* fb = nullptr);
void end();
void renderRect(CBox*, const CHyprColor&, int round = 0, float roundingPower = 2.0f);
void renderRectWithBlur(CBox*, const CHyprColor&, int round = 0, float roundingPower = 2.0f, float blurA = 1.f, bool xray = false);
void renderRectWithDamage(CBox*, const CHyprColor&, const CRegion& damage, int round = 0, float roundingPower = 2.0f);
void renderTexture(SP<CTexture>, CBox*, float a, int round = 0, float roundingPower = 2.0f, bool discardActive = false, bool allowCustomUV = false);
void renderTextureWithDamage(SP<CTexture>, CBox*, const CRegion& damage, float a, int round = 0, float roundingPower = 2.0f, bool discardActive = false,
bool allowCustomUV = false, SP<CSyncTimeline> waitTimeline = nullptr, uint64_t waitPoint = 0);
void renderTextureWithBlur(SP<CTexture>, CBox*, float a, SP<CWLSurfaceResource> pSurface, int round = 0, float roundingPower = 2.0f, bool blockBlurOptimization = false,
float blurA = 1.f, float overallA = 1.f);
void renderRoundedShadow(CBox*, int round, float roundingPower, int range, const CHyprColor& color, float a = 1.0);
void renderBorder(CBox*, const CGradientValueData&, int round, float roundingPower, int borderSize, float a = 1.0, int outerRound = -1 /* use round */);
void renderBorder(CBox*, const CGradientValueData&, const CGradientValueData&, float lerp, int round, float roundingPower, int borderSize, float a = 1.0,
int outerRound = -1 /* use round */);
void renderTextureMatte(SP<CTexture> tex, CBox* pBox, CFramebuffer& matte);
void renderRect(const CBox&, const CHyprColor&, int round = 0, float roundingPower = 2.0f);
void renderRectWithBlur(const CBox&, const CHyprColor&, int round = 0, float roundingPower = 2.0f, float blurA = 1.f, bool xray = false);
void renderRectWithDamage(const CBox&, const CHyprColor&, const CRegion& damage, int round = 0, float roundingPower = 2.0f);
void renderTexture(SP<CTexture>, const CBox&, float a, int round = 0, float roundingPower = 2.0f, bool discardActive = false, bool allowCustomUV = false);
void renderTextureWithDamage(SP<CTexture>, const CBox&, const CRegion& damage, float a, int round = 0, float roundingPower = 2.0f, bool discardActive = false,
bool allowCustomUV = false, SP<CSyncTimeline> waitTimeline = nullptr, uint64_t waitPoint = 0);
void renderTextureWithBlur(SP<CTexture>, const CBox&, float a, SP<CWLSurfaceResource> pSurface, int round = 0, float roundingPower = 2.0f, bool blockBlurOptimization = false,
float blurA = 1.f, float overallA = 1.f);
void renderRoundedShadow(const CBox&, int round, float roundingPower, int range, const CHyprColor& color, float a = 1.0);
void renderBorder(const CBox&, const CGradientValueData&, int round, float roundingPower, int borderSize, float a = 1.0, int outerRound = -1 /* use round */);
void renderBorder(const CBox&, const CGradientValueData&, const CGradientValueData&, float lerp, int round, float roundingPower, int borderSize, float a = 1.0,
int outerRound = -1 /* use round */);
void renderTextureMatte(SP<CTexture> tex, const CBox& pBox, CFramebuffer& matte);
void setMonitorTransformEnabled(bool enabled);
void setRenderModifEnabled(bool enabled);
void setMonitorTransformEnabled(bool enabled);
void setRenderModifEnabled(bool enabled);
void saveMatrix();
void setMatrixScaleTranslate(const Vector2D& translate, const float& scale);
void restoreMatrix();
void saveMatrix();
void setMatrixScaleTranslate(const Vector2D& translate, const float& scale);
void restoreMatrix();
void blend(bool enabled);
void blend(bool enabled);
bool shouldUseNewBlurOptimizations(PHLLS pLayer, PHLWINDOW pWindow);
bool shouldUseNewBlurOptimizations(PHLLS pLayer, PHLWINDOW pWindow);
void clear(const CHyprColor&);
void clearWithTex();
void scissor(const CBox*, bool transform = true);
void scissor(const pixman_box32*, bool transform = true);
void scissor(const int x, const int y, const int w, const int h, bool transform = true);
void clear(const CHyprColor&);
void clearWithTex();
void scissor(const CBox&, bool transform = true);
void scissor(const pixman_box32*, bool transform = true);
void scissor(const int x, const int y, const int w, const int h, bool transform = true);
void destroyMonitorResources(PHLMONITOR);
void destroyMonitorResources(PHLMONITOR);
void markBlurDirtyForMonitor(PHLMONITOR);
void markBlurDirtyForMonitor(PHLMONITOR);
void preWindowPass();
bool preBlurQueued();
void preRender(PHLMONITOR);
void preWindowPass();
bool preBlurQueued();
void preRender(PHLMONITOR);
void saveBufferForMirror(CBox*);
void renderMirrored();
void saveBufferForMirror(const CBox&);
void renderMirrored();
void applyScreenShader(const std::string& path);
void applyScreenShader(const std::string& path);
void bindOffMain();
void renderOffToMain(CFramebuffer* off);
void bindBackOnMain();
void bindOffMain();
void renderOffToMain(CFramebuffer* off);
void bindBackOnMain();
SP<CTexture> loadAsset(const std::string& file);
SP<CTexture> renderText(const std::string& text, CHyprColor col, int pt, bool italic = false, const std::string& fontFamily = "", int maxWidth = 0);
SP<CTexture> loadAsset(const std::string& file);
SP<CTexture> renderText(const std::string& text, CHyprColor col, int pt, bool italic = false, const std::string& fontFamily = "", int maxWidth = 0);
void setDamage(const CRegion& damage, std::optional<CRegion> finalDamage = {});
void setDamage(const CRegion& damage, std::optional<CRegion> finalDamage = {});
void ensureBackgroundTexturePresence();
void ensureBackgroundTexturePresence();
uint32_t getPreferredReadFormat(PHLMONITOR pMonitor);
std::vector<SDRMFormat> getDRMFormats();
EGLImageKHR createEGLImage(const Aquamarine::SDMABUFAttrs& attrs);
SP<CEGLSync> createEGLSync(int fenceFD);
bool waitForTimelinePoint(SP<CSyncTimeline> timeline, uint64_t point);
uint32_t getPreferredReadFormat(PHLMONITOR pMonitor);
std::vector<SDRMFormat> getDRMFormats();
EGLImageKHR createEGLImage(const Aquamarine::SDMABUFAttrs& attrs);
SP<CEGLSync> createEGLSync(int fenceFD);
bool waitForTimelinePoint(SP<CSyncTimeline> timeline, uint64_t point);
SCurrentRenderData m_RenderData;
SCurrentRenderData m_RenderData;
GLint m_iCurrentOutputFb = 0;
GLint m_iCurrentOutputFb = 0;
int m_iGBMFD = -1;
gbm_device* m_pGbmDevice = nullptr;
EGLContext m_pEglContext = nullptr;
EGLDisplay m_pEglDisplay = nullptr;
EGLDeviceEXT m_pEglDevice = nullptr;
uint failedAssetsNo = 0;
int m_iGBMFD = -1;
gbm_device* m_pGbmDevice = nullptr;
EGLContext m_pEglContext = nullptr;
EGLDisplay m_pEglDisplay = nullptr;
EGLDeviceEXT m_pEglDevice = nullptr;
uint failedAssetsNo = 0;
bool m_bReloadScreenShader = true; // at launch it can be set
bool m_bReloadScreenShader = true; // at launch it can be set
std::map<PHLWINDOWREF, CFramebuffer> m_mWindowFramebuffers;
std::map<PHLLSREF, CFramebuffer> m_mLayerFramebuffers;
std::map<PHLWINDOWREF, CFramebuffer> m_mWindowFramebuffers;
std::map<PHLLSREF, CFramebuffer> m_mLayerFramebuffers;
std::map<PHLMONITORREF, SMonitorRenderData> m_mMonitorRenderResources;
std::map<PHLMONITORREF, CFramebuffer> m_mMonitorBGFBs;
@@ -314,14 +314,14 @@ class CHyprOpenGLImpl {
// returns the out FB, can be either Mirror or MirrorSwap
CFramebuffer* blurMainFramebufferWithDamage(float a, CRegion* damage);
void renderTextureInternalWithDamage(SP<CTexture>, CBox* pBox, float a, const CRegion& damage, int round = 0, float roundingPower = 2.0f, bool discardOpaque = false,
bool noAA = false, bool allowCustomUV = false, bool allowDim = false, SP<CSyncTimeline> = nullptr, uint64_t waitPoint = 0);
void renderTexturePrimitive(SP<CTexture> tex, CBox* pBox);
void renderSplash(cairo_t* const, cairo_surface_t* const, double offset, const Vector2D& size);
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, SP<CSyncTimeline> = nullptr, uint64_t waitPoint = 0);
void renderTexturePrimitive(SP<CTexture> tex, const CBox& box);
void renderSplash(cairo_t* const, cairo_surface_t* const, double offset, const Vector2D& size);
void preBlurForCurrentMonitor();
void preBlurForCurrentMonitor();
bool passRequiresIntrospection(PHLMONITOR pMonitor);
bool passRequiresIntrospection(PHLMONITOR pMonitor);
friend class CHyprRenderer;
friend class CTexPassElement;