diff options
author | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
commit | 07274513e984f0b5544586c74508ccd16e7dcafa (patch) | |
tree | b32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/evas/src/modules/engines/software_generic/evas_engine.c | |
parent | Added Irrlicht 1.8, but without all the Windows binaries. (diff) | |
download | SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2 SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz |
Remove EFL, since it's been released now.
Diffstat (limited to '')
-rw-r--r-- | libraries/evas/src/modules/engines/software_generic/evas_engine.c | 2818 |
1 files changed, 0 insertions, 2818 deletions
diff --git a/libraries/evas/src/modules/engines/software_generic/evas_engine.c b/libraries/evas/src/modules/engines/software_generic/evas_engine.c deleted file mode 100644 index 4667f6b..0000000 --- a/libraries/evas/src/modules/engines/software_generic/evas_engine.c +++ /dev/null | |||
@@ -1,2818 +0,0 @@ | |||
1 | #include "evas_common.h" /* Also includes international specific stuff */ | ||
2 | #include "evas_private.h" | ||
3 | |||
4 | #ifdef HAVE_DLSYM | ||
5 | # include <dlfcn.h> /* dlopen,dlclose,etc */ | ||
6 | |||
7 | # define EVAS_GL 1 | ||
8 | # define EVAS_GL_NO_GL_H_CHECK 1 | ||
9 | # include "Evas_GL.h" | ||
10 | |||
11 | #else | ||
12 | # warning software_generic will not be able to have Evas_GL API. | ||
13 | #endif | ||
14 | |||
15 | #ifdef EVAS_GL | ||
16 | //----------------------------------// | ||
17 | // OSMesa... | ||
18 | |||
19 | #define OSMESA_MAJOR_VERSION 6 | ||
20 | #define OSMESA_MINOR_VERSION 5 | ||
21 | #define OSMESA_PATCH_VERSION 0 | ||
22 | |||
23 | /* | ||
24 | * Values for the format parameter of OSMesaCreateContext() | ||
25 | * New in version 2.0. | ||
26 | */ | ||
27 | #define OSMESA_COLOR_INDEX GL_COLOR_INDEX | ||
28 | #define OSMESA_RGBA GL_RGBA | ||
29 | #define OSMESA_BGRA 0x1 | ||
30 | #define OSMESA_ARGB 0x2 | ||
31 | #define OSMESA_RGB GL_RGB | ||
32 | #define OSMESA_BGR 0x4 | ||
33 | #define OSMESA_RGB_565 0x5 | ||
34 | |||
35 | |||
36 | /* | ||
37 | * OSMesaPixelStore() parameters: | ||
38 | * New in version 2.0. | ||
39 | */ | ||
40 | #define OSMESA_ROW_LENGTH 0x10 | ||
41 | #define OSMESA_Y_UP 0x11 | ||
42 | |||
43 | |||
44 | /* | ||
45 | * Accepted by OSMesaGetIntegerv: | ||
46 | */ | ||
47 | #define OSMESA_WIDTH 0x20 | ||
48 | #define OSMESA_HEIGHT 0x21 | ||
49 | #define OSMESA_FORMAT 0x22 | ||
50 | #define OSMESA_TYPE 0x23 | ||
51 | #define OSMESA_MAX_WIDTH 0x24 /* new in 4.0 */ | ||
52 | #define OSMESA_MAX_HEIGHT 0x25 /* new in 4.0 */ | ||
53 | |||
54 | |||
55 | typedef void (*OSMESAproc)(); | ||
56 | typedef struct osmesa_context *OSMesaContext; | ||
57 | #endif | ||
58 | |||
59 | typedef struct _Render_Engine_GL_Surface Render_Engine_GL_Surface; | ||
60 | typedef struct _Render_Engine_GL_Context Render_Engine_GL_Context; | ||
61 | |||
62 | struct _Render_Engine_GL_Surface | ||
63 | { | ||
64 | int initialized; | ||
65 | int w, h; | ||
66 | |||
67 | #ifdef EVAS_GL | ||
68 | GLenum internal_fmt; | ||
69 | #endif | ||
70 | int internal_cpp; // Component per pixel. ie. RGB = 3 | ||
71 | |||
72 | int depth_bits; | ||
73 | int stencil_bits; | ||
74 | |||
75 | // Data | ||
76 | void *buffer; | ||
77 | |||
78 | Render_Engine_GL_Context *current_ctx; | ||
79 | }; | ||
80 | |||
81 | #ifdef EVAS_GL | ||
82 | struct _Render_Engine_GL_Context | ||
83 | { | ||
84 | int initialized; | ||
85 | |||
86 | OSMesaContext context; | ||
87 | |||
88 | Render_Engine_GL_Context *share_ctx; | ||
89 | |||
90 | Render_Engine_GL_Surface *current_sfc; | ||
91 | }; | ||
92 | |||
93 | //------------------------------------------------------// | ||
94 | typedef void (*_eng_fn) (void ); | ||
95 | typedef _eng_fn (*glsym_func_eng_fn) (); | ||
96 | typedef void (*glsym_func_void) (); | ||
97 | typedef unsigned int (*glsym_func_uint) (); | ||
98 | typedef int (*glsym_func_int) (); | ||
99 | typedef unsigned char (*glsym_func_uchar) (); | ||
100 | typedef unsigned char *(*glsym_func_uchar_ptr) (); | ||
101 | typedef const unsigned char *(*glsym_func_const_uchar_ptr) (); | ||
102 | typedef char const *(*glsym_func_char_const_ptr) (); | ||
103 | typedef GLboolean (*glsym_func_bool) (); | ||
104 | typedef OSMesaContext (*glsym_func_osm_ctx) (); | ||
105 | //------------------------------------------------------// | ||
106 | |||
107 | /* Function table for GL APIs */ | ||
108 | static Evas_GL_API gl_funcs; | ||
109 | static void *gl_lib_handle; | ||
110 | static int gl_lib_is_gles = 0; | ||
111 | static Evas_GL_API gl_funcs; | ||
112 | |||
113 | //------------------------------------------------------// | ||
114 | // OSMesa APIS... | ||
115 | static OSMesaContext (*_sym_OSMesaCreateContextExt) (GLenum format, GLint depthBits, GLint stencilBits, GLint accumBits, OSMesaContext sharelist) = NULL; | ||
116 | static void (*_sym_OSMesaDestroyContext) (OSMesaContext ctx) = NULL; | ||
117 | static GLboolean (*_sym_OSMesaMakeCurrent) (OSMesaContext ctx, void *buffer, GLenum type, GLsizei width, GLsizei height) = NULL; | ||
118 | static void (*_sym_OSMesaPixelStore) (GLint pname, GLint value) = NULL; | ||
119 | static OSMESAproc (*_sym_OSMesaGetProcAddress) (const char *funcName); | ||
120 | |||
121 | |||
122 | //------------------------------------------------------// | ||
123 | // GLES 2.0 APIs... | ||
124 | static void (*_sym_glActiveTexture) (GLenum texture) = NULL; | ||
125 | static void (*_sym_glAttachShader) (GLuint program, GLuint shader) = NULL; | ||
126 | static void (*_sym_glBindAttribLocation) (GLuint program, GLuint index, const char* name) = NULL; | ||
127 | static void (*_sym_glBindBuffer) (GLenum target, GLuint buffer) = NULL; | ||
128 | static void (*_sym_glBindFramebuffer) (GLenum target, GLuint framebuffer) = NULL; | ||
129 | static void (*_sym_glBindRenderbuffer) (GLenum target, GLuint renderbuffer) = NULL; | ||
130 | static void (*_sym_glBindTexture) (GLenum target, GLuint texture) = NULL; | ||
131 | static void (*_sym_glBlendColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) = NULL; | ||
132 | static void (*_sym_glBlendEquation) (GLenum mode) = NULL; | ||
133 | static void (*_sym_glBlendEquationSeparate) (GLenum modeRGB, GLenum modeAlpha) = NULL; | ||
134 | static void (*_sym_glBlendFunc) (GLenum sfactor, GLenum dfactor) = NULL; | ||
135 | static void (*_sym_glBlendFuncSeparate) (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) = NULL; | ||
136 | static void (*_sym_glBufferData) (GLenum target, GLsizeiptr size, const void* data, GLenum usage) = NULL; | ||
137 | static void (*_sym_glBufferSubData) (GLenum target, GLintptr offset, GLsizeiptr size, const void* data) = NULL; | ||
138 | static GLenum (*_sym_glCheckFramebufferStatus) (GLenum target) = NULL; | ||
139 | static void (*_sym_glClear) (GLbitfield mask) = NULL; | ||
140 | static void (*_sym_glClearColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) = NULL; | ||
141 | static void (*_sym_glClearDepthf) (GLclampf depth) = NULL; | ||
142 | static void (*_sym_glClearStencil) (GLint s) = NULL; | ||
143 | static void (*_sym_glColorMask) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) = NULL; | ||
144 | static void (*_sym_glCompileShader) (GLuint shader) = NULL; | ||
145 | static void (*_sym_glCompressedTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) = NULL; | ||
146 | static void (*_sym_glCompressedTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) = NULL; | ||
147 | static void (*_sym_glCopyTexImage2D) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) = NULL; | ||
148 | static void (*_sym_glCopyTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) = NULL; | ||
149 | static GLuint (*_sym_glCreateProgram) (void) = NULL; | ||
150 | static GLuint (*_sym_glCreateShader) (GLenum type) = NULL; | ||
151 | static void (*_sym_glCullFace) (GLenum mode) = NULL; | ||
152 | static void (*_sym_glDeleteBuffers) (GLsizei n, const GLuint* buffers) = NULL; | ||
153 | static void (*_sym_glDeleteFramebuffers) (GLsizei n, const GLuint* framebuffers) = NULL; | ||
154 | static void (*_sym_glDeleteProgram) (GLuint program) = NULL; | ||
155 | static void (*_sym_glDeleteRenderbuffers) (GLsizei n, const GLuint* renderbuffers) = NULL; | ||
156 | static void (*_sym_glDeleteShader) (GLuint shader) = NULL; | ||
157 | static void (*_sym_glDeleteTextures) (GLsizei n, const GLuint* textures) = NULL; | ||
158 | static void (*_sym_glDepthFunc) (GLenum func) = NULL; | ||
159 | static void (*_sym_glDepthMask) (GLboolean flag) = NULL; | ||
160 | static void (*_sym_glDepthRangef) (GLclampf zNear, GLclampf zFar) = NULL; | ||
161 | static void (*_sym_glDetachShader) (GLuint program, GLuint shader) = NULL; | ||
162 | static void (*_sym_glDisable) (GLenum cap) = NULL; | ||
163 | static void (*_sym_glDisableVertexAttribArray) (GLuint index) = NULL; | ||
164 | static void (*_sym_glDrawArrays) (GLenum mode, GLint first, GLsizei count) = NULL; | ||
165 | static void (*_sym_glDrawElements) (GLenum mode, GLsizei count, GLenum type, const void* indices) = NULL; | ||
166 | static void (*_sym_glEnable) (GLenum cap) = NULL; | ||
167 | static void (*_sym_glEnableVertexAttribArray) (GLuint index) = NULL; | ||
168 | static void (*_sym_glFinish) (void) = NULL; | ||
169 | static void (*_sym_glFlush) (void) = NULL; | ||
170 | static void (*_sym_glFramebufferRenderbuffer) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) = NULL; | ||
171 | static void (*_sym_glFramebufferTexture2D) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) = NULL; | ||
172 | static void (*_sym_glFrontFace) (GLenum mode) = NULL; | ||
173 | static void (*_sym_glGenBuffers) (GLsizei n, GLuint* buffers) = NULL; | ||
174 | static void (*_sym_glGenerateMipmap) (GLenum target) = NULL; | ||
175 | static void (*_sym_glGenFramebuffers) (GLsizei n, GLuint* framebuffers) = NULL; | ||
176 | static void (*_sym_glGenRenderbuffers) (GLsizei n, GLuint* renderbuffers) = NULL; | ||
177 | static void (*_sym_glGenTextures) (GLsizei n, GLuint* textures) = NULL; | ||
178 | static void (*_sym_glGetActiveAttrib) (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) = NULL; | ||
179 | static void (*_sym_glGetActiveUniform) (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) = NULL; | ||
180 | static void (*_sym_glGetAttachedShaders) (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) = NULL; | ||
181 | static int (*_sym_glGetAttribLocation) (GLuint program, const char* name) = NULL; | ||
182 | static void (*_sym_glGetBooleanv) (GLenum pname, GLboolean* params) = NULL; | ||
183 | static void (*_sym_glGetBufferParameteriv) (GLenum target, GLenum pname, GLint* params) = NULL; | ||
184 | static GLenum (*_sym_glGetError) (void) = NULL; | ||
185 | static void (*_sym_glGetFloatv) (GLenum pname, GLfloat* params) = NULL; | ||
186 | static void (*_sym_glGetFramebufferAttachmentParameteriv) (GLenum target, GLenum attachment, GLenum pname, GLint* params) = NULL; | ||
187 | static void (*_sym_glGetIntegerv) (GLenum pname, GLint* params) = NULL; | ||
188 | static void (*_sym_glGetProgramiv) (GLuint program, GLenum pname, GLint* params) = NULL; | ||
189 | static void (*_sym_glGetProgramInfoLog) (GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) = NULL; | ||
190 | static void (*_sym_glGetRenderbufferParameteriv) (GLenum target, GLenum pname, GLint* params) = NULL; | ||
191 | static void (*_sym_glGetShaderiv) (GLuint shader, GLenum pname, GLint* params) = NULL; | ||
192 | static void (*_sym_glGetShaderInfoLog) (GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) = NULL; | ||
193 | static void (*_sym_glGetShaderPrecisionFormat) (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) = NULL; | ||
194 | static void (*_sym_glGetShaderSource) (GLuint shader, GLsizei bufsize, GLsizei* length, char* source) = NULL; | ||
195 | static const GLubyte *(*_sym_glGetString) (GLenum name) = NULL; | ||
196 | static void (*_sym_glGetTexParameterfv) (GLenum target, GLenum pname, GLfloat* params) = NULL; | ||
197 | static void (*_sym_glGetTexParameteriv) (GLenum target, GLenum pname, GLint* params) = NULL; | ||
198 | static void (*_sym_glGetUniformfv) (GLuint program, GLint location, GLfloat* params) = NULL; | ||
199 | static void (*_sym_glGetUniformiv) (GLuint program, GLint location, GLint* params) = NULL; | ||
200 | static int (*_sym_glGetUniformLocation) (GLuint program, const char* name) = NULL; | ||
201 | static void (*_sym_glGetVertexAttribfv) (GLuint index, GLenum pname, GLfloat* params) = NULL; | ||
202 | static void (*_sym_glGetVertexAttribiv) (GLuint index, GLenum pname, GLint* params) = NULL; | ||
203 | static void (*_sym_glGetVertexAttribPointerv) (GLuint index, GLenum pname, void** pointer) = NULL; | ||
204 | static void (*_sym_glHint) (GLenum target, GLenum mode) = NULL; | ||
205 | static GLboolean (*_sym_glIsBuffer) (GLuint buffer) = NULL; | ||
206 | static GLboolean (*_sym_glIsEnabled) (GLenum cap) = NULL; | ||
207 | static GLboolean (*_sym_glIsFramebuffer) (GLuint framebuffer) = NULL; | ||
208 | static GLboolean (*_sym_glIsProgram) (GLuint program) = NULL; | ||
209 | static GLboolean (*_sym_glIsRenderbuffer) (GLuint renderbuffer) = NULL; | ||
210 | static GLboolean (*_sym_glIsShader) (GLuint shader) = NULL; | ||
211 | static GLboolean (*_sym_glIsTexture) (GLuint texture) = NULL; | ||
212 | static void (*_sym_glLineWidth) (GLfloat width) = NULL; | ||
213 | static void (*_sym_glLinkProgram) (GLuint program) = NULL; | ||
214 | static void (*_sym_glPixelStorei) (GLenum pname, GLint param) = NULL; | ||
215 | static void (*_sym_glPolygonOffset) (GLfloat factor, GLfloat units) = NULL; | ||
216 | static void (*_sym_glReadPixels) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) = NULL; | ||
217 | static void (*_sym_glReleaseShaderCompiler) (void) = NULL; | ||
218 | static void (*_sym_glRenderbufferStorage) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height) = NULL; | ||
219 | static void (*_sym_glSampleCoverage) (GLclampf value, GLboolean invert) = NULL; | ||
220 | static void (*_sym_glScissor) (GLint x, GLint y, GLsizei width, GLsizei height) = NULL; | ||
221 | static void (*_sym_glShaderBinary) (GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length) = NULL; | ||
222 | static void (*_sym_glShaderSource) (GLuint shader, GLsizei count, const char** string, const GLint* length) = NULL; | ||
223 | static void (*_sym_glStencilFunc) (GLenum func, GLint ref, GLuint mask) = NULL; | ||
224 | static void (*_sym_glStencilFuncSeparate) (GLenum face, GLenum func, GLint ref, GLuint mask) = NULL; | ||
225 | static void (*_sym_glStencilMask) (GLuint mask) = NULL; | ||
226 | static void (*_sym_glStencilMaskSeparate) (GLenum face, GLuint mask) = NULL; | ||
227 | static void (*_sym_glStencilOp) (GLenum fail, GLenum zfail, GLenum zpass) = NULL; | ||
228 | static void (*_sym_glStencilOpSeparate) (GLenum face, GLenum fail, GLenum zfail, GLenum zpass) = NULL; | ||
229 | static void (*_sym_glTexImage2D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) = NULL; | ||
230 | static void (*_sym_glTexParameterf) (GLenum target, GLenum pname, GLfloat param) = NULL; | ||
231 | static void (*_sym_glTexParameterfv) (GLenum target, GLenum pname, const GLfloat* params) = NULL; | ||
232 | static void (*_sym_glTexParameteri) (GLenum target, GLenum pname, GLint param) = NULL; | ||
233 | static void (*_sym_glTexParameteriv) (GLenum target, GLenum pname, const GLint* params) = NULL; | ||
234 | static void (*_sym_glTexSubImage2D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) = NULL; | ||
235 | static void (*_sym_glUniform1f) (GLint location, GLfloat x) = NULL; | ||
236 | static void (*_sym_glUniform1fv) (GLint location, GLsizei count, const GLfloat* v) = NULL; | ||
237 | static void (*_sym_glUniform1i) (GLint location, GLint x) = NULL; | ||
238 | static void (*_sym_glUniform1iv) (GLint location, GLsizei count, const GLint* v) = NULL; | ||
239 | static void (*_sym_glUniform2f) (GLint location, GLfloat x, GLfloat y) = NULL; | ||
240 | static void (*_sym_glUniform2fv) (GLint location, GLsizei count, const GLfloat* v) = NULL; | ||
241 | static void (*_sym_glUniform2i) (GLint location, GLint x, GLint y) = NULL; | ||
242 | static void (*_sym_glUniform2iv) (GLint location, GLsizei count, const GLint* v) = NULL; | ||
243 | static void (*_sym_glUniform3f) (GLint location, GLfloat x, GLfloat y, GLfloat z) = NULL; | ||
244 | static void (*_sym_glUniform3fv) (GLint location, GLsizei count, const GLfloat* v) = NULL; | ||
245 | static void (*_sym_glUniform3i) (GLint location, GLint x, GLint y, GLint z) = NULL; | ||
246 | static void (*_sym_glUniform3iv) (GLint location, GLsizei count, const GLint* v) = NULL; | ||
247 | static void (*_sym_glUniform4f) (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) = NULL; | ||
248 | static void (*_sym_glUniform4fv) (GLint location, GLsizei count, const GLfloat* v) = NULL; | ||
249 | static void (*_sym_glUniform4i) (GLint location, GLint x, GLint y, GLint z, GLint w) = NULL; | ||
250 | static void (*_sym_glUniform4iv) (GLint location, GLsizei count, const GLint* v) = NULL; | ||
251 | static void (*_sym_glUniformMatrix2fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) = NULL; | ||
252 | static void (*_sym_glUniformMatrix3fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) = NULL; | ||
253 | static void (*_sym_glUniformMatrix4fv) (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) = NULL; | ||
254 | static void (*_sym_glUseProgram) (GLuint program) = NULL; | ||
255 | static void (*_sym_glValidateProgram) (GLuint program) = NULL; | ||
256 | static void (*_sym_glVertexAttrib1f) (GLuint indx, GLfloat x) = NULL; | ||
257 | static void (*_sym_glVertexAttrib1fv) (GLuint indx, const GLfloat* values) = NULL; | ||
258 | static void (*_sym_glVertexAttrib2f) (GLuint indx, GLfloat x, GLfloat y) = NULL; | ||
259 | static void (*_sym_glVertexAttrib2fv) (GLuint indx, const GLfloat* values) = NULL; | ||
260 | static void (*_sym_glVertexAttrib3f) (GLuint indx, GLfloat x, GLfloat y, GLfloat z) = NULL; | ||
261 | static void (*_sym_glVertexAttrib3fv) (GLuint indx, const GLfloat* values) = NULL; | ||
262 | static void (*_sym_glVertexAttrib4f) (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) = NULL; | ||
263 | static void (*_sym_glVertexAttrib4fv) (GLuint indx, const GLfloat* values) = NULL; | ||
264 | static void (*_sym_glVertexAttribPointer) (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) = NULL; | ||
265 | static void (*_sym_glViewport) (GLint x, GLint y, GLsizei width, GLsizei height) = NULL; | ||
266 | |||
267 | // GLES Extensions... | ||
268 | /* static void (*_sym_glGetProgramBinary) (GLuint a, GLsizei b, GLsizei* c, GLenum* d, void* e) = NULL; */ | ||
269 | /* static void (*_sym_glProgramBinary) (GLuint a, GLenum b, const void* c, GLint d) = NULL; */ | ||
270 | /* static void (*_sym_glProgramParameteri) (GLuint a, GLuint b, GLint d) = NULL; */ | ||
271 | #endif | ||
272 | |||
273 | /* | ||
274 | ***** | ||
275 | ** | ||
276 | ** ENGINE ROUTINES | ||
277 | ** | ||
278 | ***** | ||
279 | */ | ||
280 | static int cpunum = 0; | ||
281 | static int _evas_soft_gen_log_dom = -1; | ||
282 | |||
283 | static void | ||
284 | eng_output_dump(void *data __UNUSED__) | ||
285 | { | ||
286 | evas_common_image_image_all_unload(); | ||
287 | evas_common_font_font_all_unload(); | ||
288 | } | ||
289 | |||
290 | static void * | ||
291 | eng_context_new(void *data __UNUSED__) | ||
292 | { | ||
293 | return evas_common_draw_context_new(); | ||
294 | } | ||
295 | |||
296 | static void | ||
297 | eng_context_free(void *data __UNUSED__, void *context) | ||
298 | { | ||
299 | evas_common_draw_context_free(context); | ||
300 | } | ||
301 | |||
302 | static void | ||
303 | eng_context_clip_set(void *data __UNUSED__, void *context, int x, int y, int w, int h) | ||
304 | { | ||
305 | evas_common_draw_context_set_clip(context, x, y, w, h); | ||
306 | } | ||
307 | |||
308 | static void | ||
309 | eng_context_clip_clip(void *data __UNUSED__, void *context, int x, int y, int w, int h) | ||
310 | { | ||
311 | evas_common_draw_context_clip_clip(context, x, y, w, h); | ||
312 | } | ||
313 | |||
314 | static void | ||
315 | eng_context_clip_unset(void *data __UNUSED__, void *context) | ||
316 | { | ||
317 | evas_common_draw_context_unset_clip(context); | ||
318 | } | ||
319 | |||
320 | static int | ||
321 | eng_context_clip_get(void *data __UNUSED__, void *context, int *x, int *y, int *w, int *h) | ||
322 | { | ||
323 | *x = ((RGBA_Draw_Context *)context)->clip.x; | ||
324 | *y = ((RGBA_Draw_Context *)context)->clip.y; | ||
325 | *w = ((RGBA_Draw_Context *)context)->clip.w; | ||
326 | *h = ((RGBA_Draw_Context *)context)->clip.h; | ||
327 | return ((RGBA_Draw_Context *)context)->clip.use; | ||
328 | } | ||
329 | |||
330 | static void | ||
331 | eng_context_color_set(void *data __UNUSED__, void *context, int r, int g, int b, int a) | ||
332 | { | ||
333 | evas_common_draw_context_set_color(context, r, g, b, a); | ||
334 | } | ||
335 | |||
336 | static int | ||
337 | eng_context_color_get(void *data __UNUSED__, void *context, int *r, int *g, int *b, int *a) | ||
338 | { | ||
339 | *r = (int)(R_VAL(&((RGBA_Draw_Context *)context)->col.col)); | ||
340 | *g = (int)(G_VAL(&((RGBA_Draw_Context *)context)->col.col)); | ||
341 | *b = (int)(B_VAL(&((RGBA_Draw_Context *)context)->col.col)); | ||
342 | *a = (int)(A_VAL(&((RGBA_Draw_Context *)context)->col.col)); | ||
343 | return 1; | ||
344 | } | ||
345 | |||
346 | static void | ||
347 | eng_context_multiplier_set(void *data __UNUSED__, void *context, int r, int g, int b, int a) | ||
348 | { | ||
349 | evas_common_draw_context_set_multiplier(context, r, g, b, a); | ||
350 | } | ||
351 | |||
352 | static void | ||
353 | eng_context_multiplier_unset(void *data __UNUSED__, void *context) | ||
354 | { | ||
355 | evas_common_draw_context_unset_multiplier(context); | ||
356 | } | ||
357 | |||
358 | static int | ||
359 | eng_context_multiplier_get(void *data __UNUSED__, void *context, int *r, int *g, int *b, int *a) | ||
360 | { | ||
361 | *r = (int)(R_VAL(&((RGBA_Draw_Context *)context)->mul.col)); | ||
362 | *g = (int)(G_VAL(&((RGBA_Draw_Context *)context)->mul.col)); | ||
363 | *b = (int)(B_VAL(&((RGBA_Draw_Context *)context)->mul.col)); | ||
364 | *a = (int)(A_VAL(&((RGBA_Draw_Context *)context)->mul.col)); | ||
365 | return ((RGBA_Draw_Context *)context)->mul.use; | ||
366 | } | ||
367 | |||
368 | static void | ||
369 | eng_context_mask_set(void *data __UNUSED__, void *context, void *mask, int x, int y, int w, int h) | ||
370 | { | ||
371 | evas_common_draw_context_set_mask(context, mask, x, y, w, h); | ||
372 | } | ||
373 | |||
374 | static void | ||
375 | eng_context_mask_unset(void *data __UNUSED__, void *context) | ||
376 | { | ||
377 | evas_common_draw_context_unset_mask(context); | ||
378 | } | ||
379 | /* | ||
380 | static void * | ||
381 | eng_context_mask_get(void *data __UNUSED__, void *context) | ||
382 | { | ||
383 | return ((RGBA_Draw_Context *)context)->mask.mask; | ||
384 | } | ||
385 | */ | ||
386 | |||
387 | static void | ||
388 | eng_context_cutout_add(void *data __UNUSED__, void *context, int x, int y, int w, int h) | ||
389 | { | ||
390 | evas_common_draw_context_add_cutout(context, x, y, w, h); | ||
391 | } | ||
392 | |||
393 | static void | ||
394 | eng_context_cutout_clear(void *data __UNUSED__, void *context) | ||
395 | { | ||
396 | evas_common_draw_context_clear_cutouts(context); | ||
397 | } | ||
398 | |||
399 | static void | ||
400 | eng_context_anti_alias_set(void *data __UNUSED__, void *context, unsigned char aa) | ||
401 | { | ||
402 | evas_common_draw_context_set_anti_alias(context, aa); | ||
403 | } | ||
404 | |||
405 | static unsigned char | ||
406 | eng_context_anti_alias_get(void *data __UNUSED__, void *context) | ||
407 | { | ||
408 | return ((RGBA_Draw_Context *)context)->anti_alias; | ||
409 | } | ||
410 | |||
411 | static void | ||
412 | eng_context_color_interpolation_set(void *data __UNUSED__, void *context, int color_space) | ||
413 | { | ||
414 | evas_common_draw_context_set_color_interpolation(context, color_space); | ||
415 | } | ||
416 | |||
417 | static int | ||
418 | eng_context_color_interpolation_get(void *data __UNUSED__, void *context) | ||
419 | { | ||
420 | return ((RGBA_Draw_Context *)context)->interpolation.color_space; | ||
421 | } | ||
422 | |||
423 | static void | ||
424 | eng_context_render_op_set(void *data __UNUSED__, void *context, int op) | ||
425 | { | ||
426 | evas_common_draw_context_set_render_op(context, op); | ||
427 | } | ||
428 | |||
429 | static int | ||
430 | eng_context_render_op_get(void *data __UNUSED__, void *context) | ||
431 | { | ||
432 | return ((RGBA_Draw_Context *)context)->render_op; | ||
433 | } | ||
434 | |||
435 | |||
436 | |||
437 | static void | ||
438 | eng_rectangle_draw(void *data __UNUSED__, void *context, void *surface, int x, int y, int w, int h) | ||
439 | { | ||
440 | #ifdef BUILD_PIPE_RENDER | ||
441 | if ((cpunum > 1) | ||
442 | #ifdef EVAS_FRAME_QUEUING | ||
443 | && evas_common_frameq_enabled() | ||
444 | #endif | ||
445 | ) | ||
446 | evas_common_pipe_rectangle_draw(surface, context, x, y, w, h); | ||
447 | else | ||
448 | #endif | ||
449 | { | ||
450 | evas_common_rectangle_draw(surface, context, x, y, w, h); | ||
451 | evas_common_cpu_end_opt(); | ||
452 | } | ||
453 | } | ||
454 | |||
455 | static void | ||
456 | eng_line_draw(void *data __UNUSED__, void *context, void *surface, int x1, int y1, int x2, int y2) | ||
457 | { | ||
458 | #ifdef BUILD_PIPE_RENDER | ||
459 | if ((cpunum > 1) | ||
460 | #ifdef EVAS_FRAME_QUEUING | ||
461 | && evas_common_frameq_enabled() | ||
462 | #endif | ||
463 | ) | ||
464 | evas_common_pipe_line_draw(surface, context, x1, y1, x2, y2); | ||
465 | else | ||
466 | #endif | ||
467 | { | ||
468 | evas_common_line_draw(surface, context, x1, y1, x2, y2); | ||
469 | evas_common_cpu_end_opt(); | ||
470 | } | ||
471 | } | ||
472 | |||
473 | static void * | ||
474 | eng_polygon_point_add(void *data __UNUSED__, void *context __UNUSED__, void *polygon, int x, int y) | ||
475 | { | ||
476 | return evas_common_polygon_point_add(polygon, x, y); | ||
477 | } | ||
478 | |||
479 | static void * | ||
480 | eng_polygon_points_clear(void *data __UNUSED__, void *context __UNUSED__, void *polygon) | ||
481 | { | ||
482 | return evas_common_polygon_points_clear(polygon); | ||
483 | } | ||
484 | |||
485 | static void | ||
486 | eng_polygon_draw(void *data __UNUSED__, void *context, void *surface, void *polygon, int x, int y) | ||
487 | { | ||
488 | #ifdef BUILD_PIPE_RENDER | ||
489 | if ((cpunum > 1) | ||
490 | #ifdef EVAS_FRAME_QUEUING | ||
491 | && evas_common_frameq_enabled() | ||
492 | #endif | ||
493 | ) | ||
494 | evas_common_pipe_poly_draw(surface, context, polygon, x, y); | ||
495 | else | ||
496 | #endif | ||
497 | { | ||
498 | evas_common_polygon_draw(surface, context, polygon, x, y); | ||
499 | evas_common_cpu_end_opt(); | ||
500 | } | ||
501 | } | ||
502 | |||
503 | static int | ||
504 | eng_image_alpha_get(void *data __UNUSED__, void *image) | ||
505 | { | ||
506 | Image_Entry *im; | ||
507 | |||
508 | if (!image) return 1; | ||
509 | im = image; | ||
510 | switch (im->space) | ||
511 | { | ||
512 | case EVAS_COLORSPACE_ARGB8888: | ||
513 | if (im->flags.alpha) return 1; | ||
514 | default: | ||
515 | break; | ||
516 | } | ||
517 | return 0; | ||
518 | } | ||
519 | |||
520 | static int | ||
521 | eng_image_colorspace_get(void *data __UNUSED__, void *image) | ||
522 | { | ||
523 | Image_Entry *im; | ||
524 | |||
525 | if (!image) return EVAS_COLORSPACE_ARGB8888; | ||
526 | im = image; | ||
527 | return im->space; | ||
528 | } | ||
529 | |||
530 | static Eina_Bool | ||
531 | eng_image_can_region_get(void *data __UNUSED__, void *image) | ||
532 | { | ||
533 | Image_Entry *im; | ||
534 | if (!image) return EINA_FALSE; | ||
535 | im = image; | ||
536 | return ((Evas_Image_Load_Func*) im->info.loader)->do_region; | ||
537 | } | ||
538 | |||
539 | static void | ||
540 | eng_image_mask_create(void *data __UNUSED__, void *image) | ||
541 | { | ||
542 | RGBA_Image *im; | ||
543 | int sz; | ||
544 | uint8_t *dst,*end; | ||
545 | uint32_t *src; | ||
546 | |||
547 | if (!image) return; | ||
548 | im = image; | ||
549 | if (im->mask.mask && !im->mask.dirty) return; | ||
550 | |||
551 | if (im->mask.mask) free(im->mask.mask); | ||
552 | sz = im->cache_entry.w * im->cache_entry.h; | ||
553 | im->mask.mask = malloc(sz); | ||
554 | dst = im->mask.mask; | ||
555 | if (!im->image.data) | ||
556 | evas_cache_image_load_data(&im->cache_entry); | ||
557 | src = (void*) im->image.data; | ||
558 | if (!src) return; | ||
559 | for (end = dst + sz ; dst < end ; dst ++, src ++) | ||
560 | *dst = *src >> 24; | ||
561 | im->mask.dirty = 0; | ||
562 | } | ||
563 | |||
564 | |||
565 | static void * | ||
566 | eng_image_alpha_set(void *data __UNUSED__, void *image, int has_alpha) | ||
567 | { | ||
568 | RGBA_Image *im; | ||
569 | |||
570 | if (!image) return NULL; | ||
571 | im = image; | ||
572 | if (im->cache_entry.space != EVAS_COLORSPACE_ARGB8888) | ||
573 | { | ||
574 | im->cache_entry.flags.alpha = 0; | ||
575 | return im; | ||
576 | } | ||
577 | im = (RGBA_Image *) evas_cache_image_alone(&im->cache_entry); | ||
578 | evas_common_image_colorspace_dirty(im); | ||
579 | |||
580 | im->cache_entry.flags.alpha = has_alpha ? 1 : 0; | ||
581 | return im; | ||
582 | } | ||
583 | |||
584 | static void * | ||
585 | eng_image_border_set(void *data __UNUSED__, void *image, int l __UNUSED__, int r __UNUSED__, int t __UNUSED__, int b __UNUSED__) | ||
586 | { | ||
587 | RGBA_Image *im; | ||
588 | |||
589 | im = image; | ||
590 | return im; | ||
591 | } | ||
592 | |||
593 | static void | ||
594 | eng_image_border_get(void *data __UNUSED__, void *image __UNUSED__, int *l __UNUSED__, int *r __UNUSED__, int *t __UNUSED__, int *b __UNUSED__) | ||
595 | { | ||
596 | } | ||
597 | |||
598 | static char * | ||
599 | eng_image_comment_get(void *data __UNUSED__, void *image, char *key __UNUSED__) | ||
600 | { | ||
601 | RGBA_Image *im; | ||
602 | |||
603 | if (!image) return NULL; | ||
604 | im = image; | ||
605 | return im->info.comment; | ||
606 | } | ||
607 | |||
608 | static char * | ||
609 | eng_image_format_get(void *data __UNUSED__, void *image __UNUSED__) | ||
610 | { | ||
611 | return NULL; | ||
612 | } | ||
613 | |||
614 | static void | ||
615 | eng_image_colorspace_set(void *data __UNUSED__, void *image, int cspace) | ||
616 | { | ||
617 | Image_Entry *im; | ||
618 | |||
619 | if (!image) return; | ||
620 | im = image; | ||
621 | evas_cache_image_colorspace(im, cspace); | ||
622 | } | ||
623 | |||
624 | static void * | ||
625 | eng_image_native_set(void *data __UNUSED__, void *image, void *native __UNUSED__) | ||
626 | { | ||
627 | //return image; | ||
628 | Evas_Native_Surface *ns = native; | ||
629 | Image_Entry *im = image, *im2 = NULL; | ||
630 | |||
631 | if (!im) | ||
632 | { | ||
633 | if ((!ns) && (ns->data.x11.visual)) | ||
634 | { | ||
635 | im = evas_cache_image_data(evas_common_image_cache_get(), | ||
636 | im->w, im->h, | ||
637 | ns->data.x11.visual, 1, | ||
638 | EVAS_COLORSPACE_ARGB8888); | ||
639 | return im; | ||
640 | } | ||
641 | else | ||
642 | return NULL; | ||
643 | } | ||
644 | |||
645 | if ((!ns) && (!im)) return im; | ||
646 | |||
647 | if (!ns) return im; | ||
648 | |||
649 | im2 = evas_cache_image_data(evas_common_image_cache_get(), | ||
650 | im->w, im->h, | ||
651 | ns->data.x11.visual, 1, | ||
652 | EVAS_COLORSPACE_ARGB8888); | ||
653 | evas_cache_image_drop(im); | ||
654 | im = im2; | ||
655 | |||
656 | return im; | ||
657 | |||
658 | } | ||
659 | |||
660 | static void * | ||
661 | eng_image_native_get(void *data __UNUSED__, void *image __UNUSED__) | ||
662 | { | ||
663 | return NULL; | ||
664 | } | ||
665 | |||
666 | static void * | ||
667 | eng_image_load(void *data __UNUSED__, const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo) | ||
668 | { | ||
669 | *error = EVAS_LOAD_ERROR_NONE; | ||
670 | return evas_common_load_image_from_file(file, key, lo, error); | ||
671 | } | ||
672 | |||
673 | static void * | ||
674 | eng_image_new_from_data(void *data __UNUSED__, int w, int h, DATA32 *image_data, int alpha, int cspace) | ||
675 | { | ||
676 | return evas_cache_image_data(evas_common_image_cache_get(), w, h, image_data, alpha, cspace); | ||
677 | } | ||
678 | |||
679 | static void * | ||
680 | eng_image_new_from_copied_data(void *data __UNUSED__, int w, int h, DATA32 *image_data, int alpha, int cspace) | ||
681 | { | ||
682 | return evas_cache_image_copied_data(evas_common_image_cache_get(), w, h, image_data, alpha, cspace); | ||
683 | } | ||
684 | |||
685 | static void | ||
686 | eng_image_free(void *data __UNUSED__, void *image) | ||
687 | { | ||
688 | evas_cache_image_drop(image); | ||
689 | } | ||
690 | |||
691 | static void | ||
692 | eng_image_size_get(void *data __UNUSED__, void *image, int *w, int *h) | ||
693 | { | ||
694 | Image_Entry *im; | ||
695 | |||
696 | im = image; | ||
697 | if (w) *w = im->w; | ||
698 | if (h) *h = im->h; | ||
699 | } | ||
700 | |||
701 | static void * | ||
702 | eng_image_size_set(void *data __UNUSED__, void *image, int w, int h) | ||
703 | { | ||
704 | Image_Entry *im = image; | ||
705 | if (!im) return NULL; | ||
706 | return evas_cache_image_size_set(im, w, h); | ||
707 | } | ||
708 | |||
709 | static void * | ||
710 | eng_image_dirty_region(void *data __UNUSED__, void *image, int x, int y, int w, int h) | ||
711 | { | ||
712 | Image_Entry *im = image; | ||
713 | if (!im) return NULL; | ||
714 | return evas_cache_image_dirty(im, x, y, w, h); | ||
715 | } | ||
716 | |||
717 | static void * | ||
718 | eng_image_data_get(void *data __UNUSED__, void *image, int to_write, DATA32 **image_data, int *err) | ||
719 | { | ||
720 | RGBA_Image *im; | ||
721 | int error; | ||
722 | |||
723 | if (!image) | ||
724 | { | ||
725 | *image_data = NULL; | ||
726 | return NULL; | ||
727 | } | ||
728 | im = image; | ||
729 | error = evas_cache_image_load_data(&im->cache_entry); | ||
730 | switch (im->cache_entry.space) | ||
731 | { | ||
732 | case EVAS_COLORSPACE_ARGB8888: | ||
733 | if (to_write) | ||
734 | im = (RGBA_Image *)evas_cache_image_alone(&im->cache_entry); | ||
735 | *image_data = im->image.data; | ||
736 | break; | ||
737 | case EVAS_COLORSPACE_YCBCR422P601_PL: | ||
738 | case EVAS_COLORSPACE_YCBCR422P709_PL: | ||
739 | case EVAS_COLORSPACE_YCBCR422601_PL: | ||
740 | case EVAS_COLORSPACE_YCBCR420NV12601_PL: | ||
741 | case EVAS_COLORSPACE_YCBCR420TM12601_PL: | ||
742 | *image_data = im->cs.data; | ||
743 | break; | ||
744 | default: | ||
745 | abort(); | ||
746 | break; | ||
747 | } | ||
748 | if (err) *err = error; | ||
749 | return im; | ||
750 | } | ||
751 | |||
752 | static void * | ||
753 | eng_image_data_put(void *data, void *image, DATA32 *image_data) | ||
754 | { | ||
755 | RGBA_Image *im, *im2; | ||
756 | |||
757 | if (!image) return NULL; | ||
758 | im = image; | ||
759 | switch (im->cache_entry.space) | ||
760 | { | ||
761 | case EVAS_COLORSPACE_ARGB8888: | ||
762 | if (image_data != im->image.data) | ||
763 | { | ||
764 | int w, h; | ||
765 | |||
766 | w = im->cache_entry.w; | ||
767 | h = im->cache_entry.h; | ||
768 | im2 = eng_image_new_from_data(data, w, h, image_data, | ||
769 | eng_image_alpha_get(data, image), | ||
770 | eng_image_colorspace_get(data, image)); | ||
771 | evas_cache_image_drop(&im->cache_entry); | ||
772 | im = im2; | ||
773 | } | ||
774 | break; | ||
775 | case EVAS_COLORSPACE_YCBCR422P601_PL: | ||
776 | case EVAS_COLORSPACE_YCBCR422P709_PL: | ||
777 | case EVAS_COLORSPACE_YCBCR422601_PL: | ||
778 | case EVAS_COLORSPACE_YCBCR420NV12601_PL: | ||
779 | case EVAS_COLORSPACE_YCBCR420TM12601_PL: | ||
780 | if (image_data != im->cs.data) | ||
781 | { | ||
782 | if (im->cs.data) | ||
783 | { | ||
784 | if (!im->cs.no_free) free(im->cs.data); | ||
785 | } | ||
786 | im->cs.data = image_data; | ||
787 | } | ||
788 | evas_common_image_colorspace_dirty(im); | ||
789 | break; | ||
790 | default: | ||
791 | abort(); | ||
792 | break; | ||
793 | } | ||
794 | return im; | ||
795 | } | ||
796 | |||
797 | static void | ||
798 | eng_image_data_preload_request(void *data __UNUSED__, void *image, const void *target) | ||
799 | { | ||
800 | RGBA_Image *im = image; | ||
801 | |||
802 | if (!im) return ; | ||
803 | evas_cache_image_preload_data(&im->cache_entry, target); | ||
804 | } | ||
805 | |||
806 | static void | ||
807 | eng_image_data_preload_cancel(void *data __UNUSED__, void *image, const void *target) | ||
808 | { | ||
809 | RGBA_Image *im = image; | ||
810 | |||
811 | if (!im) return ; | ||
812 | evas_cache_image_preload_cancel(&im->cache_entry, target); | ||
813 | } | ||
814 | |||
815 | static void | ||
816 | eng_image_draw(void *data __UNUSED__, void *context, void *surface, void *image, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int smooth) | ||
817 | { | ||
818 | RGBA_Image *im; | ||
819 | |||
820 | if (!image) return; | ||
821 | im = image; | ||
822 | #ifdef BUILD_PIPE_RENDER | ||
823 | if ((cpunum > 1) | ||
824 | #ifdef EVAS_FRAME_QUEUING | ||
825 | && evas_common_frameq_enabled() | ||
826 | #endif | ||
827 | ) | ||
828 | { | ||
829 | evas_common_rgba_image_scalecache_prepare((Image_Entry *)(im), | ||
830 | surface, context, smooth, | ||
831 | src_x, src_y, src_w, src_h, | ||
832 | dst_x, dst_y, dst_w, dst_h); | ||
833 | |||
834 | evas_common_pipe_image_draw(im, surface, context, smooth, | ||
835 | src_x, src_y, src_w, src_h, | ||
836 | dst_x, dst_y, dst_w, dst_h); | ||
837 | } | ||
838 | else | ||
839 | #endif | ||
840 | { | ||
841 | // if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888) | ||
842 | // evas_cache_image_load_data(&im->cache_entry); | ||
843 | // evas_common_image_colorspace_normalize(im); | ||
844 | evas_common_rgba_image_scalecache_prepare(&im->cache_entry, surface, context, smooth, | ||
845 | src_x, src_y, src_w, src_h, | ||
846 | dst_x, dst_y, dst_w, dst_h); | ||
847 | evas_common_rgba_image_scalecache_do(&im->cache_entry, surface, context, smooth, | ||
848 | src_x, src_y, src_w, src_h, | ||
849 | dst_x, dst_y, dst_w, dst_h); | ||
850 | /* | ||
851 | if (smooth) | ||
852 | evas_common_scale_rgba_in_to_out_clip_smooth(im, surface, context, | ||
853 | src_x, src_y, src_w, src_h, | ||
854 | dst_x, dst_y, dst_w, dst_h); | ||
855 | else | ||
856 | evas_common_scale_rgba_in_to_out_clip_sample(im, surface, context, | ||
857 | src_x, src_y, src_w, src_h, | ||
858 | dst_x, dst_y, dst_w, dst_h); | ||
859 | */ | ||
860 | evas_common_cpu_end_opt(); | ||
861 | } | ||
862 | } | ||
863 | |||
864 | static void | ||
865 | eng_image_map_draw(void *data __UNUSED__, void *context, void *surface, void *image, int npoints, RGBA_Map_Point *p, int smooth, int level) | ||
866 | { | ||
867 | RGBA_Image *im; | ||
868 | |||
869 | if (!image) return; | ||
870 | if (npoints < 3) return; | ||
871 | im = image; | ||
872 | |||
873 | if ((p[0].x == p[3].x) && | ||
874 | (p[1].x == p[2].x) && | ||
875 | (p[0].y == p[1].y) && | ||
876 | (p[3].y == p[2].y) && | ||
877 | (p[0].x <= p[1].x) && | ||
878 | (p[0].y <= p[2].y) && | ||
879 | (p[0].u == 0) && | ||
880 | (p[0].v == 0) && | ||
881 | (p[1].u == (int)(im->cache_entry.w << FP)) && | ||
882 | (p[1].v == 0) && | ||
883 | (p[2].u == (int)(im->cache_entry.w << FP)) && | ||
884 | (p[2].v == (int)(im->cache_entry.h << FP)) && | ||
885 | (p[3].u == 0) && | ||
886 | (p[3].v == (int)(im->cache_entry.h << FP)) && | ||
887 | (p[0].col == 0xffffffff) && | ||
888 | (p[1].col == 0xffffffff) && | ||
889 | (p[2].col == 0xffffffff) && | ||
890 | (p[3].col == 0xffffffff)) | ||
891 | { | ||
892 | int dx, dy, dw, dh; | ||
893 | |||
894 | dx = p[0].x >> FP; | ||
895 | dy = p[0].y >> FP; | ||
896 | dw = (p[2].x >> FP) - dx; | ||
897 | dh = (p[2].y >> FP) - dy; | ||
898 | eng_image_draw | ||
899 | (data, context, surface, image, | ||
900 | 0, 0, im->cache_entry.w, im->cache_entry.h, | ||
901 | dx, dy, dw, dh, smooth); | ||
902 | } | ||
903 | else | ||
904 | { | ||
905 | #ifdef BUILD_PIPE_RENDER | ||
906 | if ((cpunum > 1) | ||
907 | # ifdef EVAS_FRAME_QUEUING | ||
908 | && evas_common_frameq_enabled() | ||
909 | # endif | ||
910 | ) | ||
911 | evas_common_pipe_map_draw(im, surface, context, npoints, p, smooth, level); | ||
912 | else | ||
913 | #endif | ||
914 | evas_common_map_rgba(im, surface, context, npoints, p, smooth, level); | ||
915 | } | ||
916 | evas_common_cpu_end_opt(); | ||
917 | |||
918 | if (npoints > 4) | ||
919 | { | ||
920 | eng_image_map_draw(data, context, surface, image, npoints - 2, p + 2, | ||
921 | smooth, level); | ||
922 | } | ||
923 | } | ||
924 | |||
925 | static void * | ||
926 | eng_image_map_surface_new(void *data __UNUSED__, int w, int h, int alpha) | ||
927 | { | ||
928 | void *surface; | ||
929 | surface = evas_cache_image_copied_data(evas_common_image_cache_get(), | ||
930 | w, h, NULL, alpha, | ||
931 | EVAS_COLORSPACE_ARGB8888); | ||
932 | evas_cache_image_pixels(surface); | ||
933 | return surface; | ||
934 | } | ||
935 | |||
936 | static void | ||
937 | eng_image_map_surface_free(void *data __UNUSED__, void *surface) | ||
938 | { | ||
939 | evas_cache_image_drop(surface); | ||
940 | } | ||
941 | |||
942 | static void | ||
943 | eng_image_scale_hint_set(void *data __UNUSED__, void *image, int hint) | ||
944 | { | ||
945 | Image_Entry *im; | ||
946 | |||
947 | if (!image) return; | ||
948 | im = image; | ||
949 | im->scale_hint = hint; | ||
950 | } | ||
951 | |||
952 | static int | ||
953 | eng_image_scale_hint_get(void *data __UNUSED__, void *image) | ||
954 | { | ||
955 | Image_Entry *im; | ||
956 | |||
957 | if (!image) return EVAS_IMAGE_SCALE_HINT_NONE; | ||
958 | im = image; | ||
959 | return im->scale_hint; | ||
960 | } | ||
961 | |||
962 | static Eina_Bool | ||
963 | eng_image_animated_get(void *data __UNUSED__, void *image) | ||
964 | { | ||
965 | Image_Entry *im; | ||
966 | |||
967 | if (!image) return EINA_FALSE; | ||
968 | im = image; | ||
969 | return im->flags.animated; | ||
970 | } | ||
971 | |||
972 | static int | ||
973 | eng_image_animated_frame_count_get(void *data __UNUSED__, void *image) | ||
974 | { | ||
975 | Image_Entry *im; | ||
976 | |||
977 | if (!image) return -1; | ||
978 | im = image; | ||
979 | if (!im->flags.animated) return -1; | ||
980 | return im->frame_count; | ||
981 | } | ||
982 | |||
983 | static Evas_Image_Animated_Loop_Hint | ||
984 | eng_image_animated_loop_type_get(void *data __UNUSED__, void *image) | ||
985 | { | ||
986 | Image_Entry *im; | ||
987 | |||
988 | if (!image) return EVAS_IMAGE_ANIMATED_HINT_NONE; | ||
989 | im = image; | ||
990 | if (!im->flags.animated) return EVAS_IMAGE_ANIMATED_HINT_NONE; | ||
991 | return im->loop_hint; | ||
992 | } | ||
993 | |||
994 | static int | ||
995 | eng_image_animated_loop_count_get(void *data __UNUSED__, void *image) | ||
996 | { | ||
997 | Image_Entry *im; | ||
998 | |||
999 | if (!image) return -1; | ||
1000 | im = image; | ||
1001 | if (!im->flags.animated) return -1; | ||
1002 | return im->loop_count; | ||
1003 | } | ||
1004 | |||
1005 | static double | ||
1006 | eng_image_animated_frame_duration_get(void *data __UNUSED__, void *image, int start_frame, int frame_num) | ||
1007 | { | ||
1008 | Image_Entry *im; | ||
1009 | |||
1010 | if (!image) return -1; | ||
1011 | im = image; | ||
1012 | if (!im->flags.animated) return -1; | ||
1013 | return evas_common_load_rgba_image_frame_duration_from_file(im, start_frame, frame_num); | ||
1014 | } | ||
1015 | |||
1016 | static Eina_Bool | ||
1017 | eng_image_animated_frame_set(void *data __UNUSED__, void *image, int frame_index) | ||
1018 | { | ||
1019 | Image_Entry *im; | ||
1020 | |||
1021 | if (!image) return EINA_FALSE; | ||
1022 | im = image; | ||
1023 | if (!im->flags.animated) return EINA_FALSE; | ||
1024 | if (im->cur_frame == frame_index) return EINA_FALSE; | ||
1025 | im->cur_frame = frame_index; | ||
1026 | return EINA_TRUE; | ||
1027 | } | ||
1028 | |||
1029 | static void | ||
1030 | eng_image_cache_flush(void *data __UNUSED__) | ||
1031 | { | ||
1032 | int tmp_size; | ||
1033 | |||
1034 | tmp_size = evas_common_image_get_cache(); | ||
1035 | evas_common_image_set_cache(0); | ||
1036 | evas_common_rgba_image_scalecache_flush(); | ||
1037 | evas_common_image_set_cache(tmp_size); | ||
1038 | } | ||
1039 | |||
1040 | static void | ||
1041 | eng_image_cache_set(void *data __UNUSED__, int bytes) | ||
1042 | { | ||
1043 | evas_common_image_set_cache(bytes); | ||
1044 | evas_common_rgba_image_scalecache_size_set(bytes); | ||
1045 | } | ||
1046 | |||
1047 | static int | ||
1048 | eng_image_cache_get(void *data __UNUSED__) | ||
1049 | { | ||
1050 | return evas_common_image_get_cache(); | ||
1051 | } | ||
1052 | |||
1053 | static Evas_Font_Set * | ||
1054 | eng_font_load(void *data __UNUSED__, const char *name, int size, | ||
1055 | Font_Rend_Flags wanted_rend) | ||
1056 | { | ||
1057 | return (Evas_Font_Set *) evas_common_font_load(name, size, wanted_rend); | ||
1058 | } | ||
1059 | |||
1060 | static Evas_Font_Set * | ||
1061 | eng_font_memory_load(void *data __UNUSED__, char *name, int size, const void *fdata, int fdata_size, Font_Rend_Flags wanted_rend) | ||
1062 | { | ||
1063 | return (Evas_Font_Set *) evas_common_font_memory_load(name, size, fdata, | ||
1064 | fdata_size, wanted_rend); | ||
1065 | } | ||
1066 | |||
1067 | static Evas_Font_Set * | ||
1068 | eng_font_add(void *data __UNUSED__, Evas_Font_Set *font, const char *name, int size, Font_Rend_Flags wanted_rend) | ||
1069 | { | ||
1070 | return (Evas_Font_Set *) evas_common_font_add((RGBA_Font *) font, name, | ||
1071 | size, wanted_rend); | ||
1072 | } | ||
1073 | |||
1074 | static Evas_Font_Set * | ||
1075 | eng_font_memory_add(void *data __UNUSED__, Evas_Font_Set *font, char *name, int size, const void *fdata, int fdata_size, Font_Rend_Flags wanted_rend) | ||
1076 | { | ||
1077 | return (Evas_Font_Set *) evas_common_font_memory_add((RGBA_Font *) font, | ||
1078 | name, size, fdata, fdata_size, wanted_rend); | ||
1079 | } | ||
1080 | |||
1081 | static void | ||
1082 | eng_font_free(void *data __UNUSED__, Evas_Font_Set *font) | ||
1083 | { | ||
1084 | evas_common_font_free((RGBA_Font *) font); | ||
1085 | } | ||
1086 | |||
1087 | static int | ||
1088 | eng_font_ascent_get(void *data __UNUSED__, Evas_Font_Set *font) | ||
1089 | { | ||
1090 | return evas_common_font_ascent_get((RGBA_Font *) font); | ||
1091 | } | ||
1092 | |||
1093 | static int | ||
1094 | eng_font_descent_get(void *data __UNUSED__, Evas_Font_Set *font) | ||
1095 | { | ||
1096 | return evas_common_font_descent_get((RGBA_Font *) font); | ||
1097 | } | ||
1098 | |||
1099 | static int | ||
1100 | eng_font_max_ascent_get(void *data __UNUSED__, Evas_Font_Set *font) | ||
1101 | { | ||
1102 | return evas_common_font_max_ascent_get((RGBA_Font *) font); | ||
1103 | } | ||
1104 | |||
1105 | static int | ||
1106 | eng_font_max_descent_get(void *data __UNUSED__, Evas_Font_Set *font) | ||
1107 | { | ||
1108 | return evas_common_font_max_descent_get((RGBA_Font *) font); | ||
1109 | } | ||
1110 | |||
1111 | static void | ||
1112 | eng_font_string_size_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props, int *w, int *h) | ||
1113 | { | ||
1114 | evas_common_font_query_size((RGBA_Font *) font, text_props, w, h); | ||
1115 | } | ||
1116 | |||
1117 | static int | ||
1118 | eng_font_inset_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props) | ||
1119 | { | ||
1120 | return evas_common_font_query_inset((RGBA_Font *) font, text_props); | ||
1121 | } | ||
1122 | |||
1123 | static int | ||
1124 | eng_font_right_inset_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props) | ||
1125 | { | ||
1126 | return evas_common_font_query_right_inset((RGBA_Font *) font, text_props); | ||
1127 | } | ||
1128 | |||
1129 | static int | ||
1130 | eng_font_h_advance_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props) | ||
1131 | { | ||
1132 | int h, v; | ||
1133 | |||
1134 | evas_common_font_query_advance((RGBA_Font *) font, text_props, &h, &v); | ||
1135 | return h; | ||
1136 | } | ||
1137 | |||
1138 | static int | ||
1139 | eng_font_v_advance_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props) | ||
1140 | { | ||
1141 | int h, v; | ||
1142 | |||
1143 | evas_common_font_query_advance((RGBA_Font *) font, text_props, &h, &v); | ||
1144 | return v; | ||
1145 | } | ||
1146 | |||
1147 | static int | ||
1148 | eng_font_pen_coords_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props, int pos, int *cpen_x, int *cy, int *cadv, int *ch) | ||
1149 | { | ||
1150 | return evas_common_font_query_pen_coords((RGBA_Font *) font, text_props, pos, cpen_x, cy, cadv, ch); | ||
1151 | } | ||
1152 | |||
1153 | static Eina_Bool | ||
1154 | eng_font_text_props_info_create(void *data __UNUSED__, Evas_Font_Instance *fi, const Eina_Unicode *text, Evas_Text_Props *text_props, const Evas_BiDi_Paragraph_Props *par_props, size_t par_pos, size_t len) | ||
1155 | { | ||
1156 | return evas_common_text_props_content_create((RGBA_Font_Int *) fi, text, | ||
1157 | text_props, par_props, par_pos, len); | ||
1158 | } | ||
1159 | |||
1160 | static int | ||
1161 | eng_font_char_coords_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props, int pos, int *cx, int *cy, int *cw, int *ch) | ||
1162 | { | ||
1163 | return evas_common_font_query_char_coords((RGBA_Font *) font, text_props, pos, cx, cy, cw, ch); | ||
1164 | } | ||
1165 | |||
1166 | static int | ||
1167 | eng_font_char_at_coords_get(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props, int x, int y, int *cx, int *cy, int *cw, int *ch) | ||
1168 | { | ||
1169 | return evas_common_font_query_char_at_coords((RGBA_Font *) font, text_props, x, y, cx, cy, cw, ch); | ||
1170 | } | ||
1171 | |||
1172 | static int | ||
1173 | eng_font_last_up_to_pos(void *data __UNUSED__, Evas_Font_Set *font, const Evas_Text_Props *text_props, int x, int y) | ||
1174 | { | ||
1175 | return evas_common_font_query_last_up_to_pos((RGBA_Font *) font, text_props, x, y); | ||
1176 | } | ||
1177 | |||
1178 | static int | ||
1179 | eng_font_run_font_end_get(void *data __UNUSED__, Evas_Font_Set *font, Evas_Font_Instance **script_fi, Evas_Font_Instance **cur_fi, Evas_Script_Type script, const Eina_Unicode *text, int run_len) | ||
1180 | { | ||
1181 | return evas_common_font_query_run_font_end_get((RGBA_Font *) font, | ||
1182 | (RGBA_Font_Int **) script_fi, (RGBA_Font_Int **) cur_fi, | ||
1183 | script, text, run_len); | ||
1184 | } | ||
1185 | |||
1186 | static void | ||
1187 | eng_font_draw(void *data __UNUSED__, void *context, void *surface, Evas_Font_Set *font, int x, int y, int w __UNUSED__, int h __UNUSED__, int ow __UNUSED__, int oh __UNUSED__, const Evas_Text_Props *text_props) | ||
1188 | { | ||
1189 | #ifdef BUILD_PIPE_RENDER | ||
1190 | if ((cpunum > 1) | ||
1191 | #ifdef EVAS_FRAME_QUEUING | ||
1192 | && evas_common_frameq_enabled() | ||
1193 | #endif | ||
1194 | ) | ||
1195 | evas_common_pipe_text_draw(surface, context, (RGBA_Font *) font, x, y, | ||
1196 | text_props); | ||
1197 | else | ||
1198 | #endif | ||
1199 | { | ||
1200 | evas_common_font_draw(surface, context, (RGBA_Font *) font, x, y, | ||
1201 | text_props); | ||
1202 | evas_common_cpu_end_opt(); | ||
1203 | } | ||
1204 | } | ||
1205 | |||
1206 | static void | ||
1207 | eng_font_cache_flush(void *data __UNUSED__) | ||
1208 | { | ||
1209 | int tmp_size; | ||
1210 | |||
1211 | tmp_size = evas_common_font_cache_get(); | ||
1212 | evas_common_font_cache_set(0); | ||
1213 | evas_common_font_flush(); | ||
1214 | evas_common_font_cache_set(tmp_size); | ||
1215 | } | ||
1216 | |||
1217 | static void | ||
1218 | eng_font_cache_set(void *data __UNUSED__, int bytes) | ||
1219 | { | ||
1220 | evas_common_font_cache_set(bytes); | ||
1221 | } | ||
1222 | |||
1223 | static int | ||
1224 | eng_font_cache_get(void *data __UNUSED__) | ||
1225 | { | ||
1226 | return evas_common_font_cache_get(); | ||
1227 | } | ||
1228 | |||
1229 | static void | ||
1230 | eng_font_hinting_set(void *data __UNUSED__, Evas_Font_Set *font, int hinting) | ||
1231 | { | ||
1232 | evas_common_font_hinting_set((RGBA_Font *) font, hinting); | ||
1233 | } | ||
1234 | |||
1235 | static int | ||
1236 | eng_font_hinting_can_hint(void *data __UNUSED__, int hinting) | ||
1237 | { | ||
1238 | return evas_common_hinting_available(hinting); | ||
1239 | } | ||
1240 | |||
1241 | static Eina_Bool | ||
1242 | eng_canvas_alpha_get(void *data __UNUSED__, void *info __UNUSED__) | ||
1243 | { | ||
1244 | return EINA_TRUE; | ||
1245 | } | ||
1246 | |||
1247 | |||
1248 | /* Filter API */ | ||
1249 | #if 0 // filtering disabled | ||
1250 | static void | ||
1251 | eng_image_draw_filtered(void *data __UNUSED__, void *context __UNUSED__, | ||
1252 | void *surface, void *image, Evas_Filter_Info *filter) | ||
1253 | { | ||
1254 | Evas_Software_Filter_Fn fn; | ||
1255 | RGBA_Image *im = image; | ||
1256 | |||
1257 | fn = evas_filter_software_get(filter); | ||
1258 | if (!fn) return; | ||
1259 | if (im->cache_entry.cache) evas_cache_image_load_data(&im->cache_entry); | ||
1260 | fn(filter, image, surface); | ||
1261 | return; | ||
1262 | } | ||
1263 | |||
1264 | static Filtered_Image * | ||
1265 | eng_image_filtered_get(void *image, uint8_t *key, size_t keylen) | ||
1266 | { | ||
1267 | RGBA_Image *im = image; | ||
1268 | Filtered_Image *fi; | ||
1269 | Eina_List *l; | ||
1270 | |||
1271 | for (l = im->filtered ; l ; l = l->next) | ||
1272 | { | ||
1273 | fi = l->data; | ||
1274 | if (fi->keylen != keylen) continue; | ||
1275 | if (memcmp(key, fi->key, keylen) != 0) continue; | ||
1276 | fi->ref ++; | ||
1277 | return fi; | ||
1278 | } | ||
1279 | |||
1280 | return NULL; | ||
1281 | } | ||
1282 | |||
1283 | static Filtered_Image * | ||
1284 | eng_image_filtered_save(void *image, void *fimage, uint8_t *key, size_t keylen) | ||
1285 | { | ||
1286 | RGBA_Image *im = image; | ||
1287 | Filtered_Image *fi; | ||
1288 | Eina_List *l; | ||
1289 | |||
1290 | for (l = im->filtered ; l ; l = l->next) | ||
1291 | { | ||
1292 | fi = l->data; | ||
1293 | if (fi->keylen != keylen) continue; | ||
1294 | if (memcmp(key, fi->key, keylen) == 0) continue; | ||
1295 | evas_cache_image_drop((void *)fi->image); | ||
1296 | fi->image = fimage; | ||
1297 | return fi; | ||
1298 | } | ||
1299 | |||
1300 | fi = calloc(1,sizeof(Filtered_Image)); | ||
1301 | if (!fi) return NULL; | ||
1302 | |||
1303 | fi->keylen = keylen; | ||
1304 | fi->key = malloc(keylen); | ||
1305 | memcpy(fi->key, key, keylen); | ||
1306 | fi->image = fimage; | ||
1307 | fi->ref = 1; | ||
1308 | |||
1309 | im->filtered = eina_list_prepend(im->filtered, fi); | ||
1310 | |||
1311 | return fi; | ||
1312 | } | ||
1313 | |||
1314 | static void | ||
1315 | eng_image_filtered_free(void *image, Filtered_Image *fi) | ||
1316 | { | ||
1317 | RGBA_Image *im = image; | ||
1318 | |||
1319 | fi->ref --; | ||
1320 | if (fi->ref) return; | ||
1321 | |||
1322 | free(fi->key); | ||
1323 | evas_cache_image_drop(&fi->image->cache_entry); | ||
1324 | fi->image = NULL; | ||
1325 | |||
1326 | im->filtered = eina_list_remove(im->filtered, fi); | ||
1327 | } | ||
1328 | #endif | ||
1329 | |||
1330 | static int | ||
1331 | eng_image_load_error_get(void *data __UNUSED__, void *image) | ||
1332 | { | ||
1333 | RGBA_Image *im; | ||
1334 | |||
1335 | if (!image) return EVAS_LOAD_ERROR_NONE; | ||
1336 | im = image; | ||
1337 | return im->cache_entry.load_error; | ||
1338 | } | ||
1339 | |||
1340 | //------------ Evas GL engine code ---------------// | ||
1341 | static void * | ||
1342 | eng_gl_surface_create(void *data __UNUSED__, void *config, int w, int h) | ||
1343 | { | ||
1344 | #ifdef EVAS_GL | ||
1345 | Render_Engine_GL_Surface *sfc; | ||
1346 | Evas_GL_Config *cfg; | ||
1347 | |||
1348 | sfc = calloc(1, sizeof(Render_Engine_GL_Surface)); | ||
1349 | if (!sfc) return NULL; | ||
1350 | |||
1351 | cfg = (Evas_GL_Config *)config; | ||
1352 | |||
1353 | sfc->initialized = 0; | ||
1354 | sfc->w = w; | ||
1355 | sfc->h = h; | ||
1356 | |||
1357 | // Color Format | ||
1358 | switch (cfg->color_format) | ||
1359 | { | ||
1360 | |||
1361 | case EVAS_GL_RGB_888: | ||
1362 | sfc->internal_fmt = OSMESA_RGB; | ||
1363 | sfc->internal_cpp = 3; | ||
1364 | break; | ||
1365 | case EVAS_GL_RGBA_8888: | ||
1366 | sfc->internal_fmt = OSMESA_BGRA; | ||
1367 | sfc->internal_cpp = 4; | ||
1368 | break; | ||
1369 | default: | ||
1370 | sfc->internal_fmt = OSMESA_RGBA; | ||
1371 | sfc->internal_cpp = 4; | ||
1372 | break; | ||
1373 | } | ||
1374 | |||
1375 | // Depth Bits | ||
1376 | switch (cfg->depth_bits) | ||
1377 | { | ||
1378 | case EVAS_GL_DEPTH_BIT_8: | ||
1379 | sfc->depth_bits = 8; | ||
1380 | break; | ||
1381 | case EVAS_GL_DEPTH_BIT_16: | ||
1382 | sfc->depth_bits = 16; | ||
1383 | break; | ||
1384 | case EVAS_GL_DEPTH_BIT_24: | ||
1385 | sfc->depth_bits = 24; | ||
1386 | break; | ||
1387 | case EVAS_GL_DEPTH_BIT_32: | ||
1388 | sfc->depth_bits = 32; | ||
1389 | break; | ||
1390 | case EVAS_GL_DEPTH_NONE: | ||
1391 | default: | ||
1392 | sfc->depth_bits = 0; | ||
1393 | break; | ||
1394 | } | ||
1395 | |||
1396 | // Stencil Bits | ||
1397 | switch (cfg->stencil_bits) | ||
1398 | { | ||
1399 | case EVAS_GL_STENCIL_BIT_1: | ||
1400 | sfc->stencil_bits = 1; | ||
1401 | break; | ||
1402 | case EVAS_GL_STENCIL_BIT_2: | ||
1403 | sfc->stencil_bits = 2; | ||
1404 | break; | ||
1405 | case EVAS_GL_STENCIL_BIT_4: | ||
1406 | sfc->stencil_bits = 4; | ||
1407 | break; | ||
1408 | case EVAS_GL_STENCIL_BIT_8: | ||
1409 | sfc->stencil_bits = 8; | ||
1410 | break; | ||
1411 | case EVAS_GL_STENCIL_BIT_16: | ||
1412 | sfc->stencil_bits = 16; | ||
1413 | break; | ||
1414 | case EVAS_GL_STENCIL_NONE: | ||
1415 | default: | ||
1416 | sfc->stencil_bits = 0; | ||
1417 | break; | ||
1418 | } | ||
1419 | |||
1420 | sfc->buffer = malloc(sizeof(unsigned char)*sfc->internal_cpp*w*h); | ||
1421 | |||
1422 | if (!sfc->buffer) | ||
1423 | { | ||
1424 | free(sfc); | ||
1425 | return NULL; | ||
1426 | } | ||
1427 | |||
1428 | return sfc; | ||
1429 | #else | ||
1430 | (void) config; | ||
1431 | (void) w; | ||
1432 | (void) h; | ||
1433 | return NULL; | ||
1434 | #endif | ||
1435 | } | ||
1436 | |||
1437 | static int | ||
1438 | eng_gl_surface_destroy(void *data __UNUSED__, void *surface) | ||
1439 | { | ||
1440 | #ifdef EVAS_GL | ||
1441 | Render_Engine_GL_Surface *sfc; | ||
1442 | |||
1443 | sfc = (Render_Engine_GL_Surface*)surface; | ||
1444 | |||
1445 | if (!sfc) return 0; | ||
1446 | |||
1447 | if (sfc->buffer) free(sfc->buffer); | ||
1448 | |||
1449 | free(sfc); | ||
1450 | |||
1451 | surface = NULL; | ||
1452 | |||
1453 | return 1; | ||
1454 | #else | ||
1455 | (void) surface; | ||
1456 | return 1; | ||
1457 | #endif | ||
1458 | } | ||
1459 | |||
1460 | static void * | ||
1461 | eng_gl_context_create(void *data __UNUSED__, void *share_context) | ||
1462 | { | ||
1463 | #ifdef EVAS_GL | ||
1464 | Render_Engine_GL_Context *ctx; | ||
1465 | Render_Engine_GL_Context *share_ctx; | ||
1466 | |||
1467 | ctx = calloc(1, sizeof(Render_Engine_GL_Context)); | ||
1468 | |||
1469 | if (!ctx) return NULL; | ||
1470 | |||
1471 | share_ctx = (Render_Engine_GL_Context *)share_context; | ||
1472 | |||
1473 | ctx->share_ctx = share_ctx; | ||
1474 | |||
1475 | /* | ||
1476 | if (share_ctx) | ||
1477 | ctx->context = OSMesaCreateContextExt( OSMESA_RGBA, 8, 0, 0, share_ctx->context ); | ||
1478 | else | ||
1479 | ctx->context = OSMesaCreateContextExt( OSMESA_RGBA, 8, 0, 0, NULL ); | ||
1480 | |||
1481 | |||
1482 | if (!ctx->context) | ||
1483 | { | ||
1484 | ERR("Error creating OSMesa Context."); | ||
1485 | free(ctx); | ||
1486 | return NULL; | ||
1487 | } | ||
1488 | */ | ||
1489 | |||
1490 | ctx->initialized = 0; | ||
1491 | |||
1492 | return ctx; | ||
1493 | #else | ||
1494 | (void) share_context; | ||
1495 | return NULL; | ||
1496 | #endif | ||
1497 | } | ||
1498 | |||
1499 | static int | ||
1500 | eng_gl_context_destroy(void *data __UNUSED__, void *context) | ||
1501 | { | ||
1502 | #ifdef EVAS_GL | ||
1503 | Render_Engine_GL_Context *ctx; | ||
1504 | |||
1505 | ctx = (Render_Engine_GL_Context*)context; | ||
1506 | |||
1507 | if (!ctx) return 0; | ||
1508 | |||
1509 | _sym_OSMesaDestroyContext(ctx->context); | ||
1510 | |||
1511 | free(ctx); | ||
1512 | context = NULL; | ||
1513 | |||
1514 | return 1; | ||
1515 | #else | ||
1516 | (void) context; | ||
1517 | return 0; | ||
1518 | #endif | ||
1519 | } | ||
1520 | |||
1521 | static int | ||
1522 | eng_gl_make_current(void *data __UNUSED__, void *surface, void *context) | ||
1523 | { | ||
1524 | #ifdef EVAS_GL | ||
1525 | Render_Engine_GL_Surface *sfc; | ||
1526 | Render_Engine_GL_Context *ctx; | ||
1527 | OSMesaContext share_ctx; | ||
1528 | GLboolean ret; | ||
1529 | |||
1530 | sfc = (Render_Engine_GL_Surface*)surface; | ||
1531 | ctx = (Render_Engine_GL_Context*)context; | ||
1532 | |||
1533 | // Unset surface/context | ||
1534 | if ((!sfc) || (!ctx)) | ||
1535 | { | ||
1536 | if (ctx) ctx->current_sfc = NULL; | ||
1537 | if (sfc) sfc->current_ctx = NULL; | ||
1538 | return 1; | ||
1539 | } | ||
1540 | |||
1541 | // Initialize Context if it hasn't been. | ||
1542 | if (!ctx->initialized) | ||
1543 | { | ||
1544 | if (ctx->share_ctx) | ||
1545 | share_ctx = ctx->share_ctx->context; | ||
1546 | else | ||
1547 | share_ctx = NULL; | ||
1548 | |||
1549 | ctx->context = _sym_OSMesaCreateContextExt(sfc->internal_fmt, | ||
1550 | sfc->depth_bits, | ||
1551 | sfc->stencil_bits, | ||
1552 | 0, | ||
1553 | share_ctx); | ||
1554 | if (!ctx->context) | ||
1555 | { | ||
1556 | ERR("Error initializing context."); | ||
1557 | return 0; | ||
1558 | } | ||
1559 | |||
1560 | ctx->initialized = 1; | ||
1561 | } | ||
1562 | |||
1563 | |||
1564 | // Call MakeCurrent | ||
1565 | ret = _sym_OSMesaMakeCurrent(ctx->context, sfc->buffer, GL_UNSIGNED_BYTE, | ||
1566 | sfc->w, sfc->h); | ||
1567 | |||
1568 | if (ret == GL_FALSE) | ||
1569 | { | ||
1570 | ERR("Error doing MakeCurrent."); | ||
1571 | return 0; | ||
1572 | } | ||
1573 | |||
1574 | _sym_OSMesaPixelStore(OSMESA_Y_UP, 0); | ||
1575 | |||
1576 | // Set the current surface/context | ||
1577 | ctx->current_sfc = sfc; | ||
1578 | sfc->current_ctx = ctx; | ||
1579 | |||
1580 | return 1; | ||
1581 | #else | ||
1582 | (void) surface; | ||
1583 | (void) context; | ||
1584 | return 1; | ||
1585 | #endif | ||
1586 | } | ||
1587 | |||
1588 | // FIXME!!! Implement later | ||
1589 | static void * | ||
1590 | eng_gl_string_query(void *data __UNUSED__, int name __UNUSED__) | ||
1591 | { | ||
1592 | return NULL; | ||
1593 | } | ||
1594 | |||
1595 | static void * | ||
1596 | eng_gl_proc_address_get(void *data __UNUSED__, const char *name) | ||
1597 | { | ||
1598 | #ifdef EVAS_GL | ||
1599 | if (_sym_OSMesaGetProcAddress) return _sym_OSMesaGetProcAddress(name); | ||
1600 | return dlsym(RTLD_DEFAULT, name); | ||
1601 | #else | ||
1602 | (void) name; | ||
1603 | return NULL; | ||
1604 | #endif | ||
1605 | } | ||
1606 | |||
1607 | static int | ||
1608 | eng_gl_native_surface_get(void *data __UNUSED__, void *surface, void *native_surface) | ||
1609 | { | ||
1610 | #ifdef EVAS_GL | ||
1611 | Render_Engine_GL_Surface *sfc; | ||
1612 | Evas_Native_Surface *ns; | ||
1613 | |||
1614 | sfc = (Render_Engine_GL_Surface*)surface; | ||
1615 | ns = (Evas_Native_Surface*)native_surface; | ||
1616 | |||
1617 | if (!sfc) return 0; | ||
1618 | |||
1619 | ns->type = EVAS_NATIVE_SURFACE_OPENGL; | ||
1620 | ns->version = EVAS_NATIVE_SURFACE_VERSION; | ||
1621 | ns->data.x11.visual = sfc->buffer; | ||
1622 | |||
1623 | return 1; | ||
1624 | #else | ||
1625 | (void) surface; | ||
1626 | (void) native_surface; | ||
1627 | return 1; | ||
1628 | #endif | ||
1629 | } | ||
1630 | |||
1631 | |||
1632 | static void * | ||
1633 | eng_gl_api_get(void *data __UNUSED__) | ||
1634 | { | ||
1635 | #ifdef EVAS_GL | ||
1636 | return &gl_funcs; | ||
1637 | #else | ||
1638 | return NULL; | ||
1639 | #endif | ||
1640 | } | ||
1641 | |||
1642 | //------------------------------------------------// | ||
1643 | |||
1644 | |||
1645 | /* | ||
1646 | ***** | ||
1647 | ** | ||
1648 | ** ENGINE API | ||
1649 | ** | ||
1650 | ***** | ||
1651 | */ | ||
1652 | |||
1653 | static Evas_Func func = | ||
1654 | { | ||
1655 | NULL, | ||
1656 | NULL, | ||
1657 | NULL, | ||
1658 | NULL, | ||
1659 | NULL, | ||
1660 | NULL, | ||
1661 | NULL, | ||
1662 | NULL, | ||
1663 | NULL, | ||
1664 | NULL, | ||
1665 | NULL, | ||
1666 | NULL, | ||
1667 | NULL, | ||
1668 | eng_output_dump, | ||
1669 | /* draw context virtual methods */ | ||
1670 | eng_context_new, | ||
1671 | eng_canvas_alpha_get, | ||
1672 | eng_context_free, | ||
1673 | eng_context_clip_set, | ||
1674 | eng_context_clip_clip, | ||
1675 | eng_context_clip_unset, | ||
1676 | eng_context_clip_get, | ||
1677 | eng_context_mask_set, | ||
1678 | eng_context_mask_unset, | ||
1679 | eng_context_color_set, | ||
1680 | eng_context_color_get, | ||
1681 | eng_context_multiplier_set, | ||
1682 | eng_context_multiplier_unset, | ||
1683 | eng_context_multiplier_get, | ||
1684 | eng_context_cutout_add, | ||
1685 | eng_context_cutout_clear, | ||
1686 | eng_context_anti_alias_set, | ||
1687 | eng_context_anti_alias_get, | ||
1688 | eng_context_color_interpolation_set, | ||
1689 | eng_context_color_interpolation_get, | ||
1690 | eng_context_render_op_set, | ||
1691 | eng_context_render_op_get, | ||
1692 | /* rect draw funcs */ | ||
1693 | eng_rectangle_draw, | ||
1694 | /* line draw funcs */ | ||
1695 | eng_line_draw, | ||
1696 | /* polygon draw funcs */ | ||
1697 | eng_polygon_point_add, | ||
1698 | eng_polygon_points_clear, | ||
1699 | eng_polygon_draw, | ||
1700 | /* image draw funcs */ | ||
1701 | eng_image_load, | ||
1702 | eng_image_new_from_data, | ||
1703 | eng_image_new_from_copied_data, | ||
1704 | eng_image_free, | ||
1705 | eng_image_size_get, | ||
1706 | eng_image_size_set, | ||
1707 | NULL, | ||
1708 | eng_image_dirty_region, | ||
1709 | eng_image_data_get, | ||
1710 | eng_image_data_put, | ||
1711 | eng_image_data_preload_request, | ||
1712 | eng_image_data_preload_cancel, | ||
1713 | eng_image_alpha_set, | ||
1714 | eng_image_alpha_get, | ||
1715 | eng_image_border_set, | ||
1716 | eng_image_border_get, | ||
1717 | eng_image_draw, | ||
1718 | eng_image_comment_get, | ||
1719 | eng_image_format_get, | ||
1720 | eng_image_colorspace_set, | ||
1721 | eng_image_colorspace_get, | ||
1722 | eng_image_can_region_get, | ||
1723 | eng_image_mask_create, | ||
1724 | eng_image_native_set, | ||
1725 | eng_image_native_get, | ||
1726 | /* image cache funcs */ | ||
1727 | eng_image_cache_flush, | ||
1728 | eng_image_cache_set, | ||
1729 | eng_image_cache_get, | ||
1730 | /* font draw functions */ | ||
1731 | eng_font_load, | ||
1732 | eng_font_memory_load, | ||
1733 | eng_font_add, | ||
1734 | eng_font_memory_add, | ||
1735 | eng_font_free, | ||
1736 | eng_font_ascent_get, | ||
1737 | eng_font_descent_get, | ||
1738 | eng_font_max_ascent_get, | ||
1739 | eng_font_max_descent_get, | ||
1740 | eng_font_string_size_get, | ||
1741 | eng_font_inset_get, | ||
1742 | eng_font_h_advance_get, | ||
1743 | eng_font_v_advance_get, | ||
1744 | eng_font_char_coords_get, | ||
1745 | eng_font_char_at_coords_get, | ||
1746 | eng_font_draw, | ||
1747 | /* font cache functions */ | ||
1748 | eng_font_cache_flush, | ||
1749 | eng_font_cache_set, | ||
1750 | eng_font_cache_get, | ||
1751 | /* font hinting functions */ | ||
1752 | eng_font_hinting_set, | ||
1753 | eng_font_hinting_can_hint, | ||
1754 | eng_image_scale_hint_set, | ||
1755 | eng_image_scale_hint_get, | ||
1756 | /* more font draw functions */ | ||
1757 | eng_font_last_up_to_pos, | ||
1758 | eng_image_map_draw, | ||
1759 | eng_image_map_surface_new, | ||
1760 | eng_image_map_surface_free, | ||
1761 | NULL, // eng_image_content_hint_set - software doesn't use it | ||
1762 | NULL, // eng_image_content_hint_get - software doesn't use it | ||
1763 | eng_font_pen_coords_get, | ||
1764 | eng_font_text_props_info_create, | ||
1765 | eng_font_right_inset_get, | ||
1766 | #if 0 // filtering disabled | ||
1767 | eng_image_draw_filtered, | ||
1768 | eng_image_filtered_get, | ||
1769 | eng_image_filtered_save, | ||
1770 | eng_image_filtered_free, | ||
1771 | #endif | ||
1772 | NULL, // need software mesa for gl rendering <- gl_surface_create | ||
1773 | NULL, // need software mesa for gl rendering <- gl_surface_destroy | ||
1774 | NULL, // need software mesa for gl rendering <- gl_context_create | ||
1775 | NULL, // need software mesa for gl rendering <- gl_context_destroy | ||
1776 | NULL, // need software mesa for gl rendering <- gl_make_current | ||
1777 | NULL, // need software mesa for gl rendering <- gl_string_query | ||
1778 | NULL, // need software mesa for gl rendering <- gl_proc_address_get | ||
1779 | NULL, // need software mesa for gl rendering <- gl_native_surface_get | ||
1780 | NULL, // need software mesa for gl rendering <- gl_api_get | ||
1781 | NULL, // need software mesa for gl rendering <- gl_img_obj_set | ||
1782 | eng_image_load_error_get, | ||
1783 | eng_font_run_font_end_get, | ||
1784 | eng_image_animated_get, | ||
1785 | eng_image_animated_frame_count_get, | ||
1786 | eng_image_animated_loop_type_get, | ||
1787 | eng_image_animated_loop_count_get, | ||
1788 | eng_image_animated_frame_duration_get, | ||
1789 | eng_image_animated_frame_set, | ||
1790 | NULL | ||
1791 | /* FUTURE software generic calls go here */ | ||
1792 | }; | ||
1793 | |||
1794 | |||
1795 | //----------------------------------------------------------------// | ||
1796 | // // | ||
1797 | // Load Symbols // | ||
1798 | // // | ||
1799 | //----------------------------------------------------------------// | ||
1800 | #ifdef EVAS_GL | ||
1801 | static void | ||
1802 | sym_missing(void) | ||
1803 | { | ||
1804 | ERR("GL symbols missing!\n"); | ||
1805 | } | ||
1806 | |||
1807 | static int | ||
1808 | glue_sym_init(void) | ||
1809 | { | ||
1810 | //------------------------------------------------// | ||
1811 | // Use eglGetProcAddress | ||
1812 | #define FINDSYM(dst, sym, typ) \ | ||
1813 | if (!dst) dst = (typeof(dst))dlsym(gl_lib_handle, sym); \ | ||
1814 | if (!dst) \ | ||
1815 | { \ | ||
1816 | ERR("Symbol not found %s\n", sym); \ | ||
1817 | return 0; \ | ||
1818 | } | ||
1819 | #define FALLBAK(dst, typ) if (!dst) dst = (typeof(dst))sym_missing; | ||
1820 | |||
1821 | //------------------------------------------------------// | ||
1822 | // OSMesa APIs... | ||
1823 | FINDSYM(_sym_OSMesaCreateContextExt, "OSMesaCreateContextExt", glsym_func_osm_ctx); | ||
1824 | FALLBAK(_sym_OSMesaCreateContextExt, glsym_func_void); | ||
1825 | |||
1826 | FINDSYM(_sym_OSMesaDestroyContext, "OSMesaDestroyContext", glsym_func_void); | ||
1827 | FALLBAK(_sym_OSMesaDestroyContext, glsym_func_void); | ||
1828 | |||
1829 | FINDSYM(_sym_OSMesaMakeCurrent, "OSMesaMakeCurrent", glsym_func_bool); | ||
1830 | FALLBAK(_sym_OSMesaMakeCurrent, glsym_func_void); | ||
1831 | |||
1832 | FINDSYM(_sym_OSMesaPixelStore, "OSMesaPixelStore", glsym_func_void); | ||
1833 | FALLBAK(_sym_OSMesaPixelStore, glsym_func_void); | ||
1834 | |||
1835 | FINDSYM(_sym_OSMesaGetProcAddress, "OSMesaGetProcAddress", glsym_func_eng_fn); | ||
1836 | FALLBAK(_sym_OSMesaGetProcAddress, glsym_func_void); | ||
1837 | |||
1838 | #undef FINDSYM | ||
1839 | #undef FALLBAK | ||
1840 | |||
1841 | return 1; | ||
1842 | } | ||
1843 | |||
1844 | static int | ||
1845 | gl_sym_init(void) | ||
1846 | { | ||
1847 | //------------------------------------------------// | ||
1848 | #define FINDSYM(dst, sym, typ) \ | ||
1849 | if (!dst) dst = (typeof(dst))dlsym(gl_lib_handle, sym); \ | ||
1850 | if (!dst) DBG("Symbol not found %s\n", sym); | ||
1851 | #define FALLBAK(dst, typ) if (!dst) dst = (typeof(dst))sym_missing; | ||
1852 | |||
1853 | |||
1854 | //------------------------------------------------------// | ||
1855 | // GLES 2.0 APIs... | ||
1856 | FINDSYM(_sym_glActiveTexture, "glActiveTexture", glsym_func_void); | ||
1857 | FALLBAK(_sym_glActiveTexture, glsym_func_void); | ||
1858 | |||
1859 | FINDSYM(_sym_glAttachShader, "glAttachShader", glsym_func_void); | ||
1860 | FALLBAK(_sym_glAttachShader, glsym_func_void); | ||
1861 | |||
1862 | FINDSYM(_sym_glBindAttribLocation, "glBindAttribLocation", glsym_func_void); | ||
1863 | FALLBAK(_sym_glBindAttribLocation, glsym_func_void); | ||
1864 | |||
1865 | FINDSYM(_sym_glBindBuffer, "glBindBuffer", glsym_func_void); | ||
1866 | FALLBAK(_sym_glBindBuffer, glsym_func_void); | ||
1867 | |||
1868 | FINDSYM(_sym_glBindFramebuffer, "glBindFramebuffer", glsym_func_void); | ||
1869 | FALLBAK(_sym_glBindFramebuffer, glsym_func_void); | ||
1870 | |||
1871 | FINDSYM(_sym_glBindRenderbuffer, "glBindRenderbuffer", glsym_func_void); | ||
1872 | FALLBAK(_sym_glBindRenderbuffer, glsym_func_void); | ||
1873 | |||
1874 | FINDSYM(_sym_glBindTexture, "glBindTexture", glsym_func_void); | ||
1875 | FALLBAK(_sym_glBindTexture, glsym_func_void); | ||
1876 | |||
1877 | FINDSYM(_sym_glBlendColor, "glBlendColor", glsym_func_void); | ||
1878 | FALLBAK(_sym_glBlendColor, glsym_func_void); | ||
1879 | |||
1880 | FINDSYM(_sym_glBlendEquation, "glBlendEquation", glsym_func_void); | ||
1881 | FALLBAK(_sym_glBlendEquation, glsym_func_void); | ||
1882 | |||
1883 | FINDSYM(_sym_glBlendEquationSeparate, "glBlendEquationSeparate", glsym_func_void); | ||
1884 | FALLBAK(_sym_glBlendEquationSeparate, glsym_func_void); | ||
1885 | |||
1886 | FINDSYM(_sym_glBlendFunc, "glBlendFunc", glsym_func_void); | ||
1887 | FALLBAK(_sym_glBlendFunc, glsym_func_void); | ||
1888 | |||
1889 | FINDSYM(_sym_glBlendFuncSeparate, "glBlendFuncSeparate", glsym_func_void); | ||
1890 | FALLBAK(_sym_glBlendFuncSeparate, glsym_func_void); | ||
1891 | |||
1892 | FINDSYM(_sym_glBufferData, "glBufferData", glsym_func_void); | ||
1893 | FALLBAK(_sym_glBufferData, glsym_func_void); | ||
1894 | |||
1895 | FINDSYM(_sym_glBufferSubData, "glBufferSubData", glsym_func_void); | ||
1896 | FALLBAK(_sym_glBufferSubData, glsym_func_void); | ||
1897 | |||
1898 | FINDSYM(_sym_glCheckFramebufferStatus, "glCheckFramebufferStatus", glsym_func_uint); | ||
1899 | FALLBAK(_sym_glCheckFramebufferStatus, glsym_func_uint); | ||
1900 | |||
1901 | FINDSYM(_sym_glClear, "glClear", glsym_func_void); | ||
1902 | FALLBAK(_sym_glClear, glsym_func_void); | ||
1903 | |||
1904 | FINDSYM(_sym_glClearColor, "glClearColor", glsym_func_void); | ||
1905 | FALLBAK(_sym_glClearColor, glsym_func_void); | ||
1906 | |||
1907 | FINDSYM(_sym_glClearDepthf, "glClearDepthf", glsym_func_void); | ||
1908 | FINDSYM(_sym_glClearDepthf, "glClearDepth", glsym_func_void); | ||
1909 | FALLBAK(_sym_glClearDepthf, glsym_func_void); | ||
1910 | |||
1911 | FINDSYM(_sym_glClearStencil, "glClearStencil", glsym_func_void); | ||
1912 | FALLBAK(_sym_glClearStencil, glsym_func_void); | ||
1913 | |||
1914 | FINDSYM(_sym_glColorMask, "glColorMask", glsym_func_void); | ||
1915 | FALLBAK(_sym_glColorMask, glsym_func_void); | ||
1916 | |||
1917 | FINDSYM(_sym_glCompileShader, "glCompileShader", glsym_func_void); | ||
1918 | FALLBAK(_sym_glCompileShader, glsym_func_void); | ||
1919 | |||
1920 | FINDSYM(_sym_glCompressedTexImage2D, "glCompressedTexImage2D", glsym_func_void); | ||
1921 | FALLBAK(_sym_glCompressedTexImage2D, glsym_func_void); | ||
1922 | |||
1923 | FINDSYM(_sym_glCompressedTexSubImage2D, "glCompressedTexSubImage2D", glsym_func_void); | ||
1924 | FALLBAK(_sym_glCompressedTexSubImage2D, glsym_func_void); | ||
1925 | |||
1926 | FINDSYM(_sym_glCopyTexImage2D, "glCopyTexImage2D", glsym_func_void); | ||
1927 | FALLBAK(_sym_glCopyTexImage2D, glsym_func_void); | ||
1928 | |||
1929 | FINDSYM(_sym_glCopyTexSubImage2D, "glCopyTexSubImage2D", glsym_func_void); | ||
1930 | FALLBAK(_sym_glCopyTexSubImage2D, glsym_func_void); | ||
1931 | |||
1932 | FINDSYM(_sym_glCreateProgram, "glCreateProgram", glsym_func_uint); | ||
1933 | FALLBAK(_sym_glCreateProgram, glsym_func_uint); | ||
1934 | |||
1935 | FINDSYM(_sym_glCreateShader, "glCreateShader", glsym_func_uint); | ||
1936 | FALLBAK(_sym_glCreateShader, glsym_func_uint); | ||
1937 | |||
1938 | FINDSYM(_sym_glCullFace, "glCullFace", glsym_func_void); | ||
1939 | FALLBAK(_sym_glCullFace, glsym_func_void); | ||
1940 | |||
1941 | FINDSYM(_sym_glDeleteBuffers, "glDeleteBuffers", glsym_func_void); | ||
1942 | FALLBAK(_sym_glDeleteBuffers, glsym_func_void); | ||
1943 | |||
1944 | FINDSYM(_sym_glDeleteFramebuffers, "glDeleteFramebuffers", glsym_func_void); | ||
1945 | FALLBAK(_sym_glDeleteFramebuffers, glsym_func_void); | ||
1946 | |||
1947 | FINDSYM(_sym_glDeleteProgram, "glDeleteProgram", glsym_func_void); | ||
1948 | FALLBAK(_sym_glDeleteProgram, glsym_func_void); | ||
1949 | |||
1950 | FINDSYM(_sym_glDeleteRenderbuffers, "glDeleteRenderbuffers", glsym_func_void); | ||
1951 | FALLBAK(_sym_glDeleteRenderbuffers, glsym_func_void); | ||
1952 | |||
1953 | FINDSYM(_sym_glDeleteShader, "glDeleteShader", glsym_func_void); | ||
1954 | FALLBAK(_sym_glDeleteShader, glsym_func_void); | ||
1955 | |||
1956 | FINDSYM(_sym_glDeleteTextures, "glDeleteTextures", glsym_func_void); | ||
1957 | FALLBAK(_sym_glDeleteTextures, glsym_func_void); | ||
1958 | |||
1959 | FINDSYM(_sym_glDepthFunc, "glDepthFunc", glsym_func_void); | ||
1960 | FALLBAK(_sym_glDepthFunc, glsym_func_void); | ||
1961 | |||
1962 | FINDSYM(_sym_glDepthMask, "glDepthMask", glsym_func_void); | ||
1963 | FALLBAK(_sym_glDepthMask, glsym_func_void); | ||
1964 | |||
1965 | FINDSYM(_sym_glDepthRangef, "glDepthRangef", glsym_func_void); | ||
1966 | FINDSYM(_sym_glDepthRangef, "glDepthRange", glsym_func_void); | ||
1967 | FALLBAK(_sym_glDepthRangef, glsym_func_void); | ||
1968 | |||
1969 | FINDSYM(_sym_glDetachShader, "glDetachShader", glsym_func_void); | ||
1970 | FALLBAK(_sym_glDetachShader, glsym_func_void); | ||
1971 | |||
1972 | FINDSYM(_sym_glDisable, "glDisable", glsym_func_void); | ||
1973 | FALLBAK(_sym_glDisable, glsym_func_void); | ||
1974 | |||
1975 | FINDSYM(_sym_glDisableVertexAttribArray, "glDisableVertexAttribArray", glsym_func_void); | ||
1976 | FALLBAK(_sym_glDisableVertexAttribArray, glsym_func_void); | ||
1977 | |||
1978 | FINDSYM(_sym_glDrawArrays, "glDrawArrays", glsym_func_void); | ||
1979 | FALLBAK(_sym_glDrawArrays, glsym_func_void); | ||
1980 | |||
1981 | FINDSYM(_sym_glDrawElements, "glDrawElements", glsym_func_void); | ||
1982 | FALLBAK(_sym_glDrawElements, glsym_func_void); | ||
1983 | |||
1984 | FINDSYM(_sym_glEnable, "glEnable", glsym_func_void); | ||
1985 | FALLBAK(_sym_glEnable, glsym_func_void); | ||
1986 | |||
1987 | FINDSYM(_sym_glEnableVertexAttribArray, "glEnableVertexAttribArray", glsym_func_void); | ||
1988 | FALLBAK(_sym_glEnableVertexAttribArray, glsym_func_void); | ||
1989 | |||
1990 | FINDSYM(_sym_glFinish, "glFinish", glsym_func_void); | ||
1991 | FALLBAK(_sym_glFinish, glsym_func_void); | ||
1992 | |||
1993 | FINDSYM(_sym_glFlush, "glFlush", glsym_func_void); | ||
1994 | FALLBAK(_sym_glFlush, glsym_func_void); | ||
1995 | |||
1996 | FINDSYM(_sym_glFramebufferRenderbuffer, "glFramebufferRenderbuffer", glsym_func_void); | ||
1997 | FALLBAK(_sym_glFramebufferRenderbuffer, glsym_func_void); | ||
1998 | |||
1999 | FINDSYM(_sym_glFramebufferTexture2D, "glFramebufferTexture2D", glsym_func_void); | ||
2000 | FALLBAK(_sym_glFramebufferTexture2D, glsym_func_void); | ||
2001 | |||
2002 | FINDSYM(_sym_glFrontFace, "glFrontFace", glsym_func_void); | ||
2003 | FALLBAK(_sym_glFrontFace, glsym_func_void); | ||
2004 | |||
2005 | FINDSYM(_sym_glGenBuffers, "glGenBuffers", glsym_func_void); | ||
2006 | FALLBAK(_sym_glGenBuffers, glsym_func_void); | ||
2007 | |||
2008 | FINDSYM(_sym_glGenerateMipmap, "glGenerateMipmap", glsym_func_void); | ||
2009 | FALLBAK(_sym_glGenerateMipmap, glsym_func_void); | ||
2010 | |||
2011 | FINDSYM(_sym_glGenFramebuffers, "glGenFramebuffers", glsym_func_void); | ||
2012 | FALLBAK(_sym_glGenFramebuffers, glsym_func_void); | ||
2013 | |||
2014 | FINDSYM(_sym_glGenRenderbuffers, "glGenRenderbuffers", glsym_func_void); | ||
2015 | FALLBAK(_sym_glGenRenderbuffers, glsym_func_void); | ||
2016 | |||
2017 | FINDSYM(_sym_glGenTextures, "glGenTextures", glsym_func_void); | ||
2018 | FALLBAK(_sym_glGenTextures, glsym_func_void); | ||
2019 | |||
2020 | FINDSYM(_sym_glGetActiveAttrib, "glGetActiveAttrib", glsym_func_void); | ||
2021 | FALLBAK(_sym_glGetActiveAttrib, glsym_func_void); | ||
2022 | |||
2023 | FINDSYM(_sym_glGetActiveUniform, "glGetActiveUniform", glsym_func_void); | ||
2024 | FALLBAK(_sym_glGetActiveUniform, glsym_func_void); | ||
2025 | |||
2026 | FINDSYM(_sym_glGetAttachedShaders, "glGetAttachedShaders", glsym_func_void); | ||
2027 | FALLBAK(_sym_glGetAttachedShaders, glsym_func_void); | ||
2028 | |||
2029 | FINDSYM(_sym_glGetAttribLocation, "glGetAttribLocation", glsym_func_int); | ||
2030 | FALLBAK(_sym_glGetAttribLocation, glsym_func_int); | ||
2031 | |||
2032 | FINDSYM(_sym_glGetBooleanv, "glGetBooleanv", glsym_func_void); | ||
2033 | FALLBAK(_sym_glGetBooleanv, glsym_func_void); | ||
2034 | |||
2035 | FINDSYM(_sym_glGetBufferParameteriv, "glGetBufferParameteriv", glsym_func_void); | ||
2036 | FALLBAK(_sym_glGetBufferParameteriv, glsym_func_void); | ||
2037 | |||
2038 | FINDSYM(_sym_glGetError, "glGetError", glsym_func_uint); | ||
2039 | FALLBAK(_sym_glGetError, glsym_func_uint); | ||
2040 | |||
2041 | FINDSYM(_sym_glGetFloatv, "glGetFloatv", glsym_func_void); | ||
2042 | FALLBAK(_sym_glGetFloatv, glsym_func_void); | ||
2043 | |||
2044 | FINDSYM(_sym_glGetFramebufferAttachmentParameteriv, "glGetFramebufferAttachmentParameteriv", glsym_func_void); | ||
2045 | FALLBAK(_sym_glGetFramebufferAttachmentParameteriv, glsym_func_void); | ||
2046 | |||
2047 | FINDSYM(_sym_glGetIntegerv, "glGetIntegerv", glsym_func_void); | ||
2048 | FALLBAK(_sym_glGetIntegerv, glsym_func_void); | ||
2049 | |||
2050 | FINDSYM(_sym_glGetProgramiv, "glGetProgramiv", glsym_func_void); | ||
2051 | FALLBAK(_sym_glGetProgramiv, glsym_func_void); | ||
2052 | |||
2053 | FINDSYM(_sym_glGetProgramInfoLog, "glGetProgramInfoLog", glsym_func_void); | ||
2054 | FALLBAK(_sym_glGetProgramInfoLog, glsym_func_void); | ||
2055 | |||
2056 | FINDSYM(_sym_glGetRenderbufferParameteriv, "glGetRenderbufferParameteriv", glsym_func_void); | ||
2057 | FALLBAK(_sym_glGetRenderbufferParameteriv, glsym_func_void); | ||
2058 | |||
2059 | FINDSYM(_sym_glGetShaderiv, "glGetShaderiv", glsym_func_void); | ||
2060 | FALLBAK(_sym_glGetShaderiv, glsym_func_void); | ||
2061 | |||
2062 | FINDSYM(_sym_glGetShaderInfoLog, "glGetShaderInfoLog", glsym_func_void); | ||
2063 | FALLBAK(_sym_glGetShaderInfoLog, glsym_func_void); | ||
2064 | |||
2065 | FINDSYM(_sym_glGetShaderPrecisionFormat, "glGetShaderPrecisionFormat", glsym_func_void); | ||
2066 | FALLBAK(_sym_glGetShaderPrecisionFormat, glsym_func_void); | ||
2067 | |||
2068 | FINDSYM(_sym_glGetShaderSource, "glGetShaderSource", glsym_func_void); | ||
2069 | FALLBAK(_sym_glGetShaderSource, glsym_func_void); | ||
2070 | |||
2071 | FINDSYM(_sym_glGetString, "glGetString", glsym_func_uchar_ptr); | ||
2072 | FALLBAK(_sym_glGetString, glsym_func_const_uchar_ptr); | ||
2073 | |||
2074 | FINDSYM(_sym_glGetTexParameterfv, "glGetTexParameterfv", glsym_func_void); | ||
2075 | FALLBAK(_sym_glGetTexParameterfv, glsym_func_void); | ||
2076 | |||
2077 | FINDSYM(_sym_glGetTexParameteriv, "glGetTexParameteriv", glsym_func_void); | ||
2078 | FALLBAK(_sym_glGetTexParameteriv, glsym_func_void); | ||
2079 | |||
2080 | FINDSYM(_sym_glGetUniformfv, "glGetUniformfv", glsym_func_void); | ||
2081 | FALLBAK(_sym_glGetUniformfv, glsym_func_void); | ||
2082 | |||
2083 | FINDSYM(_sym_glGetUniformiv, "glGetUniformiv", glsym_func_void); | ||
2084 | FALLBAK(_sym_glGetUniformiv, glsym_func_void); | ||
2085 | |||
2086 | FINDSYM(_sym_glGetUniformLocation, "glGetUniformLocation", glsym_func_int); | ||
2087 | FALLBAK(_sym_glGetUniformLocation, glsym_func_int); | ||
2088 | |||
2089 | FINDSYM(_sym_glGetVertexAttribfv, "glGetVertexAttribfv", glsym_func_void); | ||
2090 | FALLBAK(_sym_glGetVertexAttribfv, glsym_func_void); | ||
2091 | |||
2092 | FINDSYM(_sym_glGetVertexAttribiv, "glGetVertexAttribiv", glsym_func_void); | ||
2093 | FALLBAK(_sym_glGetVertexAttribiv, glsym_func_void); | ||
2094 | |||
2095 | FINDSYM(_sym_glGetVertexAttribPointerv, "glGetVertexAttribPointerv", glsym_func_void); | ||
2096 | FALLBAK(_sym_glGetVertexAttribPointerv, glsym_func_void); | ||
2097 | |||
2098 | FINDSYM(_sym_glHint, "glHint", glsym_func_void); | ||
2099 | FALLBAK(_sym_glHint, glsym_func_void); | ||
2100 | |||
2101 | FINDSYM(_sym_glIsBuffer, "glIsBuffer", glsym_func_uchar); | ||
2102 | FALLBAK(_sym_glIsBuffer, glsym_func_uchar); | ||
2103 | |||
2104 | FINDSYM(_sym_glIsEnabled, "glIsEnabled", glsym_func_uchar); | ||
2105 | FALLBAK(_sym_glIsEnabled, glsym_func_uchar); | ||
2106 | |||
2107 | FINDSYM(_sym_glIsFramebuffer, "glIsFramebuffer", glsym_func_uchar); | ||
2108 | FALLBAK(_sym_glIsFramebuffer, glsym_func_uchar); | ||
2109 | |||
2110 | FINDSYM(_sym_glIsProgram, "glIsProgram", glsym_func_uchar); | ||
2111 | FALLBAK(_sym_glIsProgram, glsym_func_uchar); | ||
2112 | |||
2113 | FINDSYM(_sym_glIsRenderbuffer, "glIsRenderbuffer", glsym_func_uchar); | ||
2114 | FALLBAK(_sym_glIsRenderbuffer, glsym_func_uchar); | ||
2115 | |||
2116 | FINDSYM(_sym_glIsShader, "glIsShader", glsym_func_uchar); | ||
2117 | FALLBAK(_sym_glIsShader, glsym_func_uchar); | ||
2118 | |||
2119 | FINDSYM(_sym_glIsTexture, "glIsTexture", glsym_func_uchar); | ||
2120 | FALLBAK(_sym_glIsTexture, glsym_func_uchar); | ||
2121 | |||
2122 | FINDSYM(_sym_glLineWidth, "glLineWidth", glsym_func_void); | ||
2123 | FALLBAK(_sym_glLineWidth, glsym_func_void); | ||
2124 | |||
2125 | FINDSYM(_sym_glLinkProgram, "glLinkProgram", glsym_func_void); | ||
2126 | FALLBAK(_sym_glLinkProgram, glsym_func_void); | ||
2127 | |||
2128 | FINDSYM(_sym_glPixelStorei, "glPixelStorei", glsym_func_void); | ||
2129 | FALLBAK(_sym_glPixelStorei, glsym_func_void); | ||
2130 | |||
2131 | FINDSYM(_sym_glPolygonOffset, "glPolygonOffset", glsym_func_void); | ||
2132 | FALLBAK(_sym_glPolygonOffset, glsym_func_void); | ||
2133 | |||
2134 | FINDSYM(_sym_glReadPixels, "glReadPixels", glsym_func_void); | ||
2135 | FALLBAK(_sym_glReadPixels, glsym_func_void); | ||
2136 | |||
2137 | FINDSYM(_sym_glReleaseShaderCompiler, "glReleaseShaderCompiler", glsym_func_void); | ||
2138 | FALLBAK(_sym_glReleaseShaderCompiler, glsym_func_void); | ||
2139 | |||
2140 | FINDSYM(_sym_glRenderbufferStorage, "glRenderbufferStorage", glsym_func_void); | ||
2141 | FALLBAK(_sym_glRenderbufferStorage, glsym_func_void); | ||
2142 | |||
2143 | FINDSYM(_sym_glSampleCoverage, "glSampleCoverage", glsym_func_void); | ||
2144 | FALLBAK(_sym_glSampleCoverage, glsym_func_void); | ||
2145 | |||
2146 | FINDSYM(_sym_glScissor, "glScissor", glsym_func_void); | ||
2147 | FALLBAK(_sym_glScissor, glsym_func_void); | ||
2148 | |||
2149 | FINDSYM(_sym_glShaderBinary, "glShaderBinary", glsym_func_void); | ||
2150 | FALLBAK(_sym_glShaderBinary, glsym_func_void); | ||
2151 | |||
2152 | FINDSYM(_sym_glShaderSource, "glShaderSource", glsym_func_void); | ||
2153 | FALLBAK(_sym_glShaderSource, glsym_func_void); | ||
2154 | |||
2155 | FINDSYM(_sym_glStencilFunc, "glStencilFunc", glsym_func_void); | ||
2156 | FALLBAK(_sym_glStencilFunc, glsym_func_void); | ||
2157 | |||
2158 | FINDSYM(_sym_glStencilFuncSeparate, "glStencilFuncSeparate", glsym_func_void); | ||
2159 | FALLBAK(_sym_glStencilFuncSeparate, glsym_func_void); | ||
2160 | |||
2161 | FINDSYM(_sym_glStencilMask, "glStencilMask", glsym_func_void); | ||
2162 | FALLBAK(_sym_glStencilMask, glsym_func_void); | ||
2163 | |||
2164 | FINDSYM(_sym_glStencilMaskSeparate, "glStencilMaskSeparate", glsym_func_void); | ||
2165 | FALLBAK(_sym_glStencilMaskSeparate, glsym_func_void); | ||
2166 | |||
2167 | FINDSYM(_sym_glStencilOp, "glStencilOp", glsym_func_void); | ||
2168 | FALLBAK(_sym_glStencilOp, glsym_func_void); | ||
2169 | |||
2170 | FINDSYM(_sym_glStencilOpSeparate, "glStencilOpSeparate", glsym_func_void); | ||
2171 | FALLBAK(_sym_glStencilOpSeparate, glsym_func_void); | ||
2172 | |||
2173 | FINDSYM(_sym_glTexImage2D, "glTexImage2D", glsym_func_void); | ||
2174 | FALLBAK(_sym_glTexImage2D, glsym_func_void); | ||
2175 | |||
2176 | FINDSYM(_sym_glTexParameterf, "glTexParameterf", glsym_func_void); | ||
2177 | FALLBAK(_sym_glTexParameterf, glsym_func_void); | ||
2178 | |||
2179 | FINDSYM(_sym_glTexParameterfv, "glTexParameterfv", glsym_func_void); | ||
2180 | FALLBAK(_sym_glTexParameterfv, glsym_func_void); | ||
2181 | |||
2182 | FINDSYM(_sym_glTexParameteri, "glTexParameteri", glsym_func_void); | ||
2183 | FALLBAK(_sym_glTexParameteri, glsym_func_void); | ||
2184 | |||
2185 | FINDSYM(_sym_glTexParameteriv, "glTexParameteriv", glsym_func_void); | ||
2186 | FALLBAK(_sym_glTexParameteriv, glsym_func_void); | ||
2187 | |||
2188 | FINDSYM(_sym_glTexSubImage2D, "glTexSubImage2D", glsym_func_void); | ||
2189 | FALLBAK(_sym_glTexSubImage2D, glsym_func_void); | ||
2190 | |||
2191 | FINDSYM(_sym_glUniform1f, "glUniform1f", glsym_func_void); | ||
2192 | FALLBAK(_sym_glUniform1f, glsym_func_void); | ||
2193 | |||
2194 | FINDSYM(_sym_glUniform1fv, "glUniform1fv", glsym_func_void); | ||
2195 | FALLBAK(_sym_glUniform1fv, glsym_func_void); | ||
2196 | |||
2197 | FINDSYM(_sym_glUniform1i, "glUniform1i", glsym_func_void); | ||
2198 | FALLBAK(_sym_glUniform1i, glsym_func_void); | ||
2199 | |||
2200 | FINDSYM(_sym_glUniform1iv, "glUniform1iv", glsym_func_void); | ||
2201 | FALLBAK(_sym_glUniform1iv, glsym_func_void); | ||
2202 | |||
2203 | FINDSYM(_sym_glUniform2f, "glUniform2f", glsym_func_void); | ||
2204 | FALLBAK(_sym_glUniform2f, glsym_func_void); | ||
2205 | |||
2206 | FINDSYM(_sym_glUniform2fv, "glUniform2fv", glsym_func_void); | ||
2207 | FALLBAK(_sym_glUniform2fv, glsym_func_void); | ||
2208 | |||
2209 | FINDSYM(_sym_glUniform2i, "glUniform2i", glsym_func_void); | ||
2210 | FALLBAK(_sym_glUniform2i, glsym_func_void); | ||
2211 | |||
2212 | FINDSYM(_sym_glUniform2iv, "glUniform2iv", glsym_func_void); | ||
2213 | FALLBAK(_sym_glUniform2iv, glsym_func_void); | ||
2214 | |||
2215 | FINDSYM(_sym_glUniform3f, "glUniform3f", glsym_func_void); | ||
2216 | FALLBAK(_sym_glUniform3f, glsym_func_void); | ||
2217 | |||
2218 | FINDSYM(_sym_glUniform3fv, "glUniform3fv", glsym_func_void); | ||
2219 | FALLBAK(_sym_glUniform3fv, glsym_func_void); | ||
2220 | |||
2221 | FINDSYM(_sym_glUniform3i, "glUniform3i", glsym_func_void); | ||
2222 | FALLBAK(_sym_glUniform3i, glsym_func_void); | ||
2223 | |||
2224 | FINDSYM(_sym_glUniform3iv, "glUniform3iv", glsym_func_void); | ||
2225 | FALLBAK(_sym_glUniform3iv, glsym_func_void); | ||
2226 | |||
2227 | FINDSYM(_sym_glUniform4f, "glUniform4f", glsym_func_void); | ||
2228 | FALLBAK(_sym_glUniform4f, glsym_func_void); | ||
2229 | |||
2230 | FINDSYM(_sym_glUniform4fv, "glUniform4fv", glsym_func_void); | ||
2231 | FALLBAK(_sym_glUniform4fv, glsym_func_void); | ||
2232 | |||
2233 | FINDSYM(_sym_glUniform4i, "glUniform4i", glsym_func_void); | ||
2234 | FALLBAK(_sym_glUniform4i, glsym_func_void); | ||
2235 | |||
2236 | FINDSYM(_sym_glUniform4iv, "glUniform4iv", glsym_func_void); | ||
2237 | FALLBAK(_sym_glUniform4iv, glsym_func_void); | ||
2238 | |||
2239 | FINDSYM(_sym_glUniformMatrix2fv, "glUniformMatrix2fv", glsym_func_void); | ||
2240 | FALLBAK(_sym_glUniformMatrix2fv, glsym_func_void); | ||
2241 | |||
2242 | FINDSYM(_sym_glUniformMatrix3fv, "glUniformMatrix3fv", glsym_func_void); | ||
2243 | FALLBAK(_sym_glUniformMatrix3fv, glsym_func_void); | ||
2244 | |||
2245 | FINDSYM(_sym_glUniformMatrix4fv, "glUniformMatrix4fv", glsym_func_void); | ||
2246 | FALLBAK(_sym_glUniformMatrix4fv, glsym_func_void); | ||
2247 | |||
2248 | FINDSYM(_sym_glUseProgram, "glUseProgram", glsym_func_void); | ||
2249 | FALLBAK(_sym_glUseProgram, glsym_func_void); | ||
2250 | |||
2251 | FINDSYM(_sym_glValidateProgram, "glValidateProgram", glsym_func_void); | ||
2252 | FALLBAK(_sym_glValidateProgram, glsym_func_void); | ||
2253 | |||
2254 | FINDSYM(_sym_glVertexAttrib1f, "glVertexAttrib1f", glsym_func_void); | ||
2255 | FALLBAK(_sym_glVertexAttrib1f, glsym_func_void); | ||
2256 | |||
2257 | FINDSYM(_sym_glVertexAttrib1fv, "glVertexAttrib1fv", glsym_func_void); | ||
2258 | FALLBAK(_sym_glVertexAttrib1fv, glsym_func_void); | ||
2259 | |||
2260 | FINDSYM(_sym_glVertexAttrib2f, "glVertexAttrib2f", glsym_func_void); | ||
2261 | FALLBAK(_sym_glVertexAttrib2f, glsym_func_void); | ||
2262 | |||
2263 | FINDSYM(_sym_glVertexAttrib2fv, "glVertexAttrib2fv", glsym_func_void); | ||
2264 | FALLBAK(_sym_glVertexAttrib2fv, glsym_func_void); | ||
2265 | |||
2266 | FINDSYM(_sym_glVertexAttrib3f, "glVertexAttrib3f", glsym_func_void); | ||
2267 | FALLBAK(_sym_glVertexAttrib3f, glsym_func_void); | ||
2268 | |||
2269 | FINDSYM(_sym_glVertexAttrib3fv, "glVertexAttrib3fv", glsym_func_void); | ||
2270 | FALLBAK(_sym_glVertexAttrib3fv, glsym_func_void); | ||
2271 | |||
2272 | FINDSYM(_sym_glVertexAttrib4f, "glVertexAttrib4f", glsym_func_void); | ||
2273 | FALLBAK(_sym_glVertexAttrib4f, glsym_func_void); | ||
2274 | |||
2275 | FINDSYM(_sym_glVertexAttrib4fv, "glVertexAttrib4fv", glsym_func_void); | ||
2276 | FALLBAK(_sym_glVertexAttrib4fv, glsym_func_void); | ||
2277 | |||
2278 | FINDSYM(_sym_glVertexAttribPointer, "glVertexAttribPointer", glsym_func_void); | ||
2279 | FALLBAK(_sym_glVertexAttribPointer, glsym_func_void); | ||
2280 | |||
2281 | FINDSYM(_sym_glViewport, "glViewport", glsym_func_void); | ||
2282 | FALLBAK(_sym_glViewport, glsym_func_void); | ||
2283 | |||
2284 | #undef FINDSYM | ||
2285 | #undef FALLBAK | ||
2286 | |||
2287 | // Checking to see if this function exists is a poor but reasonable way to | ||
2288 | // check if it's gles but it works for now | ||
2289 | if (_sym_glGetShaderPrecisionFormat != (typeof(_sym_glGetShaderPrecisionFormat))sym_missing ) | ||
2290 | { | ||
2291 | DBG("GL Library is GLES."); | ||
2292 | gl_lib_is_gles = 1; | ||
2293 | } | ||
2294 | |||
2295 | return 1; | ||
2296 | } | ||
2297 | |||
2298 | //--------------------------------------------------------------// | ||
2299 | // Wrapped GL APIs to handle desktop compatibility | ||
2300 | |||
2301 | // Stripping precision code from GLES shader for desktop compatibility | ||
2302 | // Code adopted from Meego GL code. Temporary Fix. | ||
2303 | static const char * | ||
2304 | opengl_strtok(const char *s, int *n, char **saveptr, char *prevbuf) | ||
2305 | { | ||
2306 | char *start; | ||
2307 | char *ret; | ||
2308 | char *p; | ||
2309 | int retlen; | ||
2310 | static const char *delim = " \t\n\r/"; | ||
2311 | |||
2312 | if (prevbuf) free(prevbuf); | ||
2313 | |||
2314 | if (s) | ||
2315 | *saveptr = (char *)s; | ||
2316 | else | ||
2317 | { | ||
2318 | if (!(*saveptr) || !(*n)) | ||
2319 | return NULL; | ||
2320 | s = *saveptr; | ||
2321 | } | ||
2322 | |||
2323 | for (; *n && strchr(delim, *s); s++, (*n)--) | ||
2324 | { | ||
2325 | if (*s == '/' && *n > 1) | ||
2326 | { | ||
2327 | if (s[1] == '/') | ||
2328 | { | ||
2329 | do | ||
2330 | { | ||
2331 | s++, (*n)--; | ||
2332 | } | ||
2333 | while (*n > 1 && s[1] != '\n' && s[1] != '\r'); | ||
2334 | } | ||
2335 | else if (s[1] == '*') | ||
2336 | { | ||
2337 | do | ||
2338 | { | ||
2339 | s++, (*n)--; | ||
2340 | } | ||
2341 | while (*n > 2 && (s[1] != '*' || s[2] != '/')); | ||
2342 | s++, (*n)--; | ||
2343 | } | ||
2344 | } | ||
2345 | } | ||
2346 | |||
2347 | start = (char *)s; | ||
2348 | for (; *n && *s && !strchr(delim, *s); s++, (*n)--); | ||
2349 | if (*n > 0) s++, (*n)--; | ||
2350 | |||
2351 | *saveptr = (char *)s; | ||
2352 | |||
2353 | retlen = s - start; | ||
2354 | ret = malloc(retlen + 1); | ||
2355 | p = ret; | ||
2356 | |||
2357 | while (retlen > 0) | ||
2358 | { | ||
2359 | if (*start == '/' && retlen > 1) | ||
2360 | { | ||
2361 | if (start[1] == '/') | ||
2362 | { | ||
2363 | do | ||
2364 | { | ||
2365 | start++, retlen--; | ||
2366 | } | ||
2367 | while (retlen > 1 && start[1] != '\n' && start[1] != '\r'); | ||
2368 | start++, retlen--; | ||
2369 | continue; | ||
2370 | } | ||
2371 | else if (start[1] == '*') | ||
2372 | { | ||
2373 | do | ||
2374 | { | ||
2375 | start++, retlen--; | ||
2376 | } | ||
2377 | while (retlen > 2 && (start[1] != '*' || start[2] != '/')); | ||
2378 | start += 3, retlen -= 3; | ||
2379 | continue; | ||
2380 | } | ||
2381 | } | ||
2382 | *(p++) = *(start++), retlen--; | ||
2383 | } | ||
2384 | |||
2385 | *p = 0; | ||
2386 | return ret; | ||
2387 | } | ||
2388 | |||
2389 | static char * | ||
2390 | patch_gles_shader(const char *source, int length, int *patched_len) | ||
2391 | { | ||
2392 | char *saveptr = NULL; | ||
2393 | char *sp; | ||
2394 | char *p = NULL; | ||
2395 | |||
2396 | if (!length) length = strlen(source); | ||
2397 | |||
2398 | *patched_len = 0; | ||
2399 | int patched_size = length; | ||
2400 | char *patched = malloc(patched_size + 1); | ||
2401 | |||
2402 | if (!patched) return NULL; | ||
2403 | |||
2404 | p = (char *)opengl_strtok(source, &length, &saveptr, NULL); | ||
2405 | for (; p; p = (char *)opengl_strtok(0, &length, &saveptr, p)) | ||
2406 | { | ||
2407 | if (!strncmp(p, "lowp", 4) || !strncmp(p, "mediump", 7) || !strncmp(p, "highp", 5)) | ||
2408 | { | ||
2409 | continue; | ||
2410 | } | ||
2411 | else if (!strncmp(p, "precision", 9)) | ||
2412 | { | ||
2413 | while ((p = (char *)opengl_strtok(0, &length, &saveptr, p)) && !strchr(p, ';')); | ||
2414 | } | ||
2415 | else | ||
2416 | { | ||
2417 | if (!strncmp(p, "gl_MaxVertexUniformVectors", 26)) | ||
2418 | { | ||
2419 | p = "(gl_MaxVertexUniformComponents / 4)"; | ||
2420 | } | ||
2421 | else if (!strncmp(p, "gl_MaxFragmentUniformVectors", 28)) | ||
2422 | { | ||
2423 | p = "(gl_MaxFragmentUniformComponents / 4)"; | ||
2424 | } | ||
2425 | else if (!strncmp(p, "gl_MaxVaryingVectors", 20)) | ||
2426 | { | ||
2427 | p = "(gl_MaxVaryingFloats / 4)"; | ||
2428 | } | ||
2429 | |||
2430 | int new_len = strlen(p); | ||
2431 | if (*patched_len + new_len > patched_size) | ||
2432 | { | ||
2433 | patched_size *= 2; | ||
2434 | patched = realloc(patched, patched_size + 1); | ||
2435 | |||
2436 | if (!patched) | ||
2437 | return NULL; | ||
2438 | } | ||
2439 | |||
2440 | memcpy(patched + *patched_len, p, new_len); | ||
2441 | *patched_len += new_len; | ||
2442 | } | ||
2443 | } | ||
2444 | |||
2445 | patched[*patched_len] = 0; | ||
2446 | /* check that we don't leave dummy preprocessor lines */ | ||
2447 | for (sp = patched; *sp;) | ||
2448 | { | ||
2449 | for (; *sp == ' ' || *sp == '\t'; sp++); | ||
2450 | if (!strncmp(sp, "#define", 7)) | ||
2451 | { | ||
2452 | for (p = sp + 7; *p == ' ' || *p == '\t'; p++); | ||
2453 | if (*p == '\n' || *p == '\r' || *p == '/') | ||
2454 | { | ||
2455 | memset(sp, 0x20, 7); | ||
2456 | } | ||
2457 | } | ||
2458 | for (; *sp && *sp != '\n' && *sp != '\r'; sp++); | ||
2459 | for (; *sp == '\n' || *sp == '\r'; sp++); | ||
2460 | } | ||
2461 | return patched; | ||
2462 | } | ||
2463 | |||
2464 | static void | ||
2465 | evgl_glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) | ||
2466 | { | ||
2467 | int i = 0, len = 0; | ||
2468 | |||
2469 | char **s = malloc(count * sizeof(char*)); | ||
2470 | GLint *l = malloc(count * sizeof(GLint)); | ||
2471 | |||
2472 | memset(s, 0, count * sizeof(char*)); | ||
2473 | memset(l, 0, count * sizeof(GLint)); | ||
2474 | |||
2475 | for (i = 0; i < count; ++i) | ||
2476 | { | ||
2477 | if (length) | ||
2478 | { | ||
2479 | len = length[i]; | ||
2480 | if (len < 0) | ||
2481 | len = string[i] ? strlen(string[i]) : 0; | ||
2482 | } | ||
2483 | else | ||
2484 | len = string[i] ? strlen(string[i]) : 0; | ||
2485 | |||
2486 | if (string[i]) | ||
2487 | { | ||
2488 | s[i] = patch_gles_shader(string[i], len, &l[i]); | ||
2489 | if (!s[i]) | ||
2490 | { | ||
2491 | while(i) | ||
2492 | free(s[--i]); | ||
2493 | free(l); | ||
2494 | free(s); | ||
2495 | |||
2496 | DBG("Patching Shader Failed."); | ||
2497 | return; | ||
2498 | } | ||
2499 | } | ||
2500 | else | ||
2501 | { | ||
2502 | s[i] = NULL; | ||
2503 | l[i] = 0; | ||
2504 | } | ||
2505 | } | ||
2506 | |||
2507 | _sym_glShaderSource(shader, count, (const char **)s, l); | ||
2508 | |||
2509 | while(i) | ||
2510 | free(s[--i]); | ||
2511 | free(l); | ||
2512 | free(s); | ||
2513 | } | ||
2514 | |||
2515 | |||
2516 | static void | ||
2517 | evgl_glGetShaderPrecisionFormat(GLenum shadertype __UNUSED__, GLenum precisiontype __UNUSED__, GLint* range, GLint* precision) | ||
2518 | { | ||
2519 | if (range) | ||
2520 | { | ||
2521 | range[0] = -126; // floor(log2(FLT_MIN)) | ||
2522 | range[1] = 127; // floor(log2(FLT_MAX)) | ||
2523 | } | ||
2524 | if (precision) | ||
2525 | { | ||
2526 | precision[0] = 24; // floor(-log2((1.0/16777218.0))); | ||
2527 | } | ||
2528 | return; | ||
2529 | } | ||
2530 | |||
2531 | static void | ||
2532 | evgl_glReleaseShaderCompiler(void) | ||
2533 | { | ||
2534 | DBG("Not supported in Desktop GL"); | ||
2535 | return; | ||
2536 | } | ||
2537 | |||
2538 | static void | ||
2539 | evgl_glShaderBinary(GLsizei n __UNUSED__, const GLuint* shaders __UNUSED__, GLenum binaryformat __UNUSED__, const void* binary __UNUSED__, GLsizei length __UNUSED__) | ||
2540 | { | ||
2541 | // FIXME: need to dlsym/getprocaddress for this | ||
2542 | DBG("Not supported in Desktop GL"); | ||
2543 | return; | ||
2544 | //n = binaryformat = length = 0; | ||
2545 | //shaders = binary = 0; | ||
2546 | } | ||
2547 | #endif | ||
2548 | //--------------------------------------------------------------// | ||
2549 | |||
2550 | |||
2551 | #ifdef EVAS_GL | ||
2552 | static void | ||
2553 | override_gl_apis(Evas_GL_API *api) | ||
2554 | { | ||
2555 | |||
2556 | api->version = EVAS_GL_API_VERSION; | ||
2557 | |||
2558 | #define ORD(f) EVAS_API_OVERRIDE(f, api, _sym_) | ||
2559 | // GLES 2.0 | ||
2560 | ORD(glActiveTexture); | ||
2561 | ORD(glAttachShader); | ||
2562 | ORD(glBindAttribLocation); | ||
2563 | ORD(glBindBuffer); | ||
2564 | ORD(glBindFramebuffer); | ||
2565 | ORD(glBindRenderbuffer); | ||
2566 | ORD(glBindTexture); | ||
2567 | ORD(glBlendColor); | ||
2568 | ORD(glBlendEquation); | ||
2569 | ORD(glBlendEquationSeparate); | ||
2570 | ORD(glBlendFunc); | ||
2571 | ORD(glBlendFuncSeparate); | ||
2572 | ORD(glBufferData); | ||
2573 | ORD(glBufferSubData); | ||
2574 | ORD(glCheckFramebufferStatus); | ||
2575 | ORD(glClear); | ||
2576 | ORD(glClearColor); | ||
2577 | ORD(glClearDepthf); | ||
2578 | ORD(glClearStencil); | ||
2579 | ORD(glColorMask); | ||
2580 | ORD(glCompileShader); | ||
2581 | ORD(glCompressedTexImage2D); | ||
2582 | ORD(glCompressedTexSubImage2D); | ||
2583 | ORD(glCopyTexImage2D); | ||
2584 | ORD(glCopyTexSubImage2D); | ||
2585 | ORD(glCreateProgram); | ||
2586 | ORD(glCreateShader); | ||
2587 | ORD(glCullFace); | ||
2588 | ORD(glDeleteBuffers); | ||
2589 | ORD(glDeleteFramebuffers); | ||
2590 | ORD(glDeleteProgram); | ||
2591 | ORD(glDeleteRenderbuffers); | ||
2592 | ORD(glDeleteShader); | ||
2593 | ORD(glDeleteTextures); | ||
2594 | ORD(glDepthFunc); | ||
2595 | ORD(glDepthMask); | ||
2596 | ORD(glDepthRangef); | ||
2597 | ORD(glDetachShader); | ||
2598 | ORD(glDisable); | ||
2599 | ORD(glDisableVertexAttribArray); | ||
2600 | ORD(glDrawArrays); | ||
2601 | ORD(glDrawElements); | ||
2602 | ORD(glEnable); | ||
2603 | ORD(glEnableVertexAttribArray); | ||
2604 | ORD(glFinish); | ||
2605 | ORD(glFlush); | ||
2606 | ORD(glFramebufferRenderbuffer); | ||
2607 | ORD(glFramebufferTexture2D); | ||
2608 | ORD(glFrontFace); | ||
2609 | ORD(glGenBuffers); | ||
2610 | ORD(glGenerateMipmap); | ||
2611 | ORD(glGenFramebuffers); | ||
2612 | ORD(glGenRenderbuffers); | ||
2613 | ORD(glGenTextures); | ||
2614 | ORD(glGetActiveAttrib); | ||
2615 | ORD(glGetActiveUniform); | ||
2616 | ORD(glGetAttachedShaders); | ||
2617 | ORD(glGetAttribLocation); | ||
2618 | ORD(glGetBooleanv); | ||
2619 | ORD(glGetBufferParameteriv); | ||
2620 | ORD(glGetError); | ||
2621 | ORD(glGetFloatv); | ||
2622 | ORD(glGetFramebufferAttachmentParameteriv); | ||
2623 | ORD(glGetIntegerv); | ||
2624 | ORD(glGetProgramiv); | ||
2625 | ORD(glGetProgramInfoLog); | ||
2626 | ORD(glGetRenderbufferParameteriv); | ||
2627 | ORD(glGetShaderiv); | ||
2628 | ORD(glGetShaderInfoLog); | ||
2629 | ORD(glGetShaderPrecisionFormat); | ||
2630 | ORD(glGetShaderSource); | ||
2631 | ORD(glGetString); // FIXME | ||
2632 | ORD(glGetTexParameterfv); | ||
2633 | ORD(glGetTexParameteriv); | ||
2634 | ORD(glGetUniformfv); | ||
2635 | ORD(glGetUniformiv); | ||
2636 | ORD(glGetUniformLocation); | ||
2637 | ORD(glGetVertexAttribfv); | ||
2638 | ORD(glGetVertexAttribiv); | ||
2639 | ORD(glGetVertexAttribPointerv); | ||
2640 | ORD(glHint); | ||
2641 | ORD(glIsBuffer); | ||
2642 | ORD(glIsEnabled); | ||
2643 | ORD(glIsFramebuffer); | ||
2644 | ORD(glIsProgram); | ||
2645 | ORD(glIsRenderbuffer); | ||
2646 | ORD(glIsShader); | ||
2647 | ORD(glIsTexture); | ||
2648 | ORD(glLineWidth); | ||
2649 | ORD(glLinkProgram); | ||
2650 | ORD(glPixelStorei); | ||
2651 | ORD(glPolygonOffset); | ||
2652 | ORD(glReadPixels); | ||
2653 | ORD(glReleaseShaderCompiler); | ||
2654 | ORD(glRenderbufferStorage); | ||
2655 | ORD(glSampleCoverage); | ||
2656 | ORD(glScissor); | ||
2657 | ORD(glShaderBinary); | ||
2658 | ORD(glShaderSource); | ||
2659 | ORD(glStencilFunc); | ||
2660 | ORD(glStencilFuncSeparate); | ||
2661 | ORD(glStencilMask); | ||
2662 | ORD(glStencilMaskSeparate); | ||
2663 | ORD(glStencilOp); | ||
2664 | ORD(glStencilOpSeparate); | ||
2665 | ORD(glTexImage2D); | ||
2666 | ORD(glTexParameterf); | ||
2667 | ORD(glTexParameterfv); | ||
2668 | ORD(glTexParameteri); | ||
2669 | ORD(glTexParameteriv); | ||
2670 | ORD(glTexSubImage2D); | ||
2671 | ORD(glUniform1f); | ||
2672 | ORD(glUniform1fv); | ||
2673 | ORD(glUniform1i); | ||
2674 | ORD(glUniform1iv); | ||
2675 | ORD(glUniform2f); | ||
2676 | ORD(glUniform2fv); | ||
2677 | ORD(glUniform2i); | ||
2678 | ORD(glUniform2iv); | ||
2679 | ORD(glUniform3f); | ||
2680 | ORD(glUniform3fv); | ||
2681 | ORD(glUniform3i); | ||
2682 | ORD(glUniform3iv); | ||
2683 | ORD(glUniform4f); | ||
2684 | ORD(glUniform4fv); | ||
2685 | ORD(glUniform4i); | ||
2686 | ORD(glUniform4iv); | ||
2687 | ORD(glUniformMatrix2fv); | ||
2688 | ORD(glUniformMatrix3fv); | ||
2689 | ORD(glUniformMatrix4fv); | ||
2690 | ORD(glUseProgram); | ||
2691 | ORD(glValidateProgram); | ||
2692 | ORD(glVertexAttrib1f); | ||
2693 | ORD(glVertexAttrib1fv); | ||
2694 | ORD(glVertexAttrib2f); | ||
2695 | ORD(glVertexAttrib2fv); | ||
2696 | ORD(glVertexAttrib3f); | ||
2697 | ORD(glVertexAttrib3fv); | ||
2698 | ORD(glVertexAttrib4f); | ||
2699 | ORD(glVertexAttrib4fv); | ||
2700 | ORD(glVertexAttribPointer); | ||
2701 | ORD(glViewport); | ||
2702 | #undef ORD | ||
2703 | |||
2704 | #define ORD(f) EVAS_API_OVERRIDE(f, &gl_funcs, evgl_) | ||
2705 | if (!gl_lib_is_gles) | ||
2706 | { | ||
2707 | // Override functions wrapped by Evas_GL | ||
2708 | // GLES2.0 API compat on top of desktop gl | ||
2709 | ORD(glGetShaderPrecisionFormat); | ||
2710 | ORD(glReleaseShaderCompiler); | ||
2711 | ORD(glShaderBinary); | ||
2712 | } | ||
2713 | |||
2714 | ORD(glShaderSource); // Do precision stripping in both cases | ||
2715 | #undef ORD | ||
2716 | } | ||
2717 | #endif | ||
2718 | |||
2719 | //-------------------------------------------// | ||
2720 | static int | ||
2721 | gl_lib_init(void) | ||
2722 | { | ||
2723 | #ifdef EVAS_GL | ||
2724 | // dlopen OSMesa | ||
2725 | gl_lib_handle = dlopen("libOSMesa.so.1", RTLD_NOW); | ||
2726 | if (!gl_lib_handle) gl_lib_handle = dlopen("libOSMesa.so", RTLD_NOW); | ||
2727 | if (!gl_lib_handle) | ||
2728 | { | ||
2729 | DBG("Unable to open libOSMesa: %s", dlerror()); | ||
2730 | return 0; | ||
2731 | } | ||
2732 | |||
2733 | //------------------------------------------------// | ||
2734 | if (!glue_sym_init()) return 0; | ||
2735 | if (!gl_sym_init()) return 0; | ||
2736 | |||
2737 | override_gl_apis(&gl_funcs); | ||
2738 | |||
2739 | return 1; | ||
2740 | #else | ||
2741 | return 0; | ||
2742 | #endif | ||
2743 | } | ||
2744 | |||
2745 | |||
2746 | static void | ||
2747 | init_gl(void) | ||
2748 | { | ||
2749 | DBG("Initializing Software OpenGL APIs...\n"); | ||
2750 | |||
2751 | if (!gl_lib_init()) | ||
2752 | DBG("Unable to support EvasGL in this engine module. Install OSMesa to get it running"); | ||
2753 | else | ||
2754 | { | ||
2755 | #define ORD(f) EVAS_API_OVERRIDE(f, &func, eng_) | ||
2756 | ORD(gl_surface_create); | ||
2757 | ORD(gl_surface_destroy); | ||
2758 | ORD(gl_context_create); | ||
2759 | ORD(gl_context_destroy); | ||
2760 | ORD(gl_make_current); | ||
2761 | ORD(gl_string_query); // FIXME: Need to implement | ||
2762 | ORD(gl_proc_address_get); // FIXME: Need to implement | ||
2763 | ORD(gl_native_surface_get); | ||
2764 | ORD(gl_api_get); | ||
2765 | #undef ORD | ||
2766 | } | ||
2767 | } | ||
2768 | |||
2769 | |||
2770 | /* | ||
2771 | ***** | ||
2772 | ** | ||
2773 | ** MODULE ACCESSIBLE API API | ||
2774 | ** | ||
2775 | ***** | ||
2776 | */ | ||
2777 | |||
2778 | static int | ||
2779 | module_open(Evas_Module *em) | ||
2780 | { | ||
2781 | if (!em) return 0; | ||
2782 | _evas_soft_gen_log_dom = eina_log_domain_register | ||
2783 | ("evas-software_generic", EVAS_DEFAULT_LOG_COLOR); | ||
2784 | if(_evas_soft_gen_log_dom<0) | ||
2785 | { | ||
2786 | EINA_LOG_ERR("Can not create a module log domain."); | ||
2787 | return 0; | ||
2788 | } | ||
2789 | |||
2790 | init_gl(); | ||
2791 | |||
2792 | em->functions = (void *)(&func); | ||
2793 | cpunum = eina_cpu_count(); | ||
2794 | return 1; | ||
2795 | } | ||
2796 | |||
2797 | static void | ||
2798 | module_close(Evas_Module *em __UNUSED__) | ||
2799 | { | ||
2800 | eina_log_domain_unregister(_evas_soft_gen_log_dom); | ||
2801 | } | ||
2802 | |||
2803 | static Evas_Module_Api evas_modapi = | ||
2804 | { | ||
2805 | EVAS_MODULE_API_VERSION, | ||
2806 | "software_generic", | ||
2807 | "none", | ||
2808 | { | ||
2809 | module_open, | ||
2810 | module_close | ||
2811 | } | ||
2812 | }; | ||
2813 | |||
2814 | EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_ENGINE, engine, software_generic); | ||
2815 | |||
2816 | #ifndef EVAS_STATIC_BUILD_SOFTWARE_GENERIC | ||
2817 | EVAS_EINA_MODULE_DEFINE(engine, software_generic); | ||
2818 | #endif | ||