summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Vorobiov <s.vorobiov@samsung.com>2014-05-12 16:56:54 +0400
committerStanislav Vorobiov <s.vorobiov@samsung.com>2014-05-13 10:16:13 +0400
commit6e36571c369b56f57e962b903e67e9a464c8b5cb (patch)
tree56092bdcd662f9203241db6a76923d6043d6f3b2
parent22a343aa1f3c1ac4814f69dc1dc313436df47d14 (diff)
downloadqemu-6e36571c369b56f57e962b903e67e9a464c8b5cb.tar.gz
qemu-6e36571c369b56f57e962b903e67e9a464c8b5cb.tar.bz2
qemu-6e36571c369b56f57e962b903e67e9a464c8b5cb.zip
YaGL/VIGS: GLESv3 workarounds for Mac OS X 10.7
Mac OS X 10.7 supports OpenGL 3.2, however, it doesn't have all the necessary functions implemented in order to implement GLESv3 on target. This workaround checks for some mandatory functions and if at least one of them is not present - we revert back to OpenGL 2.1. A nicer fix would be checking for OpenGL functions globally, not in CGL backend, this is a TODO Change-Id: I9c0acce3220af9ed7276a8586fa18b97d8223079 Signed-off-by: Stanislav Vorobiov <s.vorobiov@samsung.com>
-rw-r--r--hw/vigs/vigs_gl_backend_cgl.c24
-rw-r--r--hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c24
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;