From 253085375b85116c27298cd8d017fbd42b22899b Mon Sep 17 00:00:00 2001 From: Stanislav Vorobiov Date: Mon, 12 May 2014 17:34:20 +0400 Subject: [PATCH] check_gl: GLESv3 workaround 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 conclude that GLESv3 is not supported Change-Id: I855c5cfbb724b8f43ba00dbfa6f5c30431a91d4b Signed-off-by: Stanislav Vorobiov --- tizen/src/check_gl_core.c | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/tizen/src/check_gl_core.c b/tizen/src/check_gl_core.c index b8422c59b7..6e48d66c8c 100644 --- a/tizen/src/check_gl_core.c +++ b/tizen/src/check_gl_core.c @@ -47,6 +47,16 @@ static const char *gl_version_str[gl_3_2 + 1] = "3.2" }; +static const char *gl_3_2_check_funcs[] = +{ + "glGenTransformFeedbacks", + "glBindTransformFeedback", + "glPauseTransformFeedback", + "glResumeTransformFeedback", + "glDeleteTransformFeedbacks", + "glVertexAttribDivisor" +}; + void check_gl_log(gl_log_level level, const char *format, ...) { va_list args; @@ -64,6 +74,7 @@ void check_gl_log(gl_log_level level, const char *format, ...) static const GLubyte *(GLAPIENTRY *get_string)(GLenum); static const GLubyte *(GLAPIENTRY *get_stringi)(GLenum, GLuint); static void (GLAPIENTRY *get_integerv)(GLenum, GLint*); +static void (GLAPIENTRY *dummy)(); static struct gl_context *check_gl_version(gl_version version) { @@ -131,6 +142,7 @@ int check_gl(void) struct gl_context *ctx_3_1; struct gl_context *ctx_3_2; int have_es3 = 0; + int have_es3_compatibility = 0; int have_es1 = 0; if (!check_gl_init()) { @@ -153,7 +165,25 @@ int check_gl(void) } have_es1 = (ctx_2 != NULL); - have_es3 = (ctx_3_2 != NULL); + + if (ctx_3_2) { + unsigned int i; + int found_all = 1; + + for (i = 0; + i < sizeof(gl_3_2_check_funcs)/sizeof(gl_3_2_check_funcs[0]); + ++i) { + if (!check_gl_procaddr((void**)&dummy, gl_3_2_check_funcs[i], 1) || + !dummy) { + found_all = 0; + break; + } + } + + if (found_all) { + have_es3 = 1; + } + } /* * Check if GL_ARB_ES3_compatibility is supported within @@ -172,6 +202,7 @@ int check_gl(void) if (strcmp(tmp, "GL_ARB_ES3_compatibility") == 0) { have_es3 = 1; + have_es3_compatibility = 1; break; } } @@ -183,11 +214,11 @@ int check_gl(void) * Check if OpenGL 2.1 contexts can be shared with OpenGL 3.x contexts */ - if (ctx_2 && ((ctx_3_1 && have_es3) || ctx_3_2)) { + if (ctx_2 && have_es3) { struct gl_context *ctx = NULL; - ctx = check_gl_context_create(((ctx_3_1 && have_es3) ? ctx_3_1 - : ctx_3_2), + ctx = check_gl_context_create(((ctx_3_1 && have_es3_compatibility) ? ctx_3_1 + : ctx_3_2), gl_2); if (ctx) { -- 2.34.1