From 4fc95d646dbbe71744fb4e02ca0e995b652bffe5 Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Thu, 18 Sep 2025 22:10:30 +0200 Subject: renderer: asynchronously load background tex (#11749) Bumps required hyprgraphics to 0.1.6 --------- Co-authored-by: Mihai Fufezan --- src/render/OpenGL.hpp | 71 +++++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 34 deletions(-) (limited to 'src/render/OpenGL.hpp') diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index 9e61106b..a69ebbfe 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -28,6 +28,7 @@ #include #include #include +#include #include "../debug/TracyDefines.hpp" #include "../protocols/core/Compositor.hpp" @@ -261,13 +262,13 @@ class CHyprOpenGLImpl { void renderOffToMain(CFramebuffer* off); void bindBackOnMain(); + std::string resolveAssetPath(const std::string& file); SP loadAsset(const std::string& file); + SP texFromCairo(cairo_surface_t* cairo); SP renderText(const std::string& text, CHyprColor col, int pt, bool italic = false, const std::string& fontFamily = "", int maxWidth = 0, int weight = 400); void setDamage(const CRegion& damage, std::optional finalDamage = {}); - void ensureBackgroundTexturePresence(); - uint32_t getPreferredReadFormat(PHLMONITOR pMonitor); std::vector getDRMFormats(); EGLImageKHR createEGLImage(const Aquamarine::SDMABUFAttrs& attrs); @@ -348,38 +349,40 @@ class CHyprOpenGLImpl { GLsizei height = 0; } m_lastViewport; - std::unordered_map m_capStatus; - - std::vector m_drmFormats; - bool m_hasModifiers = false; - - int m_drmFD = -1; - std::string m_extensions; - - bool m_fakeFrame = false; - bool m_applyFinalShader = false; - bool m_blend = false; - bool m_offloadedFramebuffer = false; - bool m_cmSupported = true; - - bool m_monitorTransformEnabled = false; // do not modify directly - std::stack m_monitorTransformStack; - SP m_missingAssetTexture; - SP m_backgroundTexture; - SP m_lockDeadTexture; - SP m_lockDead2Texture; - SP m_lockTtyTextTexture; - SShader m_finalScreenShader; - CTimer m_globalTimer; - GLuint m_currentProgram; - - void logShaderError(const GLuint&, bool program = false, bool silent = false); - void createBGTextureForMonitor(PHLMONITOR); - void initDRMFormats(); - void initEGL(bool gbm); - EGLDeviceEXT eglDeviceFromDRMFD(int drmFD); - void initAssets(); - void initMissingAssetTexture(); + std::unordered_map m_capStatus; + + std::vector m_drmFormats; + bool m_hasModifiers = false; + + int m_drmFD = -1; + std::string m_extensions; + + bool m_fakeFrame = false; + bool m_applyFinalShader = false; + bool m_blend = false; + bool m_offloadedFramebuffer = false; + bool m_cmSupported = true; + + bool m_monitorTransformEnabled = false; // do not modify directly + std::stack m_monitorTransformStack; + SP m_missingAssetTexture; + SP m_lockDeadTexture; + SP m_lockDead2Texture; + SP m_lockTtyTextTexture; + SShader m_finalScreenShader; + CTimer m_globalTimer; + GLuint m_currentProgram; + ASP m_backgroundResource; + bool m_backgroundResourceFailed = false; + + void logShaderError(const GLuint&, bool program = false, bool silent = false); + void createBGTextureForMonitor(PHLMONITOR); + void initDRMFormats(); + void initEGL(bool gbm); + EGLDeviceEXT eglDeviceFromDRMFD(int drmFD); + void initAssets(); + void initMissingAssetTexture(); + void requestBackgroundResource(); // std::optional> getModsForFormat(EGLint format); -- cgit v1.2.3