aboutsummaryrefslogtreecommitdiff
path: root/src/egl.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2025-01-16 22:55:20 +0100
committerdec05eba <dec05eba@protonmail.com>2025-01-16 22:55:20 +0100
commitb68400ca20fa3e06070ef33afe7b303d466a7650 (patch)
treebe9c272bf20956bf14fc4cdb91665134113c5825 /src/egl.c
parent4211dfa2f8649d724f4d08f382dba7ffc7af59f9 (diff)
Add -gl-debug option to make it easier to debug user issues that cant easily be reproducedHEADmaster
Diffstat (limited to 'src/egl.c')
-rw-r--r--src/egl.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/egl.c b/src/egl.c
index 249fe53..682810d 100644
--- a/src/egl.c
+++ b/src/egl.c
@@ -344,25 +344,18 @@ static bool gsr_egl_load_gl(gsr_egl *self, void *library) {
return true;
}
-// #define GL_DEBUG_TYPE_ERROR 0x824C
-// static void debug_callback( unsigned int source,
-// unsigned int type,
-// unsigned int id,
-// unsigned int severity,
-// int length,
-// const char* message,
-// const void* userParam )
-// {
-// (void)source;
-// (void)id;
-// (void)length;
-// (void)userParam;
-// fprintf( stderr, "GL CALLBACK: %s type = 0x%x, severity = 0x%x, message = %s\n",
-// ( type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : "" ),
-// type, severity, message );
-// }
-
-bool gsr_egl_load(gsr_egl *self, gsr_window *window, bool is_monitor_capture) {
+#define GL_DEBUG_TYPE_ERROR 0x824C
+#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
+static void debug_callback(unsigned int source, unsigned int type, unsigned int id, unsigned int severity, int length, const char* message, const void* userParam) {
+ (void)source;
+ (void)id;
+ (void)length;
+ (void)userParam;
+ if(severity != GL_DEBUG_SEVERITY_NOTIFICATION)
+ fprintf(stderr, "gsr info: gl callback: %s type = 0x%x, severity = 0x%x, message = %s\n", type == GL_DEBUG_TYPE_ERROR ? "** GL ERROR **" : "", type, severity, message);
+}
+
+bool gsr_egl_load(gsr_egl *self, gsr_window *window, bool is_monitor_capture, bool enable_debug) {
memset(self, 0, sizeof(gsr_egl));
self->context_type = GSR_GL_CONTEXT_TYPE_EGL;
self->window = window;
@@ -418,8 +411,10 @@ bool gsr_egl_load(gsr_egl *self, gsr_window *window, bool is_monitor_capture) {
self->glEnable(GL_BLEND);
self->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- //self->glEnable(GL_DEBUG_OUTPUT);
- //self->glDebugMessageCallback(debug_callback, NULL);
+ if(enable_debug) {
+ self->glEnable(GL_DEBUG_OUTPUT);
+ self->glDebugMessageCallback(debug_callback, NULL);
+ }
return true;