--- /dev/null
- PFNGLXCREATENEWCONTEXTPROC glXCreateNewContext;
+ /*
+ * vigs
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include "vigs_gl_backend.h"
+ #include "vigs_log.h"
+ #include <GL/glx.h>
+ #include <dlfcn.h>
+
+ #ifndef GLX_VERSION_1_4
+ #error GL/glx.h must be equal to or greater than GLX 1.4
+ #endif
+
+ #define VIGS_GLX_GET_PROC(proc_type, proc_name) \
+ do { \
+ gl_backend_glx->proc_name = \
+ (proc_type)gl_backend_glx->glXGetProcAddress((const GLubyte*)#proc_name); \
+ if (!gl_backend_glx->proc_name) { \
+ VIGS_LOG_CRITICAL("Unable to load symbol: %s", dlerror()); \
+ goto fail2; \
+ } \
+ } while (0)
+
+ #define VIGS_GL_GET_PROC(func, proc_name) \
+ do { \
+ *(void**)(&gl_backend_glx->base.func) = gl_backend_glx->glXGetProcAddress((const GLubyte*)#proc_name); \
+ if (!gl_backend_glx->base.func) { \
+ *(void**)(&gl_backend_glx->base.func) = dlsym(gl_backend_glx->handle, #proc_name); \
+ if (!gl_backend_glx->base.func) { \
+ VIGS_LOG_CRITICAL("Unable to load symbol: %s", dlerror()); \
+ goto fail2; \
+ } \
+ } \
+ } while (0)
+
+ #define VIGS_GL_GET_PROC_OPTIONAL(func, proc_name) \
+ do { \
+ *(void**)(&gl_backend_glx->base.func) = gl_backend_glx->glXGetProcAddress((const GLubyte*)#proc_name); \
+ if (!gl_backend_glx->base.func) { \
+ *(void**)(&gl_backend_glx->base.func) = dlsym(gl_backend_glx->handle, #proc_name); \
+ } \
+ } while (0)
+
+ /* GLX 1.0 */
+ typedef void (*PFNGLXDESTROYCONTEXTPROC)(Display *dpy, GLXContext ctx);
+ typedef GLXContext (*PFNGLXGETCURRENTCONTEXTPROC)(void);
+
+ struct vigs_gl_backend_glx
+ {
+ struct vigs_gl_backend base;
+
+ void *handle;
+
+ PFNGLXGETPROCADDRESSPROC glXGetProcAddress;
+ PFNGLXCHOOSEFBCONFIGPROC glXChooseFBConfig;
+ PFNGLXGETFBCONFIGATTRIBPROC glXGetFBConfigAttrib;
+ PFNGLXCREATEPBUFFERPROC glXCreatePbuffer;
+ PFNGLXDESTROYPBUFFERPROC glXDestroyPbuffer;
- *ctx = gl_backend_glx->glXCreateNewContext(gl_backend_glx->dpy,
- config,
- GLX_RGBA_TYPE,
- share_ctx,
- True);
+ PFNGLXDESTROYCONTEXTPROC glXDestroyContext;
+ PFNGLXMAKECONTEXTCURRENTPROC glXMakeContextCurrent;
+ PFNGLXGETCURRENTCONTEXTPROC glXGetCurrentContext;
+
++ /* GLX_ARB_create_context */
++ PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB;
++
+ Display *dpy;
+ GLXPbuffer sfc;
+ GLXContext ctx;
+ GLXPbuffer read_pixels_sfc;
+ GLXContext read_pixels_ctx;
+ };
+
+ static GLXFBConfig vigs_gl_backend_glx_get_config(struct vigs_gl_backend_glx *gl_backend_glx)
+ {
+ int config_attribs[] =
+ {
+ GLX_DOUBLEBUFFER, True,
+ GLX_RED_SIZE, 8,
+ GLX_GREEN_SIZE, 8,
+ GLX_BLUE_SIZE, 8,
+ GLX_ALPHA_SIZE, 8,
+ GLX_BUFFER_SIZE, 32,
+ GLX_DEPTH_SIZE, 24,
+ GLX_STENCIL_SIZE, 8,
+ GLX_RENDER_TYPE, GLX_RGBA_BIT,
+ GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
+ None
+ };
+ int n = 0;
+ GLXFBConfig *glx_configs;
+ GLXFBConfig best_config = NULL;
+
+ glx_configs = gl_backend_glx->glXChooseFBConfig(gl_backend_glx->dpy,
+ DefaultScreen(gl_backend_glx->dpy),
+ config_attribs,
+ &n);
+
+ if (n > 0) {
+ int tmp;
+ best_config = glx_configs[0];
+
+ if (gl_backend_glx->glXGetFBConfigAttrib(gl_backend_glx->dpy,
+ best_config,
+ GLX_FBCONFIG_ID,
+ &tmp) == Success) {
+ VIGS_LOG_INFO("GLX config ID: 0x%X", tmp);
+ }
+
+ if (gl_backend_glx->glXGetFBConfigAttrib(gl_backend_glx->dpy,
+ best_config,
+ GLX_VISUAL_ID,
+ &tmp) == Success) {
+ VIGS_LOG_INFO("GLX visual ID: 0x%X", tmp);
+ }
+ }
+
+ XFree(glx_configs);
+
+ if (!best_config) {
+ VIGS_LOG_CRITICAL("Suitable GLX config not found");
+ }
+
+ return best_config;
+ }
+
+ static bool vigs_gl_backend_glx_create_surface(struct vigs_gl_backend_glx *gl_backend_glx,
+ GLXFBConfig config,
+ GLXPbuffer *sfc)
+ {
+ int surface_attribs[] =
+ {
+ GLX_PBUFFER_WIDTH, 1,
+ GLX_PBUFFER_HEIGHT, 1,
+ GLX_LARGEST_PBUFFER, False,
+ None
+ };
+
+ *sfc = gl_backend_glx->glXCreatePbuffer(gl_backend_glx->dpy,
+ config,
+ surface_attribs);
+
+ if (!*sfc) {
+ VIGS_LOG_CRITICAL("glXCreatePbuffer failed");
+ return false;
+ }
+
+ return true;
+ }
+
+ static bool vigs_gl_backend_glx_create_context(struct vigs_gl_backend_glx *gl_backend_glx,
+ GLXFBConfig config,
+ GLXContext share_ctx,
+ GLXContext *ctx)
+ {
- VIGS_LOG_CRITICAL("glXCreateNewContext failed");
++ int attribs[] =
++ {
++ GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
++ GLX_CONTEXT_MINOR_VERSION_ARB, 0,
++ GLX_RENDER_TYPE, GLX_RGBA_TYPE,
++ None
++ };
++
++ *ctx = gl_backend_glx->glXCreateContextAttribsARB(gl_backend_glx->dpy,
++ config,
++ share_ctx,
++ True,
++ attribs);
+
+ if (!*ctx) {
- VIGS_GLX_GET_PROC(PFNGLXCREATENEWCONTEXTPROC, glXCreateNewContext);
++ VIGS_LOG_CRITICAL("glXCreateContextAttribsARB failed");
+ return false;
+ }
+
+ return true;
+ }
+
+ static bool vigs_gl_backend_glx_has_current(struct vigs_gl_backend *gl_backend)
+ {
+ struct vigs_gl_backend_glx *gl_backend_glx =
+ (struct vigs_gl_backend_glx*)gl_backend;
+
+ return gl_backend_glx->glXGetCurrentContext() != NULL;
+ }
+
+ static bool vigs_gl_backend_glx_make_current(struct vigs_gl_backend *gl_backend,
+ bool enable)
+ {
+ struct vigs_gl_backend_glx *gl_backend_glx =
+ (struct vigs_gl_backend_glx*)gl_backend;
+ Bool ret;
+
+ ret = gl_backend_glx->glXMakeContextCurrent(gl_backend_glx->dpy,
+ (enable ? gl_backend_glx->sfc : None),
+ (enable ? gl_backend_glx->sfc : None),
+ (enable ? gl_backend_glx->ctx : NULL));
+
+ if (!ret) {
+ VIGS_LOG_CRITICAL("glXMakeContextCurrent failed");
+ return false;
+ }
+
+ return true;
+ }
+
+ static bool vigs_gl_backend_glx_read_pixels_make_current(struct vigs_gl_backend *gl_backend,
+ bool enable)
+ {
+ struct vigs_gl_backend_glx *gl_backend_glx =
+ (struct vigs_gl_backend_glx*)gl_backend;
+ Bool ret;
+
+ ret = gl_backend_glx->glXMakeContextCurrent(gl_backend_glx->dpy,
+ (enable ? gl_backend_glx->read_pixels_sfc : None),
+ (enable ? gl_backend_glx->read_pixels_sfc : None),
+ (enable ? gl_backend_glx->read_pixels_ctx : NULL));
+
+ if (!ret) {
+ VIGS_LOG_CRITICAL("glXMakeContextCurrent failed");
+ return false;
+ }
+
+ return true;
+ }
+
+ static void vigs_gl_backend_glx_destroy(struct vigs_backend *backend)
+ {
+ struct vigs_gl_backend_glx *gl_backend_glx = (struct vigs_gl_backend_glx*)backend;
+
+ vigs_gl_backend_cleanup(&gl_backend_glx->base);
+
+ gl_backend_glx->glXDestroyContext(gl_backend_glx->dpy,
+ gl_backend_glx->read_pixels_ctx);
+
+ gl_backend_glx->glXDestroyContext(gl_backend_glx->dpy,
+ gl_backend_glx->ctx);
+
+ gl_backend_glx->glXDestroyPbuffer(gl_backend_glx->dpy,
+ gl_backend_glx->read_pixels_sfc);
+
+ gl_backend_glx->glXDestroyPbuffer(gl_backend_glx->dpy,
+ gl_backend_glx->sfc);
+
+ dlclose(gl_backend_glx->handle);
+
+ vigs_backend_cleanup(&gl_backend_glx->base.base);
+
+ g_free(gl_backend_glx);
+
+ VIGS_LOG_DEBUG("destroyed");
+ }
+
+ struct vigs_backend *vigs_gl_backend_create(void *display)
+ {
+ struct vigs_gl_backend_glx *gl_backend_glx;
+ GLXFBConfig config;
+ Display *x_display = display;
+
+ gl_backend_glx = g_malloc0(sizeof(*gl_backend_glx));
+
+ vigs_backend_init(&gl_backend_glx->base.base,
+ &gl_backend_glx->base.ws_info.base);
+
+ gl_backend_glx->handle = dlopen("libGL.so.1", RTLD_NOW | RTLD_GLOBAL);
+
+ if (!gl_backend_glx->handle) {
+ VIGS_LOG_CRITICAL("Unable to load libGL.so.1: %s", dlerror());
+ goto fail1;
+ }
+
+ gl_backend_glx->glXGetProcAddress =
+ dlsym(gl_backend_glx->handle, "glXGetProcAddress");
+
+ if (!gl_backend_glx->glXGetProcAddress) {
+ gl_backend_glx->glXGetProcAddress =
+ dlsym(gl_backend_glx->handle, "glXGetProcAddressARB");
+ }
+
+ if (!gl_backend_glx->glXGetProcAddress) {
+ VIGS_LOG_CRITICAL("Unable to load symbol: %s", dlerror());
+ goto fail2;
+ }
+
+ VIGS_GLX_GET_PROC(PFNGLXCHOOSEFBCONFIGPROC, glXChooseFBConfig);
+ VIGS_GLX_GET_PROC(PFNGLXGETFBCONFIGATTRIBPROC, glXGetFBConfigAttrib);
+ VIGS_GLX_GET_PROC(PFNGLXCREATEPBUFFERPROC, glXCreatePbuffer);
+ VIGS_GLX_GET_PROC(PFNGLXDESTROYPBUFFERPROC, glXDestroyPbuffer);
+ VIGS_GLX_GET_PROC(PFNGLXDESTROYCONTEXTPROC, glXDestroyContext);
+ VIGS_GLX_GET_PROC(PFNGLXMAKECONTEXTCURRENTPROC, glXMakeContextCurrent);
+ VIGS_GLX_GET_PROC(PFNGLXGETCURRENTCONTEXTPROC, glXGetCurrentContext);
++ VIGS_GLX_GET_PROC(PFNGLXCREATECONTEXTATTRIBSARBPROC, glXCreateContextAttribsARB);
+
+ VIGS_GL_GET_PROC(GenTextures, glGenTextures);
+ VIGS_GL_GET_PROC(DeleteTextures, glDeleteTextures);
+ VIGS_GL_GET_PROC(BindTexture, glBindTexture);
+ VIGS_GL_GET_PROC(Begin, glBegin);
+ VIGS_GL_GET_PROC(End, glEnd);
+ VIGS_GL_GET_PROC(CullFace, glCullFace);
+ VIGS_GL_GET_PROC(TexParameterf, glTexParameterf);
+ VIGS_GL_GET_PROC(TexParameterfv, glTexParameterfv);
+ VIGS_GL_GET_PROC(TexParameteri, glTexParameteri);
+ VIGS_GL_GET_PROC(TexParameteriv, glTexParameteriv);
+ VIGS_GL_GET_PROC(TexImage2D, glTexImage2D);
+ VIGS_GL_GET_PROC(TexSubImage2D, glTexSubImage2D);
+ VIGS_GL_GET_PROC(TexEnvf, glTexEnvf);
+ VIGS_GL_GET_PROC(TexEnvfv, glTexEnvfv);
+ VIGS_GL_GET_PROC(TexEnvi, glTexEnvi);
+ VIGS_GL_GET_PROC(TexEnviv, glTexEnviv);
+ VIGS_GL_GET_PROC(Clear, glClear);
+ VIGS_GL_GET_PROC(ClearColor, glClearColor);
+ VIGS_GL_GET_PROC(Disable, glDisable);
+ VIGS_GL_GET_PROC(Enable, glEnable);
+ VIGS_GL_GET_PROC(Finish, glFinish);
+ VIGS_GL_GET_PROC(Flush, glFlush);
+ VIGS_GL_GET_PROC(PixelStorei, glPixelStorei);
+ VIGS_GL_GET_PROC(ReadPixels, glReadPixels);
+ VIGS_GL_GET_PROC(Viewport, glViewport);
+ VIGS_GL_GET_PROC(GenFramebuffers, glGenFramebuffersEXT);
+ VIGS_GL_GET_PROC(GenRenderbuffers, glGenRenderbuffersEXT);
+ VIGS_GL_GET_PROC(DeleteFramebuffers, glDeleteFramebuffersEXT);
+ VIGS_GL_GET_PROC(DeleteRenderbuffers, glDeleteRenderbuffersEXT);
+ VIGS_GL_GET_PROC(BindFramebuffer, glBindFramebufferEXT);
+ VIGS_GL_GET_PROC(BindRenderbuffer, glBindRenderbufferEXT);
+ VIGS_GL_GET_PROC(RenderbufferStorage, glRenderbufferStorageEXT);
+ VIGS_GL_GET_PROC(FramebufferRenderbuffer, glFramebufferRenderbufferEXT);
+ VIGS_GL_GET_PROC(FramebufferTexture2D, glFramebufferTexture2DEXT);
+ VIGS_GL_GET_PROC(GetIntegerv, glGetIntegerv);
+ VIGS_GL_GET_PROC(GetString, glGetString);
+ VIGS_GL_GET_PROC(LoadIdentity, glLoadIdentity);
+ VIGS_GL_GET_PROC(MatrixMode, glMatrixMode);
+ VIGS_GL_GET_PROC(Ortho, glOrtho);
+ VIGS_GL_GET_PROC(EnableClientState, glEnableClientState);
+ VIGS_GL_GET_PROC(DisableClientState, glDisableClientState);
+ VIGS_GL_GET_PROC(Color4f, glColor4f);
+ VIGS_GL_GET_PROC(TexCoordPointer, glTexCoordPointer);
+ VIGS_GL_GET_PROC(VertexPointer, glVertexPointer);
+ VIGS_GL_GET_PROC(DrawArrays, glDrawArrays);
+ VIGS_GL_GET_PROC(Color4ub, glColor4ub);
+ VIGS_GL_GET_PROC(WindowPos2f, glWindowPos2f);
+ VIGS_GL_GET_PROC(PixelZoom, glPixelZoom);
+ VIGS_GL_GET_PROC(DrawPixels, glDrawPixels);
+ VIGS_GL_GET_PROC(BlendFunc, glBlendFunc);
+ VIGS_GL_GET_PROC(CopyTexImage2D, glCopyTexImage2D);
+ VIGS_GL_GET_PROC(BlitFramebuffer, glBlitFramebufferEXT);
+ VIGS_GL_GET_PROC(GenBuffers, glGenBuffers);
+ VIGS_GL_GET_PROC(DeleteBuffers, glDeleteBuffers);
+ VIGS_GL_GET_PROC(BindBuffer, glBindBuffer);
+ VIGS_GL_GET_PROC(BufferData, glBufferData);
+ VIGS_GL_GET_PROC(MapBuffer, glMapBuffer);
+ VIGS_GL_GET_PROC(UnmapBuffer, glUnmapBuffer);
+
+ gl_backend_glx->dpy = x_display;
+
+ config = vigs_gl_backend_glx_get_config(gl_backend_glx);
+
+ if (!config) {
+ goto fail2;
+ }
+
+ if (!vigs_gl_backend_glx_create_surface(gl_backend_glx,
+ config,
+ &gl_backend_glx->sfc)) {
+ goto fail2;
+ }
+
+ if (!vigs_gl_backend_glx_create_surface(gl_backend_glx,
+ config,
+ &gl_backend_glx->read_pixels_sfc)) {
+ goto fail3;
+ }
+
+ if (!vigs_gl_backend_glx_create_context(gl_backend_glx,
+ config,
+ NULL,
+ &gl_backend_glx->ctx)) {
+ goto fail4;
+ }
+
+ if (!vigs_gl_backend_glx_create_context(gl_backend_glx,
+ config,
+ gl_backend_glx->ctx,
+ &gl_backend_glx->read_pixels_ctx)) {
+ goto fail5;
+ }
+
+ gl_backend_glx->base.base.destroy = &vigs_gl_backend_glx_destroy;
+ gl_backend_glx->base.has_current = &vigs_gl_backend_glx_has_current;
+ gl_backend_glx->base.make_current = &vigs_gl_backend_glx_make_current;
+ gl_backend_glx->base.read_pixels_make_current = &vigs_gl_backend_glx_read_pixels_make_current;
+ gl_backend_glx->base.ws_info.context = gl_backend_glx->ctx;
+
+ if (!vigs_gl_backend_init(&gl_backend_glx->base)) {
+ goto fail6;
+ }
+
+ VIGS_LOG_DEBUG("created");
+
+ return &gl_backend_glx->base.base;
+
+ fail6:
+ gl_backend_glx->glXDestroyContext(gl_backend_glx->dpy,
+ gl_backend_glx->read_pixels_ctx);
+ fail5:
+ gl_backend_glx->glXDestroyContext(gl_backend_glx->dpy,
+ gl_backend_glx->ctx);
+ fail4:
+ gl_backend_glx->glXDestroyPbuffer(gl_backend_glx->dpy,
+ gl_backend_glx->read_pixels_sfc);
+ fail3:
+ gl_backend_glx->glXDestroyPbuffer(gl_backend_glx->dpy,
+ gl_backend_glx->sfc);
+ fail2:
+ dlclose(gl_backend_glx->handle);
+ fail1:
+ vigs_backend_cleanup(&gl_backend_glx->base.base);
+
+ g_free(gl_backend_glx);
+
+ return NULL;
+ }
--- /dev/null
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include "yagl_egl_config.h"
+ #include "yagl_egl_backend.h"
+ #include "yagl_egl_display.h"
+ #include "yagl_eglb_display.h"
+ #include "yagl_resource.h"
+ #include "yagl_process.h"
+ #include "yagl_thread.h"
+ #include <EGL/eglext.h>
+
+ static void yagl_egl_config_destroy(struct yagl_ref *ref)
+ {
+ struct yagl_egl_config *cfg = (struct yagl_egl_config*)ref;
+
+ cfg->dpy->backend_dpy->config_cleanup(cfg->dpy->backend_dpy,
+ &cfg->native);
+
+ yagl_resource_cleanup(&cfg->res);
+
+ g_free(cfg);
+ }
+
+ static bool yagl_egl_config_is_less(struct yagl_egl_native_config *lhs_cfg,
+ struct yagl_egl_native_config *rhs_cfg)
+ {
+ /*
+ * 1. EGL_NONE < EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG
+ * Conformant first.
+ */
+ if (lhs_cfg->conformant != rhs_cfg->conformant) {
+ return lhs_cfg->conformant != 0;
+ }
+
+ /*
+ * 1. EGL_NONE < EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG
+ * EGL_NONE first.
+ */
+ if (lhs_cfg->caveat != rhs_cfg->caveat) {
+ return lhs_cfg->caveat < rhs_cfg->caveat;
+ }
+
+ /*
+ * 2, 3. skip
+ */
+
+ /*
+ * 4. Smaller EGL_BUFFER_SIZE.
+ */
+ if (lhs_cfg->buffer_size != rhs_cfg->buffer_size) {
+ return lhs_cfg->buffer_size < rhs_cfg->buffer_size;
+ }
+
+ /*
+ * 5. Smaller EGL_SAMPLE_BUFFERS.
+ */
+ if (lhs_cfg->sample_buffers_num != rhs_cfg->sample_buffers_num) {
+ return lhs_cfg->sample_buffers_num <
+ rhs_cfg->sample_buffers_num;
+ }
+
+ /*
+ * 6. Smaller EGL_SAMPLES.
+ */
+ if (lhs_cfg->samples_per_pixel != rhs_cfg->samples_per_pixel) {
+ return lhs_cfg->samples_per_pixel < rhs_cfg->samples_per_pixel;
+ }
+
+ /*
+ * 7. Smaller EGL_DEPTH_SIZE.
+ */
+ if (lhs_cfg->depth_size != rhs_cfg->depth_size) {
+ return lhs_cfg->depth_size < rhs_cfg->depth_size;
+ }
+
+ /*
+ * 8. Smaller EGL_STENCIL_SIZE.
+ */
+ if (lhs_cfg->stencil_size != rhs_cfg->stencil_size) {
+ return lhs_cfg->stencil_size < rhs_cfg->stencil_size;
+ }
+
+ /*
+ * 9. skip
+ */
+
+ /*
+ * 10. EGL_NATIVE_VISUAL_TYPE
+ */
+
+ if (lhs_cfg->native_visual_type != rhs_cfg->native_visual_type) {
+ return lhs_cfg->native_visual_type < rhs_cfg->native_visual_type;
+ }
+
+ /*
+ * 11. Smaller EGL_CONFIG_ID. Last rule.
+ */
+
+ return lhs_cfg->config_id < rhs_cfg->config_id;
+ }
+
+ static int yagl_egl_config_sort_func(const void *lhs, const void *rhs)
+ {
+ struct yagl_egl_config *lhs_cfg = *(struct yagl_egl_config**)lhs;
+ struct yagl_egl_config *rhs_cfg = *(struct yagl_egl_config**)rhs;
+
+ if (yagl_egl_config_is_less(&lhs_cfg->native, &rhs_cfg->native)) {
+ return -1;
+ } else {
+ return yagl_egl_config_is_less(&rhs_cfg->native, &lhs_cfg->native) ? 1 : 0;
+ }
+ }
+
+ /*
+ * 'native_cfg' is byte-copied into allocated config.
+ */
+ static struct yagl_egl_config
+ *yagl_egl_config_create(struct yagl_egl_display *dpy,
+ const struct yagl_egl_native_config *native_cfg)
+ {
+ struct yagl_egl_config *cfg = g_malloc0(sizeof(struct yagl_egl_config));
+
+ yagl_resource_init(&cfg->res, &yagl_egl_config_destroy);
+ cfg->dpy = dpy;
+ cfg->native = *native_cfg;
+
+ cfg->native.surface_type = EGL_PBUFFER_BIT |
+ EGL_PIXMAP_BIT |
+ EGL_WINDOW_BIT |
+ EGL_SWAP_BEHAVIOR_PRESERVED_BIT |
+ EGL_LOCK_SURFACE_BIT_KHR |
+ EGL_OPTIMAL_FORMAT_BIT_KHR;
+
+ cfg->native.native_renderable = EGL_TRUE;
+ cfg->native.renderable_type = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT;
+
++ if (dpy->backend->gl_version >= yagl_gl_3_1_es3) {
++ cfg->native.renderable_type |= EGL_OPENGL_ES3_BIT_KHR;
++ }
++
+ cfg->native.conformant =
+ (((cfg->native.red_size + cfg->native.green_size + cfg->native.blue_size + cfg->native.alpha_size) > 0) &&
+ (cfg->native.caveat != EGL_NON_CONFORMANT_CONFIG)) ? cfg->native.renderable_type : 0;
+
+ cfg->native.sample_buffers_num = (cfg->native.samples_per_pixel > 0) ? 1 : 0;
+
+ cfg->native.bind_to_texture_rgb = EGL_TRUE;
+ cfg->native.bind_to_texture_rgba = EGL_TRUE;
+
+ return cfg;
+ }
+
+ struct yagl_egl_config
+ **yagl_egl_config_enum(struct yagl_egl_display *dpy,
+ int* num_configs )
+ {
+ struct yagl_egl_native_config *native_configs;
+ int num_native_configs, i;
+ struct yagl_egl_config **configs;
+
+ native_configs = dpy->backend_dpy->config_enum(dpy->backend_dpy, &num_native_configs);
+
+ if (num_native_configs <= 0) {
+ return NULL;
+ }
+
+ configs = g_malloc0(num_native_configs * sizeof(*configs));
+
+ *num_configs = 0;
+
+ for (i = 0; i < num_native_configs; ++i) {
+ /*
+ * We only accept RGBA8888, that's to be sure we can handle all kinds
+ * of formats.
+ */
+ if ((native_configs[i].buffer_size != 32) ||
+ (native_configs[i].red_size != 8) ||
+ (native_configs[i].green_size != 8) ||
+ (native_configs[i].blue_size != 8) ||
+ (native_configs[i].alpha_size != 8)) {
+ dpy->backend_dpy->config_cleanup(dpy->backend_dpy,
+ &native_configs[i]);
+ continue;
+ }
+
+ /*
+ * A bugfix for Tizen's WebKit. When it chooses a config it
+ * doesn't always pass EGL_DEPTH_SIZE, thus, if host GPU has at least
+ * one config without a depth buffer it gets chosen (EGL_DEPTH_SIZE is
+ * 0 by default and has an AtLeast,Smaller sorting rule). But WebKit
+ * WANTS THE DEPTH BUFFER! If someone wants to have a depth buffer
+ * a value greater than zero must be passed with EGL_DEPTH_SIZE,
+ * read the manual goddamit!
+ *
+ * P.S: We just drop all configs with depth_size == 0 and
+ * also with stencil_size == 0, just in case.
+ */
+ if ((native_configs[i].depth_size == 0) ||
+ (native_configs[i].stencil_size == 0)) {
+ dpy->backend_dpy->config_cleanup(dpy->backend_dpy,
+ &native_configs[i]);
+ continue;
+ }
+
+ configs[*num_configs] = yagl_egl_config_create(dpy, &native_configs[i]);
+
+ ++*num_configs;
+ }
+
+ g_free(native_configs);
+
+ return configs;
+ }
+
+ void yagl_egl_config_sort(struct yagl_egl_config **cfgs, int num_configs)
+ {
+ qsort(cfgs, num_configs, sizeof(*cfgs), &yagl_egl_config_sort_func);
+ }
+
+ #define YAGL_CHECK_ATTRIB(attrib, op) \
+ if ((dummy->attrib != EGL_DONT_CARE) && (dummy->attrib op cfg->native.attrib)) { \
+ return false; \
+ }
+
+ #define YAGL_CHECK_ATTRIB_CAST(attrib, op) \
+ if (((EGLint)(dummy->attrib) != EGL_DONT_CARE) && (dummy->attrib op cfg->native.attrib)) { \
+ return false; \
+ }
+
+ bool yagl_egl_config_is_chosen_by(const struct yagl_egl_config *cfg,
+ const struct yagl_egl_native_config *dummy)
+ {
+ /*
+ * AtLeast.
+ */
+
+ YAGL_CHECK_ATTRIB(red_size, >);
+ YAGL_CHECK_ATTRIB(green_size, >);
+ YAGL_CHECK_ATTRIB(blue_size, >);
+ YAGL_CHECK_ATTRIB(alpha_size, >);
+ YAGL_CHECK_ATTRIB(buffer_size, >);
+ YAGL_CHECK_ATTRIB(depth_size, >);
+ YAGL_CHECK_ATTRIB(stencil_size, >);
+ YAGL_CHECK_ATTRIB(samples_per_pixel, >);
+ YAGL_CHECK_ATTRIB(sample_buffers_num, >);
+
+ /*
+ * Exact.
+ */
+
+ YAGL_CHECK_ATTRIB(frame_buffer_level, !=);
+ YAGL_CHECK_ATTRIB(config_id, !=);
+ YAGL_CHECK_ATTRIB(native_visual_type, !=);
+ YAGL_CHECK_ATTRIB(max_swap_interval, !=);
+ YAGL_CHECK_ATTRIB(min_swap_interval, !=);
+ YAGL_CHECK_ATTRIB(trans_red_val, !=);
+ YAGL_CHECK_ATTRIB(trans_green_val, !=);
+ YAGL_CHECK_ATTRIB(trans_blue_val, !=);
+ /*
+ * Exact with cast.
+ */
+ YAGL_CHECK_ATTRIB_CAST(caveat, !=);
+ YAGL_CHECK_ATTRIB_CAST(native_renderable, !=);
+ YAGL_CHECK_ATTRIB_CAST(transparent_type, !=);
+ YAGL_CHECK_ATTRIB_CAST(bind_to_texture_rgb, !=);
+ YAGL_CHECK_ATTRIB_CAST(bind_to_texture_rgba, !=);
+
+ /*
+ * Mask.
+ */
+
+ if (dummy->surface_type != EGL_DONT_CARE &&
+ ((dummy->surface_type & cfg->native.surface_type) != dummy->surface_type)) {
+ return false;
+ }
+
+ if (dummy->conformant != (EGLenum)EGL_DONT_CARE &&
+ ((dummy->conformant & cfg->native.conformant) != dummy->conformant)) {
+ return false;
+ }
+
+ if (dummy->renderable_type != EGL_DONT_CARE &&
+ ((dummy->renderable_type & cfg->native.renderable_type) != dummy->renderable_type)) {
+ return false;
+ }
+
+ /*
+ * EGL_MATCH_FORMAT_KHR.
+ */
+
+ if ((dummy->match_format_khr != EGL_DONT_CARE) &&
+ (dummy->match_format_khr != EGL_FORMAT_RGBA_8888_EXACT_KHR) &&
+ (dummy->match_format_khr != EGL_FORMAT_RGBA_8888_KHR)) {
+ return false;
+ }
+
+ return true;
+ }
+ bool yagl_egl_config_get_attrib(const struct yagl_egl_config *cfg,
+ EGLint attrib,
+ EGLint *value)
+ {
+ switch (attrib) {
+ case EGL_BUFFER_SIZE:
+ *value = cfg->native.buffer_size;
+ break;
+ case EGL_RED_SIZE:
+ *value = cfg->native.red_size;
+ break;
+ case EGL_GREEN_SIZE:
+ *value = cfg->native.green_size;
+ break;
+ case EGL_BLUE_SIZE:
+ *value = cfg->native.blue_size;
+ break;
+ case EGL_ALPHA_SIZE:
+ *value = cfg->native.alpha_size;
+ break;
+ case EGL_ALPHA_MASK_SIZE:
+ *value = 0;
+ break;
+ case EGL_BIND_TO_TEXTURE_RGB:
+ *value = cfg->native.bind_to_texture_rgb;
+ break;
+ case EGL_BIND_TO_TEXTURE_RGBA:
+ *value = cfg->native.bind_to_texture_rgba;
+ break;
+ case EGL_CONFIG_CAVEAT:
+ *value = cfg->native.caveat;
+ break;
+ case EGL_CONFIG_ID:
+ *value = cfg->native.config_id;
+ break;
+ case EGL_DEPTH_SIZE:
+ *value = cfg->native.depth_size;
+ break;
+ case EGL_LEVEL:
+ *value = cfg->native.frame_buffer_level;
+ break;
+ case EGL_MAX_PBUFFER_WIDTH:
+ *value = cfg->native.max_pbuffer_width;
+ break;
+ case EGL_MAX_PBUFFER_HEIGHT:
+ *value = cfg->native.max_pbuffer_height;
+ break;
+ case EGL_MAX_PBUFFER_PIXELS:
+ *value = cfg->native.max_pbuffer_size;
+ break;
+ case EGL_MAX_SWAP_INTERVAL:
+ *value = cfg->native.max_swap_interval;
+ break;
+ case EGL_MIN_SWAP_INTERVAL:
+ *value = cfg->native.min_swap_interval;
+ break;
+ case EGL_NATIVE_RENDERABLE:
+ *value = cfg->native.native_renderable;
+ break;
+ case EGL_NATIVE_VISUAL_ID:
+ *value = cfg->native.native_visual_id;
+ break;
+ case EGL_NATIVE_VISUAL_TYPE:
+ *value = cfg->native.native_visual_type;
+ break;
+ case EGL_RENDERABLE_TYPE:
+ *value = cfg->native.renderable_type;
+ break;
+ case EGL_SAMPLE_BUFFERS:
+ *value = cfg->native.sample_buffers_num;
+ break;
+ case EGL_SAMPLES:
+ *value = cfg->native.samples_per_pixel;
+ break;
+ case EGL_STENCIL_SIZE:
+ *value = cfg->native.stencil_size;
+ break;
+ case EGL_SURFACE_TYPE:
+ *value = cfg->native.surface_type;
+ break;
+ case EGL_TRANSPARENT_TYPE:
+ *value = cfg->native.transparent_type;
+ break;
+ case EGL_TRANSPARENT_RED_VALUE:
+ *value = cfg->native.trans_red_val;
+ break;
+ case EGL_TRANSPARENT_GREEN_VALUE:
+ *value = cfg->native.trans_green_val;
+ break;
+ case EGL_TRANSPARENT_BLUE_VALUE:
+ *value = cfg->native.trans_blue_val;
+ break;
+ case EGL_CONFORMANT:
+ *value = cfg->native.conformant;
+ break;
+ case EGL_COLOR_BUFFER_TYPE:
+ *value = EGL_RGB_BUFFER;
+ break;
+ case EGL_MATCH_FORMAT_KHR:
+ *value = EGL_FORMAT_RGBA_8888_EXACT_KHR;
+ break;
+ default:
+ return false;
+ }
+ return true;
+ }
+
+ void yagl_egl_config_acquire(struct yagl_egl_config *cfg)
+ {
+ if (cfg) {
+ yagl_resource_acquire(&cfg->res);
+ }
+ }
+
+ void yagl_egl_config_release(struct yagl_egl_config *cfg)
+ {
+ if (cfg) {
+ yagl_resource_release(&cfg->res);
+ }
+ }
--- /dev/null
-static void yagl_egl_ensure_current(struct yagl_egl_interface *iface)
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include "yagl_host_egl_calls.h"
+ #include "yagl_egl_calls.h"
+ #include "yagl_egl_api_ps.h"
+ #include "yagl_egl_api_ts.h"
+ #include "yagl_egl_api.h"
+ #include "yagl_egl_display.h"
+ #include "yagl_egl_backend.h"
+ #include "yagl_egl_interface.h"
+ #include "yagl_egl_config.h"
+ #include "yagl_egl_surface.h"
+ #include "yagl_egl_context.h"
+ #include "yagl_egl_validate.h"
+ #include "yagl_eglb_display.h"
+ #include "yagl_eglb_context.h"
+ #include "yagl_eglb_surface.h"
+ #include "yagl_log.h"
+ #include "yagl_tls.h"
+ #include "yagl_thread.h"
+ #include "yagl_process.h"
+ #include "yagl_object_map.h"
+ #include <EGL/eglext.h>
+
+ #define YAGL_EGL_VERSION_MAJOR 1
+ #define YAGL_EGL_VERSION_MINOR 4
+
+ #define YAGL_SET_ERR(err) \
+ *error = err; \
+ YAGL_LOG_ERROR("error = 0x%X", err)
+
+ #define YAGL_UNIMPLEMENTED(func, ret) \
+ YAGL_LOG_FUNC_SET(func); \
+ YAGL_LOG_WARN("NOT IMPLEMENTED!!!"); \
+ *retval = ret; \
+ return true;
+
+ struct yagl_egl_interface_impl
+ {
+ struct yagl_egl_interface base;
+
+ struct yagl_egl_backend *backend;
+ };
+
- struct yagl_egl_interface_impl *egl_iface = (struct yagl_egl_interface_impl*)iface;
- egl_iface->backend->ensure_current(egl_iface->backend);
++static YAGL_DEFINE_TLS(struct yagl_egl_api_ts*, egl_api_ts);
++
++static uint32_t yagl_egl_get_ctx_id(struct yagl_egl_interface *iface)
+ {
-static void yagl_egl_unensure_current(struct yagl_egl_interface *iface)
++ if (egl_api_ts) {
++ return egl_api_ts->context ? egl_api_ts->context->res.handle : 0;
++ } else {
++ return 0;
++ }
+ }
+
- egl_iface->backend->unensure_current(egl_iface->backend);
++static void yagl_egl_ensure_ctx(struct yagl_egl_interface *iface, uint32_t ctx_id)
+ {
+ struct yagl_egl_interface_impl *egl_iface = (struct yagl_egl_interface_impl*)iface;
-static YAGL_DEFINE_TLS(struct yagl_egl_api_ts*, egl_api_ts);
++ uint32_t current_ctx_id = yagl_egl_get_ctx_id(iface);
++
++ if (!current_ctx_id || (ctx_id && (current_ctx_id != ctx_id))) {
++ egl_iface->backend->ensure_current(egl_iface->backend);
++ }
+ }
+
- egl_iface->base.ensure_ctx = &yagl_egl_ensure_current;
- egl_iface->base.unensure_ctx = &yagl_egl_unensure_current;
++static void yagl_egl_unensure_ctx(struct yagl_egl_interface *iface, uint32_t ctx_id)
++{
++ struct yagl_egl_interface_impl *egl_iface = (struct yagl_egl_interface_impl*)iface;
++ uint32_t current_ctx_id = yagl_egl_get_ctx_id(iface);
++
++ if (!current_ctx_id || (ctx_id && (current_ctx_id != ctx_id))) {
++ egl_iface->backend->unensure_current(egl_iface->backend);
++ }
++}
+
+ static __inline bool yagl_validate_display(yagl_host_handle dpy_,
+ struct yagl_egl_display **dpy,
+ EGLint *error)
+ {
+ YAGL_LOG_FUNC_SET(yagl_validate_display);
+
+ *dpy = yagl_egl_api_ps_display_get(egl_api_ts->api_ps, dpy_);
+
+ if (!*dpy) {
+ YAGL_SET_ERR(EGL_BAD_DISPLAY);
+ return false;
+ }
+
+ if (!yagl_egl_display_is_initialized(*dpy)) {
+ YAGL_SET_ERR(EGL_NOT_INITIALIZED);
+ return false;
+ }
+
+ return true;
+ }
+
+ static __inline bool yagl_validate_config(struct yagl_egl_display *dpy,
+ yagl_host_handle cfg_,
+ struct yagl_egl_config **cfg,
+ EGLint *error)
+ {
+ YAGL_LOG_FUNC_SET(yagl_validate_config);
+
+ *cfg = yagl_egl_display_acquire_config(dpy, cfg_);
+
+ if (!*cfg) {
+ YAGL_SET_ERR(EGL_BAD_CONFIG);
+ return false;
+ }
+
+ return true;
+ }
+
+ static __inline bool yagl_validate_surface(struct yagl_egl_display *dpy,
+ yagl_host_handle sfc_,
+ struct yagl_egl_surface **sfc,
+ EGLint *error)
+ {
+ YAGL_LOG_FUNC_SET(yagl_validate_surface);
+
+ *sfc = yagl_egl_display_acquire_surface(dpy, sfc_);
+
+ if (!*sfc) {
+ YAGL_SET_ERR(EGL_BAD_SURFACE);
+ return false;
+ }
+
+ return true;
+ }
+
+ static __inline bool yagl_validate_context(struct yagl_egl_display *dpy,
+ yagl_host_handle ctx_,
+ struct yagl_egl_context **ctx,
+ EGLint *error)
+ {
+ YAGL_LOG_FUNC_SET(yagl_validate_context);
+
+ *ctx = yagl_egl_display_acquire_context(dpy, ctx_);
+
+ if (!*ctx) {
+ YAGL_SET_ERR(EGL_BAD_CONTEXT);
+ return false;
+ }
+
+ return true;
+ }
+
+ static bool yagl_egl_release_current_context(struct yagl_egl_display *dpy)
+ {
+ if (!egl_api_ts->context) {
+ return true;
+ }
+
+ if (!egl_api_ts->backend->release_current(egl_api_ts->backend, false)) {
+ return false;
+ }
+
+ yagl_egl_context_update_surfaces(egl_api_ts->context, NULL, NULL);
+
+ yagl_egl_api_ts_update_context(egl_api_ts, NULL);
+
+ return true;
+ }
+
+ static yagl_api_func yagl_host_egl_get_func(struct yagl_api_ps *api_ps,
+ uint32_t func_id)
+ {
+ if ((func_id <= 0) || (func_id > yagl_egl_api_num_funcs)) {
+ return NULL;
+ } else {
+ return yagl_egl_api_funcs[func_id - 1];
+ }
+ }
+
+ static void yagl_host_egl_thread_init(struct yagl_api_ps *api_ps)
+ {
+ struct yagl_egl_api_ps *egl_api_ps = (struct yagl_egl_api_ps*)api_ps;
+
+ YAGL_LOG_FUNC_ENTER(yagl_host_egl_thread_init, NULL);
+
+ egl_api_ps->backend->thread_init(egl_api_ps->backend);
+
+ egl_api_ts = g_malloc0(sizeof(*egl_api_ts));
+
+ yagl_egl_api_ts_init(egl_api_ts, egl_api_ps);
+
+ cur_ts->egl_api_ts = egl_api_ts;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static void yagl_host_egl_batch_start(struct yagl_api_ps *api_ps)
+ {
+ struct yagl_egl_api_ps *egl_api_ps = (struct yagl_egl_api_ps*)api_ps;
+
+ egl_api_ts = cur_ts->egl_api_ts;
+
+ egl_api_ps->backend->batch_start(egl_api_ps->backend);
+ }
+
+ static void yagl_host_egl_batch_end(struct yagl_api_ps *api_ps)
+ {
+ struct yagl_egl_api_ps *egl_api_ps = (struct yagl_egl_api_ps*)api_ps;
+
+ egl_api_ps->backend->batch_end(egl_api_ps->backend);
+ }
+
+ static void yagl_host_egl_thread_fini(struct yagl_api_ps *api_ps)
+ {
+ struct yagl_egl_api_ps *egl_api_ps = (struct yagl_egl_api_ps*)api_ps;
+
+ YAGL_LOG_FUNC_ENTER(yagl_host_egl_thread_fini, NULL);
+
+ egl_api_ts = cur_ts->egl_api_ts;
+
+ egl_api_ps->backend->batch_start(egl_api_ps->backend);
+
+ yagl_egl_api_ts_cleanup(egl_api_ts);
+
+ g_free(egl_api_ts);
+
+ egl_api_ts = cur_ts->egl_api_ts = NULL;
+
+ egl_api_ps->backend->batch_end(egl_api_ps->backend);
+ egl_api_ps->backend->thread_fini(egl_api_ps->backend);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static void yagl_host_egl_process_destroy(struct yagl_api_ps *api_ps)
+ {
+ struct yagl_egl_api_ps *egl_api_ps = (struct yagl_egl_api_ps*)api_ps;
+
+ YAGL_LOG_FUNC_ENTER(yagl_host_egl_process_destroy, NULL);
+
+ yagl_egl_api_ps_cleanup(egl_api_ps);
+
+ g_free(egl_api_ps->egl_iface);
+
+ yagl_api_ps_cleanup(&egl_api_ps->base);
+
+ g_free(egl_api_ps);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ struct yagl_api_ps *yagl_host_egl_process_init(struct yagl_api *api)
+ {
+ struct yagl_egl_api *egl_api = (struct yagl_egl_api*)api;
+ struct yagl_egl_interface_impl *egl_iface;
+ struct yagl_egl_api_ps *egl_api_ps;
+
+ YAGL_LOG_FUNC_ENTER(yagl_host_egl_process_init, NULL);
+
+ /*
+ * Create EGL interface.
+ */
+
+ egl_iface = g_malloc0(sizeof(*egl_iface));
+
++ egl_iface->base.get_ctx_id = &yagl_egl_get_ctx_id;
++ egl_iface->base.ensure_ctx = &yagl_egl_ensure_ctx;
++ egl_iface->base.unensure_ctx = &yagl_egl_unensure_ctx;
+ egl_iface->backend = egl_api->backend;
+
+ /*
+ * Finally, create API ps.
+ */
+
+ egl_api_ps = g_malloc0(sizeof(*egl_api_ps));
+
+ yagl_api_ps_init(&egl_api_ps->base, api);
+
+ egl_api_ps->base.thread_init = &yagl_host_egl_thread_init;
+ egl_api_ps->base.batch_start = &yagl_host_egl_batch_start;
+ egl_api_ps->base.get_func = &yagl_host_egl_get_func;
+ egl_api_ps->base.batch_end = &yagl_host_egl_batch_end;
+ egl_api_ps->base.thread_fini = &yagl_host_egl_thread_fini;
+ egl_api_ps->base.destroy = &yagl_host_egl_process_destroy;
+
+ yagl_egl_api_ps_init(egl_api_ps, egl_api->backend, &egl_iface->base);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return &egl_api_ps->base;
+ }
+
+ yagl_host_handle yagl_host_eglGetDisplay(uint32_t display_id,
+ EGLint *error)
+ {
+ struct yagl_egl_display *dpy;
+
+ dpy = yagl_egl_api_ps_display_add(egl_api_ts->api_ps, display_id);
+
+ return (dpy ? dpy->handle : 0);
+ }
+
+ EGLBoolean yagl_host_eglInitialize(yagl_host_handle dpy_,
+ EGLint *major,
+ EGLint *minor,
+ EGLint *error)
+ {
+ struct yagl_egl_display *dpy;
+
+ YAGL_LOG_FUNC_SET(eglInitialize);
+
+ dpy = yagl_egl_api_ps_display_get(egl_api_ts->api_ps, dpy_);
+
+ if (!dpy) {
+ YAGL_SET_ERR(EGL_BAD_DISPLAY);
+ return EGL_FALSE;
+ }
+
+ yagl_egl_display_initialize(dpy);
+
+ if (major) {
+ *major = YAGL_EGL_VERSION_MAJOR;
+ }
+
+ if (minor) {
+ *minor = YAGL_EGL_VERSION_MINOR;
+ }
+
+ return EGL_TRUE;
+ }
+
+ EGLBoolean yagl_host_eglTerminate(yagl_host_handle dpy_,
+ EGLint *error)
+ {
+ struct yagl_egl_display *dpy = NULL;
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ return EGL_FALSE;
+ }
+
+ yagl_egl_display_terminate(dpy);
+
+ return EGL_TRUE;
+ }
+
+ EGLBoolean yagl_host_eglGetConfigs(yagl_host_handle dpy_,
+ yagl_host_handle *configs, int32_t configs_maxcount, int32_t *configs_count,
+ EGLint *error)
+ {
+ struct yagl_egl_display *dpy = NULL;
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ return EGL_FALSE;
+ }
+
+ if (configs) {
+ *configs_count = configs_maxcount;
+ yagl_egl_display_get_config_handles(dpy, configs, configs_count);
+ } else {
+ *configs_count = yagl_egl_display_get_config_count(dpy);
+ }
+
+ return EGL_TRUE;
+ }
+
+ EGLBoolean yagl_host_eglChooseConfig(yagl_host_handle dpy_,
+ const EGLint *attrib_list, int32_t attrib_list_count,
+ yagl_host_handle *configs, int32_t configs_maxcount, int32_t *configs_count,
+ EGLint *error)
+ {
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_native_config dummy;
+ int i = 0;
+
+ YAGL_LOG_FUNC_SET(eglChooseConfig);
+
+ yagl_egl_native_config_init(&dummy);
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ /*
+ * Selection defaults.
+ */
+
+ dummy.surface_type = EGL_WINDOW_BIT;
+ dummy.renderable_type = EGL_OPENGL_ES_BIT;
+ dummy.caveat = EGL_DONT_CARE;
+ dummy.config_id = EGL_DONT_CARE;
+ dummy.native_renderable = EGL_DONT_CARE;
+ dummy.native_visual_type = EGL_DONT_CARE;
+ dummy.max_swap_interval = EGL_DONT_CARE;
+ dummy.min_swap_interval = EGL_DONT_CARE;
+ dummy.trans_red_val = EGL_DONT_CARE;
+ dummy.trans_green_val = EGL_DONT_CARE;
+ dummy.trans_blue_val = EGL_DONT_CARE;
+ dummy.transparent_type = EGL_NONE;
+ dummy.match_format_khr = EGL_DONT_CARE;
+ dummy.bind_to_texture_rgb = EGL_DONT_CARE;
+ dummy.bind_to_texture_rgba = EGL_DONT_CARE;
+
+ if (!yagl_egl_is_attrib_list_empty(attrib_list)) {
+ bool has_config_id = false;
+ EGLint config_id = 0;
+
+ while ((attrib_list[i] != EGL_NONE) && !has_config_id) {
+ switch (attrib_list[i]) {
+ case EGL_MAX_PBUFFER_WIDTH:
+ case EGL_MAX_PBUFFER_HEIGHT:
+ case EGL_MAX_PBUFFER_PIXELS:
+ case EGL_NATIVE_VISUAL_ID:
+ break;
+ case EGL_BIND_TO_TEXTURE_RGB:
+ dummy.bind_to_texture_rgb = attrib_list[i + 1];
+ break;
+ case EGL_BIND_TO_TEXTURE_RGBA:
+ dummy.bind_to_texture_rgba = attrib_list[i + 1];
+ break;
+ case EGL_SURFACE_TYPE:
+ dummy.surface_type = attrib_list[i + 1];
+ break;
+ case EGL_LEVEL:
+ if (attrib_list[i + 1] == EGL_DONT_CARE) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ dummy.frame_buffer_level = attrib_list[i + 1];
+ break;
+ case EGL_BUFFER_SIZE:
+ if (attrib_list[i + 1] < 0) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ dummy.buffer_size = attrib_list[i + 1];
+ break;
+ case EGL_RED_SIZE:
+ if (attrib_list[i + 1] < 0) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ dummy.red_size = attrib_list[i + 1];
+ break;
+ case EGL_GREEN_SIZE:
+ if (attrib_list[i + 1] < 0) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ dummy.green_size = attrib_list[i + 1];
+ break;
+ case EGL_BLUE_SIZE:
+ if (attrib_list[i + 1] < 0) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ dummy.blue_size = attrib_list[i + 1];
+ break;
+ case EGL_ALPHA_SIZE:
+ if (attrib_list[i + 1] < 0) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ dummy.alpha_size = attrib_list[i + 1];
+ break;
+ case EGL_CONFIG_CAVEAT:
+ if ((attrib_list[i + 1] != EGL_NONE) &&
+ (attrib_list[i + 1] != EGL_SLOW_CONFIG) &&
+ (attrib_list[i + 1] != EGL_NON_CONFORMANT_CONFIG)) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ dummy.caveat = attrib_list[i + 1];
+ break;
+ case EGL_CONFIG_ID:
+ if (attrib_list[i + 1] < 0) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ config_id = attrib_list[i + 1];
+ has_config_id = true;
+ break;
+ case EGL_DEPTH_SIZE:
+ if (attrib_list[i + 1] < 0) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ dummy.depth_size = attrib_list[i + 1];
+ break;
+ case EGL_MAX_SWAP_INTERVAL:
+ if (attrib_list[i + 1] < 0) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ dummy.max_swap_interval = attrib_list[i + 1];
+ break;
+ case EGL_MIN_SWAP_INTERVAL:
+ if (attrib_list[i + 1] < 0) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ dummy.min_swap_interval = attrib_list[i + 1];
+ break;
+ case EGL_CONFORMANT:
+ if ((attrib_list[i + 1] &
+ ~(EGL_OPENGL_ES_BIT|
+ EGL_OPENVG_BIT|
+ EGL_OPENGL_ES2_BIT|
+ EGL_OPENGL_BIT)) != 0) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ dummy.conformant = attrib_list[i + 1];
+ break;
+ case EGL_NATIVE_RENDERABLE:
+ dummy.native_renderable = attrib_list[i + 1];
+ break;
+ case EGL_RENDERABLE_TYPE:
+ dummy.renderable_type = attrib_list[i + 1];
+ break;
+ case EGL_NATIVE_VISUAL_TYPE:
+ dummy.native_visual_type = attrib_list[i + 1];
+ if ((attrib_list[i + 1] < 0) || (attrib_list[i + 1] > 1)) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ break;
+ case EGL_SAMPLE_BUFFERS:
+ if (attrib_list[i + 1] < 0) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ dummy.sample_buffers_num = attrib_list[i + 1];
+ break;
+ case EGL_SAMPLES:
+ if (attrib_list[i + 1] < 0) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ dummy.samples_per_pixel = attrib_list[i + 1];
+ break;
+ case EGL_STENCIL_SIZE:
+ if (attrib_list[i + 1] < 0) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ dummy.stencil_size = attrib_list[i + 1];
+ break;
+ case EGL_TRANSPARENT_TYPE:
+ if ((attrib_list[i + 1] != EGL_NONE) &&
+ (attrib_list[i + 1] != EGL_TRANSPARENT_RGB)) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ dummy.transparent_type = attrib_list[i + 1];
+ break;
+ case EGL_TRANSPARENT_RED_VALUE:
+ dummy.trans_red_val = attrib_list[i + 1];
+ break;
+ case EGL_TRANSPARENT_GREEN_VALUE:
+ dummy.trans_green_val = attrib_list[i + 1];
+ break;
+ case EGL_TRANSPARENT_BLUE_VALUE:
+ dummy.trans_blue_val = attrib_list[i + 1];
+ break;
+ case EGL_MATCH_FORMAT_KHR:
+ dummy.match_format_khr = attrib_list[i + 1];
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ i += 2;
+ }
+
+ if (has_config_id) {
+ yagl_host_handle handle = 0;
+ struct yagl_egl_config *cfg =
+ yagl_egl_display_acquire_config_by_id(dpy, config_id);
+
+ if (cfg) {
+ handle = cfg->res.handle;
+ yagl_egl_config_release(cfg);
+ }
+
+ YAGL_LOG_DEBUG("requesting config with id = %d", config_id);
+
+ if (handle) {
+ if (configs) {
+ *configs = handle;
+ }
+
+ *configs_count = 1;
+
+ res = EGL_TRUE;
+ goto out;
+ } else {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ }
+ }
+
+ *configs_count = configs_maxcount;
+ yagl_egl_display_choose_configs(dpy, &dummy, configs, configs_count);
+
+ YAGL_LOG_DEBUG("chosen %d configs", *configs_count);
+
+ res = EGL_TRUE;
+
+ out:
+ return res;
+ }
+
+ EGLBoolean yagl_host_eglGetConfigAttrib(yagl_host_handle dpy_,
+ yagl_host_handle config_,
+ EGLint attribute,
+ EGLint *value,
+ EGLint *error)
+ {
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_config *config = NULL;
+ EGLint tmp;
+
+ YAGL_LOG_FUNC_SET(eglGetConfigAttrib);
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_config(dpy, config_, &config, error)) {
+ goto out;
+ }
+
+ if (!yagl_egl_config_get_attrib(config, attribute, &tmp)) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ if (value) {
+ *value = tmp;
+ }
+
+ res = EGL_TRUE;
+
+ out:
+ yagl_egl_config_release(config);
+
+ return res;
+ }
+
+ EGLBoolean yagl_host_eglDestroySurface(yagl_host_handle dpy_,
+ yagl_host_handle surface_,
+ EGLint *error)
+ {
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_surface *surface = NULL;
+
+ YAGL_LOG_FUNC_SET(eglDestroySurface);
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface, error)) {
+ goto out;
+ }
+
+ if (!yagl_egl_display_remove_surface(dpy, surface->res.handle)) {
+ YAGL_SET_ERR(EGL_BAD_SURFACE);
+ goto out;
+ }
+
+ res = EGL_TRUE;
+
+ out:
+ yagl_egl_surface_release(surface);
+
+ return res;
+ }
+
+ EGLBoolean yagl_host_eglQuerySurface(yagl_host_handle dpy_,
+ yagl_host_handle surface_,
+ EGLint attribute,
+ EGLint *value,
+ EGLint *error)
+ {
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_surface *surface = NULL;
+ EGLint tmp;
+
+ YAGL_LOG_FUNC_SET(eglQuerySurface);
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface, error)) {
+ goto out;
+ }
+
+ switch (attribute) {
+ case EGL_CONFIG_ID:
+ if (value) {
+ *value = surface->cfg->native.config_id;
+ }
+ break;
+ case EGL_LARGEST_PBUFFER:
+ if ((surface->backend_sfc->type == EGL_PBUFFER_BIT) && value) {
+ *value = surface->backend_sfc->attribs.pbuffer.largest;
+ }
+ break;
+ case EGL_TEXTURE_FORMAT:
+ if ((surface->backend_sfc->type == EGL_PBUFFER_BIT) && value) {
+ *value = surface->backend_sfc->attribs.pbuffer.tex_format;
+ }
+ break;
+ case EGL_TEXTURE_TARGET:
+ if ((surface->backend_sfc->type == EGL_PBUFFER_BIT) && value) {
+ *value = surface->backend_sfc->attribs.pbuffer.tex_target;
+ }
+ break;
+ case EGL_MIPMAP_TEXTURE:
+ if ((surface->backend_sfc->type == EGL_PBUFFER_BIT) && value) {
+ *value = surface->backend_sfc->attribs.pbuffer.tex_mipmap;
+ }
+ break;
+ case EGL_MIPMAP_LEVEL:
+ if ((surface->backend_sfc->type == EGL_PBUFFER_BIT) && value) {
+ *value = 0;
+ }
+ break;
+ case EGL_RENDER_BUFFER:
+ switch (surface->backend_sfc->type) {
+ case EGL_PBUFFER_BIT:
+ case EGL_WINDOW_BIT:
+ if (value) {
+ *value = EGL_BACK_BUFFER;
+ }
+ break;
+ case EGL_PIXMAP_BIT:
+ if (value) {
+ *value = EGL_SINGLE_BUFFER;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ case EGL_HORIZONTAL_RESOLUTION:
+ case EGL_VERTICAL_RESOLUTION:
+ case EGL_PIXEL_ASPECT_RATIO:
+ if (value) {
+ *value = EGL_UNKNOWN;
+ }
+ break;
+ case EGL_SWAP_BEHAVIOR:
+ if (value) {
+ *value = EGL_BUFFER_PRESERVED;
+ }
+ break;
+ case EGL_MULTISAMPLE_RESOLVE:
+ if (value) {
+ *value = EGL_MULTISAMPLE_RESOLVE_DEFAULT;
+ }
+ break;
+ default:
+ if (!surface->backend_sfc->query(surface->backend_sfc,
+ attribute,
+ &tmp)) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ if (value) {
+ *value = tmp;
+ }
+ break;
+ }
+
+ res = EGL_TRUE;
+
+ out:
+ yagl_egl_surface_release(surface);
+
+ return res;
+ }
+
+ void yagl_host_eglBindAPI(EGLenum api)
+ {
+ egl_api_ts->api = api;
+ }
+
+ void yagl_host_eglWaitClient(void)
+ {
+ struct yagl_egl_surface *sfc = NULL;
+
+ if (!egl_api_ts->context) {
+ return;
+ }
+
+ sfc = egl_api_ts->context->draw;
+
+ if (!sfc) {
+ return;
+ }
+
+ sfc->backend_sfc->wait_gl(sfc->backend_sfc);
+ }
+
+ EGLBoolean yagl_host_eglReleaseThread(EGLint *error)
+ {
+ EGLBoolean res = EGL_FALSE;
+
+ YAGL_LOG_FUNC_SET(eglReleaseThread);
+
+ if (egl_api_ts->context) {
+ if (!yagl_egl_release_current_context(egl_api_ts->context->dpy)) {
+ YAGL_SET_ERR(EGL_BAD_ACCESS);
+ goto out;
+ }
+ }
+
+ yagl_egl_api_ts_reset(egl_api_ts);
+
+ res = EGL_TRUE;
+
+ out:
+ return res;
+ }
+
+ EGLBoolean yagl_host_eglSurfaceAttrib(yagl_host_handle dpy_,
+ yagl_host_handle surface_,
+ EGLint attribute,
+ EGLint value,
+ EGLint *error)
+ {
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_surface *surface = NULL;
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface, error)) {
+ goto out;
+ }
+
+ /*
+ * TODO: implement.
+ */
+
+ res = EGL_TRUE;
+
+ out:
+ yagl_egl_surface_release(surface);
+
+ return res;
+ }
+
+ yagl_host_handle yagl_host_eglCreateContext(yagl_host_handle dpy_,
+ yagl_host_handle config_,
+ yagl_host_handle share_context_,
+ const EGLint *attrib_list, int32_t attrib_list_count,
+ EGLint *error)
+ {
+ yagl_host_handle res = 0;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_config *config = NULL;
+ struct yagl_egl_context *share_context = NULL;
+ struct yagl_egl_context *ctx = NULL;
+
+ YAGL_LOG_FUNC_SET(eglCreateContext);
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_config(dpy, config_, &config, error)) {
+ goto out;
+ }
+
+ if (share_context_) {
+ if (!yagl_validate_context(dpy, share_context_, &share_context, error)) {
+ goto out;
+ }
+ }
+
+ ctx = yagl_egl_context_create(dpy,
+ config,
+ (share_context ? share_context->backend_ctx
+ : NULL));
+
+ if (!ctx) {
+ YAGL_SET_ERR(EGL_BAD_MATCH);
+ goto out;
+ }
+
+ yagl_egl_display_add_context(dpy, ctx);
+ yagl_egl_context_release(ctx);
+
+ res = ctx->res.handle;
+
+ out:
+ yagl_egl_context_release(share_context);
+ yagl_egl_config_release(config);
+
+ return res;
+ }
+
+ EGLBoolean yagl_host_eglDestroyContext(yagl_host_handle dpy_,
+ yagl_host_handle ctx_,
+ EGLint *error)
+ {
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_context *ctx = NULL;
+
+ YAGL_LOG_FUNC_SET(eglDestroyContext);
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_context(dpy, ctx_, &ctx, error)) {
+ goto out;
+ }
+
+ if (yagl_egl_display_remove_context(dpy, ctx->res.handle)) {
+ res = EGL_TRUE;
+ } else {
+ YAGL_SET_ERR(EGL_BAD_CONTEXT);
+ }
+
+ out:
+ yagl_egl_context_release(ctx);
+
+ return res;
+ }
+
+ void yagl_host_eglMakeCurrent(yagl_host_handle dpy_,
+ yagl_host_handle draw_,
+ yagl_host_handle read_,
+ yagl_host_handle ctx_)
+ {
+ EGLint error = 0;
+ bool release_context = !draw_ && !read_ && !ctx_;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_context *prev_ctx = NULL;
+ struct yagl_egl_context *ctx = NULL;
+ struct yagl_egl_surface *draw = NULL;
+ struct yagl_egl_surface *read = NULL;
+
+ YAGL_LOG_FUNC_SET(eglMakeCurrent);
+
+ if (!yagl_validate_display(dpy_, &dpy, &error)) {
+ goto out;
+ }
+
+ prev_ctx = egl_api_ts->context;
+ yagl_egl_context_acquire(prev_ctx);
+
+ if (release_context) {
+ if (!yagl_egl_release_current_context(dpy)) {
+ YAGL_LOG_ERROR("cannot release current context");
+ goto out;
+ }
+ } else {
+ if (!yagl_validate_context(dpy, ctx_, &ctx, &error)) {
+ goto out;
+ }
+
+ if (draw_ && !yagl_validate_surface(dpy, draw_, &draw, &error)) {
+ goto out;
+ }
+
+ if (read_ && !yagl_validate_surface(dpy, read_, &read, &error)) {
+ goto out;
+ }
+
+ if (prev_ctx != ctx) {
+ /*
+ * Previous context must be detached from its surfaces.
+ */
+
+ release_context = true;
+ }
+
+ if (!egl_api_ts->backend->make_current(egl_api_ts->backend,
+ dpy->backend_dpy,
+ ctx->backend_ctx,
+ (draw ? draw->backend_sfc : NULL),
+ (read ? read->backend_sfc : NULL))) {
+ YAGL_LOG_ERROR("make_current failed");
+ goto out;
+ }
+
+ yagl_egl_context_update_surfaces(ctx, draw, read);
+
+ yagl_egl_api_ts_update_context(egl_api_ts, ctx);
+ }
+
+ if (release_context && prev_ctx) {
+ yagl_egl_context_update_surfaces(prev_ctx, NULL, NULL);
+ }
+
+ YAGL_LOG_TRACE("Context switched (%u, %u, %u, %u)",
+ dpy_,
+ draw_,
+ read_,
+ ctx_);
+
+ out:
+ yagl_egl_surface_release(read);
+ yagl_egl_surface_release(draw);
+ yagl_egl_context_release(ctx);
+ yagl_egl_context_release(prev_ctx);
+ }
+
+ EGLBoolean yagl_host_eglQueryContext(yagl_host_handle dpy_,
+ yagl_host_handle ctx_,
+ EGLint attribute,
+ EGLint *value,
+ EGLint *error)
+ {
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_context *ctx = NULL;
+
+ YAGL_LOG_FUNC_SET(eglQueryContext);
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_context(dpy, ctx_, &ctx, error)) {
+ goto out;
+ }
+
+ switch (attribute) {
+ case EGL_CONFIG_ID:
+ if (value) {
+ *value = ctx->cfg->native.config_id;
+ }
+ break;
+ case EGL_RENDER_BUFFER:
+ if (ctx->draw) {
+ switch (ctx->draw->backend_sfc->type) {
+ case EGL_PBUFFER_BIT:
+ case EGL_WINDOW_BIT:
+ if (value) {
+ *value = EGL_BACK_BUFFER;
+ }
+ break;
+ case EGL_PIXMAP_BIT:
+ if (value) {
+ *value = EGL_SINGLE_BUFFER;
+ }
+ break;
+ default:
+ if (value) {
+ *value = EGL_NONE;
+ }
+ break;
+ }
+ } else if (value) {
+ *value = EGL_NONE;
+ }
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ res = EGL_TRUE;
+
+ out:
+ yagl_egl_context_release(ctx);
+
+ return res;
+ }
+
+ void yagl_host_eglSwapBuffers(yagl_host_handle dpy_,
+ yagl_host_handle surface_)
+ {
+ EGLint error = 0;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_surface *surface = NULL;
+
+ if (!yagl_validate_display(dpy_, &dpy, &error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface, &error)) {
+ goto out;
+ }
+
+ surface->backend_sfc->swap_buffers(surface->backend_sfc);
+
+ out:
+ yagl_egl_surface_release(surface);
+ }
+
+ void yagl_host_eglCopyBuffers(yagl_host_handle dpy_,
+ yagl_host_handle surface_)
+ {
+ EGLint error = 0;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_surface *surface = NULL;
+
+ if (!yagl_validate_display(dpy_, &dpy, &error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface, &error)) {
+ goto out;
+ }
+
+ surface->backend_sfc->copy_buffers(surface->backend_sfc);
+
+ out:
+ yagl_egl_surface_release(surface);
+ }
+
+ yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle dpy_,
+ yagl_host_handle config_,
+ uint32_t width,
+ uint32_t height,
+ uint32_t bpp,
+ target_ulong pixels,
+ const EGLint *attrib_list, int32_t attrib_list_count,
+ EGLint *error)
+ {
+ yagl_host_handle res = 0;
+ struct yagl_eglb_surface *backend_sfc = NULL;
+ struct yagl_egl_window_attribs attribs;
+ int i = 0;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_config *config = NULL;
+ struct yagl_egl_surface *surface = NULL;
+
+ YAGL_LOG_FUNC_SET(eglCreateWindowSurfaceOffscreenYAGL);
+
+ yagl_egl_window_attribs_init(&attribs);
+
+ if (!yagl_egl_is_attrib_list_empty(attrib_list)) {
+ while (attrib_list[i] != EGL_NONE) {
+ switch (attrib_list[i]) {
+ case EGL_RENDER_BUFFER:
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ i += 2;
+ }
+ }
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_config(dpy, config_, &config, error)) {
+ goto out;
+ }
+
+ if (!dpy->backend_dpy->create_offscreen_surface) {
+ YAGL_LOG_CRITICAL("Offscreen surfaces not supported");
+ YAGL_SET_ERR(EGL_BAD_NATIVE_WINDOW);
+ goto out;
+ }
+
+ backend_sfc = dpy->backend_dpy->create_offscreen_surface(dpy->backend_dpy,
+ &config->native,
+ EGL_WINDOW_BIT,
+ &attribs,
+ width,
+ height,
+ bpp,
+ pixels);
+
+ if (!backend_sfc) {
+ YAGL_SET_ERR(EGL_BAD_NATIVE_WINDOW);
+ goto out;
+ }
+
+ surface = yagl_egl_surface_create(dpy, config, backend_sfc);
+
+ if (!surface) {
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto out;
+ }
+
+ /*
+ * Owned by 'surface' now.
+ */
+ backend_sfc = NULL;
+
+ yagl_egl_display_add_surface(dpy, surface);
+ yagl_egl_surface_release(surface);
+
+ res = surface->res.handle;
+
+ out:
+ yagl_egl_config_release(config);
+ if (backend_sfc) {
+ backend_sfc->destroy(backend_sfc);
+ }
+
+ return res;
+ }
+
+ yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle dpy_,
+ yagl_host_handle config_,
+ uint32_t width,
+ uint32_t height,
+ uint32_t bpp,
+ target_ulong pixels,
+ const EGLint *attrib_list, int32_t attrib_list_count,
+ EGLint *error)
+ {
+ yagl_host_handle res = 0;
+ struct yagl_eglb_surface *backend_sfc = NULL;
+ struct yagl_egl_pbuffer_attribs attribs;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_config *config = NULL;
+ struct yagl_egl_surface *surface = NULL;
+ int i = 0;
+
+ YAGL_LOG_FUNC_SET(eglCreatePbufferSurfaceOffscreenYAGL);
+
+ yagl_egl_pbuffer_attribs_init(&attribs);
+
+ if (!yagl_egl_is_attrib_list_empty(attrib_list)) {
+ while (attrib_list[i] != EGL_NONE) {
+ switch (attrib_list[i]) {
+ case EGL_LARGEST_PBUFFER:
+ attribs.largest = (attrib_list[i + 1] ? EGL_TRUE : EGL_FALSE);
+ break;
+ case EGL_MIPMAP_TEXTURE:
+ attribs.tex_mipmap = (attrib_list[i + 1] ? EGL_TRUE : EGL_FALSE);
+ break;
+ case EGL_TEXTURE_FORMAT:
+ switch (attrib_list[i + 1]) {
+ case EGL_NO_TEXTURE:
+ case EGL_TEXTURE_RGB:
+ case EGL_TEXTURE_RGBA:
+ attribs.tex_format = attrib_list[i + 1];
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ break;
+ case EGL_TEXTURE_TARGET:
+ switch (attrib_list[i + 1]) {
+ case EGL_NO_TEXTURE:
+ case EGL_TEXTURE_2D:
+ attribs.tex_target = attrib_list[i + 1];
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ break;
+ case EGL_HEIGHT:
+ case EGL_WIDTH:
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ i += 2;
+ }
+ }
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_config(dpy, config_, &config, error)) {
+ goto out;
+ }
+
+ if (!dpy->backend_dpy->create_offscreen_surface) {
+ YAGL_LOG_CRITICAL("Offscreen surfaces not supported");
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto out;
+ }
+
+ backend_sfc = dpy->backend_dpy->create_offscreen_surface(dpy->backend_dpy,
+ &config->native,
+ EGL_PBUFFER_BIT,
+ &attribs,
+ width,
+ height,
+ bpp,
+ pixels);
+
+ if (!backend_sfc) {
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto out;
+ }
+
+ surface = yagl_egl_surface_create(dpy, config, backend_sfc);
+
+ if (!surface) {
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto out;
+ }
+
+ /*
+ * Owned by 'surface' now.
+ */
+ backend_sfc = NULL;
+
+ yagl_egl_display_add_surface(dpy, surface);
+ yagl_egl_surface_release(surface);
+
+ res = surface->res.handle;
+
+ out:
+ yagl_egl_config_release(config);
+ if (backend_sfc) {
+ backend_sfc->destroy(backend_sfc);
+ }
+
+ return res;
+ }
+
+ yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle dpy_,
+ yagl_host_handle config_,
+ uint32_t width,
+ uint32_t height,
+ uint32_t bpp,
+ target_ulong pixels,
+ const EGLint *attrib_list, int32_t attrib_list_count,
+ EGLint *error)
+ {
+ yagl_host_handle res = 0;
+ struct yagl_eglb_surface *backend_sfc = NULL;
+ struct yagl_egl_pixmap_attribs attribs;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_config *config = NULL;
+ struct yagl_egl_surface *surface = NULL;
+
+ YAGL_LOG_FUNC_SET(eglCreatePixmapSurfaceOffscreenYAGL);
+
+ yagl_egl_pixmap_attribs_init(&attribs);
+
+ if (!yagl_egl_is_attrib_list_empty(attrib_list)) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_config(dpy, config_, &config, error)) {
+ goto out;
+ }
+
+ if (!dpy->backend_dpy->create_offscreen_surface) {
+ YAGL_LOG_CRITICAL("Offscreen surfaces not supported");
+ YAGL_SET_ERR(EGL_BAD_NATIVE_PIXMAP);
+ goto out;
+ }
+
+ backend_sfc = dpy->backend_dpy->create_offscreen_surface(dpy->backend_dpy,
+ &config->native,
+ EGL_PIXMAP_BIT,
+ &attribs,
+ width,
+ height,
+ bpp,
+ pixels);
+
+ if (!backend_sfc) {
+ YAGL_SET_ERR(EGL_BAD_NATIVE_PIXMAP);
+ goto out;
+ }
+
+ surface = yagl_egl_surface_create(dpy, config, backend_sfc);
+
+ if (!surface) {
+ YAGL_SET_ERR(EGL_BAD_NATIVE_PIXMAP);
+ goto out;
+ }
+
+ /*
+ * Owned by 'surface' now.
+ */
+ backend_sfc = NULL;
+
+ yagl_egl_display_add_surface(dpy, surface);
+ yagl_egl_surface_release(surface);
+
+ res = surface->res.handle;
+
+ out:
+ yagl_egl_config_release(config);
+ if (backend_sfc) {
+ backend_sfc->destroy(backend_sfc);
+ }
+
+ return res;
+ }
+
+ EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy_,
+ yagl_host_handle surface_,
+ uint32_t width,
+ uint32_t height,
+ uint32_t bpp,
+ target_ulong pixels,
+ EGLint *error)
+ {
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_surface *surface = NULL;
+ struct yagl_eglb_surface *backend_sfc = NULL;
+ struct yagl_eglb_surface *draw_sfc = NULL;
+ struct yagl_eglb_surface *read_sfc = NULL;
+
+ YAGL_LOG_FUNC_SET(eglResizeOffscreenSurfaceYAGL);
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface, error)) {
+ goto out;
+ }
+
+ if (!dpy->backend_dpy->create_offscreen_surface) {
+ YAGL_LOG_CRITICAL("Offscreen surfaces not supported");
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto out;
+ }
+
+ backend_sfc = dpy->backend_dpy->create_offscreen_surface(dpy->backend_dpy,
+ &surface->cfg->native,
+ surface->backend_sfc->type,
+ &surface->backend_sfc->attribs,
+ width,
+ height,
+ bpp,
+ pixels);
+
+ if (!backend_sfc) {
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto out;
+ }
+
+ if (egl_api_ts->context->draw) {
+ if (egl_api_ts->context->draw == surface) {
+ draw_sfc = backend_sfc;
+ } else {
+ draw_sfc = egl_api_ts->context->draw->backend_sfc;
+ }
+ }
+
+ if (egl_api_ts->context->read) {
+ if (egl_api_ts->context->read == surface) {
+ read_sfc = backend_sfc;
+ } else {
+ read_sfc = egl_api_ts->context->read->backend_sfc;
+ }
+ }
+
+ if (!egl_api_ts->backend->make_current(egl_api_ts->backend,
+ dpy->backend_dpy,
+ egl_api_ts->context->backend_ctx,
+ draw_sfc,
+ read_sfc)) {
+ YAGL_LOG_ERROR("make_current failed");
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto out;
+ }
+
+ surface->backend_sfc->replace(surface->backend_sfc, backend_sfc);
+
+ backend_sfc = NULL;
+
+ res = EGL_TRUE;
+
+ out:
+ if (backend_sfc) {
+ backend_sfc->destroy(backend_sfc);
+ }
+ yagl_egl_surface_release(surface);
+
+ return res;
+ }
+
+ yagl_host_handle yagl_host_eglCreateWindowSurfaceOnscreenYAGL(yagl_host_handle dpy_,
+ yagl_host_handle config_,
+ yagl_winsys_id win,
+ const EGLint *attrib_list, int32_t attrib_list_count,
+ EGLint *error)
+ {
+ yagl_host_handle res = 0;
+ struct yagl_eglb_surface *backend_sfc = NULL;
+ struct yagl_egl_window_attribs attribs;
+ int i = 0;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_config *config = NULL;
+ struct yagl_egl_surface *surface = NULL;
+
+ YAGL_LOG_FUNC_SET(eglCreateWindowSurfaceOnscreenYAGL);
+
+ yagl_egl_window_attribs_init(&attribs);
+
+ if (!yagl_egl_is_attrib_list_empty(attrib_list)) {
+ while (attrib_list[i] != EGL_NONE) {
+ switch (attrib_list[i]) {
+ case EGL_RENDER_BUFFER:
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ i += 2;
+ }
+ }
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_config(dpy, config_, &config, error)) {
+ goto out;
+ }
+
+ if (!dpy->backend_dpy->create_onscreen_window_surface) {
+ YAGL_LOG_CRITICAL("Onscreen window surfaces not supported");
+ YAGL_SET_ERR(EGL_BAD_NATIVE_WINDOW);
+ goto out;
+ }
+
+ backend_sfc = dpy->backend_dpy->create_onscreen_window_surface(dpy->backend_dpy,
+ &config->native,
+ &attribs,
+ win);
+
+ if (!backend_sfc) {
+ YAGL_LOG_ERROR("Unable to create window surface for 0x%X", win);
+ YAGL_SET_ERR(EGL_BAD_NATIVE_WINDOW);
+ goto out;
+ }
+
+ surface = yagl_egl_surface_create(dpy, config, backend_sfc);
+
+ if (!surface) {
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto out;
+ }
+
+ /*
+ * Owned by 'surface' now.
+ */
+ backend_sfc = NULL;
+
+ yagl_egl_display_add_surface(dpy, surface);
+ yagl_egl_surface_release(surface);
+
+ res = surface->res.handle;
+
+ out:
+ yagl_egl_config_release(config);
+ if (backend_sfc) {
+ backend_sfc->destroy(backend_sfc);
+ }
+
+ return res;
+ }
+
+ yagl_host_handle yagl_host_eglCreatePbufferSurfaceOnscreenYAGL(yagl_host_handle dpy_,
+ yagl_host_handle config_,
+ yagl_winsys_id buffer,
+ const EGLint *attrib_list, int32_t attrib_list_count,
+ EGLint *error)
+ {
+ yagl_host_handle res = 0;
+ struct yagl_eglb_surface *backend_sfc = NULL;
+ struct yagl_egl_pbuffer_attribs attribs;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_config *config = NULL;
+ struct yagl_egl_surface *surface = NULL;
+ int i = 0;
+
+ YAGL_LOG_FUNC_SET(eglCreatePbufferSurfaceOnscreenYAGL);
+
+ yagl_egl_pbuffer_attribs_init(&attribs);
+
+ if (!yagl_egl_is_attrib_list_empty(attrib_list)) {
+ while (attrib_list[i] != EGL_NONE) {
+ switch (attrib_list[i]) {
+ case EGL_LARGEST_PBUFFER:
+ attribs.largest = (attrib_list[i + 1] ? EGL_TRUE : EGL_FALSE);
+ break;
+ case EGL_MIPMAP_TEXTURE:
+ attribs.tex_mipmap = (attrib_list[i + 1] ? EGL_TRUE : EGL_FALSE);
+ break;
+ case EGL_TEXTURE_FORMAT:
+ switch (attrib_list[i + 1]) {
+ case EGL_NO_TEXTURE:
+ case EGL_TEXTURE_RGB:
+ case EGL_TEXTURE_RGBA:
+ attribs.tex_format = attrib_list[i + 1];
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ break;
+ case EGL_TEXTURE_TARGET:
+ switch (attrib_list[i + 1]) {
+ case EGL_NO_TEXTURE:
+ case EGL_TEXTURE_2D:
+ attribs.tex_target = attrib_list[i + 1];
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+ break;
+ case EGL_HEIGHT:
+ case EGL_WIDTH:
+ break;
+ default:
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ i += 2;
+ }
+ }
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_config(dpy, config_, &config, error)) {
+ goto out;
+ }
+
+ if (!dpy->backend_dpy->create_onscreen_pbuffer_surface) {
+ YAGL_LOG_CRITICAL("Onscreen pbuffer surfaces not supported");
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto out;
+ }
+
+ backend_sfc = dpy->backend_dpy->create_onscreen_pbuffer_surface(dpy->backend_dpy,
+ &config->native,
+ &attribs,
+ buffer);
+
+ if (!backend_sfc) {
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto out;
+ }
+
+ surface = yagl_egl_surface_create(dpy, config, backend_sfc);
+
+ if (!surface) {
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto out;
+ }
+
+ /*
+ * Owned by 'surface' now.
+ */
+ backend_sfc = NULL;
+
+ yagl_egl_display_add_surface(dpy, surface);
+ yagl_egl_surface_release(surface);
+
+ res = surface->res.handle;
+
+ out:
+ yagl_egl_config_release(config);
+ if (backend_sfc) {
+ backend_sfc->destroy(backend_sfc);
+ }
+
+ return res;
+ }
+
+ yagl_host_handle yagl_host_eglCreatePixmapSurfaceOnscreenYAGL(yagl_host_handle dpy_,
+ yagl_host_handle config_,
+ yagl_winsys_id pixmap,
+ const EGLint *attrib_list, int32_t attrib_list_count,
+ EGLint *error)
+ {
+ yagl_host_handle res = 0;
+ struct yagl_eglb_surface *backend_sfc = NULL;
+ struct yagl_egl_pixmap_attribs attribs;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_config *config = NULL;
+ struct yagl_egl_surface *surface = NULL;
+
+ YAGL_LOG_FUNC_SET(eglCreatePixmapSurfaceOnscreenYAGL);
+
+ yagl_egl_pixmap_attribs_init(&attribs);
+
+ if (!yagl_egl_is_attrib_list_empty(attrib_list)) {
+ YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+ goto out;
+ }
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_config(dpy, config_, &config, error)) {
+ goto out;
+ }
+
+ if (!dpy->backend_dpy->create_onscreen_pixmap_surface) {
+ YAGL_LOG_CRITICAL("Onscreen pixmap surfaces not supported");
+ YAGL_SET_ERR(EGL_BAD_NATIVE_PIXMAP);
+ goto out;
+ }
+
+ backend_sfc = dpy->backend_dpy->create_onscreen_pixmap_surface(dpy->backend_dpy,
+ &config->native,
+ &attribs,
+ pixmap);
+
+ if (!backend_sfc) {
+ YAGL_LOG_ERROR("Unable to create pixmap surface for 0x%X", pixmap);
+ YAGL_SET_ERR(EGL_BAD_NATIVE_PIXMAP);
+ goto out;
+ }
+
+ surface = yagl_egl_surface_create(dpy, config, backend_sfc);
+
+ if (!surface) {
+ YAGL_SET_ERR(EGL_BAD_NATIVE_PIXMAP);
+ goto out;
+ }
+
+ /*
+ * Owned by 'surface' now.
+ */
+ backend_sfc = NULL;
+
+ yagl_egl_display_add_surface(dpy, surface);
+ yagl_egl_surface_release(surface);
+
+ res = surface->res.handle;
+
+ out:
+ yagl_egl_config_release(config);
+ if (backend_sfc) {
+ backend_sfc->destroy(backend_sfc);
+ }
+
+ return res;
+ }
+
+ void yagl_host_eglInvalidateOnscreenSurfaceYAGL(yagl_host_handle dpy_,
+ yagl_host_handle surface_,
+ yagl_winsys_id buffer)
+ {
+ EGLint error = 0;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_egl_surface *surface = NULL;
+
+ if (!yagl_validate_display(dpy_, &dpy, &error)) {
+ goto out;
+ }
+
+ if (!yagl_validate_surface(dpy, surface_, &surface, &error)) {
+ goto out;
+ }
+
+ surface->backend_sfc->invalidate(surface->backend_sfc, buffer);
+
+ out:
+ yagl_egl_surface_release(surface);
+ }
+
+ EGLBoolean yagl_host_eglCreateImageYAGL(uint32_t texture,
+ yagl_host_handle dpy_,
+ yagl_winsys_id buffer,
+ EGLint *error)
+ {
+ EGLBoolean res = EGL_FALSE;
+ struct yagl_egl_display *dpy = NULL;
+ struct yagl_object *image;
+
+ YAGL_LOG_FUNC_SET(eglCreateImageYAGL);
+
+ if (!yagl_validate_display(dpy_, &dpy, error)) {
+ goto out;
+ }
+
+ image = dpy->backend_dpy->create_image(dpy->backend_dpy, buffer);
+
+ if (!image) {
+ YAGL_SET_ERR(EGL_BAD_ALLOC);
+ goto out;
+ }
+
+ yagl_object_map_add(cur_ts->ps->object_map, texture, image);
+
+ res = EGL_TRUE;
+
+ out:
+ return res;
+ }
--- /dev/null
-#include "yagl_vector.h"
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
++#include <GL/gl.h>
+ #include "yagl_gles_api_ts.h"
++#include "yagl_gles_driver.h"
+ #include "yagl_process.h"
+ #include "yagl_thread.h"
- uint32_t i;
-
- for (i = 0; i < gles_api_ts->num_arrays; ++i) {
- yagl_vector_cleanup(&gles_api_ts->arrays[i]);
+
+ void yagl_gles_api_ts_init(struct yagl_gles_api_ts *gles_api_ts,
+ struct yagl_gles_driver *driver,
+ struct yagl_gles_api_ps *ps)
+ {
+ gles_api_ts->driver = driver;
+ gles_api_ts->ps = ps;
+ }
+
+ void yagl_gles_api_ts_cleanup(struct yagl_gles_api_ts *gles_api_ts)
+ {
++ if (gles_api_ts->num_arrays > 0) {
++ yagl_ensure_ctx(0);
++ gles_api_ts->driver->DeleteBuffers(gles_api_ts->num_arrays,
++ gles_api_ts->arrays);
++ yagl_unensure_ctx(0);
+ }
++
+ g_free(gles_api_ts->arrays);
+ }
--- /dev/null
-struct yagl_vector;
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #ifndef _QEMU_YAGL_GLES_API_TS_H
+ #define _QEMU_YAGL_GLES_API_TS_H
+
+ #include "yagl_types.h"
+
+ struct yagl_gles_driver;
+ struct yagl_gles_api_ps;
- struct yagl_vector *arrays;
+
+ struct yagl_gles_api_ts
+ {
+ struct yagl_gles_driver *driver;
+
+ struct yagl_gles_api_ps *ps;
+
++ GLuint *arrays;
+ uint32_t num_arrays;
+ };
+
+ void yagl_gles_api_ts_init(struct yagl_gles_api_ts *gles_api_ts,
+ struct yagl_gles_driver *driver,
+ struct yagl_gles_api_ps *ps);
+
+ void yagl_gles_api_ts_cleanup(struct yagl_gles_api_ts *gles_api_ts);
+
+ #endif
--- /dev/null
- * glDisableVertexAttribArray dispatcher. id = 4
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ /*
+ * Generated by gen-yagl-calls.py, do not modify!
+ */
+ #include "yagl_gles_calls.h"
+ #include "yagl_host_gles_calls.h"
+ #include "yagl_transport_gl.h"
+ #include "yagl_thread.h"
+ #include "yagl_process.h"
+ #include "yagl_log.h"
+
+ /*
+ * glDrawArrays dispatcher. id = 1
+ */
+ static void yagl_func_glDrawArrays(struct yagl_transport *t)
+ {
+ GLenum mode;
+ GLint first;
+ GLsizei count;
+ mode = yagl_transport_get_out_GLenum(t);
+ first = yagl_transport_get_out_GLint(t);
+ count = yagl_transport_get_out_GLsizei(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glDrawArrays, GLenum, GLint, GLsizei, mode, first, count);
+ (void)yagl_host_glDrawArrays(mode, first, count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
+ * glDrawElements dispatcher. id = 2
+ */
+ static void yagl_func_glDrawElements(struct yagl_transport *t)
+ {
+ GLenum mode;
+ GLsizei count;
+ GLenum type;
+ const GLvoid *indices;
+ int32_t indices_count;
+ mode = yagl_transport_get_out_GLenum(t);
+ count = yagl_transport_get_out_GLsizei(t);
+ type = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_out_array(t, 1, (const void**)&indices, &indices_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glDrawElements, GLenum, GLsizei, GLenum, void*, mode, count, type, indices);
+ (void)yagl_host_glDrawElements(mode, count, type, indices, indices_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
+ * glReadPixels dispatcher. id = 3
+ */
+ static void yagl_func_glReadPixels(struct yagl_transport *t)
+ {
+ GLint x;
+ GLint y;
+ GLsizei width;
+ GLsizei height;
+ GLenum format;
+ GLenum type;
+ GLvoid *pixels;
+ int32_t pixels_maxcount;
+ int32_t *pixels_count;
+ x = yagl_transport_get_out_GLint(t);
+ y = yagl_transport_get_out_GLint(t);
+ width = yagl_transport_get_out_GLsizei(t);
+ height = yagl_transport_get_out_GLsizei(t);
+ format = yagl_transport_get_out_GLenum(t);
+ type = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_array(t, 1, (void**)&pixels, &pixels_maxcount, &pixels_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT7(glReadPixels, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void*, x, y, width, height, format, type, pixels);
+ *pixels_count = 0;
+ (void)yagl_host_glReadPixels(x, y, width, height, format, type, pixels, pixels_maxcount, pixels_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glEnableVertexAttribArray dispatcher. id = 5
++ * glDrawArraysInstanced dispatcher. id = 4
++ */
++static void yagl_func_glDrawArraysInstanced(struct yagl_transport *t)
++{
++ GLenum mode;
++ GLint start;
++ GLsizei count;
++ GLsizei primcount;
++ mode = yagl_transport_get_out_GLenum(t);
++ start = yagl_transport_get_out_GLint(t);
++ count = yagl_transport_get_out_GLsizei(t);
++ primcount = yagl_transport_get_out_GLsizei(t);
++ YAGL_LOG_FUNC_ENTER_SPLIT4(glDrawArraysInstanced, GLenum, GLint, GLsizei, GLsizei, mode, start, count, primcount);
++ (void)yagl_host_glDrawArraysInstanced(mode, start, count, primcount);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glDrawElementsInstanced dispatcher. id = 5
++ */
++static void yagl_func_glDrawElementsInstanced(struct yagl_transport *t)
++{
++ GLenum mode;
++ GLsizei count;
++ GLenum type;
++ const void *indices;
++ int32_t indices_count;
++ GLsizei primcount;
++ mode = yagl_transport_get_out_GLenum(t);
++ count = yagl_transport_get_out_GLsizei(t);
++ type = yagl_transport_get_out_GLenum(t);
++ yagl_transport_get_out_array(t, 1, (const void**)&indices, &indices_count);
++ primcount = yagl_transport_get_out_GLsizei(t);
++ YAGL_LOG_FUNC_ENTER_SPLIT5(glDrawElementsInstanced, GLenum, GLsizei, GLenum, void*, GLsizei, mode, count, type, indices, primcount);
++ (void)yagl_host_glDrawElementsInstanced(mode, count, type, indices, indices_count, primcount);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glGenVertexArrays dispatcher. id = 6
++ */
++static void yagl_func_glGenVertexArrays(struct yagl_transport *t)
++{
++ const GLuint *arrays;
++ int32_t arrays_count;
++ yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&arrays, &arrays_count);
++ YAGL_LOG_FUNC_ENTER_SPLIT1(glGenVertexArrays, void*, arrays);
++ (void)yagl_host_glGenVertexArrays(arrays, arrays_count);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glBindVertexArray dispatcher. id = 7
++ */
++static void yagl_func_glBindVertexArray(struct yagl_transport *t)
++{
++ GLuint array;
++ array = yagl_transport_get_out_GLuint(t);
++ YAGL_LOG_FUNC_ENTER_SPLIT1(glBindVertexArray, GLuint, array);
++ (void)yagl_host_glBindVertexArray(array);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glDisableVertexAttribArray dispatcher. id = 8
+ */
+ static void yagl_func_glDisableVertexAttribArray(struct yagl_transport *t)
+ {
+ GLuint index;
+ index = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glDisableVertexAttribArray, GLuint, index);
+ (void)yagl_host_glDisableVertexAttribArray(index);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glVertexAttribPointerData dispatcher. id = 6
++ * glEnableVertexAttribArray dispatcher. id = 9
+ */
+ static void yagl_func_glEnableVertexAttribArray(struct yagl_transport *t)
+ {
+ GLuint index;
+ index = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glEnableVertexAttribArray, GLuint, index);
+ (void)yagl_host_glEnableVertexAttribArray(index);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glVertexAttribPointerOffset dispatcher. id = 7
++ * glVertexAttribPointerData dispatcher. id = 10
+ */
+ static void yagl_func_glVertexAttribPointerData(struct yagl_transport *t)
+ {
+ GLuint indx;
+ GLint size;
+ GLenum type;
+ GLboolean normalized;
+ GLsizei stride;
+ GLint first;
+ const GLvoid *data;
+ int32_t data_count;
+ indx = yagl_transport_get_out_GLuint(t);
+ size = yagl_transport_get_out_GLint(t);
+ type = yagl_transport_get_out_GLenum(t);
+ normalized = yagl_transport_get_out_GLboolean(t);
+ stride = yagl_transport_get_out_GLsizei(t);
+ first = yagl_transport_get_out_GLint(t);
+ yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT7(glVertexAttribPointerData, GLuint, GLint, GLenum, GLboolean, GLsizei, GLint, void*, indx, size, type, normalized, stride, first, data);
+ (void)yagl_host_glVertexAttribPointerData(indx, size, type, normalized, stride, first, data, data_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glVertexPointerData dispatcher. id = 8
++ * glVertexAttribPointerOffset dispatcher. id = 11
+ */
+ static void yagl_func_glVertexAttribPointerOffset(struct yagl_transport *t)
+ {
+ GLuint indx;
+ GLint size;
+ GLenum type;
+ GLboolean normalized;
+ GLsizei stride;
+ GLsizei offset;
+ indx = yagl_transport_get_out_GLuint(t);
+ size = yagl_transport_get_out_GLint(t);
+ type = yagl_transport_get_out_GLenum(t);
+ normalized = yagl_transport_get_out_GLboolean(t);
+ stride = yagl_transport_get_out_GLsizei(t);
+ offset = yagl_transport_get_out_GLsizei(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT6(glVertexAttribPointerOffset, GLuint, GLint, GLenum, GLboolean, GLsizei, GLsizei, indx, size, type, normalized, stride, offset);
+ (void)yagl_host_glVertexAttribPointerOffset(indx, size, type, normalized, stride, offset);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glVertexPointerOffset dispatcher. id = 9
++ * glVertexPointerData dispatcher. id = 12
+ */
+ static void yagl_func_glVertexPointerData(struct yagl_transport *t)
+ {
+ GLint size;
+ GLenum type;
+ GLsizei stride;
+ GLint first;
+ const GLvoid *data;
+ int32_t data_count;
+ size = yagl_transport_get_out_GLint(t);
+ type = yagl_transport_get_out_GLenum(t);
+ stride = yagl_transport_get_out_GLsizei(t);
+ first = yagl_transport_get_out_GLint(t);
+ yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glVertexPointerData, GLint, GLenum, GLsizei, GLint, void*, size, type, stride, first, data);
+ (void)yagl_host_glVertexPointerData(size, type, stride, first, data, data_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glNormalPointerData dispatcher. id = 10
++ * glVertexPointerOffset dispatcher. id = 13
+ */
+ static void yagl_func_glVertexPointerOffset(struct yagl_transport *t)
+ {
+ GLint size;
+ GLenum type;
+ GLsizei stride;
+ GLsizei offset;
+ size = yagl_transport_get_out_GLint(t);
+ type = yagl_transport_get_out_GLenum(t);
+ stride = yagl_transport_get_out_GLsizei(t);
+ offset = yagl_transport_get_out_GLsizei(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glVertexPointerOffset, GLint, GLenum, GLsizei, GLsizei, size, type, stride, offset);
+ (void)yagl_host_glVertexPointerOffset(size, type, stride, offset);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glNormalPointerOffset dispatcher. id = 11
++ * glNormalPointerData dispatcher. id = 14
+ */
+ static void yagl_func_glNormalPointerData(struct yagl_transport *t)
+ {
+ GLenum type;
+ GLsizei stride;
+ GLint first;
+ const GLvoid *data;
+ int32_t data_count;
+ type = yagl_transport_get_out_GLenum(t);
+ stride = yagl_transport_get_out_GLsizei(t);
+ first = yagl_transport_get_out_GLint(t);
+ yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glNormalPointerData, GLenum, GLsizei, GLint, void*, type, stride, first, data);
+ (void)yagl_host_glNormalPointerData(type, stride, first, data, data_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glColorPointerData dispatcher. id = 12
++ * glNormalPointerOffset dispatcher. id = 15
+ */
+ static void yagl_func_glNormalPointerOffset(struct yagl_transport *t)
+ {
+ GLenum type;
+ GLsizei stride;
+ GLsizei offset;
+ type = yagl_transport_get_out_GLenum(t);
+ stride = yagl_transport_get_out_GLsizei(t);
+ offset = yagl_transport_get_out_GLsizei(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glNormalPointerOffset, GLenum, GLsizei, GLsizei, type, stride, offset);
+ (void)yagl_host_glNormalPointerOffset(type, stride, offset);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glColorPointerOffset dispatcher. id = 13
++ * glColorPointerData dispatcher. id = 16
+ */
+ static void yagl_func_glColorPointerData(struct yagl_transport *t)
+ {
+ GLint size;
+ GLenum type;
+ GLsizei stride;
+ GLint first;
+ const GLvoid *data;
+ int32_t data_count;
+ size = yagl_transport_get_out_GLint(t);
+ type = yagl_transport_get_out_GLenum(t);
+ stride = yagl_transport_get_out_GLsizei(t);
+ first = yagl_transport_get_out_GLint(t);
+ yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glColorPointerData, GLint, GLenum, GLsizei, GLint, void*, size, type, stride, first, data);
+ (void)yagl_host_glColorPointerData(size, type, stride, first, data, data_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glTexCoordPointerData dispatcher. id = 14
++ * glColorPointerOffset dispatcher. id = 17
+ */
+ static void yagl_func_glColorPointerOffset(struct yagl_transport *t)
+ {
+ GLint size;
+ GLenum type;
+ GLsizei stride;
+ GLsizei offset;
+ size = yagl_transport_get_out_GLint(t);
+ type = yagl_transport_get_out_GLenum(t);
+ stride = yagl_transport_get_out_GLsizei(t);
+ offset = yagl_transport_get_out_GLsizei(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glColorPointerOffset, GLint, GLenum, GLsizei, GLsizei, size, type, stride, offset);
+ (void)yagl_host_glColorPointerOffset(size, type, stride, offset);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glTexCoordPointerOffset dispatcher. id = 15
++ * glTexCoordPointerData dispatcher. id = 18
+ */
+ static void yagl_func_glTexCoordPointerData(struct yagl_transport *t)
+ {
+ GLint tex_id;
+ GLint size;
+ GLenum type;
+ GLsizei stride;
+ GLint first;
+ const GLvoid *data;
+ int32_t data_count;
+ tex_id = yagl_transport_get_out_GLint(t);
+ size = yagl_transport_get_out_GLint(t);
+ type = yagl_transport_get_out_GLenum(t);
+ stride = yagl_transport_get_out_GLsizei(t);
+ first = yagl_transport_get_out_GLint(t);
+ yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT6(glTexCoordPointerData, GLint, GLint, GLenum, GLsizei, GLint, void*, tex_id, size, type, stride, first, data);
+ (void)yagl_host_glTexCoordPointerData(tex_id, size, type, stride, first, data, data_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glDisableClientState dispatcher. id = 16
++ * glTexCoordPointerOffset dispatcher. id = 19
+ */
+ static void yagl_func_glTexCoordPointerOffset(struct yagl_transport *t)
+ {
+ GLint size;
+ GLenum type;
+ GLsizei stride;
+ GLsizei offset;
+ size = yagl_transport_get_out_GLint(t);
+ type = yagl_transport_get_out_GLenum(t);
+ stride = yagl_transport_get_out_GLsizei(t);
+ offset = yagl_transport_get_out_GLsizei(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glTexCoordPointerOffset, GLint, GLenum, GLsizei, GLsizei, size, type, stride, offset);
+ (void)yagl_host_glTexCoordPointerOffset(size, type, stride, offset);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glEnableClientState dispatcher. id = 17
++ * glDisableClientState dispatcher. id = 20
+ */
+ static void yagl_func_glDisableClientState(struct yagl_transport *t)
+ {
+ GLenum array;
+ array = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glDisableClientState, GLenum, array);
+ (void)yagl_host_glDisableClientState(array);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGenBuffers dispatcher. id = 18
++ * glEnableClientState dispatcher. id = 21
+ */
+ static void yagl_func_glEnableClientState(struct yagl_transport *t)
+ {
+ GLenum array;
+ array = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glEnableClientState, GLenum, array);
+ (void)yagl_host_glEnableClientState(array);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glBindBuffer dispatcher. id = 19
++ * glVertexAttribDivisor dispatcher. id = 22
++ */
++static void yagl_func_glVertexAttribDivisor(struct yagl_transport *t)
++{
++ GLuint index;
++ GLuint divisor;
++ index = yagl_transport_get_out_GLuint(t);
++ divisor = yagl_transport_get_out_GLuint(t);
++ YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttribDivisor, GLuint, GLuint, index, divisor);
++ (void)yagl_host_glVertexAttribDivisor(index, divisor);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glGenBuffers dispatcher. id = 23
+ */
+ static void yagl_func_glGenBuffers(struct yagl_transport *t)
+ {
+ const GLuint *buffers;
+ int32_t buffers_count;
+ yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&buffers, &buffers_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glGenBuffers, void*, buffers);
+ (void)yagl_host_glGenBuffers(buffers, buffers_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glBufferData dispatcher. id = 20
++ * glBindBuffer dispatcher. id = 24
+ */
+ static void yagl_func_glBindBuffer(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLuint buffer;
+ target = yagl_transport_get_out_GLenum(t);
+ buffer = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glBindBuffer, GLenum, GLuint, target, buffer);
+ (void)yagl_host_glBindBuffer(target, buffer);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glBufferSubData dispatcher. id = 21
++ * glBufferData dispatcher. id = 25
+ */
+ static void yagl_func_glBufferData(struct yagl_transport *t)
+ {
+ GLenum target;
+ const GLvoid *data;
+ int32_t data_count;
+ GLenum usage;
+ target = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count);
+ usage = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glBufferData, GLenum, void*, GLenum, target, data, usage);
+ (void)yagl_host_glBufferData(target, data, data_count, usage);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGenTextures dispatcher. id = 22
++ * glBufferSubData dispatcher. id = 26
+ */
+ static void yagl_func_glBufferSubData(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLsizei offset;
+ const GLvoid *data;
+ int32_t data_count;
+ target = yagl_transport_get_out_GLenum(t);
+ offset = yagl_transport_get_out_GLsizei(t);
+ yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glBufferSubData, GLenum, GLsizei, void*, target, offset, data);
+ (void)yagl_host_glBufferSubData(target, offset, data, data_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glBindTexture dispatcher. id = 23
++ * glBindBufferBase dispatcher. id = 27
++ */
++static void yagl_func_glBindBufferBase(struct yagl_transport *t)
++{
++ GLenum target;
++ GLuint index;
++ GLuint buffer;
++ target = yagl_transport_get_out_GLenum(t);
++ index = yagl_transport_get_out_GLuint(t);
++ buffer = yagl_transport_get_out_GLuint(t);
++ YAGL_LOG_FUNC_ENTER_SPLIT3(glBindBufferBase, GLenum, GLuint, GLuint, target, index, buffer);
++ (void)yagl_host_glBindBufferBase(target, index, buffer);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glBindBufferRange dispatcher. id = 28
++ */
++static void yagl_func_glBindBufferRange(struct yagl_transport *t)
++{
++ GLenum target;
++ GLuint index;
++ GLuint buffer;
++ GLint offset;
++ GLsizei size;
++ target = yagl_transport_get_out_GLenum(t);
++ index = yagl_transport_get_out_GLuint(t);
++ buffer = yagl_transport_get_out_GLuint(t);
++ offset = yagl_transport_get_out_GLint(t);
++ size = yagl_transport_get_out_GLsizei(t);
++ YAGL_LOG_FUNC_ENTER_SPLIT5(glBindBufferRange, GLenum, GLuint, GLuint, GLint, GLsizei, target, index, buffer, offset, size);
++ (void)yagl_host_glBindBufferRange(target, index, buffer, offset, size);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glGenTextures dispatcher. id = 29
+ */
+ static void yagl_func_glGenTextures(struct yagl_transport *t)
+ {
+ const GLuint *textures;
+ int32_t textures_count;
+ yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&textures, &textures_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glGenTextures, void*, textures);
+ (void)yagl_host_glGenTextures(textures, textures_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glActiveTexture dispatcher. id = 24
++ * glBindTexture dispatcher. id = 30
+ */
+ static void yagl_func_glBindTexture(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLuint texture;
+ target = yagl_transport_get_out_GLenum(t);
+ texture = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glBindTexture, GLenum, GLuint, target, texture);
+ (void)yagl_host_glBindTexture(target, texture);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glCompressedTexImage2D dispatcher. id = 25
++ * glActiveTexture dispatcher. id = 31
+ */
+ static void yagl_func_glActiveTexture(struct yagl_transport *t)
+ {
+ GLenum texture;
+ texture = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glActiveTexture, GLenum, texture);
+ (void)yagl_host_glActiveTexture(texture);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glCompressedTexSubImage2D dispatcher. id = 26
++ * glCompressedTexImage2D dispatcher. id = 32
+ */
+ static void yagl_func_glCompressedTexImage2D(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLint level;
+ GLenum internalformat;
+ GLsizei width;
+ GLsizei height;
+ GLint border;
+ const GLvoid *data;
+ int32_t data_count;
+ target = yagl_transport_get_out_GLenum(t);
+ level = yagl_transport_get_out_GLint(t);
+ internalformat = yagl_transport_get_out_GLenum(t);
+ width = yagl_transport_get_out_GLsizei(t);
+ height = yagl_transport_get_out_GLsizei(t);
+ border = yagl_transport_get_out_GLint(t);
+ yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT7(glCompressedTexImage2D, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, void*, target, level, internalformat, width, height, border, data);
+ (void)yagl_host_glCompressedTexImage2D(target, level, internalformat, width, height, border, data, data_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glCopyTexImage2D dispatcher. id = 27
++ * glCompressedTexSubImage2D dispatcher. id = 33
+ */
+ static void yagl_func_glCompressedTexSubImage2D(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLint level;
+ GLint xoffset;
+ GLint yoffset;
+ GLsizei width;
+ GLsizei height;
+ GLenum format;
+ const GLvoid *data;
+ int32_t data_count;
+ target = yagl_transport_get_out_GLenum(t);
+ level = yagl_transport_get_out_GLint(t);
+ xoffset = yagl_transport_get_out_GLint(t);
+ yoffset = yagl_transport_get_out_GLint(t);
+ width = yagl_transport_get_out_GLsizei(t);
+ height = yagl_transport_get_out_GLsizei(t);
+ format = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT8(glCompressedTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, void*, target, level, xoffset, yoffset, width, height, format, data);
+ (void)yagl_host_glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, data, data_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glCopyTexSubImage2D dispatcher. id = 28
++ * glCopyTexImage2D dispatcher. id = 34
+ */
+ static void yagl_func_glCopyTexImage2D(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLint level;
+ GLenum internalformat;
+ GLint x;
+ GLint y;
+ GLsizei width;
+ GLsizei height;
+ GLint border;
+ target = yagl_transport_get_out_GLenum(t);
+ level = yagl_transport_get_out_GLint(t);
+ internalformat = yagl_transport_get_out_GLenum(t);
+ x = yagl_transport_get_out_GLint(t);
+ y = yagl_transport_get_out_GLint(t);
+ width = yagl_transport_get_out_GLsizei(t);
+ height = yagl_transport_get_out_GLsizei(t);
+ border = yagl_transport_get_out_GLint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT8(glCopyTexImage2D, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, target, level, internalformat, x, y, width, height, border);
+ (void)yagl_host_glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetTexParameterfv dispatcher. id = 29
++ * glCopyTexSubImage2D dispatcher. id = 35
+ */
+ static void yagl_func_glCopyTexSubImage2D(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLint level;
+ GLint xoffset;
+ GLint yoffset;
+ GLint x;
+ GLint y;
+ GLsizei width;
+ GLsizei height;
+ target = yagl_transport_get_out_GLenum(t);
+ level = yagl_transport_get_out_GLint(t);
+ xoffset = yagl_transport_get_out_GLint(t);
+ yoffset = yagl_transport_get_out_GLint(t);
+ x = yagl_transport_get_out_GLint(t);
+ y = yagl_transport_get_out_GLint(t);
+ width = yagl_transport_get_out_GLsizei(t);
+ height = yagl_transport_get_out_GLsizei(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT8(glCopyTexSubImage2D, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, target, level, xoffset, yoffset, x, y, width, height);
+ (void)yagl_host_glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetTexParameteriv dispatcher. id = 30
++ * glGetTexParameterfv dispatcher. id = 36
+ */
+ static void yagl_func_glGetTexParameterfv(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLenum pname;
+ GLfloat *param;
+ target = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_arg(t, (void**)¶m);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexParameterfv, GLenum, GLenum, void*, target, pname, param);
+ (void)yagl_host_glGetTexParameterfv(target, pname, param);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glTexImage2D dispatcher. id = 31
++ * glGetTexParameteriv dispatcher. id = 37
+ */
+ static void yagl_func_glGetTexParameteriv(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLenum pname;
+ GLint *param;
+ target = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_arg(t, (void**)¶m);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexParameteriv, GLenum, GLenum, void*, target, pname, param);
+ (void)yagl_host_glGetTexParameteriv(target, pname, param);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glTexParameterf dispatcher. id = 32
++ * glTexImage2D dispatcher. id = 38
+ */
+ static void yagl_func_glTexImage2D(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLint level;
+ GLint internalformat;
+ GLsizei width;
+ GLsizei height;
+ GLint border;
+ GLenum format;
+ GLenum type;
+ const GLvoid *pixels;
+ int32_t pixels_count;
+ target = yagl_transport_get_out_GLenum(t);
+ level = yagl_transport_get_out_GLint(t);
+ internalformat = yagl_transport_get_out_GLint(t);
+ width = yagl_transport_get_out_GLsizei(t);
+ height = yagl_transport_get_out_GLsizei(t);
+ border = yagl_transport_get_out_GLint(t);
+ format = yagl_transport_get_out_GLenum(t);
+ type = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT9(glTexImage2D, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, void*, target, level, internalformat, width, height, border, format, type, pixels);
+ (void)yagl_host_glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels, pixels_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glTexParameterfv dispatcher. id = 33
++ * glTexParameterf dispatcher. id = 39
+ */
+ static void yagl_func_glTexParameterf(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLenum pname;
+ GLfloat param;
+ target = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ param = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameterf, GLenum, GLenum, GLfloat, target, pname, param);
+ (void)yagl_host_glTexParameterf(target, pname, param);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glTexParameteri dispatcher. id = 34
++ * glTexParameterfv dispatcher. id = 40
+ */
+ static void yagl_func_glTexParameterfv(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLenum pname;
+ const GLfloat *params;
+ int32_t params_count;
+ target = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameterfv, GLenum, GLenum, void*, target, pname, params);
+ (void)yagl_host_glTexParameterfv(target, pname, params, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glTexParameteriv dispatcher. id = 35
++ * glTexParameteri dispatcher. id = 41
+ */
+ static void yagl_func_glTexParameteri(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLenum pname;
+ GLint param;
+ target = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ param = yagl_transport_get_out_GLint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameteri, GLenum, GLenum, GLint, target, pname, param);
+ (void)yagl_host_glTexParameteri(target, pname, param);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glTexSubImage2D dispatcher. id = 36
++ * glTexParameteriv dispatcher. id = 42
+ */
+ static void yagl_func_glTexParameteriv(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLenum pname;
+ const GLint *params;
+ int32_t params_count;
+ target = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_out_array(t, sizeof(GLint), (const void**)¶ms, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameteriv, GLenum, GLenum, void*, target, pname, params);
+ (void)yagl_host_glTexParameteriv(target, pname, params, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glClientActiveTexture dispatcher. id = 37
++ * glTexSubImage2D dispatcher. id = 43
+ */
+ static void yagl_func_glTexSubImage2D(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLint level;
+ GLint xoffset;
+ GLint yoffset;
+ GLsizei width;
+ GLsizei height;
+ GLenum format;
+ GLenum type;
+ const GLvoid *pixels;
+ int32_t pixels_count;
+ target = yagl_transport_get_out_GLenum(t);
+ level = yagl_transport_get_out_GLint(t);
+ xoffset = yagl_transport_get_out_GLint(t);
+ yoffset = yagl_transport_get_out_GLint(t);
+ width = yagl_transport_get_out_GLsizei(t);
+ height = yagl_transport_get_out_GLsizei(t);
+ format = yagl_transport_get_out_GLenum(t);
+ type = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT9(glTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void*, target, level, xoffset, yoffset, width, height, format, type, pixels);
+ (void)yagl_host_glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels, pixels_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glTexEnvi dispatcher. id = 38
++ * glClientActiveTexture dispatcher. id = 44
+ */
+ static void yagl_func_glClientActiveTexture(struct yagl_transport *t)
+ {
+ GLenum texture;
+ texture = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glClientActiveTexture, GLenum, texture);
+ (void)yagl_host_glClientActiveTexture(texture);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glTexEnvf dispatcher. id = 39
++ * glTexEnvi dispatcher. id = 45
+ */
+ static void yagl_func_glTexEnvi(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLenum pname;
+ GLint param;
+ target = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ param = yagl_transport_get_out_GLint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnvi, GLenum, GLenum, GLint, target, pname, param);
+ (void)yagl_host_glTexEnvi(target, pname, param);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glMultiTexCoord4f dispatcher. id = 40
++ * glTexEnvf dispatcher. id = 46
+ */
+ static void yagl_func_glTexEnvf(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLenum pname;
+ GLfloat param;
+ target = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ param = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnvf, GLenum, GLenum, GLfloat, target, pname, param);
+ (void)yagl_host_glTexEnvf(target, pname, param);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glTexEnviv dispatcher. id = 41
++ * glMultiTexCoord4f dispatcher. id = 47
+ */
+ static void yagl_func_glMultiTexCoord4f(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLfloat s;
+ GLfloat tt;
+ GLfloat r;
+ GLfloat q;
+ target = yagl_transport_get_out_GLenum(t);
+ s = yagl_transport_get_out_GLfloat(t);
+ tt = yagl_transport_get_out_GLfloat(t);
+ r = yagl_transport_get_out_GLfloat(t);
+ q = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glMultiTexCoord4f, GLenum, GLfloat, GLfloat, GLfloat, GLfloat, target, s, tt, r, q);
+ (void)yagl_host_glMultiTexCoord4f(target, s, tt, r, q);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glTexEnvfv dispatcher. id = 42
++ * glTexEnviv dispatcher. id = 48
+ */
+ static void yagl_func_glTexEnviv(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLenum pname;
+ const GLint *params;
+ int32_t params_count;
+ target = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_out_array(t, sizeof(GLint), (const void**)¶ms, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnviv, GLenum, GLenum, void*, target, pname, params);
+ (void)yagl_host_glTexEnviv(target, pname, params, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetTexEnviv dispatcher. id = 43
++ * glTexEnvfv dispatcher. id = 49
+ */
+ static void yagl_func_glTexEnvfv(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLenum pname;
+ const GLfloat *params;
+ int32_t params_count;
+ target = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnvfv, GLenum, GLenum, void*, target, pname, params);
+ (void)yagl_host_glTexEnvfv(target, pname, params, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetTexEnvfv dispatcher. id = 44
++ * glGetTexEnviv dispatcher. id = 50
+ */
+ static void yagl_func_glGetTexEnviv(struct yagl_transport *t)
+ {
+ GLenum env;
+ GLenum pname;
+ GLint *params;
+ int32_t params_maxcount;
+ int32_t *params_count;
+ env = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexEnviv, GLenum, GLenum, void*, env, pname, params);
+ *params_count = 0;
+ (void)yagl_host_glGetTexEnviv(env, pname, params, params_maxcount, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGenFramebuffers dispatcher. id = 45
++ * glGetTexEnvfv dispatcher. id = 51
+ */
+ static void yagl_func_glGetTexEnvfv(struct yagl_transport *t)
+ {
+ GLenum env;
+ GLenum pname;
+ GLfloat *params;
+ int32_t params_maxcount;
+ int32_t *params_count;
+ env = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexEnvfv, GLenum, GLenum, void*, env, pname, params);
+ *params_count = 0;
+ (void)yagl_host_glGetTexEnvfv(env, pname, params, params_maxcount, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glBindFramebuffer dispatcher. id = 46
++ * glGenFramebuffers dispatcher. id = 52
+ */
+ static void yagl_func_glGenFramebuffers(struct yagl_transport *t)
+ {
+ const GLuint *framebuffers;
+ int32_t framebuffers_count;
+ yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&framebuffers, &framebuffers_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glGenFramebuffers, void*, framebuffers);
+ (void)yagl_host_glGenFramebuffers(framebuffers, framebuffers_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glFramebufferTexture2D dispatcher. id = 47
++ * glBindFramebuffer dispatcher. id = 53
+ */
+ static void yagl_func_glBindFramebuffer(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLuint framebuffer;
+ target = yagl_transport_get_out_GLenum(t);
+ framebuffer = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glBindFramebuffer, GLenum, GLuint, target, framebuffer);
+ (void)yagl_host_glBindFramebuffer(target, framebuffer);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glFramebufferRenderbuffer dispatcher. id = 48
++ * glFramebufferTexture2D dispatcher. id = 54
+ */
+ static void yagl_func_glFramebufferTexture2D(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLenum attachment;
+ GLenum textarget;
+ GLuint texture;
+ GLint level;
+ target = yagl_transport_get_out_GLenum(t);
+ attachment = yagl_transport_get_out_GLenum(t);
+ textarget = yagl_transport_get_out_GLenum(t);
+ texture = yagl_transport_get_out_GLuint(t);
+ level = yagl_transport_get_out_GLint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glFramebufferTexture2D, GLenum, GLenum, GLenum, GLuint, GLint, target, attachment, textarget, texture, level);
+ (void)yagl_host_glFramebufferTexture2D(target, attachment, textarget, texture, level);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGenRenderbuffers dispatcher. id = 49
++ * glFramebufferRenderbuffer dispatcher. id = 55
+ */
+ static void yagl_func_glFramebufferRenderbuffer(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLenum attachment;
+ GLenum renderbuffertarget;
+ GLuint renderbuffer;
+ target = yagl_transport_get_out_GLenum(t);
+ attachment = yagl_transport_get_out_GLenum(t);
+ renderbuffertarget = yagl_transport_get_out_GLenum(t);
+ renderbuffer = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glFramebufferRenderbuffer, GLenum, GLenum, GLenum, GLuint, target, attachment, renderbuffertarget, renderbuffer);
+ (void)yagl_host_glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glBindRenderbuffer dispatcher. id = 50
++ * glBlitFramebuffer dispatcher. id = 56
++ */
++static void yagl_func_glBlitFramebuffer(struct yagl_transport *t)
++{
++ GLint srcX0;
++ GLint srcY0;
++ GLint srcX1;
++ GLint srcY1;
++ GLint dstX0;
++ GLint dstY0;
++ GLint dstX1;
++ GLint dstY1;
++ GLbitfield mask;
++ GLenum filter;
++ srcX0 = yagl_transport_get_out_GLint(t);
++ srcY0 = yagl_transport_get_out_GLint(t);
++ srcX1 = yagl_transport_get_out_GLint(t);
++ srcY1 = yagl_transport_get_out_GLint(t);
++ dstX0 = yagl_transport_get_out_GLint(t);
++ dstY0 = yagl_transport_get_out_GLint(t);
++ dstX1 = yagl_transport_get_out_GLint(t);
++ dstY1 = yagl_transport_get_out_GLint(t);
++ mask = yagl_transport_get_out_GLbitfield(t);
++ filter = yagl_transport_get_out_GLenum(t);
++ YAGL_LOG_FUNC_ENTER_SPLIT10(glBlitFramebuffer, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
++ (void)yagl_host_glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glDrawBuffers dispatcher. id = 57
++ */
++static void yagl_func_glDrawBuffers(struct yagl_transport *t)
++{
++ const GLenum *bufs;
++ int32_t bufs_count;
++ yagl_transport_get_out_array(t, sizeof(GLenum), (const void**)&bufs, &bufs_count);
++ YAGL_LOG_FUNC_ENTER_SPLIT1(glDrawBuffers, void*, bufs);
++ (void)yagl_host_glDrawBuffers(bufs, bufs_count);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glGenRenderbuffers dispatcher. id = 58
+ */
+ static void yagl_func_glGenRenderbuffers(struct yagl_transport *t)
+ {
+ const GLuint *renderbuffers;
+ int32_t renderbuffers_count;
+ yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&renderbuffers, &renderbuffers_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glGenRenderbuffers, void*, renderbuffers);
+ (void)yagl_host_glGenRenderbuffers(renderbuffers, renderbuffers_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glRenderbufferStorage dispatcher. id = 51
++ * glBindRenderbuffer dispatcher. id = 59
+ */
+ static void yagl_func_glBindRenderbuffer(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLuint renderbuffer;
+ target = yagl_transport_get_out_GLenum(t);
+ renderbuffer = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glBindRenderbuffer, GLenum, GLuint, target, renderbuffer);
+ (void)yagl_host_glBindRenderbuffer(target, renderbuffer);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetRenderbufferParameteriv dispatcher. id = 52
++ * glRenderbufferStorage dispatcher. id = 60
+ */
+ static void yagl_func_glRenderbufferStorage(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLenum internalformat;
+ GLsizei width;
+ GLsizei height;
+ target = yagl_transport_get_out_GLenum(t);
+ internalformat = yagl_transport_get_out_GLenum(t);
+ width = yagl_transport_get_out_GLsizei(t);
+ height = yagl_transport_get_out_GLsizei(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glRenderbufferStorage, GLenum, GLenum, GLsizei, GLsizei, target, internalformat, width, height);
+ (void)yagl_host_glRenderbufferStorage(target, internalformat, width, height);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glCreateProgram dispatcher. id = 53
++ * glGetRenderbufferParameteriv dispatcher. id = 61
+ */
+ static void yagl_func_glGetRenderbufferParameteriv(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLenum pname;
+ GLint *param;
+ target = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_arg(t, (void**)¶m);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetRenderbufferParameteriv, GLenum, GLenum, void*, target, pname, param);
+ (void)yagl_host_glGetRenderbufferParameteriv(target, pname, param);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glCreateShader dispatcher. id = 54
++ * glCreateProgram dispatcher. id = 62
+ */
+ static void yagl_func_glCreateProgram(struct yagl_transport *t)
+ {
+ GLuint program;
+ program = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glCreateProgram, GLuint, program);
+ (void)yagl_host_glCreateProgram(program);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glShaderSource dispatcher. id = 55
++ * glCreateShader dispatcher. id = 63
+ */
+ static void yagl_func_glCreateShader(struct yagl_transport *t)
+ {
+ GLuint shader;
+ GLenum type;
+ shader = yagl_transport_get_out_GLuint(t);
+ type = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glCreateShader, GLuint, GLenum, shader, type);
+ (void)yagl_host_glCreateShader(shader, type);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glAttachShader dispatcher. id = 56
++ * glShaderSource dispatcher. id = 64
+ */
+ static void yagl_func_glShaderSource(struct yagl_transport *t)
+ {
+ GLuint shader;
+ const GLchar *string;
+ int32_t string_count;
+ shader = yagl_transport_get_out_GLuint(t);
+ yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&string, &string_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glShaderSource, GLuint, void*, shader, string);
+ (void)yagl_host_glShaderSource(shader, string, string_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glDetachShader dispatcher. id = 57
++ * glAttachShader dispatcher. id = 65
+ */
+ static void yagl_func_glAttachShader(struct yagl_transport *t)
+ {
+ GLuint program;
+ GLuint shader;
+ program = yagl_transport_get_out_GLuint(t);
+ shader = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glAttachShader, GLuint, GLuint, program, shader);
+ (void)yagl_host_glAttachShader(program, shader);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glCompileShader dispatcher. id = 58
++ * glDetachShader dispatcher. id = 66
+ */
+ static void yagl_func_glDetachShader(struct yagl_transport *t)
+ {
+ GLuint program;
+ GLuint shader;
+ program = yagl_transport_get_out_GLuint(t);
+ shader = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glDetachShader, GLuint, GLuint, program, shader);
+ (void)yagl_host_glDetachShader(program, shader);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glBindAttribLocation dispatcher. id = 59
++ * glCompileShader dispatcher. id = 67
+ */
+ static void yagl_func_glCompileShader(struct yagl_transport *t)
+ {
+ GLuint shader;
+ shader = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glCompileShader, GLuint, shader);
+ (void)yagl_host_glCompileShader(shader);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetActiveAttrib dispatcher. id = 60
++ * glBindAttribLocation dispatcher. id = 68
+ */
+ static void yagl_func_glBindAttribLocation(struct yagl_transport *t)
+ {
+ GLuint program;
+ GLuint index;
+ const GLchar *name;
+ int32_t name_count;
+ program = yagl_transport_get_out_GLuint(t);
+ index = yagl_transport_get_out_GLuint(t);
+ yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glBindAttribLocation, GLuint, GLuint, void*, program, index, name);
+ (void)yagl_host_glBindAttribLocation(program, index, name, name_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- GLboolean *retval;
++ * glGetActiveAttrib dispatcher. id = 69
+ */
+ static void yagl_func_glGetActiveAttrib(struct yagl_transport *t)
+ {
+ GLuint program;
+ GLuint index;
+ GLint *size;
+ GLenum *type;
+ GLchar *name;
+ int32_t name_maxcount;
+ int32_t *name_count;
- yagl_transport_get_in_arg(t, (void**)&retval);
+ program = yagl_transport_get_out_GLuint(t);
+ index = yagl_transport_get_out_GLuint(t);
+ yagl_transport_get_in_arg(t, (void**)&size);
+ yagl_transport_get_in_arg(t, (void**)&type);
+ yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&name, &name_maxcount, &name_count);
- *retval = yagl_host_glGetActiveAttrib(program, index, size, type, name, name_maxcount, name_count);
- YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval);
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glGetActiveAttrib, GLuint, GLuint, void*, void*, void*, program, index, size, type, name);
+ *name_count = 0;
- * glGetActiveUniform dispatcher. id = 61
++ (void)yagl_host_glGetActiveAttrib(program, index, size, type, name, name_maxcount, name_count);
++ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- GLboolean *retval;
++ * glGetActiveUniform dispatcher. id = 70
+ */
+ static void yagl_func_glGetActiveUniform(struct yagl_transport *t)
+ {
+ GLuint program;
+ GLuint index;
+ GLint *size;
+ GLenum *type;
+ GLchar *name;
+ int32_t name_maxcount;
+ int32_t *name_count;
- yagl_transport_get_in_arg(t, (void**)&retval);
+ program = yagl_transport_get_out_GLuint(t);
+ index = yagl_transport_get_out_GLuint(t);
+ yagl_transport_get_in_arg(t, (void**)&size);
+ yagl_transport_get_in_arg(t, (void**)&type);
+ yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&name, &name_maxcount, &name_count);
- *retval = yagl_host_glGetActiveUniform(program, index, size, type, name, name_maxcount, name_count);
- YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval);
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glGetActiveUniform, GLuint, GLuint, void*, void*, void*, program, index, size, type, name);
+ *name_count = 0;
- * glGetAttribLocation dispatcher. id = 62
++ (void)yagl_host_glGetActiveUniform(program, index, size, type, name, name_maxcount, name_count);
++ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetProgramiv dispatcher. id = 63
++ * glGetAttribLocation dispatcher. id = 71
+ */
+ static void yagl_func_glGetAttribLocation(struct yagl_transport *t)
+ {
+ GLuint program;
+ const GLchar *name;
+ int32_t name_count;
+ int *retval;
+ program = yagl_transport_get_out_GLuint(t);
+ yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count);
+ yagl_transport_get_in_arg(t, (void**)&retval);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetAttribLocation, GLuint, void*, program, name);
+ *retval = yagl_host_glGetAttribLocation(program, name, name_count);
+ YAGL_LOG_FUNC_EXIT_SPLIT(int, *retval);
+ }
+
+ /*
- * glGetProgramInfoLog dispatcher. id = 64
++ * glGetProgramiv dispatcher. id = 72
+ */
+ static void yagl_func_glGetProgramiv(struct yagl_transport *t)
+ {
+ GLuint program;
+ GLenum pname;
+ GLint *param;
+ program = yagl_transport_get_out_GLuint(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_arg(t, (void**)¶m);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetProgramiv, GLuint, GLenum, void*, program, pname, param);
+ (void)yagl_host_glGetProgramiv(program, pname, param);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetShaderiv dispatcher. id = 65
++ * glGetProgramInfoLog dispatcher. id = 73
+ */
+ static void yagl_func_glGetProgramInfoLog(struct yagl_transport *t)
+ {
+ GLuint program;
+ GLchar *infolog;
+ int32_t infolog_maxcount;
+ int32_t *infolog_count;
+ GLboolean *retval;
+ program = yagl_transport_get_out_GLuint(t);
+ yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&infolog, &infolog_maxcount, &infolog_count);
+ yagl_transport_get_in_arg(t, (void**)&retval);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetProgramInfoLog, GLuint, void*, program, infolog);
+ *infolog_count = 0;
+ *retval = yagl_host_glGetProgramInfoLog(program, infolog, infolog_maxcount, infolog_count);
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval);
+ }
+
+ /*
- * glGetShaderInfoLog dispatcher. id = 66
++ * glGetShaderiv dispatcher. id = 74
+ */
+ static void yagl_func_glGetShaderiv(struct yagl_transport *t)
+ {
+ GLuint shader;
+ GLenum pname;
+ GLint *param;
+ shader = yagl_transport_get_out_GLuint(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_arg(t, (void**)¶m);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetShaderiv, GLuint, GLenum, void*, shader, pname, param);
+ (void)yagl_host_glGetShaderiv(shader, pname, param);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetUniformfv dispatcher. id = 67
++ * glGetShaderInfoLog dispatcher. id = 75
+ */
+ static void yagl_func_glGetShaderInfoLog(struct yagl_transport *t)
+ {
+ GLuint shader;
+ GLchar *infolog;
+ int32_t infolog_maxcount;
+ int32_t *infolog_count;
+ GLboolean *retval;
+ shader = yagl_transport_get_out_GLuint(t);
+ yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&infolog, &infolog_maxcount, &infolog_count);
+ yagl_transport_get_in_arg(t, (void**)&retval);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetShaderInfoLog, GLuint, void*, shader, infolog);
+ *infolog_count = 0;
+ *retval = yagl_host_glGetShaderInfoLog(shader, infolog, infolog_maxcount, infolog_count);
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval);
+ }
+
+ /*
- * glGetUniformiv dispatcher. id = 68
++ * glGetUniformfv dispatcher. id = 76
+ */
+ static void yagl_func_glGetUniformfv(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ GLuint program;
+ uint32_t location;
+ GLfloat *params;
+ int32_t params_maxcount;
+ int32_t *params_count;
+ tl = yagl_transport_get_out_GLboolean(t);
+ program = yagl_transport_get_out_GLuint(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glGetUniformfv, GLboolean, GLuint, uint32_t, void*, tl, program, location, params);
+ *params_count = 0;
+ (void)yagl_host_glGetUniformfv(tl, program, location, params, params_maxcount, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetUniformLocation dispatcher. id = 69
++ * glGetUniformiv dispatcher. id = 77
+ */
+ static void yagl_func_glGetUniformiv(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ GLuint program;
+ uint32_t location;
+ GLint *params;
+ int32_t params_maxcount;
+ int32_t *params_count;
+ tl = yagl_transport_get_out_GLboolean(t);
+ program = yagl_transport_get_out_GLuint(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glGetUniformiv, GLboolean, GLuint, uint32_t, void*, tl, program, location, params);
+ *params_count = 0;
+ (void)yagl_host_glGetUniformiv(tl, program, location, params, params_maxcount, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetVertexAttribfv dispatcher. id = 70
++ * glGetUniformLocation dispatcher. id = 78
+ */
+ static void yagl_func_glGetUniformLocation(struct yagl_transport *t)
+ {
+ GLuint program;
+ const GLchar *name;
+ int32_t name_count;
+ int *retval;
+ program = yagl_transport_get_out_GLuint(t);
+ yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count);
+ yagl_transport_get_in_arg(t, (void**)&retval);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetUniformLocation, GLuint, void*, program, name);
+ *retval = yagl_host_glGetUniformLocation(program, name, name_count);
+ YAGL_LOG_FUNC_EXIT_SPLIT(int, *retval);
+ }
+
+ /*
- * glGetVertexAttribiv dispatcher. id = 71
++ * glGetVertexAttribfv dispatcher. id = 79
+ */
+ static void yagl_func_glGetVertexAttribfv(struct yagl_transport *t)
+ {
+ GLuint index;
+ GLenum pname;
+ GLfloat *params;
+ int32_t params_maxcount;
+ int32_t *params_count;
+ index = yagl_transport_get_out_GLuint(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetVertexAttribfv, GLuint, GLenum, void*, index, pname, params);
+ *params_count = 0;
+ (void)yagl_host_glGetVertexAttribfv(index, pname, params, params_maxcount, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glLinkProgram dispatcher. id = 72
++ * glGetVertexAttribiv dispatcher. id = 80
+ */
+ static void yagl_func_glGetVertexAttribiv(struct yagl_transport *t)
+ {
+ GLuint index;
+ GLenum pname;
+ GLint *params;
+ int32_t params_maxcount;
+ int32_t *params_count;
+ index = yagl_transport_get_out_GLuint(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetVertexAttribiv, GLuint, GLenum, void*, index, pname, params);
+ *params_count = 0;
+ (void)yagl_host_glGetVertexAttribiv(index, pname, params, params_maxcount, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- YAGL_LOG_FUNC_ENTER_SPLIT1(glLinkProgram, GLuint, program);
- (void)yagl_host_glLinkProgram(program);
++ * glLinkProgram dispatcher. id = 81
+ */
+ static void yagl_func_glLinkProgram(struct yagl_transport *t)
+ {
+ GLuint program;
++ GLint *params;
++ int32_t params_maxcount;
++ int32_t *params_count;
+ program = yagl_transport_get_out_GLuint(t);
- * glUniform1f dispatcher. id = 73
++ yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count);
++ YAGL_LOG_FUNC_ENTER_SPLIT2(glLinkProgram, GLuint, void*, program, params);
++ *params_count = 0;
++ (void)yagl_host_glLinkProgram(program, params, params_maxcount, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniform1fv dispatcher. id = 74
++ * glUniform1f dispatcher. id = 82
+ */
+ static void yagl_func_glUniform1f(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ GLfloat x;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ x = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform1f, GLboolean, uint32_t, GLfloat, tl, location, x);
+ (void)yagl_host_glUniform1f(tl, location, x);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniform1i dispatcher. id = 75
++ * glUniform1fv dispatcher. id = 83
+ */
+ static void yagl_func_glUniform1fv(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ const GLfloat *v;
+ int32_t v_count;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform1fv, GLboolean, uint32_t, void*, tl, location, v);
+ (void)yagl_host_glUniform1fv(tl, location, v, v_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniform1iv dispatcher. id = 76
++ * glUniform1i dispatcher. id = 84
+ */
+ static void yagl_func_glUniform1i(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ GLint x;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ x = yagl_transport_get_out_GLint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform1i, GLboolean, uint32_t, GLint, tl, location, x);
+ (void)yagl_host_glUniform1i(tl, location, x);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniform2f dispatcher. id = 77
++ * glUniform1iv dispatcher. id = 85
+ */
+ static void yagl_func_glUniform1iv(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ const GLint *v;
+ int32_t v_count;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform1iv, GLboolean, uint32_t, void*, tl, location, v);
+ (void)yagl_host_glUniform1iv(tl, location, v, v_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniform2fv dispatcher. id = 78
++ * glUniform2f dispatcher. id = 86
+ */
+ static void yagl_func_glUniform2f(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ GLfloat x;
+ GLfloat y;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ x = yagl_transport_get_out_GLfloat(t);
+ y = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniform2f, GLboolean, uint32_t, GLfloat, GLfloat, tl, location, x, y);
+ (void)yagl_host_glUniform2f(tl, location, x, y);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniform2i dispatcher. id = 79
++ * glUniform2fv dispatcher. id = 87
+ */
+ static void yagl_func_glUniform2fv(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ const GLfloat *v;
+ int32_t v_count;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform2fv, GLboolean, uint32_t, void*, tl, location, v);
+ (void)yagl_host_glUniform2fv(tl, location, v, v_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniform2iv dispatcher. id = 80
++ * glUniform2i dispatcher. id = 88
+ */
+ static void yagl_func_glUniform2i(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ GLint x;
+ GLint y;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ x = yagl_transport_get_out_GLint(t);
+ y = yagl_transport_get_out_GLint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniform2i, GLboolean, uint32_t, GLint, GLint, tl, location, x, y);
+ (void)yagl_host_glUniform2i(tl, location, x, y);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniform3f dispatcher. id = 81
++ * glUniform2iv dispatcher. id = 89
+ */
+ static void yagl_func_glUniform2iv(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ const GLint *v;
+ int32_t v_count;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform2iv, GLboolean, uint32_t, void*, tl, location, v);
+ (void)yagl_host_glUniform2iv(tl, location, v, v_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniform3fv dispatcher. id = 82
++ * glUniform3f dispatcher. id = 90
+ */
+ static void yagl_func_glUniform3f(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ GLfloat x;
+ GLfloat y;
+ GLfloat z;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ x = yagl_transport_get_out_GLfloat(t);
+ y = yagl_transport_get_out_GLfloat(t);
+ z = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glUniform3f, GLboolean, uint32_t, GLfloat, GLfloat, GLfloat, tl, location, x, y, z);
+ (void)yagl_host_glUniform3f(tl, location, x, y, z);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniform3i dispatcher. id = 83
++ * glUniform3fv dispatcher. id = 91
+ */
+ static void yagl_func_glUniform3fv(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ const GLfloat *v;
+ int32_t v_count;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform3fv, GLboolean, uint32_t, void*, tl, location, v);
+ (void)yagl_host_glUniform3fv(tl, location, v, v_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniform3iv dispatcher. id = 84
++ * glUniform3i dispatcher. id = 92
+ */
+ static void yagl_func_glUniform3i(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ GLint x;
+ GLint y;
+ GLint z;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ x = yagl_transport_get_out_GLint(t);
+ y = yagl_transport_get_out_GLint(t);
+ z = yagl_transport_get_out_GLint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glUniform3i, GLboolean, uint32_t, GLint, GLint, GLint, tl, location, x, y, z);
+ (void)yagl_host_glUniform3i(tl, location, x, y, z);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniform4f dispatcher. id = 85
++ * glUniform3iv dispatcher. id = 93
+ */
+ static void yagl_func_glUniform3iv(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ const GLint *v;
+ int32_t v_count;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform3iv, GLboolean, uint32_t, void*, tl, location, v);
+ (void)yagl_host_glUniform3iv(tl, location, v, v_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniform4fv dispatcher. id = 86
++ * glUniform4f dispatcher. id = 94
+ */
+ static void yagl_func_glUniform4f(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ GLfloat x;
+ GLfloat y;
+ GLfloat z;
+ GLfloat w;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ x = yagl_transport_get_out_GLfloat(t);
+ y = yagl_transport_get_out_GLfloat(t);
+ z = yagl_transport_get_out_GLfloat(t);
+ w = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT6(glUniform4f, GLboolean, uint32_t, GLfloat, GLfloat, GLfloat, GLfloat, tl, location, x, y, z, w);
+ (void)yagl_host_glUniform4f(tl, location, x, y, z, w);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniform4i dispatcher. id = 87
++ * glUniform4fv dispatcher. id = 95
+ */
+ static void yagl_func_glUniform4fv(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ const GLfloat *v;
+ int32_t v_count;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform4fv, GLboolean, uint32_t, void*, tl, location, v);
+ (void)yagl_host_glUniform4fv(tl, location, v, v_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniform4iv dispatcher. id = 88
++ * glUniform4i dispatcher. id = 96
+ */
+ static void yagl_func_glUniform4i(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ GLint x;
+ GLint y;
+ GLint z;
+ GLint w;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ x = yagl_transport_get_out_GLint(t);
+ y = yagl_transport_get_out_GLint(t);
+ z = yagl_transport_get_out_GLint(t);
+ w = yagl_transport_get_out_GLint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT6(glUniform4i, GLboolean, uint32_t, GLint, GLint, GLint, GLint, tl, location, x, y, z, w);
+ (void)yagl_host_glUniform4i(tl, location, x, y, z, w);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniformMatrix2fv dispatcher. id = 89
++ * glUniform4iv dispatcher. id = 97
+ */
+ static void yagl_func_glUniform4iv(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ const GLint *v;
+ int32_t v_count;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform4iv, GLboolean, uint32_t, void*, tl, location, v);
+ (void)yagl_host_glUniform4iv(tl, location, v, v_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniformMatrix3fv dispatcher. id = 90
++ * glUniformMatrix2fv dispatcher. id = 98
+ */
+ static void yagl_func_glUniformMatrix2fv(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ GLboolean transpose;
+ const GLfloat *value;
+ int32_t value_count;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ transpose = yagl_transport_get_out_GLboolean(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix2fv, GLboolean, uint32_t, GLboolean, void*, tl, location, transpose, value);
+ (void)yagl_host_glUniformMatrix2fv(tl, location, transpose, value, value_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUniformMatrix4fv dispatcher. id = 91
++ * glUniformMatrix3fv dispatcher. id = 99
+ */
+ static void yagl_func_glUniformMatrix3fv(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ GLboolean transpose;
+ const GLfloat *value;
+ int32_t value_count;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ transpose = yagl_transport_get_out_GLboolean(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix3fv, GLboolean, uint32_t, GLboolean, void*, tl, location, transpose, value);
+ (void)yagl_host_glUniformMatrix3fv(tl, location, transpose, value, value_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUseProgram dispatcher. id = 92
++ * glUniformMatrix4fv dispatcher. id = 100
+ */
+ static void yagl_func_glUniformMatrix4fv(struct yagl_transport *t)
+ {
+ GLboolean tl;
+ uint32_t location;
+ GLboolean transpose;
+ const GLfloat *value;
+ int32_t value_count;
+ tl = yagl_transport_get_out_GLboolean(t);
+ location = yagl_transport_get_out_uint32_t(t);
+ transpose = yagl_transport_get_out_GLboolean(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix4fv, GLboolean, uint32_t, GLboolean, void*, tl, location, transpose, value);
+ (void)yagl_host_glUniformMatrix4fv(tl, location, transpose, value, value_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glValidateProgram dispatcher. id = 93
++ * glUseProgram dispatcher. id = 101
+ */
+ static void yagl_func_glUseProgram(struct yagl_transport *t)
+ {
+ GLuint program;
+ program = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glUseProgram, GLuint, program);
+ (void)yagl_host_glUseProgram(program);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glVertexAttrib1f dispatcher. id = 94
++ * glValidateProgram dispatcher. id = 102
+ */
+ static void yagl_func_glValidateProgram(struct yagl_transport *t)
+ {
+ GLuint program;
+ program = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glValidateProgram, GLuint, program);
+ (void)yagl_host_glValidateProgram(program);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glVertexAttrib1fv dispatcher. id = 95
++ * glVertexAttrib1f dispatcher. id = 103
+ */
+ static void yagl_func_glVertexAttrib1f(struct yagl_transport *t)
+ {
+ GLuint indx;
+ GLfloat x;
+ indx = yagl_transport_get_out_GLuint(t);
+ x = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib1f, GLuint, GLfloat, indx, x);
+ (void)yagl_host_glVertexAttrib1f(indx, x);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glVertexAttrib2f dispatcher. id = 96
++ * glVertexAttrib1fv dispatcher. id = 104
+ */
+ static void yagl_func_glVertexAttrib1fv(struct yagl_transport *t)
+ {
+ GLuint indx;
+ const GLfloat *values;
+ int32_t values_count;
+ indx = yagl_transport_get_out_GLuint(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib1fv, GLuint, void*, indx, values);
+ (void)yagl_host_glVertexAttrib1fv(indx, values, values_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glVertexAttrib2fv dispatcher. id = 97
++ * glVertexAttrib2f dispatcher. id = 105
+ */
+ static void yagl_func_glVertexAttrib2f(struct yagl_transport *t)
+ {
+ GLuint indx;
+ GLfloat x;
+ GLfloat y;
+ indx = yagl_transport_get_out_GLuint(t);
+ x = yagl_transport_get_out_GLfloat(t);
+ y = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glVertexAttrib2f, GLuint, GLfloat, GLfloat, indx, x, y);
+ (void)yagl_host_glVertexAttrib2f(indx, x, y);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glVertexAttrib3f dispatcher. id = 98
++ * glVertexAttrib2fv dispatcher. id = 106
+ */
+ static void yagl_func_glVertexAttrib2fv(struct yagl_transport *t)
+ {
+ GLuint indx;
+ const GLfloat *values;
+ int32_t values_count;
+ indx = yagl_transport_get_out_GLuint(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib2fv, GLuint, void*, indx, values);
+ (void)yagl_host_glVertexAttrib2fv(indx, values, values_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glVertexAttrib3fv dispatcher. id = 99
++ * glVertexAttrib3f dispatcher. id = 107
+ */
+ static void yagl_func_glVertexAttrib3f(struct yagl_transport *t)
+ {
+ GLuint indx;
+ GLfloat x;
+ GLfloat y;
+ GLfloat z;
+ indx = yagl_transport_get_out_GLuint(t);
+ x = yagl_transport_get_out_GLfloat(t);
+ y = yagl_transport_get_out_GLfloat(t);
+ z = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glVertexAttrib3f, GLuint, GLfloat, GLfloat, GLfloat, indx, x, y, z);
+ (void)yagl_host_glVertexAttrib3f(indx, x, y, z);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glVertexAttrib4f dispatcher. id = 100
++ * glVertexAttrib3fv dispatcher. id = 108
+ */
+ static void yagl_func_glVertexAttrib3fv(struct yagl_transport *t)
+ {
+ GLuint indx;
+ const GLfloat *values;
+ int32_t values_count;
+ indx = yagl_transport_get_out_GLuint(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib3fv, GLuint, void*, indx, values);
+ (void)yagl_host_glVertexAttrib3fv(indx, values, values_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glVertexAttrib4fv dispatcher. id = 101
++ * glVertexAttrib4f dispatcher. id = 109
+ */
+ static void yagl_func_glVertexAttrib4f(struct yagl_transport *t)
+ {
+ GLuint indx;
+ GLfloat x;
+ GLfloat y;
+ GLfloat z;
+ GLfloat w;
+ indx = yagl_transport_get_out_GLuint(t);
+ x = yagl_transport_get_out_GLfloat(t);
+ y = yagl_transport_get_out_GLfloat(t);
+ z = yagl_transport_get_out_GLfloat(t);
+ w = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glVertexAttrib4f, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, indx, x, y, z, w);
+ (void)yagl_host_glVertexAttrib4f(indx, x, y, z, w);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetIntegerv dispatcher. id = 102
++ * glVertexAttrib4fv dispatcher. id = 110
+ */
+ static void yagl_func_glVertexAttrib4fv(struct yagl_transport *t)
+ {
+ GLuint indx;
+ const GLfloat *values;
+ int32_t values_count;
+ indx = yagl_transport_get_out_GLuint(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib4fv, GLuint, void*, indx, values);
+ (void)yagl_host_glVertexAttrib4fv(indx, values, values_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetFloatv dispatcher. id = 103
++ * glGetActiveUniformsiv dispatcher. id = 111
++ */
++static void yagl_func_glGetActiveUniformsiv(struct yagl_transport *t)
++{
++ GLuint program;
++ const GLuint *uniformIndices;
++ int32_t uniformIndices_count;
++ GLint *params;
++ int32_t params_maxcount;
++ int32_t *params_count;
++ program = yagl_transport_get_out_GLuint(t);
++ yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&uniformIndices, &uniformIndices_count);
++ yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count);
++ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetActiveUniformsiv, GLuint, void*, void*, program, uniformIndices, params);
++ *params_count = 0;
++ (void)yagl_host_glGetActiveUniformsiv(program, uniformIndices, uniformIndices_count, params, params_maxcount, params_count);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glGetUniformIndices dispatcher. id = 112
++ */
++static void yagl_func_glGetUniformIndices(struct yagl_transport *t)
++{
++ GLuint program;
++ const GLchar *uniformNames;
++ int32_t uniformNames_count;
++ GLuint *uniformIndices;
++ int32_t uniformIndices_maxcount;
++ int32_t *uniformIndices_count;
++ program = yagl_transport_get_out_GLuint(t);
++ yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&uniformNames, &uniformNames_count);
++ yagl_transport_get_in_array(t, sizeof(GLuint), (void**)&uniformIndices, &uniformIndices_maxcount, &uniformIndices_count);
++ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetUniformIndices, GLuint, void*, void*, program, uniformNames, uniformIndices);
++ *uniformIndices_count = 0;
++ (void)yagl_host_glGetUniformIndices(program, uniformNames, uniformNames_count, uniformIndices, uniformIndices_maxcount, uniformIndices_count);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glGetUniformBlockIndex dispatcher. id = 113
++ */
++static void yagl_func_glGetUniformBlockIndex(struct yagl_transport *t)
++{
++ GLuint program;
++ const GLchar *uniformBlockName;
++ int32_t uniformBlockName_count;
++ GLuint *retval;
++ program = yagl_transport_get_out_GLuint(t);
++ yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&uniformBlockName, &uniformBlockName_count);
++ yagl_transport_get_in_arg(t, (void**)&retval);
++ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetUniformBlockIndex, GLuint, void*, program, uniformBlockName);
++ *retval = yagl_host_glGetUniformBlockIndex(program, uniformBlockName, uniformBlockName_count);
++ YAGL_LOG_FUNC_EXIT_SPLIT(GLuint, *retval);
++}
++
++/*
++ * glUniformBlockBinding dispatcher. id = 114
++ */
++static void yagl_func_glUniformBlockBinding(struct yagl_transport *t)
++{
++ GLuint program;
++ GLuint uniformBlockIndex;
++ GLuint uniformBlockBinding;
++ program = yagl_transport_get_out_GLuint(t);
++ uniformBlockIndex = yagl_transport_get_out_GLuint(t);
++ uniformBlockBinding = yagl_transport_get_out_GLuint(t);
++ YAGL_LOG_FUNC_ENTER_SPLIT3(glUniformBlockBinding, GLuint, GLuint, GLuint, program, uniformBlockIndex, uniformBlockBinding);
++ (void)yagl_host_glUniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glGetActiveUniformBlockName dispatcher. id = 115
++ */
++static void yagl_func_glGetActiveUniformBlockName(struct yagl_transport *t)
++{
++ GLuint program;
++ GLuint uniformBlockIndex;
++ GLchar *uniformBlockName;
++ int32_t uniformBlockName_maxcount;
++ int32_t *uniformBlockName_count;
++ program = yagl_transport_get_out_GLuint(t);
++ uniformBlockIndex = yagl_transport_get_out_GLuint(t);
++ yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&uniformBlockName, &uniformBlockName_maxcount, &uniformBlockName_count);
++ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetActiveUniformBlockName, GLuint, GLuint, void*, program, uniformBlockIndex, uniformBlockName);
++ *uniformBlockName_count = 0;
++ (void)yagl_host_glGetActiveUniformBlockName(program, uniformBlockIndex, uniformBlockName, uniformBlockName_maxcount, uniformBlockName_count);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glGetActiveUniformBlockiv dispatcher. id = 116
++ */
++static void yagl_func_glGetActiveUniformBlockiv(struct yagl_transport *t)
++{
++ GLuint program;
++ GLuint uniformBlockIndex;
++ GLenum pname;
++ GLint *params;
++ int32_t params_maxcount;
++ int32_t *params_count;
++ program = yagl_transport_get_out_GLuint(t);
++ uniformBlockIndex = yagl_transport_get_out_GLuint(t);
++ pname = yagl_transport_get_out_GLenum(t);
++ yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count);
++ YAGL_LOG_FUNC_ENTER_SPLIT4(glGetActiveUniformBlockiv, GLuint, GLuint, GLenum, void*, program, uniformBlockIndex, pname, params);
++ *params_count = 0;
++ (void)yagl_host_glGetActiveUniformBlockiv(program, uniformBlockIndex, pname, params, params_maxcount, params_count);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glGetIntegerv dispatcher. id = 117
+ */
+ static void yagl_func_glGetIntegerv(struct yagl_transport *t)
+ {
+ GLenum pname;
+ GLint *params;
+ int32_t params_maxcount;
+ int32_t *params_count;
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetIntegerv, GLenum, void*, pname, params);
+ *params_count = 0;
+ (void)yagl_host_glGetIntegerv(pname, params, params_maxcount, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetString dispatcher. id = 104
++ * glGetFloatv dispatcher. id = 118
+ */
+ static void yagl_func_glGetFloatv(struct yagl_transport *t)
+ {
+ GLenum pname;
+ GLfloat *params;
+ int32_t params_maxcount;
+ int32_t *params_count;
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetFloatv, GLenum, void*, pname, params);
+ *params_count = 0;
+ (void)yagl_host_glGetFloatv(pname, params, params_maxcount, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glIsEnabled dispatcher. id = 105
++ * glGetString dispatcher. id = 119
+ */
+ static void yagl_func_glGetString(struct yagl_transport *t)
+ {
+ GLenum name;
+ GLchar *str;
+ int32_t str_maxcount;
+ int32_t *str_count;
+ name = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&str, &str_maxcount, &str_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetString, GLenum, void*, name, str);
+ *str_count = 0;
+ (void)yagl_host_glGetString(name, str, str_maxcount, str_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glDeleteObjects dispatcher. id = 106
++ * glIsEnabled dispatcher. id = 120
+ */
+ static void yagl_func_glIsEnabled(struct yagl_transport *t)
+ {
+ GLenum cap;
+ GLboolean *retval;
+ cap = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_arg(t, (void**)&retval);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glIsEnabled, GLenum, cap);
+ *retval = yagl_host_glIsEnabled(cap);
+ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval);
+ }
+
+ /*
- * glBlendEquation dispatcher. id = 107
++ * glGenTransformFeedbacks dispatcher. id = 121
++ */
++static void yagl_func_glGenTransformFeedbacks(struct yagl_transport *t)
++{
++ const GLuint *ids;
++ int32_t ids_count;
++ yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&ids, &ids_count);
++ YAGL_LOG_FUNC_ENTER_SPLIT1(glGenTransformFeedbacks, void*, ids);
++ (void)yagl_host_glGenTransformFeedbacks(ids, ids_count);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glBindTransformFeedback dispatcher. id = 122
++ */
++static void yagl_func_glBindTransformFeedback(struct yagl_transport *t)
++{
++ GLenum target;
++ GLuint id;
++ target = yagl_transport_get_out_GLenum(t);
++ id = yagl_transport_get_out_GLuint(t);
++ YAGL_LOG_FUNC_ENTER_SPLIT2(glBindTransformFeedback, GLenum, GLuint, target, id);
++ (void)yagl_host_glBindTransformFeedback(target, id);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glBeginTransformFeedback dispatcher. id = 123
++ */
++static void yagl_func_glBeginTransformFeedback(struct yagl_transport *t)
++{
++ GLenum primitiveMode;
++ primitiveMode = yagl_transport_get_out_GLenum(t);
++ YAGL_LOG_FUNC_ENTER_SPLIT1(glBeginTransformFeedback, GLenum, primitiveMode);
++ (void)yagl_host_glBeginTransformFeedback(primitiveMode);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glEndTransformFeedback dispatcher. id = 124
++ */
++static void yagl_func_glEndTransformFeedback(struct yagl_transport *t)
++{
++ YAGL_LOG_FUNC_ENTER_SPLIT0(glEndTransformFeedback);
++ (void)yagl_host_glEndTransformFeedback();
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glPauseTransformFeedback dispatcher. id = 125
++ */
++static void yagl_func_glPauseTransformFeedback(struct yagl_transport *t)
++{
++ YAGL_LOG_FUNC_ENTER_SPLIT0(glPauseTransformFeedback);
++ (void)yagl_host_glPauseTransformFeedback();
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glResumeTransformFeedback dispatcher. id = 126
++ */
++static void yagl_func_glResumeTransformFeedback(struct yagl_transport *t)
++{
++ YAGL_LOG_FUNC_ENTER_SPLIT0(glResumeTransformFeedback);
++ (void)yagl_host_glResumeTransformFeedback();
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glTransformFeedbackVaryings dispatcher. id = 127
++ */
++static void yagl_func_glTransformFeedbackVaryings(struct yagl_transport *t)
++{
++ GLuint program;
++ const GLchar *varyings;
++ int32_t varyings_count;
++ GLenum bufferMode;
++ program = yagl_transport_get_out_GLuint(t);
++ yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&varyings, &varyings_count);
++ bufferMode = yagl_transport_get_out_GLenum(t);
++ YAGL_LOG_FUNC_ENTER_SPLIT3(glTransformFeedbackVaryings, GLuint, void*, GLenum, program, varyings, bufferMode);
++ (void)yagl_host_glTransformFeedbackVaryings(program, varyings, varyings_count, bufferMode);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glGetTransformFeedbackVaryings dispatcher. id = 128
++ */
++static void yagl_func_glGetTransformFeedbackVaryings(struct yagl_transport *t)
++{
++ GLuint program;
++ GLsizei *sizes;
++ int32_t sizes_maxcount;
++ int32_t *sizes_count;
++ GLenum *types;
++ int32_t types_maxcount;
++ int32_t *types_count;
++ program = yagl_transport_get_out_GLuint(t);
++ yagl_transport_get_in_array(t, sizeof(GLsizei), (void**)&sizes, &sizes_maxcount, &sizes_count);
++ yagl_transport_get_in_array(t, sizeof(GLenum), (void**)&types, &types_maxcount, &types_count);
++ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTransformFeedbackVaryings, GLuint, void*, void*, program, sizes, types);
++ *sizes_count = 0;
++ *types_count = 0;
++ (void)yagl_host_glGetTransformFeedbackVaryings(program, sizes, sizes_maxcount, sizes_count, types, types_maxcount, types_count);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glGenQueries dispatcher. id = 129
++ */
++static void yagl_func_glGenQueries(struct yagl_transport *t)
++{
++ const GLuint *ids;
++ int32_t ids_count;
++ yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&ids, &ids_count);
++ YAGL_LOG_FUNC_ENTER_SPLIT1(glGenQueries, void*, ids);
++ (void)yagl_host_glGenQueries(ids, ids_count);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glBeginQuery dispatcher. id = 130
++ */
++static void yagl_func_glBeginQuery(struct yagl_transport *t)
++{
++ GLenum target;
++ GLuint id;
++ target = yagl_transport_get_out_GLenum(t);
++ id = yagl_transport_get_out_GLuint(t);
++ YAGL_LOG_FUNC_ENTER_SPLIT2(glBeginQuery, GLenum, GLuint, target, id);
++ (void)yagl_host_glBeginQuery(target, id);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glEndQuery dispatcher. id = 131
++ */
++static void yagl_func_glEndQuery(struct yagl_transport *t)
++{
++ GLenum target;
++ target = yagl_transport_get_out_GLenum(t);
++ YAGL_LOG_FUNC_ENTER_SPLIT1(glEndQuery, GLenum, target);
++ (void)yagl_host_glEndQuery(target);
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++/*
++ * glGetQueryObjectuiv dispatcher. id = 132
++ */
++static void yagl_func_glGetQueryObjectuiv(struct yagl_transport *t)
++{
++ GLuint id;
++ GLuint *result;
++ GLboolean *retval;
++ id = yagl_transport_get_out_GLuint(t);
++ yagl_transport_get_in_arg(t, (void**)&result);
++ yagl_transport_get_in_arg(t, (void**)&retval);
++ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetQueryObjectuiv, GLuint, void*, id, result);
++ *retval = yagl_host_glGetQueryObjectuiv(id, result);
++ YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval);
++}
++
++/*
++ * glDeleteObjects dispatcher. id = 133
+ */
+ static void yagl_func_glDeleteObjects(struct yagl_transport *t)
+ {
+ const GLuint *objects;
+ int32_t objects_count;
+ yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&objects, &objects_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteObjects, void*, objects);
+ (void)yagl_host_glDeleteObjects(objects, objects_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glBlendEquationSeparate dispatcher. id = 108
++ * glBlendEquation dispatcher. id = 134
+ */
+ static void yagl_func_glBlendEquation(struct yagl_transport *t)
+ {
+ GLenum mode;
+ mode = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glBlendEquation, GLenum, mode);
+ (void)yagl_host_glBlendEquation(mode);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glBlendFunc dispatcher. id = 109
++ * glBlendEquationSeparate dispatcher. id = 135
+ */
+ static void yagl_func_glBlendEquationSeparate(struct yagl_transport *t)
+ {
+ GLenum modeRGB;
+ GLenum modeAlpha;
+ modeRGB = yagl_transport_get_out_GLenum(t);
+ modeAlpha = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glBlendEquationSeparate, GLenum, GLenum, modeRGB, modeAlpha);
+ (void)yagl_host_glBlendEquationSeparate(modeRGB, modeAlpha);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glBlendFuncSeparate dispatcher. id = 110
++ * glBlendFunc dispatcher. id = 136
+ */
+ static void yagl_func_glBlendFunc(struct yagl_transport *t)
+ {
+ GLenum sfactor;
+ GLenum dfactor;
+ sfactor = yagl_transport_get_out_GLenum(t);
+ dfactor = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glBlendFunc, GLenum, GLenum, sfactor, dfactor);
+ (void)yagl_host_glBlendFunc(sfactor, dfactor);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glBlendColor dispatcher. id = 111
++ * glBlendFuncSeparate dispatcher. id = 137
+ */
+ static void yagl_func_glBlendFuncSeparate(struct yagl_transport *t)
+ {
+ GLenum srcRGB;
+ GLenum dstRGB;
+ GLenum srcAlpha;
+ GLenum dstAlpha;
+ srcRGB = yagl_transport_get_out_GLenum(t);
+ dstRGB = yagl_transport_get_out_GLenum(t);
+ srcAlpha = yagl_transport_get_out_GLenum(t);
+ dstAlpha = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glBlendFuncSeparate, GLenum, GLenum, GLenum, GLenum, srcRGB, dstRGB, srcAlpha, dstAlpha);
+ (void)yagl_host_glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glClear dispatcher. id = 112
++ * glBlendColor dispatcher. id = 138
+ */
+ static void yagl_func_glBlendColor(struct yagl_transport *t)
+ {
+ GLclampf red;
+ GLclampf green;
+ GLclampf blue;
+ GLclampf alpha;
+ red = yagl_transport_get_out_GLclampf(t);
+ green = yagl_transport_get_out_GLclampf(t);
+ blue = yagl_transport_get_out_GLclampf(t);
+ alpha = yagl_transport_get_out_GLclampf(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glBlendColor, GLclampf, GLclampf, GLclampf, GLclampf, red, green, blue, alpha);
+ (void)yagl_host_glBlendColor(red, green, blue, alpha);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glClearColor dispatcher. id = 113
++ * glClear dispatcher. id = 139
+ */
+ static void yagl_func_glClear(struct yagl_transport *t)
+ {
+ GLbitfield mask;
+ mask = yagl_transport_get_out_GLbitfield(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glClear, GLbitfield, mask);
+ (void)yagl_host_glClear(mask);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glClearDepthf dispatcher. id = 114
++ * glClearColor dispatcher. id = 140
+ */
+ static void yagl_func_glClearColor(struct yagl_transport *t)
+ {
+ GLclampf red;
+ GLclampf green;
+ GLclampf blue;
+ GLclampf alpha;
+ red = yagl_transport_get_out_GLclampf(t);
+ green = yagl_transport_get_out_GLclampf(t);
+ blue = yagl_transport_get_out_GLclampf(t);
+ alpha = yagl_transport_get_out_GLclampf(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glClearColor, GLclampf, GLclampf, GLclampf, GLclampf, red, green, blue, alpha);
+ (void)yagl_host_glClearColor(red, green, blue, alpha);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glClearStencil dispatcher. id = 115
++ * glClearDepthf dispatcher. id = 141
+ */
+ static void yagl_func_glClearDepthf(struct yagl_transport *t)
+ {
+ GLclampf depth;
+ depth = yagl_transport_get_out_GLclampf(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glClearDepthf, GLclampf, depth);
+ (void)yagl_host_glClearDepthf(depth);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glColorMask dispatcher. id = 116
++ * glClearStencil dispatcher. id = 142
+ */
+ static void yagl_func_glClearStencil(struct yagl_transport *t)
+ {
+ GLint s;
+ s = yagl_transport_get_out_GLint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glClearStencil, GLint, s);
+ (void)yagl_host_glClearStencil(s);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glCullFace dispatcher. id = 117
++ * glColorMask dispatcher. id = 143
+ */
+ static void yagl_func_glColorMask(struct yagl_transport *t)
+ {
+ GLboolean red;
+ GLboolean green;
+ GLboolean blue;
+ GLboolean alpha;
+ red = yagl_transport_get_out_GLboolean(t);
+ green = yagl_transport_get_out_GLboolean(t);
+ blue = yagl_transport_get_out_GLboolean(t);
+ alpha = yagl_transport_get_out_GLboolean(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glColorMask, GLboolean, GLboolean, GLboolean, GLboolean, red, green, blue, alpha);
+ (void)yagl_host_glColorMask(red, green, blue, alpha);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glDepthFunc dispatcher. id = 118
++ * glCullFace dispatcher. id = 144
+ */
+ static void yagl_func_glCullFace(struct yagl_transport *t)
+ {
+ GLenum mode;
+ mode = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glCullFace, GLenum, mode);
+ (void)yagl_host_glCullFace(mode);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glDepthMask dispatcher. id = 119
++ * glDepthFunc dispatcher. id = 145
+ */
+ static void yagl_func_glDepthFunc(struct yagl_transport *t)
+ {
+ GLenum func;
+ func = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glDepthFunc, GLenum, func);
+ (void)yagl_host_glDepthFunc(func);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glDepthRangef dispatcher. id = 120
++ * glDepthMask dispatcher. id = 146
+ */
+ static void yagl_func_glDepthMask(struct yagl_transport *t)
+ {
+ GLboolean flag;
+ flag = yagl_transport_get_out_GLboolean(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glDepthMask, GLboolean, flag);
+ (void)yagl_host_glDepthMask(flag);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glEnable dispatcher. id = 121
++ * glDepthRangef dispatcher. id = 147
+ */
+ static void yagl_func_glDepthRangef(struct yagl_transport *t)
+ {
+ GLclampf zNear;
+ GLclampf zFar;
+ zNear = yagl_transport_get_out_GLclampf(t);
+ zFar = yagl_transport_get_out_GLclampf(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glDepthRangef, GLclampf, GLclampf, zNear, zFar);
+ (void)yagl_host_glDepthRangef(zNear, zFar);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glDisable dispatcher. id = 122
++ * glEnable dispatcher. id = 148
+ */
+ static void yagl_func_glEnable(struct yagl_transport *t)
+ {
+ GLenum cap;
+ cap = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glEnable, GLenum, cap);
+ (void)yagl_host_glEnable(cap);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glFlush dispatcher. id = 123
++ * glDisable dispatcher. id = 149
+ */
+ static void yagl_func_glDisable(struct yagl_transport *t)
+ {
+ GLenum cap;
+ cap = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glDisable, GLenum, cap);
+ (void)yagl_host_glDisable(cap);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glFrontFace dispatcher. id = 124
++ * glFlush dispatcher. id = 150
+ */
+ static void yagl_func_glFlush(struct yagl_transport *t)
+ {
+ YAGL_LOG_FUNC_ENTER_SPLIT0(glFlush);
+ (void)yagl_host_glFlush();
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGenerateMipmap dispatcher. id = 125
++ * glFrontFace dispatcher. id = 151
+ */
+ static void yagl_func_glFrontFace(struct yagl_transport *t)
+ {
+ GLenum mode;
+ mode = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glFrontFace, GLenum, mode);
+ (void)yagl_host_glFrontFace(mode);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glHint dispatcher. id = 126
++ * glGenerateMipmap dispatcher. id = 152
+ */
+ static void yagl_func_glGenerateMipmap(struct yagl_transport *t)
+ {
+ GLenum target;
+ target = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glGenerateMipmap, GLenum, target);
+ (void)yagl_host_glGenerateMipmap(target);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glLineWidth dispatcher. id = 127
++ * glHint dispatcher. id = 153
+ */
+ static void yagl_func_glHint(struct yagl_transport *t)
+ {
+ GLenum target;
+ GLenum mode;
+ target = yagl_transport_get_out_GLenum(t);
+ mode = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glHint, GLenum, GLenum, target, mode);
+ (void)yagl_host_glHint(target, mode);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glPixelStorei dispatcher. id = 128
++ * glLineWidth dispatcher. id = 154
+ */
+ static void yagl_func_glLineWidth(struct yagl_transport *t)
+ {
+ GLfloat width;
+ width = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glLineWidth, GLfloat, width);
+ (void)yagl_host_glLineWidth(width);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glPolygonOffset dispatcher. id = 129
++ * glPixelStorei dispatcher. id = 155
+ */
+ static void yagl_func_glPixelStorei(struct yagl_transport *t)
+ {
+ GLenum pname;
+ GLint param;
+ pname = yagl_transport_get_out_GLenum(t);
+ param = yagl_transport_get_out_GLint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glPixelStorei, GLenum, GLint, pname, param);
+ (void)yagl_host_glPixelStorei(pname, param);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glScissor dispatcher. id = 130
++ * glPolygonOffset dispatcher. id = 156
+ */
+ static void yagl_func_glPolygonOffset(struct yagl_transport *t)
+ {
+ GLfloat factor;
+ GLfloat units;
+ factor = yagl_transport_get_out_GLfloat(t);
+ units = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glPolygonOffset, GLfloat, GLfloat, factor, units);
+ (void)yagl_host_glPolygonOffset(factor, units);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glStencilFunc dispatcher. id = 131
++ * glScissor dispatcher. id = 157
+ */
+ static void yagl_func_glScissor(struct yagl_transport *t)
+ {
+ GLint x;
+ GLint y;
+ GLsizei width;
+ GLsizei height;
+ x = yagl_transport_get_out_GLint(t);
+ y = yagl_transport_get_out_GLint(t);
+ width = yagl_transport_get_out_GLsizei(t);
+ height = yagl_transport_get_out_GLsizei(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glScissor, GLint, GLint, GLsizei, GLsizei, x, y, width, height);
+ (void)yagl_host_glScissor(x, y, width, height);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glStencilMask dispatcher. id = 132
++ * glStencilFunc dispatcher. id = 158
+ */
+ static void yagl_func_glStencilFunc(struct yagl_transport *t)
+ {
+ GLenum func;
+ GLint ref;
+ GLuint mask;
+ func = yagl_transport_get_out_GLenum(t);
+ ref = yagl_transport_get_out_GLint(t);
+ mask = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glStencilFunc, GLenum, GLint, GLuint, func, ref, mask);
+ (void)yagl_host_glStencilFunc(func, ref, mask);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glStencilOp dispatcher. id = 133
++ * glStencilMask dispatcher. id = 159
+ */
+ static void yagl_func_glStencilMask(struct yagl_transport *t)
+ {
+ GLuint mask;
+ mask = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glStencilMask, GLuint, mask);
+ (void)yagl_host_glStencilMask(mask);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glSampleCoverage dispatcher. id = 134
++ * glStencilOp dispatcher. id = 160
+ */
+ static void yagl_func_glStencilOp(struct yagl_transport *t)
+ {
+ GLenum fail;
+ GLenum zfail;
+ GLenum zpass;
+ fail = yagl_transport_get_out_GLenum(t);
+ zfail = yagl_transport_get_out_GLenum(t);
+ zpass = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glStencilOp, GLenum, GLenum, GLenum, fail, zfail, zpass);
+ (void)yagl_host_glStencilOp(fail, zfail, zpass);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glViewport dispatcher. id = 135
++ * glSampleCoverage dispatcher. id = 161
+ */
+ static void yagl_func_glSampleCoverage(struct yagl_transport *t)
+ {
+ GLclampf value;
+ GLboolean invert;
+ value = yagl_transport_get_out_GLclampf(t);
+ invert = yagl_transport_get_out_GLboolean(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glSampleCoverage, GLclampf, GLboolean, value, invert);
+ (void)yagl_host_glSampleCoverage(value, invert);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glStencilFuncSeparate dispatcher. id = 136
++ * glViewport dispatcher. id = 162
+ */
+ static void yagl_func_glViewport(struct yagl_transport *t)
+ {
+ GLint x;
+ GLint y;
+ GLsizei width;
+ GLsizei height;
+ x = yagl_transport_get_out_GLint(t);
+ y = yagl_transport_get_out_GLint(t);
+ width = yagl_transport_get_out_GLsizei(t);
+ height = yagl_transport_get_out_GLsizei(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glViewport, GLint, GLint, GLsizei, GLsizei, x, y, width, height);
+ (void)yagl_host_glViewport(x, y, width, height);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glStencilMaskSeparate dispatcher. id = 137
++ * glStencilFuncSeparate dispatcher. id = 163
+ */
+ static void yagl_func_glStencilFuncSeparate(struct yagl_transport *t)
+ {
+ GLenum face;
+ GLenum func;
+ GLint ref;
+ GLuint mask;
+ face = yagl_transport_get_out_GLenum(t);
+ func = yagl_transport_get_out_GLenum(t);
+ ref = yagl_transport_get_out_GLint(t);
+ mask = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glStencilFuncSeparate, GLenum, GLenum, GLint, GLuint, face, func, ref, mask);
+ (void)yagl_host_glStencilFuncSeparate(face, func, ref, mask);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glStencilOpSeparate dispatcher. id = 138
++ * glStencilMaskSeparate dispatcher. id = 164
+ */
+ static void yagl_func_glStencilMaskSeparate(struct yagl_transport *t)
+ {
+ GLenum face;
+ GLuint mask;
+ face = yagl_transport_get_out_GLenum(t);
+ mask = yagl_transport_get_out_GLuint(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glStencilMaskSeparate, GLenum, GLuint, face, mask);
+ (void)yagl_host_glStencilMaskSeparate(face, mask);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glPointSize dispatcher. id = 139
++ * glStencilOpSeparate dispatcher. id = 165
+ */
+ static void yagl_func_glStencilOpSeparate(struct yagl_transport *t)
+ {
+ GLenum face;
+ GLenum fail;
+ GLenum zfail;
+ GLenum zpass;
+ face = yagl_transport_get_out_GLenum(t);
+ fail = yagl_transport_get_out_GLenum(t);
+ zfail = yagl_transport_get_out_GLenum(t);
+ zpass = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glStencilOpSeparate, GLenum, GLenum, GLenum, GLenum, face, fail, zfail, zpass);
+ (void)yagl_host_glStencilOpSeparate(face, fail, zfail, zpass);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glAlphaFunc dispatcher. id = 140
++ * glPointSize dispatcher. id = 166
+ */
+ static void yagl_func_glPointSize(struct yagl_transport *t)
+ {
+ GLfloat size;
+ size = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glPointSize, GLfloat, size);
+ (void)yagl_host_glPointSize(size);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glMatrixMode dispatcher. id = 141
++ * glAlphaFunc dispatcher. id = 167
+ */
+ static void yagl_func_glAlphaFunc(struct yagl_transport *t)
+ {
+ GLenum func;
+ GLclampf ref;
+ func = yagl_transport_get_out_GLenum(t);
+ ref = yagl_transport_get_out_GLclampf(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glAlphaFunc, GLenum, GLclampf, func, ref);
+ (void)yagl_host_glAlphaFunc(func, ref);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glLoadIdentity dispatcher. id = 142
++ * glMatrixMode dispatcher. id = 168
+ */
+ static void yagl_func_glMatrixMode(struct yagl_transport *t)
+ {
+ GLenum mode;
+ mode = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glMatrixMode, GLenum, mode);
+ (void)yagl_host_glMatrixMode(mode);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glPopMatrix dispatcher. id = 143
++ * glLoadIdentity dispatcher. id = 169
+ */
+ static void yagl_func_glLoadIdentity(struct yagl_transport *t)
+ {
+ YAGL_LOG_FUNC_ENTER_SPLIT0(glLoadIdentity);
+ (void)yagl_host_glLoadIdentity();
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glPushMatrix dispatcher. id = 144
++ * glPopMatrix dispatcher. id = 170
+ */
+ static void yagl_func_glPopMatrix(struct yagl_transport *t)
+ {
+ YAGL_LOG_FUNC_ENTER_SPLIT0(glPopMatrix);
+ (void)yagl_host_glPopMatrix();
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glRotatef dispatcher. id = 145
++ * glPushMatrix dispatcher. id = 171
+ */
+ static void yagl_func_glPushMatrix(struct yagl_transport *t)
+ {
+ YAGL_LOG_FUNC_ENTER_SPLIT0(glPushMatrix);
+ (void)yagl_host_glPushMatrix();
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glTranslatef dispatcher. id = 146
++ * glRotatef dispatcher. id = 172
+ */
+ static void yagl_func_glRotatef(struct yagl_transport *t)
+ {
+ GLfloat angle;
+ GLfloat x;
+ GLfloat y;
+ GLfloat z;
+ angle = yagl_transport_get_out_GLfloat(t);
+ x = yagl_transport_get_out_GLfloat(t);
+ y = yagl_transport_get_out_GLfloat(t);
+ z = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glRotatef, GLfloat, GLfloat, GLfloat, GLfloat, angle, x, y, z);
+ (void)yagl_host_glRotatef(angle, x, y, z);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glScalef dispatcher. id = 147
++ * glTranslatef dispatcher. id = 173
+ */
+ static void yagl_func_glTranslatef(struct yagl_transport *t)
+ {
+ GLfloat x;
+ GLfloat y;
+ GLfloat z;
+ x = yagl_transport_get_out_GLfloat(t);
+ y = yagl_transport_get_out_GLfloat(t);
+ z = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glTranslatef, GLfloat, GLfloat, GLfloat, x, y, z);
+ (void)yagl_host_glTranslatef(x, y, z);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glOrthof dispatcher. id = 148
++ * glScalef dispatcher. id = 174
+ */
+ static void yagl_func_glScalef(struct yagl_transport *t)
+ {
+ GLfloat x;
+ GLfloat y;
+ GLfloat z;
+ x = yagl_transport_get_out_GLfloat(t);
+ y = yagl_transport_get_out_GLfloat(t);
+ z = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glScalef, GLfloat, GLfloat, GLfloat, x, y, z);
+ (void)yagl_host_glScalef(x, y, z);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glColor4f dispatcher. id = 149
++ * glOrthof dispatcher. id = 175
+ */
+ static void yagl_func_glOrthof(struct yagl_transport *t)
+ {
+ GLfloat left;
+ GLfloat right;
+ GLfloat bottom;
+ GLfloat top;
+ GLfloat zNear;
+ GLfloat zFar;
+ left = yagl_transport_get_out_GLfloat(t);
+ right = yagl_transport_get_out_GLfloat(t);
+ bottom = yagl_transport_get_out_GLfloat(t);
+ top = yagl_transport_get_out_GLfloat(t);
+ zNear = yagl_transport_get_out_GLfloat(t);
+ zFar = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT6(glOrthof, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, left, right, bottom, top, zNear, zFar);
+ (void)yagl_host_glOrthof(left, right, bottom, top, zNear, zFar);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glColor4ub dispatcher. id = 150
++ * glColor4f dispatcher. id = 176
+ */
+ static void yagl_func_glColor4f(struct yagl_transport *t)
+ {
+ GLfloat red;
+ GLfloat green;
+ GLfloat blue;
+ GLfloat alpha;
+ red = yagl_transport_get_out_GLfloat(t);
+ green = yagl_transport_get_out_GLfloat(t);
+ blue = yagl_transport_get_out_GLfloat(t);
+ alpha = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glColor4f, GLfloat, GLfloat, GLfloat, GLfloat, red, green, blue, alpha);
+ (void)yagl_host_glColor4f(red, green, blue, alpha);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glNormal3f dispatcher. id = 151
++ * glColor4ub dispatcher. id = 177
+ */
+ static void yagl_func_glColor4ub(struct yagl_transport *t)
+ {
+ GLubyte red;
+ GLubyte green;
+ GLubyte blue;
+ GLubyte alpha;
+ red = yagl_transport_get_out_GLubyte(t);
+ green = yagl_transport_get_out_GLubyte(t);
+ blue = yagl_transport_get_out_GLubyte(t);
+ alpha = yagl_transport_get_out_GLubyte(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT4(glColor4ub, GLubyte, GLubyte, GLubyte, GLubyte, red, green, blue, alpha);
+ (void)yagl_host_glColor4ub(red, green, blue, alpha);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glPointParameterf dispatcher. id = 152
++ * glNormal3f dispatcher. id = 178
+ */
+ static void yagl_func_glNormal3f(struct yagl_transport *t)
+ {
+ GLfloat nx;
+ GLfloat ny;
+ GLfloat nz;
+ nx = yagl_transport_get_out_GLfloat(t);
+ ny = yagl_transport_get_out_GLfloat(t);
+ nz = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glNormal3f, GLfloat, GLfloat, GLfloat, nx, ny, nz);
+ (void)yagl_host_glNormal3f(nx, ny, nz);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glPointParameterfv dispatcher. id = 153
++ * glPointParameterf dispatcher. id = 179
+ */
+ static void yagl_func_glPointParameterf(struct yagl_transport *t)
+ {
+ GLenum pname;
+ GLfloat param;
+ pname = yagl_transport_get_out_GLenum(t);
+ param = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glPointParameterf, GLenum, GLfloat, pname, param);
+ (void)yagl_host_glPointParameterf(pname, param);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glFogf dispatcher. id = 154
++ * glPointParameterfv dispatcher. id = 180
+ */
+ static void yagl_func_glPointParameterfv(struct yagl_transport *t)
+ {
+ GLenum pname;
+ const GLfloat *params;
+ int32_t params_count;
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glPointParameterfv, GLenum, void*, pname, params);
+ (void)yagl_host_glPointParameterfv(pname, params, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glFogfv dispatcher. id = 155
++ * glFogf dispatcher. id = 181
+ */
+ static void yagl_func_glFogf(struct yagl_transport *t)
+ {
+ GLenum pname;
+ GLfloat param;
+ pname = yagl_transport_get_out_GLenum(t);
+ param = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glFogf, GLenum, GLfloat, pname, param);
+ (void)yagl_host_glFogf(pname, param);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glFrustumf dispatcher. id = 156
++ * glFogfv dispatcher. id = 182
+ */
+ static void yagl_func_glFogfv(struct yagl_transport *t)
+ {
+ GLenum pname;
+ const GLfloat *params;
+ int32_t params_count;
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glFogfv, GLenum, void*, pname, params);
+ (void)yagl_host_glFogfv(pname, params, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glLightf dispatcher. id = 157
++ * glFrustumf dispatcher. id = 183
+ */
+ static void yagl_func_glFrustumf(struct yagl_transport *t)
+ {
+ GLfloat left;
+ GLfloat right;
+ GLfloat bottom;
+ GLfloat top;
+ GLfloat zNear;
+ GLfloat zFar;
+ left = yagl_transport_get_out_GLfloat(t);
+ right = yagl_transport_get_out_GLfloat(t);
+ bottom = yagl_transport_get_out_GLfloat(t);
+ top = yagl_transport_get_out_GLfloat(t);
+ zNear = yagl_transport_get_out_GLfloat(t);
+ zFar = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT6(glFrustumf, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, left, right, bottom, top, zNear, zFar);
+ (void)yagl_host_glFrustumf(left, right, bottom, top, zNear, zFar);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glLightfv dispatcher. id = 158
++ * glLightf dispatcher. id = 184
+ */
+ static void yagl_func_glLightf(struct yagl_transport *t)
+ {
+ GLenum light;
+ GLenum pname;
+ GLfloat param;
+ light = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ param = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glLightf, GLenum, GLenum, GLfloat, light, pname, param);
+ (void)yagl_host_glLightf(light, pname, param);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetLightfv dispatcher. id = 159
++ * glLightfv dispatcher. id = 185
+ */
+ static void yagl_func_glLightfv(struct yagl_transport *t)
+ {
+ GLenum light;
+ GLenum pname;
+ const GLfloat *params;
+ int32_t params_count;
+ light = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glLightfv, GLenum, GLenum, void*, light, pname, params);
+ (void)yagl_host_glLightfv(light, pname, params, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glLightModelf dispatcher. id = 160
++ * glGetLightfv dispatcher. id = 186
+ */
+ static void yagl_func_glGetLightfv(struct yagl_transport *t)
+ {
+ GLenum light;
+ GLenum pname;
+ GLfloat *params;
+ int32_t params_maxcount;
+ int32_t *params_count;
+ light = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetLightfv, GLenum, GLenum, void*, light, pname, params);
+ *params_count = 0;
+ (void)yagl_host_glGetLightfv(light, pname, params, params_maxcount, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glLightModelfv dispatcher. id = 161
++ * glLightModelf dispatcher. id = 187
+ */
+ static void yagl_func_glLightModelf(struct yagl_transport *t)
+ {
+ GLenum pname;
+ GLfloat param;
+ pname = yagl_transport_get_out_GLenum(t);
+ param = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glLightModelf, GLenum, GLfloat, pname, param);
+ (void)yagl_host_glLightModelf(pname, param);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glMaterialf dispatcher. id = 162
++ * glLightModelfv dispatcher. id = 188
+ */
+ static void yagl_func_glLightModelfv(struct yagl_transport *t)
+ {
+ GLenum pname;
+ const GLfloat *params;
+ int32_t params_count;
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glLightModelfv, GLenum, void*, pname, params);
+ (void)yagl_host_glLightModelfv(pname, params, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glMaterialfv dispatcher. id = 163
++ * glMaterialf dispatcher. id = 189
+ */
+ static void yagl_func_glMaterialf(struct yagl_transport *t)
+ {
+ GLenum face;
+ GLenum pname;
+ GLfloat param;
+ face = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ param = yagl_transport_get_out_GLfloat(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glMaterialf, GLenum, GLenum, GLfloat, face, pname, param);
+ (void)yagl_host_glMaterialf(face, pname, param);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetMaterialfv dispatcher. id = 164
++ * glMaterialfv dispatcher. id = 190
+ */
+ static void yagl_func_glMaterialfv(struct yagl_transport *t)
+ {
+ GLenum face;
+ GLenum pname;
+ const GLfloat *params;
+ int32_t params_count;
+ face = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glMaterialfv, GLenum, GLenum, void*, face, pname, params);
+ (void)yagl_host_glMaterialfv(face, pname, params, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glShadeModel dispatcher. id = 165
++ * glGetMaterialfv dispatcher. id = 191
+ */
+ static void yagl_func_glGetMaterialfv(struct yagl_transport *t)
+ {
+ GLenum face;
+ GLenum pname;
+ GLfloat *params;
+ int32_t params_maxcount;
+ int32_t *params_count;
+ face = yagl_transport_get_out_GLenum(t);
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGetMaterialfv, GLenum, GLenum, void*, face, pname, params);
+ *params_count = 0;
+ (void)yagl_host_glGetMaterialfv(face, pname, params, params_maxcount, params_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glLogicOp dispatcher. id = 166
++ * glShadeModel dispatcher. id = 192
+ */
+ static void yagl_func_glShadeModel(struct yagl_transport *t)
+ {
+ GLenum mode;
+ mode = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glShadeModel, GLenum, mode);
+ (void)yagl_host_glShadeModel(mode);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glMultMatrixf dispatcher. id = 167
++ * glLogicOp dispatcher. id = 193
+ */
+ static void yagl_func_glLogicOp(struct yagl_transport *t)
+ {
+ GLenum opcode;
+ opcode = yagl_transport_get_out_GLenum(t);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glLogicOp, GLenum, opcode);
+ (void)yagl_host_glLogicOp(opcode);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glLoadMatrixf dispatcher. id = 168
++ * glMultMatrixf dispatcher. id = 194
+ */
+ static void yagl_func_glMultMatrixf(struct yagl_transport *t)
+ {
+ const GLfloat *m;
+ int32_t m_count;
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&m, &m_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glMultMatrixf, void*, m);
+ (void)yagl_host_glMultMatrixf(m, m_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glClipPlanef dispatcher. id = 169
++ * glLoadMatrixf dispatcher. id = 195
+ */
+ static void yagl_func_glLoadMatrixf(struct yagl_transport *t)
+ {
+ const GLfloat *m;
+ int32_t m_count;
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&m, &m_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glLoadMatrixf, void*, m);
+ (void)yagl_host_glLoadMatrixf(m, m_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGetClipPlanef dispatcher. id = 170
++ * glClipPlanef dispatcher. id = 196
+ */
+ static void yagl_func_glClipPlanef(struct yagl_transport *t)
+ {
+ GLenum plane;
+ const GLfloat *equation;
+ int32_t equation_count;
+ plane = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&equation, &equation_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glClipPlanef, GLenum, void*, plane, equation);
+ (void)yagl_host_glClipPlanef(plane, equation, equation_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glUpdateOffscreenImageYAGL dispatcher. id = 171
++ * glGetClipPlanef dispatcher. id = 197
+ */
+ static void yagl_func_glGetClipPlanef(struct yagl_transport *t)
+ {
+ GLenum pname;
+ GLfloat *eqn;
+ int32_t eqn_maxcount;
+ int32_t *eqn_count;
+ pname = yagl_transport_get_out_GLenum(t);
+ yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)&eqn, &eqn_maxcount, &eqn_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT2(glGetClipPlanef, GLenum, void*, pname, eqn);
+ *eqn_count = 0;
+ (void)yagl_host_glGetClipPlanef(pname, eqn, eqn_maxcount, eqn_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glGenUniformLocationYAGL dispatcher. id = 172
++ * glUpdateOffscreenImageYAGL dispatcher. id = 198
+ */
+ static void yagl_func_glUpdateOffscreenImageYAGL(struct yagl_transport *t)
+ {
+ GLuint texture;
+ uint32_t width;
+ uint32_t height;
+ uint32_t bpp;
+ const void *pixels;
+ int32_t pixels_count;
+ texture = yagl_transport_get_out_GLuint(t);
+ width = yagl_transport_get_out_uint32_t(t);
+ height = yagl_transport_get_out_uint32_t(t);
+ bpp = yagl_transport_get_out_uint32_t(t);
+ yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT5(glUpdateOffscreenImageYAGL, GLuint, uint32_t, uint32_t, uint32_t, void*, texture, width, height, bpp, pixels);
+ (void)yagl_host_glUpdateOffscreenImageYAGL(texture, width, height, bpp, pixels, pixels_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
- * glDeleteUniformLocationsYAGL dispatcher. id = 173
++ * glGenUniformLocationYAGL dispatcher. id = 199
+ */
+ static void yagl_func_glGenUniformLocationYAGL(struct yagl_transport *t)
+ {
+ uint32_t location;
+ GLuint program;
+ const GLchar *name;
+ int32_t name_count;
+ location = yagl_transport_get_out_uint32_t(t);
+ program = yagl_transport_get_out_GLuint(t);
+ yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT3(glGenUniformLocationYAGL, uint32_t, GLuint, void*, location, program, name);
+ (void)yagl_host_glGenUniformLocationYAGL(location, program, name, name_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ /*
-const uint32_t yagl_gles_api_num_funcs = 173;
++ * glDeleteUniformLocationsYAGL dispatcher. id = 200
+ */
+ static void yagl_func_glDeleteUniformLocationsYAGL(struct yagl_transport *t)
+ {
+ const uint32_t *locations;
+ int32_t locations_count;
+ yagl_transport_get_out_array(t, sizeof(uint32_t), (const void**)&locations, &locations_count);
+ YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteUniformLocationsYAGL, void*, locations);
+ (void)yagl_host_glDeleteUniformLocationsYAGL(locations, locations_count);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
++const uint32_t yagl_gles_api_num_funcs = 200;
+
+ yagl_api_func yagl_gles_api_funcs[] = {
+ &yagl_func_glDrawArrays,
+ &yagl_func_glDrawElements,
+ &yagl_func_glReadPixels,
++ &yagl_func_glDrawArraysInstanced,
++ &yagl_func_glDrawElementsInstanced,
++ &yagl_func_glGenVertexArrays,
++ &yagl_func_glBindVertexArray,
+ &yagl_func_glDisableVertexAttribArray,
+ &yagl_func_glEnableVertexAttribArray,
+ &yagl_func_glVertexAttribPointerData,
+ &yagl_func_glVertexAttribPointerOffset,
+ &yagl_func_glVertexPointerData,
+ &yagl_func_glVertexPointerOffset,
+ &yagl_func_glNormalPointerData,
+ &yagl_func_glNormalPointerOffset,
+ &yagl_func_glColorPointerData,
+ &yagl_func_glColorPointerOffset,
+ &yagl_func_glTexCoordPointerData,
+ &yagl_func_glTexCoordPointerOffset,
+ &yagl_func_glDisableClientState,
+ &yagl_func_glEnableClientState,
++ &yagl_func_glVertexAttribDivisor,
+ &yagl_func_glGenBuffers,
+ &yagl_func_glBindBuffer,
+ &yagl_func_glBufferData,
+ &yagl_func_glBufferSubData,
++ &yagl_func_glBindBufferBase,
++ &yagl_func_glBindBufferRange,
+ &yagl_func_glGenTextures,
+ &yagl_func_glBindTexture,
+ &yagl_func_glActiveTexture,
+ &yagl_func_glCompressedTexImage2D,
+ &yagl_func_glCompressedTexSubImage2D,
+ &yagl_func_glCopyTexImage2D,
+ &yagl_func_glCopyTexSubImage2D,
+ &yagl_func_glGetTexParameterfv,
+ &yagl_func_glGetTexParameteriv,
+ &yagl_func_glTexImage2D,
+ &yagl_func_glTexParameterf,
+ &yagl_func_glTexParameterfv,
+ &yagl_func_glTexParameteri,
+ &yagl_func_glTexParameteriv,
+ &yagl_func_glTexSubImage2D,
+ &yagl_func_glClientActiveTexture,
+ &yagl_func_glTexEnvi,
+ &yagl_func_glTexEnvf,
+ &yagl_func_glMultiTexCoord4f,
+ &yagl_func_glTexEnviv,
+ &yagl_func_glTexEnvfv,
+ &yagl_func_glGetTexEnviv,
+ &yagl_func_glGetTexEnvfv,
+ &yagl_func_glGenFramebuffers,
+ &yagl_func_glBindFramebuffer,
+ &yagl_func_glFramebufferTexture2D,
+ &yagl_func_glFramebufferRenderbuffer,
++ &yagl_func_glBlitFramebuffer,
++ &yagl_func_glDrawBuffers,
+ &yagl_func_glGenRenderbuffers,
+ &yagl_func_glBindRenderbuffer,
+ &yagl_func_glRenderbufferStorage,
+ &yagl_func_glGetRenderbufferParameteriv,
+ &yagl_func_glCreateProgram,
+ &yagl_func_glCreateShader,
+ &yagl_func_glShaderSource,
+ &yagl_func_glAttachShader,
+ &yagl_func_glDetachShader,
+ &yagl_func_glCompileShader,
+ &yagl_func_glBindAttribLocation,
+ &yagl_func_glGetActiveAttrib,
+ &yagl_func_glGetActiveUniform,
+ &yagl_func_glGetAttribLocation,
+ &yagl_func_glGetProgramiv,
+ &yagl_func_glGetProgramInfoLog,
+ &yagl_func_glGetShaderiv,
+ &yagl_func_glGetShaderInfoLog,
+ &yagl_func_glGetUniformfv,
+ &yagl_func_glGetUniformiv,
+ &yagl_func_glGetUniformLocation,
+ &yagl_func_glGetVertexAttribfv,
+ &yagl_func_glGetVertexAttribiv,
+ &yagl_func_glLinkProgram,
+ &yagl_func_glUniform1f,
+ &yagl_func_glUniform1fv,
+ &yagl_func_glUniform1i,
+ &yagl_func_glUniform1iv,
+ &yagl_func_glUniform2f,
+ &yagl_func_glUniform2fv,
+ &yagl_func_glUniform2i,
+ &yagl_func_glUniform2iv,
+ &yagl_func_glUniform3f,
+ &yagl_func_glUniform3fv,
+ &yagl_func_glUniform3i,
+ &yagl_func_glUniform3iv,
+ &yagl_func_glUniform4f,
+ &yagl_func_glUniform4fv,
+ &yagl_func_glUniform4i,
+ &yagl_func_glUniform4iv,
+ &yagl_func_glUniformMatrix2fv,
+ &yagl_func_glUniformMatrix3fv,
+ &yagl_func_glUniformMatrix4fv,
+ &yagl_func_glUseProgram,
+ &yagl_func_glValidateProgram,
+ &yagl_func_glVertexAttrib1f,
+ &yagl_func_glVertexAttrib1fv,
+ &yagl_func_glVertexAttrib2f,
+ &yagl_func_glVertexAttrib2fv,
+ &yagl_func_glVertexAttrib3f,
+ &yagl_func_glVertexAttrib3fv,
+ &yagl_func_glVertexAttrib4f,
+ &yagl_func_glVertexAttrib4fv,
++ &yagl_func_glGetActiveUniformsiv,
++ &yagl_func_glGetUniformIndices,
++ &yagl_func_glGetUniformBlockIndex,
++ &yagl_func_glUniformBlockBinding,
++ &yagl_func_glGetActiveUniformBlockName,
++ &yagl_func_glGetActiveUniformBlockiv,
+ &yagl_func_glGetIntegerv,
+ &yagl_func_glGetFloatv,
+ &yagl_func_glGetString,
+ &yagl_func_glIsEnabled,
++ &yagl_func_glGenTransformFeedbacks,
++ &yagl_func_glBindTransformFeedback,
++ &yagl_func_glBeginTransformFeedback,
++ &yagl_func_glEndTransformFeedback,
++ &yagl_func_glPauseTransformFeedback,
++ &yagl_func_glResumeTransformFeedback,
++ &yagl_func_glTransformFeedbackVaryings,
++ &yagl_func_glGetTransformFeedbackVaryings,
++ &yagl_func_glGenQueries,
++ &yagl_func_glBeginQuery,
++ &yagl_func_glEndQuery,
++ &yagl_func_glGetQueryObjectuiv,
+ &yagl_func_glDeleteObjects,
+ &yagl_func_glBlendEquation,
+ &yagl_func_glBlendEquationSeparate,
+ &yagl_func_glBlendFunc,
+ &yagl_func_glBlendFuncSeparate,
+ &yagl_func_glBlendColor,
+ &yagl_func_glClear,
+ &yagl_func_glClearColor,
+ &yagl_func_glClearDepthf,
+ &yagl_func_glClearStencil,
+ &yagl_func_glColorMask,
+ &yagl_func_glCullFace,
+ &yagl_func_glDepthFunc,
+ &yagl_func_glDepthMask,
+ &yagl_func_glDepthRangef,
+ &yagl_func_glEnable,
+ &yagl_func_glDisable,
+ &yagl_func_glFlush,
+ &yagl_func_glFrontFace,
+ &yagl_func_glGenerateMipmap,
+ &yagl_func_glHint,
+ &yagl_func_glLineWidth,
+ &yagl_func_glPixelStorei,
+ &yagl_func_glPolygonOffset,
+ &yagl_func_glScissor,
+ &yagl_func_glStencilFunc,
+ &yagl_func_glStencilMask,
+ &yagl_func_glStencilOp,
+ &yagl_func_glSampleCoverage,
+ &yagl_func_glViewport,
+ &yagl_func_glStencilFuncSeparate,
+ &yagl_func_glStencilMaskSeparate,
+ &yagl_func_glStencilOpSeparate,
+ &yagl_func_glPointSize,
+ &yagl_func_glAlphaFunc,
+ &yagl_func_glMatrixMode,
+ &yagl_func_glLoadIdentity,
+ &yagl_func_glPopMatrix,
+ &yagl_func_glPushMatrix,
+ &yagl_func_glRotatef,
+ &yagl_func_glTranslatef,
+ &yagl_func_glScalef,
+ &yagl_func_glOrthof,
+ &yagl_func_glColor4f,
+ &yagl_func_glColor4ub,
+ &yagl_func_glNormal3f,
+ &yagl_func_glPointParameterf,
+ &yagl_func_glPointParameterfv,
+ &yagl_func_glFogf,
+ &yagl_func_glFogfv,
+ &yagl_func_glFrustumf,
+ &yagl_func_glLightf,
+ &yagl_func_glLightfv,
+ &yagl_func_glGetLightfv,
+ &yagl_func_glLightModelf,
+ &yagl_func_glLightModelfv,
+ &yagl_func_glMaterialf,
+ &yagl_func_glMaterialfv,
+ &yagl_func_glGetMaterialfv,
+ &yagl_func_glShadeModel,
+ &yagl_func_glLogicOp,
+ &yagl_func_glMultMatrixf,
+ &yagl_func_glLoadMatrixf,
+ &yagl_func_glClipPlanef,
+ &yagl_func_glGetClipPlanef,
+ &yagl_func_glUpdateOffscreenImageYAGL,
+ &yagl_func_glGenUniformLocationYAGL,
+ &yagl_func_glDeleteUniformLocationsYAGL,
+ };
--- /dev/null
-static void *yagl_gles_get_array(uint32_t indx, uint32_t size)
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include "yagl_host_gles_calls.h"
+ #include "yagl_gles_calls.h"
+ #include "yagl_gles_api.h"
+ #include "yagl_gles_driver.h"
+ #include "yagl_gles_api_ps.h"
+ #include "yagl_gles_api_ts.h"
+ #include "yagl_tls.h"
+ #include "yagl_log.h"
+ #include "yagl_process.h"
+ #include "yagl_thread.h"
+ #include "yagl_vector.h"
+ #include "yagl_object_map.h"
++#include "yagl_transport.h"
+
+ static YAGL_DEFINE_TLS(struct yagl_gles_api_ts*, gles_api_ts);
+
+ struct yagl_gles_object
+ {
+ struct yagl_object base;
+
+ struct yagl_gles_driver *driver;
++
++ uint32_t ctx_id;
+ };
+
+ typedef enum
+ {
+ yagl_gles1_array_vertex = 0,
+ yagl_gles1_array_color,
+ yagl_gles1_array_normal,
+ yagl_gles1_array_pointsize,
+ yagl_gles1_array_texcoord,
+ } yagl_gles1_array_type;
+
- struct yagl_vector *array;
++static GLuint yagl_gles_bind_array(uint32_t indx,
++ GLint first,
++ GLsizei stride,
++ const GLvoid *data,
++ int32_t data_count)
+ {
- struct yagl_vector *arrays;
- uint32_t i;
++ GLuint current_vbo;
+
+ if (indx >= gles_api_ts->num_arrays) {
- for (i = gles_api_ts->num_arrays; i < (indx + 1); ++i) {
- yagl_vector_init(&arrays[i], 1, 0);
- }
++ GLuint *arrays;
+
+ arrays = g_malloc((indx + 1) * sizeof(arrays[0]));
+
+ memcpy(arrays,
+ gles_api_ts->arrays,
+ gles_api_ts->num_arrays * sizeof(arrays[0]));
+
- array = &gles_api_ts->arrays[indx];
++ gles_api_ts->driver->GenBuffers(indx + 1 - gles_api_ts->num_arrays,
++ &arrays[gles_api_ts->num_arrays]);
+
+ g_free(gles_api_ts->arrays);
+
+ gles_api_ts->arrays = arrays;
+ gles_api_ts->num_arrays = indx + 1;
+ }
+
- yagl_vector_resize(array, size);
++ gles_api_ts->driver->GetIntegerv(GL_ARRAY_BUFFER_BINDING,
++ (GLint*)¤t_vbo);
+
- return yagl_vector_data(array);
++ gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, gles_api_ts->arrays[indx]);
+
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: *count = 1; break;
- case GL_VERTEX_ATTRIB_ARRAY_ENABLED: *count = 1; break;
- case GL_VERTEX_ATTRIB_ARRAY_SIZE: *count = 1; break;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE: *count = 1; break;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE: *count = 1; break;
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: *count = 1; break;
++ gles_api_ts->driver->BufferData(GL_ARRAY_BUFFER,
++ first * stride + data_count, NULL,
++ GL_STREAM_DRAW);
++ gles_api_ts->driver->BufferSubData(GL_ARRAY_BUFFER,
++ first * stride, data_count, data);
++
++ return current_vbo;
+ }
+
+ static bool yagl_gles_program_get_uniform_type(GLuint program,
+ GLint location,
+ GLenum *type)
+ {
+ GLint link_status = GL_FALSE;
+ GLint i = 0, num_active_uniforms = 0;
+ GLint uniform_name_max_length = 0;
+ GLchar *uniform_name = NULL;
+ bool res = false;
+
+ YAGL_LOG_FUNC_SET(yagl_gles_program_get_uniform_type);
+
+ if (location < 0) {
+ return false;
+ }
+
+ gles_api_ts->driver->GetProgramiv(program,
+ GL_LINK_STATUS,
+ &link_status);
+
+ if (link_status == GL_FALSE) {
+ return false;
+ }
+
+ gles_api_ts->driver->GetProgramiv(program,
+ GL_ACTIVE_UNIFORMS,
+ &num_active_uniforms);
+
+ gles_api_ts->driver->GetProgramiv(program,
+ GL_ACTIVE_UNIFORM_MAX_LENGTH,
+ &uniform_name_max_length);
+
+ uniform_name = g_malloc(uniform_name_max_length + 1);
+
+ for (i = 0; i < num_active_uniforms; ++i) {
+ GLsizei length = 0;
+ GLint size = 0;
+ GLenum tmp_type = 0;
+
+ gles_api_ts->driver->GetActiveUniform(program,
+ i,
+ uniform_name_max_length,
+ &length,
+ &size,
+ &tmp_type,
+ uniform_name);
+
+ if (length == 0) {
+ YAGL_LOG_ERROR("Cannot get active uniform %d for program %d", i, program);
+ continue;
+ }
+
+ if (gles_api_ts->driver->GetUniformLocation(program,
+ uniform_name) == location) {
+ *type = tmp_type;
+ res = true;
+ break;
+ }
+ }
+
+ g_free(uniform_name);
+
+ return res;
+ }
+
+ static bool yagl_gles_get_uniform_type_count(GLenum uniform_type, int *count)
+ {
+ switch (uniform_type) {
+ case GL_FLOAT: *count = 1; break;
+ case GL_FLOAT_VEC2: *count = 2; break;
+ case GL_FLOAT_VEC3: *count = 3; break;
+ case GL_FLOAT_VEC4: *count = 4; break;
+ case GL_FLOAT_MAT2: *count = 2*2; break;
+ case GL_FLOAT_MAT3: *count = 3*3; break;
+ case GL_FLOAT_MAT4: *count = 4*4; break;
+ case GL_INT: *count = 1; break;
+ case GL_INT_VEC2: *count = 2; break;
+ case GL_INT_VEC3: *count = 3; break;
+ case GL_INT_VEC4: *count = 4; break;
+ case GL_BOOL: *count = 1; break;
+ case GL_BOOL_VEC2: *count = 2; break;
+ case GL_BOOL_VEC3: *count = 3; break;
+ case GL_BOOL_VEC4: *count = 4; break;
+ case GL_SAMPLER_2D: *count = 1; break;
+ case GL_SAMPLER_CUBE: *count = 1; break;
++ case GL_UNSIGNED_INT: *count = 1; break;
++ case GL_UNSIGNED_INT_VEC2: *count = 2; break;
++ case GL_UNSIGNED_INT_VEC3: *count = 3; break;
++ case GL_UNSIGNED_INT_VEC4: *count = 4; break;
++ case GL_FLOAT_MAT2x3: *count = 2*3; break;
++ case GL_FLOAT_MAT2x4: *count = 2*4; break;
++ case GL_FLOAT_MAT3x2: *count = 3*2; break;
++ case GL_FLOAT_MAT3x4: *count = 3*4; break;
++ case GL_FLOAT_MAT4x2: *count = 4*2; break;
++ case GL_FLOAT_MAT4x3: *count = 4*3; break;
++ case GL_SAMPLER_3D: *count = 1; break;
++ case GL_SAMPLER_2D_SHADOW: *count = 1; break;
++ case GL_SAMPLER_2D_ARRAY: *count = 1; break;
++ case GL_SAMPLER_2D_ARRAY_SHADOW: *count = 1; break;
++ case GL_SAMPLER_CUBE_SHADOW: *count = 1; break;
++ case GL_INT_SAMPLER_2D: *count = 1; break;
++ case GL_INT_SAMPLER_3D: *count = 1; break;
++ case GL_INT_SAMPLER_CUBE: *count = 1; break;
++ case GL_INT_SAMPLER_2D_ARRAY: *count = 1; break;
++ case GL_UNSIGNED_INT_SAMPLER_2D: *count = 1; break;
++ case GL_UNSIGNED_INT_SAMPLER_3D: *count = 1; break;
++ case GL_UNSIGNED_INT_SAMPLER_CUBE: *count = 1; break;
++ case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: *count = 1; break;
+ default: return false;
+ }
+ return true;
+ }
+
+ static bool yagl_gles_get_array_param_count(GLenum pname, int *count)
+ {
+ switch (pname) {
- yagl_ensure_ctx();
+ case GL_CURRENT_VERTEX_ATTRIB: *count = 4; break;
+ default: return false;
+ }
+ return true;
+ }
+
+ static void yagl_gles_object_add(GLuint local_name,
+ GLuint global_name,
++ uint32_t ctx_id,
+ void (*destroy_func)(struct yagl_object */*obj*/))
+ {
+ struct yagl_gles_object *obj;
+
+ obj = g_malloc(sizeof(*obj));
+
+ obj->base.global_name = global_name;
+ obj->base.destroy = destroy_func;
+ obj->driver = gles_api_ts->driver;
++ obj->ctx_id = ctx_id;
+
+ yagl_object_map_add(cur_ts->ps->object_map,
+ local_name,
+ &obj->base);
+ }
+
+ static void yagl_gles_buffer_destroy(struct yagl_object *obj)
+ {
+ struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles_buffer_destroy, "%u", obj->global_name);
+
- yagl_unensure_ctx();
++ yagl_ensure_ctx(0);
+ gles_obj->driver->DeleteBuffers(1, &obj->global_name);
- yagl_ensure_ctx();
++ yagl_unensure_ctx(0);
+
+ g_free(gles_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static void yagl_gles_texture_destroy(struct yagl_object *obj)
+ {
+ struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles_texture_destroy, "%u", obj->global_name);
+
- yagl_unensure_ctx();
++ yagl_ensure_ctx(0);
+ gles_obj->driver->DeleteTextures(1, &obj->global_name);
- yagl_ensure_ctx();
++ yagl_unensure_ctx(0);
+
+ g_free(gles_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static void yagl_gles_framebuffer_destroy(struct yagl_object *obj)
+ {
+ struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles_framebuffer_destroy, "%u", obj->global_name);
+
- yagl_unensure_ctx();
++ yagl_ensure_ctx(gles_obj->ctx_id);
+ gles_obj->driver->DeleteFramebuffers(1, &obj->global_name);
- yagl_ensure_ctx();
++ yagl_unensure_ctx(gles_obj->ctx_id);
+
+ g_free(gles_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static void yagl_gles_renderbuffer_destroy(struct yagl_object *obj)
+ {
+ struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles_renderbuffer_destroy, "%u", obj->global_name);
+
- yagl_unensure_ctx();
++ yagl_ensure_ctx(0);
+ gles_obj->driver->DeleteRenderbuffers(1, &obj->global_name);
- yagl_ensure_ctx();
++ yagl_unensure_ctx(0);
+
+ g_free(gles_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static void yagl_gles_program_destroy(struct yagl_object *obj)
+ {
+ struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles_program_destroy, "%u", obj->global_name);
+
- yagl_unensure_ctx();
++ yagl_ensure_ctx(0);
+ gles_obj->driver->DeleteProgram(obj->global_name);
- yagl_ensure_ctx();
++ yagl_unensure_ctx(0);
+
+ g_free(gles_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static void yagl_gles_shader_destroy(struct yagl_object *obj)
+ {
+ struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles_shader_destroy, "%u", obj->global_name);
+
- yagl_unensure_ctx();
++ yagl_ensure_ctx(0);
+ gles_obj->driver->DeleteShader(obj->global_name);
- void *array_data = yagl_gles_get_array(indx, first * stride + data_count);
-
- memcpy(array_data + (first * stride), data, data_count);
++ yagl_unensure_ctx(0);
++
++ g_free(gles_obj);
++
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++static void yagl_gles_vertex_array_destroy(struct yagl_object *obj)
++{
++ struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj;
++
++ YAGL_LOG_FUNC_ENTER(yagl_gles_vertex_array_destroy, "%u", obj->global_name);
++
++ yagl_ensure_ctx(gles_obj->ctx_id);
++ gles_obj->driver->DeleteVertexArrays(1, &obj->global_name);
++ yagl_unensure_ctx(gles_obj->ctx_id);
++
++ g_free(gles_obj);
++
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++static void yagl_gles_transform_feedback_destroy(struct yagl_object *obj)
++{
++ struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj;
++
++ YAGL_LOG_FUNC_ENTER(yagl_gles_transform_feedback_destroy, "%u", obj->global_name);
++
++ yagl_ensure_ctx(gles_obj->ctx_id);
++ gles_obj->driver->DeleteTransformFeedbacks(1, &obj->global_name);
++ yagl_unensure_ctx(gles_obj->ctx_id);
++
++ g_free(gles_obj);
++
++ YAGL_LOG_FUNC_EXIT(NULL);
++}
++
++static void yagl_gles_query_destroy(struct yagl_object *obj)
++{
++ struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj;
++
++ YAGL_LOG_FUNC_ENTER(yagl_gles_query_destroy, "%u", obj->global_name);
++
++ yagl_ensure_ctx(gles_obj->ctx_id);
++ gles_obj->driver->DeleteQueries(1, &obj->global_name);
++ yagl_unensure_ctx(gles_obj->ctx_id);
+
+ g_free(gles_obj);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static __inline GLuint yagl_gles_object_get(GLuint local_name)
+ {
+ return (local_name > 0) ? yagl_object_map_get(cur_ts->ps->object_map, local_name) : 0;
+ }
+
+ static yagl_api_func yagl_host_gles_get_func(struct yagl_api_ps *api_ps,
+ uint32_t func_id)
+ {
+ if ((func_id <= 0) || (func_id > yagl_gles_api_num_funcs)) {
+ return NULL;
+ } else {
+ return yagl_gles_api_funcs[func_id - 1];
+ }
+ }
+
+ static void yagl_host_gles_thread_init(struct yagl_api_ps *api_ps)
+ {
+ struct yagl_gles_api_ps *gles_api_ps = (struct yagl_gles_api_ps*)api_ps;
+
+ YAGL_LOG_FUNC_ENTER(yagl_host_gles_thread_init, NULL);
+
+ gles_api_ts = g_malloc0(sizeof(*gles_api_ts));
+
+ yagl_gles_api_ts_init(gles_api_ts, gles_api_ps->driver, gles_api_ps);
+
+ cur_ts->gles_api_ts = gles_api_ts;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static void yagl_host_gles_batch_start(struct yagl_api_ps *api_ps)
+ {
+ gles_api_ts = cur_ts->gles_api_ts;
+ }
+
+ static void yagl_host_gles_batch_end(struct yagl_api_ps *api_ps)
+ {
+ }
+
+ static void yagl_host_gles_thread_fini(struct yagl_api_ps *api_ps)
+ {
+ YAGL_LOG_FUNC_ENTER(yagl_host_gles_thread_fini, NULL);
+
+ gles_api_ts = cur_ts->gles_api_ts;
+
+ yagl_gles_api_ts_cleanup(gles_api_ts);
+
+ g_free(gles_api_ts);
+
+ gles_api_ts = cur_ts->gles_api_ts = NULL;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static void yagl_host_gles_process_destroy(struct yagl_api_ps *api_ps)
+ {
+ struct yagl_gles_api_ps *gles_api_ps = (struct yagl_gles_api_ps*)api_ps;
+
+ YAGL_LOG_FUNC_ENTER(yagl_host_gles_process_destroy, NULL);
+
+ yagl_gles_api_ps_cleanup(gles_api_ps);
+ yagl_api_ps_cleanup(&gles_api_ps->base);
+
+ g_free(gles_api_ps);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ struct yagl_api_ps *yagl_host_gles_process_init(struct yagl_api *api)
+ {
+ struct yagl_gles_api *gles_api = (struct yagl_gles_api*)api;
+ struct yagl_gles_api_ps *gles_api_ps;
+
+ YAGL_LOG_FUNC_ENTER(yagl_host_gles_process_init, NULL);
+
+ gles_api_ps = g_malloc0(sizeof(*gles_api_ps));
+
+ yagl_api_ps_init(&gles_api_ps->base, api);
+
+ gles_api_ps->base.thread_init = &yagl_host_gles_thread_init;
+ gles_api_ps->base.batch_start = &yagl_host_gles_batch_start;
+ gles_api_ps->base.get_func = &yagl_host_gles_get_func;
+ gles_api_ps->base.batch_end = &yagl_host_gles_batch_end;
+ gles_api_ps->base.thread_fini = &yagl_host_gles_thread_fini;
+ gles_api_ps->base.destroy = &yagl_host_gles_process_destroy;
+
+ yagl_gles_api_ps_init(gles_api_ps, gles_api->driver);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return &gles_api_ps->base;
+ }
+
+ void yagl_host_glDrawArrays(GLenum mode,
+ GLint first,
+ GLsizei count)
+ {
+ gles_api_ts->driver->DrawArrays(mode, first, count);
+ }
+
+ void yagl_host_glDrawElements(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const GLvoid *indices, int32_t indices_count)
+ {
+ if (indices) {
+ gles_api_ts->driver->DrawElements(mode, count, type, indices);
+ } else {
+ gles_api_ts->driver->DrawElements(mode, count, type,
+ (const GLvoid*)(uintptr_t)indices_count);
+ }
+ }
+
+ void yagl_host_glReadPixels(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLvoid *pixels, int32_t pixels_maxcount, int32_t *pixels_count)
+ {
+ GLuint current_pbo = 0;
+
+ gles_api_ts->driver->GetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING_ARB,
+ (GLint*)¤t_pbo);
+ if (current_pbo != 0) {
+ gles_api_ts->driver->BindBuffer(GL_PIXEL_PACK_BUFFER_ARB,
+ 0);
+ }
+
+ gles_api_ts->driver->ReadPixels(x,
+ y,
+ width,
+ height,
+ format,
+ type,
+ pixels);
+
+ *pixels_count = pixels_maxcount;
+
+ if (current_pbo != 0) {
+ gles_api_ts->driver->BindBuffer(GL_PIXEL_PACK_BUFFER_ARB,
+ current_pbo);
+ }
+ }
+
++void yagl_host_glDrawArraysInstanced(GLenum mode,
++ GLint start,
++ GLsizei count,
++ GLsizei primcount)
++{
++ gles_api_ts->driver->DrawArraysInstanced(mode, start, count, primcount);
++}
++
++void yagl_host_glDrawElementsInstanced(GLenum mode,
++ GLsizei count,
++ GLenum type,
++ const void *indices, int32_t indices_count,
++ GLsizei primcount)
++{
++ if (indices) {
++ gles_api_ts->driver->DrawElementsInstanced(mode, count, type, indices, primcount);
++ } else {
++ gles_api_ts->driver->DrawElementsInstanced(mode,
++ count,
++ type,
++ (const GLvoid*)(uintptr_t)indices_count,
++ primcount);
++ }
++}
++
++void yagl_host_glGenVertexArrays(const GLuint *arrays, int32_t arrays_count)
++{
++ int i;
++
++ for (i = 0; i < arrays_count; ++i) {
++ GLuint global_name;
++
++ gles_api_ts->driver->GenVertexArrays(1, &global_name);
++
++ yagl_gles_object_add(arrays[i],
++ global_name,
++ yagl_get_ctx_id(),
++ &yagl_gles_vertex_array_destroy);
++ }
++}
++
++void yagl_host_glBindVertexArray(GLuint array)
++{
++ gles_api_ts->driver->BindVertexArray(yagl_gles_object_get(array));
++}
++
+ void yagl_host_glDisableVertexAttribArray(GLuint index)
+ {
+ gles_api_ts->driver->DisableVertexAttribArray(index);
+ }
+
+ void yagl_host_glEnableVertexAttribArray(GLuint index)
+ {
+ gles_api_ts->driver->EnableVertexAttribArray(index);
+ }
+
+ void yagl_host_glVertexAttribPointerData(GLuint indx,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLsizei stride,
+ GLint first,
+ const GLvoid *data, int32_t data_count)
+ {
- stride, array_data);
++ GLuint current_vbo = yagl_gles_bind_array(indx, first, stride,
++ data, data_count);
+
+ gles_api_ts->driver->VertexAttribPointer(indx, size, type, normalized,
- stride, (const GLvoid*)(uintptr_t)offset);
++ stride,
++ NULL);
++
++ gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo);
+ }
+
+ void yagl_host_glVertexAttribPointerOffset(GLuint indx,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLsizei stride,
+ GLsizei offset)
+ {
+ gles_api_ts->driver->VertexAttribPointer(indx, size, type, normalized,
- void *array_data = yagl_gles_get_array(yagl_gles1_array_vertex, first * stride + data_count);
++ stride,
++ (const GLvoid*)(uintptr_t)offset);
+ }
+
+ void yagl_host_glVertexPointerData(GLint size,
+ GLenum type,
+ GLsizei stride,
+ GLint first,
+ const GLvoid *data, int32_t data_count)
+ {
- memcpy(array_data + (first * stride), data, data_count);
++ GLuint current_vbo = yagl_gles_bind_array(yagl_gles1_array_vertex,
++ first, stride,
++ data, data_count);
+
- gles_api_ts->driver->VertexPointer(size, type, stride, array_data);
++ gles_api_ts->driver->VertexPointer(size, type, stride, NULL);
+
- void *array_data = yagl_gles_get_array(yagl_gles1_array_normal, first * stride + data_count);
++ gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo);
+ }
+
+ void yagl_host_glVertexPointerOffset(GLint size,
+ GLenum type,
+ GLsizei stride,
+ GLsizei offset)
+ {
+ gles_api_ts->driver->VertexPointer(size, type, stride, (const GLvoid*)(uintptr_t)offset);
+ }
+
+ void yagl_host_glNormalPointerData(GLenum type,
+ GLsizei stride,
+ GLint first,
+ const GLvoid *data, int32_t data_count)
+ {
- memcpy(array_data + (first * stride), data, data_count);
++ GLuint current_vbo = yagl_gles_bind_array(yagl_gles1_array_normal,
++ first, stride,
++ data, data_count);
+
- gles_api_ts->driver->NormalPointer(type, stride, array_data);
++ gles_api_ts->driver->NormalPointer(type, stride, NULL);
+
- void *array_data = yagl_gles_get_array(yagl_gles1_array_color, first * stride + data_count);
++ gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo);
+ }
+
+ void yagl_host_glNormalPointerOffset(GLenum type,
+ GLsizei stride,
+ GLsizei offset)
+ {
+ gles_api_ts->driver->NormalPointer(type, stride, (const GLvoid*)(uintptr_t)offset);
+ }
+
+ void yagl_host_glColorPointerData(GLint size,
+ GLenum type,
+ GLsizei stride,
+ GLint first,
+ const GLvoid *data, int32_t data_count)
+ {
- memcpy(array_data + (first * stride), data, data_count);
++ GLuint current_vbo = yagl_gles_bind_array(yagl_gles1_array_color,
++ first, stride,
++ data, data_count);
+
- gles_api_ts->driver->ColorPointer(size, type, stride, array_data);
++ gles_api_ts->driver->ColorPointer(size, type, stride, NULL);
+
- void *array_data = yagl_gles_get_array(yagl_gles1_array_texcoord + tex_id,
- first * stride + data_count);
++ gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo);
+ }
+
+ void yagl_host_glColorPointerOffset(GLint size,
+ GLenum type,
+ GLsizei stride,
+ GLsizei offset)
+ {
+ gles_api_ts->driver->ColorPointer(size, type, stride, (const GLvoid*)(uintptr_t)offset);
+ }
+
+ void yagl_host_glTexCoordPointerData(GLint tex_id,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ GLint first,
+ const GLvoid *data, int32_t data_count)
+ {
- memcpy(array_data + (first * stride), data, data_count);
++ GLuint current_vbo = yagl_gles_bind_array(yagl_gles1_array_texcoord + tex_id,
++ first, stride,
++ data, data_count);
+
- gles_api_ts->driver->TexCoordPointer(size, type, stride, array_data);
++ gles_api_ts->driver->TexCoordPointer(size, type, stride, NULL);
+
- yagl_ensure_ctx();
++ gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo);
+ }
+
+ void yagl_host_glTexCoordPointerOffset(GLint size,
+ GLenum type,
+ GLsizei stride,
+ GLsizei offset)
+ {
+ gles_api_ts->driver->TexCoordPointer(size, type, stride, (const GLvoid*)(uintptr_t)offset);
+ }
+
+ void yagl_host_glDisableClientState(GLenum array)
+ {
+ gles_api_ts->driver->DisableClientState(array);
+ }
+
+ void yagl_host_glEnableClientState(GLenum array)
+ {
+ gles_api_ts->driver->EnableClientState(array);
+ }
+
++void yagl_host_glVertexAttribDivisor(GLuint index,
++ GLuint divisor)
++{
++ gles_api_ts->driver->VertexAttribDivisor(index, divisor);
++}
++
+ void yagl_host_glGenBuffers(const GLuint *buffers, int32_t buffers_count)
+ {
+ int i;
+
+ for (i = 0; i < buffers_count; ++i) {
+ GLuint global_name;
+
+ gles_api_ts->driver->GenBuffers(1, &global_name);
+
+ yagl_gles_object_add(buffers[i],
+ global_name,
++ 0,
+ &yagl_gles_buffer_destroy);
+ }
+ }
+
+ void yagl_host_glBindBuffer(GLenum target,
+ GLuint buffer)
+ {
+ gles_api_ts->driver->BindBuffer(target, yagl_gles_object_get(buffer));
+ }
+
+ void yagl_host_glBufferData(GLenum target,
+ const GLvoid *data, int32_t data_count,
+ GLenum usage)
+ {
+ gles_api_ts->driver->BufferData(target, data_count, data, usage);
+ }
+
+ void yagl_host_glBufferSubData(GLenum target,
+ GLsizei offset,
+ const GLvoid *data, int32_t data_count)
+ {
+ gles_api_ts->driver->BufferSubData(target, offset, data_count, data);
+ }
+
++void yagl_host_glBindBufferBase(GLenum target,
++ GLuint index,
++ GLuint buffer)
++{
++ gles_api_ts->driver->BindBufferBase(target, index,
++ yagl_gles_object_get(buffer));
++}
++
++void yagl_host_glBindBufferRange(GLenum target,
++ GLuint index,
++ GLuint buffer,
++ GLint offset,
++ GLsizei size)
++{
++ gles_api_ts->driver->BindBufferRange(target, index,
++ yagl_gles_object_get(buffer),
++ offset, size);
++}
++
+ void yagl_host_glGenTextures(const GLuint *textures, int32_t textures_count)
+ {
+ int i;
+
+ for (i = 0; i < textures_count; ++i) {
+ GLuint global_name;
+
+ /*
+ * We need ensure/unensure here for eglReleaseTexImage that
+ * might be called without an active context, but
+ * which needs to create a texture.
+ */
- yagl_unensure_ctx();
++ yagl_ensure_ctx(0);
+ gles_api_ts->driver->GenTextures(1, &global_name);
-GLboolean yagl_host_glGetActiveAttrib(GLuint program,
++ yagl_unensure_ctx(0);
+
+ yagl_gles_object_add(textures[i],
+ global_name,
++ 0,
+ &yagl_gles_texture_destroy);
+ }
+ }
+
+ void yagl_host_glBindTexture(GLenum target,
+ GLuint texture)
+ {
+ gles_api_ts->driver->BindTexture(target, yagl_gles_object_get(texture));
+ }
+
+ void yagl_host_glActiveTexture(GLenum texture)
+ {
+ gles_api_ts->driver->ActiveTexture(texture);
+ }
+
+ void yagl_host_glCompressedTexImage2D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ const GLvoid *data, int32_t data_count)
+ {
+ gles_api_ts->driver->CompressedTexImage2D(target,
+ level,
+ internalformat,
+ width,
+ height,
+ border,
+ data_count,
+ data);
+ }
+
+ void yagl_host_glCompressedTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ const GLvoid *data, int32_t data_count)
+ {
+ gles_api_ts->driver->CompressedTexSubImage2D(target,
+ level,
+ xoffset,
+ yoffset,
+ width,
+ height,
+ format,
+ data_count,
+ data);
+ }
+
+ void yagl_host_glCopyTexImage2D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border)
+ {
+ gles_api_ts->driver->CopyTexImage2D(target,
+ level,
+ internalformat,
+ x,
+ y,
+ width,
+ height,
+ border);
+ }
+
+ void yagl_host_glCopyTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+ {
+ gles_api_ts->driver->CopyTexSubImage2D(target,
+ level,
+ xoffset,
+ yoffset,
+ x,
+ y,
+ width,
+ height);
+ }
+
+ void yagl_host_glGetTexParameterfv(GLenum target,
+ GLenum pname,
+ GLfloat *param)
+ {
+ GLfloat params[10];
+
+ gles_api_ts->driver->GetTexParameterfv(target,
+ pname,
+ params);
+
+ if (param) {
+ *param = params[0];
+ }
+ }
+
+ void yagl_host_glGetTexParameteriv(GLenum target,
+ GLenum pname,
+ GLint *param)
+ {
+ GLint params[10];
+
+ gles_api_ts->driver->GetTexParameteriv(target,
+ pname,
+ params);
+
+ if (param) {
+ *param = params[0];
+ }
+ }
+
+ void yagl_host_glTexImage2D(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const GLvoid *pixels, int32_t pixels_count)
+ {
+ gles_api_ts->driver->TexImage2D(target,
+ level,
+ internalformat,
+ width,
+ height,
+ border,
+ format,
+ type,
+ pixels);
+ }
+
+ void yagl_host_glTexParameterf(GLenum target,
+ GLenum pname,
+ GLfloat param)
+ {
+ gles_api_ts->driver->TexParameterf(target, pname, param);
+ }
+
+ void yagl_host_glTexParameterfv(GLenum target,
+ GLenum pname,
+ const GLfloat *params, int32_t params_count)
+ {
+ GLfloat tmp[10];
+
+ memset(tmp, 0, sizeof(tmp));
+
+ if (params) {
+ tmp[0] = *params;
+ }
+
+ gles_api_ts->driver->TexParameterfv(target,
+ pname,
+ (params ? tmp : NULL));
+ }
+
+ void yagl_host_glTexParameteri(GLenum target,
+ GLenum pname,
+ GLint param)
+ {
+ gles_api_ts->driver->TexParameteri(target, pname, param);
+ }
+
+ void yagl_host_glTexParameteriv(GLenum target,
+ GLenum pname,
+ const GLint *params, int32_t params_count)
+ {
+ GLint tmp[10];
+
+ memset(tmp, 0, sizeof(tmp));
+
+ if (params) {
+ tmp[0] = *params;
+ }
+
+ gles_api_ts->driver->TexParameteriv(target,
+ pname,
+ (params ? tmp : NULL));
+ }
+
+ void yagl_host_glTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const GLvoid *pixels, int32_t pixels_count)
+ {
+ gles_api_ts->driver->TexSubImage2D(target,
+ level,
+ xoffset,
+ yoffset,
+ width,
+ height,
+ format,
+ type,
+ pixels);
+ }
+
+ void yagl_host_glClientActiveTexture(GLenum texture)
+ {
+ gles_api_ts->driver->ClientActiveTexture(texture);
+ }
+
+ void yagl_host_glTexEnvi(GLenum target,
+ GLenum pname,
+ GLint param)
+ {
+ gles_api_ts->driver->TexEnvi(target, pname, param);
+ }
+
+ void yagl_host_glTexEnvf(GLenum target,
+ GLenum pname,
+ GLfloat param)
+ {
+ gles_api_ts->driver->TexEnvf(target, pname, param);
+ }
+
+ void yagl_host_glMultiTexCoord4f(GLenum target,
+ GLfloat s,
+ GLfloat tt,
+ GLfloat r,
+ GLfloat q)
+ {
+ gles_api_ts->driver->MultiTexCoord4f(target, s, tt, r, q);
+ }
+
+ void yagl_host_glTexEnviv(GLenum target,
+ GLenum pname,
+ const GLint *params, int32_t params_count)
+ {
+ gles_api_ts->driver->TexEnviv(target, pname, params);
+ }
+
+ void yagl_host_glTexEnvfv(GLenum target,
+ GLenum pname,
+ const GLfloat *params, int32_t params_count)
+ {
+ gles_api_ts->driver->TexEnvfv(target, pname, params);
+ }
+
+ void yagl_host_glGetTexEnviv(GLenum env,
+ GLenum pname,
+ GLint *params, int32_t params_maxcount, int32_t *params_count)
+ {
+ gles_api_ts->driver->GetTexEnviv(env, pname, params);
+ *params_count = params_maxcount;
+ }
+
+ void yagl_host_glGetTexEnvfv(GLenum env,
+ GLenum pname,
+ GLfloat *params, int32_t params_maxcount, int32_t *params_count)
+ {
+ gles_api_ts->driver->GetTexEnvfv(env, pname, params);
+ *params_count = params_maxcount;
+ }
+
+ void yagl_host_glGenFramebuffers(const GLuint *framebuffers, int32_t framebuffers_count)
+ {
+ int i;
+
+ for (i = 0; i < framebuffers_count; ++i) {
+ GLuint global_name;
+
+ gles_api_ts->driver->GenFramebuffers(1, &global_name);
+
+ yagl_gles_object_add(framebuffers[i],
+ global_name,
++ yagl_get_ctx_id(),
+ &yagl_gles_framebuffer_destroy);
+ }
+ }
+
+ void yagl_host_glBindFramebuffer(GLenum target,
+ GLuint framebuffer)
+ {
+ gles_api_ts->driver->BindFramebuffer(target,
+ yagl_gles_object_get(framebuffer));
+ }
+
+ void yagl_host_glFramebufferTexture2D(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level)
+ {
+ gles_api_ts->driver->FramebufferTexture2D(target, attachment,
+ textarget,
+ yagl_gles_object_get(texture),
+ level);
+ }
+
+ void yagl_host_glFramebufferRenderbuffer(GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer)
+ {
+ gles_api_ts->driver->FramebufferRenderbuffer(target,
+ attachment,
+ renderbuffertarget,
+ yagl_gles_object_get(renderbuffer));
+ }
+
++void yagl_host_glBlitFramebuffer(GLint srcX0,
++ GLint srcY0,
++ GLint srcX1,
++ GLint srcY1,
++ GLint dstX0,
++ GLint dstY0,
++ GLint dstX1,
++ GLint dstY1,
++ GLbitfield mask,
++ GLenum filter)
++{
++ gles_api_ts->driver->BlitFramebuffer(srcX0, srcY0, srcX1, srcY1,
++ dstX0, dstY0, dstX1, dstY1,
++ mask, filter);
++}
++
++void yagl_host_glDrawBuffers(const GLenum *bufs, int32_t bufs_count)
++{
++ gles_api_ts->driver->DrawBuffers(bufs_count, bufs);
++}
++
+ void yagl_host_glGenRenderbuffers(const GLuint *renderbuffers, int32_t renderbuffers_count)
+ {
+ int i;
+
+ for (i = 0; i < renderbuffers_count; ++i) {
+ GLuint global_name;
+
+ gles_api_ts->driver->GenRenderbuffers(1, &global_name);
+
+ yagl_gles_object_add(renderbuffers[i],
+ global_name,
++ 0,
+ &yagl_gles_renderbuffer_destroy);
+ }
+ }
+
+ void yagl_host_glBindRenderbuffer(GLenum target,
+ GLuint renderbuffer)
+ {
+ gles_api_ts->driver->BindRenderbuffer(target,
+ yagl_gles_object_get(renderbuffer));
+ }
+
+ void yagl_host_glRenderbufferStorage(GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height)
+ {
+ gles_api_ts->driver->RenderbufferStorage(target, internalformat, width, height);
+ }
+
+ void yagl_host_glGetRenderbufferParameteriv(GLenum target,
+ GLenum pname,
+ GLint *param)
+ {
+ GLint params[10];
+
+ gles_api_ts->driver->GetRenderbufferParameteriv(target,
+ pname,
+ params);
+
+ if (param) {
+ *param = params[0];
+ }
+ }
+
+ void yagl_host_glCreateProgram(GLuint program)
+ {
+ GLuint global_name = gles_api_ts->driver->CreateProgram();
+
+ yagl_gles_object_add(program,
+ global_name,
++ 0,
+ &yagl_gles_program_destroy);
+ }
+
+ void yagl_host_glCreateShader(GLuint shader,
+ GLenum type)
+ {
+ GLuint global_name = gles_api_ts->driver->CreateShader(type);
+
+ yagl_gles_object_add(shader,
+ global_name,
++ 0,
+ &yagl_gles_shader_destroy);
+ }
+
+ void yagl_host_glShaderSource(GLuint shader,
+ const GLchar *string, int32_t string_count)
+ {
+ const GLchar *strings[1];
+ GLint lenghts[1];
+
+ strings[0] = string;
+ lenghts[0] = string_count - 1;
+
+ gles_api_ts->driver->ShaderSource(yagl_gles_object_get(shader),
+ 1,
+ strings,
+ lenghts);
+ }
+
+ void yagl_host_glAttachShader(GLuint program,
+ GLuint shader)
+ {
+ gles_api_ts->driver->AttachShader(yagl_gles_object_get(program),
+ yagl_gles_object_get(shader));
+ }
+
+ void yagl_host_glDetachShader(GLuint program,
+ GLuint shader)
+ {
+ gles_api_ts->driver->DetachShader(yagl_gles_object_get(program),
+ yagl_gles_object_get(shader));
+ }
+
+ void yagl_host_glCompileShader(GLuint shader)
+ {
+ gles_api_ts->driver->CompileShader(yagl_gles_object_get(shader));
+ }
+
+ void yagl_host_glBindAttribLocation(GLuint program,
+ GLuint index,
+ const GLchar *name, int32_t name_count)
+ {
+ gles_api_ts->driver->BindAttribLocation(yagl_gles_object_get(program),
+ index,
+ name);
+ }
+
- return GL_TRUE;
- } else {
- return GL_FALSE;
++void yagl_host_glGetActiveAttrib(GLuint program,
+ GLuint index,
+ GLint *size,
+ GLenum *type,
+ GLchar *name, int32_t name_maxcount, int32_t *name_count)
+ {
+ GLsizei tmp = -1;
+
+ gles_api_ts->driver->GetActiveAttrib(yagl_gles_object_get(program),
+ index,
+ name_maxcount,
+ &tmp,
+ size,
+ type,
+ name);
+
+ if (tmp >= 0) {
+ *name_count = MIN(tmp + 1, name_maxcount);
-GLboolean yagl_host_glGetActiveUniform(GLuint program,
+ }
+ }
+
- return GL_TRUE;
- } else {
- return GL_FALSE;
++void yagl_host_glGetActiveUniform(GLuint program,
+ GLuint index,
+ GLint *size,
+ GLenum *type,
+ GLchar *name, int32_t name_maxcount, int32_t *name_count)
+ {
+ GLsizei tmp = -1;
+
+ gles_api_ts->driver->GetActiveUniform(yagl_gles_object_get(program),
+ index,
+ name_maxcount,
+ &tmp,
+ size,
+ type,
+ name);
+
+ if (tmp >= 0) {
+ *name_count = MIN(tmp + 1, name_maxcount);
-void yagl_host_glLinkProgram(GLuint program)
+ }
+ }
+
+ int yagl_host_glGetAttribLocation(GLuint program,
+ const GLchar *name, int32_t name_count)
+ {
+ return gles_api_ts->driver->GetAttribLocation(yagl_gles_object_get(program),
+ name);
+ }
+
+ void yagl_host_glGetProgramiv(GLuint program,
+ GLenum pname,
+ GLint *param)
+ {
+ gles_api_ts->driver->GetProgramiv(yagl_gles_object_get(program),
+ pname,
+ param);
+ }
+
+ GLboolean yagl_host_glGetProgramInfoLog(GLuint program,
+ GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count)
+ {
+ GLsizei tmp = -1;
+
+ gles_api_ts->driver->GetProgramInfoLog(yagl_gles_object_get(program),
+ infolog_maxcount,
+ &tmp,
+ infolog);
+
+ if (tmp >= 0) {
+ *infolog_count = MIN(tmp + 1, infolog_maxcount);
+ return GL_TRUE;
+ } else {
+ return GL_FALSE;
+ }
+ }
+
+ void yagl_host_glGetShaderiv(GLuint shader,
+ GLenum pname,
+ GLint *param)
+ {
+ gles_api_ts->driver->GetShaderiv(yagl_gles_object_get(shader),
+ pname,
+ param);
+ }
+
+ GLboolean yagl_host_glGetShaderInfoLog(GLuint shader,
+ GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count)
+ {
+ GLsizei tmp = -1;
+
+ gles_api_ts->driver->GetShaderInfoLog(yagl_gles_object_get(shader),
+ infolog_maxcount,
+ &tmp,
+ infolog);
+
+ if (tmp >= 0) {
+ *infolog_count = MIN(tmp + 1, infolog_maxcount);
+ return GL_TRUE;
+ } else {
+ return GL_FALSE;
+ }
+ }
+
+ void yagl_host_glGetUniformfv(GLboolean tl,
+ GLuint program,
+ uint32_t location,
+ GLfloat *params, int32_t params_maxcount, int32_t *params_count)
+ {
+ GLenum type;
+ GLuint global_name = yagl_gles_object_get(program);
+ GLint actual_location = yagl_gles_api_ps_translate_location(gles_api_ts->ps,
+ tl,
+ location);
+
+ if (!yagl_gles_program_get_uniform_type(global_name,
+ actual_location,
+ &type)) {
+ return;
+ }
+
+ if (!yagl_gles_get_uniform_type_count(type, params_count)) {
+ return;
+ }
+
+ gles_api_ts->driver->GetUniformfv(global_name,
+ actual_location,
+ params);
+ }
+
+ void yagl_host_glGetUniformiv(GLboolean tl,
+ GLuint program,
+ uint32_t location,
+ GLint *params, int32_t params_maxcount, int32_t *params_count)
+ {
+ GLenum type;
+ GLuint global_name = yagl_gles_object_get(program);
+ GLint actual_location = yagl_gles_api_ps_translate_location(gles_api_ts->ps,
+ tl,
+ location);
+
+ if (!yagl_gles_program_get_uniform_type(global_name,
+ actual_location,
+ &type)) {
+ return;
+ }
+
+ if (!yagl_gles_get_uniform_type_count(type, params_count)) {
+ return;
+ }
+
+ gles_api_ts->driver->GetUniformiv(global_name,
+ actual_location,
+ params);
+ }
+
+ int yagl_host_glGetUniformLocation(GLuint program,
+ const GLchar *name, int32_t name_count)
+ {
+ return gles_api_ts->driver->GetUniformLocation(yagl_gles_object_get(program),
+ name);
+ }
+
+ void yagl_host_glGetVertexAttribfv(GLuint index,
+ GLenum pname,
+ GLfloat *params, int32_t params_maxcount, int32_t *params_count)
+ {
+ if (!yagl_gles_get_array_param_count(pname, params_count)) {
+ return;
+ }
+
+ gles_api_ts->driver->GetVertexAttribfv(index, pname, params);
+ }
+
+ void yagl_host_glGetVertexAttribiv(GLuint index,
+ GLenum pname,
+ GLint *params, int32_t params_maxcount, int32_t *params_count)
+ {
+ if (!yagl_gles_get_array_param_count(pname, params_count)) {
+ return;
+ }
+
+ gles_api_ts->driver->GetVertexAttribiv(index, pname, params);
+ }
+
- gles_api_ts->driver->LinkProgram(yagl_gles_object_get(program));
++void yagl_host_glLinkProgram(GLuint program,
++ GLint *params, int32_t params_maxcount, int32_t *params_count)
+ {
- const char *tmp = (const char*)gles_api_ts->driver->GetString(name);
++ GLuint obj = yagl_gles_object_get(program);
++
++ gles_api_ts->driver->LinkProgram(obj);
++
++ if (!params || (params_maxcount != 8)) {
++ return;
++ }
++
++ gles_api_ts->driver->GetProgramiv(obj, GL_LINK_STATUS, ¶ms[0]);
++ gles_api_ts->driver->GetProgramiv(obj, GL_INFO_LOG_LENGTH, ¶ms[1]);
++ gles_api_ts->driver->GetProgramiv(obj, GL_ACTIVE_ATTRIBUTES, ¶ms[2]);
++ gles_api_ts->driver->GetProgramiv(obj, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, ¶ms[3]);
++ gles_api_ts->driver->GetProgramiv(obj, GL_ACTIVE_UNIFORMS, ¶ms[4]);
++ gles_api_ts->driver->GetProgramiv(obj, GL_ACTIVE_UNIFORM_MAX_LENGTH, ¶ms[5]);
++
++ *params_count = 6;
++
++ if (gles_api_ts->driver->gl_version > yagl_gl_2) {
++ gles_api_ts->driver->GetProgramiv(obj, GL_ACTIVE_UNIFORM_BLOCKS, ¶ms[6]);
++ gles_api_ts->driver->GetProgramiv(obj, GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH, ¶ms[7]);
++
++ *params_count = 8;
++ }
+ }
+
+ void yagl_host_glUniform1f(GLboolean tl,
+ uint32_t location,
+ GLfloat x)
+ {
+ gles_api_ts->driver->Uniform1f(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), x);
+ }
+
+ void yagl_host_glUniform1fv(GLboolean tl,
+ uint32_t location,
+ const GLfloat *v, int32_t v_count)
+ {
+ gles_api_ts->driver->Uniform1fv(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ v_count, v);
+ }
+
+ void yagl_host_glUniform1i(GLboolean tl,
+ uint32_t location,
+ GLint x)
+ {
+ gles_api_ts->driver->Uniform1i(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ x);
+ }
+
+ void yagl_host_glUniform1iv(GLboolean tl,
+ uint32_t location,
+ const GLint *v, int32_t v_count)
+ {
+ gles_api_ts->driver->Uniform1iv(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ v_count, v);
+ }
+
+ void yagl_host_glUniform2f(GLboolean tl,
+ uint32_t location,
+ GLfloat x,
+ GLfloat y)
+ {
+ gles_api_ts->driver->Uniform2f(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ x, y);
+ }
+
+ void yagl_host_glUniform2fv(GLboolean tl,
+ uint32_t location,
+ const GLfloat *v, int32_t v_count)
+ {
+ gles_api_ts->driver->Uniform2fv(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ (v_count / 2), v);
+ }
+
+ void yagl_host_glUniform2i(GLboolean tl,
+ uint32_t location,
+ GLint x,
+ GLint y)
+ {
+ gles_api_ts->driver->Uniform2i(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ x, y);
+ }
+
+ void yagl_host_glUniform2iv(GLboolean tl,
+ uint32_t location,
+ const GLint *v, int32_t v_count)
+ {
+ gles_api_ts->driver->Uniform2iv(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ (v_count / 2), v);
+ }
+
+ void yagl_host_glUniform3f(GLboolean tl,
+ uint32_t location,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z)
+ {
+ gles_api_ts->driver->Uniform3f(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ x, y, z);
+ }
+
+ void yagl_host_glUniform3fv(GLboolean tl,
+ uint32_t location,
+ const GLfloat *v, int32_t v_count)
+ {
+ gles_api_ts->driver->Uniform3fv(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ (v_count / 3), v);
+ }
+
+ void yagl_host_glUniform3i(GLboolean tl,
+ uint32_t location,
+ GLint x,
+ GLint y,
+ GLint z)
+ {
+ gles_api_ts->driver->Uniform3i(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ x, y, z);
+ }
+
+ void yagl_host_glUniform3iv(GLboolean tl,
+ uint32_t location,
+ const GLint *v, int32_t v_count)
+ {
+ gles_api_ts->driver->Uniform3iv(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ (v_count / 3), v);
+ }
+
+ void yagl_host_glUniform4f(GLboolean tl,
+ uint32_t location,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat w)
+ {
+ gles_api_ts->driver->Uniform4f(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ x, y, z, w);
+ }
+
+ void yagl_host_glUniform4fv(GLboolean tl,
+ uint32_t location,
+ const GLfloat *v, int32_t v_count)
+ {
+ gles_api_ts->driver->Uniform4fv(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ (v_count / 4), v);
+ }
+
+ void yagl_host_glUniform4i(GLboolean tl,
+ uint32_t location,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLint w)
+ {
+ gles_api_ts->driver->Uniform4i(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ x, y, z, w);
+ }
+
+ void yagl_host_glUniform4iv(GLboolean tl,
+ uint32_t location,
+ const GLint *v, int32_t v_count)
+ {
+ gles_api_ts->driver->Uniform4iv(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ (v_count / 4), v);
+ }
+
+ void yagl_host_glUniformMatrix2fv(GLboolean tl,
+ uint32_t location,
+ GLboolean transpose,
+ const GLfloat *value, int32_t value_count)
+ {
+ gles_api_ts->driver->UniformMatrix2fv(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ value_count / (2 * 2), transpose, value);
+ }
+
+ void yagl_host_glUniformMatrix3fv(GLboolean tl,
+ uint32_t location,
+ GLboolean transpose,
+ const GLfloat *value, int32_t value_count)
+ {
+ gles_api_ts->driver->UniformMatrix3fv(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ value_count / (3 * 3), transpose, value);
+ }
+
+ void yagl_host_glUniformMatrix4fv(GLboolean tl,
+ uint32_t location,
+ GLboolean transpose,
+ const GLfloat *value, int32_t value_count)
+ {
+ gles_api_ts->driver->UniformMatrix4fv(
+ yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location),
+ value_count / (4 * 4), transpose, value);
+ }
+
+ void yagl_host_glUseProgram(GLuint program)
+ {
+ gles_api_ts->driver->UseProgram(yagl_gles_object_get(program));
+ }
+
+ void yagl_host_glValidateProgram(GLuint program)
+ {
+ gles_api_ts->driver->ValidateProgram(yagl_gles_object_get(program));
+ }
+
+ void yagl_host_glVertexAttrib1f(GLuint indx,
+ GLfloat x)
+ {
+ gles_api_ts->driver->VertexAttrib1f(indx, x);
+ }
+
+ void yagl_host_glVertexAttrib1fv(GLuint indx,
+ const GLfloat *values, int32_t values_count)
+ {
+ gles_api_ts->driver->VertexAttrib1fv(indx, values);
+ }
+
+ void yagl_host_glVertexAttrib2f(GLuint indx,
+ GLfloat x,
+ GLfloat y)
+ {
+ gles_api_ts->driver->VertexAttrib2f(indx, x, y);
+ }
+
+ void yagl_host_glVertexAttrib2fv(GLuint indx,
+ const GLfloat *values, int32_t values_count)
+ {
+ gles_api_ts->driver->VertexAttrib2fv(indx, values);
+ }
+
+ void yagl_host_glVertexAttrib3f(GLuint indx,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z)
+ {
+ gles_api_ts->driver->VertexAttrib3f(indx, x, y, z);
+ }
+
+ void yagl_host_glVertexAttrib3fv(GLuint indx,
+ const GLfloat *values, int32_t values_count)
+ {
+ gles_api_ts->driver->VertexAttrib3fv(indx, values);
+ }
+
+ void yagl_host_glVertexAttrib4f(GLuint indx,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat w)
+ {
+ gles_api_ts->driver->VertexAttrib4f(indx, x, y, z, w);
+ }
+
+ void yagl_host_glVertexAttrib4fv(GLuint indx,
+ const GLfloat *values, int32_t values_count)
+ {
+ gles_api_ts->driver->VertexAttrib4fv(indx, values);
+ }
+
++void yagl_host_glGetActiveUniformsiv(GLuint program,
++ const GLuint *uniformIndices, int32_t uniformIndices_count,
++ GLint *params, int32_t params_maxcount, int32_t *params_count)
++{
++ const GLenum pnames[] =
++ {
++ GL_UNIFORM_TYPE,
++ GL_UNIFORM_SIZE,
++ GL_UNIFORM_NAME_LENGTH,
++ GL_UNIFORM_BLOCK_INDEX,
++ GL_UNIFORM_OFFSET,
++ GL_UNIFORM_ARRAY_STRIDE,
++ GL_UNIFORM_MATRIX_STRIDE,
++ GL_UNIFORM_IS_ROW_MAJOR
++ };
++ GLuint obj = yagl_gles_object_get(program);
++ int i, num_pnames = sizeof(pnames)/sizeof(pnames[0]);
++
++ if (params_maxcount != (uniformIndices_count * num_pnames)) {
++ return;
++ }
++
++ for (i = 0; i < num_pnames; ++i) {
++ gles_api_ts->driver->GetActiveUniformsiv(obj,
++ uniformIndices_count,
++ uniformIndices,
++ pnames[i],
++ params);
++ params += uniformIndices_count;
++ }
++
++ *params_count = uniformIndices_count * num_pnames;
++}
++
++void yagl_host_glGetUniformIndices(GLuint program,
++ const GLchar *uniformNames, int32_t uniformNames_count,
++ GLuint *uniformIndices, int32_t uniformIndices_maxcount, int32_t *uniformIndices_count)
++{
++ GLuint obj = yagl_gles_object_get(program);
++ int max_active_uniform_bufsize = 1, i;
++ const GLchar **name_pointers;
++
++ gles_api_ts->driver->GetProgramiv(obj,
++ GL_ACTIVE_UNIFORM_MAX_LENGTH,
++ &max_active_uniform_bufsize);
++
++ name_pointers = g_malloc(uniformIndices_maxcount * sizeof(*name_pointers));
++
++ for (i = 0; i < uniformIndices_maxcount; ++i) {
++ name_pointers[i] = &uniformNames[max_active_uniform_bufsize * i];
++ }
++
++ gles_api_ts->driver->GetUniformIndices(obj,
++ uniformIndices_maxcount,
++ name_pointers,
++ uniformIndices);
++
++ g_free(name_pointers);
++
++ *uniformIndices_count = uniformIndices_maxcount;
++}
++
++GLuint yagl_host_glGetUniformBlockIndex(GLuint program,
++ const GLchar *uniformBlockName, int32_t uniformBlockName_count)
++{
++ return gles_api_ts->driver->GetUniformBlockIndex(yagl_gles_object_get(program),
++ uniformBlockName);
++}
++
++void yagl_host_glUniformBlockBinding(GLuint program,
++ GLuint uniformBlockIndex,
++ GLuint uniformBlockBinding)
++{
++ gles_api_ts->driver->UniformBlockBinding(yagl_gles_object_get(program),
++ uniformBlockIndex,
++ uniformBlockBinding);
++}
++
++void yagl_host_glGetActiveUniformBlockName(GLuint program,
++ GLuint uniformBlockIndex,
++ GLchar *uniformBlockName, int32_t uniformBlockName_maxcount, int32_t *uniformBlockName_count)
++{
++ GLsizei tmp = -1;
++
++ gles_api_ts->driver->GetActiveUniformBlockName(yagl_gles_object_get(program),
++ uniformBlockIndex,
++ uniformBlockName_maxcount,
++ &tmp,
++ uniformBlockName);
++
++ if (tmp >= 0) {
++ *uniformBlockName_count = MIN(tmp + 1, uniformBlockName_maxcount);
++ }
++}
++
++void yagl_host_glGetActiveUniformBlockiv(GLuint program,
++ GLuint uniformBlockIndex,
++ GLenum pname,
++ GLint *params, int32_t params_maxcount, int32_t *params_count)
++{
++ GLuint obj;
++ const GLenum pnames[] =
++ {
++ GL_UNIFORM_BLOCK_DATA_SIZE,
++ GL_UNIFORM_BLOCK_NAME_LENGTH,
++ GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS,
++ GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER,
++ GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER
++ };
++ int i, num_pnames = sizeof(pnames)/sizeof(pnames[0]);
++
++ if (!params) {
++ return;
++ }
++
++ obj = yagl_gles_object_get(program);
++
++ switch (pname) {
++ case 0:
++ /*
++ * Return everything else.
++ */
++ if (params_maxcount != num_pnames) {
++ return;
++ }
++
++ for (i = 0; i < num_pnames; ++i) {
++ gles_api_ts->driver->GetActiveUniformBlockiv(obj,
++ uniformBlockIndex,
++ pnames[i],
++ ¶ms[i]);
++ }
++
++ *params_count = num_pnames;
++
++ break;
++ case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
++ /*
++ * Return active uniform indices only.
++ */
++
++ gles_api_ts->driver->GetActiveUniformBlockiv(obj,
++ uniformBlockIndex,
++ GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES,
++ params);
++
++ *params_count = params_maxcount;
++
++ break;
++ default:
++ break;
++ }
++}
++
+ void yagl_host_glGetIntegerv(GLenum pname,
+ GLint *params, int32_t params_maxcount, int32_t *params_count)
+ {
+ gles_api_ts->driver->GetIntegerv(pname, params);
+
+ *params_count = params_maxcount;
+ }
+
+ void yagl_host_glGetFloatv(GLenum pname,
+ GLfloat *params, int32_t params_maxcount, int32_t *params_count)
+ {
+ gles_api_ts->driver->GetFloatv(pname, params);
+
+ *params_count = params_maxcount;
+ }
+
+ void yagl_host_glGetString(GLenum name,
+ GLchar *str, int32_t str_maxcount, int32_t *str_count)
+ {
++ const char *tmp;
++
++ if ((name == GL_EXTENSIONS) &&
++ (gles_api_ts->driver->gl_version > yagl_gl_2)) {
++ struct yagl_vector v;
++ GLint i, num_extensions = 0;
++ char nb = '\0';
++
++ yagl_vector_init(&v, 1, 0);
++
++ gles_api_ts->driver->GetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
++
++ for (i = 0; i < num_extensions; ++i) {
++ tmp = (const char*)gles_api_ts->driver->GetStringi(name, i);
++ int size = yagl_vector_size(&v);
++ int ext_len = strlen(tmp);
++
++ yagl_vector_resize(&v, size + ext_len + 1);
++
++ memcpy(yagl_vector_data(&v) + size, tmp, ext_len);
++
++ *(char*)(yagl_vector_data(&v) + size + ext_len) = ' ';
++ }
++
++ yagl_vector_push_back(&v, &nb);
++
++ tmp = yagl_vector_data(&v);
++
++ if (str_count) {
++ *str_count = strlen(tmp) + 1;
++ }
++
++ if (str && (str_maxcount > 0)) {
++ strncpy(str, tmp, str_maxcount);
++ str[str_maxcount - 1] = '\0';
++ }
++
++ yagl_vector_cleanup(&v);
++
++ return;
++ }
++
++ tmp = (const char*)gles_api_ts->driver->GetString(name);
+
+ if (str_count) {
+ *str_count = strlen(tmp) + 1;
+ }
+
+ if (str && (str_maxcount > 0)) {
+ strncpy(str, tmp, str_maxcount);
+ str[str_maxcount - 1] = '\0';
+ }
+ }
+
+ GLboolean yagl_host_glIsEnabled(GLenum cap)
+ {
+ return gles_api_ts->driver->IsEnabled(cap);
+ }
+
++void yagl_host_glGenTransformFeedbacks(const GLuint *ids, int32_t ids_count)
++{
++ int i;
++
++ for (i = 0; i < ids_count; ++i) {
++ GLuint global_name;
++
++ gles_api_ts->driver->GenTransformFeedbacks(1, &global_name);
++
++ yagl_gles_object_add(ids[i],
++ global_name,
++ yagl_get_ctx_id(),
++ &yagl_gles_transform_feedback_destroy);
++ }
++}
++
++void yagl_host_glBindTransformFeedback(GLenum target,
++ GLuint id)
++{
++ gles_api_ts->driver->BindTransformFeedback(target,
++ yagl_gles_object_get(id));
++}
++
++void yagl_host_glBeginTransformFeedback(GLenum primitiveMode)
++{
++ gles_api_ts->driver->BeginTransformFeedback(primitiveMode);
++}
++
++void yagl_host_glEndTransformFeedback(void)
++{
++ gles_api_ts->driver->EndTransformFeedback();
++}
++
++void yagl_host_glPauseTransformFeedback(void)
++{
++ gles_api_ts->driver->PauseTransformFeedback();
++}
++
++void yagl_host_glResumeTransformFeedback(void)
++{
++ gles_api_ts->driver->ResumeTransformFeedback();
++}
++
++void yagl_host_glTransformFeedbackVaryings(GLuint program,
++ const GLchar *varyings, int32_t varyings_count,
++ GLenum bufferMode)
++{
++ const char **strings;
++ int32_t num_strings = 0;
++
++ strings = yagl_transport_get_out_string_array(varyings,
++ varyings_count,
++ &num_strings);
++
++ gles_api_ts->driver->TransformFeedbackVaryings(yagl_gles_object_get(program),
++ num_strings,
++ strings,
++ bufferMode);
++
++ g_free(strings);
++}
++
++void yagl_host_glGetTransformFeedbackVaryings(GLuint program,
++ GLsizei *sizes, int32_t sizes_maxcount, int32_t *sizes_count,
++ GLenum *types, int32_t types_maxcount, int32_t *types_count)
++{
++ GLuint obj = yagl_gles_object_get(program);
++ int32_t i;
++
++ if (sizes_maxcount != types_maxcount) {
++ return;
++ }
++
++ for (i = 0; i < sizes_maxcount; ++i) {
++ GLsizei length = -1;
++ GLchar c[2];
++
++ gles_api_ts->driver->GetTransformFeedbackVarying(obj,
++ i, sizeof(c), &length,
++ &sizes[i], &types[i],
++ c);
++
++ if (length <= 0) {
++ sizes[i] = 0;
++ types[i] = 0;
++ }
++ }
++
++ *sizes_count = *types_count = sizes_maxcount;
++}
++
++void yagl_host_glGenQueries(const GLuint *ids, int32_t ids_count)
++{
++ int i;
++
++ for (i = 0; i < ids_count; ++i) {
++ GLuint global_name;
++
++ gles_api_ts->driver->GenQueries(1, &global_name);
++
++ yagl_gles_object_add(ids[i],
++ global_name,
++ yagl_get_ctx_id(),
++ &yagl_gles_query_destroy);
++ }
++}
++
++void yagl_host_glBeginQuery(GLenum target,
++ GLuint id)
++{
++ gles_api_ts->driver->BeginQuery(target, yagl_gles_object_get(id));
++}
++
++void yagl_host_glEndQuery(GLenum target)
++{
++ gles_api_ts->driver->EndQuery(target);
++}
++
++GLboolean yagl_host_glGetQueryObjectuiv(GLuint id,
++ GLuint *result)
++{
++ GLuint obj = yagl_gles_object_get(id);
++ GLuint tmp = 0;
++
++ gles_api_ts->driver->GetQueryObjectuiv(obj, GL_QUERY_RESULT_AVAILABLE, &tmp);
++
++ if (tmp) {
++ gles_api_ts->driver->GetQueryObjectuiv(obj, GL_QUERY_RESULT, result);
++ }
++
++ return tmp;
++}
++
+ void yagl_host_glDeleteObjects(const GLuint *objects, int32_t objects_count)
+ {
+ int i;
+
+ for (i = 0; i < objects_count; ++i) {
+ yagl_object_map_remove(cur_ts->ps->object_map, objects[i]);
+ }
+ }
+
+ void yagl_host_glBlendEquation(GLenum mode)
+ {
+ gles_api_ts->driver->BlendEquation(mode);
+ }
+
+ void yagl_host_glBlendEquationSeparate(GLenum modeRGB,
+ GLenum modeAlpha)
+ {
+ gles_api_ts->driver->BlendEquationSeparate(modeRGB, modeAlpha);
+ }
+
+ void yagl_host_glBlendFunc(GLenum sfactor,
+ GLenum dfactor)
+ {
+ gles_api_ts->driver->BlendFunc(sfactor, dfactor);
+ }
+
+ void yagl_host_glBlendFuncSeparate(GLenum srcRGB,
+ GLenum dstRGB,
+ GLenum srcAlpha,
+ GLenum dstAlpha)
+ {
+ gles_api_ts->driver->BlendFuncSeparate(srcRGB,
+ dstRGB,
+ srcAlpha,
+ dstAlpha);
+ }
+
+ void yagl_host_glBlendColor(GLclampf red,
+ GLclampf green,
+ GLclampf blue,
+ GLclampf alpha)
+ {
+ gles_api_ts->driver->BlendColor(red, green, blue, alpha);
+ }
+
+ void yagl_host_glClear(GLbitfield mask)
+ {
+ gles_api_ts->driver->Clear(mask);
+ }
+
+ void yagl_host_glClearColor(GLclampf red,
+ GLclampf green,
+ GLclampf blue,
+ GLclampf alpha)
+ {
+ gles_api_ts->driver->ClearColor(red, green, blue, alpha);
+ }
+
+ void yagl_host_glClearDepthf(GLclampf depth)
+ {
+ gles_api_ts->driver->ClearDepth(depth);
+ }
+
+ void yagl_host_glClearStencil(GLint s)
+ {
+ gles_api_ts->driver->ClearStencil(s);
+ }
+
+ void yagl_host_glColorMask(GLboolean red,
+ GLboolean green,
+ GLboolean blue,
+ GLboolean alpha)
+ {
+ gles_api_ts->driver->ColorMask(red, green, blue, alpha);
+ }
+
+ void yagl_host_glCullFace(GLenum mode)
+ {
+ gles_api_ts->driver->CullFace(mode);
+ }
+
+ void yagl_host_glDepthFunc(GLenum func)
+ {
+ gles_api_ts->driver->DepthFunc(func);
+ }
+
+ void yagl_host_glDepthMask(GLboolean flag)
+ {
+ gles_api_ts->driver->DepthMask(flag);
+ }
+
+ void yagl_host_glDepthRangef(GLclampf zNear,
+ GLclampf zFar)
+ {
+ gles_api_ts->driver->DepthRange(zNear, zFar);
+ }
+
+ void yagl_host_glEnable(GLenum cap)
+ {
+ gles_api_ts->driver->Enable(cap);
+ }
+
+ void yagl_host_glDisable(GLenum cap)
+ {
+ gles_api_ts->driver->Disable(cap);
+ }
+
+ void yagl_host_glFlush(void)
+ {
+ gles_api_ts->driver->Flush();
+ }
+
+ void yagl_host_glFrontFace(GLenum mode)
+ {
+ gles_api_ts->driver->FrontFace(mode);
+ }
+
+ void yagl_host_glGenerateMipmap(GLenum target)
+ {
+ gles_api_ts->driver->GenerateMipmap(target);
+ }
+
+ void yagl_host_glHint(GLenum target,
+ GLenum mode)
+ {
+ gles_api_ts->driver->Hint(target, mode);
+ }
+
+ void yagl_host_glLineWidth(GLfloat width)
+ {
+ gles_api_ts->driver->LineWidth(width);
+ }
+
+ void yagl_host_glPixelStorei(GLenum pname,
+ GLint param)
+ {
+ gles_api_ts->driver->PixelStorei(pname, param);
+ }
+
+ void yagl_host_glPolygonOffset(GLfloat factor,
+ GLfloat units)
+ {
+ gles_api_ts->driver->PolygonOffset(factor, units);
+ }
+
+ void yagl_host_glScissor(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+ {
+ gles_api_ts->driver->Scissor(x, y, width, height);
+ }
+
+ void yagl_host_glStencilFunc(GLenum func,
+ GLint ref,
+ GLuint mask)
+ {
+ gles_api_ts->driver->StencilFunc(func, ref, mask);
+ }
+
+ void yagl_host_glStencilMask(GLuint mask)
+ {
+ gles_api_ts->driver->StencilMask(mask);
+ }
+
+ void yagl_host_glStencilOp(GLenum fail,
+ GLenum zfail,
+ GLenum zpass)
+ {
+ gles_api_ts->driver->StencilOp(fail, zfail, zpass);
+ }
+
+ void yagl_host_glSampleCoverage(GLclampf value,
+ GLboolean invert)
+ {
+ gles_api_ts->driver->SampleCoverage(value, invert);
+ }
+
+ void yagl_host_glViewport(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height)
+ {
+ gles_api_ts->driver->Viewport(x, y, width, height);
+ }
+
+ void yagl_host_glStencilFuncSeparate(GLenum face,
+ GLenum func,
+ GLint ref,
+ GLuint mask)
+ {
+ gles_api_ts->driver->StencilFuncSeparate(face, func, ref, mask);
+ }
+
+ void yagl_host_glStencilMaskSeparate(GLenum face,
+ GLuint mask)
+ {
+ gles_api_ts->driver->StencilMaskSeparate(face, mask);
+ }
+
+ void yagl_host_glStencilOpSeparate(GLenum face,
+ GLenum fail,
+ GLenum zfail,
+ GLenum zpass)
+ {
+ gles_api_ts->driver->StencilOpSeparate(face, fail, zfail, zpass);
+ }
+
+ void yagl_host_glPointSize(GLfloat size)
+ {
+ gles_api_ts->driver->PointSize(size);
+ }
+
+ void yagl_host_glAlphaFunc(GLenum func,
+ GLclampf ref)
+ {
+ gles_api_ts->driver->AlphaFunc(func, ref);
+ }
+
+ void yagl_host_glMatrixMode(GLenum mode)
+ {
+ gles_api_ts->driver->MatrixMode(mode);
+ }
+
+ void yagl_host_glLoadIdentity(void)
+ {
+ gles_api_ts->driver->LoadIdentity();
+ }
+
+ void yagl_host_glPopMatrix(void)
+ {
+ gles_api_ts->driver->PopMatrix();
+ }
+
+ void yagl_host_glPushMatrix(void)
+ {
+ gles_api_ts->driver->PushMatrix();
+ }
+
+ void yagl_host_glRotatef(GLfloat angle,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z)
+ {
+ gles_api_ts->driver->Rotatef(angle, x, y, z);
+ }
+
+ void yagl_host_glTranslatef(GLfloat x,
+ GLfloat y,
+ GLfloat z)
+ {
+ gles_api_ts->driver->Translatef(x, y, z);
+ }
+
+ void yagl_host_glScalef(GLfloat x,
+ GLfloat y,
+ GLfloat z)
+ {
+ gles_api_ts->driver->Scalef(x, y, z);
+ }
+
+ void yagl_host_glOrthof(GLfloat left,
+ GLfloat right,
+ GLfloat bottom,
+ GLfloat top,
+ GLfloat zNear,
+ GLfloat zFar)
+ {
+ gles_api_ts->driver->Ortho(left, right, bottom, top, zNear, zFar);
+ }
+
+ void yagl_host_glColor4f(GLfloat red,
+ GLfloat green,
+ GLfloat blue,
+ GLfloat alpha)
+ {
+ gles_api_ts->driver->Color4f(red, green, blue, alpha);
+ }
+
+ void yagl_host_glColor4ub(GLubyte red,
+ GLubyte green,
+ GLubyte blue,
+ GLubyte alpha)
+ {
+ gles_api_ts->driver->Color4ub(red, green, blue, alpha);
+ }
+
+ void yagl_host_glNormal3f(GLfloat nx,
+ GLfloat ny,
+ GLfloat nz)
+ {
+ gles_api_ts->driver->Normal3f(nx, ny, nz);
+ }
+
+ void yagl_host_glPointParameterf(GLenum pname,
+ GLfloat param)
+ {
+ gles_api_ts->driver->PointParameterf(pname, param);
+ }
+
+ void yagl_host_glPointParameterfv(GLenum pname,
+ const GLfloat *params, int32_t params_count)
+ {
+ gles_api_ts->driver->PointParameterfv(pname, params);
+ }
+
+ void yagl_host_glFogf(GLenum pname,
+ GLfloat param)
+ {
+ gles_api_ts->driver->Fogf(pname, param);
+ }
+
+ void yagl_host_glFogfv(GLenum pname,
+ const GLfloat *params, int32_t params_count)
+ {
+ gles_api_ts->driver->Fogfv(pname, params);
+ }
+
+ void yagl_host_glFrustumf(GLfloat left,
+ GLfloat right,
+ GLfloat bottom,
+ GLfloat top,
+ GLfloat zNear,
+ GLfloat zFar)
+ {
+ gles_api_ts->driver->Frustum(left, right, bottom, top, zNear, zFar);
+ }
+
+ void yagl_host_glLightf(GLenum light,
+ GLenum pname,
+ GLfloat param)
+ {
+ gles_api_ts->driver->Lightf(light, pname, param);
+ }
+
+ void yagl_host_glLightfv(GLenum light,
+ GLenum pname,
+ const GLfloat *params, int32_t params_count)
+ {
+ gles_api_ts->driver->Lightfv(light, pname, params);
+ }
+
+ void yagl_host_glGetLightfv(GLenum light,
+ GLenum pname,
+ GLfloat *params, int32_t params_maxcount, int32_t *params_count)
+ {
+ gles_api_ts->driver->GetLightfv(light, pname, params);
+ *params_count = params_maxcount;
+ }
+
+ void yagl_host_glLightModelf(GLenum pname,
+ GLfloat param)
+ {
+ gles_api_ts->driver->LightModelf(pname, param);
+ }
+
+ void yagl_host_glLightModelfv(GLenum pname,
+ const GLfloat *params, int32_t params_count)
+ {
+ gles_api_ts->driver->LightModelfv(pname, params);
+ }
+
+ void yagl_host_glMaterialf(GLenum face,
+ GLenum pname,
+ GLfloat param)
+ {
+ gles_api_ts->driver->Materialf(face, pname, param);
+ }
+
+ void yagl_host_glMaterialfv(GLenum face,
+ GLenum pname,
+ const GLfloat *params, int32_t params_count)
+ {
+ gles_api_ts->driver->Materialfv(face, pname, params);
+ }
+
+ void yagl_host_glGetMaterialfv(GLenum face,
+ GLenum pname,
+ GLfloat *params, int32_t params_maxcount, int32_t *params_count)
+ {
+ gles_api_ts->driver->GetMaterialfv(face, pname, params);
+ *params_count = params_maxcount;
+ }
+
+ void yagl_host_glShadeModel(GLenum mode)
+ {
+ gles_api_ts->driver->ShadeModel(mode);
+ }
+
+ void yagl_host_glLogicOp(GLenum opcode)
+ {
+ gles_api_ts->driver->LogicOp(opcode);
+ }
+
+ void yagl_host_glMultMatrixf(const GLfloat *m, int32_t m_count)
+ {
+ gles_api_ts->driver->MultMatrixf(m);
+ }
+
+ void yagl_host_glLoadMatrixf(const GLfloat *m, int32_t m_count)
+ {
+ gles_api_ts->driver->LoadMatrixf(m);
+ }
+
+ void yagl_host_glClipPlanef(GLenum plane,
+ const GLfloat *equation, int32_t equation_count)
+ {
+ yagl_GLdouble equationd[4];
+
+ if (equation) {
+ equationd[0] = equation[0];
+ equationd[1] = equation[1];
+ equationd[2] = equation[2];
+ equationd[3] = equation[3];
+ gles_api_ts->driver->ClipPlane(plane, equationd);
+ } else {
+ gles_api_ts->driver->ClipPlane(plane, NULL);
+ }
+ }
+
+ void yagl_host_glGetClipPlanef(GLenum pname,
+ GLfloat *eqn, int32_t eqn_maxcount, int32_t *eqn_count)
+ {
+ yagl_GLdouble eqnd[4];
+
+ gles_api_ts->driver->GetClipPlane(pname, eqnd);
+
+ if (eqn) {
+ eqn[0] = eqnd[0];
+ eqn[1] = eqnd[1];
+ eqn[2] = eqnd[2];
+ eqn[3] = eqnd[3];
+ *eqn_count = 4;
+ }
+ }
+
+ void yagl_host_glUpdateOffscreenImageYAGL(GLuint texture,
+ uint32_t width,
+ uint32_t height,
+ uint32_t bpp,
+ const void *pixels, int32_t pixels_count)
+ {
+ GLenum format = 0;
+ GLuint cur_tex = 0;
+ GLsizei unpack_alignment = 0;
+
+ YAGL_LOG_FUNC_SET(glUpdateOffscreenImageYAGL);
+
+ switch (bpp) {
+ case 3:
+ format = GL_RGB;
+ break;
+ case 4:
+ format = GL_BGRA;
+ break;
+ default:
+ YAGL_LOG_ERROR("bad bpp - %u", bpp);
+ return;
+ }
+
+ gles_api_ts->driver->GetIntegerv(GL_TEXTURE_BINDING_2D,
+ (GLint*)&cur_tex);
+
+ gles_api_ts->driver->GetIntegerv(GL_UNPACK_ALIGNMENT,
+ &unpack_alignment);
+
+ gles_api_ts->driver->PixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
+ gles_api_ts->driver->BindTexture(GL_TEXTURE_2D,
+ yagl_gles_object_get(texture));
+
+ gles_api_ts->driver->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ gles_api_ts->driver->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+ gles_api_ts->driver->TexImage2D(GL_TEXTURE_2D,
+ 0,
+ GL_RGB,
+ width,
+ height,
+ 0,
+ format,
+ GL_UNSIGNED_INT_8_8_8_8_REV,
+ pixels);
+
+ gles_api_ts->driver->PixelStorei(GL_UNPACK_ALIGNMENT,
+ unpack_alignment);
+
+ gles_api_ts->driver->BindTexture(GL_TEXTURE_2D, cur_tex);
+ }
+
+ void yagl_host_glGenUniformLocationYAGL(uint32_t location,
+ GLuint program,
+ const GLchar *name, int32_t name_count)
+ {
+ yagl_gles_api_ps_add_location(gles_api_ts->ps,
+ location,
+ gles_api_ts->driver->GetUniformLocation(yagl_gles_object_get(program), name));
+ }
+
+ void yagl_host_glDeleteUniformLocationsYAGL(const uint32_t *locations, int32_t locations_count)
+ {
+ int i;
+
+ for (i = 0; i < locations_count; ++i) {
+ yagl_gles_api_ps_remove_location(gles_api_ts->ps, locations[i]);
+ }
+ }
--- /dev/null
-GLboolean yagl_host_glGetActiveAttrib(GLuint program,
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #ifndef _QEMU_YAGL_HOST_GLES_CALLS_H
+ #define _QEMU_YAGL_HOST_GLES_CALLS_H
+
+ #include "yagl_api.h"
+ #include <GL/gl.h>
+
+ struct yagl_api_ps *yagl_host_gles_process_init(struct yagl_api *api);
+
+ void yagl_host_glDrawArrays(GLenum mode,
+ GLint first,
+ GLsizei count);
+ void yagl_host_glDrawElements(GLenum mode,
+ GLsizei count,
+ GLenum type,
+ const GLvoid *indices, int32_t indices_count);
+ void yagl_host_glReadPixels(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ GLvoid *pixels, int32_t pixels_maxcount, int32_t *pixels_count);
++void yagl_host_glDrawArraysInstanced(GLenum mode,
++ GLint start,
++ GLsizei count,
++ GLsizei primcount);
++void yagl_host_glDrawElementsInstanced(GLenum mode,
++ GLsizei count,
++ GLenum type,
++ const void *indices, int32_t indices_count,
++ GLsizei primcount);
++void yagl_host_glGenVertexArrays(const GLuint *arrays, int32_t arrays_count);
++void yagl_host_glBindVertexArray(GLuint array);
+ void yagl_host_glDisableVertexAttribArray(GLuint index);
+ void yagl_host_glEnableVertexAttribArray(GLuint index);
+ void yagl_host_glVertexAttribPointerData(GLuint indx,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLsizei stride,
+ GLint first,
+ const GLvoid *data, int32_t data_count);
+ void yagl_host_glVertexAttribPointerOffset(GLuint indx,
+ GLint size,
+ GLenum type,
+ GLboolean normalized,
+ GLsizei stride,
+ GLsizei offset);
+ void yagl_host_glVertexPointerData(GLint size,
+ GLenum type,
+ GLsizei stride,
+ GLint first,
+ const GLvoid *data, int32_t data_count);
+ void yagl_host_glVertexPointerOffset(GLint size,
+ GLenum type,
+ GLsizei stride,
+ GLsizei offset);
+ void yagl_host_glNormalPointerData(GLenum type,
+ GLsizei stride,
+ GLint first,
+ const GLvoid *data, int32_t data_count);
+ void yagl_host_glNormalPointerOffset(GLenum type,
+ GLsizei stride,
+ GLsizei offset);
+ void yagl_host_glColorPointerData(GLint size,
+ GLenum type,
+ GLsizei stride,
+ GLint first,
+ const GLvoid *data, int32_t data_count);
+ void yagl_host_glColorPointerOffset(GLint size,
+ GLenum type,
+ GLsizei stride,
+ GLsizei offset);
+ void yagl_host_glTexCoordPointerData(GLint tex_id,
+ GLint size,
+ GLenum type,
+ GLsizei stride,
+ GLint first,
+ const GLvoid *data, int32_t data_count);
+ void yagl_host_glTexCoordPointerOffset(GLint size,
+ GLenum type,
+ GLsizei stride,
+ GLsizei offset);
+ void yagl_host_glDisableClientState(GLenum array);
+ void yagl_host_glEnableClientState(GLenum array);
++void yagl_host_glVertexAttribDivisor(GLuint index,
++ GLuint divisor);
+ void yagl_host_glGenBuffers(const GLuint *buffers, int32_t buffers_count);
+ void yagl_host_glBindBuffer(GLenum target,
+ GLuint buffer);
+ void yagl_host_glBufferData(GLenum target,
+ const GLvoid *data, int32_t data_count,
+ GLenum usage);
+ void yagl_host_glBufferSubData(GLenum target,
+ GLsizei offset,
+ const GLvoid *data, int32_t data_count);
++void yagl_host_glBindBufferBase(GLenum target,
++ GLuint index,
++ GLuint buffer);
++void yagl_host_glBindBufferRange(GLenum target,
++ GLuint index,
++ GLuint buffer,
++ GLint offset,
++ GLsizei size);
+ void yagl_host_glGenTextures(const GLuint *textures, int32_t textures_count);
+ void yagl_host_glBindTexture(GLenum target,
+ GLuint texture);
+ void yagl_host_glActiveTexture(GLenum texture);
+ void yagl_host_glCompressedTexImage2D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ const GLvoid *data, int32_t data_count);
+ void yagl_host_glCompressedTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ const GLvoid *data, int32_t data_count);
+ void yagl_host_glCopyTexImage2D(GLenum target,
+ GLint level,
+ GLenum internalformat,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height,
+ GLint border);
+ void yagl_host_glCopyTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+ void yagl_host_glGetTexParameterfv(GLenum target,
+ GLenum pname,
+ GLfloat *param);
+ void yagl_host_glGetTexParameteriv(GLenum target,
+ GLenum pname,
+ GLint *param);
+ void yagl_host_glTexImage2D(GLenum target,
+ GLint level,
+ GLint internalformat,
+ GLsizei width,
+ GLsizei height,
+ GLint border,
+ GLenum format,
+ GLenum type,
+ const GLvoid *pixels, int32_t pixels_count);
+ void yagl_host_glTexParameterf(GLenum target,
+ GLenum pname,
+ GLfloat param);
+ void yagl_host_glTexParameterfv(GLenum target,
+ GLenum pname,
+ const GLfloat *params, int32_t params_count);
+ void yagl_host_glTexParameteri(GLenum target,
+ GLenum pname,
+ GLint param);
+ void yagl_host_glTexParameteriv(GLenum target,
+ GLenum pname,
+ const GLint *params, int32_t params_count);
+ void yagl_host_glTexSubImage2D(GLenum target,
+ GLint level,
+ GLint xoffset,
+ GLint yoffset,
+ GLsizei width,
+ GLsizei height,
+ GLenum format,
+ GLenum type,
+ const GLvoid *pixels, int32_t pixels_count);
+ void yagl_host_glClientActiveTexture(GLenum texture);
+ void yagl_host_glTexEnvi(GLenum target,
+ GLenum pname,
+ GLint param);
+ void yagl_host_glTexEnvf(GLenum target,
+ GLenum pname,
+ GLfloat param);
+ void yagl_host_glMultiTexCoord4f(GLenum target,
+ GLfloat s,
+ GLfloat tt,
+ GLfloat r,
+ GLfloat q);
+ void yagl_host_glTexEnviv(GLenum target,
+ GLenum pname,
+ const GLint *params, int32_t params_count);
+ void yagl_host_glTexEnvfv(GLenum target,
+ GLenum pname,
+ const GLfloat *params, int32_t params_count);
+ void yagl_host_glGetTexEnviv(GLenum env,
+ GLenum pname,
+ GLint *params, int32_t params_maxcount, int32_t *params_count);
+ void yagl_host_glGetTexEnvfv(GLenum env,
+ GLenum pname,
+ GLfloat *params, int32_t params_maxcount, int32_t *params_count);
+ void yagl_host_glGenFramebuffers(const GLuint *framebuffers, int32_t framebuffers_count);
+ void yagl_host_glBindFramebuffer(GLenum target,
+ GLuint framebuffer);
+ void yagl_host_glFramebufferTexture2D(GLenum target,
+ GLenum attachment,
+ GLenum textarget,
+ GLuint texture,
+ GLint level);
+ void yagl_host_glFramebufferRenderbuffer(GLenum target,
+ GLenum attachment,
+ GLenum renderbuffertarget,
+ GLuint renderbuffer);
++void yagl_host_glBlitFramebuffer(GLint srcX0,
++ GLint srcY0,
++ GLint srcX1,
++ GLint srcY1,
++ GLint dstX0,
++ GLint dstY0,
++ GLint dstX1,
++ GLint dstY1,
++ GLbitfield mask,
++ GLenum filter);
++void yagl_host_glDrawBuffers(const GLenum *bufs, int32_t bufs_count);
+ void yagl_host_glGenRenderbuffers(const GLuint *renderbuffers, int32_t renderbuffers_count);
+ void yagl_host_glBindRenderbuffer(GLenum target,
+ GLuint renderbuffer);
+ void yagl_host_glRenderbufferStorage(GLenum target,
+ GLenum internalformat,
+ GLsizei width,
+ GLsizei height);
+ void yagl_host_glGetRenderbufferParameteriv(GLenum target,
+ GLenum pname,
+ GLint *param);
+ void yagl_host_glCreateProgram(GLuint program);
+ void yagl_host_glCreateShader(GLuint shader,
+ GLenum type);
+ void yagl_host_glShaderSource(GLuint shader,
+ const GLchar *string, int32_t string_count);
+ void yagl_host_glAttachShader(GLuint program,
+ GLuint shader);
+ void yagl_host_glDetachShader(GLuint program,
+ GLuint shader);
+ void yagl_host_glCompileShader(GLuint shader);
+ void yagl_host_glBindAttribLocation(GLuint program,
+ GLuint index,
+ const GLchar *name, int32_t name_count);
-GLboolean yagl_host_glGetActiveUniform(GLuint program,
++void yagl_host_glGetActiveAttrib(GLuint program,
+ GLuint index,
+ GLint *size,
+ GLenum *type,
+ GLchar *name, int32_t name_maxcount, int32_t *name_count);
-void yagl_host_glLinkProgram(GLuint program);
++void yagl_host_glGetActiveUniform(GLuint program,
+ GLuint index,
+ GLint *size,
+ GLenum *type,
+ GLchar *name, int32_t name_maxcount, int32_t *name_count);
+ int yagl_host_glGetAttribLocation(GLuint program,
+ const GLchar *name, int32_t name_count);
+ void yagl_host_glGetProgramiv(GLuint program,
+ GLenum pname,
+ GLint *param);
+ GLboolean yagl_host_glGetProgramInfoLog(GLuint program,
+ GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count);
+ void yagl_host_glGetShaderiv(GLuint shader,
+ GLenum pname,
+ GLint *param);
+ GLboolean yagl_host_glGetShaderInfoLog(GLuint shader,
+ GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count);
+ void yagl_host_glGetUniformfv(GLboolean tl,
+ GLuint program,
+ uint32_t location,
+ GLfloat *params, int32_t params_maxcount, int32_t *params_count);
+ void yagl_host_glGetUniformiv(GLboolean tl,
+ GLuint program,
+ uint32_t location,
+ GLint *params, int32_t params_maxcount, int32_t *params_count);
+ int yagl_host_glGetUniformLocation(GLuint program,
+ const GLchar *name, int32_t name_count);
+ void yagl_host_glGetVertexAttribfv(GLuint index,
+ GLenum pname,
+ GLfloat *params, int32_t params_maxcount, int32_t *params_count);
+ void yagl_host_glGetVertexAttribiv(GLuint index,
+ GLenum pname,
+ GLint *params, int32_t params_maxcount, int32_t *params_count);
++void yagl_host_glLinkProgram(GLuint program,
++ GLint *params, int32_t params_maxcount, int32_t *params_count);
+ void yagl_host_glUniform1f(GLboolean tl,
+ uint32_t location,
+ GLfloat x);
+ void yagl_host_glUniform1fv(GLboolean tl,
+ uint32_t location,
+ const GLfloat *v, int32_t v_count);
+ void yagl_host_glUniform1i(GLboolean tl,
+ uint32_t location,
+ GLint x);
+ void yagl_host_glUniform1iv(GLboolean tl,
+ uint32_t location,
+ const GLint *v, int32_t v_count);
+ void yagl_host_glUniform2f(GLboolean tl,
+ uint32_t location,
+ GLfloat x,
+ GLfloat y);
+ void yagl_host_glUniform2fv(GLboolean tl,
+ uint32_t location,
+ const GLfloat *v, int32_t v_count);
+ void yagl_host_glUniform2i(GLboolean tl,
+ uint32_t location,
+ GLint x,
+ GLint y);
+ void yagl_host_glUniform2iv(GLboolean tl,
+ uint32_t location,
+ const GLint *v, int32_t v_count);
+ void yagl_host_glUniform3f(GLboolean tl,
+ uint32_t location,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z);
+ void yagl_host_glUniform3fv(GLboolean tl,
+ uint32_t location,
+ const GLfloat *v, int32_t v_count);
+ void yagl_host_glUniform3i(GLboolean tl,
+ uint32_t location,
+ GLint x,
+ GLint y,
+ GLint z);
+ void yagl_host_glUniform3iv(GLboolean tl,
+ uint32_t location,
+ const GLint *v, int32_t v_count);
+ void yagl_host_glUniform4f(GLboolean tl,
+ uint32_t location,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat w);
+ void yagl_host_glUniform4fv(GLboolean tl,
+ uint32_t location,
+ const GLfloat *v, int32_t v_count);
+ void yagl_host_glUniform4i(GLboolean tl,
+ uint32_t location,
+ GLint x,
+ GLint y,
+ GLint z,
+ GLint w);
+ void yagl_host_glUniform4iv(GLboolean tl,
+ uint32_t location,
+ const GLint *v, int32_t v_count);
+ void yagl_host_glUniformMatrix2fv(GLboolean tl,
+ uint32_t location,
+ GLboolean transpose,
+ const GLfloat *value, int32_t value_count);
+ void yagl_host_glUniformMatrix3fv(GLboolean tl,
+ uint32_t location,
+ GLboolean transpose,
+ const GLfloat *value, int32_t value_count);
+ void yagl_host_glUniformMatrix4fv(GLboolean tl,
+ uint32_t location,
+ GLboolean transpose,
+ const GLfloat *value, int32_t value_count);
+ void yagl_host_glUseProgram(GLuint program);
+ void yagl_host_glValidateProgram(GLuint program);
+ void yagl_host_glVertexAttrib1f(GLuint indx,
+ GLfloat x);
+ void yagl_host_glVertexAttrib1fv(GLuint indx,
+ const GLfloat *values, int32_t values_count);
+ void yagl_host_glVertexAttrib2f(GLuint indx,
+ GLfloat x,
+ GLfloat y);
+ void yagl_host_glVertexAttrib2fv(GLuint indx,
+ const GLfloat *values, int32_t values_count);
+ void yagl_host_glVertexAttrib3f(GLuint indx,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z);
+ void yagl_host_glVertexAttrib3fv(GLuint indx,
+ const GLfloat *values, int32_t values_count);
+ void yagl_host_glVertexAttrib4f(GLuint indx,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z,
+ GLfloat w);
+ void yagl_host_glVertexAttrib4fv(GLuint indx,
+ const GLfloat *values, int32_t values_count);
++void yagl_host_glGetActiveUniformsiv(GLuint program,
++ const GLuint *uniformIndices, int32_t uniformIndices_count,
++ GLint *params, int32_t params_maxcount, int32_t *params_count);
++void yagl_host_glGetUniformIndices(GLuint program,
++ const GLchar *uniformNames, int32_t uniformNames_count,
++ GLuint *uniformIndices, int32_t uniformIndices_maxcount, int32_t *uniformIndices_count);
++GLuint yagl_host_glGetUniformBlockIndex(GLuint program,
++ const GLchar *uniformBlockName, int32_t uniformBlockName_count);
++void yagl_host_glUniformBlockBinding(GLuint program,
++ GLuint uniformBlockIndex,
++ GLuint uniformBlockBinding);
++void yagl_host_glGetActiveUniformBlockName(GLuint program,
++ GLuint uniformBlockIndex,
++ GLchar *uniformBlockName, int32_t uniformBlockName_maxcount, int32_t *uniformBlockName_count);
++void yagl_host_glGetActiveUniformBlockiv(GLuint program,
++ GLuint uniformBlockIndex,
++ GLenum pname,
++ GLint *params, int32_t params_maxcount, int32_t *params_count);
+ void yagl_host_glGetIntegerv(GLenum pname,
+ GLint *params, int32_t params_maxcount, int32_t *params_count);
+ void yagl_host_glGetFloatv(GLenum pname,
+ GLfloat *params, int32_t params_maxcount, int32_t *params_count);
+ void yagl_host_glGetString(GLenum name,
+ GLchar *str, int32_t str_maxcount, int32_t *str_count);
+ GLboolean yagl_host_glIsEnabled(GLenum cap);
++void yagl_host_glGenTransformFeedbacks(const GLuint *ids, int32_t ids_count);
++void yagl_host_glBindTransformFeedback(GLenum target,
++ GLuint id);
++void yagl_host_glBeginTransformFeedback(GLenum primitiveMode);
++void yagl_host_glEndTransformFeedback(void);
++void yagl_host_glPauseTransformFeedback(void);
++void yagl_host_glResumeTransformFeedback(void);
++void yagl_host_glTransformFeedbackVaryings(GLuint program,
++ const GLchar *varyings, int32_t varyings_count,
++ GLenum bufferMode);
++void yagl_host_glGetTransformFeedbackVaryings(GLuint program,
++ GLsizei *sizes, int32_t sizes_maxcount, int32_t *sizes_count,
++ GLenum *types, int32_t types_maxcount, int32_t *types_count);
++void yagl_host_glGenQueries(const GLuint *ids, int32_t ids_count);
++void yagl_host_glBeginQuery(GLenum target,
++ GLuint id);
++void yagl_host_glEndQuery(GLenum target);
++GLboolean yagl_host_glGetQueryObjectuiv(GLuint id,
++ GLuint *result);
+ void yagl_host_glDeleteObjects(const GLuint *objects, int32_t objects_count);
+ void yagl_host_glBlendEquation(GLenum mode);
+ void yagl_host_glBlendEquationSeparate(GLenum modeRGB,
+ GLenum modeAlpha);
+ void yagl_host_glBlendFunc(GLenum sfactor,
+ GLenum dfactor);
+ void yagl_host_glBlendFuncSeparate(GLenum srcRGB,
+ GLenum dstRGB,
+ GLenum srcAlpha,
+ GLenum dstAlpha);
+ void yagl_host_glBlendColor(GLclampf red,
+ GLclampf green,
+ GLclampf blue,
+ GLclampf alpha);
+ void yagl_host_glClear(GLbitfield mask);
+ void yagl_host_glClearColor(GLclampf red,
+ GLclampf green,
+ GLclampf blue,
+ GLclampf alpha);
+ void yagl_host_glClearDepthf(GLclampf depth);
+ void yagl_host_glClearStencil(GLint s);
+ void yagl_host_glColorMask(GLboolean red,
+ GLboolean green,
+ GLboolean blue,
+ GLboolean alpha);
+ void yagl_host_glCullFace(GLenum mode);
+ void yagl_host_glDepthFunc(GLenum func);
+ void yagl_host_glDepthMask(GLboolean flag);
+ void yagl_host_glDepthRangef(GLclampf zNear,
+ GLclampf zFar);
+ void yagl_host_glEnable(GLenum cap);
+ void yagl_host_glDisable(GLenum cap);
+ void yagl_host_glFlush(void);
+ void yagl_host_glFrontFace(GLenum mode);
+ void yagl_host_glGenerateMipmap(GLenum target);
+ void yagl_host_glHint(GLenum target,
+ GLenum mode);
+ void yagl_host_glLineWidth(GLfloat width);
+ void yagl_host_glPixelStorei(GLenum pname,
+ GLint param);
+ void yagl_host_glPolygonOffset(GLfloat factor,
+ GLfloat units);
+ void yagl_host_glScissor(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+ void yagl_host_glStencilFunc(GLenum func,
+ GLint ref,
+ GLuint mask);
+ void yagl_host_glStencilMask(GLuint mask);
+ void yagl_host_glStencilOp(GLenum fail,
+ GLenum zfail,
+ GLenum zpass);
+ void yagl_host_glSampleCoverage(GLclampf value,
+ GLboolean invert);
+ void yagl_host_glViewport(GLint x,
+ GLint y,
+ GLsizei width,
+ GLsizei height);
+ void yagl_host_glStencilFuncSeparate(GLenum face,
+ GLenum func,
+ GLint ref,
+ GLuint mask);
+ void yagl_host_glStencilMaskSeparate(GLenum face,
+ GLuint mask);
+ void yagl_host_glStencilOpSeparate(GLenum face,
+ GLenum fail,
+ GLenum zfail,
+ GLenum zpass);
+ void yagl_host_glPointSize(GLfloat size);
+ void yagl_host_glAlphaFunc(GLenum func,
+ GLclampf ref);
+ void yagl_host_glMatrixMode(GLenum mode);
+ void yagl_host_glLoadIdentity(void);
+ void yagl_host_glPopMatrix(void);
+ void yagl_host_glPushMatrix(void);
+ void yagl_host_glRotatef(GLfloat angle,
+ GLfloat x,
+ GLfloat y,
+ GLfloat z);
+ void yagl_host_glTranslatef(GLfloat x,
+ GLfloat y,
+ GLfloat z);
+ void yagl_host_glScalef(GLfloat x,
+ GLfloat y,
+ GLfloat z);
+ void yagl_host_glOrthof(GLfloat left,
+ GLfloat right,
+ GLfloat bottom,
+ GLfloat top,
+ GLfloat zNear,
+ GLfloat zFar);
+ void yagl_host_glColor4f(GLfloat red,
+ GLfloat green,
+ GLfloat blue,
+ GLfloat alpha);
+ void yagl_host_glColor4ub(GLubyte red,
+ GLubyte green,
+ GLubyte blue,
+ GLubyte alpha);
+ void yagl_host_glNormal3f(GLfloat nx,
+ GLfloat ny,
+ GLfloat nz);
+ void yagl_host_glPointParameterf(GLenum pname,
+ GLfloat param);
+ void yagl_host_glPointParameterfv(GLenum pname,
+ const GLfloat *params, int32_t params_count);
+ void yagl_host_glFogf(GLenum pname,
+ GLfloat param);
+ void yagl_host_glFogfv(GLenum pname,
+ const GLfloat *params, int32_t params_count);
+ void yagl_host_glFrustumf(GLfloat left,
+ GLfloat right,
+ GLfloat bottom,
+ GLfloat top,
+ GLfloat zNear,
+ GLfloat zFar);
+ void yagl_host_glLightf(GLenum light,
+ GLenum pname,
+ GLfloat param);
+ void yagl_host_glLightfv(GLenum light,
+ GLenum pname,
+ const GLfloat *params, int32_t params_count);
+ void yagl_host_glGetLightfv(GLenum light,
+ GLenum pname,
+ GLfloat *params, int32_t params_maxcount, int32_t *params_count);
+ void yagl_host_glLightModelf(GLenum pname,
+ GLfloat param);
+ void yagl_host_glLightModelfv(GLenum pname,
+ const GLfloat *params, int32_t params_count);
+ void yagl_host_glMaterialf(GLenum face,
+ GLenum pname,
+ GLfloat param);
+ void yagl_host_glMaterialfv(GLenum face,
+ GLenum pname,
+ const GLfloat *params, int32_t params_count);
+ void yagl_host_glGetMaterialfv(GLenum face,
+ GLenum pname,
+ GLfloat *params, int32_t params_maxcount, int32_t *params_count);
+ void yagl_host_glShadeModel(GLenum mode);
+ void yagl_host_glLogicOp(GLenum opcode);
+ void yagl_host_glMultMatrixf(const GLfloat *m, int32_t m_count);
+ void yagl_host_glLoadMatrixf(const GLfloat *m, int32_t m_count);
+ void yagl_host_glClipPlanef(GLenum plane,
+ const GLfloat *equation, int32_t equation_count);
+ void yagl_host_glGetClipPlanef(GLenum pname,
+ GLfloat *eqn, int32_t eqn_maxcount, int32_t *eqn_count);
+ void yagl_host_glUpdateOffscreenImageYAGL(GLuint texture,
+ uint32_t width,
+ uint32_t height,
+ uint32_t bpp,
+ const void *pixels, int32_t pixels_count);
+ void yagl_host_glGenUniformLocationYAGL(uint32_t location,
+ GLuint program,
+ const GLchar *name, int32_t name_count);
+ void yagl_host_glDeleteUniformLocationsYAGL(const uint32_t *locations, int32_t locations_count);
+
+ #endif
--- /dev/null
- if (egl_offscreen_ts && egl_offscreen_ts->dpy) {
- return;
- }
-
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include <GL/gl.h>
+ #include "yagl_egl_offscreen.h"
+ #include "yagl_egl_offscreen_display.h"
+ #include "yagl_egl_offscreen_context.h"
+ #include "yagl_egl_offscreen_surface.h"
+ #include "yagl_egl_offscreen_ts.h"
+ #include "yagl_log.h"
+ #include "yagl_process.h"
+ #include "yagl_thread.h"
+ #include "yagl_gles_driver.h"
+
+ YAGL_DEFINE_TLS(struct yagl_egl_offscreen_ts*, egl_offscreen_ts);
+
+ static void yagl_egl_offscreen_thread_init(struct yagl_egl_backend *backend)
+ {
+ YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_thread_init, NULL);
+
+ egl_offscreen_ts = yagl_egl_offscreen_ts_create();
+
+ cur_ts->egl_offscreen_ts = egl_offscreen_ts;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static void yagl_egl_offscreen_batch_start(struct yagl_egl_backend *backend)
+ {
+ struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend;
+
+ egl_offscreen_ts = cur_ts->egl_offscreen_ts;
+
+ if (!egl_offscreen_ts->dpy) {
+ return;
+ }
+
+ egl_offscreen->egl_driver->make_current(egl_offscreen->egl_driver,
+ egl_offscreen_ts->dpy->native_dpy,
+ egl_offscreen_ts->sfc_draw,
+ egl_offscreen_ts->sfc_read,
+ egl_offscreen_ts->ctx->native_ctx);
+ }
+
+ static void yagl_egl_offscreen_batch_end(struct yagl_egl_backend *backend)
+ {
+ struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend;
+
+ if (!egl_offscreen_ts->dpy) {
+ return;
+ }
+
+ egl_offscreen->egl_driver->make_current(egl_offscreen->egl_driver,
+ egl_offscreen_ts->dpy->native_dpy,
+ EGL_NO_SURFACE,
+ EGL_NO_SURFACE,
+ EGL_NO_CONTEXT);
+ }
+
+ static struct yagl_eglb_display *yagl_egl_offscreen_create_display(struct yagl_egl_backend *backend)
+ {
+ struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend;
+ struct yagl_egl_offscreen_display *dpy =
+ yagl_egl_offscreen_display_create(egl_offscreen);
+
+ return dpy ? &dpy->base : NULL;
+ }
+
+ static bool yagl_egl_offscreen_make_current(struct yagl_egl_backend *backend,
+ struct yagl_eglb_display *dpy,
+ struct yagl_eglb_context *ctx,
+ struct yagl_eglb_surface *draw,
+ struct yagl_eglb_surface *read)
+ {
+ struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend;
+ struct yagl_egl_offscreen_display *egl_offscreen_dpy = (struct yagl_egl_offscreen_display*)dpy;
+ struct yagl_egl_offscreen_context *egl_offscreen_ctx = (struct yagl_egl_offscreen_context*)ctx;
+ struct yagl_egl_offscreen_surface *egl_offscreen_draw = (struct yagl_egl_offscreen_surface*)draw;
+ struct yagl_egl_offscreen_surface *egl_offscreen_read = (struct yagl_egl_offscreen_surface*)read;
+ bool res = false;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_make_current, NULL);
+
+ if (egl_offscreen_ts->dpy) {
+ egl_offscreen->gles_driver->Flush();
+ }
+
+ if (draw && read) {
+ res = egl_offscreen->egl_driver->make_current(egl_offscreen->egl_driver,
+ egl_offscreen_dpy->native_dpy,
+ egl_offscreen_draw->native_sfc,
+ egl_offscreen_read->native_sfc,
+ egl_offscreen_ctx->native_ctx);
+
+ if (res) {
+ egl_offscreen_ts->dpy = egl_offscreen_dpy;
+ egl_offscreen_ts->ctx = egl_offscreen_ctx;
+ egl_offscreen_ts->sfc_draw = egl_offscreen_draw->native_sfc;
+ egl_offscreen_ts->sfc_read = egl_offscreen_read->native_sfc;
+ }
+ } else {
+ /*
+ * EGL_KHR_surfaceless_context not supported for offscreen yet.
+ */
+
+ YAGL_LOG_ERROR("EGL_KHR_surfaceless_context not supported");
+ }
+
+ YAGL_LOG_FUNC_EXIT("%d", res);
+
+ return res;
+ }
+
+ static bool yagl_egl_offscreen_release_current(struct yagl_egl_backend *backend, bool force)
+ {
+ struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend;
+ bool res;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_release_current, NULL);
+
+ assert(egl_offscreen_ts->dpy);
+
+ if (!egl_offscreen_ts->dpy) {
+ return false;
+ }
+
+ egl_offscreen->gles_driver->Flush();
+
+ res = egl_offscreen->egl_driver->make_current(egl_offscreen->egl_driver,
+ egl_offscreen_ts->dpy->native_dpy,
+ EGL_NO_SURFACE,
+ EGL_NO_SURFACE,
+ EGL_NO_CONTEXT);
+
+ if (res || force) {
+ egl_offscreen_ts->dpy = NULL;
+ egl_offscreen_ts->ctx = NULL;
+ egl_offscreen_ts->sfc_draw = NULL;
+ egl_offscreen_ts->sfc_read = NULL;
+ }
+
+ YAGL_LOG_FUNC_EXIT("%d", res);
+
+ return res || force;
+ }
+
+ static void yagl_egl_offscreen_thread_fini(struct yagl_egl_backend *backend)
+ {
+ YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_thread_fini, NULL);
+
+ yagl_egl_offscreen_ts_destroy(egl_offscreen_ts);
+ egl_offscreen_ts = cur_ts->egl_offscreen_ts = NULL;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static void yagl_egl_offscreen_ensure_current(struct yagl_egl_backend *backend)
+ {
+ struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend;
+
- return;
+ egl_offscreen->egl_driver->make_current(egl_offscreen->egl_driver,
+ egl_offscreen->ensure_dpy,
+ egl_offscreen->ensure_sfc,
+ egl_offscreen->ensure_sfc,
+ egl_offscreen->ensure_ctx);
+ }
+
+ static void yagl_egl_offscreen_unensure_current(struct yagl_egl_backend *backend)
+ {
+ struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend;
+
+ if (egl_offscreen_ts && egl_offscreen_ts->dpy) {
-
- egl_offscreen->egl_driver->make_current(egl_offscreen->egl_driver,
- egl_offscreen->ensure_dpy,
- EGL_NO_SURFACE,
- EGL_NO_SURFACE,
- EGL_NO_CONTEXT);
++ egl_offscreen->egl_driver->make_current(egl_offscreen->egl_driver,
++ egl_offscreen_ts->dpy->native_dpy,
++ egl_offscreen_ts->sfc_draw,
++ egl_offscreen_ts->sfc_read,
++ egl_offscreen_ts->ctx->native_ctx);
++ } else {
++ egl_offscreen->egl_driver->make_current(egl_offscreen->egl_driver,
++ egl_offscreen->ensure_dpy,
++ EGL_NO_SURFACE,
++ EGL_NO_SURFACE,
++ EGL_NO_CONTEXT);
+ }
- yagl_egl_backend_init(&egl_offscreen->base, yagl_render_type_offscreen);
+ }
+
+ static void yagl_egl_offscreen_destroy(struct yagl_egl_backend *backend)
+ {
+ struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_destroy, NULL);
+
+ egl_offscreen->egl_driver->context_destroy(egl_offscreen->egl_driver,
+ egl_offscreen->ensure_dpy,
+ egl_offscreen->global_ctx);
+ egl_offscreen->egl_driver->context_destroy(egl_offscreen->egl_driver,
+ egl_offscreen->ensure_dpy,
+ egl_offscreen->ensure_ctx);
+ egl_offscreen->egl_driver->pbuffer_surface_destroy(egl_offscreen->egl_driver,
+ egl_offscreen->ensure_dpy,
+ egl_offscreen->ensure_sfc);
+ egl_offscreen->egl_driver->config_cleanup(egl_offscreen->egl_driver,
+ egl_offscreen->ensure_dpy,
+ &egl_offscreen->ensure_config);
+ egl_offscreen->egl_driver->display_close(egl_offscreen->egl_driver,
+ egl_offscreen->ensure_dpy);
+
+ egl_offscreen->egl_driver->destroy(egl_offscreen->egl_driver);
+ egl_offscreen->egl_driver = NULL;
+ egl_offscreen->gles_driver = NULL;
+
+ yagl_egl_backend_cleanup(&egl_offscreen->base);
+
+ g_free(egl_offscreen);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ struct yagl_egl_backend *yagl_egl_offscreen_create(struct yagl_egl_driver *egl_driver,
+ struct yagl_gles_driver *gles_driver)
+ {
+ struct yagl_egl_offscreen *egl_offscreen = g_malloc0(sizeof(struct yagl_egl_offscreen));
+ EGLNativeDisplayType dpy = NULL;
+ struct yagl_egl_native_config *configs = NULL;
+ int i, num_configs = 0;
+ struct yagl_egl_pbuffer_attribs attribs;
+ EGLSurface sfc = EGL_NO_SURFACE;
+ EGLContext ctx = EGL_NO_CONTEXT;
+ EGLContext global_ctx = EGL_NO_CONTEXT;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_create, NULL);
+
+ yagl_egl_pbuffer_attribs_init(&attribs);
+
++ yagl_egl_backend_init(&egl_offscreen->base,
++ yagl_render_type_offscreen,
++ egl_driver->gl_version);
+
+ dpy = egl_driver->display_open(egl_driver);
+
+ if (!dpy) {
+ goto fail;
+ }
+
+ configs = egl_driver->config_enum(egl_driver, dpy, &num_configs);
+
+ if (!configs || (num_configs <= 0)) {
+ goto fail;
+ }
+
+ sfc = egl_driver->pbuffer_surface_create(egl_driver, dpy, &configs[0],
+ 1, 1, &attribs);
+
+ if (sfc == EGL_NO_SURFACE) {
+ goto fail;
+ }
+
+ ctx = egl_driver->context_create(egl_driver, dpy, &configs[0], NULL);
+
+ if (ctx == EGL_NO_CONTEXT) {
+ goto fail;
+ }
+
+ global_ctx = egl_driver->context_create(egl_driver, dpy, &configs[0], ctx);
+
+ if (global_ctx == EGL_NO_CONTEXT) {
+ goto fail;
+ }
+
+ egl_offscreen->base.thread_init = &yagl_egl_offscreen_thread_init;
+ egl_offscreen->base.batch_start = &yagl_egl_offscreen_batch_start;
+ egl_offscreen->base.create_display = &yagl_egl_offscreen_create_display;
+ egl_offscreen->base.make_current = &yagl_egl_offscreen_make_current;
+ egl_offscreen->base.release_current = &yagl_egl_offscreen_release_current;
+ egl_offscreen->base.batch_end = &yagl_egl_offscreen_batch_end;
+ egl_offscreen->base.thread_fini = &yagl_egl_offscreen_thread_fini;
+ egl_offscreen->base.ensure_current = &yagl_egl_offscreen_ensure_current;
+ egl_offscreen->base.unensure_current = &yagl_egl_offscreen_unensure_current;
+ egl_offscreen->base.destroy = &yagl_egl_offscreen_destroy;
+
+ egl_offscreen->egl_driver = egl_driver;
+ egl_offscreen->gles_driver = gles_driver;
+ egl_offscreen->ensure_dpy = dpy;
+ egl_offscreen->ensure_config = configs[0];
+ egl_offscreen->ensure_ctx = ctx;
+ egl_offscreen->ensure_sfc = sfc;
+ egl_offscreen->global_ctx = global_ctx;
+
+ for (i = 1; i < num_configs; ++i) {
+ egl_driver->config_cleanup(egl_driver, dpy, &configs[i]);
+ }
+ g_free(configs);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return &egl_offscreen->base;
+
+ fail:
+ if (ctx != EGL_NO_CONTEXT) {
+ egl_driver->context_destroy(egl_driver, dpy, ctx);
+ }
+
+ if (sfc != EGL_NO_SURFACE) {
+ egl_driver->pbuffer_surface_destroy(egl_driver, dpy, sfc);
+ }
+
+ if (configs) {
+ for (i = 0; i < num_configs; ++i) {
+ egl_driver->config_cleanup(egl_driver, dpy, &configs[i]);
+ }
+ g_free(configs);
+ }
+
+ if (dpy) {
+ egl_driver->display_close(egl_driver, dpy);
+ }
+
+ yagl_egl_backend_cleanup(&egl_offscreen->base);
+
+ g_free(egl_offscreen);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return NULL;
+ }
--- /dev/null
- yagl_ensure_ctx();
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include <GL/gl.h>
+ #include "yagl_egl_offscreen_context.h"
+ #include "yagl_egl_offscreen_display.h"
+ #include "yagl_egl_offscreen.h"
+ #include "yagl_egl_native_config.h"
+ #include "yagl_gles_driver.h"
+ #include "yagl_log.h"
+ #include "yagl_tls.h"
+ #include "yagl_process.h"
+ #include "yagl_thread.h"
+
+ static void yagl_egl_offscreen_context_destroy(struct yagl_eglb_context *ctx)
+ {
+ struct yagl_egl_offscreen_context *egl_offscreen_ctx =
+ (struct yagl_egl_offscreen_context*)ctx;
+ struct yagl_egl_offscreen_display *dpy =
+ (struct yagl_egl_offscreen_display*)ctx->dpy;
+ struct yagl_egl_offscreen *egl_offscreen =
+ (struct yagl_egl_offscreen*)ctx->dpy->backend;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_context_destroy, NULL);
+
+ if (egl_offscreen_ctx->rp_pbo) {
- yagl_unensure_ctx();
++ yagl_ensure_ctx(0);
+ egl_offscreen->gles_driver->DeleteBuffers(1, &egl_offscreen_ctx->rp_pbo);
- bool pop_attrib = false;
++ yagl_unensure_ctx(0);
+ }
+
+ egl_offscreen->egl_driver->context_destroy(egl_offscreen->egl_driver,
+ dpy->native_dpy,
+ egl_offscreen_ctx->native_ctx);
+
+ yagl_eglb_context_cleanup(ctx);
+
+ g_free(egl_offscreen_ctx);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ struct yagl_egl_offscreen_context
+ *yagl_egl_offscreen_context_create(struct yagl_egl_offscreen_display *dpy,
+ const struct yagl_egl_native_config *cfg,
+ struct yagl_egl_offscreen_context *share_context)
+ {
+ struct yagl_egl_offscreen *egl_offscreen =
+ (struct yagl_egl_offscreen*)dpy->base.backend;
+ struct yagl_egl_offscreen_context *ctx;
+ EGLContext native_ctx;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_context_create,
+ "dpy = %p, cfg = %d",
+ dpy,
+ cfg->config_id);
+
+ native_ctx = egl_offscreen->egl_driver->context_create(
+ egl_offscreen->egl_driver,
+ dpy->native_dpy,
+ cfg,
+ egl_offscreen->global_ctx);
+
+ if (!native_ctx) {
+ YAGL_LOG_FUNC_EXIT(NULL);
+ return NULL;
+ }
+
+ ctx = g_malloc0(sizeof(*ctx));
+
+ yagl_eglb_context_init(&ctx->base, &dpy->base);
+
+ ctx->base.destroy = &yagl_egl_offscreen_context_destroy;
+
+ ctx->native_ctx = native_ctx;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return ctx;
+ }
+
+ bool yagl_egl_offscreen_context_read_pixels(struct yagl_egl_offscreen_context *ctx,
+ uint32_t width,
+ uint32_t height,
+ uint32_t bpp,
+ void *pixels)
+ {
+ struct yagl_gles_driver *gles_driver =
+ ((struct yagl_egl_offscreen*)ctx->base.dpy->backend)->gles_driver;
+ bool ret = false;
+ GLuint current_fb = 0;
++ GLint current_pack_alignment = 0;
+ GLuint current_pbo = 0;
+ uint32_t rp_line_size = width * bpp;
+ uint32_t rp_size = rp_line_size * height;
+ GLenum format = 0;
- gles_driver->GetIntegerv(GL_FRAMEBUFFER_BINDING,
+ void *mapped_pixels = NULL;
+ uint32_t i;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_context_read_pixels,
+ "%ux%ux%u", width, height, bpp);
+
- gles_driver->BindFramebuffer(GL_FRAMEBUFFER, 0);
++ gles_driver->GetIntegerv(GL_READ_FRAMEBUFFER_BINDING,
+ (GLint*)¤t_fb);
+
- gles_driver->PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
-
- pop_attrib = true;
-
++ gles_driver->GetIntegerv(GL_PACK_ALIGNMENT,
++ ¤t_pack_alignment);
++
++ gles_driver->BindFramebuffer(GL_READ_FRAMEBUFFER, 0);
+
+ if (!ctx->rp_pbo) {
+ /*
+ * No buffer yet, create one.
+ */
+
+ gles_driver->GenBuffers(1, &ctx->rp_pbo);
+
+ if (!ctx->rp_pbo) {
+ YAGL_LOG_ERROR("GenBuffers failed");
+ goto out;
+ }
+
+ YAGL_LOG_TRACE("Created pbo %u", ctx->rp_pbo);
+ }
+
+ gles_driver->GetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING_ARB,
+ (GLint*)¤t_pbo);
+
+ if (current_pbo != ctx->rp_pbo) {
+ YAGL_LOG_TRACE("Binding pbo");
+ gles_driver->BindBuffer(GL_PIXEL_PACK_BUFFER_ARB, ctx->rp_pbo);
+ }
+
+ if ((width != ctx->rp_pbo_width) ||
+ (height != ctx->rp_pbo_height) ||
+ (bpp != ctx->rp_pbo_bpp)) {
+ /*
+ * The surface was resized/changed, recreate pbo data accordingly.
+ */
+
+ ctx->rp_pbo_width = width;
+ ctx->rp_pbo_height = height;
+ ctx->rp_pbo_bpp = bpp;
+
+ YAGL_LOG_TRACE("Recreating pbo storage");
+
+ gles_driver->BufferData(GL_PIXEL_PACK_BUFFER_ARB,
+ rp_size,
+ 0,
+ GL_STREAM_READ);
+ }
+
+ switch (bpp) {
+ case 3:
+ format = GL_RGB;
+ break;
+ case 4:
+ format = GL_BGRA;
+ break;
+ default:
+ assert(0);
+ goto out;
+ }
+
- for (i = 0; i < height; ++i)
- {
+ gles_driver->PixelStorei(GL_PACK_ALIGNMENT, 1);
+
+ gles_driver->ReadPixels(0, 0,
+ width, height, format, GL_UNSIGNED_INT_8_8_8_8_REV,
+ NULL);
+
+ mapped_pixels = gles_driver->MapBuffer(GL_PIXEL_PACK_BUFFER_ARB,
+ GL_READ_ONLY);
+
+ if (!mapped_pixels) {
+ YAGL_LOG_ERROR("MapBuffer failed");
+ goto out;
+ }
+
+ if (height > 0) {
+ pixels += (height - 1) * rp_line_size;
+
- if (pop_attrib) {
- gles_driver->PopClientAttrib();
- }
++ for (i = 0; i < height; ++i) {
+ memcpy(pixels, mapped_pixels, rp_line_size);
+ pixels -= rp_line_size;
+ mapped_pixels += rp_line_size;
+ }
+ }
+
+ ret = true;
+
+ out:
+ if (mapped_pixels) {
+ gles_driver->UnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB);
+ }
- gles_driver->BindFramebuffer(GL_FRAMEBUFFER, current_fb);
++ gles_driver->PixelStorei(GL_PACK_ALIGNMENT, current_pack_alignment);
+ if ((current_pbo != 0) &&
+ (current_pbo != ctx->rp_pbo)) {
+ YAGL_LOG_ERROR("Target binded a pbo ?");
+ gles_driver->BindBuffer(GL_PIXEL_PACK_BUFFER_ARB,
+ current_pbo);
+ }
+
++ gles_driver->BindFramebuffer(GL_READ_FRAMEBUFFER, current_fb);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return ret;
+ }
--- /dev/null
- yagl_ensure_ctx();
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include <GL/gl.h>
+ #include "yagl_egl_offscreen_display.h"
+ #include "yagl_egl_offscreen_context.h"
+ #include "yagl_egl_offscreen_surface.h"
+ #include "yagl_egl_offscreen.h"
+ #include "yagl_egl_native_config.h"
+ #include "yagl_log.h"
+ #include "yagl_tls.h"
+ #include "yagl_process.h"
+ #include "yagl_thread.h"
+ #include "yagl_object_map.h"
+ #include "yagl_gles_driver.h"
+
+ struct yagl_egl_offscreen_image
+ {
+ struct yagl_object base;
+
+ struct yagl_gles_driver *driver;
+ };
+
+ static void yagl_egl_offscreen_image_destroy(struct yagl_object *obj)
+ {
+ struct yagl_egl_offscreen_image *image = (struct yagl_egl_offscreen_image*)obj;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_image_destroy, "%u", obj->global_name);
+
- yagl_unensure_ctx();
++ yagl_ensure_ctx(0);
+ image->driver->DeleteTextures(1, &obj->global_name);
- yagl_ensure_ctx();
++ yagl_unensure_ctx(0);
+
+ g_free(image);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static struct yagl_egl_native_config
+ *yagl_egl_offscreen_display_config_enum(struct yagl_eglb_display *dpy,
+ int *num_configs)
+ {
+ struct yagl_egl_offscreen_display *egl_offscreen_dpy =
+ (struct yagl_egl_offscreen_display*)dpy;
+ struct yagl_egl_offscreen *egl_offscreen =
+ (struct yagl_egl_offscreen*)dpy->backend;
+ struct yagl_egl_native_config *native_configs;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_display_config_enum,
+ "dpy = %p", dpy);
+
+ native_configs =
+ egl_offscreen->egl_driver->config_enum(egl_offscreen->egl_driver,
+ egl_offscreen_dpy->native_dpy,
+ num_configs);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return native_configs;
+ }
+
+ static void yagl_egl_offscreen_display_config_cleanup(struct yagl_eglb_display *dpy,
+ const struct yagl_egl_native_config *cfg)
+ {
+ struct yagl_egl_offscreen_display *egl_offscreen_dpy =
+ (struct yagl_egl_offscreen_display*)dpy;
+ struct yagl_egl_offscreen *egl_offscreen =
+ (struct yagl_egl_offscreen*)dpy->backend;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_display_config_cleanup,
+ "dpy = %p, cfg = %d",
+ dpy,
+ cfg->config_id);
+
+ egl_offscreen->egl_driver->config_cleanup(egl_offscreen->egl_driver,
+ egl_offscreen_dpy->native_dpy,
+ cfg);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static struct yagl_eglb_context
+ *yagl_egl_offscreen_display_create_context(struct yagl_eglb_display *dpy,
+ const struct yagl_egl_native_config *cfg,
+ struct yagl_eglb_context *share_context)
+ {
+ struct yagl_egl_offscreen_display *egl_offscreen_dpy =
+ (struct yagl_egl_offscreen_display*)dpy;
+ struct yagl_egl_offscreen_context *ctx =
+ yagl_egl_offscreen_context_create(egl_offscreen_dpy,
+ cfg,
+ (struct yagl_egl_offscreen_context*)share_context);
+
+ return ctx ? &ctx->base : NULL;
+ }
+
+ static struct yagl_eglb_surface
+ *yagl_egl_offscreen_display_create_surface(struct yagl_eglb_display *dpy,
+ const struct yagl_egl_native_config *cfg,
+ EGLenum type,
+ const void *attribs,
+ uint32_t width,
+ uint32_t height,
+ uint32_t bpp,
+ target_ulong pixels)
+ {
+ struct yagl_egl_offscreen_display *egl_offscreen_dpy =
+ (struct yagl_egl_offscreen_display*)dpy;
+ struct yagl_egl_offscreen_surface *sfc =
+ yagl_egl_offscreen_surface_create(egl_offscreen_dpy,
+ cfg,
+ type,
+ attribs,
+ width,
+ height,
+ bpp,
+ pixels);
+
+ return sfc ? &sfc->base : NULL;
+ }
+
+ static struct yagl_object *yagl_egl_offscreen_display_create_image(struct yagl_eglb_display *dpy,
+ yagl_winsys_id buffer)
+ {
+ struct yagl_egl_offscreen *egl_offscreen =
+ (struct yagl_egl_offscreen*)dpy->backend;
+ struct yagl_egl_offscreen_image *image;
+
+ image = g_malloc(sizeof(*image));
+
- yagl_unensure_ctx();
++ yagl_ensure_ctx(0);
+ egl_offscreen->gles_driver->GenTextures(1, &image->base.global_name);
++ yagl_unensure_ctx(0);
+ image->base.destroy = &yagl_egl_offscreen_image_destroy;
+ image->driver = egl_offscreen->gles_driver;
+
+ return &image->base;
+ }
+
+ static void yagl_egl_offscreen_display_destroy(struct yagl_eglb_display *dpy)
+ {
+ struct yagl_egl_offscreen_display *egl_offscreen_dpy =
+ (struct yagl_egl_offscreen_display*)dpy;
+ struct yagl_egl_offscreen *egl_offscreen =
+ (struct yagl_egl_offscreen*)dpy->backend;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_display_destroy,
+ "dpy = %p", dpy);
+
+ egl_offscreen->egl_driver->display_close(egl_offscreen->egl_driver,
+ egl_offscreen_dpy->native_dpy);
+
+ yagl_eglb_display_cleanup(dpy);
+
+ g_free(egl_offscreen_dpy);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ struct yagl_egl_offscreen_display
+ *yagl_egl_offscreen_display_create(struct yagl_egl_offscreen *egl_offscreen)
+ {
+ struct yagl_egl_offscreen_display *dpy;
+ EGLNativeDisplayType native_dpy;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_display_create, NULL);
+
+ native_dpy = egl_offscreen->egl_driver->display_open(egl_offscreen->egl_driver);
+
+ if (!native_dpy) {
+ YAGL_LOG_FUNC_EXIT(NULL);
+ return NULL;
+ }
+
+ dpy = g_malloc0(sizeof(*dpy));
+
+ yagl_eglb_display_init(&dpy->base, &egl_offscreen->base);
+
+ dpy->base.config_enum = &yagl_egl_offscreen_display_config_enum;
+ dpy->base.config_cleanup = &yagl_egl_offscreen_display_config_cleanup;
+ dpy->base.create_context = &yagl_egl_offscreen_display_create_context;
+ dpy->base.create_offscreen_surface = &yagl_egl_offscreen_display_create_surface;
+ dpy->base.create_image = &yagl_egl_offscreen_display_create_image;
+ dpy->base.destroy = &yagl_egl_offscreen_display_destroy;
+
+ dpy->native_dpy = native_dpy;
+
+ YAGL_LOG_FUNC_EXIT("%p", dpy);
+
+ return dpy;
+ }
--- /dev/null
- egl_onscreen->gles_driver->GetIntegerv(GL_FRAMEBUFFER_BINDING,
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include "yagl_egl_onscreen.h"
+ #include <GL/gl.h>
+ #include "yagl_egl_onscreen_ts.h"
+ #include "yagl_egl_onscreen_display.h"
+ #include "yagl_egl_onscreen_context.h"
+ #include "yagl_egl_onscreen_surface.h"
+ #include "yagl_tls.h"
+ #include "yagl_log.h"
+ #include "yagl_process.h"
+ #include "yagl_thread.h"
+ #include "yagl_gles_driver.h"
+ #include "winsys_gl.h"
+
+ YAGL_DEFINE_TLS(struct yagl_egl_onscreen_ts*, egl_onscreen_ts);
+
+ static void yagl_egl_onscreen_setup_framebuffer_zero(struct yagl_egl_onscreen *egl_onscreen)
+ {
+ GLuint cur_fb = 0;
+
+ assert(egl_onscreen_ts->dpy);
+
+ yagl_egl_onscreen_context_setup(egl_onscreen_ts->ctx);
+
+ if (!egl_onscreen_ts->sfc_draw) {
+ return;
+ }
+
+ yagl_egl_onscreen_surface_setup(egl_onscreen_ts->sfc_draw);
+
- egl_onscreen->gles_driver->BindFramebuffer(GL_FRAMEBUFFER,
++ egl_onscreen->gles_driver->GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING,
+ (GLint*)&cur_fb);
+
- yagl_egl_onscreen_surface_attach_to_framebuffer(egl_onscreen_ts->sfc_draw);
++ egl_onscreen->gles_driver->BindFramebuffer(GL_DRAW_FRAMEBUFFER,
+ egl_onscreen_ts->ctx->fb);
+
- egl_onscreen->gles_driver->BindFramebuffer(GL_FRAMEBUFFER,
++ yagl_egl_onscreen_surface_attach_to_framebuffer(egl_onscreen_ts->sfc_draw,
++ GL_DRAW_FRAMEBUFFER);
+
- egl_onscreen->gles_driver->GetIntegerv(GL_FRAMEBUFFER_BINDING,
++ egl_onscreen->gles_driver->BindFramebuffer(GL_DRAW_FRAMEBUFFER,
+ cur_fb);
+ }
+
+ static void yagl_egl_onscreen_thread_init(struct yagl_egl_backend *backend)
+ {
+ struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_thread_init, NULL);
+
+ egl_onscreen_ts = yagl_egl_onscreen_ts_create(egl_onscreen->gles_driver);
+
+ cur_ts->egl_onscreen_ts = egl_onscreen_ts;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static void yagl_egl_onscreen_batch_start(struct yagl_egl_backend *backend)
+ {
+ struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend;
+
+ egl_onscreen_ts = cur_ts->egl_onscreen_ts;
+
+ if (!egl_onscreen_ts->dpy) {
+ return;
+ }
+
+ if (egl_onscreen_ts->sfc_draw && egl_onscreen_ts->sfc_read) {
+ egl_onscreen->egl_driver->make_current(egl_onscreen->egl_driver,
+ egl_onscreen_ts->dpy->native_dpy,
+ egl_onscreen_ts->sfc_draw->dummy_native_sfc,
+ egl_onscreen_ts->sfc_read->dummy_native_sfc,
+ egl_onscreen_ts->ctx->native_ctx);
+ } else {
+ egl_onscreen->egl_driver->make_current(egl_onscreen->egl_driver,
+ egl_onscreen_ts->dpy->native_dpy,
+ egl_onscreen_ts->ctx->null_sfc,
+ egl_onscreen_ts->ctx->null_sfc,
+ egl_onscreen_ts->ctx->native_ctx);
+ }
+ }
+
+ static void yagl_egl_onscreen_batch_end(struct yagl_egl_backend *backend)
+ {
+ struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend;
+
+ if (!egl_onscreen_ts->dpy) {
+ return;
+ }
+
+ egl_onscreen->egl_driver->make_current(egl_onscreen->egl_driver,
+ egl_onscreen_ts->dpy->native_dpy,
+ EGL_NO_SURFACE,
+ EGL_NO_SURFACE,
+ EGL_NO_CONTEXT);
+ }
+
+ static struct yagl_eglb_display *yagl_egl_onscreen_create_display(struct yagl_egl_backend *backend)
+ {
+ struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend;
+ struct yagl_egl_onscreen_display *dpy =
+ yagl_egl_onscreen_display_create(egl_onscreen);
+
+ return dpy ? &dpy->base : NULL;
+ }
+
+ static bool yagl_egl_onscreen_make_current(struct yagl_egl_backend *backend,
+ struct yagl_eglb_display *dpy,
+ struct yagl_eglb_context *ctx,
+ struct yagl_eglb_surface *draw,
+ struct yagl_eglb_surface *read)
+ {
+ struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend;
+ struct yagl_egl_onscreen_display *egl_onscreen_dpy = (struct yagl_egl_onscreen_display*)dpy;
+ struct yagl_egl_onscreen_context *egl_onscreen_ctx = (struct yagl_egl_onscreen_context*)ctx;
+ struct yagl_egl_onscreen_surface *egl_onscreen_draw = (struct yagl_egl_onscreen_surface*)draw;
+ struct yagl_egl_onscreen_surface *egl_onscreen_read = (struct yagl_egl_onscreen_surface*)read;
+ bool res;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_make_current, NULL);
+
+ if (egl_onscreen_ts->dpy) {
+ egl_onscreen->gles_driver->Flush();
+ }
+
+ if (draw && read) {
+ res = egl_onscreen->egl_driver->make_current(egl_onscreen->egl_driver,
+ egl_onscreen_dpy->native_dpy,
+ egl_onscreen_draw->dummy_native_sfc,
+ egl_onscreen_read->dummy_native_sfc,
+ egl_onscreen_ctx->native_ctx);
+ } else {
+ res = yagl_egl_onscreen_context_setup_surfaceless(egl_onscreen_ctx);
+
+ if (res) {
+ res = egl_onscreen->egl_driver->make_current(egl_onscreen->egl_driver,
+ egl_onscreen_dpy->native_dpy,
+ egl_onscreen_ctx->null_sfc,
+ egl_onscreen_ctx->null_sfc,
+ egl_onscreen_ctx->native_ctx);
+ }
+ }
+
+ if (res) {
+ GLuint cur_fb = 0;
+
+ egl_onscreen_ts->dpy = egl_onscreen_dpy;
+ egl_onscreen_ts->ctx = egl_onscreen_ctx;
+ egl_onscreen_ts->sfc_draw = egl_onscreen_draw;
+ egl_onscreen_ts->sfc_read = egl_onscreen_read;
+
+ yagl_egl_onscreen_setup_framebuffer_zero(egl_onscreen);
+
- if (egl_onscreen_ts && egl_onscreen_ts->dpy) {
- return;
- }
-
++ egl_onscreen->gles_driver->GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING,
+ (GLint*)&cur_fb);
+
+ if (cur_fb == 0) {
+ /*
+ * No framebuffer, then bind our framebuffer zero.
+ */
+
+ egl_onscreen->gles_driver->BindFramebuffer(GL_FRAMEBUFFER,
+ egl_onscreen_ctx->fb);
+
+ /*
+ * Setup default viewport and scissor.
+ */
+ if (draw) {
+ egl_onscreen->gles_driver->Viewport(0,
+ 0,
+ yagl_egl_onscreen_surface_width(egl_onscreen_draw),
+ yagl_egl_onscreen_surface_height(egl_onscreen_draw));
+ egl_onscreen->gles_driver->Scissor(0,
+ 0,
+ yagl_egl_onscreen_surface_width(egl_onscreen_draw),
+ yagl_egl_onscreen_surface_height(egl_onscreen_draw));
+ } else {
+ /*
+ * "If the first time <ctx> is made current, it is without a default
+ * framebuffer (e.g. both <draw> and <read> are EGL_NO_SURFACE), then
+ * the viewport and scissor regions are set as though
+ * glViewport(0,0,0,0) and glScissor(0,0,0,0) were called."
+ */
+ egl_onscreen->gles_driver->Viewport(0, 0, 0, 0);
+ egl_onscreen->gles_driver->Scissor(0, 0, 0, 0);
+ }
+ }
+ }
+
+ YAGL_LOG_FUNC_EXIT("%d", res);
+
+ return res;
+ }
+
+ static bool yagl_egl_onscreen_release_current(struct yagl_egl_backend *backend, bool force)
+ {
+ struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend;
+ bool res;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_release_current, NULL);
+
+ assert(egl_onscreen_ts->dpy);
+
+ if (!egl_onscreen_ts->dpy) {
+ return false;
+ }
+
+ egl_onscreen->gles_driver->Flush();
+
+ res = egl_onscreen->egl_driver->make_current(egl_onscreen->egl_driver,
+ egl_onscreen_ts->dpy->native_dpy,
+ EGL_NO_SURFACE,
+ EGL_NO_SURFACE,
+ EGL_NO_CONTEXT);
+
+ if (res || force) {
+ egl_onscreen_ts->dpy = NULL;
+ egl_onscreen_ts->ctx = NULL;
+ egl_onscreen_ts->sfc_draw = NULL;
+ egl_onscreen_ts->sfc_read = NULL;
+ }
+
+ YAGL_LOG_FUNC_EXIT("%d", res);
+
+ return res || force;
+ }
+
+ static void yagl_egl_onscreen_thread_fini(struct yagl_egl_backend *backend)
+ {
+ YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_thread_fini, NULL);
+
+ yagl_egl_onscreen_ts_destroy(egl_onscreen_ts);
+ egl_onscreen_ts = cur_ts->egl_onscreen_ts = NULL;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static void yagl_egl_onscreen_ensure_current(struct yagl_egl_backend *backend)
+ {
+ struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend;
+
- return;
+ egl_onscreen->egl_driver->make_current(egl_onscreen->egl_driver,
+ egl_onscreen->ensure_dpy,
+ egl_onscreen->ensure_sfc,
+ egl_onscreen->ensure_sfc,
+ egl_onscreen->ensure_ctx);
+ }
+
+ static void yagl_egl_onscreen_unensure_current(struct yagl_egl_backend *backend)
+ {
+ struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend;
+
+ if (egl_onscreen_ts && egl_onscreen_ts->dpy) {
-
- egl_onscreen->egl_driver->make_current(egl_onscreen->egl_driver,
- egl_onscreen->ensure_dpy,
- EGL_NO_SURFACE,
- EGL_NO_SURFACE,
- EGL_NO_CONTEXT);
++ if (egl_onscreen_ts->sfc_draw && egl_onscreen_ts->sfc_read) {
++ egl_onscreen->egl_driver->make_current(egl_onscreen->egl_driver,
++ egl_onscreen_ts->dpy->native_dpy,
++ egl_onscreen_ts->sfc_draw->dummy_native_sfc,
++ egl_onscreen_ts->sfc_read->dummy_native_sfc,
++ egl_onscreen_ts->ctx->native_ctx);
++ } else {
++ egl_onscreen->egl_driver->make_current(egl_onscreen->egl_driver,
++ egl_onscreen_ts->dpy->native_dpy,
++ egl_onscreen_ts->ctx->null_sfc,
++ egl_onscreen_ts->ctx->null_sfc,
++ egl_onscreen_ts->ctx->native_ctx);
++ }
++ } else {
++ egl_onscreen->egl_driver->make_current(egl_onscreen->egl_driver,
++ egl_onscreen->ensure_dpy,
++ EGL_NO_SURFACE,
++ EGL_NO_SURFACE,
++ EGL_NO_CONTEXT);
+ }
- yagl_egl_backend_init(&egl_onscreen->base, yagl_render_type_onscreen);
+ }
+
+ static void yagl_egl_onscreen_destroy(struct yagl_egl_backend *backend)
+ {
+ struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_destroy, NULL);
+
+ egl_onscreen->egl_driver->context_destroy(egl_onscreen->egl_driver,
+ egl_onscreen->ensure_dpy,
+ egl_onscreen->global_ctx);
+ egl_onscreen->egl_driver->context_destroy(egl_onscreen->egl_driver,
+ egl_onscreen->ensure_dpy,
+ egl_onscreen->ensure_ctx);
+ egl_onscreen->egl_driver->pbuffer_surface_destroy(egl_onscreen->egl_driver,
+ egl_onscreen->ensure_dpy,
+ egl_onscreen->ensure_sfc);
+ egl_onscreen->egl_driver->config_cleanup(egl_onscreen->egl_driver,
+ egl_onscreen->ensure_dpy,
+ &egl_onscreen->ensure_config);
+ egl_onscreen->egl_driver->display_close(egl_onscreen->egl_driver,
+ egl_onscreen->ensure_dpy);
+
+ egl_onscreen->egl_driver->destroy(egl_onscreen->egl_driver);
+ egl_onscreen->egl_driver = NULL;
+ egl_onscreen->gles_driver = NULL;
+
+ yagl_egl_backend_cleanup(&egl_onscreen->base);
+
+ g_free(egl_onscreen);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ struct yagl_egl_backend *yagl_egl_onscreen_create(struct winsys_interface *wsi,
+ struct yagl_egl_driver *egl_driver,
+ struct yagl_gles_driver *gles_driver)
+ {
+ struct yagl_egl_onscreen *egl_onscreen = g_malloc0(sizeof(struct yagl_egl_onscreen));
+ EGLNativeDisplayType dpy = NULL;
+ struct yagl_egl_native_config *configs = NULL;
+ int i, num_configs = 0;
+ struct yagl_egl_pbuffer_attribs attribs;
+ EGLSurface sfc = EGL_NO_SURFACE;
+ EGLContext ctx = EGL_NO_CONTEXT;
+ EGLContext global_ctx = EGL_NO_CONTEXT;
+ struct winsys_gl_info *ws_info = (struct winsys_gl_info*)wsi->ws_info;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_create, NULL);
+
+ yagl_egl_pbuffer_attribs_init(&attribs);
+
++ yagl_egl_backend_init(&egl_onscreen->base,
++ yagl_render_type_onscreen,
++ egl_driver->gl_version);
+
+ dpy = egl_driver->display_open(egl_driver);
+
+ if (!dpy) {
+ goto fail;
+ }
+
+ configs = egl_driver->config_enum(egl_driver, dpy, &num_configs);
+
+ if (!configs || (num_configs <= 0)) {
+ goto fail;
+ }
+
+ sfc = egl_driver->pbuffer_surface_create(egl_driver, dpy, &configs[0],
+ 1, 1, &attribs);
+
+ if (sfc == EGL_NO_SURFACE) {
+ goto fail;
+ }
+
+ ctx = egl_driver->context_create(egl_driver, dpy, &configs[0],
+ (EGLContext)ws_info->context);
+
+ if (ctx == EGL_NO_CONTEXT) {
+ goto fail;
+ }
+
+ global_ctx = egl_driver->context_create(egl_driver, dpy, &configs[0], ctx);
+
+ if (global_ctx == EGL_NO_CONTEXT) {
+ goto fail;
+ }
+
+ egl_onscreen->base.thread_init = &yagl_egl_onscreen_thread_init;
+ egl_onscreen->base.batch_start = &yagl_egl_onscreen_batch_start;
+ egl_onscreen->base.create_display = &yagl_egl_onscreen_create_display;
+ egl_onscreen->base.make_current = &yagl_egl_onscreen_make_current;
+ egl_onscreen->base.release_current = &yagl_egl_onscreen_release_current;
+ egl_onscreen->base.batch_end = &yagl_egl_onscreen_batch_end;
+ egl_onscreen->base.thread_fini = &yagl_egl_onscreen_thread_fini;
+ egl_onscreen->base.ensure_current = &yagl_egl_onscreen_ensure_current;
+ egl_onscreen->base.unensure_current = &yagl_egl_onscreen_unensure_current;
+ egl_onscreen->base.destroy = &yagl_egl_onscreen_destroy;
+
+ egl_onscreen->wsi = wsi;
+ egl_onscreen->egl_driver = egl_driver;
+ egl_onscreen->gles_driver = gles_driver;
+ egl_onscreen->ensure_dpy = dpy;
+ egl_onscreen->ensure_config = configs[0];
+ egl_onscreen->ensure_ctx = ctx;
+ egl_onscreen->ensure_sfc = sfc;
+ egl_onscreen->global_ctx = global_ctx;
+
+ for (i = 1; i < num_configs; ++i) {
+ egl_driver->config_cleanup(egl_driver, dpy, &configs[i]);
+ }
+ g_free(configs);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return &egl_onscreen->base;
+
+ fail:
+ if (ctx != EGL_NO_CONTEXT) {
+ egl_driver->context_destroy(egl_driver, dpy, ctx);
+ }
+
+ if (sfc != EGL_NO_SURFACE) {
+ egl_driver->pbuffer_surface_destroy(egl_driver, dpy, sfc);
+ }
+
+ if (configs) {
+ for (i = 0; i < num_configs; ++i) {
+ egl_driver->config_cleanup(egl_driver, dpy, &configs[i]);
+ }
+ g_free(configs);
+ }
+
+ if (dpy) {
+ egl_driver->display_close(egl_driver, dpy);
+ }
+
+ yagl_egl_backend_cleanup(&egl_onscreen->base);
+
+ g_free(egl_onscreen);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return NULL;
+ }
--- /dev/null
- yagl_ensure_ctx();
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include <GL/gl.h>
+ #include "yagl_egl_onscreen_context.h"
+ #include "yagl_egl_onscreen_display.h"
+ #include "yagl_egl_onscreen.h"
+ #include "yagl_egl_surface_attribs.h"
+ #include "yagl_gles_driver.h"
+ #include "yagl_log.h"
+ #include "yagl_tls.h"
+ #include "yagl_process.h"
+ #include "yagl_thread.h"
+
+ static void yagl_egl_onscreen_context_destroy(struct yagl_eglb_context *ctx)
+ {
+ struct yagl_egl_onscreen_context *egl_onscreen_ctx =
+ (struct yagl_egl_onscreen_context*)ctx;
+ struct yagl_egl_onscreen_display *dpy =
+ (struct yagl_egl_onscreen_display*)ctx->dpy;
+ struct yagl_egl_onscreen *egl_onscreen =
+ (struct yagl_egl_onscreen*)ctx->dpy->backend;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_context_destroy, NULL);
+
+ if (egl_onscreen_ctx->fb) {
- yagl_unensure_ctx();
++ yagl_ensure_ctx(egl_onscreen_ctx->fb_ctx_id);
+ egl_onscreen->gles_driver->DeleteFramebuffers(1, &egl_onscreen_ctx->fb);
++ yagl_unensure_ctx(egl_onscreen_ctx->fb_ctx_id);
+ }
+
+ if (egl_onscreen_ctx->null_sfc != EGL_NO_SURFACE) {
+ egl_onscreen->egl_driver->pbuffer_surface_destroy(
+ egl_onscreen->egl_driver,
+ dpy->native_dpy,
+ egl_onscreen_ctx->null_sfc);
+ egl_onscreen_ctx->null_sfc = EGL_NO_SURFACE;
+ }
+
+ egl_onscreen->egl_driver->context_destroy(egl_onscreen->egl_driver,
+ dpy->native_dpy,
+ egl_onscreen_ctx->native_ctx);
+
+ yagl_eglb_context_cleanup(ctx);
+
+ g_free(egl_onscreen_ctx);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ struct yagl_egl_onscreen_context
+ *yagl_egl_onscreen_context_create(struct yagl_egl_onscreen_display *dpy,
+ const struct yagl_egl_native_config *cfg,
+ struct yagl_egl_onscreen_context *share_context)
+ {
+ struct yagl_egl_onscreen *egl_onscreen =
+ (struct yagl_egl_onscreen*)dpy->base.backend;
+ struct yagl_egl_onscreen_context *ctx;
+ EGLContext native_ctx;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_context_create,
+ "dpy = %p, cfg = %d",
+ dpy,
+ cfg->config_id);
+
+ native_ctx = egl_onscreen->egl_driver->context_create(
+ egl_onscreen->egl_driver,
+ dpy->native_dpy,
+ cfg,
+ egl_onscreen->global_ctx);
+
+ if (!native_ctx) {
+ YAGL_LOG_FUNC_EXIT(NULL);
+ return NULL;
+ }
+
+ ctx = g_malloc0(sizeof(*ctx));
+
+ yagl_eglb_context_init(&ctx->base, &dpy->base);
+
+ ctx->base.destroy = &yagl_egl_onscreen_context_destroy;
+
+ ctx->native_ctx = native_ctx;
+
+ memcpy(&ctx->cfg, cfg, sizeof(*cfg));
+
+ ctx->null_sfc = EGL_NO_SURFACE;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return ctx;
+ }
+
+ void yagl_egl_onscreen_context_setup(struct yagl_egl_onscreen_context *ctx)
+ {
+ struct yagl_egl_onscreen *egl_onscreen =
+ (struct yagl_egl_onscreen*)ctx->base.dpy->backend;
+
+ if (ctx->fb) {
+ return;
+ }
+
+ egl_onscreen->gles_driver->GenFramebuffers(1, &ctx->fb);
++ ctx->fb_ctx_id = yagl_get_ctx_id();
+ }
+
+ bool yagl_egl_onscreen_context_setup_surfaceless(struct yagl_egl_onscreen_context *ctx)
+ {
+ struct yagl_egl_onscreen *egl_onscreen =
+ (struct yagl_egl_onscreen*)ctx->base.dpy->backend;
+ struct yagl_egl_onscreen_display *dpy =
+ (struct yagl_egl_onscreen_display*)ctx->base.dpy;
+ struct yagl_egl_pbuffer_attribs pbuffer_attribs;
+
+ if (ctx->null_sfc != EGL_NO_SURFACE) {
+ return true;
+ }
+
+ yagl_egl_pbuffer_attribs_init(&pbuffer_attribs);
+
+ ctx->null_sfc = egl_onscreen->egl_driver->pbuffer_surface_create(egl_onscreen->egl_driver,
+ dpy->native_dpy,
+ &ctx->cfg,
+ 1,
+ 1,
+ &pbuffer_attribs);
+
+ return ctx->null_sfc != EGL_NO_SURFACE;
+ }
--- /dev/null
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #ifndef _QEMU_YAGL_EGL_ONSCREEN_CONTEXT_H
+ #define _QEMU_YAGL_EGL_ONSCREEN_CONTEXT_H
+
+ #include "yagl_eglb_context.h"
+ #include "yagl_egl_native_config.h"
+ #include <EGL/egl.h>
+
+ struct yagl_egl_onscreen_display;
+ struct yagl_egl_onscreen_surface;
+
+ struct yagl_egl_onscreen_context
+ {
+ struct yagl_eglb_context base;
+
+ EGLContext native_ctx;
+
+ /*
+ * Framebuffer that is used to render to window/pixmap/pbuffer texture.
+ * Allocated when this context is made current for the first time.
+ *
+ * Onscreen GLES API redirects framebuffer zero to this framebuffer.
+ */
+ GLuint fb;
++ uint32_t fb_ctx_id;
+
+ /*
+ * Config with which this context was created, used
+ * for 'null_sfc' creation.
+ *
+ * TODO: It's not very nice to copy 'cfg' into this. It works
+ * only because all configs are display resources and context
+ * is also a display resource and contexts always outlive configs.
+ * But it could change someday...
+ */
+ struct yagl_egl_native_config cfg;
+
+ /*
+ * 1x1 native pbuffer surface, used to implement
+ * EGL_KHR_surfaceless_context. Allocated on first
+ * surfaceless eglMakeCurrent.
+ */
+ EGLSurface null_sfc;
+ };
+
+ struct yagl_egl_onscreen_context
+ *yagl_egl_onscreen_context_create(struct yagl_egl_onscreen_display *dpy,
+ const struct yagl_egl_native_config *cfg,
+ struct yagl_egl_onscreen_context *share_context);
+
+ void yagl_egl_onscreen_context_setup(struct yagl_egl_onscreen_context *ctx);
+
+ bool yagl_egl_onscreen_context_setup_surfaceless(struct yagl_egl_onscreen_context *ctx);
+
+ #endif
--- /dev/null
- yagl_ensure_ctx();
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include <GL/gl.h>
+ #include "yagl_egl_onscreen_surface.h"
+ #include "yagl_egl_onscreen_context.h"
+ #include "yagl_egl_onscreen_display.h"
+ #include "yagl_egl_onscreen_ts.h"
+ #include "yagl_egl_onscreen.h"
+ #include "yagl_log.h"
+ #include "yagl_process.h"
+ #include "yagl_thread.h"
+ #include "yagl_gles_driver.h"
+ #include "winsys_gl.h"
+
+ YAGL_DECLARE_TLS(struct yagl_egl_onscreen_ts*, egl_onscreen_ts);
+
+ static void yagl_egl_onscreen_surface_invalidate(struct yagl_eglb_surface *sfc,
+ yagl_winsys_id id)
+ {
+ struct yagl_egl_onscreen_surface *osfc =
+ (struct yagl_egl_onscreen_surface*)sfc;
+ struct yagl_egl_onscreen *egl_onscreen =
+ (struct yagl_egl_onscreen*)sfc->dpy->backend;
+ struct winsys_gl_surface *ws_sfc = NULL;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_surface_invalidate, NULL);
+
+ ws_sfc = (struct winsys_gl_surface*)egl_onscreen->wsi->acquire_surface(egl_onscreen->wsi, id);
+
+ if (!ws_sfc) {
+ YAGL_LOG_WARN("winsys surface %u not found", id);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ return;
+ }
+
+ if (ws_sfc == osfc->ws_sfc) {
+ ws_sfc->base.release(&ws_sfc->base);
+ YAGL_LOG_FUNC_EXIT(NULL);
+ return;
+ }
+
+ if (((osfc->ws_sfc->base.width != ws_sfc->base.width) ||
+ (osfc->ws_sfc->base.height != ws_sfc->base.height)) &&
+ osfc->rb) {
- yagl_unensure_ctx();
++ yagl_ensure_ctx(0);
+ egl_onscreen->gles_driver->DeleteRenderbuffers(1, &osfc->rb);
- egl_onscreen->gles_driver->GetIntegerv(GL_FRAMEBUFFER_BINDING,
++ yagl_unensure_ctx(0);
+ osfc->rb = 0;
+ }
+
+ osfc->ws_sfc->base.release(&osfc->ws_sfc->base);
+ osfc->ws_sfc = ws_sfc;
+
+ if (egl_onscreen_ts->sfc_draw == osfc) {
+ GLuint cur_fb = 0;
+
+ yagl_egl_onscreen_surface_setup(osfc);
+
- egl_onscreen->gles_driver->BindFramebuffer(GL_FRAMEBUFFER,
++ egl_onscreen->gles_driver->GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING,
+ (GLint*)&cur_fb);
+
- yagl_egl_onscreen_surface_attach_to_framebuffer(osfc);
++ egl_onscreen->gles_driver->BindFramebuffer(GL_DRAW_FRAMEBUFFER,
+ egl_onscreen_ts->ctx->fb);
+
- egl_onscreen->gles_driver->BindFramebuffer(GL_FRAMEBUFFER,
++ yagl_egl_onscreen_surface_attach_to_framebuffer(osfc,
++ GL_DRAW_FRAMEBUFFER);
+
- yagl_ensure_ctx();
++ egl_onscreen->gles_driver->BindFramebuffer(GL_DRAW_FRAMEBUFFER,
+ cur_fb);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static bool yagl_egl_onscreen_surface_query(struct yagl_eglb_surface *sfc,
+ EGLint attribute,
+ EGLint *value)
+ {
+ struct yagl_egl_onscreen_surface *osfc =
+ (struct yagl_egl_onscreen_surface*)sfc;
+
+ switch (attribute) {
+ case EGL_HEIGHT:
+ *value = yagl_egl_onscreen_surface_height(osfc);
+ break;
+ case EGL_WIDTH:
+ *value = yagl_egl_onscreen_surface_width(osfc);
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+ }
+
+ static void yagl_egl_onscreen_surface_swap_buffers(struct yagl_eglb_surface *sfc)
+ {
+ struct yagl_egl_onscreen_surface *osfc =
+ (struct yagl_egl_onscreen_surface*)sfc;
+ struct yagl_egl_onscreen *egl_onscreen =
+ (struct yagl_egl_onscreen*)sfc->dpy->backend;
+
+ egl_onscreen->gles_driver->Finish();
+
+ osfc->ws_sfc->base.set_dirty(&osfc->ws_sfc->base);
+ }
+
+ static void yagl_egl_onscreen_surface_copy_buffers(struct yagl_eglb_surface *sfc)
+ {
+ struct yagl_egl_onscreen_surface *osfc =
+ (struct yagl_egl_onscreen_surface*)sfc;
+ struct yagl_egl_onscreen *egl_onscreen =
+ (struct yagl_egl_onscreen*)sfc->dpy->backend;
+
+ egl_onscreen->gles_driver->Finish();
+
+ osfc->ws_sfc->base.set_dirty(&osfc->ws_sfc->base);
+ }
+
+ static void yagl_egl_onscreen_surface_wait_gl(struct yagl_eglb_surface *sfc)
+ {
+ struct yagl_egl_onscreen_surface *osfc =
+ (struct yagl_egl_onscreen_surface*)sfc;
+ struct yagl_egl_onscreen *egl_onscreen =
+ (struct yagl_egl_onscreen*)sfc->dpy->backend;
+
+ egl_onscreen->gles_driver->Finish();
+
+ osfc->ws_sfc->base.set_dirty(&osfc->ws_sfc->base);
+ }
+
+ static void yagl_egl_onscreen_surface_destroy(struct yagl_eglb_surface *sfc)
+ {
+ struct yagl_egl_onscreen_surface *osfc =
+ (struct yagl_egl_onscreen_surface*)sfc;
+ struct yagl_egl_onscreen *egl_onscreen =
+ (struct yagl_egl_onscreen*)sfc->dpy->backend;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_surface_destroy, NULL);
+
+ egl_onscreen->egl_driver->pbuffer_surface_destroy(
+ egl_onscreen->egl_driver,
+ ((struct yagl_egl_onscreen_display*)sfc->dpy)->native_dpy,
+ osfc->dummy_native_sfc);
+ osfc->dummy_native_sfc = EGL_NO_SURFACE;
+
+ if (osfc->ws_sfc) {
+ osfc->ws_sfc->base.release(&osfc->ws_sfc->base);
+ osfc->ws_sfc = NULL;
+ }
+
+ if (osfc->rb) {
- yagl_unensure_ctx();
++ yagl_ensure_ctx(0);
+ egl_onscreen->gles_driver->DeleteRenderbuffers(1, &osfc->rb);
-void yagl_egl_onscreen_surface_attach_to_framebuffer(struct yagl_egl_onscreen_surface *sfc)
++ yagl_unensure_ctx(0);
+ }
+
+ yagl_eglb_surface_cleanup(sfc);
+
+ g_free(osfc);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ struct yagl_egl_onscreen_surface
+ *yagl_egl_onscreen_surface_create_window(struct yagl_egl_onscreen_display *dpy,
+ const struct yagl_egl_native_config *cfg,
+ const struct yagl_egl_window_attribs *attribs,
+ yagl_winsys_id id)
+ {
+ struct yagl_egl_onscreen *egl_onscreen =
+ (struct yagl_egl_onscreen*)dpy->base.backend;
+ struct winsys_gl_surface *ws_sfc = NULL;
+ struct yagl_egl_onscreen_surface *sfc = NULL;
+ EGLSurface dummy_native_sfc = EGL_NO_SURFACE;
+ struct yagl_egl_pbuffer_attribs pbuffer_attribs;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_surface_create_window,
+ "dpy = %p, cfg = %d, id = %u",
+ dpy,
+ cfg->config_id,
+ id);
+
+ ws_sfc = (struct winsys_gl_surface*)egl_onscreen->wsi->acquire_surface(egl_onscreen->wsi, id);
+
+ if (!ws_sfc) {
+ goto fail;
+ }
+
+ yagl_egl_pbuffer_attribs_init(&pbuffer_attribs);
+
+ dummy_native_sfc = egl_onscreen->egl_driver->pbuffer_surface_create(egl_onscreen->egl_driver,
+ dpy->native_dpy,
+ cfg,
+ 1,
+ 1,
+ &pbuffer_attribs);
+
+ if (!dummy_native_sfc) {
+ goto fail;
+ }
+
+ sfc = g_malloc0(sizeof(*sfc));
+
+ yagl_eglb_surface_init(&sfc->base, &dpy->base, EGL_WINDOW_BIT, attribs);
+
+ sfc->dummy_native_sfc = dummy_native_sfc;
+ sfc->ws_sfc = ws_sfc;
+
+ sfc->base.invalidate = &yagl_egl_onscreen_surface_invalidate;
+ sfc->base.query = &yagl_egl_onscreen_surface_query;
+ sfc->base.swap_buffers = &yagl_egl_onscreen_surface_swap_buffers;
+ sfc->base.copy_buffers = &yagl_egl_onscreen_surface_copy_buffers;
+ sfc->base.wait_gl = &yagl_egl_onscreen_surface_wait_gl;
+ sfc->base.destroy = &yagl_egl_onscreen_surface_destroy;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return sfc;
+
+ fail:
+ if (ws_sfc) {
+ ws_sfc->base.release(&ws_sfc->base);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return NULL;
+ }
+
+ struct yagl_egl_onscreen_surface
+ *yagl_egl_onscreen_surface_create_pixmap(struct yagl_egl_onscreen_display *dpy,
+ const struct yagl_egl_native_config *cfg,
+ const struct yagl_egl_pixmap_attribs *attribs,
+ yagl_winsys_id id)
+ {
+ struct yagl_egl_onscreen *egl_onscreen =
+ (struct yagl_egl_onscreen*)dpy->base.backend;
+ struct winsys_gl_surface *ws_sfc = NULL;
+ struct yagl_egl_onscreen_surface *sfc = NULL;
+ EGLSurface dummy_native_sfc = EGL_NO_SURFACE;
+ struct yagl_egl_pbuffer_attribs pbuffer_attribs;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_surface_create_pixmap,
+ "dpy = %p, cfg = %d, id = %u",
+ dpy,
+ cfg->config_id,
+ id);
+
+ ws_sfc = (struct winsys_gl_surface*)egl_onscreen->wsi->acquire_surface(egl_onscreen->wsi, id);
+
+ if (!ws_sfc) {
+ goto fail;
+ }
+
+ yagl_egl_pbuffer_attribs_init(&pbuffer_attribs);
+
+ dummy_native_sfc = egl_onscreen->egl_driver->pbuffer_surface_create(egl_onscreen->egl_driver,
+ dpy->native_dpy,
+ cfg,
+ 1,
+ 1,
+ &pbuffer_attribs);
+
+ if (!dummy_native_sfc) {
+ goto fail;
+ }
+
+ sfc = g_malloc0(sizeof(*sfc));
+
+ yagl_eglb_surface_init(&sfc->base, &dpy->base, EGL_PIXMAP_BIT, attribs);
+
+ sfc->dummy_native_sfc = dummy_native_sfc;
+ sfc->ws_sfc = ws_sfc;
+
+ sfc->base.invalidate = &yagl_egl_onscreen_surface_invalidate;
+ sfc->base.query = &yagl_egl_onscreen_surface_query;
+ sfc->base.swap_buffers = &yagl_egl_onscreen_surface_swap_buffers;
+ sfc->base.copy_buffers = &yagl_egl_onscreen_surface_copy_buffers;
+ sfc->base.wait_gl = &yagl_egl_onscreen_surface_wait_gl;
+ sfc->base.destroy = &yagl_egl_onscreen_surface_destroy;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return sfc;
+
+ fail:
+ if (ws_sfc) {
+ ws_sfc->base.release(&ws_sfc->base);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return NULL;
+ }
+
+ struct yagl_egl_onscreen_surface
+ *yagl_egl_onscreen_surface_create_pbuffer(struct yagl_egl_onscreen_display *dpy,
+ const struct yagl_egl_native_config *cfg,
+ const struct yagl_egl_pbuffer_attribs *attribs,
+ yagl_winsys_id id)
+ {
+ struct yagl_egl_onscreen *egl_onscreen =
+ (struct yagl_egl_onscreen*)dpy->base.backend;
+ struct winsys_gl_surface *ws_sfc = NULL;
+ struct yagl_egl_onscreen_surface *sfc = NULL;
+ EGLSurface dummy_native_sfc = EGL_NO_SURFACE;
+ struct yagl_egl_pbuffer_attribs pbuffer_attribs;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_surface_create_pbuffer,
+ "dpy = %p, cfg = %d, id = %u",
+ dpy,
+ cfg->config_id,
+ id);
+
+ ws_sfc = (struct winsys_gl_surface*)egl_onscreen->wsi->acquire_surface(egl_onscreen->wsi, id);
+
+ if (!ws_sfc) {
+ goto fail;
+ }
+
+ yagl_egl_pbuffer_attribs_init(&pbuffer_attribs);
+
+ dummy_native_sfc = egl_onscreen->egl_driver->pbuffer_surface_create(egl_onscreen->egl_driver,
+ dpy->native_dpy,
+ cfg,
+ 1,
+ 1,
+ &pbuffer_attribs);
+
+ if (!dummy_native_sfc) {
+ goto fail;
+ }
+
+ sfc = g_malloc0(sizeof(*sfc));
+
+ yagl_eglb_surface_init(&sfc->base, &dpy->base, EGL_PBUFFER_BIT, attribs);
+
+ sfc->dummy_native_sfc = dummy_native_sfc;
+ sfc->ws_sfc = ws_sfc;
+
+ sfc->base.invalidate = &yagl_egl_onscreen_surface_invalidate;
+ sfc->base.query = &yagl_egl_onscreen_surface_query;
+ sfc->base.swap_buffers = &yagl_egl_onscreen_surface_swap_buffers;
+ sfc->base.copy_buffers = &yagl_egl_onscreen_surface_copy_buffers;
+ sfc->base.wait_gl = &yagl_egl_onscreen_surface_wait_gl;
+ sfc->base.destroy = &yagl_egl_onscreen_surface_destroy;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return sfc;
+
+ fail:
+ if (ws_sfc) {
+ ws_sfc->base.release(&ws_sfc->base);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return NULL;
+ }
+
+ void yagl_egl_onscreen_surface_setup(struct yagl_egl_onscreen_surface *sfc)
+ {
+ struct yagl_egl_onscreen *egl_onscreen =
+ (struct yagl_egl_onscreen*)sfc->base.dpy->backend;
+ GLuint cur_rb = 0;
+
+ if (sfc->rb) {
+ return;
+ }
+
+ egl_onscreen->gles_driver->GenRenderbuffers(1, &sfc->rb);
+
+ egl_onscreen->gles_driver->GetIntegerv(GL_RENDERBUFFER_BINDING,
+ (GLint*)&cur_rb);
+
+ egl_onscreen->gles_driver->BindRenderbuffer(GL_RENDERBUFFER, sfc->rb);
+
+ egl_onscreen->gles_driver->RenderbufferStorage(GL_RENDERBUFFER,
+ GL_DEPTH24_STENCIL8,
+ sfc->ws_sfc->base.width,
+ sfc->ws_sfc->base.height);
+
+ egl_onscreen->gles_driver->BindRenderbuffer(GL_RENDERBUFFER, cur_rb);
+ }
+
- egl_onscreen->gles_driver->FramebufferTexture2D(GL_FRAMEBUFFER,
++void yagl_egl_onscreen_surface_attach_to_framebuffer(struct yagl_egl_onscreen_surface *sfc,
++ GLenum target)
+ {
+ struct yagl_egl_onscreen *egl_onscreen =
+ (struct yagl_egl_onscreen*)sfc->base.dpy->backend;
+
- egl_onscreen->gles_driver->FramebufferRenderbuffer(GL_FRAMEBUFFER,
++ egl_onscreen->gles_driver->FramebufferTexture2D(target,
+ GL_COLOR_ATTACHMENT0,
+ GL_TEXTURE_2D,
+ sfc->ws_sfc->get_texture(sfc->ws_sfc),
+ 0);
- egl_onscreen->gles_driver->FramebufferRenderbuffer(GL_FRAMEBUFFER,
++ egl_onscreen->gles_driver->FramebufferRenderbuffer(target,
+ GL_DEPTH_ATTACHMENT,
+ GL_RENDERBUFFER,
+ sfc->rb);
++ egl_onscreen->gles_driver->FramebufferRenderbuffer(target,
+ GL_STENCIL_ATTACHMENT,
+ GL_RENDERBUFFER,
+ sfc->rb);
+ }
+
+ uint32_t yagl_egl_onscreen_surface_width(struct yagl_egl_onscreen_surface *sfc)
+ {
+ return sfc->ws_sfc->base.width;
+ }
+
+ uint32_t yagl_egl_onscreen_surface_height(struct yagl_egl_onscreen_surface *sfc)
+ {
+ return sfc->ws_sfc->base.height;
+ }
--- /dev/null
-void yagl_egl_onscreen_surface_attach_to_framebuffer(struct yagl_egl_onscreen_surface *sfc);
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #ifndef _QEMU_YAGL_EGL_ONSCREEN_SURFACE_H
+ #define _QEMU_YAGL_EGL_ONSCREEN_SURFACE_H
+
+ #include "yagl_eglb_surface.h"
+ #include "yagl_egl_surface_attribs.h"
+
+ struct yagl_egl_onscreen_display;
+ struct yagl_egl_native_config;
+
+ struct winsys_gl_surface;
+
+ struct yagl_egl_onscreen_surface
+ {
+ struct yagl_eglb_surface base;
+
+ /*
+ * 1x1 native pbuffer surface, used just to be able to make
+ * this surface current.
+ */
+ EGLSurface dummy_native_sfc;
+
+ /*
+ * winsys surface.
+ */
+ struct winsys_gl_surface *ws_sfc;
+
+ /*
+ * Depth and stencil renderbuffer for 'ws_sfc'. Allocated
+ * when this surface is made current for the first time.
+ */
+ GLuint rb;
+ };
+
+ struct yagl_egl_onscreen_surface
+ *yagl_egl_onscreen_surface_create_window(struct yagl_egl_onscreen_display *dpy,
+ const struct yagl_egl_native_config *cfg,
+ const struct yagl_egl_window_attribs *attribs,
+ yagl_winsys_id id);
+
+ struct yagl_egl_onscreen_surface
+ *yagl_egl_onscreen_surface_create_pixmap(struct yagl_egl_onscreen_display *dpy,
+ const struct yagl_egl_native_config *cfg,
+ const struct yagl_egl_pixmap_attribs *attribs,
+ yagl_winsys_id id);
+
+ struct yagl_egl_onscreen_surface
+ *yagl_egl_onscreen_surface_create_pbuffer(struct yagl_egl_onscreen_display *dpy,
+ const struct yagl_egl_native_config *cfg,
+ const struct yagl_egl_pbuffer_attribs *attribs,
+ yagl_winsys_id id);
+
+ void yagl_egl_onscreen_surface_setup(struct yagl_egl_onscreen_surface *sfc);
+
++void yagl_egl_onscreen_surface_attach_to_framebuffer(struct yagl_egl_onscreen_surface *sfc,
++ GLenum target);
+
+ uint32_t yagl_egl_onscreen_surface_width(struct yagl_egl_onscreen_surface *sfc);
+
+ uint32_t yagl_egl_onscreen_surface_height(struct yagl_egl_onscreen_surface *sfc);
+
+ #endif
--- /dev/null
- gles_driver = yagl_gles_ogl_create(egl_driver->dyn_lib);
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include "yagl_server.h"
+ #include "yagl_log.h"
+ #include "yagl_handle_gen.h"
+ #include "yagl_stats.h"
+ #include "yagl_process.h"
+ #include "yagl_thread.h"
+ #include "yagl_egl_driver.h"
+ #include "yagl_drivers/gles_ogl/yagl_gles_ogl.h"
+ #include "yagl_drivers/gles_onscreen/yagl_gles_onscreen.h"
+ #include "yagl_backends/egl_offscreen/yagl_egl_offscreen.h"
+ #include "yagl_backends/egl_onscreen/yagl_egl_onscreen.h"
+ #include "exec/cpu-all.h"
+ #include "hw/hw.h"
+ #include "hw/pci/pci.h"
+ #include <GL/gl.h>
+ #include "winsys.h"
+ #include "yagl_gles_driver.h"
+
+ #define PCI_VENDOR_ID_YAGL 0x19B1
+ #define PCI_DEVICE_ID_YAGL 0x1010
+
+ #define YAGL_REG_BUFFPTR 0
+ #define YAGL_REG_TRIGGER 4
+ #define YAGL_REGS_SIZE 8
+
+ #define YAGL_MEM_SIZE 0x1000
+
+ #define YAGL_MAX_USERS (YAGL_MEM_SIZE / YAGL_REGS_SIZE)
+
+ struct work_queue;
+
+ struct yagl_user
+ {
+ bool activated;
+ yagl_pid process_id;
+ yagl_tid thread_id;
+ };
+
+ typedef struct YaGLState
+ {
+ PCIDevice dev;
+
+ void *display;
+
+ struct work_queue *render_queue;
+
+ struct winsys_interface *wsi;
+
+ MemoryRegion iomem;
+ struct yagl_server_state *ss;
+ struct yagl_user users[YAGL_MAX_USERS];
+ } YaGLState;
+
+ #define TYPE_YAGL_DEVICE "yagl"
+
+ static void yagl_device_operate(YaGLState *s, int user_index, hwaddr buff_pa)
+ {
+ yagl_pid target_pid;
+ yagl_tid target_tid;
+ hwaddr buff_len = TARGET_PAGE_SIZE;
+ uint8_t *buff = NULL;
+
+ YAGL_LOG_FUNC_ENTER(yagl_device_operate,
+ "user_index = %d, buff_pa = 0x%X",
+ user_index,
+ (uint32_t)buff_pa);
+
+ if (!buff_pa && !s->users[user_index].activated) {
+ YAGL_LOG_CRITICAL("user %d is not activated", user_index);
+ goto out;
+ }
+
+ if (buff_pa) {
+ buff = cpu_physical_memory_map(buff_pa, &buff_len, false);
+
+ if (!buff || (buff_len != TARGET_PAGE_SIZE)) {
+ YAGL_LOG_CRITICAL("cpu_physical_memory_map(read) failed for user %d, buff_pa = 0x%X",
+ user_index,
+ (uint32_t)buff_pa);
+ goto out;
+ }
+
+ if (s->users[user_index].activated) {
+ /*
+ * Update user.
+ */
+
+ yagl_server_dispatch_update(s->ss,
+ s->users[user_index].process_id,
+ s->users[user_index].thread_id,
+ buff);
+ } else {
+ /*
+ * Activate user.
+ */
+
+ if (yagl_server_dispatch_init(s->ss,
+ buff,
+ &target_pid,
+ &target_tid)) {
+ s->users[user_index].activated = true;
+ s->users[user_index].process_id = target_pid;
+ s->users[user_index].thread_id = target_tid;
+
+ YAGL_LOG_INFO("user %d activated", user_index);
+
+ /*
+ * The buff is now owned by client.
+ */
+ buff = NULL;
+ }
+ }
+ } else {
+ /*
+ * Deactivate user.
+ */
+
+ yagl_server_dispatch_exit(s->ss,
+ s->users[user_index].process_id,
+ s->users[user_index].thread_id);
+
+ memset(&s->users[user_index], 0, sizeof(s->users[user_index]));
+
+ YAGL_LOG_INFO("user %d deactivated", user_index);
+ }
+
+ out:
+ if (buff) {
+ cpu_physical_memory_unmap(buff,
+ TARGET_PAGE_SIZE,
+ 0,
+ TARGET_PAGE_SIZE);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static void yagl_device_trigger(YaGLState *s, int user_index, bool sync)
+ {
+ YAGL_LOG_FUNC_ENTER(yagl_device_trigger, "%d, %d", user_index, sync);
+
+ if (s->users[user_index].activated) {
+ yagl_server_dispatch_batch(s->ss,
+ s->users[user_index].process_id,
+ s->users[user_index].thread_id,
+ sync);
+ } else {
+ YAGL_LOG_CRITICAL("user %d not activated", user_index);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static uint64_t yagl_device_read(void *opaque, hwaddr offset,
+ unsigned size)
+ {
+ return 0;
+ }
+
+ static void yagl_device_write(void *opaque, hwaddr offset,
+ uint64_t value, unsigned size)
+ {
+ YaGLState *s = (YaGLState*)opaque;
+ int user_index = (offset / YAGL_REGS_SIZE);
+ offset -= user_index * YAGL_REGS_SIZE;
+
+ assert(user_index < YAGL_MAX_USERS);
+
+ if (user_index >= YAGL_MAX_USERS) {
+ YAGL_LOG_CRITICAL("bad user index = %d", user_index);
+ return;
+ }
+
+ switch (offset) {
+ case YAGL_REG_BUFFPTR:
+ yagl_device_operate(s, user_index, value);
+ break;
+ case YAGL_REG_TRIGGER:
+ yagl_device_trigger(s, user_index, value);
+ break;
+ default:
+ YAGL_LOG_CRITICAL("user %d, bad offset = %d", user_index, offset);
+ break;
+ }
+ }
+
+ static const MemoryRegionOps yagl_device_ops =
+ {
+ .read = yagl_device_read,
+ .write = yagl_device_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ };
+
+ static int yagl_device_init(PCIDevice *dev)
+ {
+ YaGLState *s = DO_UPCAST(YaGLState, dev, dev);
+ struct yagl_egl_driver *egl_driver = NULL;
+ struct yagl_egl_backend *egl_backend = NULL;
+ struct yagl_gles_driver *gles_driver = NULL;
+
+ yagl_log_init();
+
+ YAGL_LOG_FUNC_ENTER(yagl_device_init, NULL);
+
+ memory_region_init_io(&s->iomem, OBJECT(s),
+ &yagl_device_ops,
+ s,
+ TYPE_YAGL_DEVICE,
+ YAGL_MEM_SIZE);
+
+ yagl_handle_gen_init();
+
+ egl_driver = yagl_egl_driver_create(s->display);
+
+ if (!egl_driver) {
+ goto fail;
+ }
+
++ gles_driver = yagl_gles_ogl_create(egl_driver->dyn_lib,
++ egl_driver->gl_version);
+
+ if (!gles_driver) {
+ goto fail;
+ }
+
+ if (s->wsi) {
+ egl_backend = yagl_egl_onscreen_create(s->wsi,
+ egl_driver,
+ gles_driver);
+ gles_driver = yagl_gles_onscreen_create(gles_driver);
+ } else {
+ egl_backend = yagl_egl_offscreen_create(egl_driver, gles_driver);
+ }
+
+ if (!egl_backend) {
+ goto fail;
+ }
+
+ /*
+ * Now owned by EGL backend.
+ */
+ egl_driver = NULL;
+
+ s->ss = yagl_server_state_create(egl_backend, gles_driver,
+ s->render_queue, s->wsi);
+
+ /*
+ * Owned/destroyed by server state.
+ */
+ egl_backend = NULL;
+ gles_driver = NULL;
+
+ if (!s->ss) {
+ goto fail;
+ }
+
+ pci_register_bar(&s->dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->iomem);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return 0;
+
+ fail:
+ if (egl_backend) {
+ egl_backend->destroy(egl_backend);
+ }
+
+ if (gles_driver) {
+ gles_driver->destroy(gles_driver);
+ }
+
+ if (egl_driver) {
+ egl_driver->destroy(egl_driver);
+ }
+
+ yagl_handle_gen_cleanup();
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ yagl_log_cleanup();
+
+ return -1;
+ }
+
+ static void yagl_device_reset(DeviceState *d)
+ {
+ YaGLState *s = container_of(d, YaGLState, dev.qdev);
+ int i;
+
+ YAGL_LOG_FUNC_ENTER(yagl_device_reset, NULL);
+
+ yagl_server_reset(s->ss);
+
+ yagl_handle_gen_reset();
+
+ for (i = 0; i < YAGL_MAX_USERS; ++i) {
+ memset(&s->users[i], 0, sizeof(s->users[i]));
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static void yagl_device_exit(PCIDevice *dev)
+ {
+ YaGLState *s = DO_UPCAST(YaGLState, dev, dev);
+
+ YAGL_LOG_FUNC_ENTER(yagl_device_exit, NULL);
+
+ memory_region_destroy(&s->iomem);
+
+ yagl_server_state_destroy(s->ss);
+
+ yagl_handle_gen_cleanup();
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ yagl_log_cleanup();
+ }
+
+ static Property yagl_properties[] = {
+ {
+ .name = "display",
+ .info = &qdev_prop_ptr,
+ .offset = offsetof(YaGLState, display),
+ },
+ {
+ .name = "render_queue",
+ .info = &qdev_prop_ptr,
+ .offset = offsetof(YaGLState, render_queue),
+ },
+ {
+ .name = "winsys_gl_interface",
+ .info = &qdev_prop_ptr,
+ .offset = offsetof(YaGLState, wsi),
+ },
+ DEFINE_PROP_END_OF_LIST(),
+ };
+
+ static void yagl_class_init(ObjectClass *klass, void *data)
+ {
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
+
+ k->init = yagl_device_init;
+ k->exit = yagl_device_exit;
+ k->vendor_id = PCI_VENDOR_ID_YAGL;
+ k->device_id = PCI_DEVICE_ID_YAGL;
+ k->class_id = PCI_CLASS_OTHERS;
+ dc->reset = yagl_device_reset;
+ dc->props = yagl_properties;
+ dc->desc = "YaGL device";
+ }
+
+ static TypeInfo yagl_device_info =
+ {
+ .name = TYPE_YAGL_DEVICE,
+ .parent = TYPE_PCI_DEVICE,
+ .instance_size = sizeof(YaGLState),
+ .class_init = yagl_class_init,
+ };
+
+ static void yagl_register_types(void)
+ {
+ type_register_static(&yagl_device_info);
+ }
+
+ type_init(yagl_register_types)
--- /dev/null
- ctx = egl_glx->glXCreateNewContext(dpy,
- (GLXFBConfig)cfg->driver_data,
- GLX_RGBA_TYPE,
- ((share_context == EGL_NO_CONTEXT) ?
- NULL
- : (GLXContext)share_context),
- True);
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include "yagl_egl_driver.h"
+ #include "yagl_dyn_lib.h"
+ #include "yagl_log.h"
+ #include "yagl_tls.h"
+ #include "yagl_thread.h"
+ #include "yagl_process.h"
+ #include "yagl_egl_native_config.h"
+ #include "yagl_egl_surface_attribs.h"
+ #include <GL/glx.h>
+
+ #define YAGL_EGL_GLX_ENTER(func, format, ...) \
+ YAGL_LOG_FUNC_ENTER(func, format,##__VA_ARGS__)
+
+ #define YAGL_EGL_GLX_GET_PROC(proc_type, proc_name) \
+ do { \
+ egl_glx->proc_name = \
+ (proc_type)egl_glx->glXGetProcAddress((const GLubyte*)#proc_name); \
+ if (!egl_glx->proc_name) { \
+ YAGL_LOG_ERROR("Unable to get symbol: %s", \
+ yagl_dyn_lib_get_error(egl_driver->dyn_lib)); \
+ goto fail; \
+ } \
+ } while (0)
+
+ #define YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(attribute, value) \
+ if (egl_glx->glXGetFBConfigAttrib(dpy, glx_cfg, (attribute), (value)) != Success) { \
+ YAGL_LOG_WARN("glXGetFBConfigAttrib failed to get " #attribute); \
+ YAGL_LOG_FUNC_EXIT(NULL); \
+ return false; \
+ }
+
+ #ifndef GLX_VERSION_1_4
+ #error GL/glx.h must be equal to or greater than GLX 1.4
+ #endif
+
+ /* GLX 1.0 */
+ typedef GLXContext (*GLXCREATECONTEXTPROC)( Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct );
+ typedef void (*GLXDESTROYCONTEXTPROC)( Display *dpy, GLXContext ctx );
+ typedef Bool (*GLXMAKECURRENTPROC)( Display *dpy, GLXDrawable drawable, GLXContext ctx);
+ typedef void (*GLXSWAPBUFFERSPROC)( Display *dpy, GLXDrawable drawable );
+ typedef GLXPixmap (*GLXCREATEGLXPIXMAPPROC)( Display *dpy, XVisualInfo *visual, Pixmap pixmap );
+ typedef void (*GLXDESTROYGLXPIXMAPPROC)( Display *dpy, GLXPixmap pixmap );
+ typedef Bool (*GLXQUERYVERSIONPROC)( Display *dpy, int *maj, int *min );
+ typedef int (*GLXGETCONFIGPROC)( Display *dpy, XVisualInfo *visual, int attrib, int *value );
+ typedef void (*GLXWAITGLPROC)( void );
+ typedef void (*GLXWAITXPROC)( void );
+
+ /* GLX 1.1 */
+ typedef const char *(*GLXQUERYEXTENSIONSSTRINGPROC)( Display *dpy, int screen );
+ typedef const char *(*GLXQUERYSERVERSTRINGPROC)( Display *dpy, int screen, int name );
+ typedef const char *(*GLXGETCLIENTSTRINGPROC)( Display *dpy, int name );
+
+ struct yagl_egl_glx
+ {
+ struct yagl_egl_driver base;
+
+ EGLNativeDisplayType global_dpy;
+
+ /* GLX 1.0 */
+ GLXCREATECONTEXTPROC glXCreateContext;
+ GLXDESTROYCONTEXTPROC glXDestroyContext;
+ GLXMAKECURRENTPROC glXMakeCurrent;
+ GLXSWAPBUFFERSPROC glXSwapBuffers;
+ GLXCREATEGLXPIXMAPPROC glXCreateGLXPixmap;
+ GLXDESTROYGLXPIXMAPPROC glXDestroyGLXPixmap;
+ GLXQUERYVERSIONPROC glXQueryVersion;
+ GLXGETCONFIGPROC glXGetConfig;
+ GLXWAITGLPROC glXWaitGL;
+ GLXWAITXPROC glXWaitX;
+
+ /* GLX 1.1 */
+ GLXQUERYEXTENSIONSSTRINGPROC glXQueryExtensionsString;
+ GLXQUERYSERVERSTRINGPROC glXQueryServerString;
+ GLXGETCLIENTSTRINGPROC glXGetClientString;
+
+ /* GLX 1.3 or (GLX_SGI_make_current_read and GLX_SGIX_fbconfig) */
+ PFNGLXGETFBCONFIGSPROC glXGetFBConfigs;
+ PFNGLXGETFBCONFIGATTRIBPROC glXGetFBConfigAttrib;
+ PFNGLXGETVISUALFROMFBCONFIGPROC glXGetVisualFromFBConfig;
++ PFNGLXCHOOSEFBCONFIGPROC glXChooseFBConfig;
+ PFNGLXCREATEWINDOWPROC glXCreateWindow;
+ PFNGLXDESTROYWINDOWPROC glXDestroyWindow;
+ PFNGLXCREATEPIXMAPPROC glXCreatePixmap;
+ PFNGLXDESTROYPIXMAPPROC glXDestroyPixmap;
+ PFNGLXCREATEPBUFFERPROC glXCreatePbuffer;
+ PFNGLXDESTROYPBUFFERPROC glXDestroyPbuffer;
+ PFNGLXCREATENEWCONTEXTPROC glXCreateNewContext;
+ PFNGLXMAKECONTEXTCURRENTPROC glXMakeContextCurrent;
+
+ /* GLX 1.4 or GLX_ARB_get_proc_address */
+ PFNGLXGETPROCADDRESSPROC glXGetProcAddress;
++
++ /* GLX_ARB_create_context */
++ PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB;
+ };
+
++static bool yagl_egl_glx_get_gl_version(struct yagl_egl_glx *egl_glx,
++ yagl_gl_version *version)
++{
++ int config_attribs[] =
++ {
++ GLX_DOUBLEBUFFER, True,
++ GLX_RED_SIZE, 8,
++ GLX_GREEN_SIZE, 8,
++ GLX_BLUE_SIZE, 8,
++ GLX_ALPHA_SIZE, 8,
++ GLX_BUFFER_SIZE, 32,
++ GLX_DEPTH_SIZE, 24,
++ GLX_STENCIL_SIZE, 8,
++ GLX_RENDER_TYPE, GLX_RGBA_BIT,
++ GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
++ None
++ };
++ int ctx_attribs[] =
++ {
++ GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
++ GLX_CONTEXT_MINOR_VERSION_ARB, 1,
++ GLX_RENDER_TYPE, GLX_RGBA_TYPE,
++ GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
++ None
++ };
++ int surface_attribs[] = {
++ GLX_PBUFFER_WIDTH, 1,
++ GLX_PBUFFER_HEIGHT, 1,
++ GLX_LARGEST_PBUFFER, False,
++ GLX_PRESERVED_CONTENTS, False,
++ None
++ };
++ bool res = false;
++ const char *tmp;
++ int n = 0;
++ GLXFBConfig *configs = NULL;
++ GLXContext ctx = NULL;
++ GLXPbuffer pbuffer = 0;
++ const GLubyte *(GLAPIENTRY *GetStringi)(GLenum, GLuint) = NULL;
++ void (GLAPIENTRY *GetIntegerv)(GLenum, GLint*) = NULL;
++ GLint i, num_extensions = 0;
++ GLint major = 0, minor = 0;
++
++ YAGL_EGL_GLX_ENTER(yagl_egl_glx_get_gl_version, NULL);
++
++ tmp = getenv("YAGL_GL_VERSION");
++
++ if (tmp) {
++ if (strcmp(tmp, "gl_2") == 0) {
++ YAGL_LOG_INFO("YAGL_GL_VERSION forces OpenGL version to 2.1");
++ *version = yagl_gl_2;
++ res = true;
++ } else if (strcmp(tmp, "gl_3_1") == 0) {
++ YAGL_LOG_INFO("YAGL_GL_VERSION forces OpenGL version to 3.1");
++ *version = yagl_gl_3_1;
++ res = true;
++ } else if (strcmp(tmp, "gl_3_1_es3") == 0) {
++ YAGL_LOG_INFO("YAGL_GL_VERSION forces OpenGL version to 3.1 ES3");
++ *version = yagl_gl_3_1_es3;
++ res = true;
++ } else if (strcmp(tmp, "gl_3_2") == 0) {
++ YAGL_LOG_INFO("YAGL_GL_VERSION forces OpenGL version to 3.2");
++ *version = yagl_gl_3_2;
++ res = true;
++ } else {
++ YAGL_LOG_CRITICAL("Bad YAGL_GL_VERSION value = %s", tmp);
++ }
++
++ goto out;
++ }
++
++ configs = egl_glx->glXChooseFBConfig(egl_glx->global_dpy,
++ DefaultScreen(egl_glx->global_dpy),
++ config_attribs,
++ &n);
++
++ if (n <= 0) {
++ YAGL_LOG_ERROR("glXChooseFBConfig failed");
++ goto out;
++ }
++
++ ctx = egl_glx->glXCreateContextAttribsARB(egl_glx->global_dpy,
++ configs[0],
++ NULL,
++ True,
++ ctx_attribs);
++
++ if (!ctx) {
++ YAGL_LOG_INFO("glXCreateContextAttribsARB failed, using OpenGL 2.1");
++ *version = yagl_gl_2;
++ res = true;
++ goto out;
++ }
++
++ pbuffer = egl_glx->glXCreatePbuffer(egl_glx->global_dpy,
++ configs[0],
++ surface_attribs);
++
++ if (!pbuffer) {
++ YAGL_LOG_ERROR("glXCreatePbuffer failed");
++ goto out;
++ }
++
++ if (!egl_glx->glXMakeContextCurrent(egl_glx->global_dpy,
++ pbuffer, pbuffer, ctx)) {
++ YAGL_LOG_ERROR("glXMakeContextCurrent failed");
++ goto out;
++ }
++
++ GetStringi = yagl_dyn_lib_get_ogl_procaddr(egl_glx->base.dyn_lib,
++ "glGetStringi");
++
++ if (!GetStringi) {
++ YAGL_LOG_ERROR("Unable to get symbol: %s",
++ yagl_dyn_lib_get_error(egl_glx->base.dyn_lib));
++ goto out;
++ }
++
++ GetIntegerv = yagl_dyn_lib_get_ogl_procaddr(egl_glx->base.dyn_lib,
++ "glGetIntegerv");
++
++ if (!GetIntegerv) {
++ YAGL_LOG_ERROR("Unable to get symbol: %s",
++ yagl_dyn_lib_get_error(egl_glx->base.dyn_lib));
++ goto out;
++ }
++
++ GetIntegerv(GL_NUM_EXTENSIONS, &num_extensions);
++
++ for (i = 0; i < num_extensions; ++i) {
++ tmp = (const char*)GetStringi(GL_EXTENSIONS, i);
++ if (strcmp(tmp, "GL_ARB_ES3_compatibility") == 0) {
++ YAGL_LOG_INFO("GL_ARB_ES3_compatibility supported, using OpenGL 3.1 ES3");
++ *version = yagl_gl_3_1_es3;
++ res = true;
++ goto out;
++ }
++ }
++
++ /*
++ * No GL_ARB_ES3_compatibility, so we need at least OpenGL 3.2 to be
++ * able to patch shaders and run them with GLSL 1.50.
++ */
++
++ GetIntegerv(GL_MAJOR_VERSION, &major);
++ GetIntegerv(GL_MINOR_VERSION, &minor);
++
++ if ((major > 3) ||
++ ((major == 3) && (minor >= 2))) {
++ YAGL_LOG_INFO("GL_ARB_ES3_compatibility not supported, using OpenGL 3.2");
++ *version = yagl_gl_3_2;
++ res = true;
++ goto out;
++ }
++
++ YAGL_LOG_INFO("GL_ARB_ES3_compatibility not supported, OpenGL 3.2 not supported, using OpenGL 3.1");
++ *version = yagl_gl_3_1;
++ res = true;
++
++out:
++ if (pbuffer) {
++ egl_glx->glXDestroyPbuffer(egl_glx->global_dpy, pbuffer);
++ }
++ if (ctx) {
++ egl_glx->glXMakeContextCurrent(egl_glx->global_dpy, 0, 0, NULL);
++ egl_glx->glXDestroyContext(egl_glx->global_dpy, ctx);
++ }
++ if (configs) {
++ XFree(configs);
++ }
++
++ if (res) {
++ YAGL_LOG_FUNC_EXIT("%d, version = %u", res, *version);
++ } else {
++ YAGL_LOG_FUNC_EXIT("%d", res);
++ }
++
++ return res;
++}
++
+ /*
+ * INTERNAL IMPLEMENTATION FUNCTIONS
+ * @{
+ */
+
+ static bool yagl_egl_glx_config_fill(struct yagl_egl_driver *driver,
+ EGLNativeDisplayType dpy,
+ struct yagl_egl_native_config *cfg,
+ GLXFBConfig glx_cfg)
+ {
+ struct yagl_egl_glx *egl_glx = (struct yagl_egl_glx*)driver;
+ int tmp = 0;
+ int transparent_type = 0;
+ int trans_red_val = 0;
+ int trans_green_val = 0;
+ int trans_blue_val = 0;
+ int buffer_size = 0;
+ int red_size = 0;
+ int green_size = 0;
+ int blue_size = 0;
+ int alpha_size = 0;
+ int depth_size = 0;
+ int stencil_size = 0;
+ int native_visual_id = 0;
+ int native_visual_type = 0;
+ int caveat = 0;
+ int max_pbuffer_width = 0;
+ int max_pbuffer_height = 0;
+ int max_pbuffer_size = 0;
+ int frame_buffer_level = 0;
+ int config_id = 0;
+ int samples_per_pixel = 0;
+
+ YAGL_EGL_GLX_ENTER(yagl_egl_glx_config_fill, NULL);
+
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_FBCONFIG_ID, &config_id);
+
+ YAGL_LOG_TRACE("id = %d", config_id);
+
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_RENDER_TYPE, &tmp);
+
+ if ((tmp & GLX_RGBA_BIT) == 0) {
+ YAGL_LOG_FUNC_EXIT(NULL);
+ return false;
+ }
+
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_DRAWABLE_TYPE, &tmp);
+
+ if ((tmp & GLX_PBUFFER_BIT) == 0) {
+ YAGL_LOG_FUNC_EXIT(NULL);
+ return false;
+ }
+
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_TRANSPARENT_TYPE, &tmp);
+
+ if (tmp == GLX_TRANSPARENT_INDEX) {
+ YAGL_LOG_FUNC_EXIT(NULL);
+ return false;
+ } else if(tmp == GLX_NONE) {
+ transparent_type = EGL_NONE;
+ } else {
+ transparent_type = EGL_TRANSPARENT_RGB;
+
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_TRANSPARENT_RED_VALUE, &trans_red_val);
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_TRANSPARENT_GREEN_VALUE, &trans_green_val);
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_TRANSPARENT_BLUE_VALUE, &trans_blue_val);
+ }
+
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_BUFFER_SIZE, &buffer_size);
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_RED_SIZE, &red_size);
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_GREEN_SIZE, &green_size);
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_BLUE_SIZE, &blue_size);
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_ALPHA_SIZE, &alpha_size);
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_DEPTH_SIZE, &depth_size);
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_STENCIL_SIZE, &stencil_size);
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_X_VISUAL_TYPE, &native_visual_type);
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_VISUAL_ID, &native_visual_id);
+
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_CONFIG_CAVEAT, &tmp);
+
+ if (tmp == GLX_NONE) {
+ caveat = EGL_NONE;
+ } else if (tmp == GLX_SLOW_CONFIG) {
+ caveat = EGL_SLOW_CONFIG;
+ } else if (tmp == GLX_NON_CONFORMANT_CONFIG) {
+ caveat = EGL_NON_CONFORMANT_CONFIG;
+ }
+
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_MAX_PBUFFER_WIDTH, &max_pbuffer_width);
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_MAX_PBUFFER_HEIGHT, &max_pbuffer_height);
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_MAX_PBUFFER_PIXELS, &max_pbuffer_size);
+
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_LEVEL, &frame_buffer_level);
+ YAGL_EGL_GLX_GET_CONFIG_ATTRIB_RET(GLX_SAMPLES, &samples_per_pixel);
+
+ yagl_egl_native_config_init(cfg);
+
+ cfg->red_size = red_size;
+ cfg->green_size = green_size;
+ cfg->blue_size = blue_size;
+ cfg->alpha_size = alpha_size;
+ cfg->buffer_size = buffer_size;
+ cfg->caveat = caveat;
+ cfg->config_id = config_id;
+ cfg->frame_buffer_level = frame_buffer_level;
+ cfg->depth_size = depth_size;
+ cfg->max_pbuffer_width = max_pbuffer_width;
+ cfg->max_pbuffer_height = max_pbuffer_height;
+ cfg->max_pbuffer_size = max_pbuffer_size;
+ cfg->max_swap_interval = 1000;
+ cfg->min_swap_interval = 0;
+ cfg->native_visual_id = native_visual_id;
+ cfg->native_visual_type = native_visual_type;
+ cfg->samples_per_pixel = samples_per_pixel;
+ cfg->stencil_size = stencil_size;
+ cfg->transparent_type = transparent_type;
+ cfg->trans_red_val = trans_red_val;
+ cfg->trans_green_val = trans_green_val;
+ cfg->trans_blue_val = trans_blue_val;
+
+ cfg->driver_data = glx_cfg;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return true;
+ }
+
+ /*
+ * @}
+ */
+
+ /*
+ * PUBLIC FUNCTIONS
+ * @{
+ */
+
+ static EGLNativeDisplayType yagl_egl_glx_display_open(struct yagl_egl_driver *driver)
+ {
+ struct yagl_egl_glx *egl_glx = (struct yagl_egl_glx*)driver;
+
+ YAGL_EGL_GLX_ENTER(yagl_egl_glx_display_open, NULL);
+
+ YAGL_LOG_FUNC_EXIT("%p", egl_glx->global_dpy);
+
+ return egl_glx->global_dpy;
+ }
+
+ static void yagl_egl_glx_display_close(struct yagl_egl_driver *driver,
+ EGLNativeDisplayType dpy)
+ {
+ YAGL_EGL_GLX_ENTER(yagl_egl_glx_display_close, "%p", dpy);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static struct yagl_egl_native_config
+ *yagl_egl_glx_config_enum(struct yagl_egl_driver *driver,
+ EGLNativeDisplayType dpy,
+ int *num_configs)
+ {
+ struct yagl_egl_glx *egl_glx = (struct yagl_egl_glx*)driver;
+ struct yagl_egl_native_config *configs = NULL;
+ int glx_cfg_index, cfg_index, n;
+ GLXFBConfig *glx_configs;
+
+ YAGL_EGL_GLX_ENTER(yagl_egl_glx_config_enum, "%p", dpy);
+
+ *num_configs = 0;
+
+ glx_configs = egl_glx->glXGetFBConfigs(dpy, DefaultScreen(dpy), &n);
+
+ YAGL_LOG_TRACE("got %d configs", n);
+
+ configs = g_malloc0(n * sizeof(*configs));
+
+ for (glx_cfg_index = 0, cfg_index = 0; glx_cfg_index < n; ++glx_cfg_index) {
+ if (yagl_egl_glx_config_fill(driver,
+ dpy,
+ &configs[cfg_index],
+ glx_configs[glx_cfg_index])) {
+ ++cfg_index;
+ } else {
+ /*
+ * Clean up so we could construct here again.
+ */
+ memset(&configs[cfg_index],
+ 0,
+ sizeof(struct yagl_egl_native_config));
+ }
+ }
+
+ *num_configs = cfg_index;
+
+ XFree(glx_configs);
+
+ YAGL_LOG_DEBUG("glXGetFBConfigs returned %d configs, %d are usable",
+ n,
+ *num_configs);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return configs;
+ }
+
+ static void yagl_egl_glx_config_cleanup(struct yagl_egl_driver *driver,
+ EGLNativeDisplayType dpy,
+ const struct yagl_egl_native_config *cfg)
+ {
+ YAGL_EGL_GLX_ENTER(yagl_egl_glx_config_cleanup,
+ "dpy = %p, cfg = %d",
+ dpy,
+ cfg->config_id);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static EGLSurface yagl_egl_glx_pbuffer_surface_create(struct yagl_egl_driver *driver,
+ EGLNativeDisplayType dpy,
+ const struct yagl_egl_native_config *cfg,
+ EGLint width,
+ EGLint height,
+ const struct yagl_egl_pbuffer_attribs *attribs)
+ {
+ struct yagl_egl_glx *egl_glx = (struct yagl_egl_glx*)driver;
+ int glx_attribs[] = {
+ GLX_PBUFFER_WIDTH, width,
+ GLX_PBUFFER_HEIGHT, height,
+ GLX_LARGEST_PBUFFER, False,
+ GLX_PRESERVED_CONTENTS, True,
+ None
+ };
+ GLXPbuffer pbuffer;
+
+ YAGL_EGL_GLX_ENTER(yagl_egl_glx_pbuffer_surface_create,
+ "dpy = %p, width = %d, height = %d",
+ dpy,
+ width,
+ height);
+
+ pbuffer = egl_glx->glXCreatePbuffer(dpy,
+ (GLXFBConfig)cfg->driver_data,
+ glx_attribs);
+
+ if (!pbuffer) {
+ YAGL_LOG_ERROR("glXCreatePbuffer failed");
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return EGL_NO_SURFACE;
+ } else {
+ YAGL_LOG_FUNC_EXIT("%p", (EGLSurface)pbuffer);
+
+ return (EGLSurface)pbuffer;
+ }
+ }
+
+ static void yagl_egl_glx_pbuffer_surface_destroy(struct yagl_egl_driver *driver,
+ EGLNativeDisplayType dpy,
+ EGLSurface sfc)
+ {
+ struct yagl_egl_glx *egl_glx = (struct yagl_egl_glx*)driver;
+
+ YAGL_EGL_GLX_ENTER(yagl_egl_glx_pbuffer_surface_destroy,
+ "dpy = %p, sfc = %p",
+ dpy,
+ sfc);
+
+ egl_glx->glXDestroyPbuffer(dpy, (GLXPbuffer)sfc);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static EGLContext yagl_egl_glx_context_create(struct yagl_egl_driver *driver,
+ EGLNativeDisplayType dpy,
+ const struct yagl_egl_native_config *cfg,
+ EGLContext share_context)
+ {
+ struct yagl_egl_glx *egl_glx = (struct yagl_egl_glx*)driver;
+ GLXContext ctx;
++ int attribs[] =
++ {
++ GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
++ GLX_CONTEXT_MINOR_VERSION_ARB, 1,
++ GLX_RENDER_TYPE, GLX_RGBA_TYPE,
++ GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
++ None
++ };
+
+ YAGL_EGL_GLX_ENTER(yagl_egl_glx_context_create,
+ "dpy = %p, share_context = %p",
+ dpy,
+ share_context);
+
- YAGL_LOG_ERROR("glXCreateNewContext failed");
++ if (egl_glx->base.gl_version > yagl_gl_2) {
++ ctx = egl_glx->glXCreateContextAttribsARB(dpy,
++ (GLXFBConfig)cfg->driver_data,
++ ((share_context == EGL_NO_CONTEXT) ?
++ NULL
++ : (GLXContext)share_context),
++ True,
++ attribs);
++ } else {
++ ctx = egl_glx->glXCreateNewContext(dpy,
++ (GLXFBConfig)cfg->driver_data,
++ GLX_RGBA_TYPE,
++ ((share_context == EGL_NO_CONTEXT) ?
++ NULL
++ : (GLXContext)share_context),
++ True);
++ }
+
+ if (!ctx) {
++ YAGL_LOG_ERROR("glXCreateContextAttribsARB/glXCreateNewContext failed");
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return EGL_NO_CONTEXT;
+ } else {
+ YAGL_LOG_FUNC_EXIT("%p", (EGLContext)ctx);
+
+ return (EGLContext)ctx;
+ }
+ }
+
+ static void yagl_egl_glx_context_destroy(struct yagl_egl_driver *driver,
+ EGLNativeDisplayType dpy,
+ EGLContext ctx)
+ {
+ struct yagl_egl_glx *egl_glx = (struct yagl_egl_glx*)driver;
+
+ YAGL_EGL_GLX_ENTER(yagl_egl_glx_context_destroy,
+ "dpy = %p, ctx = %p",
+ dpy,
+ ctx);
+
+ egl_glx->glXDestroyContext(dpy, (GLXContext)ctx);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ static bool yagl_egl_glx_make_current(struct yagl_egl_driver *driver,
+ EGLNativeDisplayType dpy,
+ EGLSurface draw,
+ EGLSurface read,
+ EGLContext ctx)
+ {
+ struct yagl_egl_glx *egl_glx = (struct yagl_egl_glx*)driver;
+ bool ret;
+
+ YAGL_EGL_GLX_ENTER(yagl_egl_glx_make_current,
+ "dpy = %p, draw = %p, read = %p, ctx = %p",
+ dpy,
+ draw,
+ read,
+ ctx);
+
+ ret = egl_glx->glXMakeContextCurrent(dpy, (GLXDrawable)draw, (GLXDrawable)read, (GLXContext)ctx);
+
+ YAGL_LOG_FUNC_EXIT("%u", (uint32_t)ret);
+
+ return ret;
+ }
+
+ /*
+ * @}
+ */
+
+ static void yagl_egl_glx_destroy(struct yagl_egl_driver *driver)
+ {
+ struct yagl_egl_glx *egl_glx = (struct yagl_egl_glx*)driver;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_glx_destroy, NULL);
+
+ yagl_egl_driver_cleanup(&egl_glx->base);
+
+ g_free(egl_glx);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ struct yagl_egl_driver *yagl_egl_driver_create(void *display)
+ {
+ struct yagl_egl_driver *egl_driver;
+ struct yagl_egl_glx *egl_glx;
+ Display *x_display = display;
+
+ YAGL_LOG_FUNC_ENTER(yagl_egl_glx_create, NULL);
+
+ egl_glx = g_malloc0(sizeof(*egl_glx));
+
+ egl_glx->global_dpy = x_display;
+
+ egl_driver = &egl_glx->base;
+
+ yagl_egl_driver_init(egl_driver);
+
+ egl_driver->dyn_lib = yagl_dyn_lib_create();
+
+ if (!egl_driver->dyn_lib) {
+ goto fail;
+ }
+
+ if (!yagl_dyn_lib_load(egl_driver->dyn_lib, "libGL.so.1")) {
+ YAGL_LOG_ERROR("Unable to load libGL.so.1: %s",
+ yagl_dyn_lib_get_error(egl_driver->dyn_lib));
+ goto fail;
+ }
+
+ egl_glx->glXGetProcAddress =
+ yagl_dyn_lib_get_sym(egl_driver->dyn_lib, "glXGetProcAddress");
+
+ if (!egl_glx->glXGetProcAddress) {
+ egl_glx->glXGetProcAddress =
+ yagl_dyn_lib_get_sym(egl_driver->dyn_lib, "glXGetProcAddressARB");
+ }
+
+ if (!egl_glx->glXGetProcAddress) {
+ YAGL_LOG_ERROR("Unable to get symbol: %s",
+ yagl_dyn_lib_get_error(egl_driver->dyn_lib));
+ goto fail;
+ }
+
+ /* GLX 1.0 */
+ YAGL_EGL_GLX_GET_PROC(GLXCREATECONTEXTPROC, glXCreateContext);
+ YAGL_EGL_GLX_GET_PROC(GLXDESTROYCONTEXTPROC, glXDestroyContext);
+ YAGL_EGL_GLX_GET_PROC(GLXMAKECURRENTPROC, glXMakeCurrent);
+ YAGL_EGL_GLX_GET_PROC(GLXSWAPBUFFERSPROC, glXSwapBuffers);
+ YAGL_EGL_GLX_GET_PROC(GLXCREATEGLXPIXMAPPROC, glXCreateGLXPixmap);
+ YAGL_EGL_GLX_GET_PROC(GLXDESTROYGLXPIXMAPPROC, glXDestroyGLXPixmap);
+ YAGL_EGL_GLX_GET_PROC(GLXQUERYVERSIONPROC, glXQueryVersion);
+ YAGL_EGL_GLX_GET_PROC(GLXGETCONFIGPROC, glXGetConfig);
+ YAGL_EGL_GLX_GET_PROC(GLXWAITGLPROC, glXWaitGL);
+ YAGL_EGL_GLX_GET_PROC(GLXWAITXPROC, glXWaitX);
+
+ /* GLX 1.1 */
+ YAGL_EGL_GLX_GET_PROC(GLXQUERYEXTENSIONSSTRINGPROC, glXQueryExtensionsString);
+ YAGL_EGL_GLX_GET_PROC(GLXQUERYSERVERSTRINGPROC, glXQueryServerString);
+ YAGL_EGL_GLX_GET_PROC(GLXGETCLIENTSTRINGPROC, glXGetClientString);
+
+ /* GLX 1.3 */
+ YAGL_EGL_GLX_GET_PROC(PFNGLXGETFBCONFIGSPROC, glXGetFBConfigs);
+ YAGL_EGL_GLX_GET_PROC(PFNGLXGETFBCONFIGATTRIBPROC, glXGetFBConfigAttrib);
+ YAGL_EGL_GLX_GET_PROC(PFNGLXGETVISUALFROMFBCONFIGPROC, glXGetVisualFromFBConfig);
++ YAGL_EGL_GLX_GET_PROC(PFNGLXCHOOSEFBCONFIGPROC, glXChooseFBConfig);
+ YAGL_EGL_GLX_GET_PROC(PFNGLXCREATEWINDOWPROC, glXCreateWindow);
+ YAGL_EGL_GLX_GET_PROC(PFNGLXDESTROYWINDOWPROC, glXDestroyWindow);
+ YAGL_EGL_GLX_GET_PROC(PFNGLXCREATEPIXMAPPROC, glXCreatePixmap);
+ YAGL_EGL_GLX_GET_PROC(PFNGLXDESTROYPIXMAPPROC, glXDestroyPixmap);
+ YAGL_EGL_GLX_GET_PROC(PFNGLXCREATEPBUFFERPROC, glXCreatePbuffer);
+ YAGL_EGL_GLX_GET_PROC(PFNGLXDESTROYPBUFFERPROC, glXDestroyPbuffer);
+ YAGL_EGL_GLX_GET_PROC(PFNGLXCREATENEWCONTEXTPROC, glXCreateNewContext);
+ YAGL_EGL_GLX_GET_PROC(PFNGLXMAKECONTEXTCURRENTPROC, glXMakeContextCurrent);
+
++ /* GLX_ARB_create_context */
++ YAGL_EGL_GLX_GET_PROC(PFNGLXCREATECONTEXTATTRIBSARBPROC, glXCreateContextAttribsARB);
++
++ if (!yagl_egl_glx_get_gl_version(egl_glx, &egl_glx->base.gl_version)) {
++ goto fail;
++ }
++
+ egl_glx->base.display_open = &yagl_egl_glx_display_open;
+ egl_glx->base.display_close = &yagl_egl_glx_display_close;
+ egl_glx->base.config_enum = &yagl_egl_glx_config_enum;
+ egl_glx->base.config_cleanup = &yagl_egl_glx_config_cleanup;
+ egl_glx->base.pbuffer_surface_create = &yagl_egl_glx_pbuffer_surface_create;
+ egl_glx->base.pbuffer_surface_destroy = &yagl_egl_glx_pbuffer_surface_destroy;
+ egl_glx->base.context_create = &yagl_egl_glx_context_create;
+ egl_glx->base.context_destroy = &yagl_egl_glx_context_destroy;
+ egl_glx->base.make_current = &yagl_egl_glx_make_current;
+ egl_glx->base.destroy = &yagl_egl_glx_destroy;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return &egl_glx->base;
+
+ fail:
+ yagl_egl_driver_cleanup(&egl_glx->base);
+ g_free(egl_glx);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return NULL;
+ }
+
+ void *yagl_dyn_lib_get_ogl_procaddr(struct yagl_dyn_lib *dyn_lib,
+ const char *sym_name)
+ {
+ PFNGLXGETPROCADDRESSPROC get_proc_addr;
+ void *res = NULL;
+
+ get_proc_addr = yagl_dyn_lib_get_sym(dyn_lib, "glXGetProcAddress");
+
+ if (!get_proc_addr) {
+ get_proc_addr = yagl_dyn_lib_get_sym(dyn_lib, "glXGetProcAddressARB");
+ }
+
+ if (get_proc_addr) {
+ res = get_proc_addr((const GLubyte*)sym_name);
+ }
+
+ if (!res) {
+ res = yagl_dyn_lib_get_sym(dyn_lib, sym_name);
+ }
+
+ return res;
+ }
--- /dev/null
-struct yagl_gles_driver *yagl_gles_ogl_create(struct yagl_dyn_lib *dyn_lib)
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include <GL/gl.h>
+ #include "yagl_gles_driver.h"
+ #include "yagl_gles_ogl.h"
+ #include "yagl_gles_ogl_macros.h"
+ #include "yagl_log.h"
+ #include "yagl_dyn_lib.h"
+ #include "yagl_process.h"
+ #include "yagl_thread.h"
+
+ static void yagl_gles_ogl_destroy(struct yagl_gles_driver *driver)
+ {
+ YAGL_LOG_FUNC_ENTER(yagl_gles_ogl_destroy, NULL);
+
+ yagl_gles_driver_cleanup(driver);
+ g_free(driver);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
- yagl_gles_driver_init(driver);
++struct yagl_gles_driver *yagl_gles_ogl_create(struct yagl_dyn_lib *dyn_lib,
++ yagl_gl_version gl_version)
+ {
+ struct yagl_gles_driver *driver = NULL;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles_ogl_create, NULL);
+
+ driver = g_malloc0(sizeof(*driver));
+
- YAGL_GLES_OGL_GET_PROC(driver, PushClientAttrib, glPushClientAttrib);
- YAGL_GLES_OGL_GET_PROC(driver, PopClientAttrib, glPopClientAttrib);
- YAGL_GLES_OGL_GET_PROC(driver, MapBuffer, glMapBuffer);
- YAGL_GLES_OGL_GET_PROC(driver, UnmapBuffer, glUnmapBuffer);
- YAGL_GLES_OGL_GET_PROC(driver, Finish, glFinish);
++ yagl_gles_driver_init(driver, gl_version);
+
+ YAGL_GLES_OGL_GET_PROC(driver, DrawArrays, glDrawArrays);
+ YAGL_GLES_OGL_GET_PROC(driver, DrawElements, glDrawElements);
+ YAGL_GLES_OGL_GET_PROC(driver, ReadPixels, glReadPixels);
+ YAGL_GLES_OGL_GET_PROC(driver, DisableVertexAttribArray, glDisableVertexAttribArray);
+ YAGL_GLES_OGL_GET_PROC(driver, EnableVertexAttribArray, glEnableVertexAttribArray);
+ YAGL_GLES_OGL_GET_PROC(driver, VertexAttribPointer, glVertexAttribPointer);
+ YAGL_GLES_OGL_GET_PROC(driver, VertexPointer, glVertexPointer);
+ YAGL_GLES_OGL_GET_PROC(driver, NormalPointer, glNormalPointer);
+ YAGL_GLES_OGL_GET_PROC(driver, ColorPointer, glColorPointer);
+ YAGL_GLES_OGL_GET_PROC(driver, TexCoordPointer, glTexCoordPointer);
+ YAGL_GLES_OGL_GET_PROC(driver, DisableClientState, glDisableClientState);
+ YAGL_GLES_OGL_GET_PROC(driver, EnableClientState, glEnableClientState);
+ YAGL_GLES_OGL_GET_PROC(driver, GenBuffers, glGenBuffers);
+ YAGL_GLES_OGL_GET_PROC(driver, BindBuffer, glBindBuffer);
+ YAGL_GLES_OGL_GET_PROC(driver, BufferData, glBufferData);
+ YAGL_GLES_OGL_GET_PROC(driver, BufferSubData, glBufferSubData);
+ YAGL_GLES_OGL_GET_PROC(driver, DeleteBuffers, glDeleteBuffers);
+ YAGL_GLES_OGL_GET_PROC(driver, GenTextures, glGenTextures);
+ YAGL_GLES_OGL_GET_PROC(driver, BindTexture, glBindTexture);
+ YAGL_GLES_OGL_GET_PROC(driver, DeleteTextures, glDeleteTextures);
+ YAGL_GLES_OGL_GET_PROC(driver, ActiveTexture, glActiveTexture);
+ YAGL_GLES_OGL_GET_PROC(driver, CompressedTexImage2D, glCompressedTexImage2D);
+ YAGL_GLES_OGL_GET_PROC(driver, CompressedTexSubImage2D, glCompressedTexSubImage2D);
+ YAGL_GLES_OGL_GET_PROC(driver, CopyTexImage2D, glCopyTexImage2D);
+ YAGL_GLES_OGL_GET_PROC(driver, CopyTexSubImage2D, glCopyTexSubImage2D);
+ YAGL_GLES_OGL_GET_PROC(driver, GetTexParameterfv, glGetTexParameterfv);
+ YAGL_GLES_OGL_GET_PROC(driver, GetTexParameteriv, glGetTexParameteriv);
+ YAGL_GLES_OGL_GET_PROC(driver, TexImage2D, glTexImage2D);
+ YAGL_GLES_OGL_GET_PROC(driver, TexParameterf, glTexParameterf);
+ YAGL_GLES_OGL_GET_PROC(driver, TexParameterfv, glTexParameterfv);
+ YAGL_GLES_OGL_GET_PROC(driver, TexParameteri, glTexParameteri);
+ YAGL_GLES_OGL_GET_PROC(driver, TexParameteriv, glTexParameteriv);
+ YAGL_GLES_OGL_GET_PROC(driver, TexSubImage2D, glTexSubImage2D);
+ YAGL_GLES_OGL_GET_PROC(driver, ClientActiveTexture, glClientActiveTexture);
+ YAGL_GLES_OGL_GET_PROC(driver, TexEnvi, glTexEnvi);
+ YAGL_GLES_OGL_GET_PROC(driver, TexEnvf, glTexEnvf);
+ YAGL_GLES_OGL_GET_PROC(driver, MultiTexCoord4f, glMultiTexCoord4f);
+ YAGL_GLES_OGL_GET_PROC(driver, TexEnviv, glTexEnviv);
+ YAGL_GLES_OGL_GET_PROC(driver, TexEnvfv, glTexEnvfv);
+ YAGL_GLES_OGL_GET_PROC(driver, GetTexEnviv, glGetTexEnviv);
+ YAGL_GLES_OGL_GET_PROC(driver, GetTexEnvfv, glGetTexEnvfv);
+ YAGL_GLES_OGL_GET_PROC(driver, GenFramebuffers, glGenFramebuffersEXT);
+ YAGL_GLES_OGL_GET_PROC(driver, BindFramebuffer, glBindFramebufferEXT);
+ YAGL_GLES_OGL_GET_PROC(driver, FramebufferTexture2D, glFramebufferTexture2DEXT);
+ YAGL_GLES_OGL_GET_PROC(driver, FramebufferRenderbuffer, glFramebufferRenderbufferEXT);
+ YAGL_GLES_OGL_GET_PROC(driver, DeleteFramebuffers, glDeleteFramebuffersEXT);
++ YAGL_GLES_OGL_GET_PROC(driver, BlitFramebuffer, glBlitFramebufferEXT);
++ YAGL_GLES_OGL_GET_PROC(driver, DrawBuffers, glDrawBuffers);
+ YAGL_GLES_OGL_GET_PROC(driver, GenRenderbuffers, glGenRenderbuffersEXT);
+ YAGL_GLES_OGL_GET_PROC(driver, BindRenderbuffer, glBindRenderbufferEXT);
+ YAGL_GLES_OGL_GET_PROC(driver, RenderbufferStorage, glRenderbufferStorageEXT);
+ YAGL_GLES_OGL_GET_PROC(driver, DeleteRenderbuffers, glDeleteRenderbuffersEXT);
+ YAGL_GLES_OGL_GET_PROC(driver, GetRenderbufferParameteriv, glGetRenderbufferParameterivEXT);
+ YAGL_GLES_OGL_GET_PROC(driver, CreateProgram, glCreateProgram);
+ YAGL_GLES_OGL_GET_PROC(driver, CreateShader, glCreateShader);
+ YAGL_GLES_OGL_GET_PROC(driver, DeleteProgram, glDeleteProgram);
+ YAGL_GLES_OGL_GET_PROC(driver, DeleteShader, glDeleteShader);
+ YAGL_GLES_OGL_GET_PROC(driver, ShaderSource, glShaderSource);
+ YAGL_GLES_OGL_GET_PROC(driver, AttachShader, glAttachShader);
+ YAGL_GLES_OGL_GET_PROC(driver, DetachShader, glDetachShader);
+ YAGL_GLES_OGL_GET_PROC(driver, CompileShader, glCompileShader);
+ YAGL_GLES_OGL_GET_PROC(driver, BindAttribLocation, glBindAttribLocation);
+ YAGL_GLES_OGL_GET_PROC(driver, GetActiveAttrib, glGetActiveAttrib);
+ YAGL_GLES_OGL_GET_PROC(driver, GetActiveUniform, glGetActiveUniform);
+ YAGL_GLES_OGL_GET_PROC(driver, GetAttribLocation, glGetAttribLocation);
+ YAGL_GLES_OGL_GET_PROC(driver, GetProgramiv, glGetProgramiv);
+ YAGL_GLES_OGL_GET_PROC(driver, GetProgramInfoLog, glGetProgramInfoLog);
+ YAGL_GLES_OGL_GET_PROC(driver, GetShaderiv, glGetShaderiv);
+ YAGL_GLES_OGL_GET_PROC(driver, GetShaderInfoLog, glGetShaderInfoLog);
+ YAGL_GLES_OGL_GET_PROC(driver, GetUniformfv, glGetUniformfv);
+ YAGL_GLES_OGL_GET_PROC(driver, GetUniformiv, glGetUniformiv);
+ YAGL_GLES_OGL_GET_PROC(driver, GetUniformLocation, glGetUniformLocation);
+ YAGL_GLES_OGL_GET_PROC(driver, GetVertexAttribfv, glGetVertexAttribfv);
+ YAGL_GLES_OGL_GET_PROC(driver, GetVertexAttribiv, glGetVertexAttribiv);
+ YAGL_GLES_OGL_GET_PROC(driver, LinkProgram, glLinkProgram);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform1f, glUniform1f);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform1fv, glUniform1fv);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform1i, glUniform1i);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform1iv, glUniform1iv);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform2f, glUniform2f);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform2fv, glUniform2fv);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform2i, glUniform2i);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform2iv, glUniform2iv);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform3f, glUniform3f);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform3fv, glUniform3fv);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform3i, glUniform3i);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform3iv, glUniform3iv);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform4f, glUniform4f);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform4fv, glUniform4fv);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform4i, glUniform4i);
+ YAGL_GLES_OGL_GET_PROC(driver, Uniform4iv, glUniform4iv);
+ YAGL_GLES_OGL_GET_PROC(driver, UniformMatrix2fv, glUniformMatrix2fv);
+ YAGL_GLES_OGL_GET_PROC(driver, UniformMatrix3fv, glUniformMatrix3fv);
+ YAGL_GLES_OGL_GET_PROC(driver, UniformMatrix4fv, glUniformMatrix4fv);
+ YAGL_GLES_OGL_GET_PROC(driver, UseProgram, glUseProgram);
+ YAGL_GLES_OGL_GET_PROC(driver, ValidateProgram, glValidateProgram);
+ YAGL_GLES_OGL_GET_PROC(driver, VertexAttrib1f, glVertexAttrib1f);
+ YAGL_GLES_OGL_GET_PROC(driver, VertexAttrib1fv, glVertexAttrib1fv);
+ YAGL_GLES_OGL_GET_PROC(driver, VertexAttrib2f, glVertexAttrib2f);
+ YAGL_GLES_OGL_GET_PROC(driver, VertexAttrib2fv, glVertexAttrib2fv);
+ YAGL_GLES_OGL_GET_PROC(driver, VertexAttrib3f, glVertexAttrib3f);
+ YAGL_GLES_OGL_GET_PROC(driver, VertexAttrib3fv, glVertexAttrib3fv);
+ YAGL_GLES_OGL_GET_PROC(driver, VertexAttrib4f, glVertexAttrib4f);
+ YAGL_GLES_OGL_GET_PROC(driver, VertexAttrib4fv, glVertexAttrib4fv);
+ YAGL_GLES_OGL_GET_PROC(driver, GetIntegerv, glGetIntegerv);
+ YAGL_GLES_OGL_GET_PROC(driver, GetFloatv, glGetFloatv);
+ YAGL_GLES_OGL_GET_PROC(driver, GetString, glGetString);
+ YAGL_GLES_OGL_GET_PROC(driver, IsEnabled, glIsEnabled);
+ YAGL_GLES_OGL_GET_PROC(driver, BlendEquation, glBlendEquation);
+ YAGL_GLES_OGL_GET_PROC(driver, BlendEquationSeparate, glBlendEquationSeparate);
+ YAGL_GLES_OGL_GET_PROC(driver, BlendFunc, glBlendFunc);
+ YAGL_GLES_OGL_GET_PROC(driver, BlendFuncSeparate, glBlendFuncSeparate);
+ YAGL_GLES_OGL_GET_PROC(driver, BlendColor, glBlendColor);
+ YAGL_GLES_OGL_GET_PROC(driver, Clear, glClear);
+ YAGL_GLES_OGL_GET_PROC(driver, ClearColor, glClearColor);
+ YAGL_GLES_OGL_GET_PROC(driver, ClearDepth, glClearDepth);
+ YAGL_GLES_OGL_GET_PROC(driver, ClearStencil, glClearStencil);
+ YAGL_GLES_OGL_GET_PROC(driver, ColorMask, glColorMask);
+ YAGL_GLES_OGL_GET_PROC(driver, CullFace, glCullFace);
+ YAGL_GLES_OGL_GET_PROC(driver, DepthFunc, glDepthFunc);
+ YAGL_GLES_OGL_GET_PROC(driver, DepthMask, glDepthMask);
+ YAGL_GLES_OGL_GET_PROC(driver, DepthRange, glDepthRange);
+ YAGL_GLES_OGL_GET_PROC(driver, Enable, glEnable);
+ YAGL_GLES_OGL_GET_PROC(driver, Disable, glDisable);
+ YAGL_GLES_OGL_GET_PROC(driver, Flush, glFlush);
+ YAGL_GLES_OGL_GET_PROC(driver, FrontFace, glFrontFace);
+ YAGL_GLES_OGL_GET_PROC(driver, GenerateMipmap, glGenerateMipmapEXT);
+ YAGL_GLES_OGL_GET_PROC(driver, Hint, glHint);
+ YAGL_GLES_OGL_GET_PROC(driver, LineWidth, glLineWidth);
+ YAGL_GLES_OGL_GET_PROC(driver, PixelStorei, glPixelStorei);
+ YAGL_GLES_OGL_GET_PROC(driver, PolygonOffset, glPolygonOffset);
+ YAGL_GLES_OGL_GET_PROC(driver, Scissor, glScissor);
+ YAGL_GLES_OGL_GET_PROC(driver, StencilFunc, glStencilFunc);
+ YAGL_GLES_OGL_GET_PROC(driver, StencilMask, glStencilMask);
+ YAGL_GLES_OGL_GET_PROC(driver, StencilOp, glStencilOp);
+ YAGL_GLES_OGL_GET_PROC(driver, SampleCoverage, glSampleCoverage);
+ YAGL_GLES_OGL_GET_PROC(driver, Viewport, glViewport);
+ YAGL_GLES_OGL_GET_PROC(driver, StencilFuncSeparate, glStencilFuncSeparate);
+ YAGL_GLES_OGL_GET_PROC(driver, StencilMaskSeparate, glStencilMaskSeparate);
+ YAGL_GLES_OGL_GET_PROC(driver, StencilOpSeparate, glStencilOpSeparate);
+ YAGL_GLES_OGL_GET_PROC(driver, PointSize, glPointSize);
+ YAGL_GLES_OGL_GET_PROC(driver, AlphaFunc, glAlphaFunc);
+ YAGL_GLES_OGL_GET_PROC(driver, MatrixMode, glMatrixMode);
+ YAGL_GLES_OGL_GET_PROC(driver, LoadIdentity, glLoadIdentity);
+ YAGL_GLES_OGL_GET_PROC(driver, PopMatrix, glPopMatrix);
+ YAGL_GLES_OGL_GET_PROC(driver, PushMatrix, glPushMatrix);
+ YAGL_GLES_OGL_GET_PROC(driver, Rotatef, glRotatef);
+ YAGL_GLES_OGL_GET_PROC(driver, Translatef, glTranslatef);
+ YAGL_GLES_OGL_GET_PROC(driver, Scalef, glScalef);
+ YAGL_GLES_OGL_GET_PROC(driver, Ortho, glOrtho);
+ YAGL_GLES_OGL_GET_PROC(driver, Color4f, glColor4f);
+ YAGL_GLES_OGL_GET_PROC(driver, Color4ub, glColor4ub);
+ YAGL_GLES_OGL_GET_PROC(driver, Normal3f, glNormal3f);
+ YAGL_GLES_OGL_GET_PROC(driver, PointParameterf, glPointParameterf);
+ YAGL_GLES_OGL_GET_PROC(driver, PointParameterfv, glPointParameterfv);
+ YAGL_GLES_OGL_GET_PROC(driver, Fogf, glFogf);
+ YAGL_GLES_OGL_GET_PROC(driver, Fogfv, glFogfv);
+ YAGL_GLES_OGL_GET_PROC(driver, Frustum, glFrustum);
+ YAGL_GLES_OGL_GET_PROC(driver, Lightf, glLightf);
+ YAGL_GLES_OGL_GET_PROC(driver, Lightfv, glLightfv);
+ YAGL_GLES_OGL_GET_PROC(driver, GetLightfv, glGetLightfv);
+ YAGL_GLES_OGL_GET_PROC(driver, LightModelf, glLightModelf);
+ YAGL_GLES_OGL_GET_PROC(driver, LightModelfv, glLightModelfv);
+ YAGL_GLES_OGL_GET_PROC(driver, Materialf, glMaterialf);
+ YAGL_GLES_OGL_GET_PROC(driver, Materialfv, glMaterialfv);
+ YAGL_GLES_OGL_GET_PROC(driver, GetMaterialfv, glGetMaterialfv);
+ YAGL_GLES_OGL_GET_PROC(driver, ShadeModel, glShadeModel);
+ YAGL_GLES_OGL_GET_PROC(driver, LogicOp, glLogicOp);
+ YAGL_GLES_OGL_GET_PROC(driver, MultMatrixf, glMultMatrixf);
+ YAGL_GLES_OGL_GET_PROC(driver, LoadMatrixf, glLoadMatrixf);
+ YAGL_GLES_OGL_GET_PROC(driver, ClipPlane, glClipPlane);
+ YAGL_GLES_OGL_GET_PROC(driver, GetClipPlane, glGetClipPlane);
++ YAGL_GLES_OGL_GET_PROC(driver, MapBuffer, glMapBuffer);
++ YAGL_GLES_OGL_GET_PROC(driver, UnmapBuffer, glUnmapBuffer);
++ YAGL_GLES_OGL_GET_PROC(driver, Finish, glFinish);
++
++ if (gl_version > yagl_gl_2) {
++ YAGL_GLES_OGL_GET_PROC(driver, GetStringi, glGetStringi);
++ YAGL_GLES_OGL_GET_PROC(driver, GenVertexArrays, glGenVertexArrays);
++ YAGL_GLES_OGL_GET_PROC(driver, BindVertexArray, glBindVertexArray);
++ YAGL_GLES_OGL_GET_PROC(driver, DeleteVertexArrays, glDeleteVertexArrays);
++ YAGL_GLES_OGL_GET_PROC(driver, GetActiveUniformsiv, glGetActiveUniformsiv);
++ YAGL_GLES_OGL_GET_PROC(driver, GetUniformIndices, glGetUniformIndices);
++ YAGL_GLES_OGL_GET_PROC(driver, GetUniformBlockIndex, glGetUniformBlockIndex);
++ YAGL_GLES_OGL_GET_PROC(driver, UniformBlockBinding, glUniformBlockBinding);
++ YAGL_GLES_OGL_GET_PROC(driver, BindBufferBase, glBindBufferBase);
++ YAGL_GLES_OGL_GET_PROC(driver, BindBufferRange, glBindBufferRange);
++ YAGL_GLES_OGL_GET_PROC(driver, GetActiveUniformBlockName, glGetActiveUniformBlockName);
++ YAGL_GLES_OGL_GET_PROC(driver, GetActiveUniformBlockiv, glGetActiveUniformBlockiv);
++ YAGL_GLES_OGL_GET_PROC(driver, GenTransformFeedbacks, glGenTransformFeedbacks);
++ YAGL_GLES_OGL_GET_PROC(driver, BindTransformFeedback, glBindTransformFeedback);
++ YAGL_GLES_OGL_GET_PROC(driver, BeginTransformFeedback, glBeginTransformFeedback);
++ YAGL_GLES_OGL_GET_PROC(driver, EndTransformFeedback, glEndTransformFeedback);
++ YAGL_GLES_OGL_GET_PROC(driver, PauseTransformFeedback, glPauseTransformFeedback);
++ YAGL_GLES_OGL_GET_PROC(driver, ResumeTransformFeedback, glResumeTransformFeedback);
++ YAGL_GLES_OGL_GET_PROC(driver, DeleteTransformFeedbacks, glDeleteTransformFeedbacks);
++ YAGL_GLES_OGL_GET_PROC(driver, TransformFeedbackVaryings, glTransformFeedbackVaryings);
++ YAGL_GLES_OGL_GET_PROC(driver, GetTransformFeedbackVarying, glGetTransformFeedbackVarying);
++ YAGL_GLES_OGL_GET_PROC(driver, GenQueries, glGenQueries);
++ YAGL_GLES_OGL_GET_PROC(driver, BeginQuery, glBeginQuery);
++ YAGL_GLES_OGL_GET_PROC(driver, EndQuery, glEndQuery);
++ YAGL_GLES_OGL_GET_PROC(driver, GetQueryObjectuiv, glGetQueryObjectuiv);
++ YAGL_GLES_OGL_GET_PROC(driver, DeleteQueries, glDeleteQueries);
++ YAGL_GLES_OGL_GET_PROC(driver, DrawArraysInstanced, glDrawArraysInstanced);
++ YAGL_GLES_OGL_GET_PROC(driver, DrawElementsInstanced, glDrawElementsInstanced);
++ YAGL_GLES_OGL_GET_PROC(driver, VertexAttribDivisor, glVertexAttribDivisor);
++ }
+
+ driver->destroy = &yagl_gles_ogl_destroy;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return driver;
+
+ fail:
+ yagl_gles_driver_cleanup(driver);
+ g_free(driver);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return NULL;
+ }
--- /dev/null
-struct yagl_gles_driver *yagl_gles_ogl_create(struct yagl_dyn_lib *dyn_lib);
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #ifndef _QEMU_YAGL_GLES_OGL_H
+ #define _QEMU_YAGL_GLES_OGL_H
+
+ #include "yagl_types.h"
+
+ struct yagl_gles_driver;
+ struct yagl_dyn_lib;
+
++struct yagl_gles_driver *yagl_gles_ogl_create(struct yagl_dyn_lib *dyn_lib,
++ yagl_gl_version gl_version);
+
+ #endif
--- /dev/null
- yagl_gles_driver_init(&driver->base);
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include <GL/gl.h>
+ #include "yagl_gles_onscreen.h"
+ #include "yagl_gles_driver.h"
+ #include "yagl_log.h"
+ #include "yagl_tls.h"
+ #include "yagl_process.h"
+ #include "yagl_thread.h"
+ #include "yagl_backends/egl_onscreen/yagl_egl_onscreen_ts.h"
+ #include "yagl_backends/egl_onscreen/yagl_egl_onscreen_context.h"
+
+ struct yagl_gles_onscreen
+ {
+ struct yagl_gles_driver base;
+
+ struct yagl_gles_driver *orig_driver;
+ };
+
+ YAGL_DECLARE_TLS(struct yagl_egl_onscreen_ts*, egl_onscreen_ts);
+
+ static void YAGL_GLES_APIENTRY yagl_gles_onscreen_BindFramebuffer(GLenum target,
+ GLuint framebuffer)
+ {
+ if (!egl_onscreen_ts || !egl_onscreen_ts->dpy) {
+ return;
+ }
+
+ assert(framebuffer != egl_onscreen_ts->ctx->fb);
+
+ if (framebuffer == 0) {
+ framebuffer = egl_onscreen_ts->ctx->fb;
+ }
+
+ egl_onscreen_ts->gles_driver->BindFramebuffer(target, framebuffer);
+ }
+
+ static void yagl_gles_onscreen_destroy(struct yagl_gles_driver *driver)
+ {
+ struct yagl_gles_onscreen *gles_onscreen = (struct yagl_gles_onscreen*)driver;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles_onscreen_destroy, NULL);
+
+ gles_onscreen->orig_driver->destroy(gles_onscreen->orig_driver);
+ gles_onscreen->orig_driver = NULL;
+
+ yagl_gles_driver_cleanup(driver);
+ g_free(gles_onscreen);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ struct yagl_gles_driver
+ *yagl_gles_onscreen_create(struct yagl_gles_driver *orig_driver)
+ {
+ struct yagl_gles_onscreen *driver = NULL;
+
+ YAGL_LOG_FUNC_ENTER(yagl_gles_onscreen_create, NULL);
+
+ driver = g_malloc0(sizeof(*driver));
+
+ /*
+ * Just copy over everything, then init our fields.
+ */
+ memcpy(&driver->base, orig_driver, sizeof(*orig_driver));
+ driver->orig_driver = orig_driver;
+
++ yagl_gles_driver_init(&driver->base, orig_driver->gl_version);
+
+ driver->base.BindFramebuffer = &yagl_gles_onscreen_BindFramebuffer;
+
+ driver->base.destroy = &yagl_gles_onscreen_destroy;
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return &driver->base;
+ }
--- /dev/null
- yagl_render_type render_type)
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include "yagl_egl_backend.h"
+
+ void yagl_egl_backend_init(struct yagl_egl_backend *backend,
++ yagl_render_type render_type,
++ yagl_gl_version gl_version)
+ {
+ backend->render_type = render_type;
++ backend->gl_version = gl_version;
+ }
+
+ void yagl_egl_backend_cleanup(struct yagl_egl_backend *backend)
+ {
+ }
--- /dev/null
- yagl_render_type render_type);
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #ifndef _QEMU_YAGL_EGL_BACKEND_H
+ #define _QEMU_YAGL_EGL_BACKEND_H
+
+ #include "yagl_types.h"
+
+ struct yagl_eglb_display;
+ struct yagl_eglb_context;
+ struct yagl_eglb_surface;
+
+ /*
+ * YaGL EGL backend.
+ * @{
+ */
+
+ struct yagl_egl_backend
+ {
+ yagl_render_type render_type;
+
++ yagl_gl_version gl_version;
++
+ void (*thread_init)(struct yagl_egl_backend */*backend*/);
+
+ void (*batch_start)(struct yagl_egl_backend */*backend*/);
+
+ struct yagl_eglb_display *(*create_display)(struct yagl_egl_backend */*backend*/);
+
+ bool (*make_current)(struct yagl_egl_backend */*backend*/,
+ struct yagl_eglb_display */*dpy*/,
+ struct yagl_eglb_context */*ctx*/,
+ struct yagl_eglb_surface */*draw*/,
+ struct yagl_eglb_surface */*read*/);
+
+ bool (*release_current)(struct yagl_egl_backend */*backend*/,
+ bool /*force*/);
+
+ void (*batch_end)(struct yagl_egl_backend */*backend*/);
+
+ void (*thread_fini)(struct yagl_egl_backend */*backend*/);
+
+ /*
+ * Make sure that some GL context is currently active. Can
+ * be called before/after thread_init/thread_fini.
+ * @{
+ */
+
+ void (*ensure_current)(struct yagl_egl_backend */*backend*/);
+
+ void (*unensure_current)(struct yagl_egl_backend */*backend*/);
+
+ /*
+ * @}
+ */
+
+ void (*destroy)(struct yagl_egl_backend */*backend*/);
+ };
+
+ void yagl_egl_backend_init(struct yagl_egl_backend *backend,
++ yagl_render_type render_type,
++ yagl_gl_version gl_version);
+ void yagl_egl_backend_cleanup(struct yagl_egl_backend *backend);
+
+ /*
+ * @}
+ */
+
+ #endif
--- /dev/null
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include "yagl_egl_driver.h"
+
+ void yagl_egl_driver_init(struct yagl_egl_driver *driver)
+ {
+ driver->dyn_lib = NULL;
++ driver->gl_version = yagl_gl_2;
+ }
+
+ void yagl_egl_driver_cleanup(struct yagl_egl_driver *driver)
+ {
+ if (driver->dyn_lib) {
+ yagl_dyn_lib_destroy(driver->dyn_lib);
+ }
+ }
--- /dev/null
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #ifndef _QEMU_YAGL_EGL_DRIVER_H
+ #define _QEMU_YAGL_EGL_DRIVER_H
+
+ #include "yagl_types.h"
+ #include "yagl_dyn_lib.h"
+ #include <EGL/egl.h>
+
+ struct yagl_egl_native_config;
+ struct yagl_egl_pbuffer_attribs;
+
+ /*
+ * YaGL EGL driver.
+ * @{
+ */
+
+ struct yagl_egl_driver
+ {
+ /*
+ * Open/close one and only display.
+ * @{
+ */
+
+ EGLNativeDisplayType (*display_open)(struct yagl_egl_driver */*driver*/);
+ void (*display_close)(struct yagl_egl_driver */*driver*/,
+ EGLNativeDisplayType /*dpy*/);
+
+ /*
+ * @}
+ */
+
+ /*
+ * Returns a list of supported configs, must be freed with 'g_free'
+ * after use. Note that you also must call 'config_cleanup' on each
+ * returned config before freeing to cleanup the driver data in config.
+ *
+ * Configs returned must:
+ * + Support RGBA
+ * + Support at least PBUFFER surface type
+ */
+ struct yagl_egl_native_config *(*config_enum)(struct yagl_egl_driver */*driver*/,
+ EGLNativeDisplayType /*dpy*/,
+ int */*num_configs*/);
+
+ void (*config_cleanup)(struct yagl_egl_driver */*driver*/,
+ EGLNativeDisplayType /*dpy*/,
+ const struct yagl_egl_native_config */*cfg*/);
+
+ EGLSurface (*pbuffer_surface_create)(struct yagl_egl_driver */*driver*/,
+ EGLNativeDisplayType /*dpy*/,
+ const struct yagl_egl_native_config */*cfg*/,
+ EGLint /*width*/,
+ EGLint /*height*/,
+ const struct yagl_egl_pbuffer_attribs */*attribs*/);
+
+ void (*pbuffer_surface_destroy)(struct yagl_egl_driver */*driver*/,
+ EGLNativeDisplayType /*dpy*/,
+ EGLSurface /*sfc*/);
+
+ EGLContext (*context_create)(struct yagl_egl_driver */*driver*/,
+ EGLNativeDisplayType /*dpy*/,
+ const struct yagl_egl_native_config */*cfg*/,
+ EGLContext /*share_context*/);
+
+ void (*context_destroy)(struct yagl_egl_driver */*driver*/,
+ EGLNativeDisplayType /*dpy*/,
+ EGLContext /*ctx*/);
+
+ bool (*make_current)(struct yagl_egl_driver */*driver*/,
+ EGLNativeDisplayType /*dpy*/,
+ EGLSurface /*draw*/,
+ EGLSurface /*read*/,
+ EGLContext /*ctx*/);
+
+ void (*destroy)(struct yagl_egl_driver */*driver*/);
+
+ struct yagl_dyn_lib *dyn_lib;
++
++ yagl_gl_version gl_version;
+ };
+
+ /*
+ * 'display' is Display* on linux and HWND on windows.
+ */
+ struct yagl_egl_driver *yagl_egl_driver_create(void *display);
+
+ void yagl_egl_driver_init(struct yagl_egl_driver *driver);
+ void yagl_egl_driver_cleanup(struct yagl_egl_driver *driver);
+
+ /*
+ * @}
+ */
+
+ #endif
--- /dev/null
- void (*ensure_ctx)(struct yagl_egl_interface */*iface*/);
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #ifndef _QEMU_YAGL_EGL_INTERFACE_H
+ #define _QEMU_YAGL_EGL_INTERFACE_H
+
+ #include "yagl_types.h"
+
+ struct yagl_egl_interface
+ {
- void (*unensure_ctx)(struct yagl_egl_interface */*iface*/);
++ uint32_t (*get_ctx_id)(struct yagl_egl_interface */*iface*/);
+
++ void (*ensure_ctx)(struct yagl_egl_interface */*iface*/, uint32_t /*ctx_id*/);
++
++ void (*unensure_ctx)(struct yagl_egl_interface */*iface*/, uint32_t /*ctx_id*/);
+ };
+
+ #endif
--- /dev/null
-void yagl_gles_driver_init(struct yagl_gles_driver *driver)
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include <GL/gl.h>
+ #include "yagl_gles_driver.h"
+ #include "yagl_thread.h"
+ #include "yagl_process.h"
+ #include "yagl_egl_interface.h"
+
-void yagl_ensure_ctx(void)
++void yagl_gles_driver_init(struct yagl_gles_driver *driver,
++ yagl_gl_version gl_version)
+ {
++ driver->gl_version = gl_version;
+ }
+
+ void yagl_gles_driver_cleanup(struct yagl_gles_driver *driver)
+ {
+ }
+
- cur_ts->ps->egl_iface->ensure_ctx(cur_ts->ps->egl_iface);
++uint32_t yagl_get_ctx_id(void)
+ {
+ assert(cur_ts);
-void yagl_unensure_ctx(void)
++ return cur_ts->ps->egl_iface->get_ctx_id(cur_ts->ps->egl_iface);
+ }
+
- cur_ts->ps->egl_iface->unensure_ctx(cur_ts->ps->egl_iface);
++void yagl_ensure_ctx(uint32_t ctx_id)
+ {
+ assert(cur_ts);
++ cur_ts->ps->egl_iface->ensure_ctx(cur_ts->ps->egl_iface, ctx_id);
++}
++
++void yagl_unensure_ctx(uint32_t ctx_id)
++{
++ assert(cur_ts);
++ cur_ts->ps->egl_iface->unensure_ctx(cur_ts->ps->egl_iface, ctx_id);
+ }
--- /dev/null
-
- YAGL_GLES_DRIVER_FUNC1(PushClientAttrib, GLbitfield, mask)
- YAGL_GLES_DRIVER_FUNC0(PopClientAttrib)
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #ifndef _QEMU_YAGL_GLES_DRIVER_H
+ #define _QEMU_YAGL_GLES_DRIVER_H
+
+ #include "yagl_types.h"
+
+ #ifdef GL_APIENTRY
+ #define YAGL_GLES_APIENTRY GL_APIENTRY
+ #else
+ #define YAGL_GLES_APIENTRY GLAPIENTRY
+ #endif
+
+ #define YAGL_GLES_DRIVER_FUNC0(func) \
+ void (YAGL_GLES_APIENTRY *func)(void);
+
+ #define YAGL_GLES_DRIVER_FUNC_RET0(ret_type, func) \
+ ret_type (YAGL_GLES_APIENTRY *func)(void);
+
+ #define YAGL_GLES_DRIVER_FUNC1(func, arg0_type, arg0) \
+ void (YAGL_GLES_APIENTRY *func)(arg0_type arg0);
+
+ #define YAGL_GLES_DRIVER_FUNC_RET1(ret_type, func, arg0_type, arg0) \
+ ret_type (YAGL_GLES_APIENTRY *func)(arg0_type arg0);
+
+ #define YAGL_GLES_DRIVER_FUNC2(func, arg0_type, arg1_type, arg0, arg1) \
+ void (YAGL_GLES_APIENTRY *func)(arg0_type arg0, arg1_type arg1);
+
+ #define YAGL_GLES_DRIVER_FUNC_RET2(ret_type, func, arg0_type, arg1_type, arg0, arg1) \
+ ret_type (YAGL_GLES_APIENTRY *func)(arg0_type arg0, arg1_type arg1);
+
+ #define YAGL_GLES_DRIVER_FUNC3(func, arg0_type, arg1_type, arg2_type, arg0, arg1, arg2) \
+ void (YAGL_GLES_APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2);
+
+ #define YAGL_GLES_DRIVER_FUNC4(func, arg0_type, arg1_type, arg2_type, arg3_type, arg0, arg1, arg2, arg3) \
+ void (YAGL_GLES_APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3);
+
+ #define YAGL_GLES_DRIVER_FUNC5(func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg0, arg1, arg2, arg3, arg4) \
+ void (YAGL_GLES_APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4);
+
+ #define YAGL_GLES_DRIVER_FUNC6(func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg0, arg1, arg2, arg3, arg4, arg5) \
+ void (YAGL_GLES_APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, \
+ arg4_type arg4, arg5_type arg5);
+
+ #define YAGL_GLES_DRIVER_FUNC7(func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg0, arg1, arg2, arg3, arg4, arg5, arg6) \
+ void (YAGL_GLES_APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, \
+ arg4_type arg4, arg5_type arg5, arg6_type arg6);
+
+ #define YAGL_GLES_DRIVER_FUNC8(func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
+ void (YAGL_GLES_APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, \
+ arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg7);
+
+ #define YAGL_GLES_DRIVER_FUNC9(func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
+ void (YAGL_GLES_APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, \
+ arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg7, \
+ arg8_type arg8);
+
+ #define YAGL_GLES_DRIVER_FUNC10(func, arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, arg9_type, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
+ void (YAGL_GLES_APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg3, \
+ arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg7, \
+ arg8_type arg8, arg9_type arg9);
+
+ /* We need this because we can't include <GL/gl.h> (which has GLdouble
+ * definition) and <GLES/gl.h> (which has GLfixed definition) simultaneously */
+ typedef double yagl_GLdouble;
+
+ /*
+ * YaGL GLES driver.
+ * @{
+ */
+
+ struct yagl_gles_driver
+ {
++ /*
++ * OpenGL 2.1
++ * @{
++ */
++
+ YAGL_GLES_DRIVER_FUNC3(DrawArrays, GLenum, GLint, GLsizei, mode, first, count)
+ YAGL_GLES_DRIVER_FUNC4(DrawElements, GLenum, GLsizei, GLenum, const GLvoid*, mode, count, type, indices)
+ YAGL_GLES_DRIVER_FUNC7(ReadPixels, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*, x, y, width, height, format, type, pixels)
+ YAGL_GLES_DRIVER_FUNC1(DisableVertexAttribArray, GLuint, index)
+ YAGL_GLES_DRIVER_FUNC1(EnableVertexAttribArray, GLuint, index)
+ YAGL_GLES_DRIVER_FUNC6(VertexAttribPointer, GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid*, indx, size, type, normalized, stride, ptr)
+ YAGL_GLES_DRIVER_FUNC4(VertexPointer, GLint, GLenum, GLsizei, const GLvoid*, size, type, stride, pointer)
+ YAGL_GLES_DRIVER_FUNC3(NormalPointer, GLenum, GLsizei, const GLvoid*, type, stride, pointer)
+ YAGL_GLES_DRIVER_FUNC4(ColorPointer, GLint, GLenum, GLsizei, const GLvoid*, size, type, stride, pointer)
+ YAGL_GLES_DRIVER_FUNC4(TexCoordPointer, GLint, GLenum, GLsizei, const GLvoid*, size, type, stride, pointer)
+ YAGL_GLES_DRIVER_FUNC1(DisableClientState, GLenum, array)
+ YAGL_GLES_DRIVER_FUNC1(EnableClientState, GLenum, array)
+ YAGL_GLES_DRIVER_FUNC2(GenBuffers, GLsizei, GLuint*, n, buffers)
+ YAGL_GLES_DRIVER_FUNC2(BindBuffer, GLenum, GLuint, target, buffer)
+ YAGL_GLES_DRIVER_FUNC4(BufferData, GLenum, GLsizeiptr, const GLvoid*, GLenum, target, size, data, usage)
+ YAGL_GLES_DRIVER_FUNC4(BufferSubData, GLenum, GLintptr, GLsizeiptr, const GLvoid*, target, offset, size, data)
+ YAGL_GLES_DRIVER_FUNC2(DeleteBuffers, GLsizei, const GLuint*, n, buffers)
+ YAGL_GLES_DRIVER_FUNC2(GenTextures, GLsizei, GLuint*, n, textures)
+ YAGL_GLES_DRIVER_FUNC2(BindTexture, GLenum, GLuint, target, texture)
+ YAGL_GLES_DRIVER_FUNC2(DeleteTextures, GLsizei, const GLuint*, n, textures)
+ YAGL_GLES_DRIVER_FUNC1(ActiveTexture, GLenum, texture)
+ YAGL_GLES_DRIVER_FUNC8(CompressedTexImage2D, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*, target, level, internalformat, width, height, border, imageSize, data)
+ YAGL_GLES_DRIVER_FUNC9(CompressedTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*, target, level, xoffset, yoffset, width, height, format, imageSize, data)
+ YAGL_GLES_DRIVER_FUNC8(CopyTexImage2D, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, target, level, internalformat, x, y, width, height, border)
+ YAGL_GLES_DRIVER_FUNC8(CopyTexSubImage2D, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, target, level, xoffset, yoffset, x, y, width, height)
+ YAGL_GLES_DRIVER_FUNC3(GetTexParameterfv, GLenum, GLenum, GLfloat*, target, pname, params)
+ YAGL_GLES_DRIVER_FUNC3(GetTexParameteriv, GLenum, GLenum, GLint*, target, pname, params)
+ YAGL_GLES_DRIVER_FUNC9(TexImage2D, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid*, target, level, internalformat, width, height, border, format, type, pixels)
+ YAGL_GLES_DRIVER_FUNC3(TexParameterf, GLenum, GLenum, GLfloat, target, pname, param)
+ YAGL_GLES_DRIVER_FUNC3(TexParameterfv, GLenum, GLenum, const GLfloat*, target, pname, params)
+ YAGL_GLES_DRIVER_FUNC3(TexParameteri, GLenum, GLenum, GLint, target, pname, param)
+ YAGL_GLES_DRIVER_FUNC3(TexParameteriv, GLenum, GLenum, const GLint*, target, pname, params)
+ YAGL_GLES_DRIVER_FUNC9(TexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid*, target, level, xoffset, yoffset, width, height, format, type, pixels)
+ YAGL_GLES_DRIVER_FUNC1(ClientActiveTexture, GLenum, texture)
+ YAGL_GLES_DRIVER_FUNC3(TexEnvi, GLenum, GLenum, GLint, target, pname, param)
+ YAGL_GLES_DRIVER_FUNC3(TexEnvf, GLenum, GLenum, GLfloat, target, pname, param)
+ YAGL_GLES_DRIVER_FUNC5(MultiTexCoord4f, GLenum, GLfloat, GLfloat, GLfloat, GLfloat, target, s, t, r, q)
+ YAGL_GLES_DRIVER_FUNC3(TexEnviv, GLenum, GLenum, const GLint*, target, pname, params)
+ YAGL_GLES_DRIVER_FUNC3(TexEnvfv, GLenum, GLenum, const GLfloat*, target, pname, params)
+ YAGL_GLES_DRIVER_FUNC3(GetTexEnviv, GLenum, GLenum, GLint*, env, pname, params)
+ YAGL_GLES_DRIVER_FUNC3(GetTexEnvfv, GLenum, GLenum, GLfloat*, env, pname, params)
+ YAGL_GLES_DRIVER_FUNC2(GenFramebuffers, GLsizei, GLuint*, n, framebuffers)
+ YAGL_GLES_DRIVER_FUNC2(BindFramebuffer, GLenum, GLuint, target, framebuffer)
+ YAGL_GLES_DRIVER_FUNC5(FramebufferTexture2D, GLenum, GLenum, GLenum, GLuint, GLint, target, attachment, textarget, texture, level)
+ YAGL_GLES_DRIVER_FUNC4(FramebufferRenderbuffer, GLenum, GLenum, GLenum, GLuint, target, attachment, renderbuffertarget, renderbuffer)
+ YAGL_GLES_DRIVER_FUNC2(DeleteFramebuffers, GLsizei, const GLuint*, n, framebuffers)
++ YAGL_GLES_DRIVER_FUNC10(BlitFramebuffer, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter)
++ YAGL_GLES_DRIVER_FUNC2(DrawBuffers, GLsizei, const GLenum*, n, bufs)
+ YAGL_GLES_DRIVER_FUNC2(GenRenderbuffers, GLsizei, GLuint*, n, renderbuffers)
+ YAGL_GLES_DRIVER_FUNC2(BindRenderbuffer, GLenum, GLuint, target, renderbuffer)
+ YAGL_GLES_DRIVER_FUNC4(RenderbufferStorage, GLenum, GLenum, GLsizei, GLsizei, target, internalformat, width, height)
+ YAGL_GLES_DRIVER_FUNC2(DeleteRenderbuffers, GLsizei, const GLuint*, n, renderbuffers)
+ YAGL_GLES_DRIVER_FUNC3(GetRenderbufferParameteriv, GLenum, GLenum, GLint*, target, pname, params);
+ YAGL_GLES_DRIVER_FUNC_RET0(GLuint, CreateProgram)
+ YAGL_GLES_DRIVER_FUNC_RET1(GLuint, CreateShader, GLenum, type)
+ YAGL_GLES_DRIVER_FUNC1(DeleteProgram, GLuint, program)
+ YAGL_GLES_DRIVER_FUNC1(DeleteShader, GLuint, shader)
+ YAGL_GLES_DRIVER_FUNC4(ShaderSource, GLuint, GLsizei, const GLchar**, const GLint*, shader, count, string, length)
+ YAGL_GLES_DRIVER_FUNC2(AttachShader, GLuint, GLuint, program, shader)
+ YAGL_GLES_DRIVER_FUNC2(DetachShader, GLuint, GLuint, program, shader)
+ YAGL_GLES_DRIVER_FUNC1(CompileShader, GLuint, shader)
+ YAGL_GLES_DRIVER_FUNC3(BindAttribLocation, GLuint, GLuint, const GLchar*, program, index, name)
+ YAGL_GLES_DRIVER_FUNC7(GetActiveAttrib, GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*, program, index, bufsize, length, size, type, name)
+ YAGL_GLES_DRIVER_FUNC7(GetActiveUniform, GLuint, GLuint, GLsizei, GLsizei*, GLint*, GLenum*, GLchar*, program, index, bufsize, length, size, type, name)
+ YAGL_GLES_DRIVER_FUNC_RET2(int, GetAttribLocation, GLuint, const GLchar*, program, name)
+ YAGL_GLES_DRIVER_FUNC3(GetProgramiv, GLuint, GLenum, GLint*, program, pname, params)
+ YAGL_GLES_DRIVER_FUNC4(GetProgramInfoLog, GLuint, GLsizei, GLsizei*, GLchar*, program, bufsize, length, infolog)
+ YAGL_GLES_DRIVER_FUNC3(GetShaderiv, GLuint, GLenum, GLint*, shader, pname, params)
+ YAGL_GLES_DRIVER_FUNC4(GetShaderInfoLog, GLuint, GLsizei, GLsizei*, GLchar*, shader, bufsize, length, infolog)
+ YAGL_GLES_DRIVER_FUNC3(GetUniformfv, GLuint, GLint, GLfloat*, program, location, params)
+ YAGL_GLES_DRIVER_FUNC3(GetUniformiv, GLuint, GLint, GLint*, program, location, params)
+ YAGL_GLES_DRIVER_FUNC_RET2(int, GetUniformLocation, GLuint, const GLchar*, program, name)
+ YAGL_GLES_DRIVER_FUNC3(GetVertexAttribfv, GLuint, GLenum, GLfloat*, index, pname, params)
+ YAGL_GLES_DRIVER_FUNC3(GetVertexAttribiv, GLuint, GLenum, GLint*, index, pname, params)
+ YAGL_GLES_DRIVER_FUNC1(LinkProgram, GLuint, program)
+ YAGL_GLES_DRIVER_FUNC2(Uniform1f, GLint, GLfloat, location, x)
+ YAGL_GLES_DRIVER_FUNC3(Uniform1fv, GLint, GLsizei, const GLfloat*, location, count, v)
+ YAGL_GLES_DRIVER_FUNC2(Uniform1i, GLint, GLint, location, x)
+ YAGL_GLES_DRIVER_FUNC3(Uniform1iv, GLint, GLsizei, const GLint*, location, count, v)
+ YAGL_GLES_DRIVER_FUNC3(Uniform2f, GLint, GLfloat, GLfloat, location, x, y)
+ YAGL_GLES_DRIVER_FUNC3(Uniform2fv, GLint, GLsizei, const GLfloat*, location, count, v)
+ YAGL_GLES_DRIVER_FUNC3(Uniform2i, GLint, GLint, GLint, location, x, y)
+ YAGL_GLES_DRIVER_FUNC3(Uniform2iv, GLint, GLsizei, const GLint*, location, count, v)
+ YAGL_GLES_DRIVER_FUNC4(Uniform3f, GLint, GLfloat, GLfloat, GLfloat, location, x, y, z)
+ YAGL_GLES_DRIVER_FUNC3(Uniform3fv, GLint, GLsizei, const GLfloat*, location, count, v)
+ YAGL_GLES_DRIVER_FUNC4(Uniform3i, GLint, GLint, GLint, GLint, location, x, y, z)
+ YAGL_GLES_DRIVER_FUNC3(Uniform3iv, GLint, GLsizei, const GLint*, location, count, v)
+ YAGL_GLES_DRIVER_FUNC5(Uniform4f, GLint, GLfloat, GLfloat, GLfloat, GLfloat, location, x, y, z, w)
+ YAGL_GLES_DRIVER_FUNC3(Uniform4fv, GLint, GLsizei, const GLfloat*, location, count, v)
+ YAGL_GLES_DRIVER_FUNC5(Uniform4i, GLint, GLint, GLint, GLint, GLint, location, x, y, z, w)
+ YAGL_GLES_DRIVER_FUNC3(Uniform4iv, GLint, GLsizei, const GLint*, location, count, v)
+ YAGL_GLES_DRIVER_FUNC4(UniformMatrix2fv, GLint, GLsizei, GLboolean, const GLfloat*, location, count, transpose, value)
+ YAGL_GLES_DRIVER_FUNC4(UniformMatrix3fv, GLint, GLsizei, GLboolean, const GLfloat*, location, count, transpose, value)
+ YAGL_GLES_DRIVER_FUNC4(UniformMatrix4fv, GLint, GLsizei, GLboolean, const GLfloat*, location, count, transpose, value)
+ YAGL_GLES_DRIVER_FUNC1(UseProgram, GLuint, program)
+ YAGL_GLES_DRIVER_FUNC1(ValidateProgram, GLuint, program)
+ YAGL_GLES_DRIVER_FUNC2(VertexAttrib1f, GLuint, GLfloat, indx, x)
+ YAGL_GLES_DRIVER_FUNC2(VertexAttrib1fv, GLuint, const GLfloat*, indx, values)
+ YAGL_GLES_DRIVER_FUNC3(VertexAttrib2f, GLuint, GLfloat, GLfloat, indx, x, y)
+ YAGL_GLES_DRIVER_FUNC2(VertexAttrib2fv, GLuint, const GLfloat*, indx, values)
+ YAGL_GLES_DRIVER_FUNC4(VertexAttrib3f, GLuint, GLfloat, GLfloat, GLfloat, indx, x, y, z)
+ YAGL_GLES_DRIVER_FUNC2(VertexAttrib3fv, GLuint, const GLfloat*, indx, values)
+ YAGL_GLES_DRIVER_FUNC5(VertexAttrib4f, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, indx, x, y, z, w)
+ YAGL_GLES_DRIVER_FUNC2(VertexAttrib4fv, GLuint, const GLfloat*, indx, values)
+ YAGL_GLES_DRIVER_FUNC2(GetIntegerv, GLenum, GLint*, pname, params)
+ YAGL_GLES_DRIVER_FUNC2(GetFloatv, GLenum, GLfloat*, pname, params)
+ YAGL_GLES_DRIVER_FUNC_RET1(const GLubyte*, GetString, GLenum, name)
+ YAGL_GLES_DRIVER_FUNC_RET1(GLboolean, IsEnabled, GLenum, cap)
+ YAGL_GLES_DRIVER_FUNC1(BlendEquation, GLenum, mode)
+ YAGL_GLES_DRIVER_FUNC2(BlendEquationSeparate, GLenum, GLenum, modeRGB, modeAlpha)
+ YAGL_GLES_DRIVER_FUNC2(BlendFunc, GLenum, GLenum, sfactor, dfactor)
+ YAGL_GLES_DRIVER_FUNC4(BlendFuncSeparate, GLenum, GLenum, GLenum, GLenum, srcRGB, dstRGB, srcAlpha, dstAlpha)
+ YAGL_GLES_DRIVER_FUNC4(BlendColor, GLclampf, GLclampf, GLclampf, GLclampf, red, green, blue, alpha)
+ YAGL_GLES_DRIVER_FUNC1(Clear, GLbitfield, mask)
+ YAGL_GLES_DRIVER_FUNC4(ClearColor, GLclampf, GLclampf, GLclampf, GLclampf, red, green, blue, alpha)
+ YAGL_GLES_DRIVER_FUNC1(ClearDepth, yagl_GLdouble, depth)
+ YAGL_GLES_DRIVER_FUNC1(ClearStencil, GLint, s)
+ YAGL_GLES_DRIVER_FUNC4(ColorMask, GLboolean, GLboolean, GLboolean, GLboolean, red, green, blue, alpha)
+ YAGL_GLES_DRIVER_FUNC1(CullFace, GLenum, mode)
+ YAGL_GLES_DRIVER_FUNC1(DepthFunc, GLenum, func)
+ YAGL_GLES_DRIVER_FUNC1(DepthMask, GLboolean, flag)
+ YAGL_GLES_DRIVER_FUNC2(DepthRange, yagl_GLdouble, yagl_GLdouble, zNear, zFar)
+ YAGL_GLES_DRIVER_FUNC1(Enable, GLenum, cap)
+ YAGL_GLES_DRIVER_FUNC1(Disable, GLenum, cap)
+ YAGL_GLES_DRIVER_FUNC0(Flush)
+ YAGL_GLES_DRIVER_FUNC1(FrontFace, GLenum, mode)
+ YAGL_GLES_DRIVER_FUNC1(GenerateMipmap, GLenum, target)
+ YAGL_GLES_DRIVER_FUNC2(Hint, GLenum, GLenum, target, mode)
+ YAGL_GLES_DRIVER_FUNC1(LineWidth, GLfloat, width)
+ YAGL_GLES_DRIVER_FUNC2(PixelStorei, GLenum, GLint, pname, param)
+ YAGL_GLES_DRIVER_FUNC2(PolygonOffset, GLfloat, GLfloat, factor, units)
+ YAGL_GLES_DRIVER_FUNC4(Scissor, GLint, GLint, GLsizei, GLsizei, x, y, width, height)
+ YAGL_GLES_DRIVER_FUNC3(StencilFunc, GLenum, GLint, GLuint, func, ref, mask)
+ YAGL_GLES_DRIVER_FUNC1(StencilMask, GLuint, mask)
+ YAGL_GLES_DRIVER_FUNC3(StencilOp, GLenum, GLenum, GLenum, fail, zfail, zpass)
+ YAGL_GLES_DRIVER_FUNC2(SampleCoverage, GLclampf, GLboolean, value, invert)
+ YAGL_GLES_DRIVER_FUNC4(Viewport, GLint, GLint, GLsizei, GLsizei, x, y, width, height)
+ YAGL_GLES_DRIVER_FUNC4(StencilFuncSeparate, GLenum, GLenum, GLint, GLuint, face, func, ref, mask)
+ YAGL_GLES_DRIVER_FUNC2(StencilMaskSeparate, GLenum, GLuint, face, mask)
+ YAGL_GLES_DRIVER_FUNC4(StencilOpSeparate, GLenum, GLenum, GLenum, GLenum, face, fail, zfail, zpass)
+ YAGL_GLES_DRIVER_FUNC1(PointSize, GLfloat, size)
+ YAGL_GLES_DRIVER_FUNC2(AlphaFunc, GLenum, GLclampf, func, ref)
+ YAGL_GLES_DRIVER_FUNC1(MatrixMode, GLenum, mode)
+ YAGL_GLES_DRIVER_FUNC0(LoadIdentity)
+ YAGL_GLES_DRIVER_FUNC0(PopMatrix)
+ YAGL_GLES_DRIVER_FUNC0(PushMatrix)
+ YAGL_GLES_DRIVER_FUNC4(Rotatef, GLfloat, GLfloat, GLfloat, GLfloat, angle, x, y, z)
+ YAGL_GLES_DRIVER_FUNC3(Translatef, GLfloat, GLfloat, GLfloat, x, y, z)
+ YAGL_GLES_DRIVER_FUNC3(Scalef, GLfloat, GLfloat, GLfloat, x, y, z)
+ YAGL_GLES_DRIVER_FUNC6(Ortho, yagl_GLdouble, yagl_GLdouble, yagl_GLdouble, yagl_GLdouble, yagl_GLdouble, yagl_GLdouble, left, right, bottom, top, znear, zfar)
+ YAGL_GLES_DRIVER_FUNC4(Color4f, GLfloat, GLfloat, GLfloat, GLfloat, red, green, blue, alpha)
+ YAGL_GLES_DRIVER_FUNC4(Color4ub, GLubyte, GLubyte, GLubyte, GLubyte, red, green, blue, alpha)
+ YAGL_GLES_DRIVER_FUNC3(Normal3f, GLfloat, GLfloat, GLfloat, nx, ny, nz)
+ YAGL_GLES_DRIVER_FUNC2(PointParameterf, GLenum, GLfloat, pname, param)
+ YAGL_GLES_DRIVER_FUNC2(PointParameterfv, GLenum, const GLfloat*, pname, params)
+ YAGL_GLES_DRIVER_FUNC2(Fogf, GLenum, GLfloat, pname, param)
+ YAGL_GLES_DRIVER_FUNC2(Fogfv, GLenum, const GLfloat*, pname, params)
+ YAGL_GLES_DRIVER_FUNC6(Frustum, yagl_GLdouble, yagl_GLdouble, yagl_GLdouble, yagl_GLdouble, yagl_GLdouble, yagl_GLdouble, left, right, bottom, top, znear, zfar)
+ YAGL_GLES_DRIVER_FUNC3(Lightf, GLenum, GLenum, GLfloat, light, pname, param)
+ YAGL_GLES_DRIVER_FUNC3(Lightfv, GLenum, GLenum, const GLfloat*, light, pname, params)
+ YAGL_GLES_DRIVER_FUNC3(GetLightfv, GLenum, GLenum, GLfloat*, light, pname, params)
+ YAGL_GLES_DRIVER_FUNC2(LightModelf, GLenum, GLfloat, pname, param)
+ YAGL_GLES_DRIVER_FUNC2(LightModelfv, GLenum, const GLfloat*, pname, params)
+ YAGL_GLES_DRIVER_FUNC3(Materialf, GLenum, GLenum, GLfloat, face, pname, param)
+ YAGL_GLES_DRIVER_FUNC3(Materialfv, GLenum, GLenum, const GLfloat*, face, pname, params)
+ YAGL_GLES_DRIVER_FUNC3(GetMaterialfv, GLenum, GLenum, GLfloat*, face, pname, params)
+ YAGL_GLES_DRIVER_FUNC1(ShadeModel, GLenum, mode)
+ YAGL_GLES_DRIVER_FUNC1(LogicOp, GLenum, opcode)
+ YAGL_GLES_DRIVER_FUNC1(MultMatrixf, const GLfloat*, m)
+ YAGL_GLES_DRIVER_FUNC1(LoadMatrixf, const GLfloat*, m)
+ YAGL_GLES_DRIVER_FUNC2(ClipPlane, GLenum, const yagl_GLdouble *, plane, equation)
+ YAGL_GLES_DRIVER_FUNC2(GetClipPlane, GLenum, const yagl_GLdouble *, plane, equation)
-void yagl_gles_driver_init(struct yagl_gles_driver *driver);
+ YAGL_GLES_DRIVER_FUNC_RET2(void*, MapBuffer, GLenum, GLenum, target, access)
+ YAGL_GLES_DRIVER_FUNC_RET1(GLboolean, UnmapBuffer, GLenum, target)
+ YAGL_GLES_DRIVER_FUNC0(Finish)
+
++ /*
++ * @}
++ */
++
++ /*
++ * OpenGL 3.1+ core.
++ */
++
++ YAGL_GLES_DRIVER_FUNC_RET2(const GLubyte*, GetStringi, GLenum, GLuint, name, index)
++ YAGL_GLES_DRIVER_FUNC2(GenVertexArrays, GLsizei, GLuint*, n, arrays)
++ YAGL_GLES_DRIVER_FUNC1(BindVertexArray, GLuint, array)
++ YAGL_GLES_DRIVER_FUNC2(DeleteVertexArrays, GLsizei, const GLuint*, n, arrays)
++ YAGL_GLES_DRIVER_FUNC5(GetActiveUniformsiv, GLuint, GLsizei, const GLuint*, GLenum, GLint*, program, uniformCount, uniformIndices, pname, params)
++ YAGL_GLES_DRIVER_FUNC4(GetUniformIndices, GLuint, GLsizei, const GLchar* const*, GLuint*, program, uniformCount, uniformNames, uniformIndices)
++ YAGL_GLES_DRIVER_FUNC_RET2(GLuint, GetUniformBlockIndex, GLuint, const GLchar*, program, uniformBlockName);
++ YAGL_GLES_DRIVER_FUNC3(UniformBlockBinding, GLuint, GLuint, GLuint, program, uniformBlockIndex, uniformBlockBinding);
++ YAGL_GLES_DRIVER_FUNC5(GetActiveUniformBlockName, GLuint, GLuint, GLsizei, GLsizei*, GLchar*, program, uniformBlockIndex, bufSize, length, uniformBlockName);
++ YAGL_GLES_DRIVER_FUNC4(GetActiveUniformBlockiv, GLuint, GLuint, GLenum, GLint*, program, uniformBlockIndex, pname, params);
++ YAGL_GLES_DRIVER_FUNC3(BindBufferBase, GLenum, GLuint, GLuint, target, index, buffer)
++ YAGL_GLES_DRIVER_FUNC5(BindBufferRange, GLenum, GLuint, GLuint, GLintptr, GLsizeiptr, target, index, buffer, offset, size)
++ YAGL_GLES_DRIVER_FUNC2(GenTransformFeedbacks, GLsizei, GLuint*, n, ids)
++ YAGL_GLES_DRIVER_FUNC2(BindTransformFeedback, GLenum, GLuint, target, id)
++ YAGL_GLES_DRIVER_FUNC1(BeginTransformFeedback, GLenum, primitiveMode)
++ YAGL_GLES_DRIVER_FUNC0(EndTransformFeedback)
++ YAGL_GLES_DRIVER_FUNC0(PauseTransformFeedback)
++ YAGL_GLES_DRIVER_FUNC0(ResumeTransformFeedback)
++ YAGL_GLES_DRIVER_FUNC2(DeleteTransformFeedbacks, GLsizei, const GLuint*, n, ids)
++ YAGL_GLES_DRIVER_FUNC4(TransformFeedbackVaryings, GLuint, GLsizei, const GLchar* const*, GLenum, program, count, varyings, bufferMode)
++ YAGL_GLES_DRIVER_FUNC7(GetTransformFeedbackVarying, GLuint, GLuint, GLsizei, GLsizei*, GLsizei*, GLenum*, GLchar*, program, index, bufSize, length, size, type, name)
++ YAGL_GLES_DRIVER_FUNC2(GenQueries, GLsizei, GLuint*, n, ids)
++ YAGL_GLES_DRIVER_FUNC2(BeginQuery, GLenum, GLuint, target, id)
++ YAGL_GLES_DRIVER_FUNC1(EndQuery, GLenum, target)
++ YAGL_GLES_DRIVER_FUNC3(GetQueryObjectuiv, GLuint, GLenum, GLuint*, id, pname, params)
++ YAGL_GLES_DRIVER_FUNC2(DeleteQueries, GLsizei, const GLuint*, n, ids)
++ YAGL_GLES_DRIVER_FUNC4(DrawArraysInstanced, GLenum, GLint, GLsizei, GLsizei, mode, start, count, primcount);
++ YAGL_GLES_DRIVER_FUNC5(DrawElementsInstanced, GLenum, GLsizei, GLenum, const void*, GLsizei, mode, count, type, indices, primcount);
++ YAGL_GLES_DRIVER_FUNC2(VertexAttribDivisor, GLuint, GLuint, index, divisor);
++
++ /*
++ * @}
++ */
++
++ yagl_gl_version gl_version;
++
+ void (*destroy)(struct yagl_gles_driver */*driver*/);
+ };
+
-void yagl_ensure_ctx(void);
-void yagl_unensure_ctx(void);
++void yagl_gles_driver_init(struct yagl_gles_driver *driver,
++ yagl_gl_version gl_version);
+ void yagl_gles_driver_cleanup(struct yagl_gles_driver *driver);
+
+ /*
+ * @}
+ */
+
+ /*
+ * Helpers for ensuring context.
+ * @{
+ */
+
++uint32_t yagl_get_ctx_id(void);
++void yagl_ensure_ctx(uint32_t ctx_id);
++void yagl_unensure_ctx(uint32_t ctx_id);
+
+ /*
+ * @}
+ */
+
+ #endif
--- /dev/null
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #ifndef _QEMU_YAGL_LOG_H
+ #define _QEMU_YAGL_LOG_H
+
+ #ifdef _WIN32
+ #include <windows.h>
+ #endif
+
+ #include "yagl_types.h"
+
+ //#define YAGL_LOG_DISABLE
+
+ typedef enum
+ {
+ yagl_log_level_off = 0,
+ yagl_log_level_error = 1,
+ yagl_log_level_warn = 2,
+ yagl_log_level_info = 3,
+ yagl_log_level_debug = 4,
+ yagl_log_level_trace = 5
+ } yagl_log_level;
+
+ #define yagl_log_level_max yagl_log_level_trace
+
+ void yagl_log_init(void);
+
+ void yagl_log_cleanup(void);
+
+ void yagl_log_event(yagl_log_level log_level,
+ yagl_pid process_id,
+ yagl_tid thread_id,
+ const char* facility,
+ int line,
+ const char* format, ...);
+
+ void yagl_log_func_enter(yagl_pid process_id,
+ yagl_tid thread_id,
+ const char* func,
+ int line,
+ const char* format, ...);
+
+ void yagl_log_func_exit(yagl_pid process_id,
+ yagl_tid thread_id,
+ const char* func,
+ int line,
+ const char* format, ...);
+
+ /*
+ * Convenience function that uses datatypes instead of format strings, one for each
+ * function argument.
+ *
+ * 'num_args' is number of arguments to the function, then come 'num_args'
+ * (datatype, arg) strings, then come 'num_args' arguments. i.e. the call is
+ * like this:
+ * yagl_log_func_enter_split(0, 0, "my_func", 123, 2, "EGLint", "arg_1", "EGLDisplay", "arg_2", 12, my_ptr);
+ *
+ * This function uses constant size storage for final format string creation,
+ * be sure not to pass too many arguments, the overall size must not
+ * exceed 1024 characters.
+ *
+ * If one of the argument datatypes is not a supported datatype, then argument
+ * formatting is skipped and "..." is printed instead.
+ */
+ void yagl_log_func_enter_split(yagl_pid process_id,
+ yagl_tid thread_id,
+ const char* func,
+ int line,
+ int num_args, ...);
+
+ /*
+ * Same as above, but only one datatype is required and only one argument
+ * is needed. i.e.:
+ * yagl_log_func_exit_split(0, 0, "my_func", 234, "EGLint", 123);
+ */
+ void yagl_log_func_exit_split(yagl_pid process_id,
+ yagl_tid thread_id,
+ const char* func,
+ int line,
+ const char* datatype, ...);
+
+ bool yagl_log_is_enabled_for_level(yagl_log_level log_level);
+
+ bool yagl_log_is_enabled_for_facility(const char* facility);
+
+ bool yagl_log_is_enabled_for_func_tracing(void);
+
+ #ifndef YAGL_LOG_DISABLE
+ #define YAGL_LOG_EVENT(log_level, pid, tid, facility, format, ...) \
+ do \
+ { \
+ if ( yagl_log_is_enabled_for_level(yagl_log_level_##log_level) && \
+ yagl_log_is_enabled_for_facility(facility) ) \
+ { \
+ yagl_log_event(yagl_log_level_##log_level, pid, tid, facility, __LINE__, format,##__VA_ARGS__); \
+ } \
+ } while(0)
+
+ #define YAGL_LOG_FUNC_SET(func) \
+ const char* _yagl_log_current_func = #func; \
+ yagl_pid _yagl_log_current_pid = (cur_ts ? cur_ts->ps->id : 0); \
+ yagl_tid _yagl_log_current_tid = (cur_ts ? cur_ts->id : 0)
+
+ #define YAGL_LOG_FUNC_ENTER(func, format, ...) \
+ YAGL_LOG_FUNC_SET(func); \
+ do \
+ { \
+ if ( yagl_log_is_enabled_for_func_tracing() && \
+ yagl_log_is_enabled_for_facility(_yagl_log_current_func) ) \
+ { \
+ yagl_log_func_enter(_yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, __LINE__, format,##__VA_ARGS__); \
+ } \
+ } while(0)
+
+ #define YAGL_LOG_FUNC_ENTER_SPLIT(func, num_args, ...) \
+ YAGL_LOG_FUNC_SET(func); \
+ do \
+ { \
+ if ( yagl_log_is_enabled_for_func_tracing() && \
+ yagl_log_is_enabled_for_facility(_yagl_log_current_func) ) \
+ { \
+ yagl_log_func_enter_split(_yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, __LINE__, num_args,##__VA_ARGS__); \
+ } \
+ } while(0)
+
+ #define YAGL_LOG_FUNC_EXIT(format, ...) \
+ do \
+ { \
+ if ( yagl_log_is_enabled_for_func_tracing() && \
+ yagl_log_is_enabled_for_facility(_yagl_log_current_func) ) \
+ { \
+ yagl_log_func_exit(_yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, __LINE__, format,##__VA_ARGS__); \
+ } \
+ } while(0)
+
+ #define YAGL_LOG_FUNC_EXIT_SPLIT(ret_type, ret) \
+ do \
+ { \
+ if ( yagl_log_is_enabled_for_func_tracing() && \
+ yagl_log_is_enabled_for_facility(_yagl_log_current_func) ) \
+ { \
+ yagl_log_func_exit_split(_yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, __LINE__, #ret_type, ret); \
+ } \
+ } while(0)
+
+ #ifdef _WIN32
+ #define YAGL_LOG_EVENT_WIN(log_level, pid, tid, facility, format) \
+ do \
+ { \
+ DWORD err = GetLastError(); \
+ if ( yagl_log_is_enabled_for_level(yagl_log_level_##log_level) && \
+ yagl_log_is_enabled_for_facility(facility) ) \
+ { \
+ LPVOID err_msg; \
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, \
+ NULL, err, 0, (LPTSTR)&err_msg, 0 , NULL); \
+ yagl_log_event(yagl_log_level_##log_level, pid, tid, facility, __LINE__, format"%s", err_msg); \
+ LocalFree(err_msg); \
+ } \
+ } while(0)
+ #endif
+ #else
+ #define YAGL_LOG_EVENT(log_level, pid, tid, facility, format, ...)
+ #define YAGL_LOG_FUNC_SET(func)
+ #define YAGL_LOG_FUNC_ENTER(func, format, ...)
+ #define YAGL_LOG_FUNC_ENTER_SPLIT(func, num_args, ...)
+ #define YAGL_LOG_FUNC_EXIT(format, ...)
+ #define YAGL_LOG_FUNC_EXIT_SPLIT(ret_type, ret)
+ #define YAGL_LOG_EVENT_WIN(log_level, pid, tid, facility, format)
+ #endif
+
+ #define YAGL_LOG_FUNC_ENTER_SPLIT0(func) YAGL_LOG_FUNC_ENTER_SPLIT(func, 0)
+
+ #define YAGL_LOG_FUNC_ENTER_SPLIT1(func, arg0_type, arg0) \
+ YAGL_LOG_FUNC_ENTER_SPLIT(func, 1, #arg0_type, #arg0, arg0)
+
+ #define YAGL_LOG_FUNC_ENTER_SPLIT2(func, arg0_type, arg1_type, arg0, arg1) \
+ YAGL_LOG_FUNC_ENTER_SPLIT(func, 2, #arg0_type, #arg0, #arg1_type, #arg1, arg0, arg1)
+
+ #define YAGL_LOG_FUNC_ENTER_SPLIT3( func, \
+ arg0_type, arg1_type, arg2_type, \
+ arg0, arg1, arg2 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 3, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, \
+ arg0, arg1, arg2 )
+
+ #define YAGL_LOG_FUNC_ENTER_SPLIT4( func, \
+ arg0_type, arg1_type, arg2_type, arg3_type, \
+ arg0, arg1, arg2, arg3 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 4, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, #arg3_type, #arg3, \
+ arg0, arg1, arg2, arg3 )
+
+ #define YAGL_LOG_FUNC_ENTER_SPLIT5( func, \
+ arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, \
+ arg0, arg1, arg2, arg3, arg4 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 5, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, #arg3_type, #arg3, #arg4_type, #arg4, \
+ arg0, arg1, arg2, arg3, arg4 )
+
+ #define YAGL_LOG_FUNC_ENTER_SPLIT6( func, \
+ arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, \
+ arg0, arg1, arg2, arg3, arg4, arg5 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 6, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, #arg3_type, #arg3, #arg4_type, #arg4, #arg5_type, #arg5, \
+ arg0, arg1, arg2, arg3, arg4, arg5 )
+
+ #define YAGL_LOG_FUNC_ENTER_SPLIT7( func, \
+ arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 7, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, #arg3_type, #arg3, #arg4_type, #arg4, #arg5_type, #arg5, #arg6_type, #arg6, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6 )
+
+ #define YAGL_LOG_FUNC_ENTER_SPLIT8( func, \
+ arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 8, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, #arg3_type, #arg3, #arg4_type, #arg4, #arg5_type, #arg5, #arg6_type, #arg6, #arg7_type, #arg7, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 )
+
+ #define YAGL_LOG_FUNC_ENTER_SPLIT9( func, \
+ arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 ) \
+ YAGL_LOG_FUNC_ENTER_SPLIT( func, 9, \
+ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, #arg3_type, #arg3, #arg4_type, #arg4, #arg5_type, #arg5, #arg6_type, #arg6, #arg7_type, #arg7, #arg8_type, #arg8, \
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 )
+
++#define YAGL_LOG_FUNC_ENTER_SPLIT10( func, \
++ arg0_type, arg1_type, arg2_type, arg3_type, arg4_type, arg5_type, arg6_type, arg7_type, arg8_type, arg9_type, \
++ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 ) \
++ YAGL_LOG_FUNC_ENTER_SPLIT( func, 10, \
++ #arg0_type, #arg0, #arg1_type, #arg1, #arg2_type, #arg2, #arg3_type, #arg3, #arg4_type, #arg4, #arg5_type, #arg5, #arg6_type, #arg6, #arg7_type, #arg7, #arg8_type, #arg8, #arg9_type, #arg9, \
++ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 )
++
+ #define YAGL_LOG_TRACE(format, ...) YAGL_LOG_EVENT(trace, _yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, format,##__VA_ARGS__)
+ #define YAGL_LOG_DEBUG(format, ...) YAGL_LOG_EVENT(debug, _yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, format,##__VA_ARGS__)
+ #define YAGL_LOG_INFO(format, ...) YAGL_LOG_EVENT(info, _yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, format,##__VA_ARGS__)
+ #define YAGL_LOG_WARN(format, ...) YAGL_LOG_EVENT(warn, _yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, format,##__VA_ARGS__)
+ #define YAGL_LOG_ERROR(format, ...) YAGL_LOG_EVENT(error, _yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, format,##__VA_ARGS__)
+ #define YAGL_LOG_ERROR_WIN() YAGL_LOG_EVENT_WIN(error, _yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, "OS ERROR: ")
+ #define YAGL_LOG_CRITICAL(format, ...) \
+ yagl_log_event(yagl_log_level_error, 0, 0, __FUNCTION__, __LINE__, format,##__VA_ARGS__)
+
+ #endif
--- /dev/null
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include "yagl_server.h"
+ #include "yagl_api.h"
+ #include "yagl_process.h"
+ #include "yagl_thread.h"
+ #include "yagl_version.h"
+ #include "yagl_log.h"
+ #include "yagl_egl_backend.h"
+ #include "yagl_apis/egl/yagl_egl_api.h"
+ #include "yagl_apis/gles/yagl_gles_api.h"
+ #include <GL/gl.h>
+ #include "yagl_gles_driver.h"
+
+ static __inline void yagl_marshal_put_uint32_t(uint8_t** buff, uint32_t value)
+ {
+ *(uint32_t*)(*buff) = value;
+ *buff += 8;
+ }
+
+ static __inline uint32_t yagl_marshal_get_uint32_t(uint8_t** buff)
+ {
+ uint32_t tmp = *(uint32_t*)*buff;
+ *buff += 8;
+ return tmp;
+ }
+
+ static struct yagl_thread_state
+ *yagl_server_find_thread(struct yagl_server_state *ss,
+ yagl_pid target_pid,
+ yagl_tid target_tid)
+ {
+ struct yagl_process_state *ps = NULL;
+
+ QLIST_FOREACH(ps, &ss->processes, entry) {
+ if (ps->id == target_pid) {
+ return yagl_process_find_thread(ps, target_tid);
+ }
+ }
+
+ return NULL;
+ }
+
+ struct yagl_server_state
+ *yagl_server_state_create(struct yagl_egl_backend *egl_backend,
+ struct yagl_gles_driver *gles_driver,
+ struct work_queue *render_queue,
+ struct winsys_interface *wsi)
+ {
+ int i;
+ struct yagl_server_state *ss =
+ g_malloc0(sizeof(struct yagl_server_state));
+
+ QLIST_INIT(&ss->processes);
+
+ ss->apis[yagl_api_id_egl - 1] = yagl_egl_api_create(egl_backend);
+
+ if (!ss->apis[yagl_api_id_egl - 1]) {
+ egl_backend->destroy(egl_backend);
+ gles_driver->destroy(gles_driver);
+
+ goto fail;
+ }
+
+ ss->apis[yagl_api_id_gles - 1] = yagl_gles_api_create(gles_driver);
+
+ if (!ss->apis[yagl_api_id_gles - 1]) {
+ gles_driver->destroy(gles_driver);
+
+ goto fail;
+ }
+
+ ss->render_type = egl_backend->render_type;
++ ss->gl_version = egl_backend->gl_version;
+
+ ss->render_queue = render_queue;
+
+ ss->wsi = wsi;
+
+ return ss;
+
+ fail:
+ for (i = 0; i < YAGL_NUM_APIS; ++i) {
+ if (ss->apis[i]) {
+ ss->apis[i]->destroy(ss->apis[i]);
+ ss->apis[i] = NULL;
+ }
+ }
+
+ g_free(ss);
+
+ return NULL;
+ }
+
+ void yagl_server_state_destroy(struct yagl_server_state *ss)
+ {
+ int i;
+
+ yagl_server_reset(ss);
+
+ for (i = 0; i < YAGL_NUM_APIS; ++i) {
+ if (ss->apis[i]) {
+ ss->apis[i]->destroy(ss->apis[i]);
+ ss->apis[i] = NULL;
+ }
+ }
+
+ g_free(ss);
+ }
+
+ void yagl_server_reset(struct yagl_server_state *ss)
+ {
+ struct yagl_process_state *ps, *next;
+
+ work_queue_wait(ss->render_queue);
+
+ QLIST_FOREACH_SAFE(ps, &ss->processes, entry, next) {
+ QLIST_REMOVE(ps, entry);
+ yagl_process_state_destroy(ps);
+ }
+
+ assert(QLIST_EMPTY(&ss->processes));
+ }
+
+ /*
+ * buff is:
+ * IN (uint32_t) version
+ * IN (uint32_t) pid
+ * IN (uint32_t) tid
+ * OUT (uint32_t) res: 1 - init ok, 0 - init error
+ * OUT (uint32_t) render_type: in case of init ok
++ * OUT (uint32_t) gl_version: in case of init ok
+ */
+ bool yagl_server_dispatch_init(struct yagl_server_state *ss,
+ uint8_t *buff,
+ yagl_pid *target_pid,
+ yagl_tid *target_tid)
+ {
+ uint8_t *orig_buff;
+ uint32_t version;
+ struct yagl_process_state *ps = NULL;
+ struct yagl_thread_state *ts = NULL;
+ uint8_t **pages;
+
+ YAGL_LOG_FUNC_ENTER(yagl_server_dispatch_init, NULL);
+
+ orig_buff = buff;
+
+ version = yagl_marshal_get_uint32_t(&buff);
+ *target_pid = yagl_marshal_get_uint32_t(&buff);
+ *target_tid = yagl_marshal_get_uint32_t(&buff);
+
+ if (version != YAGL_VERSION) {
+ YAGL_LOG_CRITICAL(
+ "target-host version mismatch, target version is %u, host version is %u",
+ version,
+ YAGL_VERSION);
+
+ yagl_marshal_put_uint32_t(&buff, 0);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return false;
+ }
+
+ work_queue_wait(ss->render_queue);
+
+ QLIST_FOREACH(ps, &ss->processes, entry) {
+ if (ps->id == *target_pid) {
+ /*
+ * Process already exists.
+ */
+
+ ts = yagl_process_find_thread(ps, *target_tid);
+
+ if (ts) {
+ YAGL_LOG_CRITICAL(
+ "thread %u already initialized in process %u",
+ *target_tid, *target_pid);
+
+ yagl_marshal_put_uint32_t(&buff, 0);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return false;
+ } else {
+ ts = yagl_process_add_thread(ps, *target_tid);
+
+ if (!ts) {
+ YAGL_LOG_CRITICAL(
+ "cannot add thread %u to process %u",
+ *target_tid, *target_pid);
+
+ yagl_marshal_put_uint32_t(&buff, 0);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return false;
+ } else {
+ goto out;
+ }
+ }
+ }
+ }
+
+ /*
+ * No process found, create one.
+ */
+
+ ps = yagl_process_state_create(ss, *target_pid);
+
+ if (!ps) {
+ YAGL_LOG_CRITICAL("cannot create process %u", *target_pid);
+
+ yagl_marshal_put_uint32_t(&buff, 0);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return false;
+ }
+
+ ts = yagl_process_add_thread(ps, *target_tid);
+
+ if (!ts) {
+ YAGL_LOG_CRITICAL(
+ "cannot add thread %u to process %u",
+ *target_tid, *target_pid);
+
+ yagl_process_state_destroy(ps);
+
+ yagl_marshal_put_uint32_t(&buff, 0);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return false;
+ } else {
+ QLIST_INSERT_HEAD(&ss->processes, ps, entry);
+
+ goto out;
+ }
+
+ out:
+ pages = g_malloc0(2 * sizeof(*pages));
+
+ pages[0] = orig_buff;
+
+ yagl_thread_set_buffer(ts, pages);
+
+ yagl_marshal_put_uint32_t(&buff, 1);
+ yagl_marshal_put_uint32_t(&buff, ss->render_type);
++ yagl_marshal_put_uint32_t(&buff, ss->gl_version);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return true;
+ }
+
+ /*
+ * buff is:
+ * IN (uint32_t) count
+ * IN (uint32_t) phys_addr
+ * ...
+ * IN (uint32_t) phys_addr
+ * OUT (uint32_t) res: 1 - update ok, no change - update error
+ */
+ void yagl_server_dispatch_update(struct yagl_server_state *ss,
+ yagl_pid target_pid,
+ yagl_tid target_tid,
+ uint8_t *buff)
+ {
+ struct yagl_thread_state *ts;
+ uint32_t i, count = 0;
+ uint8_t **pages = NULL;
+
+ YAGL_LOG_FUNC_ENTER(yagl_server_dispatch_update, NULL);
+
+ ts = yagl_server_find_thread(ss, target_pid, target_tid);
+
+ if (!ts) {
+ YAGL_LOG_CRITICAL("process/thread %u/%u not found",
+ target_pid, target_tid);
+ goto fail;
+ }
+
+ work_queue_wait(ss->render_queue);
+
+ count = yagl_marshal_get_uint32_t(&buff);
+
+ if (count > ((TARGET_PAGE_SIZE / 8) - 2)) {
+ YAGL_LOG_CRITICAL("bad count = %u", count);
+ goto fail;
+ }
+
+ pages = g_malloc0((count + 1) * sizeof(*pages));
+
+ for (i = 0; i < count; ++i) {
+ hwaddr page_pa = yagl_marshal_get_uint32_t(&buff);
+ hwaddr len = TARGET_PAGE_SIZE;
+
+ pages[i] = cpu_physical_memory_map(page_pa, &len, false);
+
+ if (!pages[i] || (len != TARGET_PAGE_SIZE)) {
+ YAGL_LOG_CRITICAL("cpu_physical_memory_map(read) failed for page_pa = 0x%X",
+ (uint32_t)page_pa);
+ goto fail;
+ }
+ }
+
+ yagl_thread_set_buffer(ts, pages);
+
+ yagl_marshal_put_uint32_t(&buff, 1);
+
+ goto out;
+
+ fail:
+ for (i = count; i > 0; --i) {
+ if (pages[i - 1]) {
+ cpu_physical_memory_unmap(pages[i - 1],
+ TARGET_PAGE_SIZE,
+ false,
+ TARGET_PAGE_SIZE);
+ }
+ }
+ g_free(pages);
+
+ out:
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ void yagl_server_dispatch_batch(struct yagl_server_state *ss,
+ yagl_pid target_pid,
+ yagl_tid target_tid,
+ bool sync)
+ {
+ struct yagl_thread_state *ts;
+
+ YAGL_LOG_FUNC_ENTER(yagl_server_dispatch_batch, NULL);
+
+ ts = yagl_server_find_thread(ss, target_pid, target_tid);
+
+ if (ts) {
+ yagl_thread_call(ts, sync);
+ } else {
+ YAGL_LOG_CRITICAL("process/thread %u/%u not found",
+ target_pid, target_tid);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
+
+ void yagl_server_dispatch_exit(struct yagl_server_state *ss,
+ yagl_pid target_pid,
+ yagl_tid target_tid)
+ {
+ struct yagl_thread_state *ts =
+ yagl_server_find_thread(ss, target_pid, target_tid);
+ struct yagl_process_state *ps = NULL;
+
+ YAGL_LOG_FUNC_ENTER(yagl_server_dispatch_exit, NULL);
+
+ if (!ts) {
+ YAGL_LOG_CRITICAL("process/thread %u/%u not found",
+ target_pid, target_tid);
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+
+ return;
+ }
+
+ work_queue_wait(ss->render_queue);
+
+ ps = ts->ps;
+
+ yagl_process_remove_thread(ps, target_tid);
+
+ if (!yagl_process_has_threads(ps)) {
+ QLIST_REMOVE(ps, entry);
+
+ yagl_process_state_destroy(ps);
+ }
+
+ YAGL_LOG_FUNC_EXIT(NULL);
+ }
--- /dev/null
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #ifndef _QEMU_YAGL_SERVER_H
+ #define _QEMU_YAGL_SERVER_H
+
+ #include "yagl_types.h"
+ #include "qemu/queue.h"
+
+ struct yagl_api;
+ struct yagl_process_state;
+ struct yagl_egl_backend;
+ struct yagl_gles_driver;
+ struct work_queue;
+ struct winsys_interface;
+
+ struct yagl_server_state
+ {
+ yagl_render_type render_type;
+
++ yagl_gl_version gl_version;
++
+ struct yagl_api *apis[YAGL_NUM_APIS];
+
+ QLIST_HEAD(, yagl_process_state) processes;
+
+ struct work_queue *render_queue;
+
+ struct winsys_interface *wsi;
+ };
+
+ /*
+ * Create/destroy YaGL server state. Typically, there should be one and only
+ * server state which is a part of YaGL device.
+ * @{
+ */
+
+ /*
+ * 'egl_backend' and 'gles_driver' will be owned by
+ * returned server state or destroyed in case of error.
+ */
+ struct yagl_server_state
+ *yagl_server_state_create(struct yagl_egl_backend *egl_backend,
+ struct yagl_gles_driver *gles_driver,
+ struct work_queue *render_queue,
+ struct winsys_interface *wsi);
+
+ void yagl_server_state_destroy(struct yagl_server_state *ss);
+ /*
+ * @}
+ */
+
+ /*
+ * Don't destroy the state, just drop all processes/threads.
+ */
+ void yagl_server_reset(struct yagl_server_state *ss);
+
+ /*
+ * This is called for first YaGL call.
+ */
+ bool yagl_server_dispatch_init(struct yagl_server_state *ss,
+ uint8_t *buff,
+ yagl_pid *target_pid,
+ yagl_tid *target_tid);
+
+ /*
+ * This is called for each YaGL transport buffer update.
+ */
+ void yagl_server_dispatch_update(struct yagl_server_state *ss,
+ yagl_pid target_pid,
+ yagl_tid target_tid,
+ uint8_t *buff);
+
+ /*
+ * This is called for each YaGL batch.
+ */
+ void yagl_server_dispatch_batch(struct yagl_server_state *ss,
+ yagl_pid target_pid,
+ yagl_tid target_tid,
+ bool sync);
+
+ /*
+ * This is called for last YaGL call.
+ */
+ void yagl_server_dispatch_exit(struct yagl_server_state *ss,
+ yagl_pid target_pid,
+ yagl_tid target_tid);
+
+ #endif
--- /dev/null
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #include "yagl_transport.h"
+ #include "yagl_compiled_transfer.h"
+ #include "yagl_mem.h"
++#include "yagl_log.h"
++#include "yagl_thread.h"
++#include "yagl_process.h"
+
+ typedef enum
+ {
+ yagl_call_result_ok = 0xA, /* Call is ok. */
+ yagl_call_result_retry = 0xB, /* Page fault on host, retry is required. */
+ } yagl_call_result;
+
+ #define YAGL_TRANSPORT_BATCH_HEADER_SIZE (4 * 8)
+
+ static __inline uint32_t yagl_transport_uint32_t_at(struct yagl_transport *t,
+ uint32_t offset)
+ {
+ return *(uint32_t*)(t->pages[offset / TARGET_PAGE_SIZE] +
+ (offset & ~TARGET_PAGE_MASK));
+ }
+
+ static __inline target_ulong yagl_transport_va_at(struct yagl_transport *t,
+ uint32_t offset)
+ {
+ return *(target_ulong*)(t->pages[offset / TARGET_PAGE_SIZE] +
+ (offset & ~TARGET_PAGE_MASK));
+ }
+
+ static __inline void yagl_transport_uint32_t_to(struct yagl_transport *t,
+ uint32_t offset,
+ uint32_t value)
+ {
+ *(uint32_t*)(t->pages[offset / TARGET_PAGE_SIZE] +
+ (offset & ~TARGET_PAGE_MASK)) = value;
+ }
+
+ static void yagl_transport_copy_from(struct yagl_transport *t,
+ uint32_t offset,
+ uint8_t *data,
+ uint32_t size)
+ {
+ uint32_t page_index = offset / TARGET_PAGE_SIZE;
+ uint8_t *ptr = t->pages[page_index] + (offset & ~TARGET_PAGE_MASK);
+
+ while (size > 0) {
+ uint32_t rem = t->pages[page_index] + TARGET_PAGE_SIZE - ptr;
+ rem = MIN(rem, size);
+
+ memcpy(data, ptr, rem);
+
+ size -= rem;
+ data += rem;
+
+ ++page_index;
+ ptr = t->pages[page_index];
+ }
+ }
+
+ static void yagl_transport_copy_to(struct yagl_transport *t,
+ uint32_t offset,
+ const uint8_t *data,
+ uint32_t size)
+ {
+ uint32_t page_index = offset / TARGET_PAGE_SIZE;
+ uint8_t *ptr = t->pages[page_index] + (offset & ~TARGET_PAGE_MASK);
+
+ while (size > 0) {
+ uint32_t rem = t->pages[page_index] + TARGET_PAGE_SIZE - ptr;
+ rem = MIN(rem, size);
+
+ memcpy(ptr, data, rem);
+
+ size -= rem;
+ data += rem;
+
+ ++page_index;
+ ptr = t->pages[page_index];
+ }
+ }
+
+ struct yagl_transport *yagl_transport_create(void)
+ {
+ struct yagl_transport *t;
+ uint32_t i;
+
+ t = g_malloc0(sizeof(*t));
+
+ for (i = 0; i < YAGL_TRANSPORT_MAX_IN; ++i) {
+ yagl_vector_init(&t->in_arrays[i].v, 1, 0);
+ }
+
+ QLIST_INIT(&t->compiled_transfers);
+
+ return t;
+ }
+
+ void yagl_transport_destroy(struct yagl_transport *t)
+ {
+ uint32_t i;
+
+ for (i = 0; i < YAGL_TRANSPORT_MAX_IN; ++i) {
+ yagl_vector_cleanup(&t->in_arrays[i].v);
+ }
+
+ g_free(t);
+ }
+
+ void yagl_transport_set_buffer(struct yagl_transport *t, uint8_t **pages)
+ {
+ t->pages = pages;
+ }
+
+ uint8_t *yagl_transport_begin(struct yagl_transport *t,
+ uint32_t header_size,
+ uint32_t *batch_size,
+ uint32_t *out_arrays_size,
+ uint32_t *fence_seq)
+ {
+ uint32_t num_out_da, i;
+ uint8_t *batch_data, *tmp;
+
+ *fence_seq = yagl_transport_uint32_t_at(t, 1 * 8);
+ *batch_size = yagl_transport_uint32_t_at(t, 2 * 8);
+ num_out_da = yagl_transport_uint32_t_at(t, 3 * 8);
+
+ *out_arrays_size = 0;
+
+ for (i = 0; i < num_out_da; ++i) {
+ *out_arrays_size += yagl_transport_uint32_t_at(t,
+ YAGL_TRANSPORT_BATCH_HEADER_SIZE + *batch_size + ((2 * i + 1) * 8));
+ }
+
+ batch_data = tmp = g_malloc(
+ header_size + YAGL_TRANSPORT_BATCH_HEADER_SIZE +
+ *batch_size + *out_arrays_size);
+
+ tmp += header_size + YAGL_TRANSPORT_BATCH_HEADER_SIZE + *batch_size;
+
+ for (i = 0; i < num_out_da; ++i) {
+ target_ulong va = yagl_transport_va_at(t,
+ YAGL_TRANSPORT_BATCH_HEADER_SIZE + *batch_size + ((2 * i + 0) * 8));
+ uint32_t size = yagl_transport_uint32_t_at(t,
+ YAGL_TRANSPORT_BATCH_HEADER_SIZE + *batch_size + ((2 * i + 1) * 8));
+
+ if (!yagl_mem_get(va, size, tmp)) {
+ yagl_transport_uint32_t_to(t, 0, yagl_call_result_retry);
+ g_free(batch_data);
+ return NULL;
+ }
+
+ tmp += size;
+ }
+
+ yagl_transport_copy_from(t,
+ 0,
+ batch_data + header_size,
+ YAGL_TRANSPORT_BATCH_HEADER_SIZE + *batch_size);
+
+ yagl_transport_uint32_t_to(t, 0, yagl_call_result_ok);
+
+ return batch_data;
+ }
+
+ void yagl_transport_end(struct yagl_transport *t)
+ {
+ uint32_t i;
+ struct yagl_compiled_transfer *ct, *tmp;
+
+ for (i = 0; i < t->num_in_arrays; ++i) {
+ struct yagl_transport_in_array *in_array = &t->in_arrays[i];
+
+ if ((*in_array->count > 0) && t->direct) {
+ if (!yagl_mem_put(in_array->va,
+ yagl_vector_data(&in_array->v),
+ *in_array->count * in_array->el_size)) {
+ yagl_transport_uint32_t_to(t, 0, yagl_call_result_retry);
+ return;
+ }
+ }
+ }
+
+ QLIST_FOREACH_SAFE(ct, &t->compiled_transfers, entry, tmp) {
+ yagl_compiled_transfer_prepare(ct);
+ }
+
+ t->direct = false;
+ t->num_in_arrays = 0;
+
+ yagl_transport_uint32_t_to(t, 0, yagl_call_result_ok);
+ }
+
+ void yagl_transport_reset(struct yagl_transport *t,
+ uint8_t *batch_data,
+ uint32_t batch_size,
+ uint32_t out_arrays_size)
+ {
+ t->batch_data = batch_data;
+ t->batch_size = batch_size;
+ t->out_arrays_size = out_arrays_size;
+
+ t->ptr = batch_data + YAGL_TRANSPORT_BATCH_HEADER_SIZE;
+ t->out_array_ptr = batch_data + YAGL_TRANSPORT_BATCH_HEADER_SIZE + batch_size;
+ }
+
+ bool yagl_transport_begin_call(struct yagl_transport *t,
+ yagl_api_id *api_id,
+ yagl_func_id *func_id)
+ {
+ if (t->ptr >= (t->batch_data + t->batch_size)) {
+ return false;
+ }
+
+ *api_id = yagl_transport_get_out_uint32_t(t);
+ *func_id = yagl_transport_get_out_uint32_t(t);
+ t->direct = yagl_transport_get_out_uint32_t(t);
+ t->num_in_arrays = 0;
+
+ return true;
+ }
+
+ void yagl_transport_end_call(struct yagl_transport *t)
+ {
+ uint32_t i;
+
+ for (i = 0; i < t->num_in_arrays; ++i) {
+ struct yagl_transport_in_array *in_array = &t->in_arrays[i];
+
+ if ((*in_array->count > 0) && !t->direct) {
+ yagl_transport_copy_to(t,
+ in_array->offset,
+ t->batch_data + in_array->offset,
+ *in_array->count * in_array->el_size);
+ }
+ }
+ }
+
+ void yagl_transport_get_out_array(struct yagl_transport *t,
+ int32_t el_size,
+ const void **data,
+ int32_t *count)
+ {
+ target_ulong va = (target_ulong)yagl_transport_get_out_uint32_t(t);
+ uint32_t size;
+
+ *count = yagl_transport_get_out_uint32_t(t);
+
+ if (!va) {
+ *data = NULL;
+ return;
+ }
+
+ size = (*count > 0) ? (*count * el_size) : 0;
+
+ if (t->direct) {
+ *data = t->out_array_ptr;
+ t->out_array_ptr += size;
+ } else {
+ *data = t->ptr;
+ t->ptr += (size + 7U) & ~7U;
+ }
+ }
+
+ void yagl_transport_get_in_array(struct yagl_transport *t,
+ int32_t el_size,
+ void **data,
+ int32_t *maxcount,
+ int32_t **count)
+ {
+ target_ulong va = (target_ulong)yagl_transport_get_out_uint32_t(t);
+ uint32_t size;
+ struct yagl_transport_in_array *in_array;
+ uint32_t offset;
+
+ offset = t->ptr - t->batch_data;
+
+ *count = (int32_t*)(t->pages[offset / TARGET_PAGE_SIZE] +
+ (offset & ~TARGET_PAGE_MASK));
+ *maxcount = yagl_transport_get_out_uint32_t(t);
+
+ if (!va) {
+ *data = NULL;
+ return;
+ }
+
+ size = (*maxcount > 0) ? (*maxcount * el_size) : 0;
+
+ in_array = &t->in_arrays[t->num_in_arrays];
+
+ if (t->direct) {
+ yagl_vector_resize(&in_array->v, size);
+
+ in_array->va = va;
+ in_array->el_size = el_size;
+ in_array->count = *count;
+
+ ++t->num_in_arrays;
+
+ *data = yagl_vector_data(&in_array->v);
+ } else {
+ in_array->offset = t->ptr - t->batch_data;
+ in_array->el_size = el_size;
+ in_array->count = *count;
+
+ ++t->num_in_arrays;
+
+ *data = t->ptr;
+
+ t->ptr += (size + 7U) & ~7U;
+ }
+ }
++
++const char **yagl_transport_get_out_string_array(const char *data,
++ int32_t data_count,
++ int32_t *array_count)
++{
++ struct yagl_vector v;
++ char *tmp;
++
++ YAGL_LOG_FUNC_SET(yagl_transport_get_out_string_array);
++
++ if (!data) {
++ *array_count = 0;
++ return NULL;
++ }
++
++ yagl_vector_init(&v, sizeof(char*), 0);
++
++ while (data_count > 0) {
++ tmp = memchr(data, '\0', data_count);
++
++ if (!tmp) {
++ YAGL_LOG_ERROR("0 not found in string array");
++ break;
++ }
++
++ yagl_vector_push_back(&v, &data);
++
++ data_count -= tmp - data + 1;
++
++ data = tmp + 1;
++ }
++
++ *array_count = yagl_vector_size(&v);
++
++ return (const char**)yagl_vector_detach(&v);
++}
--- /dev/null
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #ifndef _QEMU_YAGL_TRANSPORT_H
+ #define _QEMU_YAGL_TRANSPORT_H
+
+ #include "yagl_types.h"
+ #include "yagl_vector.h"
+ #include "qemu/queue.h"
+
+ #define YAGL_TRANSPORT_MAX_IN 8
+
+ struct yagl_compiled_transfer;
+
+ struct yagl_transport_in_array
+ {
+ struct yagl_vector v;
+
+ union
+ {
+ target_ulong va;
+ uint32_t offset;
+ };
+
+ int32_t el_size;
+ int32_t *count;
+ };
+
+ struct yagl_transport
+ {
+ /*
+ * per-transport.
+ * @{
+ */
+
+ uint8_t **pages;
+
+ /*
+ * @}
+ */
+
+ /*
+ * per-batch.
+ * @{
+ */
+
+ uint8_t *batch_data;
+ uint32_t batch_size;
+ uint32_t out_arrays_size;
+
+ uint8_t *ptr;
+ uint8_t *out_array_ptr;
+
+ /*
+ * @}
+ */
+
+ /*
+ * per-call.
+ * @{
+ */
+
+ bool direct;
+
+ uint32_t num_in_arrays;
+
+ struct yagl_transport_in_array in_arrays[YAGL_TRANSPORT_MAX_IN];
+
+ QLIST_HEAD(, yagl_compiled_transfer) compiled_transfers;
+
+ /*
+ * @}
+ */
+ };
+
+ struct yagl_transport *yagl_transport_create(void);
+
+ void yagl_transport_destroy(struct yagl_transport *t);
+
+ void yagl_transport_set_buffer(struct yagl_transport *t, uint8_t **pages);
+
+ uint8_t *yagl_transport_begin(struct yagl_transport *t,
+ uint32_t header_size,
+ uint32_t *batch_size,
+ uint32_t *out_arrays_size,
+ uint32_t *fence_seq);
+
+ void yagl_transport_end(struct yagl_transport *t);
+
+ void yagl_transport_reset(struct yagl_transport *t,
+ uint8_t *batch_data,
+ uint32_t batch_size,
+ uint32_t out_arrays_size);
+
+ bool yagl_transport_begin_call(struct yagl_transport *t,
+ yagl_api_id *api_id,
+ yagl_func_id *func_id);
+
+ void yagl_transport_end_call(struct yagl_transport *t);
+
+ void yagl_transport_get_out_array(struct yagl_transport *t,
+ int32_t el_size,
+ const void **data,
+ int32_t *count);
+
+ void yagl_transport_get_in_array(struct yagl_transport *t,
+ int32_t el_size,
+ void **data,
+ int32_t *maxcount,
+ int32_t **count);
+
++const char **yagl_transport_get_out_string_array(const char *data,
++ int32_t data_count,
++ int32_t *array_count);
++
+ static __inline uint8_t yagl_transport_get_out_uint8_t(struct yagl_transport *t)
+ {
+ uint8_t tmp = *t->ptr;
+ t->ptr += 8;
+ return tmp;
+ }
+
+ static __inline uint32_t yagl_transport_get_out_uint32_t(struct yagl_transport *t)
+ {
+ uint32_t tmp = *(uint32_t*)t->ptr;
+ t->ptr += 8;
+ return tmp;
+ }
+
+ static __inline float yagl_transport_get_out_float(struct yagl_transport *t)
+ {
+ float tmp = *(float*)t->ptr;
+ t->ptr += 8;
+ return tmp;
+ }
+
+ static __inline void yagl_transport_get_in_arg(struct yagl_transport *t,
+ void **value)
+ {
+ target_ulong va = (target_ulong)yagl_transport_get_out_uint32_t(t);
+
+ if (va) {
+ uint32_t offset = t->ptr - t->batch_data;
+ *value = t->pages[offset / TARGET_PAGE_SIZE] +
+ (offset & ~TARGET_PAGE_MASK);
+ t->ptr += 8;
+ } else {
+ *value = NULL;
+ }
+ }
+
+ static __inline yagl_host_handle yagl_transport_get_out_yagl_host_handle(struct yagl_transport *t)
+ {
+ return yagl_transport_get_out_uint32_t(t);
+ }
+
+ static __inline yagl_winsys_id yagl_transport_get_out_yagl_winsys_id(struct yagl_transport *t)
+ {
+ return yagl_transport_get_out_uint32_t(t);
+ }
+
+ static __inline target_ulong yagl_transport_get_out_va(struct yagl_transport *t)
+ {
+ return (target_ulong)yagl_transport_get_out_uint32_t(t);
+ }
+
+ #endif
--- /dev/null
-/*
- * EGL client APIs.
- */
+ /*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+ #ifndef _QEMU_YAGL_TYPES_H
+ #define _QEMU_YAGL_TYPES_H
+
+ #include "qemu-common.h"
+
+ typedef uint32_t yagl_pid;
+ typedef uint32_t yagl_tid;
+ typedef uint32_t yagl_func_id;
+ typedef uint32_t yagl_host_handle;
+ typedef uint32_t yagl_object_name;
+ typedef uint32_t yagl_winsys_id;
+
+ struct yagl_transport;
+
+ /*
+ * YaGL supported render types.
+ */
+ typedef enum
+ {
+ yagl_render_type_offscreen = 1,
+ yagl_render_type_onscreen = 2,
+ } yagl_render_type;
+
+ /*
+ * YaGL supported API ids.
+ */
+ typedef enum
+ {
+ yagl_api_id_egl = 1,
+ yagl_api_id_gles = 2
+ } yagl_api_id;
+
+ #define YAGL_NUM_APIS 2
+
- yagl_client_api_ogl = 0,
- yagl_client_api_gles1 = 1,
- yagl_client_api_gles2 = 2,
- yagl_client_api_ovg = 3
-} yagl_client_api;
-
-#define YAGL_NUM_CLIENT_APIS 4
+ typedef enum
+ {
++ /* OpenGL 2.1 or OpenGL >= 3.1 compatibility. */
++ yagl_gl_2 = 0,
++ /* OpenGL >= 3.1 core. */
++ yagl_gl_3_1 = 1,
++ /* OpenGL >= 3.1 core, GL_ARB_ES3_compatibility support. */
++ yagl_gl_3_1_es3 = 2,
++ /* OpenGL >= 3.2 core, no GL_ARB_ES3_compatibility support. */
++ yagl_gl_3_2 = 3
++} yagl_gl_version;
+
+ typedef void (*yagl_api_func)(struct yagl_transport */*t*/);
+
+ #endif