diff options
-rw-r--r-- | hw/vigs/vigs_gl_backend_cgl.c | 24 | ||||
-rw-r--r-- | hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c | 24 |
2 files changed, 48 insertions, 0 deletions
diff --git a/hw/vigs/vigs_gl_backend_cgl.c b/hw/vigs/vigs_gl_backend_cgl.c index fd22577201..da2f9f63b8 100644 --- a/hw/vigs/vigs_gl_backend_cgl.c +++ b/hw/vigs/vigs_gl_backend_cgl.c @@ -88,6 +88,16 @@ struct vigs_gl_backend_cgl CGLContextObj context; }; +static const char *gl_3_2_check_funcs[] = +{ + "glGenTransformFeedbacks", + "glBindTransformFeedback", + "glPauseTransformFeedback", + "glResumeTransformFeedback", + "glDeleteTransformFeedbacks", + "glVertexAttribDivisor" +}; + static bool vigs_gl_backend_cgl_check_gl_version(struct vigs_gl_backend_cgl *gl_backend_cgl, bool *is_gl_2) { @@ -96,6 +106,7 @@ static bool vigs_gl_backend_cgl_check_gl_version(struct vigs_gl_backend_cgl *gl_ const char *tmp; CGLPixelFormatObj pixel_format; int n; + unsigned int i; tmp = getenv("GL_VERSION"); @@ -135,6 +146,19 @@ static bool vigs_gl_backend_cgl_check_gl_version(struct vigs_gl_backend_cgl *gl_ CGLDestroyPixelFormat(pixel_format); + for (i = 0; + i < sizeof(gl_3_2_check_funcs)/sizeof(gl_3_2_check_funcs[0]); + ++i) { + if (!dlsym(gl_backend_cgl->handle, + gl_3_2_check_funcs[i])) { + VIGS_LOG_INFO("Failed to find function \"%s\", using OpenGL 2.1", + gl_3_2_check_funcs[i]); + *is_gl_2 = true; + res = true; + goto out; + } + } + VIGS_LOG_INFO("Using OpenGL 3.2"); *is_gl_2 = false; res = true; diff --git a/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c b/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c index 32839a6d7f..31bf8d63c2 100644 --- a/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c +++ b/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c @@ -88,6 +88,16 @@ struct yagl_egl_cgl_context bool is_3_2_core; }; +static const char *gl_3_2_check_funcs[] = +{ + "glGenTransformFeedbacks", + "glBindTransformFeedback", + "glPauseTransformFeedback", + "glResumeTransformFeedback", + "glDeleteTransformFeedbacks", + "glVertexAttribDivisor" +}; + static bool yagl_egl_cgl_get_gl_version(struct yagl_egl_cgl *egl_cgl, yagl_gl_version *version) { @@ -96,6 +106,7 @@ static bool yagl_egl_cgl_get_gl_version(struct yagl_egl_cgl *egl_cgl, const char *tmp; CGLPixelFormatObj pixel_format; int n; + unsigned int i; YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_get_gl_version, NULL); @@ -137,6 +148,19 @@ static bool yagl_egl_cgl_get_gl_version(struct yagl_egl_cgl *egl_cgl, CGLDestroyPixelFormat(pixel_format); + for (i = 0; + i < sizeof(gl_3_2_check_funcs)/sizeof(gl_3_2_check_funcs[0]); + ++i) { + if (!yagl_dyn_lib_get_sym(egl_cgl->base.dyn_lib, + gl_3_2_check_funcs[i])) { + YAGL_LOG_INFO("Failed to find function \"%s\", using OpenGL 2.1", + gl_3_2_check_funcs[i]); + *version = yagl_gl_2; + res = true; + goto out; + } + } + YAGL_LOG_INFO("Using OpenGL 3.2"); *version = yagl_gl_3_2; res = true; |