summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-11-27 19:05:26 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-11-27 20:50:47 +0900
commitd8a4792612822d53e28a86f300e3c52ac9156aa4 (patch)
tree53ed81ea7a16cd2cf466a4f126375924a193237b
parent9f38aadd38183c372dd1db445d2cc6c153a3b8ef (diff)
Evas GL: Also return fake GLSL version string
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_api.c59
1 files changed, 35 insertions, 24 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_api.c b/src/modules/evas/engines/gl_common/evas_gl_api.c
index 4992acd..6a5ea56 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_api.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_api.c
@@ -547,10 +547,10 @@ _evgl_glGetIntegerv(GLenum pname, GLint* params)
547static const GLubyte * 547static const GLubyte *
548_evgl_glGetString(GLenum name) 548_evgl_glGetString(GLenum name)
549{ 549{
550 static char _version[64] = {0}; 550 static char _version[128] = {0};
551 static char _glsl[128] = {0};
551 EVGL_Resource *rsc; 552 EVGL_Resource *rsc;
552 const GLubyte *ret; 553 const GLubyte *ret;
553 char *r;
554 554
555 /* We wrap two values here: 555 /* We wrap two values here:
556 * 556 *
@@ -583,40 +583,51 @@ _evgl_glGetString(GLenum name)
583 { 583 {
584 case GL_VENDOR: 584 case GL_VENDOR:
585 case GL_RENDERER: 585 case GL_RENDERER:
586 case GL_SHADING_LANGUAGE_VERSION: 586 // Keep these as-is.
587 // GLSL version example strings (for the same GPU):
588 // For OpenGL ES 2.0 or 3.0: "OpenGL ES GLSL ES 3.10"
589 // For Desktop OpenGL: "4.40 NVIDIA via Cg compiler"
590 break; 587 break;
591 case GL_VERSION: 588
592 ret = glGetString(GL_VERSION); 589 case GL_SHADING_LANGUAGE_VERSION:
590 ret = glGetString(GL_SHADING_LANGUAGE_VERSION);
593 if (!ret) return NULL; 591 if (!ret) return NULL;
594 if (strstr((const char *) ret, "OpenGL ES 3")) 592#ifdef GL_GLES
593 if (ret[15] != (GLubyte) '1')
595 { 594 {
596 // We try not to remove the vendor fluff (contains driver version) 595 // We try not to remove the vendor fluff
597 strncpy(_version, (const char *) ret, sizeof(_version)); 596 snprintf(_glsl, sizeof(_glsl), "OpenGL ES GLSL ES 1.00 Evas GL (%s)", ((char *) ret) + 18);
598 r = strchr(_version, '3'); 597 _glsl[sizeof(_glsl) - 1] = '\0';
599 if (r) 598 return (const GLubyte *) _glsl;
600 {
601 *r++ = '2';
602 *r++ = '.';
603 *r++ = '0';
604 *r = ' ';
605 }
606 _version[sizeof(_version) - 1] = '\0';
607 return (const GLubyte *) _version;
608 } 599 }
609 else if (!strstr((const char *) ret, "OpenGL ES")) 600 return ret;
601#else
602 // Desktop GL, we still keep the official name
603 snprintf(_glsl, sizeof(_glsl), "OpenGL ES GLSL ES 1.00 Evas GL (%s)", (char *) ret);
604 _version[sizeof(_glsl) - 1] = '\0';
605 return (const GLubyte *) _glsl;
606#endif
607
608 case GL_VERSION:
609 ret = glGetString(GL_VERSION);
610 if (!ret) return NULL;
611#ifdef GL_GLES
612 if (ret[11] != (GLubyte) '2')
610 { 613 {
611 // Desktop GL, we still keep the official name 614 // We try not to remove the vendor fluff
612 snprintf(_version, sizeof(_version), "OpenGL ES 2.0 (%s)", (char *) ret); 615 snprintf(_version, sizeof(_version), "OpenGL ES 2.0 Evas GL (%s)", ((char *) ret) + 10);
613 _version[sizeof(_version) - 1] = '\0'; 616 _version[sizeof(_version) - 1] = '\0';
614 return (const GLubyte *) _version; 617 return (const GLubyte *) _version;
615 } 618 }
616 return ret; 619 return ret;
620#else
621 // Desktop GL, we still keep the official name
622 snprintf(_version, sizeof(_version), "OpenGL ES 2.0 Evas GL (%s)", (char *) ret);
623 _version[sizeof(_version) - 1] = '\0';
624 return (const GLubyte *) _version;
625#endif
626
617 case GL_EXTENSIONS: 627 case GL_EXTENSIONS:
618 return (GLubyte *) evgl_api_ext_string_get 628 return (GLubyte *) evgl_api_ext_string_get
619 (EINA_TRUE, (rsc->current_ctx->version == EVAS_GL_GLES_1_X)); 629 (EINA_TRUE, (rsc->current_ctx->version == EVAS_GL_GLES_1_X));
630
620 default: 631 default:
621 // GL_INVALID_ENUM is generated if name is not an accepted value. 632 // GL_INVALID_ENUM is generated if name is not an accepted value.
622 WRN("Unknown string requested: %x", (unsigned int) name); 633 WRN("Unknown string requested: %x", (unsigned int) name);