aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-04-07 11:01:03 +0200
committerdec05eba <dec05eba@protonmail.com>2022-04-07 11:01:03 +0200
commit581ac06f59144f3cd17cfbb99844962c468a96df (patch)
tree199463731761875a02e82530af1f976d247975b6 /src
parentd89e3d1a1cf432210361d1b0aafad8308d8ac961 (diff)
Force disable threaded gl optimization to reduce cpu usage (thread optimization doesn't improve performance here so its useless)
Diffstat (limited to 'src')
-rw-r--r--src/gl.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gl.c b/src/gl.c
index e9eeacb..0745810 100644
--- a/src/gl.c
+++ b/src/gl.c
@@ -1,6 +1,7 @@
#include "../include/mgl/gl.h"
#include <dlfcn.h>
#include <stdio.h>
+#include <stdlib.h>
typedef struct {
void **func;
@@ -19,6 +20,9 @@ static void* dlsym_print_fail(void *handle, const char *name) {
}
int mgl_gl_load(mgl_gl *self) {
+ /* Threaded gl optimization doesn't improve performance here, it just increases cpu usage, so force disable it if the user has enabled it */
+ setenv("__GL_THREADED_OPTIMIZATIONS", "0", 1);
+
const char *glx_path = "libGL.so.1";
self->handle = dlopen(glx_path, RTLD_LAZY);
if(!self->handle) {