[mutter] cogl/gl: Handle bogus glGetString(GL_RENDERER) return values
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cogl/gl: Handle bogus glGetString(GL_RENDERER) return values
- Date: Fri, 16 Jul 2021 17:06:59 +0000 (UTC)
commit e4375046e04111fb569ac1686233b40ba75849f7
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Wed Jul 14 16:48:34 2021 +0200
cogl/gl: Handle bogus glGetString(GL_RENDERER) return values
Seems glGetString(GL_RENDERER) in the wild can return NULL, causing
issues with strstr(). Handle this more gracefully by using
g_return_val_if_fail(), that assumes a NULL renderer means software
rendering.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1931>
cogl/cogl/driver/gl/cogl-util-gl.c | 7 +++++++
1 file changed, 7 insertions(+)
---
diff --git a/cogl/cogl/driver/gl/cogl-util-gl.c b/cogl/cogl/driver/gl/cogl-util-gl.c
index 096fcb7886..80c4179130 100644
--- a/cogl/cogl/driver/gl/cogl-util-gl.c
+++ b/cogl/cogl/driver/gl/cogl-util-gl.c
@@ -460,6 +460,13 @@ _cogl_driver_gl_is_hardware_accelerated (CoglContext *ctx)
const char *renderer = (const char *) ctx->glGetString (GL_RENDERER);
gboolean software;
+ if (!renderer)
+ {
+ g_warning ("OpenGL driver returned NULL as the renderer, "
+ "something is wrong");
+ return TRUE;
+ }
+
software = strstr (renderer, "llvmpipe") != NULL ||
strstr (renderer, "softpipe") != NULL ||
strstr (renderer, "software rasterizer") != NULL ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]