summaryrefslogtreecommitdiff
path: root/src/render/OpenGL.hpp
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2025-09-27 18:46:26 +0200
committerVaxry <43317083+vaxerski@users.noreply.github.com>2025-09-28 23:20:52 +0200
commiteb25dfd399d481ce770c8851416b70b077892afc (patch)
tree91f1810996f6e001d4e9e964b5b17bc43266ba8b /src/render/OpenGL.hpp
parentb627885788acbab4c768632f800e010467ffbaf9 (diff)
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.
Diffstat (limited to 'src/render/OpenGL.hpp')
-rw-r--r--src/render/OpenGL.hpp10
1 files changed, 8 insertions, 2 deletions
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 <cstdint>
#include <list>
#include <string>
-#include <unordered_map>
#include <stack>
#include <map>
@@ -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<int, bool> m_capStatus;
+ std::array<bool, CAP_STATUS_END> m_capStatus;
std::vector<SDRMFormat> m_drmFormats;
bool m_hasModifiers = false;