mirror of
https://github.com/yshui/picom.git
synced 2024-11-11 13:51:02 -05:00
gl_common: don't use GL4 feature
glGetIntegerv(GL_NUM_EXTENSIONS) is only available since GL4. (However glGetStringi(GL_EXTENSIONS) is available since GL3) Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
2d50d32bf7
commit
3cabba6161
1 changed files with 11 additions and 9 deletions
|
@ -175,24 +175,26 @@ static inline void gl_check_err_(const char *func, int line) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void gl_clear_err(void) {
|
||||||
|
while (glGetError() != GL_NO_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
#define gl_check_err() gl_check_err_(__func__, __LINE__)
|
#define gl_check_err() gl_check_err_(__func__, __LINE__)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a GLX extension exists.
|
* Check if a GLX extension exists.
|
||||||
*/
|
*/
|
||||||
static inline bool gl_has_extension(const char *ext) {
|
static inline bool gl_has_extension(const char *ext) {
|
||||||
GLint nexts = 0;
|
for (int i = 0; ; i++) {
|
||||||
glGetIntegerv(GL_NUM_EXTENSIONS, &nexts);
|
|
||||||
if (!nexts) {
|
|
||||||
log_error("Failed to get GL extension list.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < nexts; i++) {
|
|
||||||
const char *exti = (const char *)glGetStringi(GL_EXTENSIONS, (GLuint)i);
|
const char *exti = (const char *)glGetStringi(GL_EXTENSIONS, (GLuint)i);
|
||||||
if (strcmp(ext, exti) == 0)
|
if (exti == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (strcmp(ext, exti) == 0) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
gl_clear_err();
|
||||||
log_info("Missing GL extension %s.", ext);
|
log_info("Missing GL extension %s.", ext);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue