Evas GL: Minor changes inside glGetString

This commit is contained in:
Jean-Philippe Andre 2015-10-14 17:27:23 +09:00
parent 86d1b190c2
commit ec7111938c
1 changed files with 13 additions and 9 deletions

View File

@ -657,7 +657,7 @@ _evgl_glGetString(GLenum name)
static char _version[128] = {0}; static char _version[128] = {0};
static char _glsl[128] = {0}; static char _glsl[128] = {0};
EVGL_Resource *rsc; EVGL_Resource *rsc;
const GLubyte *ret; const char *ret;
/* We wrap two values here: /* We wrap two values here:
* *
@ -678,6 +678,10 @@ _evgl_glGetString(GLenum name)
* --> crash moved to app side if they blindly call strstr() * --> crash moved to app side if they blindly call strstr()
*/ */
/* NOTE: Please modify software_generic/evas_engine.c as well if you change
* this function!
*/
if ((!(rsc = _evgl_tls_resource_get())) || !rsc->current_ctx) if ((!(rsc = _evgl_tls_resource_get())) || !rsc->current_ctx)
{ {
ERR("Current context is NULL, not calling glGetString"); ERR("Current context is NULL, not calling glGetString");
@ -694,17 +698,17 @@ _evgl_glGetString(GLenum name)
break; break;
case GL_SHADING_LANGUAGE_VERSION: case GL_SHADING_LANGUAGE_VERSION:
ret = glGetString(GL_SHADING_LANGUAGE_VERSION); ret = (const char *) glGetString(GL_SHADING_LANGUAGE_VERSION);
if (!ret) return NULL; if (!ret) return NULL;
#ifdef GL_GLES #ifdef GL_GLES
if (ret[18] != (GLubyte) '1') if (ret[18] != '1')
{ {
// We try not to remove the vendor fluff // We try not to remove the vendor fluff
snprintf(_glsl, sizeof(_glsl), "OpenGL ES GLSL ES 1.00 Evas GL (%s)", ((char *) ret) + 18); snprintf(_glsl, sizeof(_glsl), "OpenGL ES GLSL ES 1.00 Evas GL (%s)", ret + 18);
_glsl[sizeof(_glsl) - 1] = '\0'; _glsl[sizeof(_glsl) - 1] = '\0';
return (const GLubyte *) _glsl; return (const GLubyte *) _glsl;
} }
return ret; return (const GLubyte *) ret;
#else #else
// Desktop GL, we still keep the official name // Desktop GL, we still keep the official name
snprintf(_glsl, sizeof(_glsl), "OpenGL ES GLSL ES 1.00 Evas GL (%s)", (char *) ret); snprintf(_glsl, sizeof(_glsl), "OpenGL ES GLSL ES 1.00 Evas GL (%s)", (char *) ret);
@ -713,17 +717,17 @@ _evgl_glGetString(GLenum name)
#endif #endif
case GL_VERSION: case GL_VERSION:
ret = glGetString(GL_VERSION); ret = (const char *) glGetString(GL_VERSION);
if (!ret) return NULL; if (!ret) return NULL;
#ifdef GL_GLES #ifdef GL_GLES
if ((ret[10] != (GLubyte) '2') && (ret[10] != (GLubyte) '3')) if ((ret[10] != '2') && (ret[10] != '3'))
{ {
// We try not to remove the vendor fluff // We try not to remove the vendor fluff
snprintf(_version, sizeof(_version), "OpenGL ES 2.0 Evas GL (%s)", ((char *) ret) + 10); snprintf(_version, sizeof(_version), "OpenGL ES 2.0 Evas GL (%s)", ret + 10);
_version[sizeof(_version) - 1] = '\0'; _version[sizeof(_version) - 1] = '\0';
return (const GLubyte *) _version; return (const GLubyte *) _version;
} }
return ret; return (const GLubyte *) ret;
#else #else
// Desktop GL, we still keep the official name // Desktop GL, we still keep the official name
snprintf(_version, sizeof(_version), "OpenGL ES 2.0 Evas GL (%s)", (char *) ret); snprintf(_version, sizeof(_version), "OpenGL ES 2.0 Evas GL (%s)", (char *) ret);