From be8eaddd46f09bb4bc114ab3114f926da51bcfec Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Tue, 5 May 2020 12:34:24 +0100 Subject: [PATCH] wflinfo: use glGetStringi() only when available In some corner cases, we may end up attempting to get the extension list via the new API, even though we're yet to get function pointer. Fetching symbols is fun, as can be seen in the beefy comment above the glGetStringi retrieval. With this in place, we no longer crash with the following: export LIBGL_ALWAYS_SOFTWARE=1 wflinfo --platform glx --api gl --profile compat --version 3.1 Reported-by: Ben Crocker Signed-off-by: Emil Velikov --- src/utils/wflinfo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c index a3752d8..2fd9605 100644 --- a/src/utils/wflinfo.c +++ b/src/utils/wflinfo.c @@ -994,7 +994,11 @@ gl_has_extension_GetStringi(const char *name) static bool gl_has_extension(const char *name) { - if (gl_get_version() >= 30) { + // Use the new glGetStringi when possible. + // + // Due to the funky semantics of obtaining the function pointer, we can + // get here, even when it is NULL. + if (glGetStringi && gl_get_version() >= 30) { return gl_has_extension_GetStringi(name); } else { return gl_has_extension_GetString(name); -- GitLab