+++ /dev/null
-#include "evas_gl_core_private.h"
-#include "evas_gl_api_ext.h"
-
-#define EVGL_FUNC_BEGIN() \
-{ \
- _func_begin_debug(__FUNCTION__); \
-}
-
-#define EVGL_FUNC_END() GLERRV(__FUNCTION__)
-#define _EVGL_INT_INIT_VALUE -3
-
-#ifdef GL_ERRORS
-#undef glActiveTexture
-#undef glBindAttribLocation
-#undef glBindBuffer
-#undef glBindTexture
-#undef glBlendFunc
-#undef glBufferData
-#undef glCompressedTexImage2D
-#undef glCompressedTexSubImage2D
-#undef glDeleteBuffers
-#undef glDepthMask
-#undef glDisable
-#undef glDisableVertexAttribArray
-#undef glDrawArrays
-#undef glEnable
-#undef glEnableVertexAttribArray
-#undef glGenBuffers
-#undef glGetFloatv
-#undef glGetIntegerv
-#undef glGetUniformLocation
-#undef glHint
-#undef glReadPixels
-#undef glScissor
-#undef glGenFramebuffers
-#undef glGenFramebuffers
-#undef glBindFramebuffer
-#undef glEndTiling
-#undef glGetProgramBinary
-#undef glMapBuffer
-#undef glPixelStorei
-#undef glStartTiling
-#undef glUnmapBuffer
-#undef glTexParameterf
-#undef glTexParameteri
-#undef glTexSubImage2D
-#undef glUniform1f
-#undef glUniform1i
-#undef glUniform2fv
-#undef glUniform4fv
-#undef glUniformMatrix4fv
-#undef glUseProgram
-#undef glVertexAttribPointer
-#undef glViewport
-#undef glCreateShader
-#undef glCreateProgram
-#undef glAttachShader
-#undef glLinkProgram
-#undef glGetProgramiv
-#undef glGetProgramInfoLog
-#undef glGetShaderiv
-#undef glShaderSource
-#undef glCompileShader
-#endif
-
-//---------------------------------------//
-// API Debug Error Checking Code
-static
-void _make_current_check(const char* api)
-{
- EVGL_Context *ctx = NULL;
-
- ctx = evas_gl_common_current_context_get();
-
- if (!ctx)
- CRI("\e[1;33m%s\e[m: Current Context NOT SET: GL Call Should NOT Be Called without MakeCurrent!!!", api);
- else if (ctx->version != EVAS_GL_GLES_2_X)
- CRI("\e[1;33m%s\e[m: This API is being called with the wrong context (invalid version).", api);
-}
-
-static
-void _direct_rendering_check(const char *api)
-{
- EVGL_Context *ctx = NULL;
-
- ctx = evas_gl_common_current_context_get();
- if (!ctx)
- {
- ERR("Current Context Not Set");
- return;
- }
-
- if (_evgl_not_in_pixel_get())
- {
- CRI("\e[1;33m%s\e[m: This API is being called outside Pixel Get Callback Function.", api);
- }
-}
-
-static
-void _func_begin_debug(const char *api)
-{
- _make_current_check(api);
- _direct_rendering_check(api);
-}
-
-//-------------------------------------------------------------//
-// GL to GLES Compatibility Functions
-//-------------------------------------------------------------//
-void
-_evgl_glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- EVGL_Context *ctx = NULL;
- EVGL_Resource *rsc;
-
- rsc = _evgl_tls_resource_get();
- ctx = evas_gl_common_current_context_get();
-
- if (!ctx)
- {
- ERR("No current context set.");
- return;
- }
- if (!rsc)
- {
- ERR("No current TLS resource.");
- return;
- }
-
- // Take care of BindFramebuffer 0 issue
- if (framebuffer==0)
- {
- if (_evgl_direct_enabled())
- {
- glBindFramebuffer(target, 0);
-
- if (rsc->direct.partial.enabled)
- {
- if (!ctx->partial_render)
- {
- evgl_direct_partial_render_start();
- ctx->partial_render = 1;
- }
- }
- }
- else
- {
- glBindFramebuffer(target, ctx->surface_fbo);
- }
- ctx->current_fbo = 0;
- }
- else
- {
- if (_evgl_direct_enabled())
- {
- if (ctx->current_fbo == 0)
- {
- if (rsc->direct.partial.enabled)
- evgl_direct_partial_render_end();
- }
- }
-
- glBindFramebuffer(target, framebuffer);
-
- // Save this for restore when doing make current
- ctx->current_fbo = framebuffer;
- }
-}
-
-void
-_evgl_glClearDepthf(GLclampf depth)
-{
-#ifdef GL_GLES
- glClearDepthf(depth);
-#else
- glClearDepth(depth);
-#endif
-}
-
-void
-_evgl_glDepthRangef(GLclampf zNear, GLclampf zFar)
-{
-#ifdef GL_GLES
- glDepthRangef(zNear, zFar);
-#else
- glDepthRange(zNear, zFar);
-#endif
-}
-
-void
-_evgl_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
-{
-#ifdef GL_GLES
- glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
-#else
- if (range)
- {
- range[0] = -126; // floor(log2(FLT_MIN))
- range[1] = 127; // floor(log2(FLT_MAX))
- }
- if (precision)
- {
- precision[0] = 24; // floor(-log2((1.0/16777218.0)));
- }
- return;
- if (shadertype) shadertype = precisiontype = 0;
-#endif
-}
-
-void
-_evgl_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
-{
-#ifdef GL_GLES
- glShaderBinary(n, shaders, binaryformat, binary, length);
-#else
- // FIXME: need to dlsym/getprocaddress for this
- ERR("Binary Shader is not supported here yet.");
- (void)n;
- (void)shaders;
- (void)binaryformat;
- (void)binary;
- (void)length;
-#endif
-}
-
-void
-_evgl_glReleaseShaderCompiler(void)
-{
-#ifdef GL_GLES
- glReleaseShaderCompiler();
-#else
-#endif
-}
-
-
-//-------------------------------------------------------------//
-// Calls related to Evas GL Direct Rendering
-//-------------------------------------------------------------//
-// Transform from Evas Coordinat to GL Coordinate
-// returns: imgc[4] (oc[4]) original image object dimension in gl coord
-// returns: objc[4] (nc[4]) tranformed (x, y, width, heigth) in gl coord
-// returns: cc[4] cliped coordinate in original coordinate
-void
-compute_gl_coordinates(int win_w, int win_h, int rot, int clip_image,
- int x, int y, int width, int height,
- int img_x, int img_y, int img_w, int img_h,
- int clip_x, int clip_y, int clip_w, int clip_h,
- int imgc[4], int objc[4], int cc[4])
-{
- if (rot == 0)
- {
- // oringinal image object coordinate in gl coordinate
- imgc[0] = img_x;
- imgc[1] = win_h - img_y - img_h;
- imgc[2] = imgc[0] + img_w;
- imgc[3] = imgc[1] + img_h;
-
- // clip coordinates in gl coordinate
- cc[0] = clip_x;
- cc[1] = win_h - clip_y - clip_h;
- cc[2] = cc[0] + clip_w;
- cc[3] = cc[1] + clip_h;
-
- // transformed (x,y,width,height) in gl coordinate
- objc[0] = imgc[0] + x;
- objc[1] = imgc[1] + y;
- objc[2] = objc[0] + width;
- objc[3] = objc[1] + height;
- }
- else if (rot == 180)
- {
- // oringinal image object coordinate in gl coordinate
- imgc[0] = win_w - img_x - img_w;
- imgc[1] = img_y;
- imgc[2] = imgc[0] + img_w;
- imgc[3] = imgc[1] + img_h;
-
- // clip coordinates in gl coordinate
- cc[0] = win_w - clip_x - clip_w;
- cc[1] = clip_y;
- cc[2] = cc[0] + clip_w;
- cc[3] = cc[1] + clip_h;
-
- // transformed (x,y,width,height) in gl coordinate
- objc[0] = imgc[0] + img_w - x - width;
- objc[1] = imgc[1] + img_h - y - height;
- objc[2] = objc[0] + width;
- objc[3] = objc[1] + height;
-
- }
- else if (rot == 90)
- {
- // oringinal image object coordinate in gl coordinate
- imgc[0] = img_y;
- imgc[1] = img_x;
- imgc[2] = imgc[0] + img_h;
- imgc[3] = imgc[1] + img_w;
-
- // clip coordinates in gl coordinate
- cc[0] = clip_y;
- cc[1] = clip_x;
- cc[2] = cc[0] + clip_h;
- cc[3] = cc[1] + clip_w;
-
- // transformed (x,y,width,height) in gl coordinate
- objc[0] = imgc[0] + img_h - y - height;
- objc[1] = imgc[1] + x;
- objc[2] = objc[0] + height;
- objc[3] = objc[1] + width;
- }
- else if (rot == 270)
- {
- // oringinal image object coordinate in gl coordinate
- imgc[0] = win_h - img_y - img_h;
- imgc[1] = win_w - img_x - img_w;
- imgc[2] = imgc[0] + img_h;
- imgc[3] = imgc[1] + img_w;
-
- // clip coordinates in gl coordinate
- cc[0] = win_h - clip_y - clip_h;
- cc[1] = win_w - clip_x - clip_w;
- cc[2] = cc[0] + clip_h;
- cc[3] = cc[1] + clip_w;
-
- // transformed (x,y,width,height) in gl coordinate
- objc[0] = imgc[0] + y;
- objc[1] = imgc[1] + img_w - x - width;
- objc[2] = objc[0] + height;
- objc[3] = objc[1] + width;
- }
- else
- {
- ERR("Invalid rotation angle %d.", rot);
- return;
- }
-
- if (clip_image)
- {
- // Clip against original image object
- if (objc[0] < imgc[0]) objc[0] = imgc[0];
- if (objc[0] > imgc[2]) objc[0] = imgc[2];
-
- if (objc[1] < imgc[1]) objc[1] = imgc[1];
- if (objc[1] > imgc[3]) objc[1] = imgc[3];
-
- if (objc[2] < imgc[0]) objc[2] = imgc[0];
- if (objc[2] > imgc[2]) objc[2] = imgc[2];
-
- if (objc[3] < imgc[1]) objc[3] = imgc[1];
- if (objc[3] > imgc[3]) objc[3] = imgc[3];
- }
-
- imgc[2] = imgc[2]-imgc[0]; // width
- imgc[3] = imgc[3]-imgc[1]; // height
-
- objc[2] = objc[2]-objc[0]; // width
- objc[3] = objc[3]-objc[1]; // height
-
- cc[2] = cc[2]-cc[0]; // width
- cc[3] = cc[3]-cc[1]; // height
-
- //DBG( "\e[1;32m Img[%d %d %d %d] Original [%d %d %d %d] Transformed[%d %d %d %d] Clip[%d %d %d %d] Clipped[%d %d %d %d] \e[m", img_x, img_y, img_w, img_h, imgc[0], imgc[1], imgc[2], imgc[3], objc[0], objc[1], objc[2], objc[3], clip[0], clip[1], clip[2], clip[3], cc[0], cc[1], cc[2], cc[3]);
-}
-
-static void
-_evgl_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- EVGL_Resource *rsc;
-
- if (!(rsc=_evgl_tls_resource_get()))
- {
- ERR("Unable to execute GL command. Error retrieving tls");
- return;
- }
-
- if (_evgl_direct_enabled())
- {
- rsc->clear_color.a = alpha;
- rsc->clear_color.r = red;
- rsc->clear_color.g = green;
- rsc->clear_color.b = blue;
- }
- glClearColor(red, green, blue, alpha);
-}
-
-static void
-_evgl_glClear(GLbitfield mask)
-{
- EVGL_Resource *rsc;
- EVGL_Context *ctx;
- int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
- int cc[4] = {0,0,0,0};
-
- if (!(rsc=_evgl_tls_resource_get()))
- {
- ERR("Unable to execute GL command. Error retrieving tls");
- return;
- }
-
- if (!rsc->current_eng)
- {
- ERR("Unable to retrive Current Engine");
- return;
- }
-
- ctx = rsc->current_ctx;
- if (!ctx)
- {
- ERR("Unable to retrive Current Context");
- return;
- }
-
- if (_evgl_direct_enabled())
- {
- if (!(rsc->current_ctx->current_fbo))
- {
- /* Skip glClear() if clearing with transparent color
- * Note: There will be side effects if the object itself is not
- * marked as having an alpha channel!
- */
- if (ctx->current_sfc->alpha && (mask & GL_COLOR_BUFFER_BIT))
- {
- if ((rsc->clear_color.a == 0) &&
- (rsc->clear_color.r == 0) &&
- (rsc->clear_color.g == 0) &&
- (rsc->clear_color.b == 0))
- {
- // Skip clear color as we don't want to write black
- mask &= ~GL_COLOR_BUFFER_BIT;
- }
- else if (rsc->clear_color.a != 1.0)
- {
- // TODO: Draw a rectangle? This will never be the perfect solution though.
- WRN("glClear() used with a semi-transparent color and direct rendering. "
- "This will erase the previous contents of the evas!");
- }
- if (!mask) return;
- }
-
- if ((!ctx->direct_scissor))
- {
- glEnable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 1;
- }
-
- if ((ctx->scissor_updated) && (ctx->scissor_enabled))
- {
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 1,
- ctx->scissor_coord[0], ctx->scissor_coord[1],
- ctx->scissor_coord[2], ctx->scissor_coord[3],
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
-
- RECTS_CLIP_TO_RECT(nc[0], nc[1], nc[2], nc[3], cc[0], cc[1], cc[2], cc[3]);
- glScissor(nc[0], nc[1], nc[2], nc[3]);
- ctx->direct_scissor = 0;
- }
- else
- {
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 0,
- 0, 0, 0, 0,
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
- glScissor(cc[0], cc[1], cc[2], cc[3]);
- }
-
- glClear(mask);
-
- // TODO/FIXME: Restore previous client-side scissors.
- }
- else
- {
- if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
- {
- glDisable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 0;
- }
-
- glClear(mask);
- }
- }
- else
- {
- if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
- {
- glDisable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 0;
- }
-
- glClear(mask);
- }
-}
-
-static void
-_evgl_glEnable(GLenum cap)
-{
- EVGL_Context *ctx;
-
- ctx = evas_gl_common_current_context_get();
-
- if (ctx && (cap == GL_SCISSOR_TEST))
- {
- ctx->scissor_enabled = 1;
-
- if (_evgl_direct_enabled())
- {
- EVGL_Resource *rsc = _evgl_tls_resource_get();
- int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0}, cc[4] = {0,0,0,0};
-
- if (rsc)
- {
- if (!ctx->current_fbo)
- {
- // Direct rendering to canvas
- if (!ctx->scissor_updated)
- {
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 0,
- 0, 0, 0, 0,
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
- glScissor(cc[0], cc[1], cc[2], cc[3]);
- }
- else
- {
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 1,
- ctx->scissor_coord[0], ctx->scissor_coord[1],
- ctx->scissor_coord[2], ctx->scissor_coord[3],
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
- glScissor(nc[0], nc[1], nc[2], nc[3]);
- }
- ctx->direct_scissor = 1;
- }
- }
- else
- {
- // Bound to an FBO, reset scissors to user data
- if (ctx->scissor_updated)
- {
- glScissor(ctx->scissor_coord[0], ctx->scissor_coord[1],
- ctx->scissor_coord[2], ctx->scissor_coord[3]);
- }
- else if (ctx->direct_scissor)
- {
- // Back to the default scissors (here: max texture size)
- glScissor(0, 0, evgl_engine->caps.max_w, evgl_engine->caps.max_h);
- }
- ctx->direct_scissor = 0;
- }
-
- glEnable(GL_SCISSOR_TEST);
- return;
- }
- }
-
- glEnable(cap);
-}
-
-static void
-_evgl_glDisable(GLenum cap)
-{
- EVGL_Context *ctx;
-
- ctx = evas_gl_common_current_context_get();
-
- if (ctx && (cap == GL_SCISSOR_TEST))
- {
- ctx->scissor_enabled = 0;
-
- if (_evgl_direct_enabled())
- {
- if (!ctx->current_fbo)
- {
- // Restore default scissors for direct rendering
- int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0}, cc[4] = {0,0,0,0};
- EVGL_Resource *rsc = _evgl_tls_resource_get();
-
- if (rsc)
- {
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 1,
- 0, 0, rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
-
- RECTS_CLIP_TO_RECT(nc[0], nc[1], nc[2], nc[3], cc[0], cc[1], cc[2], cc[3]);
- glScissor(nc[0], nc[1], nc[2], nc[3]);
-
- ctx->direct_scissor = 1;
- glEnable(GL_SCISSOR_TEST);
- }
- }
- else
- {
- // Bound to an FBO, disable scissors for real
- ctx->direct_scissor = 0;
- glDisable(GL_SCISSOR_TEST);
- }
- return;
- }
- }
-
- glDisable(cap);
-}
-
-void
-_evgl_glGetIntegerv(GLenum pname, GLint* params)
-{
- EVGL_Resource *rsc;
- EVGL_Context *ctx;
-
- if (_evgl_direct_enabled())
- {
- if (!params)
- {
- ERR("Invalid Parameter");
- return;
- }
-
- if (!(rsc=_evgl_tls_resource_get()))
- {
- ERR("Unable to execute GL command. Error retrieving tls");
- return;
- }
-
- ctx = rsc->current_ctx;
- if (!ctx)
- {
- ERR("Unable to retrive Current Context");
- return;
- }
-
- // Only need to handle it if it's directly rendering to the window
- if (!(rsc->current_ctx->current_fbo))
- {
- if (pname == GL_SCISSOR_BOX)
- {
- if (ctx->scissor_updated)
- {
- memcpy(params, ctx->scissor_coord, sizeof(int)*4);
- return;
- }
- }
- else if (pname == GL_VIEWPORT)
- {
- if (ctx->viewport_updated)
- {
- memcpy(params, ctx->viewport_coord, sizeof(int)*4);
- return;
- }
- }
-
- // If it hasn't been initialized yet, return img object size
- if ((pname == GL_SCISSOR_BOX) || (pname == GL_VIEWPORT))
- {
- params[0] = 0;
- params[1] = 0;
- params[2] = (GLint)rsc->direct.img.w;
- params[3] = (GLint)rsc->direct.img.h;
- return;
- }
- }
- }
- else
- {
- if (pname == GL_FRAMEBUFFER_BINDING)
- {
- rsc = _evgl_tls_resource_get();
- ctx = rsc ? rsc->current_ctx : NULL;
- if (ctx)
- {
- *params = ctx->current_fbo;
- return;
- }
- }
- }
-
- glGetIntegerv(pname, params);
-}
-
-static const GLubyte *
-_evgl_glGetString(GLenum name)
-{
- static char _version[128] = {0};
- static char _glsl[128] = {0};
- EVGL_Resource *rsc;
- const GLubyte *ret;
-
- /* We wrap two values here:
- *
- * VERSION: Since OpenGL ES 3 is not supported yet, we return OpenGL ES 2.0
- * The string is not modified on desktop GL (eg. 4.4.0 NVIDIA 343.22)
- * GLES 3 support is not exposed because apps can't use GLES 3 core
- * functions yet.
- *
- * EXTENSIONS: This should return only the list of GL extensions supported
- * by Evas GL. This means as many extensions as possible should be
- * added to the whitelist.
- */
-
- /*
- * Note from Khronos: "If an error is generated, glGetString returns 0."
- * I decided not to call glGetString if there is no context as this is
- * known to cause crashes on certain GL drivers (eg. Nvidia binary blob).
- * --> crash moved to app side if they blindly call strstr()
- */
-
- if ((!(rsc = _evgl_tls_resource_get())) || !rsc->current_ctx)
- {
- ERR("Current context is NULL, not calling glGetString");
- // This sets evas_gl_error_get instead of glGetError...
- evas_gl_common_error_set(NULL, EVAS_GL_BAD_CONTEXT);
- return NULL;
- }
-
- switch (name)
- {
- case GL_VENDOR:
- case GL_RENDERER:
- // Keep these as-is.
- break;
-
- case GL_SHADING_LANGUAGE_VERSION:
- ret = glGetString(GL_SHADING_LANGUAGE_VERSION);
- if (!ret) return NULL;
-#ifdef GL_GLES
- if (ret[15] != (GLubyte) '1')
- {
- // We try not to remove the vendor fluff
- snprintf(_glsl, sizeof(_glsl), "OpenGL ES GLSL ES 1.00 Evas GL (%s)", ((char *) ret) + 18);
- _glsl[sizeof(_glsl) - 1] = '\0';
- return (const GLubyte *) _glsl;
- }
- return ret;
-#else
- // Desktop GL, we still keep the official name
- snprintf(_glsl, sizeof(_glsl), "OpenGL ES GLSL ES 1.00 Evas GL (%s)", (char *) ret);
- _version[sizeof(_glsl) - 1] = '\0';
- return (const GLubyte *) _glsl;
-#endif
-
- case GL_VERSION:
- ret = glGetString(GL_VERSION);
- if (!ret) return NULL;
-#ifdef GL_GLES
- if (ret[11] != (GLubyte) '2')
- {
- // We try not to remove the vendor fluff
- snprintf(_version, sizeof(_version), "OpenGL ES 2.0 Evas GL (%s)", ((char *) ret) + 10);
- _version[sizeof(_version) - 1] = '\0';
- return (const GLubyte *) _version;
- }
- return ret;
-#else
- // Desktop GL, we still keep the official name
- snprintf(_version, sizeof(_version), "OpenGL ES 2.0 Evas GL (%s)", (char *) ret);
- _version[sizeof(_version) - 1] = '\0';
- return (const GLubyte *) _version;
-#endif
-
- case GL_EXTENSIONS:
- // No need to check context version, this is GLESv2 API.
- return (GLubyte *) evgl_api_ext_string_get(EINA_TRUE, EINA_FALSE);
-
- default:
- // GL_INVALID_ENUM is generated if name is not an accepted value.
- WRN("Unknown string requested: %x", (unsigned int) name);
- break;
- }
-
- return glGetString(name);
-}
-
-static void
-_evgl_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
-{
- EVGL_Resource *rsc;
- EVGL_Context *ctx;
- int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
- int cc[4] = {0,0,0,0};
-
-
- if (!(rsc=_evgl_tls_resource_get()))
- {
- ERR("Unable to execute GL command. Error retrieving tls");
- return;
- }
-
- if (!rsc->current_eng)
- {
- ERR("Unable to retrive Current Engine");
- return;
- }
-
- ctx = rsc->current_ctx;
- if (!ctx)
- {
- ERR("Unable to retrive Current Context");
- return;
- }
-
- if (_evgl_direct_enabled())
- {
-
- if (!(rsc->current_ctx->current_fbo))
- {
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 1,
- x, y, width, height,
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
- glReadPixels(nc[0], nc[1], nc[2], nc[3], format, type, pixels);
- }
- else
- {
- glReadPixels(x, y, width, height, format, type, pixels);
- }
- }
- else
- {
- glReadPixels(x, y, width, height, format, type, pixels);
- }
-}
-
-static void
-_evgl_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- EVGL_Resource *rsc;
- EVGL_Context *ctx;
- int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
- int cc[4] = {0,0,0,0};
-
- if (!(rsc=_evgl_tls_resource_get()))
- {
- ERR("Unable to execute GL command. Error retrieving tls");
- return;
- }
-
- if (!rsc->current_eng)
- {
- ERR("Unable to retrive Current Engine");
- return;
- }
-
- ctx = rsc->current_ctx;
- if (!ctx)
- {
- ERR("Unable to retrive Current Context");
- return;
- }
-
- if (_evgl_direct_enabled())
- {
- if (!(rsc->current_ctx->current_fbo))
- {
- // Direct rendering to canvas
- if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
- {
- glDisable(GL_SCISSOR_TEST);
- }
-
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 1,
- x, y, width, height,
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
-
- // Keep a copy of the original coordinates
- ctx->scissor_coord[0] = x;
- ctx->scissor_coord[1] = y;
- ctx->scissor_coord[2] = width;
- ctx->scissor_coord[3] = height;
-
- RECTS_CLIP_TO_RECT(nc[0], nc[1], nc[2], nc[3], cc[0], cc[1], cc[2], cc[3]);
- glScissor(nc[0], nc[1], nc[2], nc[3]);
-
- ctx->direct_scissor = 0;
-
- // Mark user scissor_coord as valid
- ctx->scissor_updated = 1;
- }
- else
- {
- // Bound to an FBO, use these new scissors
- if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
- {
- glDisable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 0;
- }
-
- glScissor(x, y, width, height);
-
- // Why did we set this flag to 0???
- //ctx->scissor_updated = 0;
- }
- }
- else
- {
- if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
- {
- glDisable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 0;
- }
-
- glScissor(x, y, width, height);
- }
-}
-
-static void
-_evgl_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- EVGL_Resource *rsc;
- EVGL_Context *ctx;
- int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
- int cc[4] = {0,0,0,0};
-
- if (!(rsc=_evgl_tls_resource_get()))
- {
- ERR("Unable to execute GL command. Error retrieving tls");
- return;
- }
-
- if (!rsc->current_eng)
- {
- ERR("Unable to retrive Current Engine");
- return;
- }
-
- ctx = rsc->current_ctx;
- if (!ctx)
- {
- ERR("Unable to retrive Current Context");
- return;
- }
-
- if (_evgl_direct_enabled())
- {
- if (!(rsc->current_ctx->current_fbo))
- {
- if ((!ctx->direct_scissor))
- {
- glEnable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 1;
- }
-
- if ((ctx->scissor_updated) && (ctx->scissor_enabled))
- {
- // Recompute the scissor coordinates
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 1,
- ctx->scissor_coord[0], ctx->scissor_coord[1],
- ctx->scissor_coord[2], ctx->scissor_coord[3],
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
-
- RECTS_CLIP_TO_RECT(nc[0], nc[1], nc[2], nc[3], cc[0], cc[1], cc[2], cc[3]);
- glScissor(nc[0], nc[1], nc[2], nc[3]);
-
- ctx->direct_scissor = 0;
-
- // Compute the viewport coordinate
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 0,
- x, y, width, height,
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
- glViewport(nc[0], nc[1], nc[2], nc[3]);
- }
- else
- {
-
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 0,
- x, y, width, height,
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
- glScissor(cc[0], cc[1], cc[2], cc[3]);
-
- glViewport(nc[0], nc[1], nc[2], nc[3]);
- }
-
- // Keep a copy of the original coordinates
- ctx->viewport_coord[0] = x;
- ctx->viewport_coord[1] = y;
- ctx->viewport_coord[2] = width;
- ctx->viewport_coord[3] = height;
-
- ctx->viewport_updated = 1;
- }
- else
- {
- if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
- {
- glDisable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 0;
- }
-
- glViewport(x, y, width, height);
- }
- }
- else
- {
- if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
- {
- glDisable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 0;
- }
-
- glViewport(x, y, width, height);
- }
-}
-//-------------------------------------------------------------//
-
-
-
-//-------------------------------------------------------------//
-// Debug Evas GL APIs
-// - GL APIs Overriden for debugging purposes
-//-------------------------------------------------------------//
-
-void
-_evgld_glActiveTexture(GLenum texture)
-{
- EVGL_FUNC_BEGIN();
- glActiveTexture(texture);
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glAttachShader(GLuint program, GLuint shader)
-{
- EVGL_FUNC_BEGIN();
- glAttachShader(program, shader);
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glBindAttribLocation(GLuint program, GLuint idx, const char* name)
-{
- EVGL_FUNC_BEGIN();
- glBindAttribLocation(program, idx, name);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glBindBuffer(GLenum target, GLuint buffer)
-{
- EVGL_FUNC_BEGIN();
- glBindBuffer(target, buffer);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- EVGL_FUNC_BEGIN();
-
- _evgl_glBindFramebuffer(target, framebuffer);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- EVGL_FUNC_BEGIN();
- glBindRenderbuffer(target, renderbuffer);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glBindTexture(GLenum target, GLuint texture)
-{
- EVGL_FUNC_BEGIN();
- glBindTexture(target, texture);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- EVGL_FUNC_BEGIN();
- glBlendColor(red, green, blue, alpha);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glBlendEquation(GLenum mode)
-{
- EVGL_FUNC_BEGIN();
- glBlendEquation(mode);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- EVGL_FUNC_BEGIN();
- glBlendEquationSeparate(modeRGB, modeAlpha);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- EVGL_FUNC_BEGIN();
- glBlendFunc(sfactor, dfactor);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- EVGL_FUNC_BEGIN();
- glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glBufferData(GLenum target, GLsizeiptr size, const void* data, GLenum usage)
-{
- EVGL_FUNC_BEGIN();
- glBufferData(target, size, data, usage);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void* data)
-{
- EVGL_FUNC_BEGIN();
- glBufferSubData(target, offset, size, data);
- GLERR();
- EVGL_FUNC_END();
-}
-
-GLenum
-_evgld_glCheckFramebufferStatus(GLenum target)
-{
- GLenum ret = GL_NONE;
-
- EVGL_FUNC_BEGIN();
- ret = glCheckFramebufferStatus(target);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-void
-_evgld_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- EVGL_FUNC_BEGIN();
- _evgl_glClearColor(red, green, blue, alpha);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glClearDepthf(GLclampf depth)
-{
- EVGL_FUNC_BEGIN();
-
- _evgl_glClearDepthf(depth);
- GLERR();
-
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glClearStencil(GLint s)
-{
- EVGL_FUNC_BEGIN();
- glClearStencil(s);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- EVGL_FUNC_BEGIN();
- glColorMask(red, green, blue, alpha);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glCompileShader(GLuint shader)
-{
- EVGL_FUNC_BEGIN();
- glCompileShader(shader);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data)
-{
- EVGL_FUNC_BEGIN();
- glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void* data)
-{
- EVGL_FUNC_BEGIN();
- glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- EVGL_FUNC_BEGIN();
- glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- EVGL_FUNC_BEGIN();
- glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
- GLERR();
- EVGL_FUNC_END();
-}
-
-GLuint
-_evgld_glCreateProgram(void)
-{
- GLuint ret = _EVGL_INT_INIT_VALUE;
-
- EVGL_FUNC_BEGIN();
- ret = glCreateProgram();
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-GLuint
-_evgld_glCreateShader(GLenum type)
-{
- GLuint ret = _EVGL_INT_INIT_VALUE;
- EVGL_FUNC_BEGIN();
- ret = glCreateShader(type);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-void
-_evgld_glCullFace(GLenum mode)
-{
- EVGL_FUNC_BEGIN();
- glCullFace(mode);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glDeleteBuffers(GLsizei n, const GLuint* buffers)
-{
- EVGL_FUNC_BEGIN();
- glDeleteBuffers(n, buffers);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
-{
- EVGL_FUNC_BEGIN();
- glDeleteFramebuffers(n, framebuffers);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glDeleteProgram(GLuint program)
-{
- EVGL_FUNC_BEGIN();
- glDeleteProgram(program);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
-{
- EVGL_FUNC_BEGIN();
- glDeleteRenderbuffers(n, renderbuffers);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glDeleteShader(GLuint shader)
-{
- EVGL_FUNC_BEGIN();
- glDeleteShader(shader);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glDeleteTextures(GLsizei n, const GLuint* textures)
-{
- EVGL_FUNC_BEGIN();
- glDeleteTextures(n, textures);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glDepthFunc(GLenum func)
-{
- EVGL_FUNC_BEGIN();
- glDepthFunc(func);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glDepthMask(GLboolean flag)
-{
- EVGL_FUNC_BEGIN();
- glDepthMask(flag);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glDepthRangef(GLclampf zNear, GLclampf zFar)
-{
- EVGL_FUNC_BEGIN();
-
- _evgl_glDepthRangef(zNear, zFar);
- GLERR();
-
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glDetachShader(GLuint program, GLuint shader)
-{
- EVGL_FUNC_BEGIN();
- glDetachShader(program, shader);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glDisableVertexAttribArray(GLuint idx)
-{
- EVGL_FUNC_BEGIN();
- glDisableVertexAttribArray(idx);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- EVGL_FUNC_BEGIN();
- glDrawArrays(mode, first, count);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glDrawElements(GLenum mode, GLsizei count, GLenum type, const void* indices)
-{
- EVGL_FUNC_BEGIN();
- glDrawElements(mode, count, type, indices);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glEnableVertexAttribArray(GLuint idx)
-{
- EVGL_FUNC_BEGIN();
- glEnableVertexAttribArray(idx);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glFinish(void)
-{
- EVGL_FUNC_BEGIN();
- glFinish();
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glFlush(void)
-{
- EVGL_FUNC_BEGIN();
- glFlush();
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- EVGL_FUNC_BEGIN();
- glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- EVGL_FUNC_BEGIN();
- glFramebufferTexture2D(target, attachment, textarget, texture, level);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glFrontFace(GLenum mode)
-{
- EVGL_FUNC_BEGIN();
- glFrontFace(mode);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetVertexAttribfv(GLuint idx, GLenum pname, GLfloat* params)
-{
- EVGL_FUNC_BEGIN();
- glGetVertexAttribfv(idx, pname, params);
-
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetVertexAttribiv(GLuint idx, GLenum pname, GLint* params)
-{
- EVGL_FUNC_BEGIN();
- glGetVertexAttribiv(idx, pname, params);
-
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetVertexAttribPointerv(GLuint idx, GLenum pname, void** pointer)
-{
- EVGL_FUNC_BEGIN();
- glGetVertexAttribPointerv(idx, pname, pointer);
-
- GLERR();
-
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glHint(GLenum target, GLenum mode)
-{
- EVGL_FUNC_BEGIN();
- glHint(target, mode);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGenBuffers(GLsizei n, GLuint* buffers)
-{
- EVGL_FUNC_BEGIN();
- glGenBuffers(n, buffers);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGenerateMipmap(GLenum target)
-{
- EVGL_FUNC_BEGIN();
- glGenerateMipmap(target);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGenFramebuffers(GLsizei n, GLuint* framebuffers)
-{
- EVGL_FUNC_BEGIN();
- glGenFramebuffers(n, framebuffers);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
-{
- EVGL_FUNC_BEGIN();
- glGenRenderbuffers(n, renderbuffers);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGenTextures(GLsizei n, GLuint* textures)
-{
- EVGL_FUNC_BEGIN();
- glGenTextures(n, textures);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetActiveAttrib(GLuint program, GLuint idx, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
-{
- EVGL_FUNC_BEGIN();
- glGetActiveAttrib(program, idx, bufsize, length, size, type, name);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetActiveUniform(GLuint program, GLuint idx, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
-{
- EVGL_FUNC_BEGIN();
- glGetActiveUniform(program, idx, bufsize, length, size, type, name);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
-{
- EVGL_FUNC_BEGIN();
- glGetAttachedShaders(program, maxcount, count, shaders);
- GLERR();
- EVGL_FUNC_END();
-}
-
-int
-_evgld_glGetAttribLocation(GLuint program, const char* name)
-{
- int ret = _EVGL_INT_INIT_VALUE;
- EVGL_FUNC_BEGIN();
- ret = glGetAttribLocation(program, name);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-void
-_evgld_glGetBooleanv(GLenum pname, GLboolean* params)
-{
- EVGL_FUNC_BEGIN();
- glGetBooleanv(pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- EVGL_FUNC_BEGIN();
- glGetBufferParameteriv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-GLenum
-_evgld_glGetError(void)
-{
- GLenum ret = GL_NONE;
-
- EVGL_FUNC_BEGIN();
- ret = glGetError();
- EVGL_FUNC_END();
- return ret;
-}
-
-void
-_evgld_glGetFloatv(GLenum pname, GLfloat* params)
-{
- EVGL_FUNC_BEGIN();
- glGetFloatv(pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
-{
- EVGL_FUNC_BEGIN();
- glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetProgramiv(GLuint program, GLenum pname, GLint* params)
-{
- EVGL_FUNC_BEGIN();
- glGetProgramiv(program, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, char* infolog)
-{
- EVGL_FUNC_BEGIN();
- glGetProgramInfoLog(program, bufsize, length, infolog);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- EVGL_FUNC_BEGIN();
- glGetRenderbufferParameteriv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
-{
- EVGL_FUNC_BEGIN();
- glGetShaderiv(shader, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, char* infolog)
-{
- EVGL_FUNC_BEGIN();
- glGetShaderInfoLog(shader, bufsize, length, infolog);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
-{
- EVGL_FUNC_BEGIN();
-
- _evgl_glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
- GLERR();
-
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, char* source)
-{
- EVGL_FUNC_BEGIN();
- glGetShaderSource(shader, bufsize, length, source);
- GLERR();
- EVGL_FUNC_END();
-}
-
-const GLubyte *
-_evgld_glGetString(GLenum name)
-{
- const GLubyte *ret = NULL;
-
- EVGL_FUNC_BEGIN();
- ret = _evgl_glGetString(name);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-void
-_evgld_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
-{
- EVGL_FUNC_BEGIN();
- glGetTexParameterfv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- EVGL_FUNC_BEGIN();
- glGetTexParameteriv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetUniformfv(GLuint program, GLint location, GLfloat* params)
-{
- EVGL_FUNC_BEGIN();
- glGetUniformfv(program, location, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetUniformiv(GLuint program, GLint location, GLint* params)
-{
- EVGL_FUNC_BEGIN();
- glGetUniformiv(program, location, params);
- GLERR();
- EVGL_FUNC_END();
-}
-int
-_evgld_glGetUniformLocation(GLuint program, const char* name)
-{
- int ret = _EVGL_INT_INIT_VALUE;
-
- EVGL_FUNC_BEGIN();
- ret = glGetUniformLocation(program, name);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-GLboolean
-_evgld_glIsBuffer(GLuint buffer)
-{
- GLboolean ret = GL_FALSE;
-
- EVGL_FUNC_BEGIN();
- ret = glIsBuffer(buffer);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-GLboolean
-_evgld_glIsEnabled(GLenum cap)
-{
- GLboolean ret = GL_FALSE;
-
- EVGL_FUNC_BEGIN();
- ret = glIsEnabled(cap);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-GLboolean
-_evgld_glIsFramebuffer(GLuint framebuffer)
-{
- GLboolean ret = GL_FALSE;
-
- EVGL_FUNC_BEGIN();
- ret = glIsFramebuffer(framebuffer);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-GLboolean
-_evgld_glIsProgram(GLuint program)
-{
- GLboolean ret;
- EVGL_FUNC_BEGIN();
- ret = glIsProgram(program);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-GLboolean
-_evgld_glIsRenderbuffer(GLuint renderbuffer)
-{
- GLboolean ret;
- EVGL_FUNC_BEGIN();
- ret = glIsRenderbuffer(renderbuffer);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-GLboolean
-_evgld_glIsShader(GLuint shader)
-{
- GLboolean ret;
- EVGL_FUNC_BEGIN();
- ret = glIsShader(shader);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-GLboolean
-_evgld_glIsTexture(GLuint texture)
-{
- GLboolean ret;
- EVGL_FUNC_BEGIN();
- ret = glIsTexture(texture);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-void
-_evgld_glLineWidth(GLfloat width)
-{
- EVGL_FUNC_BEGIN();
- glLineWidth(width);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glLinkProgram(GLuint program)
-{
- EVGL_FUNC_BEGIN();
- glLinkProgram(program);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glPixelStorei(GLenum pname, GLint param)
-{
- EVGL_FUNC_BEGIN();
- glPixelStorei(pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glPolygonOffset(GLfloat factor, GLfloat units)
-{
- EVGL_FUNC_BEGIN();
- glPolygonOffset(factor, units);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glReleaseShaderCompiler(void)
-{
- EVGL_FUNC_BEGIN();
-
- _evgl_glReleaseShaderCompiler();
- GLERR();
-
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- EVGL_FUNC_BEGIN();
- glRenderbufferStorage(target, internalformat, width, height);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glSampleCoverage(GLclampf value, GLboolean invert)
-{
- EVGL_FUNC_BEGIN();
- glSampleCoverage(value, invert);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const void* binary, GLsizei length)
-{
- EVGL_FUNC_BEGIN();
-
- _evgl_glShaderBinary(n, shaders, binaryformat, binary, length);
- GLERR();
-
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glShaderSource(GLuint shader, GLsizei count, const char* const * string, const GLint* length)
-{
- EVGL_FUNC_BEGIN();
-#ifdef GL_GLES
- glShaderSource(shader, count, (const GLchar * const *) string, length);
-#else
- glShaderSource(shader, count, (const GLchar **) string, length);
-#endif
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- EVGL_FUNC_BEGIN();
- glStencilFunc(func, ref, mask);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- EVGL_FUNC_BEGIN();
- glStencilFuncSeparate(face, func, ref, mask);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glStencilMask(GLuint mask)
-{
- EVGL_FUNC_BEGIN();
- glStencilMask(mask);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- EVGL_FUNC_BEGIN();
- glStencilMaskSeparate(face, mask);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- EVGL_FUNC_BEGIN();
- glStencilOp(fail, zfail, zpass);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
-{
- EVGL_FUNC_BEGIN();
- glStencilOpSeparate(face, fail, zfail, zpass);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void* pixels)
-{
- EVGL_FUNC_BEGIN();
- glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- EVGL_FUNC_BEGIN();
- glTexParameterf(target, pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
-{
- EVGL_FUNC_BEGIN();
- glTexParameterfv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- EVGL_FUNC_BEGIN();
- glTexParameteri(target, pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
-{
- EVGL_FUNC_BEGIN();
- glTexParameteriv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
-{
- EVGL_FUNC_BEGIN();
- glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform1f(GLint location, GLfloat x)
-{
- EVGL_FUNC_BEGIN();
- glUniform1f(location, x);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
-{
- EVGL_FUNC_BEGIN();
- glUniform1fv(location, count, v);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform1i(GLint location, GLint x)
-{
- EVGL_FUNC_BEGIN();
- glUniform1i(location, x);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform1iv(GLint location, GLsizei count, const GLint* v)
-{
- EVGL_FUNC_BEGIN();
- glUniform1iv(location, count, v);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform2f(GLint location, GLfloat x, GLfloat y)
-{
- EVGL_FUNC_BEGIN();
- glUniform2f(location, x, y);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
-{
- EVGL_FUNC_BEGIN();
- glUniform2fv(location, count, v);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform2i(GLint location, GLint x, GLint y)
-{
- EVGL_FUNC_BEGIN();
- glUniform2i(location, x, y);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform2iv(GLint location, GLsizei count, const GLint* v)
-{
- EVGL_FUNC_BEGIN();
- glUniform2iv(location, count, v);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
-{
- EVGL_FUNC_BEGIN();
- glUniform3f(location, x, y, z);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
-{
- EVGL_FUNC_BEGIN();
- glUniform3fv(location, count, v);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform3i(GLint location, GLint x, GLint y, GLint z)
-{
- EVGL_FUNC_BEGIN();
- glUniform3i(location, x, y, z);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform3iv(GLint location, GLsizei count, const GLint* v)
-{
- EVGL_FUNC_BEGIN();
- glUniform3iv(location, count, v);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- EVGL_FUNC_BEGIN();
- glUniform4f(location, x, y, z, w);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
-{
- EVGL_FUNC_BEGIN();
- glUniform4fv(location, count, v);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
-{
- EVGL_FUNC_BEGIN();
- glUniform4i(location, x, y, z, w);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniform4iv(GLint location, GLsizei count, const GLint* v)
-{
- EVGL_FUNC_BEGIN();
- glUniform4iv(location, count, v);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- EVGL_FUNC_BEGIN();
- glUniformMatrix2fv(location, count, transpose, value);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- EVGL_FUNC_BEGIN();
- glUniformMatrix3fv(location, count, transpose, value);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- EVGL_FUNC_BEGIN();
- glUniformMatrix4fv(location, count, transpose, value);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glUseProgram(GLuint program)
-{
- EVGL_FUNC_BEGIN();
- glUseProgram(program);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glValidateProgram(GLuint program)
-{
- EVGL_FUNC_BEGIN();
- glValidateProgram(program);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glVertexAttrib1f(GLuint indx, GLfloat x)
-{
- EVGL_FUNC_BEGIN();
- glVertexAttrib1f(indx, x);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glVertexAttrib1fv(GLuint indx, const GLfloat* values)
-{
- EVGL_FUNC_BEGIN();
- glVertexAttrib1fv(indx, values);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y)
-{
- EVGL_FUNC_BEGIN();
- glVertexAttrib2f(indx, x, y);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glVertexAttrib2fv(GLuint indx, const GLfloat* values)
-{
- EVGL_FUNC_BEGIN();
- glVertexAttrib2fv(indx, values);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z)
-{
- EVGL_FUNC_BEGIN();
- glVertexAttrib3f(indx, x, y, z);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glVertexAttrib3fv(GLuint indx, const GLfloat* values)
-{
- EVGL_FUNC_BEGIN();
- glVertexAttrib3fv(indx, values);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- EVGL_FUNC_BEGIN();
- glVertexAttrib4f(indx, x, y, z, w);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glVertexAttrib4fv(GLuint indx, const GLfloat* values)
-{
- EVGL_FUNC_BEGIN();
- glVertexAttrib4fv(indx, values);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr)
-{
- EVGL_FUNC_BEGIN();
- glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
- GLERR();
- EVGL_FUNC_END();
-}
-
-//-------------------------------------------------------------//
-// Calls for stripping precision string in the shader
-#if 0
-
-static const char *
-opengl_strtok(const char *s, int *n, char **saveptr, char *prevbuf)
-{
- char *start;
- char *ret;
- char *p;
- int retlen;
- static const char *delim = " \t\n\r/";
-
- if (prevbuf)
- free(prevbuf);
-
- if (s)
- {
- *saveptr = s;
- }
- else
- {
- if (!(*saveptr) || !(*n))
- return NULL;
- s = *saveptr;
- }
-
- for (; *n && strchr(delim, *s); s++, (*n)--)
- {
- if (*s == '/' && *n > 1)
- {
- if (s[1] == '/')
- {
- do {
- s++, (*n)--;
- } while (*n > 1 && s[1] != '\n' && s[1] != '\r');
- }
- else if (s[1] == '*')
- {
- do {
- s++, (*n)--;
- } while (*n > 2 && (s[1] != '*' || s[2] != '/'));
- s++, (*n)--;
- s++, (*n)--;
- if (*n == 0)
- {
- break;
- }
- }
- else
- {
- break;
- }
- }
- }
-
- start = s;
- for (; *n && *s && !strchr(delim, *s); s++, (*n)--);
- if (*n > 0)
- s++, (*n)--;
-
- *saveptr = s;
-
- retlen = s - start;
- ret = malloc(retlen + 1);
- p = ret;
-
- if (retlen == 0)
- {
- *p = 0;
- return;
- }
-
- while (retlen > 0)
- {
- if (*start == '/' && retlen > 1)
- {
- if (start[1] == '/')
- {
- do {
- start++, retlen--;
- } while (retlen > 1 && start[1] != '\n' && start[1] != '\r');
- start++, retlen--;
- continue;
- } else if (start[1] == '*')
- {
- do {
- start++, retlen--;
- } while (retlen > 2 && (start[1] != '*' || start[2] != '/'));
- start += 3, retlen -= 3;
- continue;
- }
- }
- *(p++) = *(start++), retlen--;
- }
-
- *p = 0;
- return ret;
-}
-
-static char *
-do_eglShaderPatch(const char *source, int length, int *patched_len)
-{
- char *saveptr = NULL;
- char *sp;
- char *p = NULL;
-
- if (!length) length = strlen(source);
-
- *patched_len = 0;
- int patched_size = length;
- char *patched = malloc(patched_size + 1);
-
- if (!patched) return NULL;
-
- p = opengl_strtok(source, &length, &saveptr, NULL);
-
- for (; p; p = opengl_strtok(0, &length, &saveptr, p))
- {
- if (!strncmp(p, "lowp", 4) || !strncmp(p, "mediump", 7) || !strncmp(p, "highp", 5))
- {
- continue;
- }
- else if (!strncmp(p, "precision", 9))
- {
- while ((p = opengl_strtok(0, &length, &saveptr, p)) && !strchr(p, ';'));
- }
- else
- {
- if (!strncmp(p, "gl_MaxVertexUniformVectors", 26))
- {
- free(p);
- p = strdup("(gl_MaxVertexUniformComponents / 4)");
- }
- else if (!strncmp(p, "gl_MaxFragmentUniformVectors", 28))
- {
- free(p);
- p = strdup("(gl_MaxFragmentUniformComponents / 4)");
- }
- else if (!strncmp(p, "gl_MaxVaryingVectors", 20))
- {
- free(p);
- p = strdup("(gl_MaxVaryingFloats / 4)");
- }
-
- int new_len = strlen(p);
- if (*patched_len + new_len > patched_size)
- {
- char *tmp;
-
- patched_size *= 2;
- tmp = realloc(patched, patched_size + 1);
- if (!tmp)
- {
- free(patched);
- free(p);
- return NULL;
- }
- patched = tmp;
- }
-
- memcpy(patched + *patched_len, p, new_len);
- *patched_len += new_len;
- }
- }
-
- patched[*patched_len] = 0;
- /* check that we don't leave dummy preprocessor lines */
- for (sp = patched; *sp;)
- {
- for (; *sp == ' ' || *sp == '\t'; sp++);
- if (!strncmp(sp, "#define", 7))
- {
- for (p = sp + 7; *p == ' ' || *p == '\t'; p++);
- if (*p == '\n' || *p == '\r' || *p == '/')
- {
- memset(sp, 0x20, 7);
- }
- }
- for (; *sp && *sp != '\n' && *sp != '\r'; sp++);
- for (; *sp == '\n' || *sp == '\r'; sp++);
- }
- return patched;
-}
-
-static int
-shadersrc_gles_to_gl(GLsizei count, const char** string, char **s, const GLint* length, GLint *l)
-{
- int i;
-
- for(i = 0; i < count; ++i) {
- GLint len;
- if(length) {
- len = length[i];
- if (len < 0)
- len = string[i] ? strlen(string[i]) : 0;
- } else
- len = string[i] ? strlen(string[i]) : 0;
-
- if(string[i]) {
- s[i] = do_eglShaderPatch(string[i], len, &l[i]);
- if(!s[i]) {
- while(i)
- free(s[--i]);
-
- free(l);
- free(s);
- return -1;
- }
- } else {
- s[i] = NULL;
- l[i] = 0;
- }
- }
-
- return 0;
-}
-
-
-void
-_evgld_glShaderSource(GLuint shader, GLsizei count, const char* const* string, const GLint* length)
-{
- EVGL_FUNC_BEGIN();
-
-#ifdef GL_GLES
- glShaderSource(shader, count, string, length);
- GLERR();
- goto finish;
-#else
- //GET_EXT_PTR(void, glShaderSource, (int, int, char **, void *));
- int size = count;
- int i;
- int acc_length = 0;
- GLchar **tab_prog = malloc(size * sizeof(GLchar *));
- int *tab_length = (int *) length;
-
- char **tab_prog_new;
- GLint *tab_length_new;
-
- tab_prog_new = malloc(count* sizeof(char*));
- tab_length_new = malloc(count* sizeof(GLint));
-
- memset(tab_prog_new, 0, count * sizeof(char*));
- memset(tab_length_new, 0, count * sizeof(GLint));
-
- for (i = 0; i < size; i++) {
- tab_prog[i] = ((GLchar *) string) + acc_length;
- acc_length += tab_length[i];
- }
-
- shadersrc_gles_to_gl(count, tab_prog, tab_prog_new, tab_length, tab_length_new);
-
- if (!tab_prog_new || !tab_length_new)
- ERR("Error allocating memory for shader string manipulation.");
-
- glShaderSource(shader, count, tab_prog_new, tab_length_new);
- GLERR();
-
- for (i = 0; i < count; i++)
- free(tab_prog_new[i]);
- free(tab_prog_new);
- free(tab_length_new);
-
- free(tab_prog);
-#endif
-
-finish:
- EVGL_FUNC_END();
-}
-#endif
-
-//-------------------------------------------------------------//
-
-
-//-------------------------------------------------------------//
-// Calls related to Evas GL Direct Rendering
-//-------------------------------------------------------------//
-static void
-_evgld_glClear(GLbitfield mask)
-{
- EVGL_FUNC_BEGIN();
-
- _evgl_glClear(mask);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_glEnable(GLenum cap)
-{
- EVGL_FUNC_BEGIN();
-
- _evgl_glEnable(cap);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_glDisable(GLenum cap)
-{
- EVGL_FUNC_BEGIN();
-
- _evgl_glDisable(cap);
- GLERR();
- EVGL_FUNC_END();
-}
-
-void
-_evgld_glGetIntegerv(GLenum pname, GLint* params)
-{
- EVGL_FUNC_BEGIN();
- _evgl_glGetIntegerv(pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels)
-{
- EVGL_FUNC_BEGIN();
-
- _evgl_glReadPixels(x, y, width, height, format, type, pixels);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- EVGL_FUNC_BEGIN();
-
- _evgl_glScissor(x, y, width, height);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- EVGL_FUNC_BEGIN();
-
- _evgl_glViewport(x, y, width, height);
- GLERR();
- EVGL_FUNC_END();
-}
-//-------------------------------------------------------------//
-
-static void
-_normal_gl_api_get(Evas_GL_API *funcs)
-{
- funcs->version = EVAS_GL_API_VERSION;
-
-#define ORD(f) EVAS_API_OVERRIDE(f, funcs,)
- // GLES 2.0
- ORD(glActiveTexture);
- ORD(glAttachShader);
- ORD(glBindAttribLocation);
- ORD(glBindBuffer);
- ORD(glBindTexture);
- ORD(glBlendColor);
- ORD(glBlendEquation);
- ORD(glBlendEquationSeparate);
- ORD(glBlendFunc);
- ORD(glBlendFuncSeparate);
- ORD(glBufferData);
- ORD(glBufferSubData);
- ORD(glCheckFramebufferStatus);
-// ORD(glClear);
-// ORD(glClearColor);
-// ORD(glClearDepthf);
- ORD(glClearStencil);
- ORD(glColorMask);
- ORD(glCompileShader);
- ORD(glCompressedTexImage2D);
- ORD(glCompressedTexSubImage2D);
- ORD(glCopyTexImage2D);
- ORD(glCopyTexSubImage2D);
- ORD(glCreateProgram);
- ORD(glCreateShader);
- ORD(glCullFace);
- ORD(glDeleteBuffers);
- ORD(glDeleteFramebuffers);
- ORD(glDeleteProgram);
- ORD(glDeleteRenderbuffers);
- ORD(glDeleteShader);
- ORD(glDeleteTextures);
- ORD(glDepthFunc);
- ORD(glDepthMask);
-// ORD(glDepthRangef);
- ORD(glDetachShader);
-// ORD(glDisable);
- ORD(glDisableVertexAttribArray);
- ORD(glDrawArrays);
- ORD(glDrawElements);
-// ORD(glEnable);
- ORD(glEnableVertexAttribArray);
- ORD(glFinish);
- ORD(glFlush);
- ORD(glFramebufferRenderbuffer);
- ORD(glFramebufferTexture2D);
- ORD(glFrontFace);
- ORD(glGenBuffers);
- ORD(glGenerateMipmap);
- ORD(glGenFramebuffers);
- ORD(glGenRenderbuffers);
- ORD(glGenTextures);
- ORD(glGetActiveAttrib);
- ORD(glGetActiveUniform);
- ORD(glGetAttachedShaders);
- ORD(glGetAttribLocation);
- ORD(glGetBooleanv);
- ORD(glGetBufferParameteriv);
- ORD(glGetError);
- ORD(glGetFloatv);
- ORD(glGetFramebufferAttachmentParameteriv);
-// ORD(glGetIntegerv);
- ORD(glGetProgramiv);
- ORD(glGetProgramInfoLog);
- ORD(glGetRenderbufferParameteriv);
- ORD(glGetShaderiv);
- ORD(glGetShaderInfoLog);
-// ORD(glGetShaderPrecisionFormat);
- ORD(glGetShaderSource);
-// ORD(glGetString);
- ORD(glGetTexParameterfv);
- ORD(glGetTexParameteriv);
- ORD(glGetUniformfv);
- ORD(glGetUniformiv);
- ORD(glGetUniformLocation);
- ORD(glGetVertexAttribfv);
- ORD(glGetVertexAttribiv);
- ORD(glGetVertexAttribPointerv);
- ORD(glHint);
- ORD(glIsBuffer);
- ORD(glIsEnabled);
- ORD(glIsFramebuffer);
- ORD(glIsProgram);
- ORD(glIsRenderbuffer);
- ORD(glIsShader);
- ORD(glIsTexture);
- ORD(glLineWidth);
- ORD(glLinkProgram);
- ORD(glPixelStorei);
- ORD(glPolygonOffset);
-// ORD(glReadPixels);
-// ORD(glReleaseShaderCompiler);
- ORD(glRenderbufferStorage);
- ORD(glSampleCoverage);
-// ORD(glScissor);
-// ORD(glShaderBinary);
-// Deal with double glShaderSource signature
- funcs->glShaderSource = (void (*)(GLuint, GLsizei, const char * const *, const GLint *))glShaderSource;
- ORD(glStencilFunc);
- ORD(glStencilFuncSeparate);
- ORD(glStencilMask);
- ORD(glStencilMaskSeparate);
- ORD(glStencilOp);
- ORD(glStencilOpSeparate);
- ORD(glTexImage2D);
- ORD(glTexParameterf);
- ORD(glTexParameterfv);
- ORD(glTexParameteri);
- ORD(glTexParameteriv);
- ORD(glTexSubImage2D);
- ORD(glUniform1f);
- ORD(glUniform1fv);
- ORD(glUniform1i);
- ORD(glUniform1iv);
- ORD(glUniform2f);
- ORD(glUniform2fv);
- ORD(glUniform2i);
- ORD(glUniform2iv);
- ORD(glUniform3f);
- ORD(glUniform3fv);
- ORD(glUniform3i);
- ORD(glUniform3iv);
- ORD(glUniform4f);
- ORD(glUniform4fv);
- ORD(glUniform4i);
- ORD(glUniform4iv);
- ORD(glUniformMatrix2fv);
- ORD(glUniformMatrix3fv);
- ORD(glUniformMatrix4fv);
- ORD(glUseProgram);
- ORD(glValidateProgram);
- ORD(glVertexAttrib1f);
- ORD(glVertexAttrib1fv);
- ORD(glVertexAttrib2f);
- ORD(glVertexAttrib2fv);
- ORD(glVertexAttrib3f);
- ORD(glVertexAttrib3fv);
- ORD(glVertexAttrib4f);
- ORD(glVertexAttrib4fv);
- ORD(glVertexAttribPointer);
-// ORD(glViewport);
-
-// ORD(glBindFramebuffer);
- ORD(glBindRenderbuffer);
-#undef ORD
-
-
-#define ORD(f) EVAS_API_OVERRIDE(f, funcs, _evgl_)
- // For Surface FBO
- ORD(glBindFramebuffer);
-
- // For Direct Rendering
- ORD(glClear);
- ORD(glClearColor);
- ORD(glDisable);
- ORD(glEnable);
- ORD(glGetIntegerv);
- ORD(glGetString);
- ORD(glReadPixels);
- ORD(glScissor);
- ORD(glViewport);
-
- // GLES 2 Compat for Desktop
- ORD(glClearDepthf);
- ORD(glDepthRangef);
- ORD(glGetShaderPrecisionFormat);
- ORD(glShaderBinary);
- ORD(glReleaseShaderCompiler);
-
-#undef ORD
-
- evgl_api_ext_get(funcs);
-}
-
-static void
-_direct_scissor_off_api_get(Evas_GL_API *funcs)
-{
-
-#define ORD(f) EVAS_API_OVERRIDE(f, funcs,)
- // For Direct Rendering
- ORD(glClear);
- ORD(glClearColor);
- ORD(glDisable);
- ORD(glEnable);
- ORD(glGetIntegerv);
- ORD(glReadPixels);
- ORD(glScissor);
- ORD(glViewport);
-#undef ORD
-}
-
-
-static void
-_debug_gl_api_get(Evas_GL_API *funcs)
-{
- funcs->version = EVAS_GL_API_VERSION;
-
-#define ORD(f) EVAS_API_OVERRIDE(f, funcs, _evgld_)
- // GLES 2.0
- ORD(glActiveTexture);
- ORD(glAttachShader);
- ORD(glBindAttribLocation);
- ORD(glBindBuffer);
- ORD(glBindTexture);
- ORD(glBlendColor);
- ORD(glBlendEquation);
- ORD(glBlendEquationSeparate);
- ORD(glBlendFunc);
- ORD(glBlendFuncSeparate);
- ORD(glBufferData);
- ORD(glBufferSubData);
- ORD(glCheckFramebufferStatus);
- ORD(glClear);
- ORD(glClearColor);
- ORD(glClearDepthf);
- ORD(glClearStencil);
- ORD(glColorMask);
- ORD(glCompileShader);
- ORD(glCompressedTexImage2D);
- ORD(glCompressedTexSubImage2D);
- ORD(glCopyTexImage2D);
- ORD(glCopyTexSubImage2D);
- ORD(glCreateProgram);
- ORD(glCreateShader);
- ORD(glCullFace);
- ORD(glDeleteBuffers);
- ORD(glDeleteFramebuffers);
- ORD(glDeleteProgram);
- ORD(glDeleteRenderbuffers);
- ORD(glDeleteShader);
- ORD(glDeleteTextures);
- ORD(glDepthFunc);
- ORD(glDepthMask);
- ORD(glDepthRangef);
- ORD(glDetachShader);
- ORD(glDisable);
- ORD(glDisableVertexAttribArray);
- ORD(glDrawArrays);
- ORD(glDrawElements);
- ORD(glEnable);
- ORD(glEnableVertexAttribArray);
- ORD(glFinish);
- ORD(glFlush);
- ORD(glFramebufferRenderbuffer);
- ORD(glFramebufferTexture2D);
- ORD(glFrontFace);
- ORD(glGenBuffers);
- ORD(glGenerateMipmap);
- ORD(glGenFramebuffers);
- ORD(glGenRenderbuffers);
- ORD(glGenTextures);
- ORD(glGetActiveAttrib);
- ORD(glGetActiveUniform);
- ORD(glGetAttachedShaders);
- ORD(glGetAttribLocation);
- ORD(glGetBooleanv);
- ORD(glGetBufferParameteriv);
- ORD(glGetError);
- ORD(glGetFloatv);
- ORD(glGetFramebufferAttachmentParameteriv);
- ORD(glGetIntegerv);
- ORD(glGetProgramiv);
- ORD(glGetProgramInfoLog);
- ORD(glGetRenderbufferParameteriv);
- ORD(glGetShaderiv);
- ORD(glGetShaderInfoLog);
- ORD(glGetShaderPrecisionFormat);
- ORD(glGetShaderSource);
- ORD(glGetString);
- ORD(glGetTexParameterfv);
- ORD(glGetTexParameteriv);
- ORD(glGetUniformfv);
- ORD(glGetUniformiv);
- ORD(glGetUniformLocation);
- ORD(glGetVertexAttribfv);
- ORD(glGetVertexAttribiv);
- ORD(glGetVertexAttribPointerv);
- ORD(glHint);
- ORD(glIsBuffer);
- ORD(glIsEnabled);
- ORD(glIsFramebuffer);
- ORD(glIsProgram);
- ORD(glIsRenderbuffer);
- ORD(glIsShader);
- ORD(glIsTexture);
- ORD(glLineWidth);
- ORD(glLinkProgram);
- ORD(glPixelStorei);
- ORD(glPolygonOffset);
- ORD(glReadPixels);
- ORD(glReleaseShaderCompiler);
- ORD(glRenderbufferStorage);
- ORD(glSampleCoverage);
- ORD(glScissor);
- ORD(glShaderBinary);
- ORD(glShaderSource);
- ORD(glStencilFunc);
- ORD(glStencilFuncSeparate);
- ORD(glStencilMask);
- ORD(glStencilMaskSeparate);
- ORD(glStencilOp);
- ORD(glStencilOpSeparate);
- ORD(glTexImage2D);
- ORD(glTexParameterf);
- ORD(glTexParameterfv);
- ORD(glTexParameteri);
- ORD(glTexParameteriv);
- ORD(glTexSubImage2D);
- ORD(glUniform1f);
- ORD(glUniform1fv);
- ORD(glUniform1i);
- ORD(glUniform1iv);
- ORD(glUniform2f);
- ORD(glUniform2fv);
- ORD(glUniform2i);
- ORD(glUniform2iv);
- ORD(glUniform3f);
- ORD(glUniform3fv);
- ORD(glUniform3i);
- ORD(glUniform3iv);
- ORD(glUniform4f);
- ORD(glUniform4fv);
- ORD(glUniform4i);
- ORD(glUniform4iv);
- ORD(glUniformMatrix2fv);
- ORD(glUniformMatrix3fv);
- ORD(glUniformMatrix4fv);
- ORD(glUseProgram);
- ORD(glValidateProgram);
- ORD(glVertexAttrib1f);
- ORD(glVertexAttrib1fv);
- ORD(glVertexAttrib2f);
- ORD(glVertexAttrib2fv);
- ORD(glVertexAttrib3f);
- ORD(glVertexAttrib3fv);
- ORD(glVertexAttrib4f);
- ORD(glVertexAttrib4fv);
- ORD(glVertexAttribPointer);
- ORD(glViewport);
-
- ORD(glBindFramebuffer);
- ORD(glBindRenderbuffer);
-#undef ORD
-
- evgl_api_ext_get(funcs);
-}
-
-void
-_evgl_api_get(Evas_GL_API *funcs, int debug)
-{
- if (debug)
- _debug_gl_api_get(funcs);
- else
- _normal_gl_api_get(funcs);
-
- if (evgl_engine->direct_scissor_off)
- _direct_scissor_off_api_get(funcs);
-}
+++ /dev/null
-#include "evas_gl_core_private.h"
-
-#include <dlfcn.h>
-
-#define EVGL_FUNC_BEGIN() \
-{ \
- _func_begin_debug(__FUNCTION__); \
-}
-
-#define EVGL_FUNC_END()
-
-static void *_gles1_handle = NULL;
-static Evas_GL_API _gles1_api;
-
-#define GLERR() GLERRV(__FUNCTION__)
-
-#ifdef GL_ERRORS
-#undef glActiveTexture
-#undef glBindAttribLocation
-#undef glBindBuffer
-#undef glBindTexture
-#undef glBlendFunc
-#undef glBufferData
-#undef glCompressedTexImage2D
-#undef glCompressedTexSubImage2D
-#undef glDeleteBuffers
-#undef glDepthMask
-#undef glDisable
-#undef glDisableVertexAttribArray
-#undef glDrawArrays
-#undef glEnable
-#undef glEnableVertexAttribArray
-#undef glGenBuffers
-#undef glGetFloatv
-#undef glGetIntegerv
-#undef glGetUniformLocation
-#undef glHint
-#undef glReadPixels
-#undef glScissor
-#undef glGenFramebuffers
-#undef glGenFramebuffers
-#undef glBindFramebuffer
-#undef glEndTiling
-#undef glGetProgramBinary
-#undef glMapBuffer
-#undef glPixelStorei
-#undef glStartTiling
-#undef glUnmapBuffer
-#undef glTexParameterf
-#undef glTexParameteri
-#undef glTexSubImage2D
-#undef glUniform1f
-#undef glUniform1i
-#undef glUniform2fv
-#undef glUniform4fv
-#undef glUniformMatrix4fv
-#undef glUseProgram
-#undef glVertexAttribPointer
-#undef glViewport
-#undef glCreateShader
-#undef glCreateProgram
-#undef glAttachShader
-#undef glLinkProgram
-#undef glGetProgramiv
-#undef glGetProgramInfoLog
-#undef glGetShaderiv
-#undef glShaderSource
-#undef glCompileShader
-#endif
-
-void
-compute_gl_coordinates(int win_w, int win_h, int rot, int clip_image,
- int x, int y, int width, int height,
- int img_x, int img_y, int img_w, int img_h,
- int clip_x, int clip_y, int clip_w, int clip_h,
- int imgc[4], int objc[4], int cc[4]);
-
-//---------------------------------------//
-// API Debug Error Checking Code
-
-static
-void _make_current_check(const char* api)
-{
- EVGL_Context *ctx = NULL;
-
- ctx = evas_gl_common_current_context_get();
-
- if (!ctx)
- CRI("\e[1;33m%s\e[m: Current Context NOT SET: GL Call Should NOT Be Called without MakeCurrent!!!", api);
- else if (ctx->version != EVAS_GL_GLES_1_X)
- CRI("\e[1;33m%s\e[m: This API is being called with the wrong context (invalid version).", api);
-}
-
-static
-void _direct_rendering_check(const char *api)
-{
- EVGL_Context *ctx = NULL;
-
- ctx = evas_gl_common_current_context_get();
- if (!ctx)
- {
- ERR("Current Context Not Set");
- return;
- }
-
- if (_evgl_not_in_pixel_get())
- CRI("\e[1;33m%s\e[m: This API is being called outside Pixel Get Callback Function.", api);
- else if (ctx->version != EVAS_GL_GLES_1_X)
- CRI("\e[1;33m%s\e[m: This API is being called with the wrong context (invalid version).", api);
-}
-
-static
-void _func_begin_debug(const char *api)
-{
- _make_current_check(api);
- _direct_rendering_check(api);
-}
-
-
-static void
-_evgl_gles1_glAlphaFunc(GLenum func, GLclampf ref)
-{
- if (!_gles1_api.glAlphaFunc)
- return;
- _gles1_api.glAlphaFunc(func, ref);
-}
-
-static void
-_evgl_gles1_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- EVGL_Resource *rsc;
-
- if (!_gles1_api.glClearColor)
- return;
-
- if (!(rsc=_evgl_tls_resource_get()))
- {
- ERR("Unable to execute GL command. Error retrieving tls");
- return;
- }
-
- if (_evgl_direct_enabled())
- {
- rsc->clear_color.a = alpha;
- rsc->clear_color.r = red;
- rsc->clear_color.g = green;
- rsc->clear_color.b = blue;
- }
- _gles1_api.glClearColor(red, green, blue, alpha);
-}
-
-static void
-_evgl_gles1_glClearDepthf(GLclampf depth)
-{
- if (!_gles1_api.glClearDepthf)
- return;
- _gles1_api.glClearDepthf(depth);
-}
-
-static void
-_evgl_gles1_glClipPlanef(GLenum plane, const GLfloat *equation)
-{
- if (!_gles1_api.glClipPlanef)
- return;
- _gles1_api.glClipPlanef(plane, equation);
-}
-
-static void
-_evgl_gles1_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- if (!_gles1_api.glColor4f)
- return;
- _gles1_api.glColor4f(red, green, blue, alpha);
-}
-
-static void
-_evgl_gles1_glDepthRangef(GLclampf zNear, GLclampf zFar)
-{
- if (!_gles1_api.glDepthRangef)
- return;
- _gles1_api.glDepthRangef(zNear, zFar);
-}
-
-static void
-_evgl_gles1_glFogf(GLenum pname, GLfloat param)
-{
- if (!_gles1_api.glFogf)
- return;
- _gles1_api.glFogf(pname, param);
-}
-
-static void
-_evgl_gles1_glFogfv(GLenum pname, const GLfloat *params)
-{
- if (!_gles1_api.glFogfv)
- return;
- _gles1_api.glFogfv(pname, params);
-}
-
-static void
-_evgl_gles1_glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
- if (!_gles1_api.glFrustumf)
- return;
- _gles1_api.glFrustumf(left, right, bottom, top, zNear, zFar);
-}
-
-static void
-_evgl_gles1_glGetClipPlanef(GLenum pname, GLfloat eqn[4])
-{
- if (!_gles1_api.glGetClipPlanef)
- return;
- _gles1_api.glGetClipPlanef(pname, eqn);
-}
-
-static void
-_evgl_gles1_glGetFloatv(GLenum pname, GLfloat *params)
-{
- if (!_gles1_api.glGetFloatv)
- return;
- _gles1_api.glGetFloatv(pname, params);
-}
-
-static void
-_evgl_gles1_glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- if (!_gles1_api.glGetLightfv)
- return;
- _gles1_api.glGetLightfv(light, pname, params);
-}
-
-static void
-_evgl_gles1_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- if (!_gles1_api.glGetMaterialfv)
- return;
- _gles1_api.glGetMaterialfv(face, pname, params);
-}
-
-static void
-_evgl_gles1_glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params)
-{
- if (!_gles1_api.glGetTexEnvfv)
- return;
- _gles1_api.glGetTexEnvfv(env, pname, params);
-}
-
-static void
-_evgl_gles1_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- if (!_gles1_api.glGetTexParameterfv)
- return;
- _gles1_api.glGetTexParameterfv(target, pname, params);
-}
-
-static void
-_evgl_gles1_glLightModelf(GLenum pname, GLfloat param)
-{
- if (!_gles1_api.glLightModelf)
- return;
- _gles1_api.glLightModelf(pname, param);
-}
-
-static void
-_evgl_gles1_glLightModelfv(GLenum pname, const GLfloat *params)
-{
- if (!_gles1_api.glLightModelfv)
- return;
- _gles1_api.glLightModelfv(pname, params);
-}
-
-static void
-_evgl_gles1_glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- if (!_gles1_api.glLightf)
- return;
- _gles1_api.glLightf(light, pname, param);
-}
-
-static void
-_evgl_gles1_glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- if (!_gles1_api.glLightfv)
- return;
- _gles1_api.glLightfv(light, pname, params);
-}
-
-static void
-_evgl_gles1_glLineWidth(GLfloat width)
-{
- if (!_gles1_api.glLineWidth)
- return;
- _gles1_api.glLineWidth(width);
-}
-
-static void
-_evgl_gles1_glLoadMatrixf(const GLfloat *m)
-{
- if (!_gles1_api.glLoadMatrixf)
- return;
- _gles1_api.glLoadMatrixf(m);
-}
-
-static void
-_evgl_gles1_glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- if (!_gles1_api.glMaterialf)
- return;
- _gles1_api.glMaterialf(face, pname, param);
-}
-
-static void
-_evgl_gles1_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- if (!_gles1_api.glMaterialfv)
- return;
- _gles1_api.glMaterialfv(face, pname, params);
-}
-
-static void
-_evgl_gles1_glMultMatrixf(const GLfloat *m)
-{
- if (!_gles1_api.glMultMatrixf)
- return;
- _gles1_api.glMultMatrixf(m);
-}
-
-static void
-_evgl_gles1_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- if (!_gles1_api.glMultiTexCoord4f)
- return;
- _gles1_api.glMultiTexCoord4f(target, s, t, r, q);
-}
-
-static void
-_evgl_gles1_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- if (!_gles1_api.glNormal3f)
- return;
- _gles1_api.glNormal3f(nx, ny, nz);
-}
-
-static void
-_evgl_gles1_glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
- if (!_gles1_api.glOrthof)
- return;
- _gles1_api.glOrthof(left, right, bottom, top, zNear, zFar);
-}
-
-static void
-_evgl_gles1_glPointParameterf(GLenum pname, GLfloat param)
-{
- if (!_gles1_api.glPointParameterf)
- return;
- _gles1_api.glPointParameterf(pname, param);
-}
-
-static void
-_evgl_gles1_glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- if (!_gles1_api.glPointParameterfv)
- return;
- _gles1_api.glPointParameterfv(pname, params);
-}
-
-static void
-_evgl_gles1_glPointSize(GLfloat size)
-{
- if (!_gles1_api.glPointSize)
- return;
- _gles1_api.glPointSize(size);
-}
-
-static void
-_evgl_gles1_glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- if (!_gles1_api.glPointSizePointerOES)
- return;
- _gles1_api.glPointSizePointerOES(type, stride, pointer);
-}
-
-static void
-_evgl_gles1_glPolygonOffset(GLfloat factor, GLfloat units)
-{
- if (!_gles1_api.glPolygonOffset)
- return;
- _gles1_api.glPolygonOffset(factor, units);
-}
-
-static void
-_evgl_gles1_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- if (!_gles1_api.glRotatef)
- return;
- _gles1_api.glRotatef(angle, x, y, z);
-}
-
-static void
-_evgl_gles1_glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- if (!_gles1_api.glScalef)
- return;
- _gles1_api.glScalef(x, y, z);
-}
-
-static void
-_evgl_gles1_glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- if (!_gles1_api.glTexEnvf)
- return;
- _gles1_api.glTexEnvf(target, pname, param);
-}
-
-static void
-_evgl_gles1_glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- if (!_gles1_api.glTexEnvfv)
- return;
- _gles1_api.glTexEnvfv(target, pname, params);
-}
-
-static void
-_evgl_gles1_glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- if (!_gles1_api.glTexParameterf)
- return;
- _gles1_api.glTexParameterf(target, pname, param);
-}
-
-static void
-_evgl_gles1_glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- if (!_gles1_api.glTexParameterfv)
- return;
- _gles1_api.glTexParameterfv(target, pname, params);
-}
-
-static void
-_evgl_gles1_glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- if (!_gles1_api.glTranslatef)
- return;
- _gles1_api.glTranslatef(x, y, z);
-}
-
-static void
-_evgl_gles1_glActiveTexture(GLenum texture)
-{
- if (!_gles1_api.glActiveTexture)
- return;
- _gles1_api.glActiveTexture(texture);
-}
-
-static void
-_evgl_gles1_glAlphaFuncx(GLenum func, GLclampx ref)
-{
- if (!_gles1_api.glAlphaFuncx)
- return;
- _gles1_api.glAlphaFuncx(func, ref);
-}
-
-static void
-_evgl_gles1_glBindBuffer(GLenum target, GLuint buffer)
-{
- if (!_gles1_api.glBindBuffer)
- return;
- _gles1_api.glBindBuffer(target, buffer);
-}
-
-static void
-_evgl_gles1_glBindTexture(GLenum target, GLuint texture)
-{
- if (!_gles1_api.glBindTexture)
- return;
- _gles1_api.glBindTexture(target, texture);
-}
-
-static void
-_evgl_gles1_glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- if (!_gles1_api.glBlendFunc)
- return;
- _gles1_api.glBlendFunc(sfactor, dfactor);
-}
-
-static void
-_evgl_gles1_glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- if (!_gles1_api.glBufferData)
- return;
- _gles1_api.glBufferData(target, size, data, usage);
-}
-
-static void
-_evgl_gles1_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- if (!_gles1_api.glBufferSubData)
- return;
- _gles1_api.glBufferSubData(target, offset, size, data);
-}
-
-static void
-_evgl_gles1_glClear(GLbitfield mask)
-{
- EVGL_Resource *rsc;
- EVGL_Context *ctx;
- int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
- int cc[4] = {0,0,0,0};
-
- if (!_gles1_api.glClear)
- return;
-
- if (!(rsc=_evgl_tls_resource_get()))
- {
- ERR("Unable to execute GL command. Error retrieving tls");
- return;
- }
-
- if (!rsc->current_eng)
- {
- ERR("Unable to retrive Current Engine");
- return;
- }
-
- ctx = rsc->current_ctx;
- if (!ctx)
- {
- ERR("Unable to retrive Current Context");
- return;
- }
-
- if (ctx->version != EVAS_GL_GLES_1_X)
- {
- ERR("Invalid context version %d", (int) ctx->version);
- return;
- }
-
- if (_evgl_direct_enabled())
- {
- if (!(rsc->current_ctx->current_fbo))
- //|| rsc->current_ctx->map_tex)
- {
- /* Skip glClear() if clearing with transparent color
- * Note: There will be side effects if the object itself is not
- * marked as having an alpha channel!
- */
- if (ctx->current_sfc->alpha && (mask & GL_COLOR_BUFFER_BIT))
- {
- if ((rsc->clear_color.a == 0) &&
- (rsc->clear_color.r == 0) &&
- (rsc->clear_color.g == 0) &&
- (rsc->clear_color.b == 0))
- {
- // Skip clear color as we don't want to write black
- mask &= ~GL_COLOR_BUFFER_BIT;
- }
- else if (rsc->clear_color.a != 1.0)
- {
- // TODO: Draw a rectangle? This will never be the perfect solution though.
- WRN("glClear() used with a semi-transparent color and direct rendering. "
- "This will erase the previous contents of the evas!");
- }
- if (!mask) return;
- }
-
- if ((!ctx->direct_scissor))
- {
- _gles1_api.glEnable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 1;
- }
-
- if ((ctx->scissor_updated) && (ctx->scissor_enabled))
- {
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 1,
- ctx->scissor_coord[0], ctx->scissor_coord[1],
- ctx->scissor_coord[2], ctx->scissor_coord[3],
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
-
- RECTS_CLIP_TO_RECT(nc[0], nc[1], nc[2], nc[3], cc[0], cc[1], cc[2], cc[3]);
- _gles1_api.glScissor(nc[0], nc[1], nc[2], nc[3]);
- ctx->direct_scissor = 0;
- }
- else
- {
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 0,
- 0, 0, 0, 0,
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
-
- _gles1_api.glScissor(cc[0], cc[1], cc[2], cc[3]);
- }
-
- _gles1_api.glClear(mask);
-
- // TODO/FIXME: Restore previous client-side scissors.
- }
- else
- {
- if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
- {
- _gles1_api.glDisable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 0;
- }
-
- _gles1_api.glClear(mask);
- }
- }
- else
- {
- if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
- {
- _gles1_api.glDisable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 0;
- }
-
- _gles1_api.glClear(mask);
- }
-}
-
-static void
-_evgl_gles1_glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
-{
- if (!_gles1_api.glClearColorx)
- return;
- _gles1_api.glClearColorx(red, green, blue, alpha);
-}
-
-static void
-_evgl_gles1_glClearDepthx(GLclampx depth)
-{
- if (!_gles1_api.glClearDepthx)
- return;
- _gles1_api.glClearDepthx(depth);
-}
-
-static void
-_evgl_gles1_glClearStencil(GLint s)
-{
- if (!_gles1_api.glClearStencil)
- return;
- _gles1_api.glClearStencil(s);
-}
-
-static void
-_evgl_gles1_glClientActiveTexture(GLenum texture)
-{
- if (!_gles1_api.glClientActiveTexture)
- return;
- _gles1_api.glClientActiveTexture(texture);
-}
-
-static void
-_evgl_gles1_glClipPlanex(GLenum plane, const GLfixed *equation)
-{
- if (!_gles1_api.glClipPlanex)
- return;
- _gles1_api.glClipPlanex(plane, equation);
-}
-
-static void
-_evgl_gles1_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- if (!_gles1_api.glColor4ub)
- return;
- _gles1_api.glColor4ub(red, green, blue, alpha);
-}
-
-static void
-_evgl_gles1_glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
-{
- if (!_gles1_api.glColor4x)
- return;
- _gles1_api.glColor4x(red, green, blue, alpha);
-}
-
-static void
-_evgl_gles1_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- if (!_gles1_api.glColorMask)
- return;
- _gles1_api.glColorMask(red, green, blue, alpha);
-}
-
-static void
-_evgl_gles1_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- if (!_gles1_api.glColorPointer)
- return;
- _gles1_api.glColorPointer(size, type, stride, pointer);
-}
-
-static void
-_evgl_gles1_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- if (!_gles1_api.glCompressedTexImage2D)
- return;
- _gles1_api.glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-static void
-_evgl_gles1_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- if (!_gles1_api.glCompressedTexSubImage2D)
- return;
- _gles1_api.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-static void
-_evgl_gles1_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- if (!_gles1_api.glCopyTexImage2D)
- return;
- _gles1_api.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-static void
-_evgl_gles1_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- if (!_gles1_api.glCopyTexSubImage2D)
- return;
- _gles1_api.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-static void
-_evgl_gles1_glCullFace(GLenum mode)
-{
- if (!_gles1_api.glCullFace)
- return;
- _gles1_api.glCullFace(mode);
-}
-
-static void
-_evgl_gles1_glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- if (!_gles1_api.glDeleteBuffers)
- return;
- _gles1_api.glDeleteBuffers(n, buffers);
-}
-
-static void
-_evgl_gles1_glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- if (!_gles1_api.glDeleteTextures)
- return;
- _gles1_api.glDeleteTextures(n, textures);
-}
-
-static void
-_evgl_gles1_glDepthFunc(GLenum func)
-{
- if (!_gles1_api.glDepthFunc)
- return;
- _gles1_api.glDepthFunc(func);
-}
-
-static void
-_evgl_gles1_glDepthMask(GLboolean flag)
-{
- if (!_gles1_api.glDepthMask)
- return;
- _gles1_api.glDepthMask(flag);
-}
-
-static void
-_evgl_gles1_glDepthRangex(GLclampx zNear, GLclampx zFar)
-{
- if (!_gles1_api.glDepthRangex)
- return;
- _gles1_api.glDepthRangex(zNear, zFar);
-}
-
-static void
-_evgl_gles1_glDisable(GLenum cap)
-{
- EVGL_Context *ctx;
-
- if (!_gles1_api.glDisable)
- return;
-
- ctx = evas_gl_common_current_context_get();
- if (!ctx)
- {
- ERR("Unable to retrive Current Context");
- return;
- }
-
- if (ctx->version != EVAS_GL_GLES_1_X)
- {
- ERR("Invalid context version %d", (int) ctx->version);
- return;
- }
-
- if (cap == GL_SCISSOR_TEST)
- ctx->scissor_enabled = 0;
- _gles1_api.glDisable(cap);
-}
-
-static void
-_evgl_gles1_glDisableClientState(GLenum array)
-{
- if (!_gles1_api.glDisableClientState)
- return;
- _gles1_api.glDisableClientState(array);
-}
-
-static void
-_evgl_gles1_glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- if (!_gles1_api.glDrawArrays)
- return;
- _gles1_api.glDrawArrays(mode, first, count);
-}
-
-static void
-_evgl_gles1_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- if (!_gles1_api.glDrawElements)
- return;
- _gles1_api.glDrawElements(mode, count, type, indices);
-}
-
-static void
-_evgl_gles1_glEnable(GLenum cap)
-{
- EVGL_Context *ctx;
-
- if (!_gles1_api.glEnable)
- return;
-
- ctx = evas_gl_common_current_context_get();
- if (!ctx)
- {
- ERR("Unable to retrive Current Context");
- return;
- }
-
- if (ctx->version != EVAS_GL_GLES_1_X)
- {
- ERR("Invalid context version %d", (int) ctx->version);
- return;
- }
-
- if (cap == GL_SCISSOR_TEST)
- ctx->scissor_enabled = 1;
- _gles1_api.glEnable(cap);
-}
-
-static void
-_evgl_gles1_glEnableClientState(GLenum array)
-{
- if (!_gles1_api.glEnableClientState)
- return;
- _gles1_api.glEnableClientState(array);
-}
-
-static void
-_evgl_gles1_glFinish(void)
-{
- if (!_gles1_api.glFinish)
- return;
- _gles1_api.glFinish();
-}
-
-static void
-_evgl_gles1_glFlush(void)
-{
- if (!_gles1_api.glFlush)
- return;
- _gles1_api.glFlush();
-}
-
-static void
-_evgl_gles1_glFogx(GLenum pname, GLfixed param)
-{
- if (!_gles1_api.glFogx)
- return;
- _gles1_api.glFogx(pname, param);
-}
-
-static void
-_evgl_gles1_glFogxv(GLenum pname, const GLfixed *params)
-{
- if (!_gles1_api.glFogxv)
- return;
- _gles1_api.glFogxv(pname, params);
-}
-
-static void
-_evgl_gles1_glFrontFace(GLenum mode)
-{
- if (!_gles1_api.glFrontFace)
- return;
- _gles1_api.glFrontFace(mode);
-}
-
-static void
-_evgl_gles1_glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
- if (!_gles1_api.glFrustumx)
- return;
- _gles1_api.glFrustumx(left, right, bottom, top, zNear, zFar);
-}
-
-static void
-_evgl_gles1_glGetBooleanv(GLenum pname, GLboolean *params)
-{
- if (!_gles1_api.glGetBooleanv)
- return;
- _gles1_api.glGetBooleanv(pname, params);
-}
-
-static void
-_evgl_gles1_glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- if (!_gles1_api.glGetBufferParameteriv)
- return;
- _gles1_api.glGetBufferParameteriv(target, pname, params);
-}
-
-static void
-_evgl_gles1_glGetClipPlanex(GLenum pname, GLfixed eqn[4])
-{
- if (!_gles1_api.glGetClipPlanex)
- return;
- _gles1_api.glGetClipPlanex(pname, eqn);
-}
-
-static void
-_evgl_gles1_glGenBuffers(GLsizei n, GLuint *buffers)
-{
- if (!_gles1_api.glGenBuffers)
- return;
- _gles1_api.glGenBuffers(n, buffers);
-}
-
-static void
-_evgl_gles1_glGenTextures(GLsizei n, GLuint *textures)
-{
- if (!_gles1_api.glGenTextures)
- return;
- _gles1_api.glGenTextures(n, textures);
-}
-
-static GLenum
-_evgl_gles1_glGetError(void)
-{
- GLenum ret;
- if (!_gles1_api.glGetError)
- return EVAS_GL_NOT_INITIALIZED;
- ret = _gles1_api.glGetError();
- return ret;
-}
-
-static void
-_evgl_gles1_glGetFixedv(GLenum pname, GLfixed *params)
-{
- if (!_gles1_api.glGetFixedv)
- return;
- _gles1_api.glGetFixedv(pname, params);
-}
-
-static void
-_evgl_gles1_glGetIntegerv(GLenum pname, GLint *params)
-{
- EVGL_Resource *rsc;
- EVGL_Context *ctx;
-
- if (!_gles1_api.glGetIntegerv)
- return;
-
- if (_evgl_direct_enabled())
- {
- if (!params)
- {
- ERR("Inavlid Parameter");
- return;
- }
-
- if (!(rsc=_evgl_tls_resource_get()))
- {
- ERR("Unable to execute GL command. Error retrieving tls");
- return;
- }
-
- ctx = rsc->current_ctx;
- if (!ctx)
- {
- ERR("Unable to retrive Current Context");
- return;
- }
-
- if (ctx->version != EVAS_GL_GLES_1_X)
- {
- ERR("Invalid context version %d", (int) ctx->version);
- return;
- }
-
- // Only need to handle it if it's directly rendering to the window
- if (!(rsc->current_ctx->current_fbo))
- //|| rsc->current_ctx->map_tex)
- {
- if (pname == GL_SCISSOR_BOX)
- {
- if (ctx->scissor_updated)
- {
- memcpy(params, ctx->scissor_coord, sizeof(int)*4);
- return;
- }
- }
- /*!!! Temporary Fixes to avoid Webkit issue
- if (pname == GL_VIEWPORT)
- {
- if (ctx->viewport_updated)
- {
- memcpy(params, ctx->viewport_coord, sizeof(int)*4);
- return;
- }
- }
- */
-
- // If it hasn't been initialized yet, return img object size
- if (pname == GL_SCISSOR_BOX) //|| (pname == GL_VIEWPORT))
- {
- params[0] = 0;
- params[1] = 0;
- params[2] = (GLint)rsc->direct.img.w;
- params[3] = (GLint)rsc->direct.img.h;
- return;
- }
- }
- }
-
- _gles1_api.glGetIntegerv(pname, params);
-}
-
-static void
-_evgl_gles1_glGetLightxv(GLenum light, GLenum pname, GLfixed *params)
-{
- if (!_gles1_api.glGetLightxv)
- return;
- _gles1_api.glGetLightxv(light, pname, params);
-}
-
-static void
-_evgl_gles1_glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params)
-{
- if (!_gles1_api.glGetMaterialxv)
- return;
- _gles1_api.glGetMaterialxv(face, pname, params);
-}
-
-static void
-_evgl_gles1_glGetPointerv(GLenum pname, GLvoid **params)
-{
- if (!_gles1_api.glGetPointerv)
- return;
- _gles1_api.glGetPointerv(pname, params);
-}
-
-static const GLubyte *
-_evgl_gles1_glGetString(GLenum name)
-{
- const GLubyte * ret;
- if (!_gles1_api.glGetString)
- return NULL;
- ret = _gles1_api.glGetString(name);
- return ret;
-}
-
-static void
-_evgl_gles1_glGetTexEnviv(GLenum env, GLenum pname, GLint *params)
-{
- if (!_gles1_api.glGetTexEnviv)
- return;
- _gles1_api.glGetTexEnviv(env, pname, params);
-}
-
-static void
-_evgl_gles1_glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params)
-{
- if (!_gles1_api.glGetTexEnvxv)
- return;
- _gles1_api.glGetTexEnvxv(env, pname, params);
-}
-
-static void
-_evgl_gles1_glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- if (!_gles1_api.glGetTexParameteriv)
- return;
- _gles1_api.glGetTexParameteriv(target, pname, params);
-}
-
-static void
-_evgl_gles1_glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params)
-{
- if (!_gles1_api.glGetTexParameterxv)
- return;
- _gles1_api.glGetTexParameterxv(target, pname, params);
-}
-
-static void
-_evgl_gles1_glHint(GLenum target, GLenum mode)
-{
- if (!_gles1_api.glHint)
- return;
- _gles1_api.glHint(target, mode);
-}
-
-static GLboolean
-_evgl_gles1_glIsBuffer(GLuint buffer)
-{
- GLboolean ret;
- if (!_gles1_api.glIsBuffer)
- return EINA_FALSE;
- ret = _gles1_api.glIsBuffer(buffer);
- return ret;
-}
-
-static GLboolean
-_evgl_gles1_glIsEnabled(GLenum cap)
-{
- GLboolean ret;
- if (!_gles1_api.glIsEnabled)
- return EINA_FALSE;
- ret = _gles1_api.glIsEnabled(cap);
- return ret;
-}
-
-static GLboolean
-_evgl_gles1_glIsTexture(GLuint texture)
-{
- GLboolean ret;
- if (!_gles1_api.glIsTexture)
- return EINA_FALSE;
- ret = _gles1_api.glIsTexture(texture);
- return ret;
-}
-
-static void
-_evgl_gles1_glLightModelx(GLenum pname, GLfixed param)
-{
- if (!_gles1_api.glLightModelx)
- return;
- _gles1_api.glLightModelx(pname, param);
-}
-
-static void
-_evgl_gles1_glLightModelxv(GLenum pname, const GLfixed *params)
-{
- if (!_gles1_api.glLightModelxv)
- return;
- _gles1_api.glLightModelxv(pname, params);
-}
-
-static void
-_evgl_gles1_glLightx(GLenum light, GLenum pname, GLfixed param)
-{
- if (!_gles1_api.glLightx)
- return;
- _gles1_api.glLightx(light, pname, param);
-}
-
-static void
-_evgl_gles1_glLightxv(GLenum light, GLenum pname, const GLfixed *params)
-{
- if (!_gles1_api.glLightxv)
- return;
- _gles1_api.glLightxv(light, pname, params);
-}
-
-static void
-_evgl_gles1_glLineWidthx(GLfixed width)
-{
- if (!_gles1_api.glLineWidthx)
- return;
- _gles1_api.glLineWidthx(width);
-}
-
-static void
-_evgl_gles1_glLoadIdentity(void)
-{
- if (!_gles1_api.glLoadIdentity)
- return;
- _gles1_api.glLoadIdentity();
-}
-
-static void
-_evgl_gles1_glLoadMatrixx(const GLfixed *m)
-{
- if (!_gles1_api.glLoadMatrixx)
- return;
- _gles1_api.glLoadMatrixx(m);
-}
-
-static void
-_evgl_gles1_glLogicOp(GLenum opcode)
-{
- if (!_gles1_api.glLogicOp)
- return;
- _gles1_api.glLogicOp(opcode);
-}
-
-static void
-_evgl_gles1_glMaterialx(GLenum face, GLenum pname, GLfixed param)
-{
- if (!_gles1_api.glMaterialx)
- return;
- _gles1_api.glMaterialx(face, pname, param);
-}
-
-static void
-_evgl_gles1_glMaterialxv(GLenum face, GLenum pname, const GLfixed *params)
-{
- if (!_gles1_api.glMaterialxv)
- return;
- _gles1_api.glMaterialxv(face, pname, params);
-}
-
-static void
-_evgl_gles1_glMatrixMode(GLenum mode)
-{
- if (!_gles1_api.glMatrixMode)
- return;
- _gles1_api.glMatrixMode(mode);
-}
-
-static void
-_evgl_gles1_glMultMatrixx(const GLfixed *m)
-{
- if (!_gles1_api.glMultMatrixx)
- return;
- _gles1_api.glMultMatrixx(m);
-}
-
-static void
-_evgl_gles1_glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
-{
- if (!_gles1_api.glMultiTexCoord4x)
- return;
- _gles1_api.glMultiTexCoord4x(target, s, t, r, q);
-}
-
-static void
-_evgl_gles1_glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz)
-{
- if (!_gles1_api.glNormal3x)
- return;
- _gles1_api.glNormal3x(nx, ny, nz);
-}
-
-static void
-_evgl_gles1_glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- if (!_gles1_api.glNormalPointer)
- return;
- _gles1_api.glNormalPointer(type, stride, pointer);
-}
-
-static void
-_evgl_gles1_glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
- if (!_gles1_api.glOrthox)
- return;
- _gles1_api.glOrthox(left, right, bottom, top, zNear, zFar);
-}
-
-static void
-_evgl_gles1_glPixelStorei(GLenum pname, GLint param)
-{
- if (!_gles1_api.glPixelStorei)
- return;
- _gles1_api.glPixelStorei(pname, param);
-}
-
-static void
-_evgl_gles1_glPointParameterx(GLenum pname, GLfixed param)
-{
- if (!_gles1_api.glPointParameterx)
- return;
- _gles1_api.glPointParameterx(pname, param);
-}
-
-static void
-_evgl_gles1_glPointParameterxv(GLenum pname, const GLfixed *params)
-{
- if (!_gles1_api.glPointParameterxv)
- return;
- _gles1_api.glPointParameterxv(pname, params);
-}
-
-static void
-_evgl_gles1_glPointSizex(GLfixed size)
-{
- if (!_gles1_api.glPointSizex)
- return;
- _gles1_api.glPointSizex(size);
-}
-
-static void
-_evgl_gles1_glPolygonOffsetx(GLfixed factor, GLfixed units)
-{
- if (!_gles1_api.glPolygonOffsetx)
- return;
- _gles1_api.glPolygonOffsetx(factor, units);
-}
-
-static void
-_evgl_gles1_glPopMatrix(void)
-{
- if (!_gles1_api.glPopMatrix)
- return;
- _gles1_api.glPopMatrix();
-}
-
-static void
-_evgl_gles1_glPushMatrix(void)
-{
- if (!_gles1_api.glPushMatrix)
- return;
- _gles1_api.glPushMatrix();
-}
-
-static void
-_evgl_gles1_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- EVGL_Resource *rsc;
- EVGL_Context *ctx;
- int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
- int cc[4] = {0,0,0,0};
-
- if (!_gles1_api.glReadPixels)
- return;
-
- if (!(rsc=_evgl_tls_resource_get()))
- {
- ERR("Unable to execute GL command. Error retrieving tls");
- return;
- }
-
- if (!rsc->current_eng)
- {
- ERR("Unable to retrive Current Engine");
- return;
- }
-
- ctx = rsc->current_ctx;
- if (!ctx)
- {
- ERR("Unable to retrive Current Context");
- return;
- }
-
- if (ctx->version != EVAS_GL_GLES_1_X)
- {
- ERR("Invalid context version %d", (int) ctx->version);
- return;
- }
-
- if (_evgl_direct_enabled())
- {
- if (!(rsc->current_ctx->current_fbo))
- //|| rsc->current_ctx->map_tex)
- {
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 1,
- x, y, width, height,
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
- _gles1_api.glReadPixels(nc[0], nc[1], nc[2], nc[3], format, type, pixels);
- }
- else
- {
- _gles1_api.glReadPixels(x, y, width, height, format, type, pixels);
- }
- }
- else
- {
- _gles1_api.glReadPixels(x, y, width, height, format, type, pixels);
- }
-}
-
-static void
-_evgl_gles1_glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
-{
- if (!_gles1_api.glRotatex)
- return;
- _gles1_api.glRotatex(angle, x, y, z);
-}
-
-static void
-_evgl_gles1_glSampleCoverage(GLclampf value, GLboolean invert)
-{
- if (!_gles1_api.glSampleCoverage)
- return;
- _gles1_api.glSampleCoverage(value, invert);
-}
-
-static void
-_evgl_gles1_glSampleCoveragex(GLclampx value, GLboolean invert)
-{
- if (!_gles1_api.glSampleCoveragex)
- return;
- _gles1_api.glSampleCoveragex(value, invert);
-}
-
-static void
-_evgl_gles1_glScalex(GLfixed x, GLfixed y, GLfixed z)
-{
- if (!_gles1_api.glScalex)
- return;
- _gles1_api.glScalex(x, y, z);
-}
-
-static void
-_evgl_gles1_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- EVGL_Resource *rsc;
- EVGL_Context *ctx;
- int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
- int cc[4] = {0,0,0,0};
-
- if (!_gles1_api.glScissor)
- return;
-
- if (!(rsc=_evgl_tls_resource_get()))
- {
- ERR("Unable to execute GL command. Error retrieving tls");
- return;
- }
-
- if (!rsc->current_eng)
- {
- ERR("Unable to retrive Current Engine");
- return;
- }
-
- ctx = rsc->current_ctx;
- if (!ctx)
- {
- ERR("Unable to retrive Current Context");
- return;
- }
-
- if (ctx->version != EVAS_GL_GLES_1_X)
- {
- ERR("Invalid context version %d", (int) ctx->version);
- return;
- }
-
- if (_evgl_direct_enabled())
- {
- if (!(rsc->current_ctx->current_fbo))
- //|| rsc->current_ctx->map_tex)
- {
- if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
- {
- _gles1_api.glDisable(GL_SCISSOR_TEST);
- }
-
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 1,
- x, y, width, height,
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
-
- // Keep a copy of the original coordinates
- ctx->scissor_coord[0] = x;
- ctx->scissor_coord[1] = y;
- ctx->scissor_coord[2] = width;
- ctx->scissor_coord[3] = height;
-
- RECTS_CLIP_TO_RECT(nc[0], nc[1], nc[2], nc[3], cc[0], cc[1], cc[2], cc[3]);
- _gles1_api.glScissor(nc[0], nc[1], nc[2], nc[3]);
-
- ctx->direct_scissor = 0;
-
- // Check....!!!!
- ctx->scissor_updated = 1;
- }
- else
- {
- if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
- {
- _gles1_api.glDisable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 0;
- }
-
- _gles1_api.glScissor(x, y, width, height);
-
- ctx->scissor_updated = 0;
- }
- }
- else
- {
- if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
- {
- _gles1_api.glDisable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 0;
- }
-
- _gles1_api.glScissor(x, y, width, height);
- }
-}
-
-static void
-_evgl_gles1_glShadeModel(GLenum mode)
-{
- if (!_gles1_api.glShadeModel)
- return;
- _gles1_api.glShadeModel(mode);
-}
-
-static void
-_evgl_gles1_glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- if (!_gles1_api.glStencilFunc)
- return;
- _gles1_api.glStencilFunc(func, ref, mask);
-}
-
-static void
-_evgl_gles1_glStencilMask(GLuint mask)
-{
- if (!_gles1_api.glStencilMask)
- return;
- _gles1_api.glStencilMask(mask);
-}
-
-static void
-_evgl_gles1_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- if (!_gles1_api.glStencilOp)
- return;
- _gles1_api.glStencilOp(fail, zfail, zpass);
-}
-
-static void
-_evgl_gles1_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- if (!_gles1_api.glTexCoordPointer)
- return;
- _gles1_api.glTexCoordPointer(size, type, stride, pointer);
-}
-
-static void
-_evgl_gles1_glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- if (!_gles1_api.glTexEnvi)
- return;
- _gles1_api.glTexEnvi(target, pname, param);
-}
-
-static void
-_evgl_gles1_glTexEnvx(GLenum target, GLenum pname, GLfixed param)
-{
- if (!_gles1_api.glTexEnvx)
- return;
- _gles1_api.glTexEnvx(target, pname, param);
-}
-
-static void
-_evgl_gles1_glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- if (!_gles1_api.glTexEnviv)
- return;
- _gles1_api.glTexEnviv(target, pname, params);
-}
-
-static void
-_evgl_gles1_glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params)
-{
- if (!_gles1_api.glTexEnvxv)
- return;
- _gles1_api.glTexEnvxv(target, pname, params);
-}
-
-static void
-_evgl_gles1_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- if (!_gles1_api.glTexImage2D)
- return;
- _gles1_api.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-static void
-_evgl_gles1_glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- if (!_gles1_api.glTexParameteri)
- return;
- _gles1_api.glTexParameteri(target, pname, param);
-}
-
-static void
-_evgl_gles1_glTexParameterx(GLenum target, GLenum pname, GLfixed param)
-{
- if (!_gles1_api.glTexParameterx)
- return;
- _gles1_api.glTexParameterx(target, pname, param);
-}
-
-static void
-_evgl_gles1_glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- if (!_gles1_api.glTexParameteriv)
- return;
- _gles1_api.glTexParameteriv(target, pname, params);
-}
-
-static void
-_evgl_gles1_glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params)
-{
- if (!_gles1_api.glTexParameterxv)
- return;
- _gles1_api.glTexParameterxv(target, pname, params);
-}
-
-static void
-_evgl_gles1_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- if (!_gles1_api.glTexSubImage2D)
- return;
- _gles1_api.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-static void
-_evgl_gles1_glTranslatex(GLfixed x, GLfixed y, GLfixed z)
-{
- if (!_gles1_api.glTranslatex)
- return;
- _gles1_api.glTranslatex(x, y, z);
-}
-
-static void
-_evgl_gles1_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- if (!_gles1_api.glVertexPointer)
- return;
- _gles1_api.glVertexPointer(size, type, stride, pointer);
-}
-
-static void
-_evgl_gles1_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- EVGL_Resource *rsc;
- EVGL_Context *ctx;
- int oc[4] = {0,0,0,0}, nc[4] = {0,0,0,0};
- int cc[4] = {0,0,0,0};
-
- if (!_gles1_api.glViewport)
- return;
-
- if (!(rsc=_evgl_tls_resource_get()))
- {
- ERR("Unable to execute GL command. Error retrieving tls");
- return;
- }
-
- if (!rsc->current_eng)
- {
- ERR("Unable to retrive Current Engine");
- return;
- }
-
- ctx = rsc->current_ctx;
- if (!ctx)
- {
- ERR("Unable to retrive Current Context");
- return;
- }
-
- if (ctx->version != EVAS_GL_GLES_1_X)
- {
- ERR("Invalid context version %d", (int) ctx->version);
- return;
- }
-
- if (_evgl_direct_enabled())
- {
- if (!(rsc->current_ctx->current_fbo))
- //|| rsc->current_ctx->map_tex)
- {
- if ((!ctx->direct_scissor))
- {
- _gles1_api.glEnable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 1;
- }
-
- if ((ctx->scissor_updated) && (ctx->scissor_enabled))
- {
- // Recompute the scissor coordinates
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 1,
- ctx->scissor_coord[0], ctx->scissor_coord[1],
- ctx->scissor_coord[2], ctx->scissor_coord[3],
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
-
- RECTS_CLIP_TO_RECT(nc[0], nc[1], nc[2], nc[3], cc[0], cc[1], cc[2], cc[3]);
- _gles1_api.glScissor(nc[0], nc[1], nc[2], nc[3]);
-
- ctx->direct_scissor = 0;
-
- // Compute the viewport coordinate
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 0,
- x, y, width, height,
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
- _gles1_api.glViewport(nc[0], nc[1], nc[2], nc[3]);
- }
- else
- {
-
- compute_gl_coordinates(rsc->direct.win_w, rsc->direct.win_h,
- rsc->direct.rot, 0,
- x, y, width, height,
- rsc->direct.img.x, rsc->direct.img.y,
- rsc->direct.img.w, rsc->direct.img.h,
- rsc->direct.clip.x, rsc->direct.clip.y,
- rsc->direct.clip.w, rsc->direct.clip.h,
- oc, nc, cc);
- _gles1_api.glScissor(cc[0], cc[1], cc[2], cc[3]);
-
- _gles1_api.glViewport(nc[0], nc[1], nc[2], nc[3]);
- }
-
- // Keep a copy of the original coordinates
- ctx->viewport_coord[0] = x;
- ctx->viewport_coord[1] = y;
- ctx->viewport_coord[2] = width;
- ctx->viewport_coord[3] = height;
-
- ctx->viewport_updated = 1;
- }
- else
- {
- if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
- {
- _gles1_api.glDisable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 0;
- }
-
- _gles1_api.glViewport(x, y, width, height);
- }
- }
- else
- {
- if ((ctx->direct_scissor) && (!ctx->scissor_enabled))
- {
- _gles1_api.glDisable(GL_SCISSOR_TEST);
- ctx->direct_scissor = 0;
- }
-
- _gles1_api.glViewport(x, y, width, height);
- }
-}
-
-static void
-_evgld_gles1_glAlphaFunc(GLenum func, GLclampf ref)
-{
- if (!_gles1_api.glAlphaFunc)
- {
- ERR("Can not call glAlphaFunc() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glAlphaFunc(func, ref);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- if (!_gles1_api.glClearColor)
- {
- ERR("Can not call glClearColor() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glClearColor(red, green, blue, alpha);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glClearDepthf(GLclampf depth)
-{
- if (!_gles1_api.glClearDepthf)
- {
- ERR("Can not call glClearDepthf() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glClearDepthf(depth);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glClipPlanef(GLenum plane, const GLfloat *equation)
-{
- if (!_gles1_api.glClipPlanef)
- {
- ERR("Can not call glClipPlanef() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glClipPlanef(plane, equation);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)
-{
- if (!_gles1_api.glColor4f)
- {
- ERR("Can not call glColor4f() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glColor4f(red, green, blue, alpha);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glDepthRangef(GLclampf zNear, GLclampf zFar)
-{
- if (!_gles1_api.glDepthRangef)
- {
- ERR("Can not call glDepthRangef() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glDepthRangef(zNear, zFar);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glFogf(GLenum pname, GLfloat param)
-{
- if (!_gles1_api.glFogf)
- {
- ERR("Can not call glFogf() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glFogf(pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glFogfv(GLenum pname, const GLfloat *params)
-{
- if (!_gles1_api.glFogfv)
- {
- ERR("Can not call glFogfv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glFogfv(pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
- if (!_gles1_api.glFrustumf)
- {
- ERR("Can not call glFrustumf() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glFrustumf(left, right, bottom, top, zNear, zFar);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetClipPlanef(GLenum pname, GLfloat eqn[4])
-{
- if (!_gles1_api.glGetClipPlanef)
- {
- ERR("Can not call glGetClipPlanef() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetClipPlanef(pname, eqn);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetFloatv(GLenum pname, GLfloat *params)
-{
- if (!_gles1_api.glGetFloatv)
- {
- ERR("Can not call glGetFloatv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetFloatv(pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetLightfv(GLenum light, GLenum pname, GLfloat *params)
-{
- if (!_gles1_api.glGetLightfv)
- {
- ERR("Can not call glGetLightfv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetLightfv(light, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params)
-{
- if (!_gles1_api.glGetMaterialfv)
- {
- ERR("Can not call glGetMaterialfv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetMaterialfv(face, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params)
-{
- if (!_gles1_api.glGetTexEnvfv)
- {
- ERR("Can not call glGetTexEnvfv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetTexEnvfv(env, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params)
-{
- if (!_gles1_api.glGetTexParameterfv)
- {
- ERR("Can not call glGetTexParameterfv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetTexParameterfv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glLightModelf(GLenum pname, GLfloat param)
-{
- if (!_gles1_api.glLightModelf)
- {
- ERR("Can not call glLightModelf() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glLightModelf(pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glLightModelfv(GLenum pname, const GLfloat *params)
-{
- if (!_gles1_api.glLightModelfv)
- {
- ERR("Can not call glLightModelfv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glLightModelfv(pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glLightf(GLenum light, GLenum pname, GLfloat param)
-{
- if (!_gles1_api.glLightf)
- {
- ERR("Can not call glLightf() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glLightf(light, pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glLightfv(GLenum light, GLenum pname, const GLfloat *params)
-{
- if (!_gles1_api.glLightfv)
- {
- ERR("Can not call glLightfv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glLightfv(light, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glLineWidth(GLfloat width)
-{
- if (!_gles1_api.glLineWidth)
- {
- ERR("Can not call glLineWidth() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glLineWidth(width);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glLoadMatrixf(const GLfloat *m)
-{
- if (!_gles1_api.glLoadMatrixf)
- {
- ERR("Can not call glLoadMatrixf() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glLoadMatrixf(m);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glMaterialf(GLenum face, GLenum pname, GLfloat param)
-{
- if (!_gles1_api.glMaterialf)
- {
- ERR("Can not call glMaterialf() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glMaterialf(face, pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params)
-{
- if (!_gles1_api.glMaterialfv)
- {
- ERR("Can not call glMaterialfv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glMaterialfv(face, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glMultMatrixf(const GLfloat *m)
-{
- if (!_gles1_api.glMultMatrixf)
- {
- ERR("Can not call glMultMatrixf() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glMultMatrixf(m);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)
-{
- if (!_gles1_api.glMultiTexCoord4f)
- {
- ERR("Can not call glMultiTexCoord4f() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glMultiTexCoord4f(target, s, t, r, q);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz)
-{
- if (!_gles1_api.glNormal3f)
- {
- ERR("Can not call glNormal3f() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glNormal3f(nx, ny, nz);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
-{
- if (!_gles1_api.glOrthof)
- {
- ERR("Can not call glOrthof() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glOrthof(left, right, bottom, top, zNear, zFar);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glPointParameterf(GLenum pname, GLfloat param)
-{
- if (!_gles1_api.glPointParameterf)
- {
- ERR("Can not call glPointParameterf() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glPointParameterf(pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glPointParameterfv(GLenum pname, const GLfloat *params)
-{
- if (!_gles1_api.glPointParameterfv)
- {
- ERR("Can not call glPointParameterfv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glPointParameterfv(pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glPointSize(GLfloat size)
-{
- if (!_gles1_api.glPointSize)
- {
- ERR("Can not call glPointSize() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glPointSize(size);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- if (!_gles1_api.glPointSizePointerOES)
- {
- ERR("Can not call glPointSizePointerOES() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glPointSizePointerOES(type, stride, pointer);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glPolygonOffset(GLfloat factor, GLfloat units)
-{
- if (!_gles1_api.glPolygonOffset)
- {
- ERR("Can not call glPolygonOffset() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glPolygonOffset(factor, units);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
-{
- if (!_gles1_api.glRotatef)
- {
- ERR("Can not call glRotatef() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glRotatef(angle, x, y, z);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glScalef(GLfloat x, GLfloat y, GLfloat z)
-{
- if (!_gles1_api.glScalef)
- {
- ERR("Can not call glScalef() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glScalef(x, y, z);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTexEnvf(GLenum target, GLenum pname, GLfloat param)
-{
- if (!_gles1_api.glTexEnvf)
- {
- ERR("Can not call glTexEnvf() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTexEnvf(target, pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- if (!_gles1_api.glTexEnvfv)
- {
- ERR("Can not call glTexEnvfv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTexEnvfv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- if (!_gles1_api.glTexParameterf)
- {
- ERR("Can not call glTexParameterf() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTexParameterf(target, pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
-{
- if (!_gles1_api.glTexParameterfv)
- {
- ERR("Can not call glTexParameterfv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTexParameterfv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTranslatef(GLfloat x, GLfloat y, GLfloat z)
-{
- if (!_gles1_api.glTranslatef)
- {
- ERR("Can not call glTranslatef() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTranslatef(x, y, z);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glActiveTexture(GLenum texture)
-{
- if (!_gles1_api.glActiveTexture)
- {
- ERR("Can not call glActiveTexture() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glActiveTexture(texture);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glAlphaFuncx(GLenum func, GLclampx ref)
-{
- if (!_gles1_api.glAlphaFuncx)
- {
- ERR("Can not call glAlphaFuncx() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glAlphaFuncx(func, ref);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glBindBuffer(GLenum target, GLuint buffer)
-{
- if (!_gles1_api.glBindBuffer)
- {
- ERR("Can not call glBindBuffer() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glBindBuffer(target, buffer);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glBindTexture(GLenum target, GLuint texture)
-{
- if (!_gles1_api.glBindTexture)
- {
- ERR("Can not call glBindTexture() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glBindTexture(target, texture);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- if (!_gles1_api.glBlendFunc)
- {
- ERR("Can not call glBlendFunc() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glBlendFunc(sfactor, dfactor);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)
-{
- if (!_gles1_api.glBufferData)
- {
- ERR("Can not call glBufferData() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glBufferData(target, size, data, usage);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)
-{
- if (!_gles1_api.glBufferSubData)
- {
- ERR("Can not call glBufferSubData() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glBufferSubData(target, offset, size, data);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glClear(GLbitfield mask)
-{
- if (!_gles1_api.glClear)
- {
- ERR("Can not call glClear() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glClear(mask);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
-{
- if (!_gles1_api.glClearColorx)
- {
- ERR("Can not call glClearColorx() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glClearColorx(red, green, blue, alpha);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glClearDepthx(GLclampx depth)
-{
- if (!_gles1_api.glClearDepthx)
- {
- ERR("Can not call glClearDepthx() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glClearDepthx(depth);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glClearStencil(GLint s)
-{
- if (!_gles1_api.glClearStencil)
- {
- ERR("Can not call glClearStencil() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glClearStencil(s);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glClientActiveTexture(GLenum texture)
-{
- if (!_gles1_api.glClientActiveTexture)
- {
- ERR("Can not call glClientActiveTexture() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glClientActiveTexture(texture);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glClipPlanex(GLenum plane, const GLfixed *equation)
-{
- if (!_gles1_api.glClipPlanex)
- {
- ERR("Can not call glClipPlanex() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glClipPlanex(plane, equation);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
-{
- if (!_gles1_api.glColor4ub)
- {
- ERR("Can not call glColor4ub() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glColor4ub(red, green, blue, alpha);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
-{
- if (!_gles1_api.glColor4x)
- {
- ERR("Can not call glColor4x() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glColor4x(red, green, blue, alpha);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- if (!_gles1_api.glColorMask)
- {
- ERR("Can not call glColorMask() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glColorMask(red, green, blue, alpha);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- if (!_gles1_api.glColorPointer)
- {
- ERR("Can not call glColorPointer() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glColorPointer(size, type, stride, pointer);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)
-{
- if (!_gles1_api.glCompressedTexImage2D)
- {
- ERR("Can not call glCompressedTexImage2D() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)
-{
- if (!_gles1_api.glCompressedTexSubImage2D)
- {
- ERR("Can not call glCompressedTexSubImage2D() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- if (!_gles1_api.glCopyTexImage2D)
- {
- ERR("Can not call glCopyTexImage2D() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- if (!_gles1_api.glCopyTexSubImage2D)
- {
- ERR("Can not call glCopyTexSubImage2D() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glCullFace(GLenum mode)
-{
- if (!_gles1_api.glCullFace)
- {
- ERR("Can not call glCullFace() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glCullFace(mode);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glDeleteBuffers(GLsizei n, const GLuint *buffers)
-{
- if (!_gles1_api.glDeleteBuffers)
- {
- ERR("Can not call glDeleteBuffers() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glDeleteBuffers(n, buffers);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glDeleteTextures(GLsizei n, const GLuint *textures)
-{
- if (!_gles1_api.glDeleteTextures)
- {
- ERR("Can not call glDeleteTextures() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glDeleteTextures(n, textures);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glDepthFunc(GLenum func)
-{
- if (!_gles1_api.glDepthFunc)
- {
- ERR("Can not call glDepthFunc() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glDepthFunc(func);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glDepthMask(GLboolean flag)
-{
- if (!_gles1_api.glDepthMask)
- {
- ERR("Can not call glDepthMask() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glDepthMask(flag);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glDepthRangex(GLclampx zNear, GLclampx zFar)
-{
- if (!_gles1_api.glDepthRangex)
- {
- ERR("Can not call glDepthRangex() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glDepthRangex(zNear, zFar);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glDisable(GLenum cap)
-{
- if (!_gles1_api.glDisable)
- {
- ERR("Can not call glDisable() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glDisable(cap);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glDisableClientState(GLenum array)
-{
- if (!_gles1_api.glDisableClientState)
- {
- ERR("Can not call glDisableClientState() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glDisableClientState(array);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- if (!_gles1_api.glDrawArrays)
- {
- ERR("Can not call glDrawArrays() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glDrawArrays(mode, first, count);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)
-{
- if (!_gles1_api.glDrawElements)
- {
- ERR("Can not call glDrawElements() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glDrawElements(mode, count, type, indices);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glEnable(GLenum cap)
-{
- if (!_gles1_api.glEnable)
- {
- ERR("Can not call glEnable() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glEnable(cap);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glEnableClientState(GLenum array)
-{
- if (!_gles1_api.glEnableClientState)
- {
- ERR("Can not call glEnableClientState() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glEnableClientState(array);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glFinish(void)
-{
- if (!_gles1_api.glFinish)
- {
- ERR("Can not call glFinish() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glFinish();
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glFlush(void)
-{
- if (!_gles1_api.glFlush)
- {
- ERR("Can not call glFlush() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glFlush();
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glFogx(GLenum pname, GLfixed param)
-{
- if (!_gles1_api.glFogx)
- {
- ERR("Can not call glFogx() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glFogx(pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glFogxv(GLenum pname, const GLfixed *params)
-{
- if (!_gles1_api.glFogxv)
- {
- ERR("Can not call glFogxv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glFogxv(pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glFrontFace(GLenum mode)
-{
- if (!_gles1_api.glFrontFace)
- {
- ERR("Can not call glFrontFace() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glFrontFace(mode);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
- if (!_gles1_api.glFrustumx)
- {
- ERR("Can not call glFrustumx() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glFrustumx(left, right, bottom, top, zNear, zFar);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetBooleanv(GLenum pname, GLboolean *params)
-{
- if (!_gles1_api.glGetBooleanv)
- {
- ERR("Can not call glGetBooleanv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetBooleanv(pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- if (!_gles1_api.glGetBufferParameteriv)
- {
- ERR("Can not call glGetBufferParameteriv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetBufferParameteriv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetClipPlanex(GLenum pname, GLfixed eqn[4])
-{
- if (!_gles1_api.glGetClipPlanex)
- {
- ERR("Can not call glGetClipPlanex() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetClipPlanex(pname, eqn);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGenBuffers(GLsizei n, GLuint *buffers)
-{
- if (!_gles1_api.glGenBuffers)
- {
- ERR("Can not call glGenBuffers() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGenBuffers(n, buffers);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGenTextures(GLsizei n, GLuint *textures)
-{
- if (!_gles1_api.glGenTextures)
- {
- ERR("Can not call glGenTextures() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGenTextures(n, textures);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static GLenum
-_evgld_gles1_glGetError(void)
-{
- GLenum ret;
- if (!_gles1_api.glGetError)
- {
- ERR("Can not call glGetError() in this context!");
- return EVAS_GL_NOT_INITIALIZED;
- }
- EVGL_FUNC_BEGIN();
- ret = _evgl_gles1_glGetError();
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-static void
-_evgld_gles1_glGetFixedv(GLenum pname, GLfixed *params)
-{
- if (!_gles1_api.glGetFixedv)
- {
- ERR("Can not call glGetFixedv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetFixedv(pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetIntegerv(GLenum pname, GLint *params)
-{
- if (!_gles1_api.glGetIntegerv)
- {
- ERR("Can not call glGetIntegerv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetIntegerv(pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetLightxv(GLenum light, GLenum pname, GLfixed *params)
-{
- if (!_gles1_api.glGetLightxv)
- {
- ERR("Can not call glGetLightxv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetLightxv(light, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params)
-{
- if (!_gles1_api.glGetMaterialxv)
- {
- ERR("Can not call glGetMaterialxv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetMaterialxv(face, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetPointerv(GLenum pname, GLvoid **params)
-{
- if (!_gles1_api.glGetPointerv)
- {
- ERR("Can not call glGetPointerv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetPointerv(pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static const GLubyte *
-_evgld_gles1_glGetString(GLenum name)
-{
- const GLubyte * ret;
- if (!_gles1_api.glGetString)
- {
- ERR("Can not call glGetString() in this context!");
- return NULL;
- }
- EVGL_FUNC_BEGIN();
- ret = _evgl_gles1_glGetString(name);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-static void
-_evgld_gles1_glGetTexEnviv(GLenum env, GLenum pname, GLint *params)
-{
- if (!_gles1_api.glGetTexEnviv)
- {
- ERR("Can not call glGetTexEnviv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetTexEnviv(env, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params)
-{
- if (!_gles1_api.glGetTexEnvxv)
- {
- ERR("Can not call glGetTexEnvxv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetTexEnvxv(env, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetTexParameteriv(GLenum target, GLenum pname, GLint *params)
-{
- if (!_gles1_api.glGetTexParameteriv)
- {
- ERR("Can not call glGetTexParameteriv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetTexParameteriv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params)
-{
- if (!_gles1_api.glGetTexParameterxv)
- {
- ERR("Can not call glGetTexParameterxv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glGetTexParameterxv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glHint(GLenum target, GLenum mode)
-{
- if (!_gles1_api.glHint)
- {
- ERR("Can not call glHint() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glHint(target, mode);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static GLboolean
-_evgld_gles1_glIsBuffer(GLuint buffer)
-{
- GLboolean ret;
- if (!_gles1_api.glIsBuffer)
- {
- ERR("Can not call glIsBuffer() in this context!");
- return EINA_FALSE;
- }
- EVGL_FUNC_BEGIN();
- ret = _evgl_gles1_glIsBuffer(buffer);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-static GLboolean
-_evgld_gles1_glIsEnabled(GLenum cap)
-{
- GLboolean ret;
- if (!_gles1_api.glIsEnabled)
- {
- ERR("Can not call glIsEnabled() in this context!");
- return EINA_FALSE;
- }
- EVGL_FUNC_BEGIN();
- ret = _evgl_gles1_glIsEnabled(cap);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-static GLboolean
-_evgld_gles1_glIsTexture(GLuint texture)
-{
- GLboolean ret;
- if (!_gles1_api.glIsTexture)
- {
- ERR("Can not call glIsTexture() in this context!");
- return EINA_FALSE;
- }
- EVGL_FUNC_BEGIN();
- ret = _evgl_gles1_glIsTexture(texture);
- GLERR();
- EVGL_FUNC_END();
- return ret;
-}
-
-static void
-_evgld_gles1_glLightModelx(GLenum pname, GLfixed param)
-{
- if (!_gles1_api.glLightModelx)
- {
- ERR("Can not call glLightModelx() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glLightModelx(pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glLightModelxv(GLenum pname, const GLfixed *params)
-{
- if (!_gles1_api.glLightModelxv)
- {
- ERR("Can not call glLightModelxv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glLightModelxv(pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glLightx(GLenum light, GLenum pname, GLfixed param)
-{
- if (!_gles1_api.glLightx)
- {
- ERR("Can not call glLightx() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glLightx(light, pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glLightxv(GLenum light, GLenum pname, const GLfixed *params)
-{
- if (!_gles1_api.glLightxv)
- {
- ERR("Can not call glLightxv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glLightxv(light, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glLineWidthx(GLfixed width)
-{
- if (!_gles1_api.glLineWidthx)
- {
- ERR("Can not call glLineWidthx() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glLineWidthx(width);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glLoadIdentity(void)
-{
- if (!_gles1_api.glLoadIdentity)
- {
- ERR("Can not call glLoadIdentity() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glLoadIdentity();
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glLoadMatrixx(const GLfixed *m)
-{
- if (!_gles1_api.glLoadMatrixx)
- {
- ERR("Can not call glLoadMatrixx() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glLoadMatrixx(m);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glLogicOp(GLenum opcode)
-{
- if (!_gles1_api.glLogicOp)
- {
- ERR("Can not call glLogicOp() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glLogicOp(opcode);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glMaterialx(GLenum face, GLenum pname, GLfixed param)
-{
- if (!_gles1_api.glMaterialx)
- {
- ERR("Can not call glMaterialx() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glMaterialx(face, pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glMaterialxv(GLenum face, GLenum pname, const GLfixed *params)
-{
- if (!_gles1_api.glMaterialxv)
- {
- ERR("Can not call glMaterialxv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glMaterialxv(face, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glMatrixMode(GLenum mode)
-{
- if (!_gles1_api.glMatrixMode)
- {
- ERR("Can not call glMatrixMode() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glMatrixMode(mode);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glMultMatrixx(const GLfixed *m)
-{
- if (!_gles1_api.glMultMatrixx)
- {
- ERR("Can not call glMultMatrixx() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glMultMatrixx(m);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
-{
- if (!_gles1_api.glMultiTexCoord4x)
- {
- ERR("Can not call glMultiTexCoord4x() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glMultiTexCoord4x(target, s, t, r, q);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz)
-{
- if (!_gles1_api.glNormal3x)
- {
- ERR("Can not call glNormal3x() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glNormal3x(nx, ny, nz);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- if (!_gles1_api.glNormalPointer)
- {
- ERR("Can not call glNormalPointer() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glNormalPointer(type, stride, pointer);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
-{
- if (!_gles1_api.glOrthox)
- {
- ERR("Can not call glOrthox() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glOrthox(left, right, bottom, top, zNear, zFar);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glPixelStorei(GLenum pname, GLint param)
-{
- if (!_gles1_api.glPixelStorei)
- {
- ERR("Can not call glPixelStorei() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glPixelStorei(pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glPointParameterx(GLenum pname, GLfixed param)
-{
- if (!_gles1_api.glPointParameterx)
- {
- ERR("Can not call glPointParameterx() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glPointParameterx(pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glPointParameterxv(GLenum pname, const GLfixed *params)
-{
- if (!_gles1_api.glPointParameterxv)
- {
- ERR("Can not call glPointParameterxv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glPointParameterxv(pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glPointSizex(GLfixed size)
-{
- if (!_gles1_api.glPointSizex)
- {
- ERR("Can not call glPointSizex() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glPointSizex(size);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glPolygonOffsetx(GLfixed factor, GLfixed units)
-{
- if (!_gles1_api.glPolygonOffsetx)
- {
- ERR("Can not call glPolygonOffsetx() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glPolygonOffsetx(factor, units);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glPopMatrix(void)
-{
- if (!_gles1_api.glPopMatrix)
- {
- ERR("Can not call glPopMatrix() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glPopMatrix();
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glPushMatrix(void)
-{
- if (!_gles1_api.glPushMatrix)
- {
- ERR("Can not call glPushMatrix() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glPushMatrix();
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)
-{
- if (!_gles1_api.glReadPixels)
- {
- ERR("Can not call glReadPixels() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glReadPixels(x, y, width, height, format, type, pixels);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
-{
- if (!_gles1_api.glRotatex)
- {
- ERR("Can not call glRotatex() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glRotatex(angle, x, y, z);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glSampleCoverage(GLclampf value, GLboolean invert)
-{
- if (!_gles1_api.glSampleCoverage)
- {
- ERR("Can not call glSampleCoverage() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glSampleCoverage(value, invert);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glSampleCoveragex(GLclampx value, GLboolean invert)
-{
- if (!_gles1_api.glSampleCoveragex)
- {
- ERR("Can not call glSampleCoveragex() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glSampleCoveragex(value, invert);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glScalex(GLfixed x, GLfixed y, GLfixed z)
-{
- if (!_gles1_api.glScalex)
- {
- ERR("Can not call glScalex() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glScalex(x, y, z);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- if (!_gles1_api.glScissor)
- {
- ERR("Can not call glScissor() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glScissor(x, y, width, height);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glShadeModel(GLenum mode)
-{
- if (!_gles1_api.glShadeModel)
- {
- ERR("Can not call glShadeModel() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glShadeModel(mode);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- if (!_gles1_api.glStencilFunc)
- {
- ERR("Can not call glStencilFunc() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glStencilFunc(func, ref, mask);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glStencilMask(GLuint mask)
-{
- if (!_gles1_api.glStencilMask)
- {
- ERR("Can not call glStencilMask() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glStencilMask(mask);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- if (!_gles1_api.glStencilOp)
- {
- ERR("Can not call glStencilOp() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glStencilOp(fail, zfail, zpass);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- if (!_gles1_api.glTexCoordPointer)
- {
- ERR("Can not call glTexCoordPointer() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTexCoordPointer(size, type, stride, pointer);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTexEnvi(GLenum target, GLenum pname, GLint param)
-{
- if (!_gles1_api.glTexEnvi)
- {
- ERR("Can not call glTexEnvi() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTexEnvi(target, pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTexEnvx(GLenum target, GLenum pname, GLfixed param)
-{
- if (!_gles1_api.glTexEnvx)
- {
- ERR("Can not call glTexEnvx() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTexEnvx(target, pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTexEnviv(GLenum target, GLenum pname, const GLint *params)
-{
- if (!_gles1_api.glTexEnviv)
- {
- ERR("Can not call glTexEnviv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTexEnviv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params)
-{
- if (!_gles1_api.glTexEnvxv)
- {
- ERR("Can not call glTexEnvxv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTexEnvxv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)
-{
- if (!_gles1_api.glTexImage2D)
- {
- ERR("Can not call glTexImage2D() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- if (!_gles1_api.glTexParameteri)
- {
- ERR("Can not call glTexParameteri() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTexParameteri(target, pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTexParameterx(GLenum target, GLenum pname, GLfixed param)
-{
- if (!_gles1_api.glTexParameterx)
- {
- ERR("Can not call glTexParameterx() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTexParameterx(target, pname, param);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTexParameteriv(GLenum target, GLenum pname, const GLint *params)
-{
- if (!_gles1_api.glTexParameteriv)
- {
- ERR("Can not call glTexParameteriv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTexParameteriv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params)
-{
- if (!_gles1_api.glTexParameterxv)
- {
- ERR("Can not call glTexParameterxv() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTexParameterxv(target, pname, params);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)
-{
- if (!_gles1_api.glTexSubImage2D)
- {
- ERR("Can not call glTexSubImage2D() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glTranslatex(GLfixed x, GLfixed y, GLfixed z)
-{
- if (!_gles1_api.glTranslatex)
- {
- ERR("Can not call glTranslatex() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glTranslatex(x, y, z);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
-{
- if (!_gles1_api.glVertexPointer)
- {
- ERR("Can not call glVertexPointer() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glVertexPointer(size, type, stride, pointer);
- GLERR();
- EVGL_FUNC_END();
-}
-
-static void
-_evgld_gles1_glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- if (!_gles1_api.glViewport)
- {
- ERR("Can not call glViewport() in this context!");
- return;
- }
- EVGL_FUNC_BEGIN();
- _evgl_gles1_glViewport(x, y, width, height);
- GLERR();
- EVGL_FUNC_END();
-}
-
-
-
-static void
-_evgl_load_gles1_apis(void *dl_handle, Evas_GL_API *funcs)
-{
- if (!dl_handle) return;
-
-#define ORD(name) funcs->name = dlsym(dl_handle, #name)
- /* Available only in Common profile */
- ORD(glAlphaFunc);
- ORD(glClearColor);
- ORD(glClearDepthf);
- ORD(glClipPlanef);
- ORD(glColor4f);
- ORD(glDepthRangef);
- ORD(glFogf);
- ORD(glFogfv);
- ORD(glFrustumf);
- ORD(glGetClipPlanef);
- ORD(glGetFloatv);
- ORD(glGetLightfv);
- ORD(glGetMaterialfv);
- ORD(glGetTexEnvfv);
- ORD(glGetTexParameterfv);
- ORD(glLightModelf);
- ORD(glLightModelfv);
- ORD(glLightf);
- ORD(glLightfv);
- ORD(glLineWidth);
- ORD(glLoadMatrixf);
- ORD(glMaterialf);
- ORD(glMaterialfv);
- ORD(glMultMatrixf);
- ORD(glMultiTexCoord4f);
- ORD(glNormal3f);
- ORD(glOrthof);
- ORD(glPointParameterf);
- ORD(glPointParameterfv);
- ORD(glPointSize);
- ORD(glPointSizePointerOES);
- ORD(glPolygonOffset);
- ORD(glRotatef);
- ORD(glScalef);
- ORD(glTexEnvf);
- ORD(glTexEnvfv);
- ORD(glTexParameterf);
- ORD(glTexParameterfv);
- ORD(glTranslatef);
- /* Available in both Common and Common-Lite profiles */
- ORD(glActiveTexture);
- ORD(glAlphaFuncx);
- ORD(glBindBuffer);
- ORD(glBindTexture);
- ORD(glBlendFunc);
- ORD(glBufferData);
- ORD(glBufferSubData);
- ORD(glClear);
- ORD(glClearColorx);
- ORD(glClearDepthx);
- ORD(glClearStencil);
- ORD(glClientActiveTexture);
- ORD(glClipPlanex);
- ORD(glColor4ub);
- ORD(glColor4x);
- ORD(glColorMask);
- ORD(glColorPointer);
- ORD(glCompressedTexImage2D);
- ORD(glCompressedTexSubImage2D);
- ORD(glCopyTexImage2D);
- ORD(glCopyTexSubImage2D);
- ORD(glCullFace);
- ORD(glDeleteBuffers);
- ORD(glDeleteTextures);
- ORD(glDepthFunc);
- ORD(glDepthMask);
- ORD(glDepthRangex);
- ORD(glDisable);
- ORD(glDisableClientState);
- ORD(glDrawArrays);
- ORD(glDrawElements);
- ORD(glEnable);
- ORD(glEnableClientState);
- ORD(glFinish);
- ORD(glFlush);
- ORD(glFogx);
- ORD(glFogxv);
- ORD(glFrontFace);
- ORD(glFrustumx);
- ORD(glGetBooleanv);
- ORD(glGetBufferParameteriv);
- ORD(glGetClipPlanex);
- ORD(glGenBuffers);
- ORD(glGenTextures);
- ORD(glGetError);
- ORD(glGetFixedv);
- ORD(glGetIntegerv);
- ORD(glGetLightxv);
- ORD(glGetMaterialxv);
- ORD(glGetPointerv);
- ORD(glGetString);
- ORD(glGetTexEnviv);
- ORD(glGetTexEnvxv);
- ORD(glGetTexParameteriv);
- ORD(glGetTexParameterxv);
- ORD(glHint);
- ORD(glIsBuffer);
- ORD(glIsEnabled);
- ORD(glIsTexture);
- ORD(glLightModelx);
- ORD(glLightModelxv);
- ORD(glLightx);
- ORD(glLightxv);
- ORD(glLineWidthx);
- ORD(glLoadIdentity);
- ORD(glLoadMatrixx);
- ORD(glLogicOp);
- ORD(glMaterialx);
- ORD(glMaterialxv);
- ORD(glMatrixMode);
- ORD(glMultMatrixx);
- ORD(glMultiTexCoord4x);
- ORD(glNormal3x);
- ORD(glNormalPointer);
- ORD(glOrthox);
- ORD(glPixelStorei);
- ORD(glPointParameterx);
- ORD(glPointParameterxv);
- ORD(glPointSizex);
- ORD(glPolygonOffsetx);
- ORD(glPopMatrix);
- ORD(glPushMatrix);
- ORD(glReadPixels);
- ORD(glRotatex);
- ORD(glSampleCoverage);
- ORD(glSampleCoveragex);
- ORD(glScalex);
- ORD(glScissor);
- ORD(glShadeModel);
- ORD(glStencilFunc);
- ORD(glStencilMask);
- ORD(glStencilOp);
- ORD(glTexCoordPointer);
- ORD(glTexEnvi);
- ORD(glTexEnvx);
- ORD(glTexEnviv);
- ORD(glTexEnvxv);
- ORD(glTexImage2D);
- ORD(glTexParameteri);
- ORD(glTexParameterx);
- ORD(glTexParameteriv);
- ORD(glTexParameterxv);
- ORD(glTexSubImage2D);
- ORD(glTranslatex);
- ORD(glVertexPointer);
- ORD(glViewport);
-#undef ORD
-}
-
-static Eina_Bool
-_evgl_gles1_api_init(void)
-{
- static Eina_Bool _initialized = EINA_FALSE;
- if (_initialized) return EINA_TRUE;
-
- memset(&_gles1_api, 0, sizeof(_gles1_api));
- _gles1_handle = dlopen("libGLES_CM.so", RTLD_NOW);
- if (!_gles1_handle) _gles1_handle = dlopen("libGLES_CM.so.1", RTLD_NOW);
- if (!_gles1_handle) _gles1_handle = dlopen("libGLES_CM.so.1.1", RTLD_NOW);
- if (!_gles1_handle) _gles1_handle = dlopen("libGLESv1_CM.so", RTLD_NOW);
- if (!_gles1_handle) _gles1_handle = dlopen("libGLESv1_CM.so.1", RTLD_NOW);
- if (!_gles1_handle)
- {
- WRN("OpenGL ES 1 was not found on this system. Evas GL will not support GLES 1 contexts.");
- return EINA_FALSE;
- }
-
- _evgl_load_gles1_apis(_gles1_handle, &_gles1_api);
- if (!_evgl_api_gles1_ext_init())
- WRN("Could not initialize OpenGL ES 1 extensions yet.");
-
- _initialized = EINA_TRUE;
- return EINA_TRUE;
-}
-
-static void
-_debug_gles1_api_get(Evas_GL_API *funcs)
-{
- if (!funcs) return;
-
-#define ORD(name) EVAS_API_OVERRIDE(name, funcs, _evgld_gles1_)
- /* Available only in Common profile */
- ORD(glAlphaFunc);
- ORD(glClearColor);
- ORD(glClearDepthf);
- ORD(glClipPlanef);
- ORD(glColor4f);
- ORD(glDepthRangef);
- ORD(glFogf);
- ORD(glFogfv);
- ORD(glFrustumf);
- ORD(glGetClipPlanef);
- ORD(glGetFloatv);
- ORD(glGetLightfv);
- ORD(glGetMaterialfv);
- ORD(glGetTexEnvfv);
- ORD(glGetTexParameterfv);
- ORD(glLightModelf);
- ORD(glLightModelfv);
- ORD(glLightf);
- ORD(glLightfv);
- ORD(glLineWidth);
- ORD(glLoadMatrixf);
- ORD(glMaterialf);
- ORD(glMaterialfv);
- ORD(glMultMatrixf);
- ORD(glMultiTexCoord4f);
- ORD(glNormal3f);
- ORD(glOrthof);
- ORD(glPointParameterf);
- ORD(glPointParameterfv);
- ORD(glPointSize);
- ORD(glPointSizePointerOES);
- ORD(glPolygonOffset);
- ORD(glRotatef);
- ORD(glScalef);
- ORD(glTexEnvf);
- ORD(glTexEnvfv);
- ORD(glTexParameterf);
- ORD(glTexParameterfv);
- ORD(glTranslatef);
- /* Available in both Common and Common-Lite profiles */
- ORD(glActiveTexture);
- ORD(glAlphaFuncx);
- ORD(glBindBuffer);
- ORD(glBindTexture);
- ORD(glBlendFunc);
- ORD(glBufferData);
- ORD(glBufferSubData);
- ORD(glClear);
- ORD(glClearColorx);
- ORD(glClearDepthx);
- ORD(glClearStencil);
- ORD(glClientActiveTexture);
- ORD(glClipPlanex);
- ORD(glColor4ub);
- ORD(glColor4x);
- ORD(glColorMask);
- ORD(glColorPointer);
- ORD(glCompressedTexImage2D);
- ORD(glCompressedTexSubImage2D);
- ORD(glCopyTexImage2D);
- ORD(glCopyTexSubImage2D);
- ORD(glCullFace);
- ORD(glDeleteBuffers);
- ORD(glDeleteTextures);
- ORD(glDepthFunc);
- ORD(glDepthMask);
- ORD(glDepthRangex);
- ORD(glDisable);
- ORD(glDisableClientState);
- ORD(glDrawArrays);
- ORD(glDrawElements);
- ORD(glEnable);
- ORD(glEnableClientState);
- ORD(glFinish);
- ORD(glFlush);
- ORD(glFogx);
- ORD(glFogxv);
- ORD(glFrontFace);
- ORD(glFrustumx);
- ORD(glGetBooleanv);
- ORD(glGetBufferParameteriv);
- ORD(glGetClipPlanex);
- ORD(glGenBuffers);
- ORD(glGenTextures);
- ORD(glGetError);
- ORD(glGetFixedv);
- ORD(glGetIntegerv);
- ORD(glGetLightxv);
- ORD(glGetMaterialxv);
- ORD(glGetPointerv);
- ORD(glGetString);
- ORD(glGetTexEnviv);
- ORD(glGetTexEnvxv);
- ORD(glGetTexParameteriv);
- ORD(glGetTexParameterxv);
- ORD(glHint);
- ORD(glIsBuffer);
- ORD(glIsEnabled);
- ORD(glIsTexture);
- ORD(glLightModelx);
- ORD(glLightModelxv);
- ORD(glLightx);
- ORD(glLightxv);
- ORD(glLineWidthx);
- ORD(glLoadIdentity);
- ORD(glLoadMatrixx);
- ORD(glLogicOp);
- ORD(glMaterialx);
- ORD(glMaterialxv);
- ORD(glMatrixMode);
- ORD(glMultMatrixx);
- ORD(glMultiTexCoord4x);
- ORD(glNormal3x);
- ORD(glNormalPointer);
- ORD(glOrthox);
- ORD(glPixelStorei);
- ORD(glPointParameterx);
- ORD(glPointParameterxv);
- ORD(glPointSizex);
- ORD(glPolygonOffsetx);
- ORD(glPopMatrix);
- ORD(glPushMatrix);
- ORD(glReadPixels);
- ORD(glRotatex);
- ORD(glSampleCoverage);
- ORD(glSampleCoveragex);
- ORD(glScalex);
- ORD(glScissor);
- ORD(glShadeModel);
- ORD(glStencilFunc);
- ORD(glStencilMask);
- ORD(glStencilOp);
- ORD(glTexCoordPointer);
- ORD(glTexEnvi);
- ORD(glTexEnvx);
- ORD(glTexEnviv);
- ORD(glTexEnvxv);
- ORD(glTexImage2D);
- ORD(glTexParameteri);
- ORD(glTexParameterx);
- ORD(glTexParameteriv);
- ORD(glTexParameterxv);
- ORD(glTexSubImage2D);
- ORD(glTranslatex);
- ORD(glVertexPointer);
- ORD(glViewport);
-#undef ORD
-
- evgl_api_gles1_ext_get(funcs);
-}
-
-static void
-_normal_gles1_api_get(Evas_GL_API *funcs)
-{
- if (!funcs) return;
-
-#define ORD(name) EVAS_API_OVERRIDE(name, funcs, _evgl_gles1_)
- /* Available only in Common profile */
- ORD(glAlphaFunc);
- ORD(glClearColor);
- ORD(glClearDepthf);
- ORD(glClipPlanef);
- ORD(glColor4f);
- ORD(glDepthRangef);
- ORD(glFogf);
- ORD(glFogfv);
- ORD(glFrustumf);
- ORD(glGetClipPlanef);
- ORD(glGetFloatv);
- ORD(glGetLightfv);
- ORD(glGetMaterialfv);
- ORD(glGetTexEnvfv);
- ORD(glGetTexParameterfv);
- ORD(glLightModelf);
- ORD(glLightModelfv);
- ORD(glLightf);
- ORD(glLightfv);
- ORD(glLineWidth);
- ORD(glLoadMatrixf);
- ORD(glMaterialf);
- ORD(glMaterialfv);
- ORD(glMultMatrixf);
- ORD(glMultiTexCoord4f);
- ORD(glNormal3f);
- ORD(glOrthof);
- ORD(glPointParameterf);
- ORD(glPointParameterfv);
- ORD(glPointSize);
- ORD(glPointSizePointerOES);
- ORD(glPolygonOffset);
- ORD(glRotatef);
- ORD(glScalef);
- ORD(glTexEnvf);
- ORD(glTexEnvfv);
- ORD(glTexParameterf);
- ORD(glTexParameterfv);
- ORD(glTranslatef);
- /* Available in both Common and Common-Lite profiles */
- ORD(glActiveTexture);
- ORD(glAlphaFuncx);
- ORD(glBindBuffer);
- ORD(glBindTexture);
- ORD(glBlendFunc);
- ORD(glBufferData);
- ORD(glBufferSubData);
- ORD(glClear);
- ORD(glClearColorx);
- ORD(glClearDepthx);
- ORD(glClearStencil);
- ORD(glClientActiveTexture);
- ORD(glClipPlanex);
- ORD(glColor4ub);
- ORD(glColor4x);
- ORD(glColorMask);
- ORD(glColorPointer);
- ORD(glCompressedTexImage2D);
- ORD(glCompressedTexSubImage2D);
- ORD(glCopyTexImage2D);
- ORD(glCopyTexSubImage2D);
- ORD(glCullFace);
- ORD(glDeleteBuffers);
- ORD(glDeleteTextures);
- ORD(glDepthFunc);
- ORD(glDepthMask);
- ORD(glDepthRangex);
- ORD(glDisable);
- ORD(glDisableClientState);
- ORD(glDrawArrays);
- ORD(glDrawElements);
- ORD(glEnable);
- ORD(glEnableClientState);
- ORD(glFinish);
- ORD(glFlush);
- ORD(glFogx);
- ORD(glFogxv);
- ORD(glFrontFace);
- ORD(glFrustumx);
- ORD(glGetBooleanv);
- ORD(glGetBufferParameteriv);
- ORD(glGetClipPlanex);
- ORD(glGenBuffers);
- ORD(glGenTextures);
- ORD(glGetError);
- ORD(glGetFixedv);
- ORD(glGetIntegerv);
- ORD(glGetLightxv);
- ORD(glGetMaterialxv);
- ORD(glGetPointerv);
- ORD(glGetString);
- ORD(glGetTexEnviv);
- ORD(glGetTexEnvxv);
- ORD(glGetTexParameteriv);
- ORD(glGetTexParameterxv);
- ORD(glHint);
- ORD(glIsBuffer);
- ORD(glIsEnabled);
- ORD(glIsTexture);
- ORD(glLightModelx);
- ORD(glLightModelxv);
- ORD(glLightx);
- ORD(glLightxv);
- ORD(glLineWidthx);
- ORD(glLoadIdentity);
- ORD(glLoadMatrixx);
- ORD(glLogicOp);
- ORD(glMaterialx);
- ORD(glMaterialxv);
- ORD(glMatrixMode);
- ORD(glMultMatrixx);
- ORD(glMultiTexCoord4x);
- ORD(glNormal3x);
- ORD(glNormalPointer);
- ORD(glOrthox);
- ORD(glPixelStorei);
- ORD(glPointParameterx);
- ORD(glPointParameterxv);
- ORD(glPointSizex);
- ORD(glPolygonOffsetx);
- ORD(glPopMatrix);
- ORD(glPushMatrix);
- ORD(glReadPixels);
- ORD(glRotatex);
- ORD(glSampleCoverage);
- ORD(glSampleCoveragex);
- ORD(glScalex);
- ORD(glScissor);
- ORD(glShadeModel);
- ORD(glStencilFunc);
- ORD(glStencilMask);
- ORD(glStencilOp);
- ORD(glTexCoordPointer);
- ORD(glTexEnvi);
- ORD(glTexEnvx);
- ORD(glTexEnviv);
- ORD(glTexEnvxv);
- ORD(glTexImage2D);
- ORD(glTexParameteri);
- ORD(glTexParameterx);
- ORD(glTexParameteriv);
- ORD(glTexParameterxv);
- ORD(glTexSubImage2D);
- ORD(glTranslatex);
- ORD(glVertexPointer);
- ORD(glViewport);
-#undef ORD
-
- evgl_api_gles1_ext_get(funcs);
-}
-
-void
-_evgl_api_gles1_get(Evas_GL_API *funcs, Eina_Bool debug)
-{
- if (!_evgl_gles1_api_init())
- return;
-
- if (debug)
- _debug_gles1_api_get(funcs);
- else
- _normal_gles1_api_get(funcs);
-
- // FIXME: This looks wrong, we should be calling the gles1 API
- // TODO: Implement these wrappers first
- //if (evgl_engine->direct_scissor_off)
- //_direct_scissor_off_api_get(funcs);
-}
-
-Evas_GL_API *
-_evgl_api_gles1_internal_get(void)
-{
- return &_gles1_api;
-}