summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorSung Park <sungwoo@gmail.com>2012-10-05 10:03:37 +0000
committerSung Park <sungwoo@gmail.com>2012-10-05 10:03:37 +0000
commit52e4090f9214d69588b27dd871f22498b76c3e27 (patch)
tree51de28fb1dadd5179b494bd7bfe85df29f8774d5 /legacy
parenteb9cbc76a03e51ebda645db772819482b2affe95 (diff)
Added Debug feature for Evas GL's GL APIs. It can be set with
EVAS_GL_API_DEBUG=1 and when it is set, all the GL calls will check if make_current has been properly called. Also, it'll check if all the GL calls are called within the Pixel Getter function for Direct Rendering option. SVN revision: 77522
Diffstat (limited to 'legacy')
-rw-r--r--legacy/evas/ChangeLog10
-rw-r--r--legacy/evas/NEWS1
-rw-r--r--legacy/evas/src/modules/engines/gl_common/evas_gl_api.c1544
-rwxr-xr-xlegacy/evas/src/modules/engines/gl_common/evas_gl_core.c143
-rwxr-xr-xlegacy/evas/src/modules/engines/gl_common/evas_gl_core_private.h40
5 files changed, 1030 insertions, 708 deletions
diff --git a/legacy/evas/ChangeLog b/legacy/evas/ChangeLog
index 7b48846..b1f3eb4 100644
--- a/legacy/evas/ChangeLog
+++ b/legacy/evas/ChangeLog
@@ -1071,3 +1071,13 @@
10712012-10-03 Mike Blumenkrantz 10712012-10-03 Mike Blumenkrantz
1072 1072
1073 * evas_object_del() now accepts NULL more peacefully 1073 * evas_object_del() now accepts NULL more peacefully
1074
10752012-10-05 Sung W. Park (sung_)
1076
1077 * Added Debug feature for Evas GL's GL APIs. It can be set with
1078 EVAS_GL_API_DEBUG=1 and when it is set, all the GL calls will check
1079 if make_current has been properly called. Also, it'll check if all
1080 the GL calls are called within the Pixel Getter function for Direct
1081 Rendering option.
1082
1083
diff --git a/legacy/evas/NEWS b/legacy/evas/NEWS
index 0e0553b..e06cfe7 100644
--- a/legacy/evas/NEWS
+++ b/legacy/evas/NEWS
@@ -9,6 +9,7 @@ Additions:
9 * EVAS_CALLBACK_IMAGE_RESIZE. 9 * EVAS_CALLBACK_IMAGE_RESIZE.
10 * Evas_Device registration/manipulation/querying API 10 * Evas_Device registration/manipulation/querying API
11 * Evas_Object_Display_Mode querying API 11 * Evas_Object_Display_Mode querying API
12 * EVAS_GL_API_DEBUG=1 env. var option for outputting debug logs related to Evas GL's GL calls.
12 13
13Improvements: 14Improvements:
14 15
diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_api.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_api.c
index d705b8a..f40d214 100644
--- a/legacy/evas/src/modules/engines/gl_common/evas_gl_api.c
+++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_api.c
@@ -1,12 +1,547 @@
1#include "evas_gl_core_private.h" 1#include "evas_gl_core_private.h"
2#include "evas_gl_api_ext.h" 2#include "evas_gl_api_ext.h"
3 3
4#define EVGL_FUNC_BEGIN() 4#define EVGL_FUNC_BEGIN() \
5{ \
6 _func_begin_debug(__FUNCTION__); \
7}
8
5#define EVGL_FUNC_END() 9#define EVGL_FUNC_END()
6#define _EVGL_INT_INIT_VALUE -3 10#define _EVGL_INT_INIT_VALUE -3
7 11
12//---------------------------------------//
13// API Debug Error Checking Code
14static
15void _make_current_check(const char* api)
16{
17 EVGL_Context *ctx = NULL;
18
19 ctx = _evgl_current_context_get();
20
21 if (!ctx)
22 {
23 CRIT("\e[1;33m%s\e[m: Current Context NOT SET: GL Call Should NOT Be Called without MakeCurrent!!!", api);
24 }
25}
26
27static
28void _direct_rendering_check(const char *api)
29{
30 EVGL_Context *ctx = NULL;
31
32 ctx = _evgl_current_context_get();
33 if (!ctx)
34 {
35 ERR("Current Context Not Set");
36 return;
37 }
38
39 if (_evgl_not_in_pixel_get(evgl_engine))
40 {
41 CRIT("\e[1;33m%s\e[m: This API is being called outside Pixel Get Callback Function.", api);
42 }
43}
44
45static
46void _func_begin_debug(const char *api)
47{
48 _make_current_check(api);
49 _direct_rendering_check(api);
50}
51
52//-------------------------------------------------------------//
53// GL to GLES Compatibility Functions
54//-------------------------------------------------------------//
8void 55void
9evgl_glActiveTexture(GLenum texture) 56_evgl_glBindFramebuffer(GLenum target, GLuint framebuffer)
57{
58 EVGL_Context *ctx = NULL;
59
60 ctx = _evgl_current_context_get();
61
62 if (!ctx)
63 {
64 ERR("No current context set.");
65 return;
66 }
67
68 // Take care of BindFramebuffer 0 issue
69 if (framebuffer==0)
70 {
71 if (evgl_direct_enabled(evgl_engine))
72 glBindFramebuffer(target, 0);
73 else
74 glBindFramebuffer(target, ctx->surface_fbo);
75 ctx->current_fbo = 0;
76 }
77 else
78 {
79 glBindFramebuffer(target, framebuffer);
80
81 // Save this for restore when doing make current
82 ctx->current_fbo = framebuffer;
83 }
84}
85
86void
87_evgl_glClearDepthf(GLclampf depth)
88{
89#ifdef GL_GLES
90 glClearDepthf(depth);
91#else
92 glClearDepth(depth);
93#endif
94}
95
96void
97_evgl_glDepthRangef(GLclampf zNear, GLclampf zFar)
98{
99#ifdef GL_GLES
100 glDepthRangef(zNear, zFar);
101#else
102 glDepthRange(zNear, zFar);
103#endif
104}
105
106void
107_evgl_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
108{
109#ifdef GL_GLES
110 glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
111#else
112 if (range)
113 {
114 range[0] = -126; // floor(log2(FLT_MIN))
115 range[1] = 127; // floor(log2(FLT_MAX))
116 }
117 if (precision)
118 {
119 precision[0] = 24; // floor(-log2((1.0/16777218.0)));
120 }
121 return;
122 shadertype = precisiontype = 0;
123#endif
124}
125
126void
127_evgl_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
128{
129#ifdef GL_GLES
130 glShaderBinary(n, shaders, binaryformat, binary, length);
131#else
132 // FIXME: need to dlsym/getprocaddress for this
133 ERR("Binary Shader is not supported here yet.");
134 return;
135 n = binaryformat = length = 0;
136 shaders = binary = 0;
137#endif
138}
139
140void
141_evgl_glReleaseShaderCompiler(void)
142{
143#ifdef GL_GLES
144 glReleaseShaderCompiler();
145#else
146#endif
147}
148
149
150//-------------------------------------------------------------//
151// Calls related to Evas GL Direct Rendering
152//-------------------------------------------------------------//
153// Transform from Evas Coordinat to GL Coordinate
154// returns: oc[4] original image object dimension in gl coord
155// returns: nc[4] tranformed (x, y, width, heigth) in gl coord
156static void
157compute_gl_coordinates(Evas_Object *obj, int rot, int clip,
158 int x, int y, int width, int height,
159 int imgc[4], int objc[4])
160{
161 if (rot == 0)
162 {
163 // oringinal image object coordinate in gl coordinate
164 imgc[0] = obj->cur.geometry.x;
165 imgc[1] = obj->layer->evas->output.h - obj->cur.geometry.y - obj->cur.geometry.h;
166 imgc[2] = imgc[0] + obj->cur.geometry.w;
167 imgc[3] = imgc[1] + obj->cur.geometry.h;
168
169 // transformed (x,y,width,height) in gl coordinate
170 objc[0] = imgc[0] + x;
171 objc[1] = imgc[1] + y;
172 objc[2] = objc[0] + width;
173 objc[3] = objc[1] + height;
174 }
175 else if (rot == 180)
176 {
177 // oringinal image object coordinate in gl coordinate
178 imgc[0] = obj->layer->evas->output.w - obj->cur.geometry.x - obj->cur.geometry.w;
179 imgc[1] = obj->cur.geometry.y;
180 imgc[2] = imgc[0] + obj->cur.geometry.w;
181 imgc[3] = imgc[1] + obj->cur.geometry.h;
182
183 // transformed (x,y,width,height) in gl coordinate
184 objc[0] = imgc[0] + obj->cur.geometry.w - x - width;
185 objc[1] = imgc[1] + obj->cur.geometry.h - y - height;
186 objc[2] = objc[0] + width;
187 objc[3] = objc[1] + height;
188
189 }
190 else if (rot == 90)
191 {
192 // oringinal image object coordinate in gl coordinate
193 imgc[0] = obj->cur.geometry.y;
194 imgc[1] = obj->cur.geometry.x;
195 imgc[2] = imgc[0] + obj->cur.geometry.h;
196 imgc[3] = imgc[1] + obj->cur.geometry.w;
197
198 // transformed (x,y,width,height) in gl coordinate
199 objc[0] = imgc[0] + obj->cur.geometry.h - y - height;
200 objc[1] = imgc[1] + x;
201 objc[2] = objc[0] + height;
202 objc[3] = objc[1] + width;
203 }
204 else if (rot == 270)
205 {
206 // oringinal image object coordinate in gl coordinate
207 imgc[0] = obj->layer->evas->output.h - obj->cur.geometry.y - obj->cur.geometry.h;
208 imgc[1] = obj->layer->evas->output.w - obj->cur.geometry.x - obj->cur.geometry.w;
209 imgc[2] = imgc[0] + obj->cur.geometry.h;
210 imgc[3] = imgc[1] + obj->cur.geometry.w;
211
212 // transformed (x,y,width,height) in gl coordinate
213 objc[0] = imgc[0] + y;
214 objc[1] = imgc[1] + obj->cur.geometry.w - x - width;
215 objc[2] = objc[0] + height;
216 objc[3] = objc[1] + width;
217 }
218 else
219 {
220 ERR("Invalid rotation angle %d.", rot);
221 return;
222 }
223
224 if (clip)
225 {
226 // Clip against original image object
227 if (objc[0] < imgc[0]) objc[0] = imgc[0];
228 if (objc[0] > imgc[2]) objc[0] = 0;
229
230 if (objc[1] < imgc[1]) objc[1] = imgc[1];
231 if (objc[1] > imgc[3]) objc[1] = 0;
232
233 if (objc[2] < imgc[0]) objc[0] = 0;
234 if (objc[2] > imgc[2]) objc[2] = imgc[2];
235
236 if (objc[3] < imgc[1]) objc[1] = 0;
237 if (objc[3] > imgc[3]) objc[3] = imgc[3];
238 }
239
240 imgc[2] = imgc[2]-imgc[0]; // width
241 imgc[3] = imgc[3]-imgc[1]; // height
242
243 objc[2] = objc[2]-objc[0]; // width
244 objc[3] = objc[3]-objc[1]; // height
245}
246
247static void
248_evgl_glClear(GLbitfield mask)
249{
250 EVGL_Engine *ee = evgl_engine;
251 EVGL_Resource *rsc;
252 EVGL_Context *ctx;
253 Evas_Object *img;
254 int rot = 0;
255 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
256
257 if (!(rsc=_evgl_tls_resource_get(ee)))
258 {
259 ERR("Unable to execute GL command. Error retrieving tls");
260 return;
261 }
262
263 ctx = rsc->current_ctx;
264 if (!ctx)
265 {
266 ERR("Unable to retrive Current Context");
267 return;
268 }
269
270 if (evgl_direct_enabled(evgl_engine))
271 {
272 if (!(rsc->current_ctx->current_fbo))
273 {
274 if ((!ctx->direct_scissor))
275 {
276 glEnable(GL_SCISSOR_TEST);
277 ctx->direct_scissor = 1;
278 }
279
280 img = rsc->direct_img_obj;
281 rot = ee->funcs->rotation_angle_get(ee->engine_data);
282
283 compute_gl_coordinates(img, rot, 0, 0, 0, 0, 0, oc, nc);
284
285 if ((ctx->scissor_upated) && (ctx->scissor_enabled))
286 {
287 glScissor(ctx->scissor_coord[0], ctx->scissor_coord[1],
288 ctx->scissor_coord[2], ctx->scissor_coord[3]);
289 ctx->direct_scissor = 0;
290 }
291 else
292 glScissor(oc[0], oc[1], oc[2], oc[3]);
293
294 glClear(mask);
295 }
296 else
297 {
298 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
299 {
300 glDisable(GL_SCISSOR_TEST);
301 ctx->direct_scissor = 0;
302 }
303
304 glClear(mask);
305 }
306 }
307 else
308 {
309 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
310 {
311 glDisable(GL_SCISSOR_TEST);
312 ctx->direct_scissor = 0;
313 }
314
315 glClear(mask);
316 }
317}
318
319static void
320_evgl_glEnable(GLenum cap)
321{
322 EVGL_Context *ctx;
323
324 ctx = _evgl_current_context_get();
325
326 if (cap == GL_SCISSOR_TEST)
327 if (ctx) ctx->scissor_enabled = 1;
328 glEnable(cap);
329}
330
331static void
332_evgl_glDisable(GLenum cap)
333{
334 EVGL_Context *ctx;
335
336 ctx = _evgl_current_context_get();
337
338 if (cap == GL_SCISSOR_TEST)
339 if (ctx) ctx->scissor_enabled = 0;
340 glDisable(cap);
341}
342
343
344static void
345_evgl_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
346{
347 EVGL_Engine *ee = evgl_engine;
348 EVGL_Resource *rsc;
349 EVGL_Context *ctx;
350 Evas_Object *img;
351 int rot = 0;
352 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
353
354 if (!(rsc=_evgl_tls_resource_get(ee)))
355 {
356 ERR("Unable to execute GL command. Error retrieving tls");
357 return;
358 }
359
360 ctx = rsc->current_ctx;
361 if (!ctx)
362 {
363 ERR("Unable to retrive Current Context");
364 return;
365 }
366
367 if (evgl_direct_enabled(evgl_engine))
368 {
369
370 if (!(rsc->current_ctx->current_fbo))
371 {
372 img = rsc->direct_img_obj;
373 rot = ee->funcs->rotation_angle_get(ee->engine_data);
374
375 compute_gl_coordinates(img, rot, 1, x, y, width, height, oc, nc);
376 glReadPixels(nc[0], nc[1], nc[2], nc[3], format, type, pixels);
377 }
378 else
379 {
380 glReadPixels(x, y, width, height, format, type, pixels);
381 }
382 }
383 else
384 {
385 glReadPixels(x, y, width, height, format, type, pixels);
386 }
387}
388
389static void
390_evgl_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
391{
392 EVGL_Engine *ee = evgl_engine;
393 EVGL_Resource *rsc;
394 EVGL_Context *ctx;
395 Evas_Object *img;
396 int rot = 0;
397 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
398
399 if (!(rsc=_evgl_tls_resource_get(ee)))
400 {
401 ERR("Unable to execute GL command. Error retrieving tls");
402 return;
403 }
404
405 ctx = rsc->current_ctx;
406 if (!ctx)
407 {
408 ERR("Unable to retrive Current Context");
409 return;
410 }
411
412 if (evgl_direct_enabled(evgl_engine))
413 {
414 if (!(rsc->current_ctx->current_fbo))
415 {
416 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
417 {
418 glDisable(GL_SCISSOR_TEST);
419 }
420
421 img = rsc->direct_img_obj;
422 rot = ee->funcs->rotation_angle_get(ee->engine_data);
423
424 compute_gl_coordinates(img, rot, 1, x, y, width, height, oc, nc);
425 glScissor(nc[0], nc[1], nc[2], nc[3]);
426
427 // Update coordinates
428 ctx->scissor_coord[0] = nc[0];
429 ctx->scissor_coord[1] = nc[1];
430 ctx->scissor_coord[2] = nc[2];
431 ctx->scissor_coord[3] = nc[3];
432
433 ctx->direct_scissor = 0;
434
435 // Check....!!!!
436 ctx->scissor_upated = 1;
437 }
438 else
439 {
440 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
441 {
442 glDisable(GL_SCISSOR_TEST);
443 ctx->direct_scissor = 0;
444 }
445
446 glScissor(x, y, width, height);
447
448 ctx->scissor_upated = 0;
449 }
450 }
451 else
452 {
453 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
454 {
455 glDisable(GL_SCISSOR_TEST);
456 ctx->direct_scissor = 0;
457 }
458
459 glScissor(x, y, width, height);
460 }
461}
462
463static void
464_evgl_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
465{
466 EVGL_Engine *ee = evgl_engine;
467 EVGL_Resource *rsc;
468 EVGL_Context *ctx;
469 Evas_Object *img;
470 int rot = 0;
471 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
472
473 if (!(rsc=_evgl_tls_resource_get(ee)))
474 {
475 ERR("Unable to execute GL command. Error retrieving tls");
476 return;
477 }
478
479 ctx = rsc->current_ctx;
480 if (!ctx)
481 {
482 ERR("Unable to retrive Current Context");
483 return;
484 }
485
486 if (evgl_direct_enabled(evgl_engine))
487 {
488 if (!(rsc->current_ctx->current_fbo))
489 {
490 if ((!ctx->direct_scissor))
491 {
492 glEnable(GL_SCISSOR_TEST);
493 ctx->direct_scissor = 1;
494 }
495
496 img = rsc->direct_img_obj;
497 rot = ee->funcs->rotation_angle_get(ee->engine_data);
498
499 compute_gl_coordinates(img, rot, 0, x, y, width, height, oc, nc);
500
501 if ((ctx->scissor_upated) && (ctx->scissor_enabled))
502 {
503 glScissor(ctx->scissor_coord[0], ctx->scissor_coord[1],
504 ctx->scissor_coord[2], ctx->scissor_coord[3]);
505 ctx->direct_scissor = 0;
506 }
507 else
508 glScissor(oc[0], oc[1], oc[2], oc[3]);
509
510 glViewport(nc[0], nc[1], nc[2], nc[3]);
511 }
512 else
513 {
514 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
515 {
516 glDisable(GL_SCISSOR_TEST);
517 ctx->direct_scissor = 0;
518 }
519
520 glViewport(x, y, width, height);
521 }
522 }
523 else
524 {
525 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
526 {
527 glDisable(GL_SCISSOR_TEST);
528 ctx->direct_scissor = 0;
529 }
530
531 glViewport(x, y, width, height);
532 }
533}
534//-------------------------------------------------------------//
535
536
537
538//-------------------------------------------------------------//
539// Debug Evas GL APIs
540// - GL APIs Overriden for debugging purposes
541//-------------------------------------------------------------//
542
543void
544_evgld_glActiveTexture(GLenum texture)
10{ 545{
11 EVGL_FUNC_BEGIN(); 546 EVGL_FUNC_BEGIN();
12 glActiveTexture(texture); 547 glActiveTexture(texture);
@@ -18,7 +553,7 @@ finish:
18} 553}
19 554
20void 555void
21evgl_glAttachShader(GLuint program, GLuint shader) 556_evgld_glAttachShader(GLuint program, GLuint shader)
22{ 557{
23 EVGL_FUNC_BEGIN(); 558 EVGL_FUNC_BEGIN();
24 glAttachShader(program, shader); 559 glAttachShader(program, shader);
@@ -30,7 +565,7 @@ finish:
30} 565}
31 566
32void 567void
33evgl_glBindAttribLocation(GLuint program, GLuint index, const char* name) 568_evgld_glBindAttribLocation(GLuint program, GLuint index, const char* name)
34{ 569{
35 EVGL_FUNC_BEGIN(); 570 EVGL_FUNC_BEGIN();
36 glBindAttribLocation(program, index, name); 571 glBindAttribLocation(program, index, name);
@@ -42,7 +577,7 @@ finish:
42} 577}
43 578
44void 579void
45evgl_glBindBuffer(GLenum target, GLuint buffer) 580_evgld_glBindBuffer(GLenum target, GLuint buffer)
46{ 581{
47 EVGL_FUNC_BEGIN(); 582 EVGL_FUNC_BEGIN();
48 glBindBuffer(target, buffer); 583 glBindBuffer(target, buffer);
@@ -54,38 +589,13 @@ finish:
54} 589}
55 590
56void 591void
57evgl_glBindFramebuffer(GLenum target, GLuint framebuffer) 592_evgld_glBindFramebuffer(GLenum target, GLuint framebuffer)
58{ 593{
59 EVGL_Context *ctx = NULL;
60
61 EVGL_FUNC_BEGIN(); 594 EVGL_FUNC_BEGIN();
62 595
63 ctx = _evgl_current_context_get(); 596 _evgl_glBindFramebuffer(target, framebuffer);
64
65 if (!ctx)
66 {
67 ERR("No current context set.");
68 return;
69 }
70
71 // Take care of BindFramebuffer 0 issue
72 if (framebuffer==0)
73 {
74 if (evgl_direct_enabled(evgl_engine))
75 glBindFramebuffer(target, 0);
76 else
77 glBindFramebuffer(target, ctx->surface_fbo);
78 ctx->current_fbo = 0;
79 }
80 else
81 {
82 glBindFramebuffer(target, framebuffer);
83
84 // Save this for restore when doing make current
85 ctx->current_fbo = framebuffer;
86 }
87
88 GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 597 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
598
89 goto finish; 599 goto finish;
90 600
91finish: 601finish:
@@ -93,12 +603,11 @@ finish:
93} 603}
94 604
95void 605void
96evgl_glBindRenderbuffer(GLenum target, GLuint renderbuffer) 606_evgld_glBindRenderbuffer(GLenum target, GLuint renderbuffer)
97{ 607{
98 EVGL_FUNC_BEGIN(); 608 EVGL_FUNC_BEGIN();
99 glBindRenderbuffer(target, renderbuffer); 609 glBindRenderbuffer(target, renderbuffer);
100 GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 610 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
101
102 goto finish; 611 goto finish;
103 612
104finish: 613finish:
@@ -106,7 +615,7 @@ finish:
106} 615}
107 616
108void 617void
109evgl_glBindTexture(GLenum target, GLuint texture) 618_evgld_glBindTexture(GLenum target, GLuint texture)
110{ 619{
111 EVGL_FUNC_BEGIN(); 620 EVGL_FUNC_BEGIN();
112 glBindTexture(target, texture); 621 glBindTexture(target, texture);
@@ -118,7 +627,7 @@ finish:
118} 627}
119 628
120void 629void
121evgl_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) 630_evgld_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
122{ 631{
123 EVGL_FUNC_BEGIN(); 632 EVGL_FUNC_BEGIN();
124 glBlendColor(red, green, blue, alpha); 633 glBlendColor(red, green, blue, alpha);
@@ -130,7 +639,7 @@ finish:
130} 639}
131 640
132void 641void
133evgl_glBlendEquation(GLenum mode) 642_evgld_glBlendEquation(GLenum mode)
134{ 643{
135 EVGL_FUNC_BEGIN(); 644 EVGL_FUNC_BEGIN();
136 glBlendEquation(mode); 645 glBlendEquation(mode);
@@ -142,7 +651,7 @@ finish:
142} 651}
143 652
144void 653void
145evgl_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) 654_evgld_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
146{ 655{
147 EVGL_FUNC_BEGIN(); 656 EVGL_FUNC_BEGIN();
148 glBlendEquationSeparate(modeRGB, modeAlpha); 657 glBlendEquationSeparate(modeRGB, modeAlpha);
@@ -154,7 +663,7 @@ finish:
154} 663}
155 664
156void 665void
157evgl_glBlendFunc(GLenum sfactor, GLenum dfactor) 666_evgld_glBlendFunc(GLenum sfactor, GLenum dfactor)
158{ 667{
159 EVGL_FUNC_BEGIN(); 668 EVGL_FUNC_BEGIN();
160 glBlendFunc(sfactor, dfactor); 669 glBlendFunc(sfactor, dfactor);
@@ -166,7 +675,7 @@ finish:
166} 675}
167 676
168void 677void
169evgl_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) 678_evgld_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
170{ 679{
171 EVGL_FUNC_BEGIN(); 680 EVGL_FUNC_BEGIN();
172 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); 681 glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
@@ -178,7 +687,7 @@ finish:
178} 687}
179 688
180void 689void
181evgl_glBufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage) 690_evgld_glBufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage)
182{ 691{
183 EVGL_FUNC_BEGIN(); 692 EVGL_FUNC_BEGIN();
184 glBufferData(target, size, data, usage); 693 glBufferData(target, size, data, usage);
@@ -190,7 +699,7 @@ finish:
190} 699}
191 700
192void 701void
193evgl_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data) 702_evgld_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data)
194{ 703{
195 EVGL_FUNC_BEGIN(); 704 EVGL_FUNC_BEGIN();
196 glBufferSubData(target, offset, size, data); 705 glBufferSubData(target, offset, size, data);
@@ -202,7 +711,7 @@ finish:
202} 711}
203 712
204GLenum 713GLenum
205evgl_glCheckFramebufferStatus(GLenum target) 714_evgld_glCheckFramebufferStatus(GLenum target)
206{ 715{
207 GLenum ret = GL_NONE; 716 GLenum ret = GL_NONE;
208 717
@@ -216,22 +725,8 @@ finish:
216 return ret; 725 return ret;
217} 726}
218 727
219#ifdef NO_DIRECT_RENDERING
220void
221evgl_glClear(GLbitfield mask)
222{
223 EVGL_FUNC_BEGIN();
224 glClear(mask);
225 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
226 goto finish;
227
228finish:
229 EVGL_FUNC_END();
230}
231#endif
232
233void 728void
234evgl_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) 729_evgld_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
235{ 730{
236 EVGL_FUNC_BEGIN(); 731 EVGL_FUNC_BEGIN();
237 glClearColor(red, green, blue, alpha); 732 glClearColor(red, green, blue, alpha);
@@ -243,17 +738,13 @@ finish:
243} 738}
244 739
245void 740void
246evgl_glClearDepthf(GLclampf depth) 741_evgld_glClearDepthf(GLclampf depth)
247{ 742{
248 EVGL_FUNC_BEGIN(); 743 EVGL_FUNC_BEGIN();
249 744
250#ifdef GL_GLES 745 _evgl_glClearDepthf(depth);
251 glClearDepthf(depth);
252#else
253 glClearDepth(depth);
254#endif
255
256 GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 746 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
747
257 goto finish; 748 goto finish;
258 749
259finish: 750finish:
@@ -261,7 +752,7 @@ finish:
261} 752}
262 753
263void 754void
264evgl_glClearStencil(GLint s) 755_evgld_glClearStencil(GLint s)
265{ 756{
266 EVGL_FUNC_BEGIN(); 757 EVGL_FUNC_BEGIN();
267 glClearStencil(s); 758 glClearStencil(s);
@@ -273,7 +764,7 @@ finish:
273} 764}
274 765
275void 766void
276evgl_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) 767_evgld_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
277{ 768{
278 EVGL_FUNC_BEGIN(); 769 EVGL_FUNC_BEGIN();
279 glColorMask(red, green, blue, alpha); 770 glColorMask(red, green, blue, alpha);
@@ -285,7 +776,7 @@ finish:
285} 776}
286 777
287void 778void
288evgl_glCompileShader(GLuint shader) 779_evgld_glCompileShader(GLuint shader)
289{ 780{
290 EVGL_FUNC_BEGIN(); 781 EVGL_FUNC_BEGIN();
291 glCompileShader(shader); 782 glCompileShader(shader);
@@ -297,7 +788,7 @@ finish:
297} 788}
298 789
299void 790void
300evgl_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) 791_evgld_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
301{ 792{
302 EVGL_FUNC_BEGIN(); 793 EVGL_FUNC_BEGIN();
303 glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); 794 glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
@@ -309,7 +800,7 @@ finish:
309} 800}
310 801
311void 802void
312evgl_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data) 803_evgld_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
313{ 804{
314 EVGL_FUNC_BEGIN(); 805 EVGL_FUNC_BEGIN();
315 glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); 806 glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
@@ -321,7 +812,7 @@ finish:
321} 812}
322 813
323void 814void
324evgl_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) 815_evgld_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
325{ 816{
326 EVGL_FUNC_BEGIN(); 817 EVGL_FUNC_BEGIN();
327 glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); 818 glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
@@ -333,7 +824,7 @@ finish:
333} 824}
334 825
335void 826void
336evgl_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) 827_evgld_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
337{ 828{
338 EVGL_FUNC_BEGIN(); 829 EVGL_FUNC_BEGIN();
339 glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); 830 glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
@@ -345,7 +836,7 @@ finish:
345} 836}
346 837
347GLuint 838GLuint
348evgl_glCreateProgram(void) 839_evgld_glCreateProgram(void)
349{ 840{
350 GLuint ret = _EVGL_INT_INIT_VALUE; 841 GLuint ret = _EVGL_INT_INIT_VALUE;
351 842
@@ -360,7 +851,7 @@ finish:
360} 851}
361 852
362GLuint 853GLuint
363evgl_glCreateShader(GLenum type) 854_evgld_glCreateShader(GLenum type)
364{ 855{
365 GLuint ret = _EVGL_INT_INIT_VALUE; 856 GLuint ret = _EVGL_INT_INIT_VALUE;
366 EVGL_FUNC_BEGIN(); 857 EVGL_FUNC_BEGIN();
@@ -374,7 +865,7 @@ finish:
374} 865}
375 866
376void 867void
377evgl_glCullFace(GLenum mode) 868_evgld_glCullFace(GLenum mode)
378{ 869{
379 EVGL_FUNC_BEGIN(); 870 EVGL_FUNC_BEGIN();
380 glCullFace(mode); 871 glCullFace(mode);
@@ -386,7 +877,7 @@ finish:
386} 877}
387 878
388void 879void
389evgl_glDeleteBuffers(GLsizei n, const GLuint* buffers) 880_evgld_glDeleteBuffers(GLsizei n, const GLuint* buffers)
390{ 881{
391 EVGL_FUNC_BEGIN(); 882 EVGL_FUNC_BEGIN();
392 glDeleteBuffers(n, buffers); 883 glDeleteBuffers(n, buffers);
@@ -398,7 +889,7 @@ finish:
398} 889}
399 890
400void 891void
401evgl_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) 892_evgld_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
402{ 893{
403 EVGL_FUNC_BEGIN(); 894 EVGL_FUNC_BEGIN();
404 glDeleteFramebuffers(n, framebuffers); 895 glDeleteFramebuffers(n, framebuffers);
@@ -410,7 +901,7 @@ finish:
410} 901}
411 902
412void 903void
413evgl_glDeleteProgram(GLuint program) 904_evgld_glDeleteProgram(GLuint program)
414{ 905{
415 EVGL_FUNC_BEGIN(); 906 EVGL_FUNC_BEGIN();
416 glDeleteProgram(program); 907 glDeleteProgram(program);
@@ -422,7 +913,7 @@ finish:
422} 913}
423 914
424void 915void
425evgl_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) 916_evgld_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
426{ 917{
427 EVGL_FUNC_BEGIN(); 918 EVGL_FUNC_BEGIN();
428 glDeleteRenderbuffers(n, renderbuffers); 919 glDeleteRenderbuffers(n, renderbuffers);
@@ -434,7 +925,7 @@ finish:
434} 925}
435 926
436void 927void
437evgl_glDeleteShader(GLuint shader) 928_evgld_glDeleteShader(GLuint shader)
438{ 929{
439 EVGL_FUNC_BEGIN(); 930 EVGL_FUNC_BEGIN();
440 glDeleteShader(shader); 931 glDeleteShader(shader);
@@ -446,7 +937,7 @@ finish:
446} 937}
447 938
448void 939void
449evgl_glDeleteTextures(GLsizei n, const GLuint* textures) 940_evgld_glDeleteTextures(GLsizei n, const GLuint* textures)
450{ 941{
451 EVGL_FUNC_BEGIN(); 942 EVGL_FUNC_BEGIN();
452 glDeleteTextures(n, textures); 943 glDeleteTextures(n, textures);
@@ -458,7 +949,7 @@ finish:
458} 949}
459 950
460void 951void
461evgl_glDepthFunc(GLenum func) 952_evgld_glDepthFunc(GLenum func)
462{ 953{
463 EVGL_FUNC_BEGIN(); 954 EVGL_FUNC_BEGIN();
464 glDepthFunc(func); 955 glDepthFunc(func);
@@ -470,7 +961,7 @@ finish:
470} 961}
471 962
472void 963void
473evgl_glDepthMask(GLboolean flag) 964_evgld_glDepthMask(GLboolean flag)
474{ 965{
475 EVGL_FUNC_BEGIN(); 966 EVGL_FUNC_BEGIN();
476 glDepthMask(flag); 967 glDepthMask(flag);
@@ -482,51 +973,33 @@ finish:
482} 973}
483 974
484void 975void
485evgl_glDepthRangef(GLclampf zNear, GLclampf zFar) 976_evgld_glDepthRangef(GLclampf zNear, GLclampf zFar)
486{ 977{
487 EVGL_FUNC_BEGIN(); 978 EVGL_FUNC_BEGIN();
488 979
489#ifdef GL_GLES 980 _evgl_glDepthRangef(zNear, zFar);
490 glDepthRangef(zNear, zFar);
491#else
492 glDepthRange(zNear, zFar);
493#endif
494
495 GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 981 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
496 goto finish;
497
498finish:
499 EVGL_FUNC_END();
500}
501 982
502void
503evgl_glDetachShader(GLuint program, GLuint shader)
504{
505 EVGL_FUNC_BEGIN();
506 glDetachShader(program, shader);
507 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
508 goto finish; 983 goto finish;
509 984
510finish: 985finish:
511 EVGL_FUNC_END(); 986 EVGL_FUNC_END();
512} 987}
513 988
514#ifdef NO_DIRECT_RENDERING
515void 989void
516evgl_glDisable(GLenum cap) 990_evgld_glDetachShader(GLuint program, GLuint shader)
517{ 991{
518 EVGL_FUNC_BEGIN(); 992 EVGL_FUNC_BEGIN();
519 glDisable(cap); 993 glDetachShader(program, shader);
520 GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 994 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
521 goto finish; 995 goto finish;
522 996
523finish: 997finish:
524 EVGL_FUNC_END(); 998 EVGL_FUNC_END();
525} 999}
526#endif
527 1000
528void 1001void
529evgl_glDisableVertexAttribArray(GLuint index) 1002_evgld_glDisableVertexAttribArray(GLuint index)
530{ 1003{
531 EVGL_FUNC_BEGIN(); 1004 EVGL_FUNC_BEGIN();
532 glDisableVertexAttribArray(index); 1005 glDisableVertexAttribArray(index);
@@ -538,7 +1011,7 @@ finish:
538} 1011}
539 1012
540void 1013void
541evgl_glDrawArrays(GLenum mode, GLint first, GLsizei count) 1014_evgld_glDrawArrays(GLenum mode, GLint first, GLsizei count)
542{ 1015{
543 EVGL_FUNC_BEGIN(); 1016 EVGL_FUNC_BEGIN();
544 glDrawArrays(mode, first, count); 1017 glDrawArrays(mode, first, count);
@@ -550,7 +1023,7 @@ finish:
550} 1023}
551 1024
552void 1025void
553evgl_glDrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices) 1026_evgld_glDrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices)
554{ 1027{
555 EVGL_FUNC_BEGIN(); 1028 EVGL_FUNC_BEGIN();
556 glDrawElements(mode, count, type, indices); 1029 glDrawElements(mode, count, type, indices);
@@ -561,22 +1034,8 @@ finish:
561 EVGL_FUNC_END(); 1034 EVGL_FUNC_END();
562} 1035}
563 1036
564#ifdef NO_DIRECT_RENDERING
565void
566evgl_glEnable(GLenum cap)
567{
568 EVGL_FUNC_BEGIN();
569 glEnable(cap);
570 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
571 goto finish;
572
573finish:
574 EVGL_FUNC_END();
575}
576#endif
577
578void 1037void
579evgl_glEnableVertexAttribArray(GLuint index) 1038_evgld_glEnableVertexAttribArray(GLuint index)
580{ 1039{
581 EVGL_FUNC_BEGIN(); 1040 EVGL_FUNC_BEGIN();
582 glEnableVertexAttribArray(index); 1041 glEnableVertexAttribArray(index);
@@ -588,7 +1047,7 @@ finish:
588} 1047}
589 1048
590void 1049void
591evgl_glFinish(void) 1050_evgld_glFinish(void)
592{ 1051{
593 EVGL_FUNC_BEGIN(); 1052 EVGL_FUNC_BEGIN();
594 glFinish(); 1053 glFinish();
@@ -600,7 +1059,7 @@ finish:
600} 1059}
601 1060
602void 1061void
603evgl_glFlush(void) 1062_evgld_glFlush(void)
604{ 1063{
605 EVGL_FUNC_BEGIN(); 1064 EVGL_FUNC_BEGIN();
606 glFlush(); 1065 glFlush();
@@ -612,7 +1071,7 @@ finish:
612} 1071}
613 1072
614void 1073void
615evgl_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) 1074_evgld_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
616{ 1075{
617 EVGL_FUNC_BEGIN(); 1076 EVGL_FUNC_BEGIN();
618 glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); 1077 glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
@@ -624,7 +1083,7 @@ finish:
624} 1083}
625 1084
626void 1085void
627evgl_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) 1086_evgld_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
628{ 1087{
629 EVGL_FUNC_BEGIN(); 1088 EVGL_FUNC_BEGIN();
630 glFramebufferTexture2D(target, attachment, textarget, texture, level); 1089 glFramebufferTexture2D(target, attachment, textarget, texture, level);
@@ -636,7 +1095,7 @@ finish:
636} 1095}
637 1096
638void 1097void
639evgl_glFrontFace(GLenum mode) 1098_evgld_glFrontFace(GLenum mode)
640{ 1099{
641 EVGL_FUNC_BEGIN(); 1100 EVGL_FUNC_BEGIN();
642 glFrontFace(mode); 1101 glFrontFace(mode);
@@ -648,7 +1107,7 @@ finish:
648} 1107}
649 1108
650void 1109void
651evgl_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) 1110_evgld_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
652{ 1111{
653 EVGL_FUNC_BEGIN(); 1112 EVGL_FUNC_BEGIN();
654 glGetVertexAttribfv(index, pname, params); 1113 glGetVertexAttribfv(index, pname, params);
@@ -661,7 +1120,7 @@ finish:
661} 1120}
662 1121
663void 1122void
664evgl_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) 1123_evgld_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
665{ 1124{
666 EVGL_FUNC_BEGIN(); 1125 EVGL_FUNC_BEGIN();
667 glGetVertexAttribiv(index, pname, params); 1126 glGetVertexAttribiv(index, pname, params);
@@ -674,7 +1133,7 @@ finish:
674} 1133}
675 1134
676void 1135void
677evgl_glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer) 1136_evgld_glGetVertexAttribPointerv(GLuint index, GLenum pname, void** pointer)
678{ 1137{
679 EVGL_FUNC_BEGIN(); 1138 EVGL_FUNC_BEGIN();
680 glGetVertexAttribPointerv(index, pname, pointer); 1139 glGetVertexAttribPointerv(index, pname, pointer);
@@ -688,7 +1147,7 @@ finish:
688} 1147}
689 1148
690void 1149void
691evgl_glHint(GLenum target, GLenum mode) 1150_evgld_glHint(GLenum target, GLenum mode)
692{ 1151{
693 EVGL_FUNC_BEGIN(); 1152 EVGL_FUNC_BEGIN();
694 glHint(target, mode); 1153 glHint(target, mode);
@@ -700,7 +1159,7 @@ finish:
700} 1159}
701 1160
702void 1161void
703evgl_glGenBuffers(GLsizei n, GLuint* buffers) 1162_evgld_glGenBuffers(GLsizei n, GLuint* buffers)
704{ 1163{
705 EVGL_FUNC_BEGIN(); 1164 EVGL_FUNC_BEGIN();
706 glGenBuffers(n, buffers); 1165 glGenBuffers(n, buffers);
@@ -712,7 +1171,7 @@ finish:
712} 1171}
713 1172
714void 1173void
715evgl_glGenerateMipmap(GLenum target) 1174_evgld_glGenerateMipmap(GLenum target)
716{ 1175{
717 EVGL_FUNC_BEGIN(); 1176 EVGL_FUNC_BEGIN();
718 glGenerateMipmap(target); 1177 glGenerateMipmap(target);
@@ -724,7 +1183,7 @@ finish:
724} 1183}
725 1184
726void 1185void
727evgl_glGenFramebuffers(GLsizei n, GLuint* framebuffers) 1186_evgld_glGenFramebuffers(GLsizei n, GLuint* framebuffers)
728{ 1187{
729 EVGL_FUNC_BEGIN(); 1188 EVGL_FUNC_BEGIN();
730 glGenFramebuffers(n, framebuffers); 1189 glGenFramebuffers(n, framebuffers);
@@ -736,7 +1195,7 @@ finish:
736} 1195}
737 1196
738void 1197void
739evgl_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) 1198_evgld_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
740{ 1199{
741 EVGL_FUNC_BEGIN(); 1200 EVGL_FUNC_BEGIN();
742 glGenRenderbuffers(n, renderbuffers); 1201 glGenRenderbuffers(n, renderbuffers);
@@ -748,7 +1207,7 @@ finish:
748} 1207}
749 1208
750void 1209void
751evgl_glGenTextures(GLsizei n, GLuint* textures) 1210_evgld_glGenTextures(GLsizei n, GLuint* textures)
752{ 1211{
753 EVGL_FUNC_BEGIN(); 1212 EVGL_FUNC_BEGIN();
754 glGenTextures(n, textures); 1213 glGenTextures(n, textures);
@@ -760,7 +1219,7 @@ finish:
760} 1219}
761 1220
762void 1221void
763evgl_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) 1222_evgld_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
764{ 1223{
765 EVGL_FUNC_BEGIN(); 1224 EVGL_FUNC_BEGIN();
766 glGetActiveAttrib(program, index, bufsize, length, size, type, name); 1225 glGetActiveAttrib(program, index, bufsize, length, size, type, name);
@@ -772,7 +1231,7 @@ finish:
772} 1231}
773 1232
774void 1233void
775evgl_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name) 1234_evgld_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
776{ 1235{
777 EVGL_FUNC_BEGIN(); 1236 EVGL_FUNC_BEGIN();
778 glGetActiveUniform(program, index, bufsize, length, size, type, name); 1237 glGetActiveUniform(program, index, bufsize, length, size, type, name);
@@ -784,7 +1243,7 @@ finish:
784} 1243}
785 1244
786void 1245void
787evgl_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) 1246_evgld_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
788{ 1247{
789 EVGL_FUNC_BEGIN(); 1248 EVGL_FUNC_BEGIN();
790 glGetAttachedShaders(program, maxcount, count, shaders); 1249 glGetAttachedShaders(program, maxcount, count, shaders);
@@ -796,7 +1255,7 @@ finish:
796} 1255}
797 1256
798int 1257int
799evgl_glGetAttribLocation(GLuint program, const char* name) 1258_evgld_glGetAttribLocation(GLuint program, const char* name)
800{ 1259{
801 int ret = _EVGL_INT_INIT_VALUE; 1260 int ret = _EVGL_INT_INIT_VALUE;
802 EVGL_FUNC_BEGIN(); 1261 EVGL_FUNC_BEGIN();
@@ -810,7 +1269,7 @@ finish:
810} 1269}
811 1270
812void 1271void
813evgl_glGetBooleanv(GLenum pname, GLboolean* params) 1272_evgld_glGetBooleanv(GLenum pname, GLboolean* params)
814{ 1273{
815 EVGL_FUNC_BEGIN(); 1274 EVGL_FUNC_BEGIN();
816 glGetBooleanv(pname, params); 1275 glGetBooleanv(pname, params);
@@ -822,7 +1281,7 @@ finish:
822} 1281}
823 1282
824void 1283void
825evgl_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) 1284_evgld_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
826{ 1285{
827 EVGL_FUNC_BEGIN(); 1286 EVGL_FUNC_BEGIN();
828 glGetBufferParameteriv(target, pname, params); 1287 glGetBufferParameteriv(target, pname, params);
@@ -834,7 +1293,7 @@ finish:
834} 1293}
835 1294
836GLenum 1295GLenum
837evgl_glGetError(void) 1296_evgld_glGetError(void)
838{ 1297{
839 GLenum ret = GL_NONE; 1298 GLenum ret = GL_NONE;
840 1299
@@ -848,7 +1307,7 @@ finish:
848} 1307}
849 1308
850void 1309void
851evgl_glGetFloatv(GLenum pname, GLfloat* params) 1310_evgld_glGetFloatv(GLenum pname, GLfloat* params)
852{ 1311{
853 EVGL_FUNC_BEGIN(); 1312 EVGL_FUNC_BEGIN();
854 glGetFloatv(pname, params); 1313 glGetFloatv(pname, params);
@@ -860,7 +1319,7 @@ finish:
860} 1319}
861 1320
862void 1321void
863evgl_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) 1322_evgld_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
864{ 1323{
865 EVGL_FUNC_BEGIN(); 1324 EVGL_FUNC_BEGIN();
866 glGetFramebufferAttachmentParameteriv(target, attachment, pname, params); 1325 glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
@@ -872,7 +1331,7 @@ finish:
872} 1331}
873 1332
874void 1333void
875evgl_glGetIntegerv(GLenum pname, GLint* params) 1334_evgld_glGetIntegerv(GLenum pname, GLint* params)
876{ 1335{
877 EVGL_FUNC_BEGIN(); 1336 EVGL_FUNC_BEGIN();
878 glGetIntegerv(pname, params); 1337 glGetIntegerv(pname, params);
@@ -884,7 +1343,7 @@ finish:
884} 1343}
885 1344
886void 1345void
887evgl_glGetProgramiv(GLuint program, GLenum pname, GLint* params) 1346_evgld_glGetProgramiv(GLuint program, GLenum pname, GLint* params)
888{ 1347{
889 EVGL_FUNC_BEGIN(); 1348 EVGL_FUNC_BEGIN();
890 glGetProgramiv(program, pname, params); 1349 glGetProgramiv(program, pname, params);
@@ -896,7 +1355,7 @@ finish:
896} 1355}
897 1356
898void 1357void
899evgl_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog) 1358_evgld_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
900{ 1359{
901 EVGL_FUNC_BEGIN(); 1360 EVGL_FUNC_BEGIN();
902 glGetProgramInfoLog(program, bufsize, length, infolog); 1361 glGetProgramInfoLog(program, bufsize, length, infolog);
@@ -908,7 +1367,7 @@ finish:
908} 1367}
909 1368
910void 1369void
911evgl_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) 1370_evgld_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
912{ 1371{
913 EVGL_FUNC_BEGIN(); 1372 EVGL_FUNC_BEGIN();
914 glGetRenderbufferParameteriv(target, pname, params); 1373 glGetRenderbufferParameteriv(target, pname, params);
@@ -920,7 +1379,7 @@ finish:
920} 1379}
921 1380
922void 1381void
923evgl_glGetShaderiv(GLuint shader, GLenum pname, GLint* params) 1382_evgld_glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
924{ 1383{
925 EVGL_FUNC_BEGIN(); 1384 EVGL_FUNC_BEGIN();
926 glGetShaderiv(shader, pname, params); 1385 glGetShaderiv(shader, pname, params);
@@ -932,7 +1391,7 @@ finish:
932} 1391}
933 1392
934void 1393void
935evgl_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog) 1394_evgld_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
936{ 1395{
937 EVGL_FUNC_BEGIN(); 1396 EVGL_FUNC_BEGIN();
938 glGetShaderInfoLog(shader, bufsize, length, infolog); 1397 glGetShaderInfoLog(shader, bufsize, length, infolog);
@@ -944,27 +1403,13 @@ finish:
944} 1403}
945 1404
946void 1405void
947evgl_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) 1406_evgld_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
948{ 1407{
949 EVGL_FUNC_BEGIN(); 1408 EVGL_FUNC_BEGIN();
950 1409
951#ifdef GL_GLES 1410 _evgl_glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
952 glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
953#else
954 if (range)
955 {
956 range[0] = -126; // floor(log2(FLT_MIN))
957 range[1] = 127; // floor(log2(FLT_MAX))
958 }
959 if (precision)
960 {
961 precision[0] = 24; // floor(-log2((1.0/16777218.0)));
962 }
963 return;
964 shadertype = precisiontype = 0;
965#endif
966
967 GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 1411 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1412
968 goto finish; 1413 goto finish;
969 1414
970finish: 1415finish:
@@ -972,7 +1417,7 @@ finish:
972} 1417}
973 1418
974void 1419void
975evgl_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source) 1420_evgld_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
976{ 1421{
977 EVGL_FUNC_BEGIN(); 1422 EVGL_FUNC_BEGIN();
978 glGetShaderSource(shader, bufsize, length, source); 1423 glGetShaderSource(shader, bufsize, length, source);
@@ -984,7 +1429,7 @@ finish:
984} 1429}
985 1430
986const GLubyte * 1431const GLubyte *
987evgl_glGetString(GLenum name) 1432_evgld_glGetString(GLenum name)
988{ 1433{
989 const GLubyte *ret = NULL; 1434 const GLubyte *ret = NULL;
990 1435
@@ -1005,7 +1450,7 @@ finish:
1005} 1450}
1006 1451
1007void 1452void
1008evgl_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) 1453_evgld_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
1009{ 1454{
1010 EVGL_FUNC_BEGIN(); 1455 EVGL_FUNC_BEGIN();
1011 glGetTexParameterfv(target, pname, params); 1456 glGetTexParameterfv(target, pname, params);
@@ -1017,7 +1462,7 @@ finish:
1017} 1462}
1018 1463
1019void 1464void
1020evgl_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) 1465_evgld_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
1021{ 1466{
1022 EVGL_FUNC_BEGIN(); 1467 EVGL_FUNC_BEGIN();
1023 glGetTexParameteriv(target, pname, params); 1468 glGetTexParameteriv(target, pname, params);
@@ -1029,7 +1474,7 @@ finish:
1029} 1474}
1030 1475
1031void 1476void
1032evgl_glGetUniformfv(GLuint program, GLint location, GLfloat* params) 1477_evgld_glGetUniformfv(GLuint program, GLint location, GLfloat* params)
1033{ 1478{
1034 EVGL_FUNC_BEGIN(); 1479 EVGL_FUNC_BEGIN();
1035 glGetUniformfv(program, location, params); 1480 glGetUniformfv(program, location, params);
@@ -1041,7 +1486,7 @@ finish:
1041} 1486}
1042 1487
1043void 1488void
1044evgl_glGetUniformiv(GLuint program, GLint location, GLint* params) 1489_evgld_glGetUniformiv(GLuint program, GLint location, GLint* params)
1045{ 1490{
1046 EVGL_FUNC_BEGIN(); 1491 EVGL_FUNC_BEGIN();
1047 glGetUniformiv(program, location, params); 1492 glGetUniformiv(program, location, params);
@@ -1052,7 +1497,7 @@ finish:
1052 EVGL_FUNC_END(); 1497 EVGL_FUNC_END();
1053} 1498}
1054int 1499int
1055evgl_glGetUniformLocation(GLuint program, const char* name) 1500_evgld_glGetUniformLocation(GLuint program, const char* name)
1056{ 1501{
1057 int ret = _EVGL_INT_INIT_VALUE; 1502 int ret = _EVGL_INT_INIT_VALUE;
1058 1503
@@ -1067,7 +1512,7 @@ finish:
1067} 1512}
1068 1513
1069GLboolean 1514GLboolean
1070evgl_glIsBuffer(GLuint buffer) 1515_evgld_glIsBuffer(GLuint buffer)
1071{ 1516{
1072 GLboolean ret = GL_FALSE; 1517 GLboolean ret = GL_FALSE;
1073 1518
@@ -1082,7 +1527,7 @@ finish:
1082} 1527}
1083 1528
1084GLboolean 1529GLboolean
1085evgl_glIsEnabled(GLenum cap) 1530_evgld_glIsEnabled(GLenum cap)
1086{ 1531{
1087 GLboolean ret = GL_FALSE; 1532 GLboolean ret = GL_FALSE;
1088 1533
@@ -1097,7 +1542,7 @@ finish:
1097} 1542}
1098 1543
1099GLboolean 1544GLboolean
1100evgl_glIsFramebuffer(GLuint framebuffer) 1545_evgld_glIsFramebuffer(GLuint framebuffer)
1101{ 1546{
1102 GLboolean ret = GL_FALSE; 1547 GLboolean ret = GL_FALSE;
1103 1548
@@ -1112,7 +1557,7 @@ finish:
1112} 1557}
1113 1558
1114GLboolean 1559GLboolean
1115evgl_glIsProgram(GLuint program) 1560_evgld_glIsProgram(GLuint program)
1116{ 1561{
1117 GLboolean ret; 1562 GLboolean ret;
1118 EVGL_FUNC_BEGIN(); 1563 EVGL_FUNC_BEGIN();
@@ -1126,7 +1571,7 @@ finish:
1126} 1571}
1127 1572
1128GLboolean 1573GLboolean
1129evgl_glIsRenderbuffer(GLuint renderbuffer) 1574_evgld_glIsRenderbuffer(GLuint renderbuffer)
1130{ 1575{
1131 GLboolean ret; 1576 GLboolean ret;
1132 EVGL_FUNC_BEGIN(); 1577 EVGL_FUNC_BEGIN();
@@ -1140,7 +1585,7 @@ finish:
1140} 1585}
1141 1586
1142GLboolean 1587GLboolean
1143evgl_glIsShader(GLuint shader) 1588_evgld_glIsShader(GLuint shader)
1144{ 1589{
1145 GLboolean ret; 1590 GLboolean ret;
1146 EVGL_FUNC_BEGIN(); 1591 EVGL_FUNC_BEGIN();
@@ -1154,7 +1599,7 @@ finish:
1154} 1599}
1155 1600
1156GLboolean 1601GLboolean
1157evgl_glIsTexture(GLuint texture) 1602_evgld_glIsTexture(GLuint texture)
1158{ 1603{
1159 GLboolean ret; 1604 GLboolean ret;
1160 EVGL_FUNC_BEGIN(); 1605 EVGL_FUNC_BEGIN();
@@ -1168,7 +1613,7 @@ finish:
1168} 1613}
1169 1614
1170void 1615void
1171evgl_glLineWidth(GLfloat width) 1616_evgld_glLineWidth(GLfloat width)
1172{ 1617{
1173 EVGL_FUNC_BEGIN(); 1618 EVGL_FUNC_BEGIN();
1174 glLineWidth(width); 1619 glLineWidth(width);
@@ -1180,7 +1625,7 @@ finish:
1180} 1625}
1181 1626
1182void 1627void
1183evgl_glLinkProgram(GLuint program) 1628_evgld_glLinkProgram(GLuint program)
1184{ 1629{
1185 EVGL_FUNC_BEGIN(); 1630 EVGL_FUNC_BEGIN();
1186 glLinkProgram(program); 1631 glLinkProgram(program);
@@ -1192,7 +1637,7 @@ finish:
1192} 1637}
1193 1638
1194void 1639void
1195evgl_glPixelStorei(GLenum pname, GLint param) 1640_evgld_glPixelStorei(GLenum pname, GLint param)
1196{ 1641{
1197 EVGL_FUNC_BEGIN(); 1642 EVGL_FUNC_BEGIN();
1198 glPixelStorei(pname, param); 1643 glPixelStorei(pname, param);
@@ -1204,7 +1649,7 @@ finish:
1204} 1649}
1205 1650
1206void 1651void
1207evgl_glPolygonOffset(GLfloat factor, GLfloat units) 1652_evgld_glPolygonOffset(GLfloat factor, GLfloat units)
1208{ 1653{
1209 EVGL_FUNC_BEGIN(); 1654 EVGL_FUNC_BEGIN();
1210 glPolygonOffset(factor, units); 1655 glPolygonOffset(factor, units);
@@ -1215,31 +1660,14 @@ finish:
1215 EVGL_FUNC_END(); 1660 EVGL_FUNC_END();
1216} 1661}
1217 1662
1218#ifdef NO_DIRECT_RENDERING
1219void
1220evgl_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
1221{
1222 EVGL_FUNC_BEGIN();
1223 glReadPixels(x, y, width, height, format, type, pixels);
1224 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1225 goto finish;
1226
1227finish:
1228 EVGL_FUNC_END();
1229}
1230#endif
1231
1232void 1663void
1233evgl_glReleaseShaderCompiler(void) 1664_evgld_glReleaseShaderCompiler(void)
1234{ 1665{
1235 EVGL_FUNC_BEGIN(); 1666 EVGL_FUNC_BEGIN();
1236 1667
1237#ifdef GL_GLES 1668 _evgl_glReleaseShaderCompiler();
1238 glReleaseShaderCompiler();
1239#else
1240#endif
1241
1242 GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 1669 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1670
1243 goto finish; 1671 goto finish;
1244 1672
1245finish: 1673finish:
@@ -1247,7 +1675,7 @@ finish:
1247} 1675}
1248 1676
1249void 1677void
1250evgl_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) 1678_evgld_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
1251{ 1679{
1252 EVGL_FUNC_BEGIN(); 1680 EVGL_FUNC_BEGIN();
1253 glRenderbufferStorage(target, internalformat, width, height); 1681 glRenderbufferStorage(target, internalformat, width, height);
@@ -1259,7 +1687,7 @@ finish:
1259} 1687}
1260 1688
1261void 1689void
1262evgl_glSampleCoverage(GLclampf value, GLboolean invert) 1690_evgld_glSampleCoverage(GLclampf value, GLboolean invert)
1263{ 1691{
1264 EVGL_FUNC_BEGIN(); 1692 EVGL_FUNC_BEGIN();
1265 glSampleCoverage(value, invert); 1693 glSampleCoverage(value, invert);
@@ -1270,36 +1698,14 @@ finish:
1270 EVGL_FUNC_END(); 1698 EVGL_FUNC_END();
1271} 1699}
1272 1700
1273#ifdef NO_DIRECT_RENDERING
1274void 1701void
1275evgl_glScissor(GLint x, GLint y, GLsizei width, GLsizei height) 1702_evgld_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
1276{ 1703{
1277 EVGL_FUNC_BEGIN(); 1704 EVGL_FUNC_BEGIN();
1278 glScissor(x, y, width, height);
1279 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1280 goto finish;
1281
1282finish:
1283 EVGL_FUNC_END();
1284}
1285#endif
1286
1287void
1288evgl_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
1289{
1290 EVGL_FUNC_BEGIN();
1291
1292#ifdef GL_GLES
1293 glShaderBinary(n, shaders, binaryformat, binary, length);
1294#else
1295 // FIXME: need to dlsym/getprocaddress for this
1296 ERR("Binary Shader is not supported here yet.");
1297 return;
1298 n = binaryformat = length = 0;
1299 shaders = binary = 0;
1300#endif
1301 1705
1706 _evgl_glShaderBinary(n, shaders, binaryformat, binary, length);
1302 GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 1707 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1708
1303 goto finish; 1709 goto finish;
1304 1710
1305finish: 1711finish:
@@ -1307,7 +1713,7 @@ finish:
1307} 1713}
1308 1714
1309void 1715void
1310evgl_glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) 1716_evgld_glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
1311{ 1717{
1312 EVGL_FUNC_BEGIN(); 1718 EVGL_FUNC_BEGIN();
1313 glShaderSource(shader, count, string, length); 1719 glShaderSource(shader, count, string, length);
@@ -1319,7 +1725,7 @@ finish:
1319} 1725}
1320 1726
1321void 1727void
1322evgl_glStencilFunc(GLenum func, GLint ref, GLuint mask) 1728_evgld_glStencilFunc(GLenum func, GLint ref, GLuint mask)
1323{ 1729{
1324 EVGL_FUNC_BEGIN(); 1730 EVGL_FUNC_BEGIN();
1325 glStencilFunc(func, ref, mask); 1731 glStencilFunc(func, ref, mask);
@@ -1331,7 +1737,7 @@ finish:
1331} 1737}
1332 1738
1333void 1739void
1334evgl_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) 1740_evgld_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
1335{ 1741{
1336 EVGL_FUNC_BEGIN(); 1742 EVGL_FUNC_BEGIN();
1337 glStencilFuncSeparate(face, func, ref, mask); 1743 glStencilFuncSeparate(face, func, ref, mask);
@@ -1343,7 +1749,7 @@ finish:
1343} 1749}
1344 1750
1345void 1751void
1346evgl_glStencilMask(GLuint mask) 1752_evgld_glStencilMask(GLuint mask)
1347{ 1753{
1348 EVGL_FUNC_BEGIN(); 1754 EVGL_FUNC_BEGIN();
1349 glStencilMask(mask); 1755 glStencilMask(mask);
@@ -1355,7 +1761,7 @@ finish:
1355} 1761}
1356 1762
1357void 1763void
1358evgl_glStencilMaskSeparate(GLenum face, GLuint mask) 1764_evgld_glStencilMaskSeparate(GLenum face, GLuint mask)
1359{ 1765{
1360 EVGL_FUNC_BEGIN(); 1766 EVGL_FUNC_BEGIN();
1361 glStencilMaskSeparate(face, mask); 1767 glStencilMaskSeparate(face, mask);
@@ -1367,7 +1773,7 @@ finish:
1367} 1773}
1368 1774
1369void 1775void
1370evgl_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) 1776_evgld_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
1371{ 1777{
1372 EVGL_FUNC_BEGIN(); 1778 EVGL_FUNC_BEGIN();
1373 glStencilOp(fail, zfail, zpass); 1779 glStencilOp(fail, zfail, zpass);
@@ -1379,7 +1785,7 @@ finish:
1379} 1785}
1380 1786
1381void 1787void
1382evgl_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) 1788_evgld_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
1383{ 1789{
1384 EVGL_FUNC_BEGIN(); 1790 EVGL_FUNC_BEGIN();
1385 glStencilOpSeparate(face, fail, zfail, zpass); 1791 glStencilOpSeparate(face, fail, zfail, zpass);
@@ -1391,7 +1797,7 @@ finish:
1391} 1797}
1392 1798
1393void 1799void
1394evgl_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels) 1800_evgld_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
1395{ 1801{
1396 EVGL_FUNC_BEGIN(); 1802 EVGL_FUNC_BEGIN();
1397 glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); 1803 glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
@@ -1403,7 +1809,7 @@ finish:
1403} 1809}
1404 1810
1405void 1811void
1406evgl_glTexParameterf(GLenum target, GLenum pname, GLfloat param) 1812_evgld_glTexParameterf(GLenum target, GLenum pname, GLfloat param)
1407{ 1813{
1408 EVGL_FUNC_BEGIN(); 1814 EVGL_FUNC_BEGIN();
1409 glTexParameterf(target, pname, param); 1815 glTexParameterf(target, pname, param);
@@ -1415,7 +1821,7 @@ finish:
1415} 1821}
1416 1822
1417void 1823void
1418evgl_glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) 1824_evgld_glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
1419{ 1825{
1420 EVGL_FUNC_BEGIN(); 1826 EVGL_FUNC_BEGIN();
1421 glTexParameterfv(target, pname, params); 1827 glTexParameterfv(target, pname, params);
@@ -1427,7 +1833,7 @@ finish:
1427} 1833}
1428 1834
1429void 1835void
1430evgl_glTexParameteri(GLenum target, GLenum pname, GLint param) 1836_evgld_glTexParameteri(GLenum target, GLenum pname, GLint param)
1431{ 1837{
1432 EVGL_FUNC_BEGIN(); 1838 EVGL_FUNC_BEGIN();
1433 glTexParameteri(target, pname, param); 1839 glTexParameteri(target, pname, param);
@@ -1439,7 +1845,7 @@ finish:
1439} 1845}
1440 1846
1441void 1847void
1442evgl_glTexParameteriv(GLenum target, GLenum pname, const GLint* params) 1848_evgld_glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
1443{ 1849{
1444 EVGL_FUNC_BEGIN(); 1850 EVGL_FUNC_BEGIN();
1445 glTexParameteriv(target, pname, params); 1851 glTexParameteriv(target, pname, params);
@@ -1451,7 +1857,7 @@ finish:
1451} 1857}
1452 1858
1453void 1859void
1454evgl_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) 1860_evgld_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
1455{ 1861{
1456 EVGL_FUNC_BEGIN(); 1862 EVGL_FUNC_BEGIN();
1457 glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); 1863 glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
@@ -1463,7 +1869,7 @@ finish:
1463} 1869}
1464 1870
1465void 1871void
1466evgl_glUniform1f(GLint location, GLfloat x) 1872_evgld_glUniform1f(GLint location, GLfloat x)
1467{ 1873{
1468 EVGL_FUNC_BEGIN(); 1874 EVGL_FUNC_BEGIN();
1469 glUniform1f(location, x); 1875 glUniform1f(location, x);
@@ -1475,7 +1881,7 @@ finish:
1475} 1881}
1476 1882
1477void 1883void
1478evgl_glUniform1fv(GLint location, GLsizei count, const GLfloat* v) 1884_evgld_glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
1479{ 1885{
1480 EVGL_FUNC_BEGIN(); 1886 EVGL_FUNC_BEGIN();
1481 glUniform1fv(location, count, v); 1887 glUniform1fv(location, count, v);
@@ -1487,7 +1893,7 @@ finish:
1487} 1893}
1488 1894
1489void 1895void
1490evgl_glUniform1i(GLint location, GLint x) 1896_evgld_glUniform1i(GLint location, GLint x)
1491{ 1897{
1492 EVGL_FUNC_BEGIN(); 1898 EVGL_FUNC_BEGIN();
1493 glUniform1i(location, x); 1899 glUniform1i(location, x);
@@ -1499,7 +1905,7 @@ finish:
1499} 1905}
1500 1906
1501void 1907void
1502evgl_glUniform1iv(GLint location, GLsizei count, const GLint* v) 1908_evgld_glUniform1iv(GLint location, GLsizei count, const GLint* v)
1503{ 1909{
1504 EVGL_FUNC_BEGIN(); 1910 EVGL_FUNC_BEGIN();
1505 glUniform1iv(location, count, v); 1911 glUniform1iv(location, count, v);
@@ -1511,7 +1917,7 @@ finish:
1511} 1917}
1512 1918
1513void 1919void
1514evgl_glUniform2f(GLint location, GLfloat x, GLfloat y) 1920_evgld_glUniform2f(GLint location, GLfloat x, GLfloat y)
1515{ 1921{
1516 EVGL_FUNC_BEGIN(); 1922 EVGL_FUNC_BEGIN();
1517 glUniform2f(location, x, y); 1923 glUniform2f(location, x, y);
@@ -1523,7 +1929,7 @@ finish:
1523} 1929}
1524 1930
1525void 1931void
1526evgl_glUniform2fv(GLint location, GLsizei count, const GLfloat* v) 1932_evgld_glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
1527{ 1933{
1528 EVGL_FUNC_BEGIN(); 1934 EVGL_FUNC_BEGIN();
1529 glUniform2fv(location, count, v); 1935 glUniform2fv(location, count, v);
@@ -1535,7 +1941,7 @@ finish:
1535} 1941}
1536 1942
1537void 1943void
1538evgl_glUniform2i(GLint location, GLint x, GLint y) 1944_evgld_glUniform2i(GLint location, GLint x, GLint y)
1539{ 1945{
1540 EVGL_FUNC_BEGIN(); 1946 EVGL_FUNC_BEGIN();
1541 glUniform2i(location, x, y); 1947 glUniform2i(location, x, y);
@@ -1547,7 +1953,7 @@ finish:
1547} 1953}
1548 1954
1549void 1955void
1550evgl_glUniform2iv(GLint location, GLsizei count, const GLint* v) 1956_evgld_glUniform2iv(GLint location, GLsizei count, const GLint* v)
1551{ 1957{
1552 EVGL_FUNC_BEGIN(); 1958 EVGL_FUNC_BEGIN();
1553 glUniform2iv(location, count, v); 1959 glUniform2iv(location, count, v);
@@ -1559,7 +1965,7 @@ finish:
1559} 1965}
1560 1966
1561void 1967void
1562evgl_glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) 1968_evgld_glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
1563{ 1969{
1564 EVGL_FUNC_BEGIN(); 1970 EVGL_FUNC_BEGIN();
1565 glUniform3f(location, x, y, z); 1971 glUniform3f(location, x, y, z);
@@ -1571,7 +1977,7 @@ finish:
1571} 1977}
1572 1978
1573void 1979void
1574evgl_glUniform3fv(GLint location, GLsizei count, const GLfloat* v) 1980_evgld_glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
1575{ 1981{
1576 EVGL_FUNC_BEGIN(); 1982 EVGL_FUNC_BEGIN();
1577 glUniform3fv(location, count, v); 1983 glUniform3fv(location, count, v);
@@ -1583,7 +1989,7 @@ finish:
1583} 1989}
1584 1990
1585void 1991void
1586evgl_glUniform3i(GLint location, GLint x, GLint y, GLint z) 1992_evgld_glUniform3i(GLint location, GLint x, GLint y, GLint z)
1587{ 1993{
1588 EVGL_FUNC_BEGIN(); 1994 EVGL_FUNC_BEGIN();
1589 glUniform3i(location, x, y, z); 1995 glUniform3i(location, x, y, z);
@@ -1595,7 +2001,7 @@ finish:
1595} 2001}
1596 2002
1597void 2003void
1598evgl_glUniform3iv(GLint location, GLsizei count, const GLint* v) 2004_evgld_glUniform3iv(GLint location, GLsizei count, const GLint* v)
1599{ 2005{
1600 EVGL_FUNC_BEGIN(); 2006 EVGL_FUNC_BEGIN();
1601 glUniform3iv(location, count, v); 2007 glUniform3iv(location, count, v);
@@ -1607,7 +2013,7 @@ finish:
1607} 2013}
1608 2014
1609void 2015void
1610evgl_glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 2016_evgld_glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
1611{ 2017{
1612 EVGL_FUNC_BEGIN(); 2018 EVGL_FUNC_BEGIN();
1613 glUniform4f(location, x, y, z, w); 2019 glUniform4f(location, x, y, z, w);
@@ -1619,7 +2025,7 @@ finish:
1619} 2025}
1620 2026
1621void 2027void
1622evgl_glUniform4fv(GLint location, GLsizei count, const GLfloat* v) 2028_evgld_glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
1623{ 2029{
1624 EVGL_FUNC_BEGIN(); 2030 EVGL_FUNC_BEGIN();
1625 glUniform4fv(location, count, v); 2031 glUniform4fv(location, count, v);
@@ -1631,7 +2037,7 @@ finish:
1631} 2037}
1632 2038
1633void 2039void
1634evgl_glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) 2040_evgld_glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
1635{ 2041{
1636 EVGL_FUNC_BEGIN(); 2042 EVGL_FUNC_BEGIN();
1637 glUniform4i(location, x, y, z, w); 2043 glUniform4i(location, x, y, z, w);
@@ -1643,7 +2049,7 @@ finish:
1643} 2049}
1644 2050
1645void 2051void
1646evgl_glUniform4iv(GLint location, GLsizei count, const GLint* v) 2052_evgld_glUniform4iv(GLint location, GLsizei count, const GLint* v)
1647{ 2053{
1648 EVGL_FUNC_BEGIN(); 2054 EVGL_FUNC_BEGIN();
1649 glUniform4iv(location, count, v); 2055 glUniform4iv(location, count, v);
@@ -1655,7 +2061,7 @@ finish:
1655} 2061}
1656 2062
1657void 2063void
1658evgl_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) 2064_evgld_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1659{ 2065{
1660 EVGL_FUNC_BEGIN(); 2066 EVGL_FUNC_BEGIN();
1661 glUniformMatrix2fv(location, count, transpose, value); 2067 glUniformMatrix2fv(location, count, transpose, value);
@@ -1667,7 +2073,7 @@ finish:
1667} 2073}
1668 2074
1669void 2075void
1670evgl_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) 2076_evgld_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1671{ 2077{
1672 EVGL_FUNC_BEGIN(); 2078 EVGL_FUNC_BEGIN();
1673 glUniformMatrix3fv(location, count, transpose, value); 2079 glUniformMatrix3fv(location, count, transpose, value);
@@ -1679,7 +2085,7 @@ finish:
1679} 2085}
1680 2086
1681void 2087void
1682evgl_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) 2088_evgld_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
1683{ 2089{
1684 EVGL_FUNC_BEGIN(); 2090 EVGL_FUNC_BEGIN();
1685 glUniformMatrix4fv(location, count, transpose, value); 2091 glUniformMatrix4fv(location, count, transpose, value);
@@ -1691,7 +2097,7 @@ finish:
1691} 2097}
1692 2098
1693void 2099void
1694evgl_glUseProgram(GLuint program) 2100_evgld_glUseProgram(GLuint program)
1695{ 2101{
1696 EVGL_FUNC_BEGIN(); 2102 EVGL_FUNC_BEGIN();
1697 glUseProgram(program); 2103 glUseProgram(program);
@@ -1703,7 +2109,7 @@ finish:
1703} 2109}
1704 2110
1705void 2111void
1706evgl_glValidateProgram(GLuint program) 2112_evgld_glValidateProgram(GLuint program)
1707{ 2113{
1708 EVGL_FUNC_BEGIN(); 2114 EVGL_FUNC_BEGIN();
1709 glValidateProgram(program); 2115 glValidateProgram(program);
@@ -1715,7 +2121,7 @@ finish:
1715} 2121}
1716 2122
1717void 2123void
1718evgl_glVertexAttrib1f(GLuint indx, GLfloat x) 2124_evgld_glVertexAttrib1f(GLuint indx, GLfloat x)
1719{ 2125{
1720 EVGL_FUNC_BEGIN(); 2126 EVGL_FUNC_BEGIN();
1721 glVertexAttrib1f(indx, x); 2127 glVertexAttrib1f(indx, x);
@@ -1727,7 +2133,7 @@ finish:
1727} 2133}
1728 2134
1729void 2135void
1730evgl_glVertexAttrib1fv(GLuint indx, const GLfloat* values) 2136_evgld_glVertexAttrib1fv(GLuint indx, const GLfloat* values)
1731{ 2137{
1732 EVGL_FUNC_BEGIN(); 2138 EVGL_FUNC_BEGIN();
1733 glVertexAttrib1fv(indx, values); 2139 glVertexAttrib1fv(indx, values);
@@ -1739,7 +2145,7 @@ finish:
1739} 2145}
1740 2146
1741void 2147void
1742evgl_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) 2148_evgld_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
1743{ 2149{
1744 EVGL_FUNC_BEGIN(); 2150 EVGL_FUNC_BEGIN();
1745 glVertexAttrib2f(indx, x, y); 2151 glVertexAttrib2f(indx, x, y);
@@ -1751,7 +2157,7 @@ finish:
1751} 2157}
1752 2158
1753void 2159void
1754evgl_glVertexAttrib2fv(GLuint indx, const GLfloat* values) 2160_evgld_glVertexAttrib2fv(GLuint indx, const GLfloat* values)
1755{ 2161{
1756 EVGL_FUNC_BEGIN(); 2162 EVGL_FUNC_BEGIN();
1757 glVertexAttrib2fv(indx, values); 2163 glVertexAttrib2fv(indx, values);
@@ -1763,7 +2169,7 @@ finish:
1763} 2169}
1764 2170
1765void 2171void
1766evgl_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) 2172_evgld_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
1767{ 2173{
1768 EVGL_FUNC_BEGIN(); 2174 EVGL_FUNC_BEGIN();
1769 glVertexAttrib3f(indx, x, y, z); 2175 glVertexAttrib3f(indx, x, y, z);
@@ -1775,7 +2181,7 @@ finish:
1775} 2181}
1776 2182
1777void 2183void
1778evgl_glVertexAttrib3fv(GLuint indx, const GLfloat* values) 2184_evgld_glVertexAttrib3fv(GLuint indx, const GLfloat* values)
1779{ 2185{
1780 EVGL_FUNC_BEGIN(); 2186 EVGL_FUNC_BEGIN();
1781 glVertexAttrib3fv(indx, values); 2187 glVertexAttrib3fv(indx, values);
@@ -1787,7 +2193,7 @@ finish:
1787} 2193}
1788 2194
1789void 2195void
1790evgl_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) 2196_evgld_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
1791{ 2197{
1792 EVGL_FUNC_BEGIN(); 2198 EVGL_FUNC_BEGIN();
1793 glVertexAttrib4f(indx, x, y, z, w); 2199 glVertexAttrib4f(indx, x, y, z, w);
@@ -1799,7 +2205,7 @@ finish:
1799} 2205}
1800 2206
1801void 2207void
1802evgl_glVertexAttrib4fv(GLuint indx, const GLfloat* values) 2208_evgld_glVertexAttrib4fv(GLuint indx, const GLfloat* values)
1803{ 2209{
1804 EVGL_FUNC_BEGIN(); 2210 EVGL_FUNC_BEGIN();
1805 glVertexAttrib4fv(indx, values); 2211 glVertexAttrib4fv(indx, values);
@@ -1811,7 +2217,7 @@ finish:
1811} 2217}
1812 2218
1813void 2219void
1814evgl_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) 2220_evgld_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
1815{ 2221{
1816 EVGL_FUNC_BEGIN(); 2222 EVGL_FUNC_BEGIN();
1817 glVertexAttribPointer(indx, size, type, normalized, stride, ptr); 2223 glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
@@ -1822,20 +2228,6 @@ finish:
1822 EVGL_FUNC_END(); 2228 EVGL_FUNC_END();
1823} 2229}
1824 2230
1825#ifdef NO_DIRECT_RENDERING
1826void
1827evgl_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
1828{
1829 EVGL_FUNC_BEGIN();
1830 glViewport(x, y, width, height);
1831 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
1832 goto finish;
1833
1834finish:
1835 EVGL_FUNC_END();
1836}
1837#endif
1838
1839//-------------------------------------------------------------// 2231//-------------------------------------------------------------//
1840// Calls for stripping precision string in the shader 2232// Calls for stripping precision string in the shader
1841#if 0 2233#if 0
@@ -2046,7 +2438,7 @@ shadersrc_gles_to_gl(GLsizei count, const char** string, char **s, const GLint*
2046 2438
2047 2439
2048void 2440void
2049evgl_glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length) 2441_evgld_glShaderSource(GLuint shader, GLsizei count, const char** string, const GLint* length)
2050{ 2442{
2051 EVGL_FUNC_BEGIN(); 2443 EVGL_FUNC_BEGIN();
2052 2444
@@ -2103,179 +2495,28 @@ finish:
2103//-------------------------------------------------------------// 2495//-------------------------------------------------------------//
2104// Calls related to Evas GL Direct Rendering 2496// Calls related to Evas GL Direct Rendering
2105//-------------------------------------------------------------// 2497//-------------------------------------------------------------//
2106
2107// Transform from Evas Coordinat to GL Coordinate
2108// returns: oc[4] original image object dimension in gl coord
2109// returns: nc[4] tranformed (x, y, width, heigth) in gl coord
2110static void 2498static void
2111compute_gl_coordinates(Evas_Object *obj, int rot, int clip, 2499_evgld_glClear(GLbitfield mask)
2112 int x, int y, int width, int height,
2113 int imgc[4], int objc[4])
2114{ 2500{
2115 if (rot == 0) 2501 EVGL_FUNC_BEGIN();
2116 {
2117 // oringinal image object coordinate in gl coordinate
2118 imgc[0] = obj->cur.geometry.x;
2119 imgc[1] = obj->layer->evas->output.h - obj->cur.geometry.y - obj->cur.geometry.h;
2120 imgc[2] = imgc[0] + obj->cur.geometry.w;
2121 imgc[3] = imgc[1] + obj->cur.geometry.h;
2122
2123 // transformed (x,y,width,height) in gl coordinate
2124 objc[0] = imgc[0] + x;
2125 objc[1] = imgc[1] + y;
2126 objc[2] = objc[0] + width;
2127 objc[3] = objc[1] + height;
2128 }
2129 else if (rot == 180)
2130 {
2131 // oringinal image object coordinate in gl coordinate
2132 imgc[0] = obj->layer->evas->output.w - obj->cur.geometry.x - obj->cur.geometry.w;
2133 imgc[1] = obj->cur.geometry.y;
2134 imgc[2] = imgc[0] + obj->cur.geometry.w;
2135 imgc[3] = imgc[1] + obj->cur.geometry.h;
2136
2137 // transformed (x,y,width,height) in gl coordinate
2138 objc[0] = imgc[0] + obj->cur.geometry.w - x - width;
2139 objc[1] = imgc[1] + obj->cur.geometry.h - y - height;
2140 objc[2] = objc[0] + width;
2141 objc[3] = objc[1] + height;
2142
2143 }
2144 else if (rot == 90)
2145 {
2146 // oringinal image object coordinate in gl coordinate
2147 imgc[0] = obj->cur.geometry.y;
2148 imgc[1] = obj->cur.geometry.x;
2149 imgc[2] = imgc[0] + obj->cur.geometry.h;
2150 imgc[3] = imgc[1] + obj->cur.geometry.w;
2151
2152 // transformed (x,y,width,height) in gl coordinate
2153 objc[0] = imgc[0] + obj->cur.geometry.h - y - height;
2154 objc[1] = imgc[1] + x;
2155 objc[2] = objc[0] + height;
2156 objc[3] = objc[1] + width;
2157 }
2158 else if (rot == 270)
2159 {
2160 // oringinal image object coordinate in gl coordinate
2161 imgc[0] = obj->layer->evas->output.h - obj->cur.geometry.y - obj->cur.geometry.h;
2162 imgc[1] = obj->layer->evas->output.w - obj->cur.geometry.x - obj->cur.geometry.w;
2163 imgc[2] = imgc[0] + obj->cur.geometry.h;
2164 imgc[3] = imgc[1] + obj->cur.geometry.w;
2165
2166 // transformed (x,y,width,height) in gl coordinate
2167 objc[0] = imgc[0] + y;
2168 objc[1] = imgc[1] + obj->cur.geometry.w - x - width;
2169 objc[2] = objc[0] + height;
2170 objc[3] = objc[1] + width;
2171 }
2172 else
2173 {
2174 ERR("Invalid rotation angle %d.", rot);
2175 return;
2176 }
2177
2178 if (clip)
2179 {
2180 // Clip against original image object
2181 if (objc[0] < imgc[0]) objc[0] = imgc[0];
2182 if (objc[0] > imgc[2]) objc[0] = 0;
2183
2184 if (objc[1] < imgc[1]) objc[1] = imgc[1];
2185 if (objc[1] > imgc[3]) objc[1] = 0;
2186
2187 if (objc[2] < imgc[0]) objc[0] = 0;
2188 if (objc[2] > imgc[2]) objc[2] = imgc[2];
2189 2502
2190 if (objc[3] < imgc[1]) objc[1] = 0; 2503 _evgl_glClear(mask);
2191 if (objc[3] > imgc[3]) objc[3] = imgc[3]; 2504 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2192 }
2193 2505
2194 imgc[2] = imgc[2]-imgc[0]; // width 2506 goto finish;
2195 imgc[3] = imgc[3]-imgc[1]; // height
2196 2507
2197 objc[2] = objc[2]-objc[0]; // width 2508finish:
2198 objc[3] = objc[3]-objc[1]; // height 2509 EVGL_FUNC_END();
2199} 2510}
2200 2511
2201static void 2512static void
2202evgl_glClear(GLbitfield mask) 2513_evgld_glEnable(GLenum cap)
2203{ 2514{
2204 EVGL_Engine *ee = evgl_engine;
2205 EVGL_Resource *rsc;
2206 EVGL_Context *ctx;
2207 Evas_Object *img;
2208 int rot = 0;
2209 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
2210
2211 EVGL_FUNC_BEGIN(); 2515 EVGL_FUNC_BEGIN();
2212 2516
2213 if (!(rsc=_evgl_tls_resource_get(ee))) 2517 _evgl_glEnable(cap);
2214 { 2518 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2215 ERR("Unable to execute GL command. Error retrieving tls");
2216 return;
2217 }
2218
2219 ctx = rsc->current_ctx;
2220 if (!ctx)
2221 {
2222 ERR("Unable to retrive Current Context");
2223 return;
2224 }
2225
2226 if (evgl_direct_enabled(evgl_engine))
2227 {
2228 if (!(rsc->current_ctx->current_fbo))
2229 {
2230 if ((!ctx->direct_scissor))
2231 {
2232 glEnable(GL_SCISSOR_TEST);
2233 ctx->direct_scissor = 1;
2234 }
2235
2236 img = rsc->direct_img_obj;
2237 rot = ee->funcs->rotation_angle_get(ee->engine_data);
2238
2239 compute_gl_coordinates(img, rot, 0, 0, 0, 0, 0, oc, nc);
2240
2241
2242 if ((ctx->scissor_upated) && (ctx->scissor_enabled))
2243 {
2244 glScissor(ctx->scissor_coord[0], ctx->scissor_coord[1],
2245 ctx->scissor_coord[2], ctx->scissor_coord[3]);
2246 ctx->direct_scissor = 0;
2247 }
2248 else
2249 glScissor(oc[0], oc[1], oc[2], oc[3]);
2250
2251 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2252
2253 glClear(mask);
2254 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2255 }
2256 else
2257 {
2258 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
2259 {
2260 glDisable(GL_SCISSOR_TEST);
2261 ctx->direct_scissor = 0;
2262 }
2263
2264 glClear(mask);
2265 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2266 }
2267 }
2268 else
2269 {
2270 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
2271 {
2272 glDisable(GL_SCISSOR_TEST);
2273 ctx->direct_scissor = 0;
2274 }
2275 2519
2276 glClear(mask);
2277 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2278 }
2279 goto finish; 2520 goto finish;
2280 2521
2281finish: 2522finish:
@@ -2283,92 +2524,42 @@ finish:
2283} 2524}
2284 2525
2285static void 2526static void
2286evgl_glEnable(GLenum cap) 2527_evgld_glDisable(GLenum cap)
2287{ 2528{
2288 EVGL_Context *ctx;
2289
2290 EVGL_FUNC_BEGIN(); 2529 EVGL_FUNC_BEGIN();
2291 2530
2292 ctx = _evgl_current_context_get(); 2531 _evgl_glDisable(cap);
2293
2294 if (cap == GL_SCISSOR_TEST)
2295 if (ctx) ctx->scissor_enabled = 1;
2296 glEnable(cap);
2297 GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 2532 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2533
2298 goto finish; 2534 goto finish;
2299 2535
2300finish: 2536finish:
2301 EVGL_FUNC_END(); 2537 EVGL_FUNC_END();
2302} 2538}
2303 2539
2540
2304static void 2541static void
2305evgl_glDisable(GLenum cap) 2542_evgld_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
2306{ 2543{
2307 EVGL_Context *ctx;
2308
2309 EVGL_FUNC_BEGIN(); 2544 EVGL_FUNC_BEGIN();
2310 2545
2311 ctx = _evgl_current_context_get(); 2546 _evgl_glReadPixels(x, y, width, height, format, type, pixels);
2312
2313 if (cap == GL_SCISSOR_TEST)
2314 if (ctx) ctx->scissor_enabled = 0;
2315 glDisable(cap);
2316 GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 2547 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2548
2317 goto finish; 2549 goto finish;
2318 2550
2319finish: 2551finish:
2320 EVGL_FUNC_END(); 2552 EVGL_FUNC_END();
2321} 2553}
2322 2554
2323
2324static void 2555static void
2325evgl_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) 2556_evgld_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
2326{ 2557{
2327 EVGL_Engine *ee = evgl_engine;
2328 EVGL_Resource *rsc;
2329 EVGL_Context *ctx;
2330 Evas_Object *img;
2331 int rot = 0;
2332 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
2333
2334 EVGL_FUNC_BEGIN(); 2558 EVGL_FUNC_BEGIN();
2335 2559
2336 if (!(rsc=_evgl_tls_resource_get(ee))) 2560 _evgl_glScissor(x, y, width, height);
2337 { 2561 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2338 ERR("Unable to execute GL command. Error retrieving tls");
2339 return;
2340 }
2341
2342 ctx = rsc->current_ctx;
2343 if (!ctx)
2344 {
2345 ERR("Unable to retrive Current Context");
2346 return;
2347 }
2348
2349 if (evgl_direct_enabled(evgl_engine))
2350 {
2351
2352 if (!(rsc->current_ctx->current_fbo))
2353 {
2354 img = rsc->direct_img_obj;
2355 rot = ee->funcs->rotation_angle_get(ee->engine_data);
2356 2562
2357 compute_gl_coordinates(img, rot, 1, x, y, width, height, oc, nc);
2358 glReadPixels(nc[0], nc[1], nc[2], nc[3], format, type, pixels);
2359 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2360 }
2361 else
2362 {
2363 glReadPixels(x, y, width, height, format, type, pixels);
2364 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2365 }
2366 }
2367 else
2368 {
2369 glReadPixels(x, y, width, height, format, type, pixels);
2370 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2371 }
2372 goto finish; 2563 goto finish;
2373 2564
2374finish: 2565finish:
@@ -2376,175 +2567,204 @@ finish:
2376} 2567}
2377 2568
2378static void 2569static void
2379evgl_glScissor(GLint x, GLint y, GLsizei width, GLsizei height) 2570_evgld_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
2380{ 2571{
2381 EVGL_Engine *ee = evgl_engine;
2382 EVGL_Resource *rsc;
2383 EVGL_Context *ctx;
2384 Evas_Object *img;
2385 int rot = 0;
2386 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
2387
2388 EVGL_FUNC_BEGIN(); 2572 EVGL_FUNC_BEGIN();
2389 2573
2390 if (!(rsc=_evgl_tls_resource_get(ee))) 2574 _evgl_glViewport(x, y, width, height);
2391 { 2575 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2392 ERR("Unable to execute GL command. Error retrieving tls");
2393 return;
2394 }
2395
2396 ctx = rsc->current_ctx;
2397 if (!ctx)
2398 {
2399 ERR("Unable to retrive Current Context");
2400 return;
2401 }
2402
2403 if (evgl_direct_enabled(evgl_engine))
2404 {
2405 if (!(rsc->current_ctx->current_fbo))
2406 {
2407 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
2408 {
2409 glDisable(GL_SCISSOR_TEST);
2410 }
2411
2412 img = rsc->direct_img_obj;
2413 rot = ee->funcs->rotation_angle_get(ee->engine_data);
2414
2415 compute_gl_coordinates(img, rot, 1, x, y, width, height, oc, nc);
2416 glScissor(nc[0], nc[1], nc[2], nc[3]);
2417
2418 // Update coordinates
2419 ctx->scissor_coord[0] = nc[0];
2420 ctx->scissor_coord[1] = nc[1];
2421 ctx->scissor_coord[2] = nc[2];
2422 ctx->scissor_coord[3] = nc[3];
2423
2424 ctx->direct_scissor = 0;
2425
2426 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2427 // Check....!!!!
2428 ctx->scissor_upated = 1;
2429 }
2430 else
2431 {
2432 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
2433 {
2434 glDisable(GL_SCISSOR_TEST);
2435 ctx->direct_scissor = 0;
2436 }
2437
2438 glScissor(x, y, width, height);
2439 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2440
2441 ctx->scissor_upated = 0;
2442 }
2443 }
2444 else
2445 {
2446 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
2447 {
2448 glDisable(GL_SCISSOR_TEST);
2449 ctx->direct_scissor = 0;
2450 }
2451 2576
2452 glScissor(x, y, width, height);
2453 GLERR(__FUNCTION__, __FILE__, __LINE__, "");
2454 }
2455 goto finish; 2577 goto finish;
2456 2578
2457finish: 2579finish:
2458 EVGL_FUNC_END(); 2580 EVGL_FUNC_END();
2459} 2581}
2582//-------------------------------------------------------------//
2460 2583
2461static void 2584static void
2462evgl_glViewport(GLint x, GLint y, GLsizei width, GLsizei height) 2585_normal_gl_api_get(Evas_GL_API *funcs)
2463{ 2586{
2464 EVGL_Engine *ee = evgl_engine; 2587 funcs->version = EVAS_GL_API_VERSION;
2465 EVGL_Resource *rsc;
2466 EVGL_Context *ctx;
2467 Evas_Object *img;
2468 int rot = 0;
2469 int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
2470
2471 if (!(rsc=_evgl_tls_resource_get(ee)))
2472 {
2473 ERR("Unable to execute GL command. Error retrieving tls");
2474 return;
2475 }
2476
2477 ctx = rsc->current_ctx;
2478 if (!ctx)
2479 {
2480 ERR("Unable to retrive Current Context");
2481 return;
2482 }
2483
2484 if (evgl_direct_enabled(evgl_engine))
2485 {
2486 if (!(rsc->current_ctx->current_fbo))
2487 {
2488 if ((!ctx->direct_scissor))
2489 {
2490 glEnable(GL_SCISSOR_TEST);
2491 ctx->direct_scissor = 1;
2492 }
2493 2588
2494 img = rsc->direct_img_obj; 2589#define ORD(f) EVAS_API_OVERRIDE(f, funcs,)
2495 rot = ee->funcs->rotation_angle_get(ee->engine_data); 2590 // GLES 2.0
2591 ORD(glActiveTexture);
2592 ORD(glAttachShader);
2593 ORD(glBindAttribLocation);
2594 ORD(glBindBuffer);
2595 ORD(glBindTexture);
2596 ORD(glBlendColor);
2597 ORD(glBlendEquation);
2598 ORD(glBlendEquationSeparate);
2599 ORD(glBlendFunc);
2600 ORD(glBlendFuncSeparate);
2601 ORD(glBufferData);
2602 ORD(glBufferSubData);
2603 ORD(glCheckFramebufferStatus);
2604// ORD(glClear);
2605 ORD(glClearColor);
2606// ORD(glClearDepthf);
2607 ORD(glClearStencil);
2608 ORD(glColorMask);
2609 ORD(glCompileShader);
2610 ORD(glCompressedTexImage2D);
2611 ORD(glCompressedTexSubImage2D);
2612 ORD(glCopyTexImage2D);
2613 ORD(glCopyTexSubImage2D);
2614 ORD(glCreateProgram);
2615 ORD(glCreateShader);
2616 ORD(glCullFace);
2617 ORD(glDeleteBuffers);
2618 ORD(glDeleteFramebuffers);
2619 ORD(glDeleteProgram);
2620 ORD(glDeleteRenderbuffers);
2621 ORD(glDeleteShader);
2622 ORD(glDeleteTextures);
2623 ORD(glDepthFunc);
2624 ORD(glDepthMask);
2625// ORD(glDepthRangef);
2626 ORD(glDetachShader);
2627// ORD(glDisable);
2628 ORD(glDisableVertexAttribArray);
2629 ORD(glDrawArrays);
2630 ORD(glDrawElements);
2631// ORD(glEnable);
2632 ORD(glEnableVertexAttribArray);
2633 ORD(glFinish);
2634 ORD(glFlush);
2635 ORD(glFramebufferRenderbuffer);
2636 ORD(glFramebufferTexture2D);
2637 ORD(glFrontFace);
2638 ORD(glGenBuffers);
2639 ORD(glGenerateMipmap);
2640 ORD(glGenFramebuffers);
2641 ORD(glGenRenderbuffers);
2642 ORD(glGenTextures);
2643 ORD(glGetActiveAttrib);
2644 ORD(glGetActiveUniform);
2645 ORD(glGetAttachedShaders);
2646 ORD(glGetAttribLocation);
2647 ORD(glGetBooleanv);
2648 ORD(glGetBufferParameteriv);
2649 ORD(glGetError);
2650 ORD(glGetFloatv);
2651 ORD(glGetFramebufferAttachmentParameteriv);
2652 ORD(glGetIntegerv);
2653 ORD(glGetProgramiv);
2654 ORD(glGetProgramInfoLog);
2655 ORD(glGetRenderbufferParameteriv);
2656 ORD(glGetShaderiv);
2657 ORD(glGetShaderInfoLog);
2658// ORD(glGetShaderPrecisionFormat);
2659 ORD(glGetShaderSource);
2660 ORD(glGetString);
2661 ORD(glGetTexParameterfv);
2662 ORD(glGetTexParameteriv);
2663 ORD(glGetUniformfv);
2664 ORD(glGetUniformiv);
2665 ORD(glGetUniformLocation);
2666 ORD(glGetVertexAttribfv);
2667 ORD(glGetVertexAttribiv);
2668 ORD(glGetVertexAttribPointerv);
2669 ORD(glHint);
2670 ORD(glIsBuffer);
2671 ORD(glIsEnabled);
2672 ORD(glIsFramebuffer);
2673 ORD(glIsProgram);
2674 ORD(glIsRenderbuffer);
2675 ORD(glIsShader);
2676 ORD(glIsTexture);
2677 ORD(glLineWidth);
2678 ORD(glLinkProgram);
2679 ORD(glPixelStorei);
2680 ORD(glPolygonOffset);
2681// ORD(glReadPixels);
2682// ORD(glReleaseShaderCompiler);
2683 ORD(glRenderbufferStorage);
2684 ORD(glSampleCoverage);
2685// ORD(glScissor);
2686// ORD(glShaderBinary);
2687 ORD(glShaderSource);
2688 ORD(glStencilFunc);
2689 ORD(glStencilFuncSeparate);
2690 ORD(glStencilMask);
2691 ORD(glStencilMaskSeparate);
2692 ORD(glStencilOp);
2693 ORD(glStencilOpSeparate);
2694 ORD(glTexImage2D);
2695 ORD(glTexParameterf);
2696 ORD(glTexParameterfv);
2697 ORD(glTexParameteri);
2698 ORD(glTexParameteriv);
2699 ORD(glTexSubImage2D);
2700 ORD(glUniform1f);
2701 ORD(glUniform1fv);
2702 ORD(glUniform1i);
2703 ORD(glUniform1iv);
2704 ORD(glUniform2f);
2705 ORD(glUniform2fv);
2706 ORD(glUniform2i);
2707 ORD(glUniform2iv);
2708 ORD(glUniform3f);
2709 ORD(glUniform3fv);
2710 ORD(glUniform3i);
2711 ORD(glUniform3iv);
2712 ORD(glUniform4f);
2713 ORD(glUniform4fv);
2714 ORD(glUniform4i);
2715 ORD(glUniform4iv);
2716 ORD(glUniformMatrix2fv);
2717 ORD(glUniformMatrix3fv);
2718 ORD(glUniformMatrix4fv);
2719 ORD(glUseProgram);
2720 ORD(glValidateProgram);
2721 ORD(glVertexAttrib1f);
2722 ORD(glVertexAttrib1fv);
2723 ORD(glVertexAttrib2f);
2724 ORD(glVertexAttrib2fv);
2725 ORD(glVertexAttrib3f);
2726 ORD(glVertexAttrib3fv);
2727 ORD(glVertexAttrib4f);
2728 ORD(glVertexAttrib4fv);
2729 ORD(glVertexAttribPointer);
2730// ORD(glViewport);
2496 2731
2497 compute_gl_coordinates(img, rot, 0, x, y, width, height, oc, nc); 2732// ORD(glBindFramebuffer);
2733 ORD(glBindRenderbuffer);
2734#undef ORD
2498 2735
2499 if ((ctx->scissor_upated) && (ctx->scissor_enabled))
2500 {
2501 glScissor(ctx->scissor_coord[0], ctx->scissor_coord[1],
2502 ctx->scissor_coord[2], ctx->scissor_coord[3]);
2503 ctx->direct_scissor = 0;
2504 }
2505 else
2506 glScissor(oc[0], oc[1], oc[2], oc[3]);
2507 2736
2508 glViewport(nc[0], nc[1], nc[2], nc[3]); 2737#define ORD(f) EVAS_API_OVERRIDE(f, funcs, _evgl_)
2509 } 2738 // For Surface FBO
2510 else 2739 ORD(glBindFramebuffer);
2511 {
2512 if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
2513 {
2514 glDisable(GL_SCISSOR_TEST);
2515 ctx->direct_scissor = 0;
2516 }
2517 2740
2518 glViewport(x, y, width, height); 2741 // For Direct Rendering
2519 GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 2742 ORD(glClear);
2520 } 2743 ORD(glDisable);
2521 } 2744 ORD(glEnable);
2522 else 2745 ORD(glReadPixels);
2523 { 2746 ORD(glScissor);
2524 if ((ctx->direct_scissor) && (!ctx->scissor_enabled)) 2747 ORD(glViewport);
2525 {
2526 glDisable(GL_SCISSOR_TEST);
2527 ctx->direct_scissor = 0;
2528 }
2529 2748
2530 glViewport(x, y, width, height); 2749 // GLES 2 Compat for Desktop
2531 GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 2750 ORD(glClearDepthf);
2532 } 2751 ORD(glDepthRangef);
2533 goto finish; 2752 ORD(glGetShaderPrecisionFormat);
2753 ORD(glShaderBinary);
2754 ORD(glReleaseShaderCompiler);
2755
2756#undef ORD
2534 2757
2535finish: 2758 evgl_api_ext_get(funcs);
2536 EVGL_FUNC_END();
2537} 2759}
2538//-------------------------------------------------------------//
2539
2540 2760
2541 2761
2542void 2762static void
2543_evgl_api_get(Evas_GL_API *funcs) 2763_debug_gl_api_get(Evas_GL_API *funcs)
2544{ 2764{
2545 funcs->version = EVAS_GL_API_VERSION; 2765 funcs->version = EVAS_GL_API_VERSION;
2546 2766
2547#define ORD(f) EVAS_API_OVERRIDE(f, funcs, evgl_) 2767#define ORD(f) EVAS_API_OVERRIDE(f, funcs, _evgld_)
2548 // GLES 2.0 2768 // GLES 2.0
2549 ORD(glActiveTexture); 2769 ORD(glActiveTexture);
2550 ORD(glAttachShader); 2770 ORD(glAttachShader);
@@ -2694,3 +2914,11 @@ _evgl_api_get(Evas_GL_API *funcs)
2694 evgl_api_ext_get(funcs); 2914 evgl_api_ext_get(funcs);
2695} 2915}
2696 2916
2917void
2918_evgl_api_get(Evas_GL_API *funcs, int debug)
2919{
2920 if (debug)
2921 _debug_gl_api_get(funcs);
2922 else
2923 _normal_gl_api_get(funcs);
2924}
diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_core.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_core.c
index f6b27f1..6e09b49 100755
--- a/legacy/evas/src/modules/engines/gl_common/evas_gl_core.c
+++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_core.c
@@ -11,6 +11,7 @@ typedef struct _GL_Format
11// Globals 11// Globals
12static Evas_GL_API gl_funcs; 12static Evas_GL_API gl_funcs;
13EVGL_Engine *evgl_engine = NULL; 13EVGL_Engine *evgl_engine = NULL;
14int _evas_gl_log_dom = -1;
14 15
15static void _surface_cap_print(EVGL_Engine *ee, int error); 16static void _surface_cap_print(EVGL_Engine *ee, int error);
16 17
@@ -159,8 +160,6 @@ _internal_resources_create(EVGL_Engine *ee)
159 goto error; 160 goto error;
160 } 161 }
161 162
162
163 //rsc->surface = ee->funcs->surface_create(ee->engine_data);
164 if (!rsc->surface) 163 if (!rsc->surface)
165 { 164 {
166 ERR("Internal resource surface failed."); 165 ERR("Internal resource surface failed.");
@@ -924,7 +923,7 @@ _internal_config_set(EVGL_Engine *ee, EVGL_Surface *sfc, Evas_GL_Config *cfg)
924 sfc->msaa_samples = ee->caps.fbo_fmts[i].samples; 923 sfc->msaa_samples = ee->caps.fbo_fmts[i].samples;
925 924
926 // Direct Rendering Option 925 // Direct Rendering Option
927 if (!stencil_bit) 926 if ( (!stencil_bit) || (ee->direct_override) )
928 sfc->direct_fb_opt = cfg->options_bits & EVAS_GL_OPTIONS_DIRECT; 927 sfc->direct_fb_opt = cfg->options_bits & EVAS_GL_OPTIONS_DIRECT;
929 928
930 cfg_index = i; 929 cfg_index = i;
@@ -952,6 +951,22 @@ _internal_config_set(EVGL_Engine *ee, EVGL_Surface *sfc, Evas_GL_Config *cfg)
952 } 951 }
953} 952}
954 953
954static int
955_evgl_direct_renderable(EVGL_Engine *ee, EVGL_Context *ctx, EVGL_Surface *sfc)
956{
957 EVGL_Resource *rsc;
958
959 if (!(rsc=_evgl_tls_resource_get(ee))) return 0;
960
961 if (ee->force_direct_off) return 0;
962 if (rsc->id != ee->main_tid) return 0;
963 if (!ctx) return 0;
964 if (!sfc->direct_fb_opt) return 0;
965 if (!rsc->direct_img_obj) return 0;
966
967 return 1;
968}
969
955//---------------------------------------------------------------// 970//---------------------------------------------------------------//
956// Retrieve the internal resource object from TLS 971// Retrieve the internal resource object from TLS
957//---------------------------------------------------------------// 972//---------------------------------------------------------------//
@@ -1010,9 +1025,18 @@ _evgl_current_context_get()
1010EVGL_Engine * 1025EVGL_Engine *
1011evgl_engine_create(EVGL_Interface *efunc, void *engine_data) 1026evgl_engine_create(EVGL_Interface *efunc, void *engine_data)
1012{ 1027{
1013 int direct_off = 0; 1028 int direct_off = 0, debug_mode = 0;
1014 char *s = NULL; 1029 char *s = NULL;
1015 1030
1031 // Initialize Log Domain
1032 if (_evas_gl_log_dom < 0)
1033 _evas_gl_log_dom = eina_log_domain_register("EvasGL", EVAS_DEFAULT_LOG_COLOR);
1034 if (_evas_gl_log_dom < 0)
1035 {
1036 EINA_LOG_ERR("Can not create a module log domain.");
1037 return NULL;
1038 }
1039
1016 // Check the validity of the efunc 1040 // Check the validity of the efunc
1017 if ((!efunc) || 1041 if ((!efunc) ||
1018 (!efunc->surface_create) || 1042 (!efunc->surface_create) ||
@@ -1072,6 +1096,14 @@ evgl_engine_create(EVGL_Interface *efunc, void *engine_data)
1072 if (direct_off == 1) 1096 if (direct_off == 1)
1073 evgl_engine->force_direct_off = 1; 1097 evgl_engine->force_direct_off = 1;
1074 1098
1099 // Check if API Debug mode is on
1100 s = getenv("EVAS_GL_API_DEBUG");
1101 if (s) debug_mode = atoi(s);
1102 if (debug_mode == 1)
1103 evgl_engine->api_debug_mode = 1;
1104
1105
1106 // Maint Thread ID (get tid not available in eina thread yet)
1075 evgl_engine->main_tid = 0; 1107 evgl_engine->main_tid = 0;
1076 1108
1077 // Clear Function Pointers 1109 // Clear Function Pointers
@@ -1098,7 +1130,12 @@ int evgl_engine_destroy(EVGL_Engine *ee)
1098 ERR("EVGL Engine not valid!"); 1130 ERR("EVGL Engine not valid!");
1099 return 0; 1131 return 0;
1100 } 1132 }
1101 1133
1134 // Log
1135 if (_evas_gl_log_dom >= 0) return 0;
1136 eina_log_domain_unregister(_evas_gl_log_dom);
1137 _evas_gl_log_dom = -1;
1138
1102 // Destroy internal resources 1139 // Destroy internal resources
1103 _internal_resources_destroy(ee); 1140 _internal_resources_destroy(ee);
1104 1141
@@ -1147,6 +1184,15 @@ evgl_surface_create(EVGL_Engine *ee, Evas_GL_Config *cfg, int w, int h)
1147 return NULL; 1184 return NULL;
1148 } 1185 }
1149 1186
1187 // Check for Direct rendering override env var.
1188 if (!ee->direct_override)
1189 if ((s = getenv("EVAS_GL_DIRECT_OVERRIDE")))
1190 {
1191 direct_override = atoi(s);
1192 if (direct_override == 1)
1193 ee->direct_override = 1;
1194 }
1195
1150 // Allocate surface structure 1196 // Allocate surface structure
1151 sfc = calloc(1, sizeof(EVGL_Surface)); 1197 sfc = calloc(1, sizeof(EVGL_Surface));
1152 if (!sfc) 1198 if (!sfc)
@@ -1173,14 +1219,6 @@ evgl_surface_create(EVGL_Engine *ee, Evas_GL_Config *cfg, int w, int h)
1173 goto error; 1219 goto error;
1174 }; 1220 };
1175 1221
1176 if (!ee->direct_override)
1177 if ((s = getenv("EVAS_GL_DIRECT_OVERRIDE")))
1178 {
1179 direct_override = atoi(s);
1180 if (direct_override == 1)
1181 ee->direct_override = 1;
1182 }
1183
1184 return sfc; 1222 return sfc;
1185 1223
1186error: 1224error:
@@ -1210,8 +1248,16 @@ evgl_surface_destroy(EVGL_Engine *ee, EVGL_Surface *sfc)
1210 1248
1211 if ((rsc->current_ctx) && (rsc->current_ctx->current_sfc == sfc) ) 1249 if ((rsc->current_ctx) && (rsc->current_ctx->current_sfc == sfc) )
1212 { 1250 {
1213 ERR("The surface is still current before it's being destroyed."); 1251 if (ee->api_debug_mode)
1214 ERR("Doing make_current(NULL, NULL)"); 1252 {
1253 ERR("The surface is still current before it's being destroyed.");
1254 ERR("Doing make_current(NULL, NULL)");
1255 }
1256 else
1257 {
1258 WRN("The surface is still current before it's being destroyed.");
1259 WRN("Doing make_current(NULL, NULL)");
1260 }
1215 evgl_make_current(ee, NULL, NULL); 1261 evgl_make_current(ee, NULL, NULL);
1216 } 1262 }
1217 1263
@@ -1379,22 +1425,8 @@ evgl_make_current(EVGL_Engine *ee, EVGL_Surface *sfc, EVGL_Context *ctx)
1379 if (!ctx->surface_fbo) 1425 if (!ctx->surface_fbo)
1380 glGenFramebuffers(1, &ctx->surface_fbo); 1426 glGenFramebuffers(1, &ctx->surface_fbo);
1381 1427
1382 // Attach fbo and the buffers
1383 if (ctx->current_sfc != sfc)
1384 {
1385 if (!_surface_buffers_fbo_set(sfc, ctx->surface_fbo))
1386 {
1387 ERR("Attaching buffers to context fbo failed. Engine: %p Surface: %p Context FBO: %u", ee, sfc, ctx->surface_fbo);
1388 return 0;
1389 }
1390
1391 // Bind to the previously bound buffer
1392 if (ctx->current_fbo)
1393 glBindFramebuffer(GL_FRAMEBUFFER, ctx->current_fbo);
1394 }
1395
1396 // Direct Rendering 1428 // Direct Rendering
1397 if (evgl_direct_enabled(ee)) 1429 if (_evgl_direct_renderable(ee, ctx, sfc))
1398 { 1430 {
1399 // This is to transition from FBO rendering to direct rendering 1431 // This is to transition from FBO rendering to direct rendering
1400 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &curr_fbo); 1432 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &curr_fbo);
@@ -1403,10 +1435,28 @@ evgl_make_current(EVGL_Engine *ee, EVGL_Surface *sfc, EVGL_Context *ctx)
1403 glBindFramebuffer(GL_FRAMEBUFFER, 0); 1435 glBindFramebuffer(GL_FRAMEBUFFER, 0);
1404 ctx->current_fbo = 0; 1436 ctx->current_fbo = 0;
1405 } 1437 }
1438 rsc->direct_enabled = 1;
1406 } 1439 }
1440 else
1441 {
1442 // Attach fbo and the buffers
1443 if (ctx->current_sfc != sfc)
1444 {
1445 if (!_surface_buffers_fbo_set(sfc, ctx->surface_fbo))
1446 {
1447 ERR("Attaching buffers to context fbo failed. Engine: %p Surface: %p Context FBO: %u", ee, sfc, ctx->surface_fbo);
1448 return 0;
1449 }
1407 1450
1408 ctx->current_sfc = sfc; 1451 // Bind to the previously bound buffer
1452 if (ctx->current_fbo)
1453 glBindFramebuffer(GL_FRAMEBUFFER, ctx->current_fbo);
1454 }
1455
1456 rsc->direct_enabled = 0;
1457 }
1409 1458
1459 ctx->current_sfc = sfc;
1410 rsc->current_ctx = ctx; 1460 rsc->current_ctx = ctx;
1411 1461
1412 return 1; 1462 return 1;
@@ -1457,23 +1507,30 @@ evgl_native_surface_get(EVGL_Engine *ee, EVGL_Surface *sfc, Evas_Native_Surface
1457} 1507}
1458 1508
1459int 1509int
1460evgl_direct_enabled(EVGL_Engine *ee) 1510_evgl_not_in_pixel_get(EVGL_Engine *ee)
1461{ 1511{
1462 EVGL_Resource *rsc; 1512 EVGL_Resource *rsc;
1463 1513
1464 if (!(rsc=_evgl_tls_resource_get(ee))) return 0; 1514 if (!(rsc=_evgl_tls_resource_get(ee))) return 1;
1465 1515
1466 EVGL_Context *ctx = rsc->current_ctx; 1516 EVGL_Context *ctx = rsc->current_ctx;
1467 1517
1468 if (ee->force_direct_off) return 0; 1518 if ((!ee->force_direct_off) && (rsc->id == ee->main_tid) &&
1519 (ctx) && (ctx->current_sfc) && (ctx->current_sfc->direct_fb_opt) &&
1520 (!rsc->direct_img_obj))
1521 return 1;
1522 else
1523 return 0;
1524}
1469 1525
1470 if (rsc->id != ee->main_tid) return 0; 1526int
1471 if (!ctx) return 0; 1527evgl_direct_enabled(EVGL_Engine *ee)
1472 if (!ctx->current_sfc) return 0; 1528{
1473 if (!ctx->current_sfc->direct_fb_opt) return 0; 1529 EVGL_Resource *rsc;
1474 if (!rsc->direct_img_obj) return 0; 1530
1475 1531 if (!(rsc=_evgl_tls_resource_get(ee))) return 0;
1476 return 1; 1532
1533 return rsc->direct_enabled;
1477} 1534}
1478 1535
1479void 1536void
@@ -1497,9 +1554,9 @@ evgl_direct_img_obj_get(EVGL_Engine *ee)
1497} 1554}
1498 1555
1499Evas_GL_API * 1556Evas_GL_API *
1500evgl_api_get(EVGL_Engine *ee __UNUSED__) 1557evgl_api_get(EVGL_Engine *ee)
1501{ 1558{
1502 _evgl_api_get(&gl_funcs); 1559 _evgl_api_get(&gl_funcs, ee->api_debug_mode);
1503 1560
1504 return &gl_funcs; 1561 return &gl_funcs;
1505} 1562}
diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_core_private.h b/legacy/evas/src/modules/engines/gl_common/evas_gl_core_private.h
index 069495f..838e8f5 100755
--- a/legacy/evas/src/modules/engines/gl_common/evas_gl_core_private.h
+++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_core_private.h
@@ -8,6 +8,33 @@
8 8
9//#include "evas_gl_ext.h" 9//#include "evas_gl_ext.h"
10 10
11extern int _evas_gl_log_dom;
12
13#ifdef ERR
14# undef ERR
15#endif
16#define ERR(...) EINA_LOG_DOM_ERR(_evas_gl_log_dom, __VA_ARGS__)
17
18#ifdef DBG
19# undef DBG
20#endif
21#define DBG(...) EINA_LOG_DOM_DBG(_evas_gl_log_dom, __VA_ARGS__)
22#ifdef INF
23# undef INF
24#endif
25#define INF(...) EINA_LOG_DOM_INFO(_evas_gl_log_dom, __VA_ARGS__)
26
27#ifdef WRN
28# undef WRN
29#endif
30#define WRN(...) EINA_LOG_DOM_WARN(_evas_gl_log_dom, __VA_ARGS__)
31
32#ifdef CRIT
33# undef CRIT
34#endif
35#define CRIT(...) EINA_LOG_DOM_CRIT(_evas_gl_log_dom, __VA_ARGS__)
36
37
11struct _EVGL_Interface 38struct _EVGL_Interface
12{ 39{
13 // Returns the native display of evas engine. 40 // Returns the native display of evas engine.
@@ -68,7 +95,6 @@ struct _EVGL_Surface
68 95
69 // Direct Rendering Option 96 // Direct Rendering Option
70 int direct_fb_opt; 97 int direct_fb_opt;
71 //int direct_override;
72 98
73 int cfg_index; 99 int cfg_index;
74 100
@@ -76,9 +102,6 @@ struct _EVGL_Surface
76 int fbo_attached; 102 int fbo_attached;
77 //-------------------------// 103 //-------------------------//
78 104
79 int direct_enabled;
80 Evas_Object *direct_img_obj;
81
82 EVGL_Context *current_ctx; 105 EVGL_Context *current_ctx;
83}; 106};
84 107
@@ -173,8 +196,8 @@ struct _EVGL_Resource
173 EVGLNative_Surface surface; 196 EVGLNative_Surface surface;
174 197
175 EVGL_Context *current_ctx; 198 EVGL_Context *current_ctx;
176 //EVGL_Surface *current_sfc;
177 199
200 int direct_enabled;
178 Evas_Object *direct_img_obj; 201 Evas_Object *direct_img_obj;
179}; 202};
180 203
@@ -206,6 +229,7 @@ struct _EVGL_Engine
206 229
207 230
208 int direct_override; 231 int direct_override;
232 int api_debug_mode;
209 233
210 // Force Off fo Debug purposes 234 // Force Off fo Debug purposes
211 int force_direct_off; 235 int force_direct_off;
@@ -213,12 +237,14 @@ struct _EVGL_Engine
213 void *engine_data; 237 void *engine_data;
214}; 238};
215 239
240
216// Evas GL Engine 241// Evas GL Engine
217extern EVGL_Engine *evgl_engine; 242extern EVGL_Engine *evgl_engine;
218 243
219// Internally used functions 244// Internally used functions
220extern void _evgl_api_get(Evas_GL_API *api); 245extern void _evgl_api_get(Evas_GL_API *api, int debug);
221extern EVGL_Resource *_evgl_tls_resource_get(); 246extern EVGL_Resource *_evgl_tls_resource_get(EVGL_Engine *ee);
222extern EVGL_Context *_evgl_current_context_get(); 247extern EVGL_Context *_evgl_current_context_get();
248extern int _evgl_not_in_pixel_get();
223 249
224#endif //_EVAS_GL_CORE_PRIVATE_H 250#endif //_EVAS_GL_CORE_PRIVATE_H