From eb25dfd399d481ce770c8851416b70b077892afc Mon Sep 17 00:00:00 2001 From: Tom Englund Date: Sat, 27 Sep 2025 18:46:26 +0200 Subject: opengl: move from unordered_set to array setCapStatus is a a heavy used function in hot rendering paths, it shows up in profiling as using a bit of cpu just because of unordered_set hashing etc, move to a enum and array and cache only the heavily used ones. --- src/render/OpenGL.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/render/OpenGL.hpp') diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp index a69ebbfe..a6dbd339 100644 --- a/src/render/OpenGL.hpp +++ b/src/render/OpenGL.hpp @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -341,6 +340,13 @@ class CHyprOpenGLImpl { eEGLContextVersion m_eglContextVersion = EGL_CONTEXT_GLES_3_2; + enum eCachedCapStatus : uint8_t { + CAP_STATUS_BLEND = 0, + CAP_STATUS_SCISSOR_TEST, + CAP_STATUS_STENCIL_TEST, + CAP_STATUS_END + }; + private: struct { GLint x = 0; @@ -349,7 +355,7 @@ class CHyprOpenGLImpl { GLsizei height = 0; } m_lastViewport; - std::unordered_map m_capStatus; + std::array m_capStatus; std::vector m_drmFormats; bool m_hasModifiers = false; -- cgit v1.2.3