summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-10-14 17:27:53 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-10-14 19:46:47 +0900
commita23fcb8b71a6a849b429f7501b433d7dc1daf470 (patch)
tree1a7984bb5aaa7565fdc5a809d6c6ddddfc21b694
parentec7111938c80a28671793f586f62df1e02b39ec9 (diff)
Evas GL: Implement glGetString wrapper for OSMesa
This is only one step into making the software engine actually work the same as a proper GL engine from Evas GL APIs point of view. This is necessary for the test suite (coming next).
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c55
1 files changed, 49 insertions, 6 deletions
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 3bde9014b7..4eaa9a481c 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -211,7 +211,7 @@ static void (*_sym_glGetShaderiv) (GLuint shader,
211static void (*_sym_glGetShaderInfoLog) (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) = NULL; 211static void (*_sym_glGetShaderInfoLog) (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) = NULL;
212static void (*_sym_glGetShaderPrecisionFormat) (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) = NULL; 212static void (*_sym_glGetShaderPrecisionFormat) (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) = NULL;
213static void (*_sym_glGetShaderSource) (GLuint shader, GLsizei bufsize, GLsizei* length, char* source) = NULL; 213static void (*_sym_glGetShaderSource) (GLuint shader, GLsizei bufsize, GLsizei* length, char* source) = NULL;
214static const GLubyte *(*_sym_glGetString) (GLenum name) = NULL; 214static const GLubyte *(*_sym_glGetString) (GLenum name) = NULL;
215static void (*_sym_glGetTexParameterfv) (GLenum target, GLenum pname, GLfloat* params) = NULL; 215static void (*_sym_glGetTexParameterfv) (GLenum target, GLenum pname, GLfloat* params) = NULL;
216static void (*_sym_glGetTexParameteriv) (GLenum target, GLenum pname, GLint* params) = NULL; 216static void (*_sym_glGetTexParameteriv) (GLenum target, GLenum pname, GLint* params) = NULL;
217static void (*_sym_glGetUniformfv) (GLuint program, GLint location, GLfloat* params) = NULL; 217static void (*_sym_glGetUniformfv) (GLuint program, GLint location, GLfloat* params) = NULL;
@@ -4886,11 +4886,53 @@ evgl_glShaderBinary(GLsizei n EINA_UNUSED, const GLuint* shaders EINA_UNUSED, GL
4886 //n = binaryformat = length = 0; 4886 //n = binaryformat = length = 0;
4887 //shaders = binary = 0; 4887 //shaders = binary = 0;
4888} 4888}
4889#endif 4889
4890//--------------------------------------------------------------// 4890static const GLubyte *
4891evgl_glGetString(GLenum name)
4892{
4893 static char _version[128] = {0};
4894 static char _glsl[128] = {0};
4895 const char *ret;
4896
4897 /* NOTE: Please modify gl_common/evas_gl_api.c as well if you change
4898 * this function!
4899 */
4900
4901 switch (name)
4902 {
4903 case GL_VENDOR:
4904 case GL_RENDERER:
4905 // Keep these as-is.
4906 break;
4907
4908 case GL_SHADING_LANGUAGE_VERSION:
4909 ret = (const char *) _sym_glGetString(GL_SHADING_LANGUAGE_VERSION);
4910 if (!ret) return NULL;
4911 snprintf(_glsl, sizeof(_glsl), "OpenGL ES GLSL ES 1.00 Evas GL (%s)", (char *) ret);
4912 _version[sizeof(_glsl) - 1] = '\0';
4913 return (const GLubyte *) _glsl;
4914
4915 case GL_VERSION:
4916 ret = (const char *) _sym_glGetString(GL_VERSION);
4917 if (!ret) return NULL;
4918 snprintf(_version, sizeof(_version), "OpenGL ES 2.0 Evas GL (%s)", (char *) ret);
4919 _version[sizeof(_version) - 1] = '\0';
4920 return (const GLubyte *) _version;
4921
4922 case GL_EXTENSIONS:
4923 // assume OSMesa's extensions are safe (no messing with GL context here)
4924 break;
4925
4926 default:
4927 // GL_INVALID_ENUM is generated if name is not an accepted value.
4928 WRN("Unknown string requested: %x", (unsigned int) name);
4929 break;
4930 }
4931
4932 return _sym_glGetString(name);
4933}
4891 4934
4892 4935
4893#ifdef EVAS_GL
4894static void 4936static void
4895override_gl_apis(Evas_GL_API *api) 4937override_gl_apis(Evas_GL_API *api)
4896{ 4938{
@@ -4959,7 +5001,7 @@ override_gl_apis(Evas_GL_API *api)
4959 ORD(glGetAttribLocation); 5001 ORD(glGetAttribLocation);
4960 ORD(glGetBooleanv); 5002 ORD(glGetBooleanv);
4961 ORD(glGetBufferParameteriv); 5003 ORD(glGetBufferParameteriv);
4962 ORD(glGetError); 5004 ORD(glGetError); // FIXME
4963 ORD(glGetFloatv); 5005 ORD(glGetFloatv);
4964 ORD(glGetFramebufferAttachmentParameteriv); 5006 ORD(glGetFramebufferAttachmentParameteriv);
4965 ORD(glGetIntegerv); 5007 ORD(glGetIntegerv);
@@ -4970,7 +5012,6 @@ override_gl_apis(Evas_GL_API *api)
4970 ORD(glGetShaderInfoLog); 5012 ORD(glGetShaderInfoLog);
4971 ORD(glGetShaderPrecisionFormat); 5013 ORD(glGetShaderPrecisionFormat);
4972 ORD(glGetShaderSource); 5014 ORD(glGetShaderSource);
4973 ORD(glGetString); // FIXME
4974 ORD(glGetTexParameterfv); 5015 ORD(glGetTexParameterfv);
4975 ORD(glGetTexParameteriv); 5016 ORD(glGetTexParameteriv);
4976 ORD(glGetUniformfv); 5017 ORD(glGetUniformfv);
@@ -5044,6 +5085,8 @@ override_gl_apis(Evas_GL_API *api)
5044#undef ORD 5085#undef ORD
5045 5086
5046#define ORD(f) EVAS_API_OVERRIDE(f, &gl_funcs, evgl_) 5087#define ORD(f) EVAS_API_OVERRIDE(f, &gl_funcs, evgl_)
5088 ORD(glGetString);
5089
5047 if (!gl_lib_is_gles) 5090 if (!gl_lib_is_gles)
5048 { 5091 {
5049 // Override functions wrapped by Evas_GL 5092 // Override functions wrapped by Evas_GL