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>
This commit is contained in:
parent
b65555a958
commit
e4375046e0
@ -460,6 +460,13 @@ _cogl_driver_gl_is_hardware_accelerated (CoglContext *ctx)
|
|||||||
const char *renderer = (const char *) ctx->glGetString (GL_RENDERER);
|
const char *renderer = (const char *) ctx->glGetString (GL_RENDERER);
|
||||||
gboolean software;
|
gboolean software;
|
||||||
|
|
||||||
|
if (!renderer)
|
||||||
|
{
|
||||||
|
g_warning ("OpenGL driver returned NULL as the renderer, "
|
||||||
|
"something is wrong");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
software = strstr (renderer, "llvmpipe") != NULL ||
|
software = strstr (renderer, "llvmpipe") != NULL ||
|
||||||
strstr (renderer, "softpipe") != NULL ||
|
strstr (renderer, "softpipe") != NULL ||
|
||||||
strstr (renderer, "software rasterizer") != NULL ||
|
strstr (renderer, "software rasterizer") != NULL ||
|
||||||
|
Loading…
Reference in New Issue
Block a user