From: Stanislav Vorobiov Date: Mon, 7 Oct 2013 11:29:16 +0000 (+0400) Subject: YaGL: Batching improved X-Git-Tag: TizenStudio_2.0_p2.3~343^2~57 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9dfe963ec492fbe6a7d8a99bac94515de2848554;p=sdk%2Femulator%2Fqemu.git YaGL: Batching improved The improvements are: * State tracking is moved completely from host to target, this allows executing many OpenGL functions such as state queries without doing vmexits * Host code now contains mostly rendering and is made as trivial as possible so that amount of time spend inside host is minimal * True TLS is not used anymore, we fake it using yagl_thread, this is both faster and doesn't cause compilation problems on Mac * yagl_thread no longer creates a separate thread for OpenGL call processing. The processing is done inplace and OpenGL contexts are switch accordingly. This gives us an opportunity to use glFlush instead of glFinish inside eglSwapBuffers, thus, host OpenGL throughput is increased * We now have a single OpenGL driver - yagl_gles_driver instead of two. Having several separate OpenGL drivers only complicates things Change-Id: I053958e700350a4b0dd103990d59df9ff352eff5 --- diff --git a/Makefile.target b/Makefile.target index 9fba593..7243b3a 100644 --- a/Makefile.target +++ b/Makefile.target @@ -168,19 +168,13 @@ QEMU_CFLAGS += -I$(SRC_PATH)/hw/yagl_inc $(call set-vpath, $(SRC_PATH)/hw/yagl_apis/egl: \ $(SRC_PATH)/hw/yagl_apis/gles: \ - $(SRC_PATH)/hw/yagl_apis/gles1: \ - $(SRC_PATH)/hw/yagl_apis/gles2: \ $(SRC_PATH)/hw/yagl_backends/egl_offscreen: \ $(SRC_PATH)/hw/yagl_backends/egl_onscreen: \ $(SRC_PATH)/hw/yagl_drivers/egl_glx: \ $(SRC_PATH)/hw/yagl_drivers/egl_wgl: \ $(SRC_PATH)/hw/yagl_drivers/egl_agl: \ $(SRC_PATH)/hw/yagl_drivers/gles_ogl: \ - $(SRC_PATH)/hw/yagl_drivers/gles_onscreen: \ - $(SRC_PATH)/hw/yagl_drivers/gles1_ogl: \ - $(SRC_PATH)/hw/yagl_drivers/gles2_ogl: \ - $(SRC_PATH)/hw/yagl_drivers/gles1_onscreen: \ - $(SRC_PATH)/hw/yagl_drivers/gles2_onscreen) + $(SRC_PATH)/hw/yagl_drivers/gles_onscreen) obj-y += yagl_device.o obj-y += yagl_log.o @@ -196,26 +190,15 @@ obj-y += yagl_api.o obj-y += yagl_vector.o obj-y += yagl_avl.o obj-y += yagl_transport.o -obj-y += yagl_range_list.o obj-y += yagl_egl_backend.o obj-y += yagl_eglb_display.o obj-y += yagl_eglb_context.o obj-y += yagl_eglb_surface.o -obj-y += yagl_eglb_image.o obj-y += yagl_egl_driver.o obj-y += yagl_gles_driver.o -obj-y += yagl_gles1_driver.o -obj-y += yagl_gles2_driver.o -obj-y += yagl_egl_interface.o -obj-y += yagl_client_interface.o -obj-y += yagl_client_context.o -obj-y += yagl_client_image.o -obj-y += yagl_client_tex_image.o obj-y += yagl_resource.o obj-y += yagl_resource_list.o -obj-y += yagl_object.o -obj-y += yagl_namespace.o -obj-y += yagl_sharegroup.o +obj-y += yagl_object_map.o obj-y += yagl_stats.o obj-y += yagl_compiled_transfer.o obj-y += yagl_egl_native_config.o @@ -229,52 +212,26 @@ obj-y += yagl_egl_display.o obj-y += yagl_egl_config.o obj-y += yagl_egl_surface.o obj-y += yagl_egl_context.o -obj-y += yagl_egl_image.o obj-y += yagl_egl_validate.o obj-y += yagl_host_egl_calls.o -# GLES common api -obj-y += yagl_gles_context.o -obj-y += yagl_gles_array.o -obj-y += yagl_gles_buffer.o -obj-y += yagl_gles_texture.o -obj-y += yagl_gles_framebuffer.o -obj-y += yagl_gles_renderbuffer.o -obj-y += yagl_gles_image.o -obj-y += yagl_gles_tex_image.o -obj-y += yagl_gles_texture_unit.o -obj-y += yagl_gles_validate.o +# GLES api +obj-y += yagl_gles_api.o +obj-y += yagl_gles_api_ps.o +obj-y += yagl_gles_api_ts.o +obj-y += yagl_gles_calls.o obj-y += yagl_host_gles_calls.o -# GLESv1_CM api -obj-y += yagl_gles1_api.o -obj-y += yagl_gles1_api_ps.o -obj-y += yagl_gles1_api_ts.o -obj-y += yagl_gles1_calls.o -obj-y += yagl_gles1_context.o -obj-y += yagl_host_gles1_calls.o -# GLESv2 api -obj-y += yagl_gles2_api.o -obj-y += yagl_gles2_api_ps.o -obj-y += yagl_gles2_api_ts.o -obj-y += yagl_gles2_calls.o -obj-y += yagl_gles2_context.o -obj-y += yagl_gles2_shader.o -obj-y += yagl_gles2_program.o -obj-y += yagl_gles2_validate.o -obj-y += yagl_host_gles2_calls.o # EGL offscreen backend obj-y += yagl_egl_offscreen.o obj-y += yagl_egl_offscreen_ts.o obj-y += yagl_egl_offscreen_display.o obj-y += yagl_egl_offscreen_context.o obj-y += yagl_egl_offscreen_surface.o -obj-y += yagl_egl_offscreen_image.o # EGL onscreen backend obj-y += yagl_egl_onscreen.o obj-y += yagl_egl_onscreen_ts.o obj-y += yagl_egl_onscreen_display.o obj-y += yagl_egl_onscreen_context.o obj-y += yagl_egl_onscreen_surface.o -obj-y += yagl_egl_onscreen_image.o # EGL GLX driver ifdef CONFIG_LINUX obj-y += yagl_egl_glx.o @@ -288,18 +245,10 @@ ifdef CONFIG_DARWIN QEMU_CFLAGS += -Wno-comment obj-y += yagl_egl_agl.o endif -# GLES OpenGL common driver +# GLES OpenGL driver obj-y += yagl_gles_ogl.o -# GLESv1_CM OpenGL driver -obj-y += yagl_gles1_ogl.o -# GLESv2 OpenGL driver -obj-y += yagl_gles2_ogl.o -# GLES onscreen common driver +# GLES onscreen driver obj-y += yagl_gles_onscreen.o -# GLESv1_CM onscreen driver -obj-y += yagl_gles1_onscreen.o -# GLESv2 onscreen driver -obj-y += yagl_gles2_onscreen.o endif diff --git a/hw/vigs_gl_backend.c b/hw/vigs_gl_backend.c index 1a8f9b9..d4bca43 100644 --- a/hw/vigs_gl_backend.c +++ b/hw/vigs_gl_backend.c @@ -297,6 +297,14 @@ static void vigs_gl_backend_batch_start(struct vigs_backend *backend) if (!gl_backend->make_current(gl_backend, true)) { VIGS_LOG_CRITICAL("make_current failed"); } + + /* + * Wait until previous rendering is finished. If we don't do this + * then in case if vsync is off many frames will be batched together and + * then flushed once the display is finally updated. This can cause lags + * on some GPUs. + */ + gl_backend->Finish(); } /* @@ -799,7 +807,6 @@ static void vigs_gl_backend_batch_end(struct vigs_backend *backend) { struct vigs_gl_backend *gl_backend = (struct vigs_gl_backend*)backend; - gl_backend->Finish(); gl_backend->make_current(gl_backend, false); } @@ -828,35 +835,6 @@ bool vigs_gl_backend_init(struct vigs_gl_backend *gl_backend) goto fail; } - /* - * Currently we shouldn't do this. Consider this scenario: - * 1. Host OpenGL has a large GL commands buffer - * 2. Target renders a lot of frames continuously - * 3. QEMU makes a glReadPixels call 50 times per second (to update its display) - * Thus, we might have a situation where target will queue up thousands - * of frames and glReadPixels will take really long until all of these - * frames are rendered which is foolish, since we only need the last one. - * We might have really large FPS, but true performance will degrade. - * The right way to implement all of this is via vsync, which is a todo. - * TODO: Implement vsync. - * @{ - */ - - /*gl_backend->has_arb_sync = (strstr(extensions, "GL_ARB_sync ") != NULL) && - gl_backend->FenceSync && - gl_backend->DeleteSync && - gl_backend->WaitSync && - gl_backend->ClientWaitSync; - if (gl_backend->has_arb_sync) { - VIGS_LOG_INFO("ARB_sync supported"); - } else { - VIGS_LOG_WARN("ARB_sync not supported!"); - }*/ - - /* - * @} - */ - gl_backend->base.batch_start = &vigs_gl_backend_batch_start; gl_backend->base.create_surface = &vigs_gl_backend_create_surface; gl_backend->base.batch_end = &vigs_gl_backend_batch_end; diff --git a/hw/yagl_api.h b/hw/yagl_api.h index 0d1e448..0068f30 100644 --- a/hw/yagl_api.h +++ b/hw/yagl_api.h @@ -14,12 +14,14 @@ struct yagl_api_ps void (*thread_init)(struct yagl_api_ps */*api_ps*/); + void (*batch_start)(struct yagl_api_ps */*api_ps*/); + yagl_api_func (*get_func)(struct yagl_api_ps */*api_ps*/, uint32_t /*func_id*/); - void (*thread_fini)(struct yagl_api_ps */*api_ps*/); + void (*batch_end)(struct yagl_api_ps */*api_ps*/); - void (*fini)(struct yagl_api_ps */*api_ps*/); + void (*thread_fini)(struct yagl_api_ps */*api_ps*/); void (*destroy)(struct yagl_api_ps */*api_ps*/); }; diff --git a/hw/yagl_apis/egl/yagl_egl_api_ps.c b/hw/yagl_apis/egl/yagl_egl_api_ps.c index 6bbed44..9d5696d 100644 --- a/hw/yagl_apis/egl/yagl_egl_api_ps.c +++ b/hw/yagl_apis/egl/yagl_egl_api_ps.c @@ -1,7 +1,6 @@ #include "yagl_egl_api_ps.h" #include "yagl_egl_display.h" #include "yagl_egl_backend.h" -#include "yagl_egl_interface.h" #include "yagl_process.h" #include "yagl_thread.h" @@ -17,7 +16,7 @@ void yagl_egl_api_ps_init(struct yagl_egl_api_ps *egl_api_ps, QLIST_INIT(&egl_api_ps->displays); } -void yagl_egl_api_ps_fini(struct yagl_egl_api_ps *egl_api_ps) +void yagl_egl_api_ps_cleanup(struct yagl_egl_api_ps *egl_api_ps) { struct yagl_egl_display *dpy, *next; @@ -27,11 +26,6 @@ void yagl_egl_api_ps_fini(struct yagl_egl_api_ps *egl_api_ps) } assert(QLIST_EMPTY(&egl_api_ps->displays)); -} - -void yagl_egl_api_ps_cleanup(struct yagl_egl_api_ps *egl_api_ps) -{ - assert(QLIST_EMPTY(&egl_api_ps->displays)); yagl_process_unregister_egl_interface(cur_ts->ps); } diff --git a/hw/yagl_apis/egl/yagl_egl_api_ps.h b/hw/yagl_apis/egl/yagl_egl_api_ps.h index d486883..af44259 100644 --- a/hw/yagl_apis/egl/yagl_egl_api_ps.h +++ b/hw/yagl_apis/egl/yagl_egl_api_ps.h @@ -23,14 +23,6 @@ void yagl_egl_api_ps_init(struct yagl_egl_api_ps *egl_api_ps, struct yagl_egl_backend *backend, struct yagl_egl_interface *egl_iface); -/* - * This MUST be called before cleanup in order to purge all resources. - * This cannot be done in 'xxx_cleanup' since by that time all - * client interfaces will be destroyed and they're required in order to - * destroy some internal state like contexts. - */ -void yagl_egl_api_ps_fini(struct yagl_egl_api_ps *egl_api_ps); - void yagl_egl_api_ps_cleanup(struct yagl_egl_api_ps *egl_api_ps); struct yagl_egl_display *yagl_egl_api_ps_display_get(struct yagl_egl_api_ps *egl_api_ps, diff --git a/hw/yagl_apis/egl/yagl_egl_api_ts.c b/hw/yagl_apis/egl/yagl_egl_api_ts.c index 1592080..c305b6a 100644 --- a/hw/yagl_apis/egl/yagl_egl_api_ts.c +++ b/hw/yagl_apis/egl/yagl_egl_api_ts.c @@ -3,7 +3,6 @@ #include "yagl_egl_context.h" #include "yagl_eglb_context.h" #include "yagl_egl_backend.h" -#include "yagl_client_context.h" void yagl_egl_api_ts_init(struct yagl_egl_api_ts *egl_api_ts, struct yagl_egl_api_ps *api_ps) @@ -19,13 +18,6 @@ void yagl_egl_api_ts_cleanup(struct yagl_egl_api_ts *egl_api_ts) { if (egl_api_ts->context) { /* - * If we have an active context here then it was activated for sure, - * deactivate it first. - */ - - egl_api_ts->context->backend_ctx->client_ctx->deactivate(egl_api_ts->context->backend_ctx->client_ctx); - - /* * Force release current. */ egl_api_ts->backend->release_current(egl_api_ts->backend, true); @@ -48,6 +40,5 @@ void yagl_egl_api_ts_update_context(struct yagl_egl_api_ts *egl_api_ts, void yagl_egl_api_ts_reset(struct yagl_egl_api_ts *egl_api_ts) { - egl_api_ts->error = EGL_SUCCESS; egl_api_ts->api = EGL_OPENGL_ES_API; } diff --git a/hw/yagl_apis/egl/yagl_egl_api_ts.h b/hw/yagl_apis/egl/yagl_egl_api_ts.h index 3ba5bec..3746fd5 100644 --- a/hw/yagl_apis/egl/yagl_egl_api_ts.h +++ b/hw/yagl_apis/egl/yagl_egl_api_ts.h @@ -16,8 +16,6 @@ struct yagl_egl_api_ts */ struct yagl_egl_backend *backend; - EGLint error; - EGLenum api; /* diff --git a/hw/yagl_apis/egl/yagl_egl_calls.c b/hw/yagl_apis/egl/yagl_egl_calls.c index 574b5a6..93a3a29 100644 --- a/hw/yagl_apis/egl/yagl_egl_calls.c +++ b/hw/yagl_apis/egl/yagl_egl_calls.c @@ -9,73 +9,65 @@ #include "yagl_log.h" /* - * eglGetError dispatcher. id = 1 - */ -static bool yagl_func_eglGetError(struct yagl_transport *t) -{ - EGLint *retval; - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT0(eglGetError); - *retval = yagl_host_eglGetError(); - YAGL_LOG_FUNC_EXIT_SPLIT(EGLint, *retval); - - return true; -} - -/* - * eglGetDisplay dispatcher. id = 2 + * eglGetDisplay dispatcher. id = 1 */ static bool yagl_func_eglGetDisplay(struct yagl_transport *t) { uint32_t display_id; + EGLint *error; yagl_host_handle *retval; display_id = yagl_transport_get_out_uint32_t(t); + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(eglGetDisplay, uint32_t, display_id); - *retval = yagl_host_eglGetDisplay(display_id); + YAGL_LOG_FUNC_ENTER_SPLIT2(eglGetDisplay, uint32_t, void*, display_id, error); + *retval = yagl_host_eglGetDisplay(display_id, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); return true; } /* - * eglInitialize dispatcher. id = 3 + * eglInitialize dispatcher. id = 2 */ static bool yagl_func_eglInitialize(struct yagl_transport *t) { yagl_host_handle dpy; EGLint *major; EGLint *minor; + EGLint *error; EGLBoolean *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); yagl_transport_get_in_arg(t, (void**)&major); yagl_transport_get_in_arg(t, (void**)&minor); + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT3(eglInitialize, yagl_host_handle, void*, void*, dpy, major, minor); - *retval = yagl_host_eglInitialize(dpy, major, minor); + YAGL_LOG_FUNC_ENTER_SPLIT4(eglInitialize, yagl_host_handle, void*, void*, void*, dpy, major, minor, error); + *retval = yagl_host_eglInitialize(dpy, major, minor, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); return true; } /* - * eglTerminate dispatcher. id = 4 + * eglTerminate dispatcher. id = 3 */ static bool yagl_func_eglTerminate(struct yagl_transport *t) { yagl_host_handle dpy; + EGLint *error; EGLBoolean *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(eglTerminate, yagl_host_handle, dpy); - *retval = yagl_host_eglTerminate(dpy); + YAGL_LOG_FUNC_ENTER_SPLIT2(eglTerminate, yagl_host_handle, void*, dpy, error); + *retval = yagl_host_eglTerminate(dpy, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); return true; } /* - * eglGetConfigs dispatcher. id = 5 + * eglGetConfigs dispatcher. id = 4 */ static bool yagl_func_eglGetConfigs(struct yagl_transport *t) { @@ -83,22 +75,24 @@ static bool yagl_func_eglGetConfigs(struct yagl_transport *t) yagl_host_handle *configs; int32_t configs_maxcount; int32_t *configs_count; + EGLint *error; EGLBoolean *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); if (!yagl_transport_get_in_array(t, sizeof(yagl_host_handle), (void**)&configs, &configs_maxcount, &configs_count)) { return false; } + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT2(eglGetConfigs, yagl_host_handle, void*, dpy, configs); + YAGL_LOG_FUNC_ENTER_SPLIT3(eglGetConfigs, yagl_host_handle, void*, void*, dpy, configs, error); *configs_count = 0; - *retval = yagl_host_eglGetConfigs(dpy, configs, configs_maxcount, configs_count); + *retval = yagl_host_eglGetConfigs(dpy, configs, configs_maxcount, configs_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); return true; } /* - * eglChooseConfig dispatcher. id = 6 + * eglChooseConfig dispatcher. id = 5 */ static bool yagl_func_eglChooseConfig(struct yagl_transport *t) { @@ -108,6 +102,7 @@ static bool yagl_func_eglChooseConfig(struct yagl_transport *t) yagl_host_handle *configs; int32_t configs_maxcount; int32_t *configs_count; + EGLint *error; EGLBoolean *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); if (!yagl_transport_get_out_array(t, sizeof(EGLint), (const void**)&attrib_list, &attrib_list_count)) { @@ -116,17 +111,18 @@ static bool yagl_func_eglChooseConfig(struct yagl_transport *t) if (!yagl_transport_get_in_array(t, sizeof(yagl_host_handle), (void**)&configs, &configs_maxcount, &configs_count)) { return false; } + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT3(eglChooseConfig, yagl_host_handle, void*, void*, dpy, attrib_list, configs); + YAGL_LOG_FUNC_ENTER_SPLIT4(eglChooseConfig, yagl_host_handle, void*, void*, void*, dpy, attrib_list, configs, error); *configs_count = 0; - *retval = yagl_host_eglChooseConfig(dpy, attrib_list, attrib_list_count, configs, configs_maxcount, configs_count); + *retval = yagl_host_eglChooseConfig(dpy, attrib_list, attrib_list_count, configs, configs_maxcount, configs_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); return true; } /* - * eglGetConfigAttrib dispatcher. id = 7 + * eglGetConfigAttrib dispatcher. id = 6 */ static bool yagl_func_eglGetConfigAttrib(struct yagl_transport *t) { @@ -134,39 +130,43 @@ static bool yagl_func_eglGetConfigAttrib(struct yagl_transport *t) yagl_host_handle config; EGLint attribute; EGLint *value; + EGLint *error; EGLBoolean *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); config = yagl_transport_get_out_yagl_host_handle(t); attribute = yagl_transport_get_out_EGLint(t); yagl_transport_get_in_arg(t, (void**)&value); + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT4(eglGetConfigAttrib, yagl_host_handle, yagl_host_handle, EGLint, void*, dpy, config, attribute, value); - *retval = yagl_host_eglGetConfigAttrib(dpy, config, attribute, value); + YAGL_LOG_FUNC_ENTER_SPLIT5(eglGetConfigAttrib, yagl_host_handle, yagl_host_handle, EGLint, void*, void*, dpy, config, attribute, value, error); + *retval = yagl_host_eglGetConfigAttrib(dpy, config, attribute, value, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); return true; } /* - * eglDestroySurface dispatcher. id = 8 + * eglDestroySurface dispatcher. id = 7 */ static bool yagl_func_eglDestroySurface(struct yagl_transport *t) { yagl_host_handle dpy; yagl_host_handle surface; + EGLint *error; EGLBoolean *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); surface = yagl_transport_get_out_yagl_host_handle(t); + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT2(eglDestroySurface, yagl_host_handle, yagl_host_handle, dpy, surface); - *retval = yagl_host_eglDestroySurface(dpy, surface); + YAGL_LOG_FUNC_ENTER_SPLIT3(eglDestroySurface, yagl_host_handle, yagl_host_handle, void*, dpy, surface, error); + *retval = yagl_host_eglDestroySurface(dpy, surface, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); return true; } /* - * eglQuerySurface dispatcher. id = 9 + * eglQuerySurface dispatcher. id = 8 */ static bool yagl_func_eglQuerySurface(struct yagl_transport *t) { @@ -174,65 +174,65 @@ static bool yagl_func_eglQuerySurface(struct yagl_transport *t) yagl_host_handle surface; EGLint attribute; EGLint *value; + EGLint *error; EGLBoolean *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); surface = yagl_transport_get_out_yagl_host_handle(t); attribute = yagl_transport_get_out_EGLint(t); yagl_transport_get_in_arg(t, (void**)&value); + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT4(eglQuerySurface, yagl_host_handle, yagl_host_handle, EGLint, void*, dpy, surface, attribute, value); - *retval = yagl_host_eglQuerySurface(dpy, surface, attribute, value); + YAGL_LOG_FUNC_ENTER_SPLIT5(eglQuerySurface, yagl_host_handle, yagl_host_handle, EGLint, void*, void*, dpy, surface, attribute, value, error); + *retval = yagl_host_eglQuerySurface(dpy, surface, attribute, value, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); return true; } /* - * eglBindAPI dispatcher. id = 10 + * eglBindAPI dispatcher. id = 9 */ static bool yagl_func_eglBindAPI(struct yagl_transport *t) { EGLenum api; - EGLBoolean *retval; api = yagl_transport_get_out_EGLenum(t); - yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT1(eglBindAPI, EGLenum, api); - *retval = yagl_host_eglBindAPI(api); - YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); + (void)yagl_host_eglBindAPI(api); + YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * eglWaitClient dispatcher. id = 11 + * eglWaitClient dispatcher. id = 10 */ static bool yagl_func_eglWaitClient(struct yagl_transport *t) { - EGLBoolean *retval; - yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT0(eglWaitClient); - *retval = yagl_host_eglWaitClient(); - YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); + (void)yagl_host_eglWaitClient(); + YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * eglReleaseThread dispatcher. id = 12 + * eglReleaseThread dispatcher. id = 11 */ static bool yagl_func_eglReleaseThread(struct yagl_transport *t) { + EGLint *error; EGLBoolean *retval; + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT0(eglReleaseThread); - *retval = yagl_host_eglReleaseThread(); + YAGL_LOG_FUNC_ENTER_SPLIT1(eglReleaseThread, void*, error); + *retval = yagl_host_eglReleaseThread(error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); return true; } /* - * eglSurfaceAttrib dispatcher. id = 13 + * eglSurfaceAttrib dispatcher. id = 12 */ static bool yagl_func_eglSurfaceAttrib(struct yagl_transport *t) { @@ -240,61 +240,23 @@ static bool yagl_func_eglSurfaceAttrib(struct yagl_transport *t) yagl_host_handle surface; EGLint attribute; EGLint value; + EGLint *error; EGLBoolean *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); surface = yagl_transport_get_out_yagl_host_handle(t); attribute = yagl_transport_get_out_EGLint(t); value = yagl_transport_get_out_EGLint(t); + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT4(eglSurfaceAttrib, yagl_host_handle, yagl_host_handle, EGLint, EGLint, dpy, surface, attribute, value); - *retval = yagl_host_eglSurfaceAttrib(dpy, surface, attribute, value); + YAGL_LOG_FUNC_ENTER_SPLIT5(eglSurfaceAttrib, yagl_host_handle, yagl_host_handle, EGLint, EGLint, void*, dpy, surface, attribute, value, error); + *retval = yagl_host_eglSurfaceAttrib(dpy, surface, attribute, value, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); return true; } /* - * eglBindTexImage dispatcher. id = 14 - */ -static bool yagl_func_eglBindTexImage(struct yagl_transport *t) -{ - yagl_host_handle dpy; - yagl_host_handle surface; - EGLint buffer; - EGLBoolean *retval; - dpy = yagl_transport_get_out_yagl_host_handle(t); - surface = yagl_transport_get_out_yagl_host_handle(t); - buffer = yagl_transport_get_out_EGLint(t); - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT3(eglBindTexImage, yagl_host_handle, yagl_host_handle, EGLint, dpy, surface, buffer); - *retval = yagl_host_eglBindTexImage(dpy, surface, buffer); - YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); - - return true; -} - -/* - * eglReleaseTexImage dispatcher. id = 15 - */ -static bool yagl_func_eglReleaseTexImage(struct yagl_transport *t) -{ - yagl_host_handle dpy; - yagl_host_handle surface; - EGLint buffer; - EGLBoolean *retval; - dpy = yagl_transport_get_out_yagl_host_handle(t); - surface = yagl_transport_get_out_yagl_host_handle(t); - buffer = yagl_transport_get_out_EGLint(t); - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT3(eglReleaseTexImage, yagl_host_handle, yagl_host_handle, EGLint, dpy, surface, buffer); - *retval = yagl_host_eglReleaseTexImage(dpy, surface, buffer); - YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); - - return true; -} - -/* - * eglCreateContext dispatcher. id = 16 + * eglCreateContext dispatcher. id = 13 */ static bool yagl_func_eglCreateContext(struct yagl_transport *t) { @@ -303,6 +265,7 @@ static bool yagl_func_eglCreateContext(struct yagl_transport *t) yagl_host_handle share_context; const EGLint *attrib_list; int32_t attrib_list_count; + EGLint *error; yagl_host_handle *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); config = yagl_transport_get_out_yagl_host_handle(t); @@ -310,34 +273,37 @@ static bool yagl_func_eglCreateContext(struct yagl_transport *t) if (!yagl_transport_get_out_array(t, sizeof(EGLint), (const void**)&attrib_list, &attrib_list_count)) { return false; } + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT4(eglCreateContext, yagl_host_handle, yagl_host_handle, yagl_host_handle, void*, dpy, config, share_context, attrib_list); - *retval = yagl_host_eglCreateContext(dpy, config, share_context, attrib_list, attrib_list_count); + YAGL_LOG_FUNC_ENTER_SPLIT5(eglCreateContext, yagl_host_handle, yagl_host_handle, yagl_host_handle, void*, void*, dpy, config, share_context, attrib_list, error); + *retval = yagl_host_eglCreateContext(dpy, config, share_context, attrib_list, attrib_list_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); return true; } /* - * eglDestroyContext dispatcher. id = 17 + * eglDestroyContext dispatcher. id = 14 */ static bool yagl_func_eglDestroyContext(struct yagl_transport *t) { yagl_host_handle dpy; yagl_host_handle ctx; + EGLint *error; EGLBoolean *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); ctx = yagl_transport_get_out_yagl_host_handle(t); + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT2(eglDestroyContext, yagl_host_handle, yagl_host_handle, dpy, ctx); - *retval = yagl_host_eglDestroyContext(dpy, ctx); + YAGL_LOG_FUNC_ENTER_SPLIT3(eglDestroyContext, yagl_host_handle, yagl_host_handle, void*, dpy, ctx, error); + *retval = yagl_host_eglDestroyContext(dpy, ctx, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); return true; } /* - * eglMakeCurrent dispatcher. id = 18 + * eglMakeCurrent dispatcher. id = 15 */ static bool yagl_func_eglMakeCurrent(struct yagl_transport *t) { @@ -345,21 +311,19 @@ static bool yagl_func_eglMakeCurrent(struct yagl_transport *t) yagl_host_handle draw; yagl_host_handle read; yagl_host_handle ctx; - EGLBoolean *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); draw = yagl_transport_get_out_yagl_host_handle(t); read = yagl_transport_get_out_yagl_host_handle(t); ctx = yagl_transport_get_out_yagl_host_handle(t); - yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT4(eglMakeCurrent, yagl_host_handle, yagl_host_handle, yagl_host_handle, yagl_host_handle, dpy, draw, read, ctx); - *retval = yagl_host_eglMakeCurrent(dpy, draw, read, ctx); - YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); + (void)yagl_host_eglMakeCurrent(dpy, draw, read, ctx); + YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * eglQueryContext dispatcher. id = 19 + * eglQueryContext dispatcher. id = 16 */ static bool yagl_func_eglQueryContext(struct yagl_transport *t) { @@ -367,102 +331,63 @@ static bool yagl_func_eglQueryContext(struct yagl_transport *t) yagl_host_handle ctx; EGLint attribute; EGLint *value; + EGLint *error; EGLBoolean *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); ctx = yagl_transport_get_out_yagl_host_handle(t); attribute = yagl_transport_get_out_EGLint(t); yagl_transport_get_in_arg(t, (void**)&value); + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT4(eglQueryContext, yagl_host_handle, yagl_host_handle, EGLint, void*, dpy, ctx, attribute, value); - *retval = yagl_host_eglQueryContext(dpy, ctx, attribute, value); + YAGL_LOG_FUNC_ENTER_SPLIT5(eglQueryContext, yagl_host_handle, yagl_host_handle, EGLint, void*, void*, dpy, ctx, attribute, value, error); + *retval = yagl_host_eglQueryContext(dpy, ctx, attribute, value, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); return true; } /* - * eglSwapBuffers dispatcher. id = 20 + * eglSwapBuffers dispatcher. id = 17 */ static bool yagl_func_eglSwapBuffers(struct yagl_transport *t) { yagl_host_handle dpy; yagl_host_handle surface; + EGLint *error; EGLBoolean *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); surface = yagl_transport_get_out_yagl_host_handle(t); + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT2(eglSwapBuffers, yagl_host_handle, yagl_host_handle, dpy, surface); - *retval = yagl_host_eglSwapBuffers(dpy, surface); + YAGL_LOG_FUNC_ENTER_SPLIT3(eglSwapBuffers, yagl_host_handle, yagl_host_handle, void*, dpy, surface, error); + *retval = yagl_host_eglSwapBuffers(dpy, surface, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); return true; } /* - * eglCopyBuffers dispatcher. id = 21 + * eglCopyBuffers dispatcher. id = 18 */ static bool yagl_func_eglCopyBuffers(struct yagl_transport *t) { yagl_host_handle dpy; yagl_host_handle surface; + EGLint *error; EGLBoolean *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); surface = yagl_transport_get_out_yagl_host_handle(t); + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT2(eglCopyBuffers, yagl_host_handle, yagl_host_handle, dpy, surface); - *retval = yagl_host_eglCopyBuffers(dpy, surface); + YAGL_LOG_FUNC_ENTER_SPLIT3(eglCopyBuffers, yagl_host_handle, yagl_host_handle, void*, dpy, surface, error); + *retval = yagl_host_eglCopyBuffers(dpy, surface, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); return true; } /* - * eglCreateImageKHR dispatcher. id = 22 - */ -static bool yagl_func_eglCreateImageKHR(struct yagl_transport *t) -{ - yagl_host_handle dpy; - yagl_host_handle ctx; - EGLenum target; - yagl_winsys_id buffer; - const EGLint *attrib_list; - int32_t attrib_list_count; - yagl_host_handle *retval; - dpy = yagl_transport_get_out_yagl_host_handle(t); - ctx = yagl_transport_get_out_yagl_host_handle(t); - target = yagl_transport_get_out_EGLenum(t); - buffer = yagl_transport_get_out_yagl_winsys_id(t); - if (!yagl_transport_get_out_array(t, sizeof(EGLint), (const void**)&attrib_list, &attrib_list_count)) { - return false; - } - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT5(eglCreateImageKHR, yagl_host_handle, yagl_host_handle, EGLenum, yagl_winsys_id, void*, dpy, ctx, target, buffer, attrib_list); - *retval = yagl_host_eglCreateImageKHR(dpy, ctx, target, buffer, attrib_list, attrib_list_count); - YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); - - return true; -} - -/* - * eglDestroyImageKHR dispatcher. id = 23 - */ -static bool yagl_func_eglDestroyImageKHR(struct yagl_transport *t) -{ - yagl_host_handle dpy; - yagl_host_handle image; - EGLBoolean *retval; - dpy = yagl_transport_get_out_yagl_host_handle(t); - image = yagl_transport_get_out_yagl_host_handle(t); - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT2(eglDestroyImageKHR, yagl_host_handle, yagl_host_handle, dpy, image); - *retval = yagl_host_eglDestroyImageKHR(dpy, image); - YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); - - return true; -} - -/* - * eglCreateWindowSurfaceOffscreenYAGL dispatcher. id = 24 + * eglCreateWindowSurfaceOffscreenYAGL dispatcher. id = 19 */ static bool yagl_func_eglCreateWindowSurfaceOffscreenYAGL(struct yagl_transport *t) { @@ -474,6 +399,7 @@ static bool yagl_func_eglCreateWindowSurfaceOffscreenYAGL(struct yagl_transport target_ulong pixels; const EGLint *attrib_list; int32_t attrib_list_count; + EGLint *error; yagl_host_handle *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); config = yagl_transport_get_out_yagl_host_handle(t); @@ -484,16 +410,17 @@ static bool yagl_func_eglCreateWindowSurfaceOffscreenYAGL(struct yagl_transport if (!yagl_transport_get_out_array(t, sizeof(EGLint), (const void**)&attrib_list, &attrib_list_count)) { return false; } + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT7(eglCreateWindowSurfaceOffscreenYAGL, yagl_host_handle, yagl_host_handle, uint32_t, uint32_t, uint32_t, target_ulong, void*, dpy, config, width, height, bpp, pixels, attrib_list); - *retval = yagl_host_eglCreateWindowSurfaceOffscreenYAGL(dpy, config, width, height, bpp, pixels, attrib_list, attrib_list_count); + YAGL_LOG_FUNC_ENTER_SPLIT8(eglCreateWindowSurfaceOffscreenYAGL, yagl_host_handle, yagl_host_handle, uint32_t, uint32_t, uint32_t, target_ulong, void*, void*, dpy, config, width, height, bpp, pixels, attrib_list, error); + *retval = yagl_host_eglCreateWindowSurfaceOffscreenYAGL(dpy, config, width, height, bpp, pixels, attrib_list, attrib_list_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); return true; } /* - * eglCreatePbufferSurfaceOffscreenYAGL dispatcher. id = 25 + * eglCreatePbufferSurfaceOffscreenYAGL dispatcher. id = 20 */ static bool yagl_func_eglCreatePbufferSurfaceOffscreenYAGL(struct yagl_transport *t) { @@ -505,6 +432,7 @@ static bool yagl_func_eglCreatePbufferSurfaceOffscreenYAGL(struct yagl_transport target_ulong pixels; const EGLint *attrib_list; int32_t attrib_list_count; + EGLint *error; yagl_host_handle *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); config = yagl_transport_get_out_yagl_host_handle(t); @@ -515,16 +443,17 @@ static bool yagl_func_eglCreatePbufferSurfaceOffscreenYAGL(struct yagl_transport if (!yagl_transport_get_out_array(t, sizeof(EGLint), (const void**)&attrib_list, &attrib_list_count)) { return false; } + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT7(eglCreatePbufferSurfaceOffscreenYAGL, yagl_host_handle, yagl_host_handle, uint32_t, uint32_t, uint32_t, target_ulong, void*, dpy, config, width, height, bpp, pixels, attrib_list); - *retval = yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(dpy, config, width, height, bpp, pixels, attrib_list, attrib_list_count); + YAGL_LOG_FUNC_ENTER_SPLIT8(eglCreatePbufferSurfaceOffscreenYAGL, yagl_host_handle, yagl_host_handle, uint32_t, uint32_t, uint32_t, target_ulong, void*, void*, dpy, config, width, height, bpp, pixels, attrib_list, error); + *retval = yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(dpy, config, width, height, bpp, pixels, attrib_list, attrib_list_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); return true; } /* - * eglCreatePixmapSurfaceOffscreenYAGL dispatcher. id = 26 + * eglCreatePixmapSurfaceOffscreenYAGL dispatcher. id = 21 */ static bool yagl_func_eglCreatePixmapSurfaceOffscreenYAGL(struct yagl_transport *t) { @@ -536,6 +465,7 @@ static bool yagl_func_eglCreatePixmapSurfaceOffscreenYAGL(struct yagl_transport target_ulong pixels; const EGLint *attrib_list; int32_t attrib_list_count; + EGLint *error; yagl_host_handle *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); config = yagl_transport_get_out_yagl_host_handle(t); @@ -546,16 +476,17 @@ static bool yagl_func_eglCreatePixmapSurfaceOffscreenYAGL(struct yagl_transport if (!yagl_transport_get_out_array(t, sizeof(EGLint), (const void**)&attrib_list, &attrib_list_count)) { return false; } + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT7(eglCreatePixmapSurfaceOffscreenYAGL, yagl_host_handle, yagl_host_handle, uint32_t, uint32_t, uint32_t, target_ulong, void*, dpy, config, width, height, bpp, pixels, attrib_list); - *retval = yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(dpy, config, width, height, bpp, pixels, attrib_list, attrib_list_count); + YAGL_LOG_FUNC_ENTER_SPLIT8(eglCreatePixmapSurfaceOffscreenYAGL, yagl_host_handle, yagl_host_handle, uint32_t, uint32_t, uint32_t, target_ulong, void*, void*, dpy, config, width, height, bpp, pixels, attrib_list, error); + *retval = yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(dpy, config, width, height, bpp, pixels, attrib_list, attrib_list_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); return true; } /* - * eglResizeOffscreenSurfaceYAGL dispatcher. id = 27 + * eglResizeOffscreenSurfaceYAGL dispatcher. id = 22 */ static bool yagl_func_eglResizeOffscreenSurfaceYAGL(struct yagl_transport *t) { @@ -565,6 +496,7 @@ static bool yagl_func_eglResizeOffscreenSurfaceYAGL(struct yagl_transport *t) uint32_t height; uint32_t bpp; target_ulong pixels; + EGLint *error; EGLBoolean *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); surface = yagl_transport_get_out_yagl_host_handle(t); @@ -572,43 +504,17 @@ static bool yagl_func_eglResizeOffscreenSurfaceYAGL(struct yagl_transport *t) height = yagl_transport_get_out_uint32_t(t); bpp = yagl_transport_get_out_uint32_t(t); pixels = yagl_transport_get_out_va(t); + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT6(eglResizeOffscreenSurfaceYAGL, yagl_host_handle, yagl_host_handle, uint32_t, uint32_t, uint32_t, target_ulong, dpy, surface, width, height, bpp, pixels); - *retval = yagl_host_eglResizeOffscreenSurfaceYAGL(dpy, surface, width, height, bpp, pixels); + YAGL_LOG_FUNC_ENTER_SPLIT7(eglResizeOffscreenSurfaceYAGL, yagl_host_handle, yagl_host_handle, uint32_t, uint32_t, uint32_t, target_ulong, void*, dpy, surface, width, height, bpp, pixels, error); + *retval = yagl_host_eglResizeOffscreenSurfaceYAGL(dpy, surface, width, height, bpp, pixels, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); return true; } /* - * eglUpdateOffscreenImageYAGL dispatcher. id = 28 - */ -static bool yagl_func_eglUpdateOffscreenImageYAGL(struct yagl_transport *t) -{ - yagl_host_handle dpy; - yagl_host_handle image; - uint32_t width; - uint32_t height; - uint32_t bpp; - const void *pixels; - int32_t pixels_count; - dpy = yagl_transport_get_out_yagl_host_handle(t); - image = yagl_transport_get_out_yagl_host_handle(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); - if (!yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT6(eglUpdateOffscreenImageYAGL, yagl_host_handle, yagl_host_handle, uint32_t, uint32_t, uint32_t, void*, dpy, image, width, height, bpp, pixels); - (void)yagl_host_eglUpdateOffscreenImageYAGL(dpy, image, width, height, bpp, pixels, pixels_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * eglCreateWindowSurfaceOnscreenYAGL dispatcher. id = 29 + * eglCreateWindowSurfaceOnscreenYAGL dispatcher. id = 23 */ static bool yagl_func_eglCreateWindowSurfaceOnscreenYAGL(struct yagl_transport *t) { @@ -617,6 +523,7 @@ static bool yagl_func_eglCreateWindowSurfaceOnscreenYAGL(struct yagl_transport * yagl_winsys_id win; const EGLint *attrib_list; int32_t attrib_list_count; + EGLint *error; yagl_host_handle *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); config = yagl_transport_get_out_yagl_host_handle(t); @@ -624,16 +531,17 @@ static bool yagl_func_eglCreateWindowSurfaceOnscreenYAGL(struct yagl_transport * if (!yagl_transport_get_out_array(t, sizeof(EGLint), (const void**)&attrib_list, &attrib_list_count)) { return false; } + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT4(eglCreateWindowSurfaceOnscreenYAGL, yagl_host_handle, yagl_host_handle, yagl_winsys_id, void*, dpy, config, win, attrib_list); - *retval = yagl_host_eglCreateWindowSurfaceOnscreenYAGL(dpy, config, win, attrib_list, attrib_list_count); + YAGL_LOG_FUNC_ENTER_SPLIT5(eglCreateWindowSurfaceOnscreenYAGL, yagl_host_handle, yagl_host_handle, yagl_winsys_id, void*, void*, dpy, config, win, attrib_list, error); + *retval = yagl_host_eglCreateWindowSurfaceOnscreenYAGL(dpy, config, win, attrib_list, attrib_list_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); return true; } /* - * eglCreatePbufferSurfaceOnscreenYAGL dispatcher. id = 30 + * eglCreatePbufferSurfaceOnscreenYAGL dispatcher. id = 24 */ static bool yagl_func_eglCreatePbufferSurfaceOnscreenYAGL(struct yagl_transport *t) { @@ -642,6 +550,7 @@ static bool yagl_func_eglCreatePbufferSurfaceOnscreenYAGL(struct yagl_transport yagl_winsys_id buffer; const EGLint *attrib_list; int32_t attrib_list_count; + EGLint *error; yagl_host_handle *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); config = yagl_transport_get_out_yagl_host_handle(t); @@ -649,16 +558,17 @@ static bool yagl_func_eglCreatePbufferSurfaceOnscreenYAGL(struct yagl_transport if (!yagl_transport_get_out_array(t, sizeof(EGLint), (const void**)&attrib_list, &attrib_list_count)) { return false; } + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT4(eglCreatePbufferSurfaceOnscreenYAGL, yagl_host_handle, yagl_host_handle, yagl_winsys_id, void*, dpy, config, buffer, attrib_list); - *retval = yagl_host_eglCreatePbufferSurfaceOnscreenYAGL(dpy, config, buffer, attrib_list, attrib_list_count); + YAGL_LOG_FUNC_ENTER_SPLIT5(eglCreatePbufferSurfaceOnscreenYAGL, yagl_host_handle, yagl_host_handle, yagl_winsys_id, void*, void*, dpy, config, buffer, attrib_list, error); + *retval = yagl_host_eglCreatePbufferSurfaceOnscreenYAGL(dpy, config, buffer, attrib_list, attrib_list_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); return true; } /* - * eglCreatePixmapSurfaceOnscreenYAGL dispatcher. id = 31 + * eglCreatePixmapSurfaceOnscreenYAGL dispatcher. id = 25 */ static bool yagl_func_eglCreatePixmapSurfaceOnscreenYAGL(struct yagl_transport *t) { @@ -667,6 +577,7 @@ static bool yagl_func_eglCreatePixmapSurfaceOnscreenYAGL(struct yagl_transport * yagl_winsys_id pixmap; const EGLint *attrib_list; int32_t attrib_list_count; + EGLint *error; yagl_host_handle *retval; dpy = yagl_transport_get_out_yagl_host_handle(t); config = yagl_transport_get_out_yagl_host_handle(t); @@ -674,16 +585,17 @@ static bool yagl_func_eglCreatePixmapSurfaceOnscreenYAGL(struct yagl_transport * if (!yagl_transport_get_out_array(t, sizeof(EGLint), (const void**)&attrib_list, &attrib_list_count)) { return false; } + yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT4(eglCreatePixmapSurfaceOnscreenYAGL, yagl_host_handle, yagl_host_handle, yagl_winsys_id, void*, dpy, config, pixmap, attrib_list); - *retval = yagl_host_eglCreatePixmapSurfaceOnscreenYAGL(dpy, config, pixmap, attrib_list, attrib_list_count); + YAGL_LOG_FUNC_ENTER_SPLIT5(eglCreatePixmapSurfaceOnscreenYAGL, yagl_host_handle, yagl_host_handle, yagl_winsys_id, void*, void*, dpy, config, pixmap, attrib_list, error); + *retval = yagl_host_eglCreatePixmapSurfaceOnscreenYAGL(dpy, config, pixmap, attrib_list, attrib_list_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); return true; } /* - * eglInvalidateOnscreenSurfaceYAGL dispatcher. id = 32 + * eglInvalidateOnscreenSurfaceYAGL dispatcher. id = 26 */ static bool yagl_func_eglInvalidateOnscreenSurfaceYAGL(struct yagl_transport *t) { @@ -700,10 +612,31 @@ static bool yagl_func_eglInvalidateOnscreenSurfaceYAGL(struct yagl_transport *t) return true; } -const uint32_t yagl_egl_api_num_funcs = 32; +/* + * eglCreateImageYAGL dispatcher. id = 27 + */ +static bool yagl_func_eglCreateImageYAGL(struct yagl_transport *t) +{ + uint32_t texture; + yagl_host_handle dpy; + yagl_winsys_id buffer; + EGLint *error; + EGLBoolean *retval; + texture = yagl_transport_get_out_uint32_t(t); + dpy = yagl_transport_get_out_yagl_host_handle(t); + buffer = yagl_transport_get_out_yagl_winsys_id(t); + yagl_transport_get_in_arg(t, (void**)&error); + yagl_transport_get_in_arg(t, (void**)&retval); + YAGL_LOG_FUNC_ENTER_SPLIT4(eglCreateImageYAGL, uint32_t, yagl_host_handle, yagl_winsys_id, void*, texture, dpy, buffer, error); + *retval = yagl_host_eglCreateImageYAGL(texture, dpy, buffer, error); + YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); + + return true; +} + +const uint32_t yagl_egl_api_num_funcs = 27; yagl_api_func yagl_egl_api_funcs[] = { - &yagl_func_eglGetError, &yagl_func_eglGetDisplay, &yagl_func_eglInitialize, &yagl_func_eglTerminate, @@ -716,23 +649,19 @@ yagl_api_func yagl_egl_api_funcs[] = { &yagl_func_eglWaitClient, &yagl_func_eglReleaseThread, &yagl_func_eglSurfaceAttrib, - &yagl_func_eglBindTexImage, - &yagl_func_eglReleaseTexImage, &yagl_func_eglCreateContext, &yagl_func_eglDestroyContext, &yagl_func_eglMakeCurrent, &yagl_func_eglQueryContext, &yagl_func_eglSwapBuffers, &yagl_func_eglCopyBuffers, - &yagl_func_eglCreateImageKHR, - &yagl_func_eglDestroyImageKHR, &yagl_func_eglCreateWindowSurfaceOffscreenYAGL, &yagl_func_eglCreatePbufferSurfaceOffscreenYAGL, &yagl_func_eglCreatePixmapSurfaceOffscreenYAGL, &yagl_func_eglResizeOffscreenSurfaceYAGL, - &yagl_func_eglUpdateOffscreenImageYAGL, &yagl_func_eglCreateWindowSurfaceOnscreenYAGL, &yagl_func_eglCreatePbufferSurfaceOnscreenYAGL, &yagl_func_eglCreatePixmapSurfaceOnscreenYAGL, &yagl_func_eglInvalidateOnscreenSurfaceYAGL, + &yagl_func_eglCreateImageYAGL, }; diff --git a/hw/yagl_apis/egl/yagl_egl_config.c b/hw/yagl_apis/egl/yagl_egl_config.c index 70fd711..93bbb62 100644 --- a/hw/yagl_apis/egl/yagl_egl_config.c +++ b/hw/yagl_apis/egl/yagl_egl_config.c @@ -7,30 +7,6 @@ #include "yagl_thread.h" #include -static EGLint yagl_egl_config_get_renderable_type(void) -{ - struct yagl_process_state *ps = cur_ts->ps; - EGLint renderable_type = 0; - - if (ps->client_ifaces[yagl_client_api_ogl]) { - renderable_type |= EGL_OPENGL_BIT; - } - - if (ps->client_ifaces[yagl_client_api_gles1]) { - renderable_type |= EGL_OPENGL_ES_BIT; - } - - if (ps->client_ifaces[yagl_client_api_gles2]) { - renderable_type |= EGL_OPENGL_ES2_BIT; - } - - if (ps->client_ifaces[yagl_client_api_ovg]) { - renderable_type |= EGL_OPENVG_BIT; - } - - return renderable_type; -} - static void yagl_egl_config_destroy(struct yagl_ref *ref) { struct yagl_egl_config *cfg = (struct yagl_egl_config*)ref; @@ -154,9 +130,7 @@ static struct yagl_egl_config EGL_OPTIMAL_FORMAT_BIT_KHR; cfg->native.native_renderable = EGL_TRUE; - - cfg->native.renderable_type = - yagl_egl_config_get_renderable_type(); + cfg->native.renderable_type = EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT; cfg->native.conformant = (((cfg->native.red_size + cfg->native.green_size + cfg->native.blue_size + cfg->native.alpha_size) > 0) && diff --git a/hw/yagl_apis/egl/yagl_egl_context.c b/hw/yagl_apis/egl/yagl_egl_context.c index a96c08b..068c6a8 100644 --- a/hw/yagl_apis/egl/yagl_egl_context.c +++ b/hw/yagl_apis/egl/yagl_egl_context.c @@ -4,13 +4,10 @@ #include "yagl_egl_config.h" #include "yagl_eglb_context.h" #include "yagl_eglb_display.h" -#include "yagl_sharegroup.h" -#include "yagl_client_context.h" static void yagl_egl_context_destroy(struct yagl_ref *ref) { struct yagl_egl_context *ctx = (struct yagl_egl_context*)ref; - struct yagl_client_context *client_ctx = ctx->backend_ctx->client_ctx; assert(!ctx->draw); assert(!ctx->read); @@ -22,14 +19,11 @@ static void yagl_egl_context_destroy(struct yagl_ref *ref) yagl_resource_cleanup(&ctx->res); g_free(ctx); - - client_ctx->destroy(client_ctx); } struct yagl_egl_context *yagl_egl_context_create(struct yagl_egl_display *dpy, struct yagl_egl_config *cfg, - struct yagl_client_context *client_ctx, struct yagl_eglb_context *backend_share_ctx) { struct yagl_eglb_context *backend_ctx; @@ -37,7 +31,6 @@ struct yagl_egl_context backend_ctx = dpy->backend_dpy->create_context(dpy->backend_dpy, &cfg->native, - client_ctx, backend_share_ctx); if (!backend_ctx) { diff --git a/hw/yagl_apis/egl/yagl_egl_context.h b/hw/yagl_apis/egl/yagl_egl_context.h index 3600981..7f3ce56 100644 --- a/hw/yagl_apis/egl/yagl_egl_context.h +++ b/hw/yagl_apis/egl/yagl_egl_context.h @@ -7,7 +7,6 @@ struct yagl_egl_display; struct yagl_egl_config; struct yagl_egl_surface; -struct yagl_client_context; struct yagl_eglb_context; struct yagl_egl_context @@ -31,7 +30,6 @@ struct yagl_egl_context struct yagl_egl_context *yagl_egl_context_create(struct yagl_egl_display *dpy, struct yagl_egl_config *cfg, - struct yagl_client_context *client_ctx, struct yagl_eglb_context *backend_share_ctx); void yagl_egl_context_update_surfaces(struct yagl_egl_context *ctx, diff --git a/hw/yagl_apis/egl/yagl_egl_display.c b/hw/yagl_apis/egl/yagl_egl_display.c index 504a072..fe0fae7 100644 --- a/hw/yagl_apis/egl/yagl_egl_display.c +++ b/hw/yagl_apis/egl/yagl_egl_display.c @@ -4,7 +4,6 @@ #include "yagl_egl_config.h" #include "yagl_egl_surface.h" #include "yagl_egl_context.h" -#include "yagl_egl_image.h" #include "yagl_process.h" #include "yagl_thread.h" #include "yagl_log.h" @@ -35,7 +34,6 @@ struct yagl_egl_display yagl_resource_list_init(&dpy->configs); yagl_resource_list_init(&dpy->contexts); yagl_resource_list_init(&dpy->surfaces); - yagl_resource_list_init(&dpy->images); return dpy; } @@ -44,7 +42,6 @@ void yagl_egl_display_destroy(struct yagl_egl_display *dpy) { yagl_egl_display_terminate(dpy); - yagl_resource_list_cleanup(&dpy->images); yagl_resource_list_cleanup(&dpy->surfaces); yagl_resource_list_cleanup(&dpy->contexts); yagl_resource_list_cleanup(&dpy->configs); @@ -107,7 +104,6 @@ void yagl_egl_display_terminate(struct yagl_egl_display *dpy) yagl_resource_list_init(&tmp_list); - yagl_resource_list_move(&dpy->images, &tmp_list); yagl_resource_list_move(&dpy->surfaces, &tmp_list); yagl_resource_list_move(&dpy->contexts, &tmp_list); yagl_resource_list_move(&dpy->configs, &tmp_list); @@ -224,22 +220,3 @@ bool yagl_egl_display_remove_surface(struct yagl_egl_display *dpy, { return yagl_resource_list_remove(&dpy->surfaces, handle); } - -void yagl_egl_display_add_image(struct yagl_egl_display *dpy, - struct yagl_egl_image *image) -{ - yagl_resource_list_add(&dpy->images, &image->res); -} - -struct yagl_egl_image - *yagl_egl_display_acquire_image(struct yagl_egl_display *dpy, - yagl_host_handle handle) -{ - return (struct yagl_egl_image*)yagl_resource_list_acquire(&dpy->images, handle); -} - -bool yagl_egl_display_remove_image(struct yagl_egl_display *dpy, - yagl_host_handle handle) -{ - return yagl_resource_list_remove(&dpy->images, handle); -} diff --git a/hw/yagl_apis/egl/yagl_egl_display.h b/hw/yagl_apis/egl/yagl_egl_display.h index 8c0085e..f88d849 100644 --- a/hw/yagl_apis/egl/yagl_egl_display.h +++ b/hw/yagl_apis/egl/yagl_egl_display.h @@ -11,7 +11,6 @@ struct yagl_egl_config; struct yagl_egl_native_config; struct yagl_egl_surface; struct yagl_egl_context; -struct yagl_egl_image; struct yagl_eglb_display; struct yagl_egl_display @@ -33,8 +32,6 @@ struct yagl_egl_display struct yagl_resource_list contexts; struct yagl_resource_list surfaces; - - struct yagl_resource_list images; }; struct yagl_egl_display @@ -139,28 +136,4 @@ bool yagl_egl_display_remove_surface(struct yagl_egl_display *dpy, * @} */ -/* - * Images. - * @{ - */ - -/* - * This acquires 'image', so the caller should - * release 'image' if he doesn't want to use it and wants it to belong to the - * display alone. - */ -void yagl_egl_display_add_image(struct yagl_egl_display *dpy, - struct yagl_egl_image *image); - -struct yagl_egl_image - *yagl_egl_display_acquire_image(struct yagl_egl_display *dpy, - yagl_host_handle handle); - -bool yagl_egl_display_remove_image(struct yagl_egl_display *dpy, - yagl_host_handle handle); - -/* - * @} - */ - #endif diff --git a/hw/yagl_apis/egl/yagl_egl_image.c b/hw/yagl_apis/egl/yagl_egl_image.c deleted file mode 100644 index f64e80b..0000000 --- a/hw/yagl_apis/egl/yagl_egl_image.c +++ /dev/null @@ -1,51 +0,0 @@ -#include "yagl_egl_image.h" -#include "yagl_egl_display.h" -#include "yagl_eglb_display.h" -#include "yagl_eglb_image.h" - -static void yagl_egl_image_destroy(struct yagl_ref *ref) -{ - struct yagl_egl_image *image = (struct yagl_egl_image*)ref; - - image->backend_image->destroy(image->backend_image); - - yagl_resource_cleanup(&image->res); - - g_free(image); -} - -struct yagl_egl_image *yagl_egl_image_create(struct yagl_egl_display *dpy, - yagl_winsys_id buffer) -{ - struct yagl_eglb_image *backend_image; - struct yagl_egl_image *image; - - backend_image = dpy->backend_dpy->create_image(dpy->backend_dpy, buffer); - - if (!backend_image) { - return NULL; - } - - image = g_malloc0(sizeof(*image)); - - yagl_resource_init(&image->res, &yagl_egl_image_destroy); - - image->dpy = dpy; - image->backend_image = backend_image; - - return image; -} - -void yagl_egl_image_acquire(struct yagl_egl_image *image) -{ - if (image) { - yagl_resource_acquire(&image->res); - } -} - -void yagl_egl_image_release(struct yagl_egl_image *image) -{ - if (image) { - yagl_resource_release(&image->res); - } -} diff --git a/hw/yagl_apis/egl/yagl_egl_image.h b/hw/yagl_apis/egl/yagl_egl_image.h deleted file mode 100644 index 06c17cd..0000000 --- a/hw/yagl_apis/egl/yagl_egl_image.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef _QEMU_YAGL_EGL_IMAGE_H -#define _QEMU_YAGL_EGL_IMAGE_H - -#include "yagl_types.h" -#include "yagl_resource.h" - -struct yagl_egl_display; -struct yagl_eglb_image; - -struct yagl_egl_image -{ - struct yagl_resource res; - - struct yagl_egl_display *dpy; - - struct yagl_eglb_image *backend_image; -}; - -struct yagl_egl_image *yagl_egl_image_create(struct yagl_egl_display *dpy, - yagl_winsys_id buffer); - -/* - * Helper functions that simply acquire/release yagl_egl_image::res - * @{ - */ - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_egl_image_acquire(struct yagl_egl_image *image); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_egl_image_release(struct yagl_egl_image *image); - -/* - * @} - */ - -#endif diff --git a/hw/yagl_apis/egl/yagl_egl_validate.c b/hw/yagl_apis/egl/yagl_egl_validate.c index d9c0a4e..b1b725e 100644 --- a/hw/yagl_apis/egl/yagl_egl_validate.c +++ b/hw/yagl_apis/egl/yagl_egl_validate.c @@ -4,8 +4,3 @@ bool yagl_egl_is_attrib_list_empty(const EGLint *attrib_list) { return !attrib_list || (attrib_list[0] == EGL_NONE); } - -bool yagl_egl_is_api_valid(EGLenum api) -{ - return (api == EGL_OPENGL_ES_API); -} diff --git a/hw/yagl_apis/egl/yagl_egl_validate.h b/hw/yagl_apis/egl/yagl_egl_validate.h index 9d8ddda..4a4c0b3 100644 --- a/hw/yagl_apis/egl/yagl_egl_validate.h +++ b/hw/yagl_apis/egl/yagl_egl_validate.h @@ -6,6 +6,4 @@ bool yagl_egl_is_attrib_list_empty(const EGLint *attrib_list); -bool yagl_egl_is_api_valid(EGLenum api); - #endif diff --git a/hw/yagl_apis/egl/yagl_host_egl_calls.c b/hw/yagl_apis/egl/yagl_host_egl_calls.c index c36934a..515ddd8 100644 --- a/hw/yagl_apis/egl/yagl_host_egl_calls.c +++ b/hw/yagl_apis/egl/yagl_host_egl_calls.c @@ -9,29 +9,22 @@ #include "yagl_egl_config.h" #include "yagl_egl_surface.h" #include "yagl_egl_context.h" -#include "yagl_egl_image.h" #include "yagl_egl_validate.h" #include "yagl_eglb_display.h" #include "yagl_eglb_context.h" #include "yagl_eglb_surface.h" -#include "yagl_eglb_image.h" #include "yagl_log.h" #include "yagl_tls.h" #include "yagl_thread.h" #include "yagl_process.h" -#include "yagl_client_interface.h" -#include "yagl_client_context.h" -#include "yagl_client_image.h" -#include "yagl_sharegroup.h" +#include "yagl_object_map.h" #include #define YAGL_EGL_VERSION_MAJOR 1 #define YAGL_EGL_VERSION_MINOR 4 #define YAGL_SET_ERR(err) \ - if (egl_api_ts->error == EGL_SUCCESS) { \ - egl_api_ts->error = err; \ - } \ + *error = err; \ YAGL_LOG_ERROR("error = 0x%X", err) #define YAGL_UNIMPLEMENTED(func, ret) \ @@ -47,10 +40,23 @@ struct yagl_egl_interface_impl struct yagl_egl_backend *backend; }; +static void yagl_egl_ensure_current(struct yagl_egl_interface *iface) +{ + struct yagl_egl_interface_impl *egl_iface = (struct yagl_egl_interface_impl*)iface; + egl_iface->backend->ensure_current(egl_iface->backend); +} + +static void yagl_egl_unensure_current(struct yagl_egl_interface *iface) +{ + struct yagl_egl_interface_impl *egl_iface = (struct yagl_egl_interface_impl*)iface; + egl_iface->backend->unensure_current(egl_iface->backend); +} + static YAGL_DEFINE_TLS(struct yagl_egl_api_ts*, egl_api_ts); static __inline bool yagl_validate_display(yagl_host_handle dpy_, - struct yagl_egl_display **dpy) + struct yagl_egl_display **dpy, + EGLint *error) { YAGL_LOG_FUNC_SET(yagl_validate_display); @@ -71,7 +77,8 @@ static __inline bool yagl_validate_display(yagl_host_handle dpy_, static __inline bool yagl_validate_config(struct yagl_egl_display *dpy, yagl_host_handle cfg_, - struct yagl_egl_config **cfg) + struct yagl_egl_config **cfg, + EGLint *error) { YAGL_LOG_FUNC_SET(yagl_validate_config); @@ -87,7 +94,8 @@ static __inline bool yagl_validate_config(struct yagl_egl_display *dpy, static __inline bool yagl_validate_surface(struct yagl_egl_display *dpy, yagl_host_handle sfc_, - struct yagl_egl_surface **sfc) + struct yagl_egl_surface **sfc, + EGLint *error) { YAGL_LOG_FUNC_SET(yagl_validate_surface); @@ -103,7 +111,8 @@ static __inline bool yagl_validate_surface(struct yagl_egl_display *dpy, static __inline bool yagl_validate_context(struct yagl_egl_display *dpy, yagl_host_handle ctx_, - struct yagl_egl_context **ctx) + struct yagl_egl_context **ctx, + EGLint *error) { YAGL_LOG_FUNC_SET(yagl_validate_context); @@ -117,114 +126,13 @@ static __inline bool yagl_validate_context(struct yagl_egl_display *dpy, return true; } -static __inline bool yagl_validate_image(struct yagl_egl_display *dpy, - yagl_host_handle image_, - struct yagl_egl_image **image) -{ - YAGL_LOG_FUNC_SET(yagl_validate_image); - - *image = yagl_egl_display_acquire_image(dpy, image_); - - if (!*image) { - YAGL_SET_ERR(EGL_BAD_PARAMETER); - return false; - } - - return true; -} - -static bool yagl_get_client_api(const EGLint *attrib_list, yagl_client_api *client_api) -{ - int i = 0; - - switch (egl_api_ts->api) { - case EGL_OPENGL_ES_API: - *client_api = yagl_client_api_gles1; - if (!yagl_egl_is_attrib_list_empty(attrib_list)) { - while (attrib_list[i] != EGL_NONE) { - switch (attrib_list[i]) { - case EGL_CONTEXT_CLIENT_VERSION: - if (attrib_list[i + 1] == 1) { - *client_api = yagl_client_api_gles1; - } else if (attrib_list[i + 1] == 2) { - *client_api = yagl_client_api_gles2; - } else { - return false; - } - break; - default: - return false; - } - - i += 2; - } - } - break; - case EGL_OPENVG_API: - *client_api = yagl_client_api_ovg; - break; - case EGL_OPENGL_API: - *client_api = yagl_client_api_ogl; - break; - default: - return false; - } - return true; -} - -static struct yagl_client_context *yagl_egl_get_ctx(struct yagl_egl_interface *iface) -{ - if (egl_api_ts->context) { - return egl_api_ts->context->backend_ctx->client_ctx; - } else { - return NULL; - } -} - -static struct yagl_client_image *yagl_egl_get_image(struct yagl_egl_interface *iface, - yagl_host_handle image) -{ - if (egl_api_ts->context) { - struct yagl_egl_image *egl_image = - yagl_egl_display_acquire_image(egl_api_ts->context->dpy, image); - if (egl_image) { - struct yagl_client_image *client_image = - egl_image->backend_image->glegl_image; - yagl_client_image_acquire(client_image); - yagl_egl_image_release(egl_image); - return client_image; - } - } - - return NULL; -} - -static void yagl_egl_ensure_ctx(struct yagl_egl_interface *iface) -{ - struct yagl_egl_interface_impl *egl_iface = (struct yagl_egl_interface_impl*)iface; - egl_iface->backend->ensure_current(egl_iface->backend); -} - -static void yagl_egl_unensure_ctx(struct yagl_egl_interface *iface) -{ - struct yagl_egl_interface_impl *egl_iface = (struct yagl_egl_interface_impl*)iface; - egl_iface->backend->unensure_current(egl_iface->backend); -} - static bool yagl_egl_release_current_context(struct yagl_egl_display *dpy) { if (!egl_api_ts->context) { return true; } - egl_api_ts->context->backend_ctx->client_ctx->flush(egl_api_ts->context->backend_ctx->client_ctx); - egl_api_ts->context->backend_ctx->client_ctx->deactivate(egl_api_ts->context->backend_ctx->client_ctx); - if (!egl_api_ts->backend->release_current(egl_api_ts->backend, false)) { - /* - * If host 'make_current' failed then re-activate. - */ - egl_api_ts->context->backend_ctx->client_ctx->activate(egl_api_ts->context->backend_ctx->client_ctx); return false; } @@ -257,44 +165,58 @@ static void yagl_host_egl_thread_init(struct yagl_api_ps *api_ps) 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 = NULL; + 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_fini(struct yagl_api_ps *api_ps) -{ - struct yagl_egl_api_ps *egl_api_ps = (struct yagl_egl_api_ps*)api_ps; - - yagl_egl_api_ps_fini(egl_api_ps); -} - 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; - struct yagl_egl_interface_impl *egl_iface = (struct yagl_egl_interface_impl*)egl_api_ps->egl_iface; YAGL_LOG_FUNC_ENTER(yagl_host_egl_process_destroy, NULL); yagl_egl_api_ps_cleanup(egl_api_ps); - yagl_egl_interface_cleanup(&egl_iface->base); - g_free(egl_iface); + g_free(egl_api_ps->egl_iface); yagl_api_ps_cleanup(&egl_api_ps->base); @@ -317,12 +239,8 @@ struct yagl_api_ps *yagl_host_egl_process_init(struct yagl_api *api) egl_iface = g_malloc0(sizeof(*egl_iface)); - yagl_egl_interface_init(&egl_iface->base, egl_api->backend->render_type); - - egl_iface->base.get_ctx = &yagl_egl_get_ctx; - egl_iface->base.get_image = &yagl_egl_get_image; - egl_iface->base.ensure_ctx = &yagl_egl_ensure_ctx; - egl_iface->base.unensure_ctx = &yagl_egl_unensure_ctx; + egl_iface->base.ensure_ctx = &yagl_egl_ensure_current; + egl_iface->base.unensure_ctx = &yagl_egl_unensure_current; egl_iface->backend = egl_api->backend; /* @@ -334,9 +252,10 @@ struct yagl_api_ps *yagl_host_egl_process_init(struct yagl_api *api) 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.fini = &yagl_host_egl_process_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); @@ -346,16 +265,8 @@ struct yagl_api_ps *yagl_host_egl_process_init(struct yagl_api *api) return &egl_api_ps->base; } -EGLint yagl_host_eglGetError(void) -{ - EGLint res = egl_api_ts->error; - - egl_api_ts->error = EGL_SUCCESS; - - return res; -} - -yagl_host_handle yagl_host_eglGetDisplay(uint32_t display_id) +yagl_host_handle yagl_host_eglGetDisplay(uint32_t display_id, + EGLint *error) { struct yagl_egl_display *dpy; @@ -366,7 +277,8 @@ yagl_host_handle yagl_host_eglGetDisplay(uint32_t display_id) EGLBoolean yagl_host_eglInitialize(yagl_host_handle dpy_, EGLint *major, - EGLint *minor) + EGLint *minor, + EGLint *error) { struct yagl_egl_display *dpy; @@ -392,11 +304,12 @@ EGLBoolean yagl_host_eglInitialize(yagl_host_handle dpy_, return EGL_TRUE; } -EGLBoolean yagl_host_eglTerminate(yagl_host_handle dpy_) +EGLBoolean yagl_host_eglTerminate(yagl_host_handle dpy_, + EGLint *error) { struct yagl_egl_display *dpy = NULL; - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { return EGL_FALSE; } @@ -406,11 +319,12 @@ EGLBoolean yagl_host_eglTerminate(yagl_host_handle dpy_) } EGLBoolean yagl_host_eglGetConfigs(yagl_host_handle dpy_, - yagl_host_handle *configs, int32_t configs_maxcount, int32_t *configs_count) + 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)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { return EGL_FALSE; } @@ -426,7 +340,8 @@ EGLBoolean yagl_host_eglGetConfigs(yagl_host_handle dpy_, 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) + yagl_host_handle *configs, int32_t configs_maxcount, int32_t *configs_count, + EGLint *error) { EGLBoolean res = EGL_FALSE; struct yagl_egl_display *dpy = NULL; @@ -437,7 +352,7 @@ EGLBoolean yagl_host_eglChooseConfig(yagl_host_handle dpy_, yagl_egl_native_config_init(&dummy); - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } @@ -676,7 +591,8 @@ out: EGLBoolean yagl_host_eglGetConfigAttrib(yagl_host_handle dpy_, yagl_host_handle config_, EGLint attribute, - EGLint *value) + EGLint *value, + EGLint *error) { EGLBoolean res = EGL_FALSE; struct yagl_egl_display *dpy = NULL; @@ -685,11 +601,11 @@ EGLBoolean yagl_host_eglGetConfigAttrib(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglGetConfigAttrib); - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_config(dpy, config_, &config)) { + if (!yagl_validate_config(dpy, config_, &config, error)) { goto out; } @@ -711,7 +627,8 @@ out: } EGLBoolean yagl_host_eglDestroySurface(yagl_host_handle dpy_, - yagl_host_handle surface_) + yagl_host_handle surface_, + EGLint *error) { EGLBoolean res = EGL_FALSE; struct yagl_egl_display *dpy = NULL; @@ -719,11 +636,11 @@ EGLBoolean yagl_host_eglDestroySurface(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglDestroySurface); - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_surface(dpy, surface_, &surface)) { + if (!yagl_validate_surface(dpy, surface_, &surface, error)) { goto out; } @@ -743,7 +660,8 @@ out: EGLBoolean yagl_host_eglQuerySurface(yagl_host_handle dpy_, yagl_host_handle surface_, EGLint attribute, - EGLint *value) + EGLint *value, + EGLint *error) { EGLBoolean res = EGL_FALSE; struct yagl_egl_display *dpy = NULL; @@ -752,11 +670,11 @@ EGLBoolean yagl_host_eglQuerySurface(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglQuerySurface); - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_surface(dpy, surface_, &surface)) { + if (!yagl_validate_surface(dpy, surface_, &surface, error)) { goto out; } @@ -846,41 +764,29 @@ out: return res; } -EGLBoolean yagl_host_eglBindAPI(EGLenum api) +void yagl_host_eglBindAPI(EGLenum api) { - YAGL_LOG_FUNC_SET(eglBindAPI); - - if (!yagl_egl_is_api_valid(api)) { - YAGL_SET_ERR(EGL_BAD_PARAMETER); - return EGL_FALSE; - } - egl_api_ts->api = api; - - return EGL_TRUE; } -EGLBoolean yagl_host_eglWaitClient(void) +void yagl_host_eglWaitClient(void) { struct yagl_egl_surface *sfc = NULL; if (!egl_api_ts->context) { - goto out; + return; } sfc = egl_api_ts->context->draw; if (!sfc) { - goto out; + return; } sfc->backend_sfc->wait_gl(sfc->backend_sfc); - -out: - return EGL_TRUE; } -EGLBoolean yagl_host_eglReleaseThread(void) +EGLBoolean yagl_host_eglReleaseThread(EGLint *error) { EGLBoolean res = EGL_FALSE; @@ -904,17 +810,18 @@ out: EGLBoolean yagl_host_eglSurfaceAttrib(yagl_host_handle dpy_, yagl_host_handle surface_, EGLint attribute, - EGLint value) + 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)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_surface(dpy, surface_, &surface)) { + if (!yagl_validate_surface(dpy, surface_, &surface, error)) { goto out; } @@ -930,172 +837,36 @@ out: return res; } -EGLBoolean yagl_host_eglBindTexImage(yagl_host_handle dpy_, - yagl_host_handle surface_, - EGLint buffer) -{ - EGLBoolean res = EGL_FALSE; - struct yagl_egl_display *dpy = NULL; - struct yagl_egl_surface *surface = NULL; - - YAGL_LOG_FUNC_SET(eglBindTexImage); - - if (!egl_api_ts->context) { - YAGL_LOG_WARN("No context"); - res = EGL_TRUE; - goto out; - } - - if (!yagl_validate_display(dpy_, &dpy)) { - goto out; - } - - if (!yagl_validate_surface(dpy, surface_, &surface)) { - goto out; - } - - if (buffer != EGL_BACK_BUFFER) { - YAGL_SET_ERR(EGL_BAD_PARAMETER); - goto out; - } - - if (surface->backend_sfc->type != EGL_PBUFFER_BIT) { - YAGL_SET_ERR(EGL_BAD_SURFACE); - goto out; - } - - if (surface->backend_sfc->attribs.pbuffer.tex_format == EGL_NO_TEXTURE) { - YAGL_SET_ERR(EGL_BAD_MATCH); - goto out; - } - - if (surface->backend_sfc->attribs.pbuffer.tex_target == EGL_NO_TEXTURE) { - YAGL_SET_ERR(EGL_BAD_MATCH); - goto out; - } - - if (!surface->backend_sfc->bind_tex_image(surface->backend_sfc)) { - YAGL_SET_ERR(EGL_BAD_ACCESS); - goto out; - } - - res = EGL_TRUE; - -out: - yagl_egl_surface_release(surface); - - return res; -} - -EGLBoolean yagl_host_eglReleaseTexImage(yagl_host_handle dpy_, - yagl_host_handle surface_, - EGLint buffer) -{ - EGLBoolean res = EGL_FALSE; - struct yagl_egl_display *dpy = NULL; - struct yagl_egl_surface *surface = NULL; - - YAGL_LOG_FUNC_SET(eglReleaseTexImage); - - if (!yagl_validate_display(dpy_, &dpy)) { - goto out; - } - - if (!yagl_validate_surface(dpy, surface_, &surface)) { - goto out; - } - - if (buffer != EGL_BACK_BUFFER) { - YAGL_SET_ERR(EGL_BAD_PARAMETER); - goto out; - } - - if (surface->backend_sfc->type != EGL_PBUFFER_BIT) { - YAGL_SET_ERR(EGL_BAD_SURFACE); - goto out; - } - - if (surface->backend_sfc->attribs.pbuffer.tex_format == EGL_NO_TEXTURE) { - YAGL_SET_ERR(EGL_BAD_MATCH); - goto out; - } - - if (surface->backend_sfc->attribs.pbuffer.tex_target == EGL_NO_TEXTURE) { - YAGL_SET_ERR(EGL_BAD_MATCH); - goto out; - } - - if (!surface->backend_sfc->release_tex_image(surface->backend_sfc)) { - YAGL_SET_ERR(EGL_BAD_ACCESS); - goto out; - } - - 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) + 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; - yagl_client_api client_api; - struct yagl_client_interface *client_iface = NULL; struct yagl_egl_context *share_context = NULL; - struct yagl_sharegroup *sg = NULL; - struct yagl_client_context *client_ctx = NULL; struct yagl_egl_context *ctx = NULL; YAGL_LOG_FUNC_SET(eglCreateContext); - if (!yagl_validate_display(dpy_, &dpy)) { - goto out; - } - - if (!yagl_validate_config(dpy, config_, &config)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_get_client_api(attrib_list, &client_api)) { - YAGL_SET_ERR(EGL_BAD_ATTRIBUTE); - goto out; - } - - client_iface = cur_ts->ps->client_ifaces[client_api]; - - if (!client_iface) { - YAGL_LOG_ERROR("client API %d is not supported", client_api); - YAGL_SET_ERR(EGL_BAD_ATTRIBUTE); + if (!yagl_validate_config(dpy, config_, &config, error)) { goto out; } if (share_context_) { - if (!yagl_validate_context(dpy, share_context_, &share_context)) { + if (!yagl_validate_context(dpy, share_context_, &share_context, error)) { goto out; } - sg = share_context->backend_ctx->client_ctx->sg; - yagl_sharegroup_acquire(sg); - } else { - sg = yagl_sharegroup_create(); - } - - client_ctx = client_iface->create_ctx(client_iface, sg); - - if (!client_ctx) { - YAGL_SET_ERR(EGL_BAD_ALLOC); - goto out; } ctx = yagl_egl_context_create(dpy, config, - client_ctx, (share_context ? share_context->backend_ctx : NULL)); @@ -1104,21 +875,12 @@ yagl_host_handle yagl_host_eglCreateContext(yagl_host_handle dpy_, goto out; } - /* - * Now owned by 'ctx'. - */ - client_ctx = NULL; - yagl_egl_display_add_context(dpy, ctx); yagl_egl_context_release(ctx); res = ctx->res.handle; out: - if (client_ctx) { - client_ctx->destroy(client_ctx); - } - yagl_sharegroup_release(sg); yagl_egl_context_release(share_context); yagl_egl_config_release(config); @@ -1126,7 +888,8 @@ out: } EGLBoolean yagl_host_eglDestroyContext(yagl_host_handle dpy_, - yagl_host_handle ctx_) + yagl_host_handle ctx_, + EGLint *error) { EGLBoolean res = EGL_FALSE; struct yagl_egl_display *dpy = NULL; @@ -1134,11 +897,11 @@ EGLBoolean yagl_host_eglDestroyContext(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglDestroyContext); - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_context(dpy, ctx_, &ctx)) { + if (!yagl_validate_context(dpy, ctx_, &ctx, error)) { goto out; } @@ -1154,13 +917,12 @@ out: return res; } -EGLBoolean yagl_host_eglMakeCurrent(yagl_host_handle dpy_, +void yagl_host_eglMakeCurrent(yagl_host_handle dpy_, yagl_host_handle draw_, yagl_host_handle read_, yagl_host_handle ctx_) { - EGLBoolean res = EGL_FALSE; - bool bad_match = ctx_ ? (!draw_ ^ !read_) : (draw_ || read_); + EGLint error = 0; bool release_context = !draw_ && !read_ && !ctx_; struct yagl_egl_display *dpy = NULL; struct yagl_egl_context *prev_ctx = NULL; @@ -1170,8 +932,7 @@ EGLBoolean yagl_host_eglMakeCurrent(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglMakeCurrent); - if (bad_match) { - YAGL_SET_ERR(EGL_BAD_MATCH); + if (!yagl_validate_display(dpy_, &dpy, &error)) { goto out; } @@ -1179,45 +940,20 @@ EGLBoolean yagl_host_eglMakeCurrent(yagl_host_handle dpy_, yagl_egl_context_acquire(prev_ctx); if (release_context) { - if (prev_ctx) { - if (!dpy_) { - /* - * Workaround for the case when dpy - * passed is EGL_NO_DISPLAY and we're releasing - * the current context. - */ - - dpy_ = prev_ctx->dpy->handle; - dpy = prev_ctx->dpy; - } else { - dpy = yagl_egl_api_ps_display_get(egl_api_ts->api_ps, dpy_); - if (!dpy) { - YAGL_SET_ERR(EGL_BAD_DISPLAY); - goto out; - } - } - } - } else { - if (!yagl_validate_display(dpy_, &dpy)) { - goto out; - } - } - - if (release_context) { if (!yagl_egl_release_current_context(dpy)) { - YAGL_SET_ERR(EGL_BAD_ACCESS); + YAGL_LOG_ERROR("cannot release current context"); goto out; } } else { - if (!yagl_validate_context(dpy, ctx_, &ctx)) { + if (!yagl_validate_context(dpy, ctx_, &ctx, &error)) { goto out; } - if (draw_ && !yagl_validate_surface(dpy, draw_, &draw)) { + if (draw_ && !yagl_validate_surface(dpy, draw_, &draw, &error)) { goto out; } - if (read_ && !yagl_validate_surface(dpy, read_, &read)) { + if (read_ && !yagl_validate_surface(dpy, read_, &read, &error)) { goto out; } @@ -1229,35 +965,18 @@ EGLBoolean yagl_host_eglMakeCurrent(yagl_host_handle dpy_, release_context = true; } - if (prev_ctx) { - prev_ctx->backend_ctx->client_ctx->flush(prev_ctx->backend_ctx->client_ctx); - if (prev_ctx != ctx) { - prev_ctx->backend_ctx->client_ctx->deactivate(prev_ctx->backend_ctx->client_ctx); - } - } - 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))) { - if (prev_ctx && (prev_ctx != ctx)) { - /* - * If host 'make_current' failed then re-activate. - */ - prev_ctx->backend_ctx->client_ctx->activate(prev_ctx->backend_ctx->client_ctx); - } - YAGL_SET_ERR(EGL_BAD_ACCESS); + 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 (prev_ctx != ctx) { - ctx->backend_ctx->client_ctx->activate(ctx->backend_ctx->client_ctx); - } } if (release_context && prev_ctx) { @@ -1270,21 +989,18 @@ EGLBoolean yagl_host_eglMakeCurrent(yagl_host_handle dpy_, read_, ctx_); - res = EGL_TRUE; - out: yagl_egl_surface_release(read); yagl_egl_surface_release(draw); yagl_egl_context_release(ctx); yagl_egl_context_release(prev_ctx); - - return res; } EGLBoolean yagl_host_eglQueryContext(yagl_host_handle dpy_, yagl_host_handle ctx_, EGLint attribute, - EGLint *value) + EGLint *value, + EGLint *error) { EGLBoolean res = EGL_FALSE; struct yagl_egl_display *dpy = NULL; @@ -1292,11 +1008,11 @@ EGLBoolean yagl_host_eglQueryContext(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglQueryContext); - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_context(dpy, ctx_, &ctx)) { + if (!yagl_validate_context(dpy, ctx_, &ctx, error)) { goto out; } @@ -1306,52 +1022,6 @@ EGLBoolean yagl_host_eglQueryContext(yagl_host_handle dpy_, *value = ctx->cfg->native.config_id; } break; - case EGL_CONTEXT_CLIENT_TYPE: - switch (ctx->backend_ctx->client_ctx->client_api) { - case yagl_client_api_gles1: - case yagl_client_api_gles2: - if (value) { - *value = EGL_OPENGL_ES_API; - } - break; - case yagl_client_api_ogl: - if (value) { - *value = EGL_OPENGL_API; - } - break; - case yagl_client_api_ovg: - if (value) { - *value = EGL_OPENVG_API; - } - break; - default: - if (value) { - *value = EGL_NONE; - } - break; - } - break; - case EGL_CONTEXT_CLIENT_VERSION: - switch (ctx->backend_ctx->client_ctx->client_api) { - case yagl_client_api_gles1: - if (value) { - *value = 1; - } - break; - case yagl_client_api_gles2: - if (value) { - *value = 2; - } - break; - case yagl_client_api_ogl: - case yagl_client_api_ovg: - default: - if (value) { - *value = 0; - } - break; - } - break; case EGL_RENDER_BUFFER: if (ctx->draw) { switch (ctx->draw->backend_sfc->type) { @@ -1390,7 +1060,8 @@ out: } EGLBoolean yagl_host_eglSwapBuffers(yagl_host_handle dpy_, - yagl_host_handle surface_) + yagl_host_handle surface_, + EGLint *error) { EGLBoolean res = EGL_FALSE; struct yagl_egl_display *dpy = NULL; @@ -1398,11 +1069,11 @@ EGLBoolean yagl_host_eglSwapBuffers(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglSwapBuffers); - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_surface(dpy, surface_, &surface)) { + if (!yagl_validate_surface(dpy, surface_, &surface, error)) { goto out; } @@ -1420,7 +1091,8 @@ out: } EGLBoolean yagl_host_eglCopyBuffers(yagl_host_handle dpy_, - yagl_host_handle surface_) + yagl_host_handle surface_, + EGLint *error) { EGLBoolean res = EGL_FALSE; struct yagl_egl_display *dpy = NULL; @@ -1428,11 +1100,11 @@ EGLBoolean yagl_host_eglCopyBuffers(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglCopyBuffers); - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_surface(dpy, surface_, &surface)) { + if (!yagl_validate_surface(dpy, surface_, &surface, error)) { goto out; } @@ -1449,74 +1121,14 @@ out: return res; } -yagl_host_handle yagl_host_eglCreateImageKHR(yagl_host_handle dpy_, - yagl_host_handle ctx, - EGLenum target, - yagl_winsys_id buffer, - const EGLint *attrib_list, int32_t attrib_list_count) -{ - yagl_host_handle res = 0; - struct yagl_egl_display *dpy = NULL; - struct yagl_egl_image *image = NULL; - - YAGL_LOG_FUNC_SET(eglCreateImageKHR); - - if (!yagl_validate_display(dpy_, &dpy)) { - goto out; - } - - image = yagl_egl_image_create(dpy, buffer); - - if (!image) { - YAGL_SET_ERR(EGL_BAD_ALLOC); - goto out; - } - - yagl_egl_display_add_image(dpy, image); - yagl_egl_image_release(image); - - res = image->res.handle; - -out: - return res; -} - -EGLBoolean yagl_host_eglDestroyImageKHR(yagl_host_handle dpy_, - yagl_host_handle image_) -{ - EGLBoolean res = EGL_FALSE; - struct yagl_egl_display *dpy = NULL; - struct yagl_egl_image *image = NULL; - - YAGL_LOG_FUNC_SET(eglDestroyImageKHR); - - if (!yagl_validate_display(dpy_, &dpy)) { - goto out; - } - - if (!yagl_validate_image(dpy, image_, &image)) { - goto out; - } - - if (yagl_egl_display_remove_image(dpy, image->res.handle)) { - res = EGL_TRUE; - } else { - YAGL_SET_ERR(EGL_BAD_PARAMETER); - } - -out: - yagl_egl_image_release(image); - - return res; -} - 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) + const EGLint *attrib_list, int32_t attrib_list_count, + EGLint *error) { yagl_host_handle res = 0; struct yagl_eglb_surface *backend_sfc = NULL; @@ -1544,11 +1156,11 @@ yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle } } - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_config(dpy, config_, &config)) { + if (!yagl_validate_config(dpy, config_, &config, error)) { goto out; } @@ -1604,7 +1216,8 @@ yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle uint32_t height, uint32_t bpp, target_ulong pixels, - const EGLint *attrib_list, int32_t attrib_list_count) + const EGLint *attrib_list, int32_t attrib_list_count, + EGLint *error) { yagl_host_handle res = 0; struct yagl_eglb_surface *backend_sfc = NULL; @@ -1662,11 +1275,11 @@ yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle } } - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_config(dpy, config_, &config)) { + if (!yagl_validate_config(dpy, config_, &config, error)) { goto out; } @@ -1722,7 +1335,8 @@ yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle uint32_t height, uint32_t bpp, target_ulong pixels, - const EGLint *attrib_list, int32_t attrib_list_count) + const EGLint *attrib_list, int32_t attrib_list_count, + EGLint *error) { yagl_host_handle res = 0; struct yagl_eglb_surface *backend_sfc = NULL; @@ -1740,11 +1354,11 @@ yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle goto out; } - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_config(dpy, config_, &config)) { + if (!yagl_validate_config(dpy, config_, &config, error)) { goto out; } @@ -1799,7 +1413,8 @@ EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy_, uint32_t width, uint32_t height, uint32_t bpp, - target_ulong pixels) + target_ulong pixels, + EGLint *error) { EGLBoolean res = EGL_FALSE; struct yagl_egl_display *dpy = NULL; @@ -1810,11 +1425,11 @@ EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglResizeOffscreenSurfaceYAGL); - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_surface(dpy, surface_, &surface)) { + if (!yagl_validate_surface(dpy, surface_, &surface, error)) { goto out; } @@ -1879,46 +1494,11 @@ out: return res; } -void yagl_host_eglUpdateOffscreenImageYAGL(yagl_host_handle dpy_, - yagl_host_handle image_, - uint32_t width, - uint32_t height, - uint32_t bpp, - const void *pixels, int32_t pixels_count) -{ - struct yagl_egl_display *dpy = NULL; - struct yagl_egl_image *image = NULL; - - YAGL_LOG_FUNC_SET(eglUpdateOffscreenImageYAGL); - - if (!yagl_validate_display(dpy_, &dpy)) { - goto out; - } - - if (!yagl_validate_image(dpy, image_, &image)) { - goto out; - } - - if (!image->backend_image->update_offscreen) { - YAGL_LOG_CRITICAL("Offscreen images not supported"); - YAGL_SET_ERR(EGL_BAD_PARAMETER); - goto out; - } - - image->backend_image->update_offscreen(image->backend_image, - width, - height, - bpp, - pixels); - -out: - yagl_egl_image_release(image); -} - 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) + const EGLint *attrib_list, int32_t attrib_list_count, + EGLint *error) { yagl_host_handle res = 0; struct yagl_eglb_surface *backend_sfc = NULL; @@ -1946,11 +1526,11 @@ yagl_host_handle yagl_host_eglCreateWindowSurfaceOnscreenYAGL(yagl_host_handle d } } - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_config(dpy, config_, &config)) { + if (!yagl_validate_config(dpy, config_, &config, error)) { goto out; } @@ -2000,7 +1580,8 @@ out: 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) + const EGLint *attrib_list, int32_t attrib_list_count, + EGLint *error) { yagl_host_handle res = 0; struct yagl_eglb_surface *backend_sfc = NULL; @@ -2058,11 +1639,11 @@ yagl_host_handle yagl_host_eglCreatePbufferSurfaceOnscreenYAGL(yagl_host_handle } } - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_config(dpy, config_, &config)) { + if (!yagl_validate_config(dpy, config_, &config, error)) { goto out; } @@ -2111,7 +1692,8 @@ out: 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) + const EGLint *attrib_list, int32_t attrib_list_count, + EGLint *error) { yagl_host_handle res = 0; struct yagl_eglb_surface *backend_sfc = NULL; @@ -2129,11 +1711,11 @@ yagl_host_handle yagl_host_eglCreatePixmapSurfaceOnscreenYAGL(yagl_host_handle d goto out; } - if (!yagl_validate_display(dpy_, &dpy)) { + if (!yagl_validate_display(dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_config(dpy, config_, &config)) { + if (!yagl_validate_config(dpy, config_, &config, error)) { goto out; } @@ -2184,14 +1766,15 @@ 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)) { + if (!yagl_validate_display(dpy_, &dpy, &error)) { goto out; } - if (!yagl_validate_surface(dpy, surface_, &surface)) { + if (!yagl_validate_surface(dpy, surface_, &surface, &error)) { goto out; } @@ -2200,3 +1783,33 @@ void yagl_host_eglInvalidateOnscreenSurfaceYAGL(yagl_host_handle dpy_, 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; +} diff --git a/hw/yagl_apis/egl/yagl_host_egl_calls.h b/hw/yagl_apis/egl/yagl_host_egl_calls.h index ce4063f..1ffca87 100644 --- a/hw/yagl_apis/egl/yagl_host_egl_calls.h +++ b/hw/yagl_apis/egl/yagl_host_egl_calls.h @@ -6,112 +6,117 @@ struct yagl_api_ps *yagl_host_egl_process_init(struct yagl_api *api); -EGLint yagl_host_eglGetError(void); -yagl_host_handle yagl_host_eglGetDisplay(uint32_t display_id); +yagl_host_handle yagl_host_eglGetDisplay(uint32_t display_id, + EGLint *error); EGLBoolean yagl_host_eglInitialize(yagl_host_handle dpy, EGLint *major, - EGLint *minor); -EGLBoolean yagl_host_eglTerminate(yagl_host_handle dpy); + EGLint *minor, + EGLint *error); +EGLBoolean yagl_host_eglTerminate(yagl_host_handle dpy, + EGLint *error); EGLBoolean yagl_host_eglGetConfigs(yagl_host_handle dpy, - yagl_host_handle *configs, int32_t configs_maxcount, int32_t *configs_count); + yagl_host_handle *configs, int32_t configs_maxcount, int32_t *configs_count, + EGLint *error); 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); + yagl_host_handle *configs, int32_t configs_maxcount, int32_t *configs_count, + EGLint *error); EGLBoolean yagl_host_eglGetConfigAttrib(yagl_host_handle dpy, yagl_host_handle config, EGLint attribute, - EGLint *value); + EGLint *value, + EGLint *error); EGLBoolean yagl_host_eglDestroySurface(yagl_host_handle dpy, - yagl_host_handle surface); + yagl_host_handle surface, + EGLint *error); EGLBoolean yagl_host_eglQuerySurface(yagl_host_handle dpy, yagl_host_handle surface, EGLint attribute, - EGLint *value); -EGLBoolean yagl_host_eglBindAPI(EGLenum api); -EGLBoolean yagl_host_eglWaitClient(void); -EGLBoolean yagl_host_eglReleaseThread(void); + EGLint *value, + EGLint *error); +void yagl_host_eglBindAPI(EGLenum api); +void yagl_host_eglWaitClient(void); +EGLBoolean yagl_host_eglReleaseThread(EGLint *error); EGLBoolean yagl_host_eglSurfaceAttrib(yagl_host_handle dpy, yagl_host_handle surface, EGLint attribute, - EGLint value); -EGLBoolean yagl_host_eglBindTexImage(yagl_host_handle dpy, - yagl_host_handle surface, - EGLint buffer); -EGLBoolean yagl_host_eglReleaseTexImage(yagl_host_handle dpy, - yagl_host_handle surface, - EGLint buffer); + EGLint value, + EGLint *error); 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); + const EGLint *attrib_list, int32_t attrib_list_count, + EGLint *error); EGLBoolean yagl_host_eglDestroyContext(yagl_host_handle dpy, - yagl_host_handle ctx); -EGLBoolean yagl_host_eglMakeCurrent(yagl_host_handle dpy, + yagl_host_handle ctx, + EGLint *error); +void yagl_host_eglMakeCurrent(yagl_host_handle dpy, yagl_host_handle draw, yagl_host_handle read, yagl_host_handle ctx); EGLBoolean yagl_host_eglQueryContext(yagl_host_handle dpy, yagl_host_handle ctx, EGLint attribute, - EGLint *value); + EGLint *value, + EGLint *error); EGLBoolean yagl_host_eglSwapBuffers(yagl_host_handle dpy, - yagl_host_handle surface); + yagl_host_handle surface, + EGLint *error); EGLBoolean yagl_host_eglCopyBuffers(yagl_host_handle dpy, - yagl_host_handle surface); -yagl_host_handle yagl_host_eglCreateImageKHR(yagl_host_handle dpy, - yagl_host_handle ctx, - EGLenum target, - yagl_winsys_id buffer, - const EGLint *attrib_list, int32_t attrib_list_count); -EGLBoolean yagl_host_eglDestroyImageKHR(yagl_host_handle dpy, - yagl_host_handle image); + yagl_host_handle surface, + EGLint *error); 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); + const EGLint *attrib_list, int32_t attrib_list_count, + EGLint *error); 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); + const EGLint *attrib_list, int32_t attrib_list_count, + EGLint *error); 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); + const EGLint *attrib_list, int32_t attrib_list_count, + EGLint *error); EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy, yagl_host_handle surface, uint32_t width, uint32_t height, uint32_t bpp, - target_ulong pixels); -void yagl_host_eglUpdateOffscreenImageYAGL(yagl_host_handle dpy, - yagl_host_handle image, - uint32_t width, - uint32_t height, - uint32_t bpp, - const void *pixels, int32_t pixels_count); + target_ulong pixels, + EGLint *error); 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); + const EGLint *attrib_list, int32_t attrib_list_count, + EGLint *error); 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); + const EGLint *attrib_list, int32_t attrib_list_count, + EGLint *error); 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); + const EGLint *attrib_list, int32_t attrib_list_count, + EGLint *error); void yagl_host_eglInvalidateOnscreenSurfaceYAGL(yagl_host_handle dpy, yagl_host_handle surface, yagl_winsys_id buffer); +EGLBoolean yagl_host_eglCreateImageYAGL(uint32_t texture, + yagl_host_handle dpy, + yagl_winsys_id buffer, + EGLint *error); #endif diff --git a/hw/yagl_apis/gles/yagl_gles_api.c b/hw/yagl_apis/gles/yagl_gles_api.c new file mode 100644 index 0000000..5deb6eb --- /dev/null +++ b/hw/yagl_apis/gles/yagl_gles_api.c @@ -0,0 +1,29 @@ +#include "yagl_gles_api.h" +#include "yagl_host_gles_calls.h" +#include "yagl_gles_driver.h" + +static void yagl_gles_api_destroy(struct yagl_api *api) +{ + struct yagl_gles_api *gles_api = (struct yagl_gles_api*)api; + + gles_api->driver->destroy(gles_api->driver); + gles_api->driver = NULL; + + yagl_api_cleanup(&gles_api->base); + + g_free(gles_api); +} + +struct yagl_api *yagl_gles_api_create(struct yagl_gles_driver *driver) +{ + struct yagl_gles_api *gles_api = g_malloc0(sizeof(struct yagl_gles_api)); + + yagl_api_init(&gles_api->base); + + gles_api->base.process_init = &yagl_host_gles_process_init; + gles_api->base.destroy = &yagl_gles_api_destroy; + + gles_api->driver = driver; + + return &gles_api->base; +} diff --git a/hw/yagl_apis/gles/yagl_gles_api.h b/hw/yagl_apis/gles/yagl_gles_api.h new file mode 100644 index 0000000..ded47e2 --- /dev/null +++ b/hw/yagl_apis/gles/yagl_gles_api.h @@ -0,0 +1,20 @@ +#ifndef _QEMU_YAGL_GLES_API_H +#define _QEMU_YAGL_GLES_API_H + +#include "yagl_api.h" + +struct yagl_gles_driver; + +struct yagl_gles_api +{ + struct yagl_api base; + + struct yagl_gles_driver *driver; +}; + +/* + * Takes ownership of 'driver' + */ +struct yagl_api *yagl_gles_api_create(struct yagl_gles_driver *driver); + +#endif diff --git a/hw/yagl_apis/gles/yagl_gles_api_ps.c b/hw/yagl_apis/gles/yagl_gles_api_ps.c new file mode 100644 index 0000000..7b77ba8 --- /dev/null +++ b/hw/yagl_apis/gles/yagl_gles_api_ps.c @@ -0,0 +1,96 @@ +#include +#include "yagl_gles_api_ps.h" +#include "yagl_process.h" +#include "yagl_thread.h" +#include "yagl_avl.h" + +struct yagl_location +{ + uint32_t location; + + GLint actual_location; +}; + +static int yagl_location_compare(const void *avl_a, + const void *avl_b, + void *avl_param) +{ + const struct yagl_location *a = avl_a; + const struct yagl_location *b = avl_b; + + if (a->location < b->location) { + return -1; + } else if (a->location > b->location) { + return 1; + } else { + return 0; + } +} + +static void yagl_location_destroy(void *avl_item, void *avl_param) +{ + g_free(avl_item); +} + +void yagl_gles_api_ps_init(struct yagl_gles_api_ps *gles_api_ps, + struct yagl_gles_driver *driver) +{ + gles_api_ps->driver = driver; + gles_api_ps->locations = yagl_avl_create(&yagl_location_compare, + NULL, + NULL); + assert(gles_api_ps->locations); +} + +void yagl_gles_api_ps_cleanup(struct yagl_gles_api_ps *gles_api_ps) +{ + yagl_avl_destroy(gles_api_ps->locations, &yagl_location_destroy); +} + +void yagl_gles_api_ps_add_location(struct yagl_gles_api_ps *gles_api_ps, + uint32_t location, + GLint actual_location) +{ + struct yagl_location *item = g_malloc0(sizeof(struct yagl_location)); + + item->location = location; + item->actual_location = actual_location; + + yagl_avl_assert_insert(gles_api_ps->locations, item); +} + +GLint yagl_gles_api_ps_translate_location(struct yagl_gles_api_ps *gles_api_ps, + GLboolean tl, + uint32_t location) +{ + struct yagl_location *item; + struct yagl_location dummy; + + if (!tl) { + return location; + } + + dummy.location = location; + + item = yagl_avl_find(gles_api_ps->locations, &dummy); + + if (item) { + return item->actual_location; + } else { + assert(0); + return -1; + } +} + +void yagl_gles_api_ps_remove_location(struct yagl_gles_api_ps *gles_api_ps, + uint32_t location) +{ + void *item; + struct yagl_location dummy; + + dummy.location = location; + + item = yagl_avl_assert_delete(gles_api_ps->locations, &dummy); + + yagl_location_destroy(item, gles_api_ps->locations->avl_param); +} diff --git a/hw/yagl_apis/gles/yagl_gles_api_ps.h b/hw/yagl_apis/gles/yagl_gles_api_ps.h new file mode 100644 index 0000000..6330bda --- /dev/null +++ b/hw/yagl_apis/gles/yagl_gles_api_ps.h @@ -0,0 +1,34 @@ +#ifndef _QEMU_YAGL_GLES_API_PS_H +#define _QEMU_YAGL_GLES_API_PS_H + +#include "yagl_api.h" + +struct yagl_gles_driver; +struct yagl_avl_table; + +struct yagl_gles_api_ps +{ + struct yagl_api_ps base; + + struct yagl_gles_driver *driver; + + struct yagl_avl_table *locations; +}; + +void yagl_gles_api_ps_init(struct yagl_gles_api_ps *gles_api_ps, + struct yagl_gles_driver *driver); + +void yagl_gles_api_ps_cleanup(struct yagl_gles_api_ps *gles_api_ps); + +void yagl_gles_api_ps_add_location(struct yagl_gles_api_ps *gles_api_ps, + uint32_t location, + GLint actual_location); + +GLint yagl_gles_api_ps_translate_location(struct yagl_gles_api_ps *gles_api_ps, + GLboolean tl, + uint32_t location); + +void yagl_gles_api_ps_remove_location(struct yagl_gles_api_ps *gles_api_ps, + uint32_t location); + +#endif diff --git a/hw/yagl_apis/gles/yagl_gles_api_ts.c b/hw/yagl_apis/gles/yagl_gles_api_ts.c new file mode 100644 index 0000000..67517bb --- /dev/null +++ b/hw/yagl_apis/gles/yagl_gles_api_ts.c @@ -0,0 +1,22 @@ +#include "yagl_gles_api_ts.h" +#include "yagl_process.h" +#include "yagl_thread.h" +#include "yagl_vector.h" + +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) +{ + uint32_t i; + + for (i = 0; i < gles_api_ts->num_arrays; ++i) { + yagl_vector_cleanup(&gles_api_ts->arrays[i]); + } + g_free(gles_api_ts->arrays); +} diff --git a/hw/yagl_apis/gles/yagl_gles_api_ts.h b/hw/yagl_apis/gles/yagl_gles_api_ts.h new file mode 100644 index 0000000..cd8571c --- /dev/null +++ b/hw/yagl_apis/gles/yagl_gles_api_ts.h @@ -0,0 +1,26 @@ +#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; + +struct yagl_gles_api_ts +{ + struct yagl_gles_driver *driver; + + struct yagl_gles_api_ps *ps; + + struct yagl_vector *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 diff --git a/hw/yagl_apis/gles/yagl_gles_array.c b/hw/yagl_apis/gles/yagl_gles_array.c deleted file mode 100644 index 4c0b55c..0000000 --- a/hw/yagl_apis/gles/yagl_gles_array.c +++ /dev/null @@ -1,269 +0,0 @@ -#include -#include "yagl_gles_array.h" -#include "yagl_gles_context.h" -#include "yagl_gles_buffer.h" -#include "yagl_mem.h" -#include "yagl_sharegroup.h" - -static __inline bool yagl_get_el_size(GLenum type, int *el_size) -{ - switch (type) { - case GL_BYTE: - *el_size = 1; - break; - case GL_UNSIGNED_BYTE: - *el_size = 1; - break; - case GL_SHORT: - *el_size = 2; - break; - case GL_UNSIGNED_SHORT: - *el_size = 2; - break; - case GL_FLOAT: - *el_size = 4; - break; - case GL_FIXED: - *el_size = 4; - break; - default: - return false; - } - return true; -} - -static void yagl_gles_array_reset(struct yagl_gles_array *array) -{ - if (array->vbo) { - yagl_gles_buffer_release(array->vbo); - array->vbo = NULL; - array->vbo_local_name = 0; - array->offset = 0; - } else { - array->target_data = 0; - g_free(array->host_data); - array->host_data = NULL; - array->host_data_size = 0; - } -} - -/* - * GLES1 could use GL_FIXED data type, which is not supported by host OpenGL. - * Also, GLES1 glTexCoordPointer and glVertexPointer could use GL_BYTE type - * for data while host OpenGL doesn't support this type for these functions. - * Conversion to host-acceptable data type is required for either of these - * cases. - * We only change host_data and host_data_size here, because other - * array parameters are guest visible. - */ - -/* After conversion from GL_BYTE to GL_SHORT host_data is always tightly - * packed (stride = 0) */ -static void yagl_gles1_array_byte_to_short(struct yagl_gles_array *array, - uint32_t first, - uint32_t count) -{ - uint32_t new_data_size; - GLshort *new_data; - GLbyte *old_data = array->host_data + first * array->stride; - unsigned i, j; - - new_data_size = (first + count) * array->size * sizeof(GLshort); - new_data = g_malloc(new_data_size); - - for (i = first * array->size; i < (first + count) * array->size; i += array->size) { - for (j = 0; j < array->size; ++j) { - new_data[i + j] = old_data[j]; - } - old_data += array->stride; - } - - g_free(array->host_data); - array->host_data = new_data; - array->host_data_size = new_data_size; -} - -static void yagl_gles1_array_fixed_to_float(struct yagl_gles_array *array, - uint32_t first, - uint32_t count) -{ - uint32_t offset = first * array->stride; - void *data; - unsigned i; - - for (; offset < (first + count) * array->stride; offset += array->stride) { - data = array->host_data + offset; - - for (i = 0; i < array->size; ++i) { - ((GLfloat *)data)[i] = yagl_fixed_to_float(((GLfixed *)data)[i]); - } - } -} - - -void yagl_gles_array_init(struct yagl_gles_array *array, - GLuint index, - struct yagl_gles_context *ctx, - yagl_gles_array_apply_func apply) -{ - memset(array, 0, sizeof(*array)); - - array->index = index; - array->ctx = ctx; - array->apply = apply; -} - -void yagl_gles_array_cleanup(struct yagl_gles_array *array) -{ - if (array->vbo) { - yagl_gles_buffer_release(array->vbo); - array->vbo = NULL; - array->vbo_local_name = 0; - array->offset = 0; - } else { - array->target_data = 0; - g_free(array->host_data); - array->host_data = NULL; - array->host_data_size = 0; - } -} - -void yagl_gles_array_enable(struct yagl_gles_array *array, bool enable) -{ - array->enabled = enable; -} - -bool yagl_gles_array_update(struct yagl_gles_array *array, - GLint size, - GLenum type, - bool need_convert, - GLboolean normalized, - GLsizei stride, - target_ulong target_data) -{ - if (!yagl_get_el_size(type, &array->el_size)) { - return false; - } - - yagl_gles_array_reset(array); - - array->size = size; - array->type = type; - array->need_convert = need_convert; - array->normalized = normalized; - array->stride = stride; - - if (!array->stride) { - array->stride = array->size * array->el_size; - } - - array->target_data = target_data; - - if (need_convert) { - assert(type == GL_FIXED || type == GL_BYTE); - } - - return true; -} - -bool yagl_gles_array_update_vbo(struct yagl_gles_array *array, - GLint size, - GLenum type, - bool need_convert, - GLboolean normalized, - GLsizei stride, - struct yagl_gles_buffer *vbo, - yagl_object_name vbo_local_name, - GLint offset) -{ - if (!yagl_get_el_size(type, &array->el_size)) { - return false; - } - - yagl_gles_buffer_acquire(vbo); - - yagl_gles_array_reset(array); - - array->size = size; - array->type = type; - array->need_convert = need_convert; - array->normalized = normalized; - array->stride = stride; - - if (!array->stride) { - array->stride = array->size * array->el_size; - } - - array->vbo = vbo; - array->vbo_local_name = vbo_local_name; - array->offset = offset; - - if (need_convert) { - assert(type == GL_FIXED || type == GL_BYTE); - } - - return true; -} - -void yagl_gles_array_transfer(struct yagl_gles_array *array, - uint32_t first, - const void *data, - uint32_t size) -{ - uint32_t host_data_size; - - if (!array->enabled || array->vbo || !array->target_data) { - return; - } - - /* - * We must take 'first' into account since we're going to - * feed 'host_data' to glVertexAttribPointer or whatever, so - * the data before 'first' can be garbage, the host won't touch it, - * what matters is data starting at 'first' and 'count' elements long. - * - * Nokia dgles has an implementation of this where there's an extra - * variable called 'delta' = first * stride, which is being subtracted - * from 'host_data', thus, giving host implementation a bad pointer which - * it will increment according to GL rules and will get to what we need. - * Though works, I find this approach awkward, so I'll keep with - * overallocating for now... - */ - - host_data_size = first * array->stride + size; - - if (host_data_size > array->host_data_size) { - array->host_data_size = host_data_size; - g_free(array->host_data); - array->host_data = g_malloc(array->host_data_size); - } - - memcpy(array->host_data + (first * array->stride), data, size); - - if (array->need_convert) { - switch (array->type) { - case GL_BYTE: - yagl_gles1_array_byte_to_short(array, first, (size / array->stride)); - break; - case GL_FIXED: - yagl_gles1_array_fixed_to_float(array, first, (size / array->stride)); - break; - } - } - - array->apply(array); -} - -void yagl_gles_array_transfer_vbo(struct yagl_gles_array *array) -{ - if (!array->enabled || !array->vbo) { - return; - } - - yagl_gles_buffer_transfer(array->vbo, - array->type, - GL_ARRAY_BUFFER, - array->need_convert); - - array->apply(array); -} diff --git a/hw/yagl_apis/gles/yagl_gles_array.h b/hw/yagl_apis/gles/yagl_gles_array.h deleted file mode 100644 index eb109a1..0000000 --- a/hw/yagl_apis/gles/yagl_gles_array.h +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef _QEMU_YAGL_GLES_ARRAY_H -#define _QEMU_YAGL_GLES_ARRAY_H - -#include "yagl_types.h" - -/* - * This structure represents GLES array, such arrays are - * typically set up by calls to 'glColorPointer', 'glVertexPointer', - * 'glVertexAttribPointer', etc. - * - * Note that we can't call host 'glVertexAttribPointer' right away - * when target 'glVertexAttribPointer' call is made. We can't just - * transfer the data from target to host and feed it to - * host 'glVertexAttribPointer' since the data that pointer points to - * may be changed later, thus, we must do the transfer right before host - * OpenGL will attempt to use it. Host OpenGL will attempt to use - * the array pointer on 'glDrawArrays' and 'glDrawElements', thus, we must - * do the transfer right before those calls. For this to work, we'll - * store 'apply' function together with an array, this function will be - * responsible for calling 'glVertexAttribPointer', 'glColorPointer' - * or whatever. - */ - -struct yagl_gles_context; -struct yagl_gles_array; -struct yagl_gles_buffer; - -/* - * Calls the corresponding host array function. - */ -typedef void (*yagl_gles_array_apply_func)(struct yagl_gles_array */*array*/); - -struct yagl_gles_array -{ - /* - * Owning context. - */ - struct yagl_gles_context *ctx; - - GLuint index; - GLint size; - GLenum type; - int el_size; - GLboolean normalized; - GLsizei stride; - - /* - * Specifies if array data needs to be converted before transfering to - * host OpenGL occures. - * This could be used with GL_FIXED or GL_BYTE types, then data is - * converted to GL_FLOAT or GL_SHORT respectively. Setting this flag - * when yagl_gles_array::type is not either GL_FIXED or GL_FLOAT is - * programming error. - */ - bool need_convert; - - /* - * Is array enabled by 'glEnableClientState'/'glEnableVertexAttribArray'. - */ - bool enabled; - - struct yagl_gles_buffer *vbo; - yagl_object_name vbo_local_name; - - union - { - /* - * Array data. - */ - struct - { - target_ulong target_data; - - void *host_data; - uint32_t host_data_size; - }; - /* - * VBO data. - */ - struct - { - GLint offset; - }; - }; - - yagl_gles_array_apply_func apply; -}; - -void yagl_gles_array_init(struct yagl_gles_array *array, - GLuint index, - struct yagl_gles_context *ctx, - yagl_gles_array_apply_func apply); - -void yagl_gles_array_cleanup(struct yagl_gles_array *array); - -void yagl_gles_array_enable(struct yagl_gles_array *array, bool enable); - -bool yagl_gles_array_update(struct yagl_gles_array *array, - GLint size, - GLenum type, - bool need_convert, - GLboolean normalized, - GLsizei stride, - target_ulong target_data); - -bool yagl_gles_array_update_vbo(struct yagl_gles_array *array, - GLint size, - GLenum type, - bool need_convert, - GLboolean normalized, - GLsizei stride, - struct yagl_gles_buffer *vbo, - yagl_object_name vbo_local_name, - GLint offset); - -/* - * Transfers 'size' bytes starting from 'first' element. - * Transferred data is kept in 'host_data'. - */ -void yagl_gles_array_transfer(struct yagl_gles_array *array, - uint32_t first, - const void *data, - uint32_t size); - -/* - * Transfers 'vbo' if this array uses 'vbo'. - */ -void yagl_gles_array_transfer_vbo(struct yagl_gles_array *array); - -#endif diff --git a/hw/yagl_apis/gles/yagl_gles_buffer.c b/hw/yagl_apis/gles/yagl_gles_buffer.c deleted file mode 100644 index 998710e..0000000 --- a/hw/yagl_apis/gles/yagl_gles_buffer.c +++ /dev/null @@ -1,417 +0,0 @@ -#include -#include "yagl_gles_buffer.h" -#include "yagl_gles_driver.h" -#include "yagl_gles_validate.h" - -typedef void (*yagl_gles_buffer_transfer_func)(struct yagl_gles_buffer */*buffer*/, - GLenum /*target*/, - int /*start*/, - int /*size*/); - -static void yagl_gles_buffer_transfer_default(struct yagl_gles_buffer *buffer, - GLenum target, - int start, - int size) -{ - if ((start == 0) && (size == buffer->size)) { - buffer->driver->BufferData(target, size, - buffer->data, buffer->usage); - } else { - buffer->driver->BufferSubData(target, start, - size, buffer->data + start); - } -} - -/* - * Here we directly substitute target GLfixed data with GLfloat data. - * We can do that because GLfloat and GLfixed have the same data length - * and because buffer data is not directly visible to guest system. - * In the future, if something like glMapBuffer would have to be implemented, - * this approach should be changed to allocating intermediate buffer for - * passing to glBuferData call. The only two users who access buffer data - * directly is yagl_gles1_draw_arrays_psize/yagl_gles1_draw_elem_psize, - * they would have to be modified to perform manual conversion from GL_FIXED - * to GL_FLOAT, or to use glMapBuffer call themselves. - */ - -static void yagl_gles_buffer_transfer_fixed(struct yagl_gles_buffer *buffer, - GLenum target, - int start, - int size) -{ - void *data = buffer->data + start;; - int i; - - assert(sizeof(GLfixed) == sizeof(GLfloat)); - - for (i = 0; i < (size / sizeof(GLfloat)); ++i) { - ((GLfloat *)data)[i] = yagl_fixed_to_float(((GLfixed *)data)[i]); - } - - if ((start == 0) && (size == buffer->size)) { - buffer->driver->BufferData(target, size, data, buffer->usage); - } else { - buffer->driver->BufferSubData(target, start, size, data); - } -} - -static void yagl_gles_buffer_transfer_byte(struct yagl_gles_buffer *buffer, - GLenum target, - int start, - int size) -{ - int host_size = size * sizeof(GLshort); - GLbyte *target_data = buffer->data + start; - GLshort *host_data; - int i; - - host_data = g_malloc(host_size); - - for (i = 0; i < size; ++i) { - host_data[i] = target_data[i]; - } - - if ((start == 0) && (size == buffer->size)) { - buffer->driver->BufferData(target, host_size, host_data, buffer->usage); - } else { - buffer->driver->BufferSubData(target, start * sizeof(GLshort), - host_size, host_data); - } - - g_free(host_data); -} - -static void yagl_gles_buffer_transfer_internal(struct yagl_gles_buffer *buffer, - struct yagl_range_list *range_list, - GLenum target, - yagl_gles_buffer_transfer_func transfer_func) -{ - int num_ranges = yagl_range_list_size(range_list); - int i, start, size; - - if (num_ranges <= 0) { - return; - } - - if (num_ranges == 1) { - yagl_range_list_get(range_list, - 0, - &start, - &size); - if (size == 0) { - /* - * Buffer clear. - */ - assert(start == 0); - buffer->driver->BufferData(target, 0, - NULL, buffer->usage); - yagl_range_list_clear(range_list); - return; - } else if ((start == 0) && (size == buffer->size)) { - /* - * Buffer full update. - */ - transfer_func(buffer, target, 0, size); - yagl_range_list_clear(range_list); - return; - } - } - - /* - * Buffer partial updates. - */ - - for (i = 0; i < num_ranges; ++i) { - yagl_range_list_get(range_list, - i, - &start, - &size); - transfer_func(buffer, target, start, size); - } - yagl_range_list_clear(range_list); -} - -static void yagl_gles_buffer_destroy(struct yagl_ref *ref) -{ - struct yagl_gles_buffer *buffer = (struct yagl_gles_buffer*)ref; - - yagl_ensure_ctx(); - buffer->driver->DeleteBuffers(1, &buffer->default_part.global_name); - buffer->driver->DeleteBuffers(1, &buffer->fixed_part.global_name); - buffer->driver->DeleteBuffers(1, &buffer->byte_part.global_name); - yagl_unensure_ctx(); - - yagl_range_list_cleanup(&buffer->default_part.range_list); - yagl_range_list_cleanup(&buffer->fixed_part.range_list); - yagl_range_list_cleanup(&buffer->byte_part.range_list); - - g_free(buffer->data); - - yagl_object_cleanup(&buffer->base); - - g_free(buffer); -} - -struct yagl_gles_buffer - *yagl_gles_buffer_create(struct yagl_gles_driver *driver) -{ - struct yagl_gles_buffer *buffer; - - buffer = g_malloc0(sizeof(*buffer)); - - yagl_object_init(&buffer->base, &yagl_gles_buffer_destroy); - - buffer->driver = driver; - - driver->GenBuffers(1, &buffer->default_part.global_name); - yagl_range_list_init(&buffer->default_part.range_list); - - driver->GenBuffers(1, &buffer->fixed_part.global_name); - yagl_range_list_init(&buffer->fixed_part.range_list); - - driver->GenBuffers(1, &buffer->byte_part.global_name); - yagl_range_list_init(&buffer->byte_part.range_list); - - return buffer; -} - -void yagl_gles_buffer_acquire(struct yagl_gles_buffer *buffer) -{ - if (buffer) { - yagl_object_acquire(&buffer->base); - } -} - -void yagl_gles_buffer_release(struct yagl_gles_buffer *buffer) -{ - if (buffer) { - yagl_object_release(&buffer->base); - } -} - -void yagl_gles_buffer_set_data(struct yagl_gles_buffer *buffer, - GLint size, - const void *data, - GLenum usage) -{ - if (size > 0) { - if (size > buffer->size) { - g_free(buffer->data); - buffer->data = g_malloc(size); - } - buffer->size = size; - if (data) { - memcpy(buffer->data, data, buffer->size); - } - } else { - g_free(buffer->data); - buffer->data = NULL; - buffer->size = 0; - } - - buffer->usage = usage; - - yagl_range_list_clear(&buffer->default_part.range_list); - yagl_range_list_clear(&buffer->fixed_part.range_list); - yagl_range_list_clear(&buffer->byte_part.range_list); - - yagl_range_list_add(&buffer->default_part.range_list, 0, buffer->size); - yagl_range_list_add(&buffer->fixed_part.range_list, 0, buffer->size); - yagl_range_list_add(&buffer->byte_part.range_list, 0, buffer->size); - - buffer->cached_minmax_idx = false; -} - -bool yagl_gles_buffer_update_data(struct yagl_gles_buffer *buffer, - GLint offset, - GLint size, - const void *data) -{ - if ((offset < 0) || (size < 0) || ((offset + size) > buffer->size)) { - return false; - } - - if (size == 0) { - return true; - } - - memcpy(buffer->data + offset, data, size); - - yagl_range_list_add(&buffer->default_part.range_list, offset, size); - yagl_range_list_add(&buffer->fixed_part.range_list, offset, size); - yagl_range_list_add(&buffer->byte_part.range_list, offset, size); - - buffer->cached_minmax_idx = false; - - return true; -} - -bool yagl_gles_buffer_get_minmax_index(struct yagl_gles_buffer *buffer, - GLenum type, - GLint offset, - GLint count, - uint32_t *min_idx, - uint32_t *max_idx) -{ - int index_size, i; - char tmp[4]; - - *min_idx = UINT32_MAX; - *max_idx = 0; - - if (!yagl_gles_get_index_size(type, &index_size)) { - return false; - } - - if ((offset < 0) || (count <= 0) || ((offset + (count * index_size)) > buffer->size)) { - return false; - } - - if (buffer->cached_minmax_idx && - (buffer->cached_type == type) && - (buffer->cached_offset == offset) && - (buffer->cached_count == count)) { - *min_idx = buffer->cached_min_idx; - *max_idx = buffer->cached_max_idx; - return true; - } - - for (i = 0; i < count; ++i) { - /* - * We don't respect target endian here, but we don't care for now, - * we're on little endian anyway. - */ - memcpy(&tmp[0], buffer->data + offset + (i * index_size), index_size); - uint32_t idx = 0; - switch (type) { - case GL_UNSIGNED_BYTE: - idx = *(uint8_t*)&tmp[0]; - break; - case GL_UNSIGNED_SHORT: - idx = *(uint16_t*)&tmp[0]; - break; - default: - assert(0); - break; - } - if (idx < *min_idx) { - *min_idx = idx; - } - if (idx > *max_idx) { - *max_idx = idx; - } - } - - buffer->cached_minmax_idx = true; - buffer->cached_type = type; - buffer->cached_offset = offset; - buffer->cached_count = count; - buffer->cached_min_idx = *min_idx; - buffer->cached_max_idx = *max_idx; - - return true; -} - -bool yagl_gles_buffer_bind(struct yagl_gles_buffer *buffer, - GLenum type, - bool need_convert, - GLenum target, - yagl_object_name *old_buffer_name) -{ - GLenum binding; - yagl_object_name tmp; - struct yagl_gles_buffer_part *bufpart = &buffer->default_part; - - if (!yagl_gles_buffer_target_to_binding(target, &binding)) { - return false; - } - - buffer->driver->GetIntegerv(binding, (GLint*)&tmp); - - if (old_buffer_name) { - *old_buffer_name = tmp; - } - - if (need_convert) { - switch (type) { - case GL_BYTE: - bufpart = &buffer->byte_part; - break; - case GL_FIXED: - bufpart = &buffer->fixed_part; - break; - } - } - - if (tmp != bufpart->global_name) { - buffer->driver->BindBuffer(target, bufpart->global_name); - } - - return true; -} - -bool yagl_gles_buffer_transfer(struct yagl_gles_buffer *buffer, - GLenum type, - GLenum target, - bool need_convert) -{ - yagl_object_name old_buffer_name = 0; - - if (!yagl_gles_buffer_bind(buffer, type, need_convert, target, &old_buffer_name)) { - return false; - } - - if (need_convert) { - switch (type) { - case GL_BYTE: - yagl_gles_buffer_transfer_internal(buffer, - &buffer->byte_part.range_list, - target, - &yagl_gles_buffer_transfer_byte); - break; - case GL_FIXED: - yagl_gles_buffer_transfer_internal(buffer, - &buffer->fixed_part.range_list, - target, - &yagl_gles_buffer_transfer_fixed); - break; - } - } else { - yagl_gles_buffer_transfer_internal(buffer, - &buffer->default_part.range_list, - target, - &yagl_gles_buffer_transfer_default); - } - - buffer->driver->BindBuffer(target, old_buffer_name); - - return true; -} - -bool yagl_gles_buffer_get_parameter(struct yagl_gles_buffer *buffer, - GLenum pname, - GLint *param) -{ - switch (pname) { - case GL_BUFFER_SIZE: - *param = buffer->size; - break; - case GL_BUFFER_USAGE: - *param = buffer->usage; - break; - default: - return false; - } - - return true; -} - -void yagl_gles_buffer_set_bound(struct yagl_gles_buffer *buffer) -{ - buffer->was_bound = true; -} - -bool yagl_gles_buffer_was_bound(struct yagl_gles_buffer *buffer) -{ - return buffer->was_bound; -} diff --git a/hw/yagl_apis/gles/yagl_gles_buffer.h b/hw/yagl_apis/gles/yagl_gles_buffer.h deleted file mode 100644 index 205207f..0000000 --- a/hw/yagl_apis/gles/yagl_gles_buffer.h +++ /dev/null @@ -1,108 +0,0 @@ -#ifndef _QEMU_YAGL_GLES_BUFFER_H -#define _QEMU_YAGL_GLES_BUFFER_H - -#include "yagl_types.h" -#include "yagl_object.h" -#include "yagl_range_list.h" - - /* - * VBO implementation is somewhat tricky because - * we must correctly handle GL_FIXED data type, which must be - * converted to GL_FLOAT, and GL_BYTE data type, which (in some cases) - * must be converted to GL_SHORT. Buffer objects may be bound to - * multiple contexts, so there may be several VBOs using the - * same buffer object, but having different data types. We handle this - * by having three 'yagl_gles_buffer_part' objects: one for GL_FIXED type, - * one for GL_BYTE type and the other for all other types. - * Each 'yagl_gles_buffer_part' object has a separate global buffer name - * and a range list that consists of 'glBufferData' and 'glBufferSubData' - * ranges which haven't been processed yet. When a VBO is used we walk - * the appropriate range list, make conversions, clear it and call - * 'glBufferData' or 'glBufferSubData' as many times as needed. - */ - -#define YAGL_NS_BUFFER 0 - -struct yagl_gles_driver; - -struct yagl_gles_buffer_part -{ - yagl_object_name global_name; - - struct yagl_range_list range_list; -}; - -struct yagl_gles_buffer -{ - struct yagl_object base; - - struct yagl_gles_driver *driver; - - struct yagl_gles_buffer_part default_part; - struct yagl_gles_buffer_part fixed_part; - struct yagl_gles_buffer_part byte_part; - - GLint size; - void *data; - GLenum usage; - - bool was_bound; - - bool cached_minmax_idx; - GLenum cached_type; - GLint cached_offset; - GLint cached_count; - uint32_t cached_min_idx; - uint32_t cached_max_idx; -}; - -struct yagl_gles_buffer - *yagl_gles_buffer_create(struct yagl_gles_driver *driver); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles_buffer_acquire(struct yagl_gles_buffer *buffer); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles_buffer_release(struct yagl_gles_buffer *buffer); - -void yagl_gles_buffer_set_data(struct yagl_gles_buffer *buffer, - GLint size, - const void *data, - GLenum usage); - -bool yagl_gles_buffer_update_data(struct yagl_gles_buffer *buffer, - GLint offset, - GLint size, - const void *data); - -bool yagl_gles_buffer_get_minmax_index(struct yagl_gles_buffer *buffer, - GLenum type, - GLint offset, - GLint count, - uint32_t *min_idx, - uint32_t *max_idx); - -bool yagl_gles_buffer_bind(struct yagl_gles_buffer *buffer, - GLenum type, - bool need_convert, - GLenum target, - yagl_object_name *old_buffer_name); - -bool yagl_gles_buffer_transfer(struct yagl_gles_buffer *buffer, - GLenum type, - GLenum target, - bool need_convert); - -bool yagl_gles_buffer_get_parameter(struct yagl_gles_buffer *buffer, - GLenum pname, - GLint *param); - -void yagl_gles_buffer_set_bound(struct yagl_gles_buffer *buffer); - -bool yagl_gles_buffer_was_bound(struct yagl_gles_buffer *buffer); - -#endif diff --git a/hw/yagl_apis/gles2/yagl_gles2_calls.c b/hw/yagl_apis/gles/yagl_gles_calls.c similarity index 59% rename from hw/yagl_apis/gles2/yagl_gles2_calls.c rename to hw/yagl_apis/gles/yagl_gles_calls.c index f427997..d11a5f4 100644 --- a/hw/yagl_apis/gles2/yagl_gles2_calls.c +++ b/hw/yagl_apis/gles/yagl_gles_calls.c @@ -1,299 +1,496 @@ /* * Generated by gen-yagl-calls.py, do not modify! */ -#include "yagl_gles2_calls.h" -#include "yagl_host_gles2_calls.h" -#include "yagl_transport_gl2.h" +#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" /* - * glActiveTexture dispatcher. id = 1 + * glDrawArrays dispatcher. id = 1 */ -static bool yagl_func_glActiveTexture(struct yagl_transport *t) +static bool yagl_func_glDrawArrays(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); + 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); return true; } /* - * glBindBuffer dispatcher. id = 2 + * glDrawElements dispatcher. id = 2 */ -static bool yagl_func_glBindBuffer(struct yagl_transport *t) +static bool yagl_func_glDrawElements(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); + 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); + if (!yagl_transport_get_out_array(t, 1, (const void**)&indices, &indices_count)) { + return false; + } + 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); return true; } /* - * glBindFramebuffer dispatcher. id = 3 + * glReadPixels dispatcher. id = 3 */ -static bool yagl_func_glBindFramebuffer(struct yagl_transport *t) +static bool yagl_func_glReadPixels(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); + 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); + if (!yagl_transport_get_in_array(t, 1, (void**)&pixels, &pixels_maxcount, &pixels_count)) { + return false; + } + 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); return true; } /* - * glBindRenderbuffer dispatcher. id = 4 + * glDisableVertexAttribArray dispatcher. id = 4 */ -static bool yagl_func_glBindRenderbuffer(struct yagl_transport *t) +static bool yagl_func_glDisableVertexAttribArray(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); + 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); return true; } /* - * glBindTexture dispatcher. id = 5 + * glEnableVertexAttribArray dispatcher. id = 5 */ -static bool yagl_func_glBindTexture(struct yagl_transport *t) +static bool yagl_func_glEnableVertexAttribArray(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); + 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); return true; } /* - * glBlendEquation dispatcher. id = 6 + * glVertexAttribPointerData dispatcher. id = 6 */ -static bool yagl_func_glBlendEquation(struct yagl_transport *t) +static bool yagl_func_glVertexAttribPointerData(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); + 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); + if (!yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count)) { + return false; + } + 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); return true; } /* - * glBlendEquationSeparate dispatcher. id = 7 + * glVertexAttribPointerOffset dispatcher. id = 7 */ -static bool yagl_func_glBlendEquationSeparate(struct yagl_transport *t) +static bool yagl_func_glVertexAttribPointerOffset(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); + 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); return true; } /* - * glBlendFunc dispatcher. id = 8 + * glVertexPointerData dispatcher. id = 8 */ -static bool yagl_func_glBlendFunc(struct yagl_transport *t) +static bool yagl_func_glVertexPointerData(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); + 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); + if (!yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count)) { + return false; + } + 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); return true; } /* - * glBlendFuncSeparate dispatcher. id = 9 + * glVertexPointerOffset dispatcher. id = 9 */ -static bool yagl_func_glBlendFuncSeparate(struct yagl_transport *t) +static bool yagl_func_glVertexPointerOffset(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); + 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); return true; } /* - * glBufferData dispatcher. id = 10 + * glNormalPointerData dispatcher. id = 10 */ -static bool yagl_func_glBufferData(struct yagl_transport *t) +static bool yagl_func_glNormalPointerData(struct yagl_transport *t) { - GLenum target; + GLenum type; + GLsizei stride; + GLint first; const GLvoid *data; int32_t data_count; - GLenum usage; - target = yagl_transport_get_out_GLenum(t); + type = yagl_transport_get_out_GLenum(t); + stride = yagl_transport_get_out_GLsizei(t); + first = yagl_transport_get_out_GLint(t); if (!yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count)) { return false; } - 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_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); return true; } /* - * glBufferSubData dispatcher. id = 11 + * glNormalPointerOffset dispatcher. id = 11 */ -static bool yagl_func_glBufferSubData(struct yagl_transport *t) +static bool yagl_func_glNormalPointerOffset(struct yagl_transport *t) { - GLenum target; + 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); + + return true; +} + +/* + * glColorPointerData dispatcher. id = 12 + */ +static bool yagl_func_glColorPointerData(struct yagl_transport *t) +{ + GLint size; + GLenum type; + GLsizei stride; + GLint first; const GLvoid *data; int32_t data_count; - target = yagl_transport_get_out_GLenum(t); - offset = yagl_transport_get_out_GLsizei(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); if (!yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT3(glBufferSubData, GLenum, GLsizei, void*, target, offset, data); - (void)yagl_host_glBufferSubData(target, offset, 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); return true; } /* - * glCheckFramebufferStatus dispatcher. id = 12 + * glColorPointerOffset dispatcher. id = 13 */ -static bool yagl_func_glCheckFramebufferStatus(struct yagl_transport *t) +static bool yagl_func_glColorPointerOffset(struct yagl_transport *t) { - GLenum target; - GLenum *retval; - target = yagl_transport_get_out_GLenum(t); - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(glCheckFramebufferStatus, GLenum, target); - *retval = yagl_host_glCheckFramebufferStatus(target); - YAGL_LOG_FUNC_EXIT_SPLIT(GLenum, *retval); + 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); return true; } /* - * glClear dispatcher. id = 13 + * glTexCoordPointerData dispatcher. id = 14 */ -static bool yagl_func_glClear(struct yagl_transport *t) +static bool yagl_func_glTexCoordPointerData(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); + 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); + if (!yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count)) { + return false; + } + 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); return true; } /* - * glClearColor dispatcher. id = 14 + * glTexCoordPointerOffset dispatcher. id = 15 */ -static bool yagl_func_glClearColor(struct yagl_transport *t) +static bool yagl_func_glTexCoordPointerOffset(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); + 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); return true; } /* - * glClearDepthf dispatcher. id = 15 + * glDisableClientState dispatcher. id = 16 */ -static bool yagl_func_glClearDepthf(struct yagl_transport *t) +static bool yagl_func_glDisableClientState(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); + 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); return true; } /* - * glClearStencil dispatcher. id = 16 + * glEnableClientState dispatcher. id = 17 */ -static bool yagl_func_glClearStencil(struct yagl_transport *t) +static bool yagl_func_glEnableClientState(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); + 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); return true; } /* - * glColorMask dispatcher. id = 17 + * glGenBuffers dispatcher. id = 18 */ -static bool yagl_func_glColorMask(struct yagl_transport *t) +static bool yagl_func_glGenBuffers(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); + const GLuint *buffers; + int32_t buffers_count; + if (!yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&buffers, &buffers_count)) { + return false; + } + YAGL_LOG_FUNC_ENTER_SPLIT1(glGenBuffers, void*, buffers); + (void)yagl_host_glGenBuffers(buffers, buffers_count); + YAGL_LOG_FUNC_EXIT(NULL); + + return true; +} + +/* + * glBindBuffer dispatcher. id = 19 + */ +static bool 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); + + return true; +} + +/* + * glBufferData dispatcher. id = 20 + */ +static bool 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); + if (!yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count)) { + return false; + } + 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); + + return true; +} + +/* + * glBufferSubData dispatcher. id = 21 + */ +static bool 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); + if (!yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count)) { + return false; + } + 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); + + return true; +} + +/* + * glGenTextures dispatcher. id = 22 + */ +static bool yagl_func_glGenTextures(struct yagl_transport *t) +{ + const GLuint *textures; + int32_t textures_count; + if (!yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&textures, &textures_count)) { + return false; + } + YAGL_LOG_FUNC_ENTER_SPLIT1(glGenTextures, void*, textures); + (void)yagl_host_glGenTextures(textures, textures_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glCompressedTexImage2D dispatcher. id = 18 + * glBindTexture dispatcher. id = 23 + */ +static bool 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); + + return true; +} + +/* + * glActiveTexture dispatcher. id = 24 + */ +static bool 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); + + return true; +} + +/* + * glCompressedTexImage2D dispatcher. id = 25 */ static bool yagl_func_glCompressedTexImage2D(struct yagl_transport *t) { @@ -322,7 +519,7 @@ static bool yagl_func_glCompressedTexImage2D(struct yagl_transport *t) } /* - * glCompressedTexSubImage2D dispatcher. id = 19 + * glCompressedTexSubImage2D dispatcher. id = 26 */ static bool yagl_func_glCompressedTexSubImage2D(struct yagl_transport *t) { @@ -353,7 +550,7 @@ static bool yagl_func_glCompressedTexSubImage2D(struct yagl_transport *t) } /* - * glCopyTexImage2D dispatcher. id = 20 + * glCopyTexImage2D dispatcher. id = 27 */ static bool yagl_func_glCopyTexImage2D(struct yagl_transport *t) { @@ -381,7 +578,7 @@ static bool yagl_func_glCopyTexImage2D(struct yagl_transport *t) } /* - * glCopyTexSubImage2D dispatcher. id = 21 + * glCopyTexSubImage2D dispatcher. id = 28 */ static bool yagl_func_glCopyTexSubImage2D(struct yagl_transport *t) { @@ -409,468 +606,475 @@ static bool yagl_func_glCopyTexSubImage2D(struct yagl_transport *t) } /* - * glCullFace dispatcher. id = 22 + * glGetTexParameterfv dispatcher. id = 29 */ -static bool yagl_func_glCullFace(struct yagl_transport *t) +static bool yagl_func_glGetTexParameterfv(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); + 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); return true; } /* - * glDeleteBuffers dispatcher. id = 23 + * glGetTexParameteriv dispatcher. id = 30 */ -static bool yagl_func_glDeleteBuffers(struct yagl_transport *t) +static bool yagl_func_glGetTexParameteriv(struct yagl_transport *t) { - const GLuint *buffers; - int32_t buffers_count; - if (!yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&buffers, &buffers_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteBuffers, void*, buffers); - (void)yagl_host_glDeleteBuffers(buffers, buffers_count); + 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); return true; } /* - * glDeleteFramebuffers dispatcher. id = 24 + * glTexImage2D dispatcher. id = 31 */ -static bool yagl_func_glDeleteFramebuffers(struct yagl_transport *t) +static bool yagl_func_glTexImage2D(struct yagl_transport *t) { - const GLuint *framebuffers; - int32_t framebuffers_count; - if (!yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&framebuffers, &framebuffers_count)) { + 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); + if (!yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteFramebuffers, void*, framebuffers); - (void)yagl_host_glDeleteFramebuffers(framebuffers, framebuffers_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); return true; } /* - * glDeleteRenderbuffers dispatcher. id = 25 + * glTexParameterf dispatcher. id = 32 */ -static bool yagl_func_glDeleteRenderbuffers(struct yagl_transport *t) +static bool yagl_func_glTexParameterf(struct yagl_transport *t) { - const GLuint *renderbuffers; - int32_t renderbuffers_count; - if (!yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&renderbuffers, &renderbuffers_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteRenderbuffers, void*, renderbuffers); - (void)yagl_host_glDeleteRenderbuffers(renderbuffers, renderbuffers_count); + 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); return true; } /* - * glDeleteTextures dispatcher. id = 26 + * glTexParameterfv dispatcher. id = 33 */ -static bool yagl_func_glDeleteTextures(struct yagl_transport *t) +static bool yagl_func_glTexParameterfv(struct yagl_transport *t) { - const GLuint *textures; - int32_t textures_count; - if (!yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&textures, &textures_count)) { + 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); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteTextures, void*, textures); - (void)yagl_host_glDeleteTextures(textures, textures_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glDepthFunc dispatcher. id = 27 - */ -static bool 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_ENTER_SPLIT3(glTexParameterfv, GLenum, GLenum, void*, target, pname, params); + (void)yagl_host_glTexParameterfv(target, pname, params, params_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glDepthMask dispatcher. id = 28 + * glTexParameteri dispatcher. id = 34 */ -static bool yagl_func_glDepthMask(struct yagl_transport *t) +static bool yagl_func_glTexParameteri(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); + 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); return true; } /* - * glDepthRangef dispatcher. id = 29 + * glTexParameteriv dispatcher. id = 35 */ -static bool yagl_func_glDepthRangef(struct yagl_transport *t) +static bool yagl_func_glTexParameteriv(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); + 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); + if (!yagl_transport_get_out_array(t, sizeof(GLint), (const void**)¶ms, ¶ms_count)) { + return false; + } + 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); return true; } /* - * glDisable dispatcher. id = 30 + * glTexSubImage2D dispatcher. id = 36 */ -static bool 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); - - return true; -} - -/* - * glDrawArrays dispatcher. id = 31 - */ -static bool 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); - - return true; -} - -/* - * glEGLImageTargetTexture2DOES dispatcher. id = 32 - */ -static bool yagl_func_glEGLImageTargetTexture2DOES(struct yagl_transport *t) +static bool yagl_func_glTexSubImage2D(struct yagl_transport *t) { GLenum target; - yagl_host_handle image; + 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); - image = yagl_transport_get_out_yagl_host_handle(t); - YAGL_LOG_FUNC_ENTER_SPLIT2(glEGLImageTargetTexture2DOES, GLenum, yagl_host_handle, target, image); - (void)yagl_host_glEGLImageTargetTexture2DOES(target, image); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glEnable dispatcher. id = 33 - */ -static bool 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); + 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); + if (!yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count)) { + return false; + } + 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); return true; } /* - * glFlush dispatcher. id = 34 + * glClientActiveTexture dispatcher. id = 37 */ -static bool yagl_func_glFlush(struct yagl_transport *t) +static bool yagl_func_glClientActiveTexture(struct yagl_transport *t) { - YAGL_LOG_FUNC_ENTER_SPLIT0(glFlush); - (void)yagl_host_glFlush(); + 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); return true; } /* - * glFramebufferTexture2D dispatcher. id = 35 + * glTexEnvi dispatcher. id = 38 */ -static bool yagl_func_glFramebufferTexture2D(struct yagl_transport *t) +static bool yagl_func_glTexEnvi(struct yagl_transport *t) { GLenum target; - GLenum attachment; - GLenum textarget; - GLuint texture; - GLint level; + GLenum pname; + GLint param; 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); + 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); return true; } /* - * glFramebufferRenderbuffer dispatcher. id = 36 + * glTexEnvf dispatcher. id = 39 */ -static bool yagl_func_glFramebufferRenderbuffer(struct yagl_transport *t) +static bool yagl_func_glTexEnvf(struct yagl_transport *t) { GLenum target; - GLenum attachment; - GLenum renderbuffertarget; - GLuint renderbuffer; + GLenum pname; + GLfloat param; 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); + 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); return true; } /* - * glFrontFace dispatcher. id = 37 + * glMultiTexCoord4f dispatcher. id = 40 */ -static bool yagl_func_glFrontFace(struct yagl_transport *t) +static bool yagl_func_glMultiTexCoord4f(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); + 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); return true; } /* - * glGenBuffers dispatcher. id = 38 + * glTexEnviv dispatcher. id = 41 */ -static bool yagl_func_glGenBuffers(struct yagl_transport *t) +static bool yagl_func_glTexEnviv(struct yagl_transport *t) { - GLuint *buffers; - int32_t buffers_maxcount; - int32_t *buffers_count; - if (!yagl_transport_get_in_array(t, sizeof(GLuint), (void**)&buffers, &buffers_maxcount, &buffers_count)) { + 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); + if (!yagl_transport_get_out_array(t, sizeof(GLint), (const void**)¶ms, ¶ms_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT1(glGenBuffers, void*, buffers); - *buffers_count = 0; - (void)yagl_host_glGenBuffers(buffers, buffers_maxcount, buffers_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); return true; } /* - * glGenerateMipmap dispatcher. id = 39 + * glTexEnvfv dispatcher. id = 42 */ -static bool yagl_func_glGenerateMipmap(struct yagl_transport *t) +static bool 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); - YAGL_LOG_FUNC_ENTER_SPLIT1(glGenerateMipmap, GLenum, target); - (void)yagl_host_glGenerateMipmap(target); + pname = yagl_transport_get_out_GLenum(t); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count)) { + return false; + } + 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); return true; } /* - * glGenFramebuffers dispatcher. id = 40 + * glGetTexEnviv dispatcher. id = 43 */ -static bool yagl_func_glGenFramebuffers(struct yagl_transport *t) +static bool yagl_func_glGetTexEnviv(struct yagl_transport *t) { - GLuint *framebuffers; - int32_t framebuffers_maxcount; - int32_t *framebuffers_count; - if (!yagl_transport_get_in_array(t, sizeof(GLuint), (void**)&framebuffers, &framebuffers_maxcount, &framebuffers_count)) { + 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); + if (!yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT1(glGenFramebuffers, void*, framebuffers); - *framebuffers_count = 0; - (void)yagl_host_glGenFramebuffers(framebuffers, framebuffers_maxcount, framebuffers_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); return true; } /* - * glGenRenderbuffers dispatcher. id = 41 + * glGetTexEnvfv dispatcher. id = 44 */ -static bool yagl_func_glGenRenderbuffers(struct yagl_transport *t) +static bool yagl_func_glGetTexEnvfv(struct yagl_transport *t) { - GLuint *renderbuffers; - int32_t renderbuffers_maxcount; - int32_t *renderbuffers_count; - if (!yagl_transport_get_in_array(t, sizeof(GLuint), (void**)&renderbuffers, &renderbuffers_maxcount, &renderbuffers_count)) { + 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); + if (!yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT1(glGenRenderbuffers, void*, renderbuffers); - *renderbuffers_count = 0; - (void)yagl_host_glGenRenderbuffers(renderbuffers, renderbuffers_maxcount, renderbuffers_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); return true; } /* - * glGenTextures dispatcher. id = 42 + * glGenFramebuffers dispatcher. id = 45 */ -static bool yagl_func_glGenTextures(struct yagl_transport *t) +static bool yagl_func_glGenFramebuffers(struct yagl_transport *t) { - GLuint *textures; - int32_t textures_maxcount; - int32_t *textures_count; - if (!yagl_transport_get_in_array(t, sizeof(GLuint), (void**)&textures, &textures_maxcount, &textures_count)) { + const GLuint *framebuffers; + int32_t framebuffers_count; + if (!yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&framebuffers, &framebuffers_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT1(glGenTextures, void*, textures); - *textures_count = 0; - (void)yagl_host_glGenTextures(textures, textures_maxcount, textures_count); + YAGL_LOG_FUNC_ENTER_SPLIT1(glGenFramebuffers, void*, framebuffers); + (void)yagl_host_glGenFramebuffers(framebuffers, framebuffers_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glGetBooleanv dispatcher. id = 43 + * glBindFramebuffer dispatcher. id = 46 */ -static bool yagl_func_glGetBooleanv(struct yagl_transport *t) +static bool yagl_func_glBindFramebuffer(struct yagl_transport *t) { - GLenum pname; - GLboolean *params; - int32_t params_maxcount; - int32_t *params_count; - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_in_array(t, sizeof(GLboolean), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glGetBooleanv, GLenum, void*, pname, params); - *params_count = 0; - (void)yagl_host_glGetBooleanv(pname, params, params_maxcount, params_count); + 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); return true; } /* - * glGetBufferParameteriv dispatcher. id = 44 + * glFramebufferTexture2D dispatcher. id = 47 */ -static bool yagl_func_glGetBufferParameteriv(struct yagl_transport *t) +static bool yagl_func_glFramebufferTexture2D(struct yagl_transport *t) { GLenum target; - GLenum pname; - GLint *param; + GLenum attachment; + GLenum textarget; + GLuint texture; + GLint level; 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(glGetBufferParameteriv, GLenum, GLenum, void*, target, pname, param); - (void)yagl_host_glGetBufferParameteriv(target, pname, param); + 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); return true; } /* - * glGetError dispatcher. id = 45 + * glFramebufferRenderbuffer dispatcher. id = 48 */ -static bool yagl_func_glGetError(struct yagl_transport *t) +static bool yagl_func_glFramebufferRenderbuffer(struct yagl_transport *t) { - GLenum *retval; - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT0(glGetError); - *retval = yagl_host_glGetError(); - YAGL_LOG_FUNC_EXIT_SPLIT(GLenum, *retval); + 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); return true; } /* - * glGetFloatv dispatcher. id = 46 + * glGenRenderbuffers dispatcher. id = 49 */ -static bool yagl_func_glGetFloatv(struct yagl_transport *t) +static bool yagl_func_glGenRenderbuffers(struct yagl_transport *t) { - GLenum pname; - GLfloat *params; - int32_t params_maxcount; - int32_t *params_count; - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { + const GLuint *renderbuffers; + int32_t renderbuffers_count; + if (!yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&renderbuffers, &renderbuffers_count)) { return false; } - 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_ENTER_SPLIT1(glGenRenderbuffers, void*, renderbuffers); + (void)yagl_host_glGenRenderbuffers(renderbuffers, renderbuffers_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glGetFramebufferAttachmentParameteriv dispatcher. id = 47 + * glBindRenderbuffer dispatcher. id = 50 */ -static bool yagl_func_glGetFramebufferAttachmentParameteriv(struct yagl_transport *t) +static bool yagl_func_glBindRenderbuffer(struct yagl_transport *t) { GLenum target; - GLenum attachment; - GLenum pname; - GLint *param; + GLuint renderbuffer; target = yagl_transport_get_out_GLenum(t); - attachment = 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_SPLIT4(glGetFramebufferAttachmentParameteriv, GLenum, GLenum, GLenum, void*, target, attachment, pname, param); - (void)yagl_host_glGetFramebufferAttachmentParameteriv(target, attachment, pname, param); + 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); return true; } /* - * glGetIntegerv dispatcher. id = 48 + * glRenderbufferStorage dispatcher. id = 51 */ -static bool yagl_func_glGetIntegerv(struct yagl_transport *t) +static bool yagl_func_glRenderbufferStorage(struct yagl_transport *t) { - GLenum pname; - GLint *params; - int32_t params_maxcount; - int32_t *params_count; - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glGetIntegerv, GLenum, void*, pname, params); - *params_count = 0; - (void)yagl_host_glGetIntegerv(pname, params, params_maxcount, params_count); + 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); return true; } /* - * glGetRenderbufferParameteriv dispatcher. id = 49 + * glGetRenderbufferParameteriv dispatcher. id = 52 */ static bool yagl_func_glGetRenderbufferParameteriv(struct yagl_transport *t) { @@ -888,1214 +1092,1558 @@ static bool yagl_func_glGetRenderbufferParameteriv(struct yagl_transport *t) } /* - * glGetTexParameterfv dispatcher. id = 50 + * glCreateProgram dispatcher. id = 53 */ -static bool yagl_func_glGetTexParameterfv(struct yagl_transport *t) +static bool yagl_func_glCreateProgram(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); + 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); return true; } /* - * glGetTexParameteriv dispatcher. id = 51 + * glCreateShader dispatcher. id = 54 */ -static bool yagl_func_glGetTexParameteriv(struct yagl_transport *t) +static bool yagl_func_glCreateShader(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); + 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); return true; } /* - * glHint dispatcher. id = 52 + * glShaderSource dispatcher. id = 55 */ -static bool yagl_func_glHint(struct yagl_transport *t) +static bool yagl_func_glShaderSource(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); + GLuint shader; + const GLchar *string; + int32_t string_count; + shader = yagl_transport_get_out_GLuint(t); + if (!yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&string, &string_count)) { + return false; + } + YAGL_LOG_FUNC_ENTER_SPLIT2(glShaderSource, GLuint, void*, shader, string); + (void)yagl_host_glShaderSource(shader, string, string_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glIsBuffer dispatcher. id = 53 + * glAttachShader dispatcher. id = 56 */ -static bool yagl_func_glIsBuffer(struct yagl_transport *t) +static bool yagl_func_glAttachShader(struct yagl_transport *t) { - GLuint buffer; + 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); + + return true; +} + +/* + * glDetachShader dispatcher. id = 57 + */ +static bool 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); + + return true; +} + +/* + * glCompileShader dispatcher. id = 58 + */ +static bool 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); + + return true; +} + +/* + * glBindAttribLocation dispatcher. id = 59 + */ +static bool 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); + if (!yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count)) { + return false; + } + 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); + + return true; +} + +/* + * glGetActiveAttrib dispatcher. id = 60 + */ +static bool 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; GLboolean *retval; - buffer = yagl_transport_get_out_GLuint(t); + 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); + if (!yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&name, &name_maxcount, &name_count)) { + return false; + } yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(glIsBuffer, GLuint, buffer); - *retval = yagl_host_glIsBuffer(buffer); + YAGL_LOG_FUNC_ENTER_SPLIT5(glGetActiveAttrib, GLuint, GLuint, void*, void*, void*, program, index, size, type, name); + *name_count = 0; + *retval = yagl_host_glGetActiveAttrib(program, index, size, type, name, name_maxcount, name_count); YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval); return true; } /* - * glIsEnabled dispatcher. id = 54 + * glGetActiveUniform dispatcher. id = 61 */ -static bool yagl_func_glIsEnabled(struct yagl_transport *t) +static bool yagl_func_glGetActiveUniform(struct yagl_transport *t) { - GLenum cap; + GLuint program; + GLuint index; + GLint *size; + GLenum *type; + GLchar *name; + int32_t name_maxcount; + int32_t *name_count; GLboolean *retval; - cap = yagl_transport_get_out_GLenum(t); + 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); + if (!yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&name, &name_maxcount, &name_count)) { + return false; + } yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(glIsEnabled, GLenum, cap); - *retval = yagl_host_glIsEnabled(cap); + YAGL_LOG_FUNC_ENTER_SPLIT5(glGetActiveUniform, GLuint, GLuint, void*, void*, void*, program, index, size, type, name); + *name_count = 0; + *retval = yagl_host_glGetActiveUniform(program, index, size, type, name, name_maxcount, name_count); YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval); return true; } /* - * glIsFramebuffer dispatcher. id = 55 + * glGetAttribLocation dispatcher. id = 62 */ -static bool yagl_func_glIsFramebuffer(struct yagl_transport *t) +static bool yagl_func_glGetAttribLocation(struct yagl_transport *t) { - GLuint framebuffer; - GLboolean *retval; - framebuffer = yagl_transport_get_out_GLuint(t); + GLuint program; + const GLchar *name; + int32_t name_count; + int *retval; + program = yagl_transport_get_out_GLuint(t); + if (!yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count)) { + return false; + } yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(glIsFramebuffer, GLuint, framebuffer); - *retval = yagl_host_glIsFramebuffer(framebuffer); - YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *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); return true; } /* - * glIsRenderbuffer dispatcher. id = 56 + * glGetProgramiv dispatcher. id = 63 */ -static bool yagl_func_glIsRenderbuffer(struct yagl_transport *t) +static bool yagl_func_glGetProgramiv(struct yagl_transport *t) { - GLuint renderbuffer; + 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); + + return true; +} + +/* + * glGetProgramInfoLog dispatcher. id = 64 + */ +static bool yagl_func_glGetProgramInfoLog(struct yagl_transport *t) +{ + GLuint program; + GLchar *infolog; + int32_t infolog_maxcount; + int32_t *infolog_count; GLboolean *retval; - renderbuffer = yagl_transport_get_out_GLuint(t); + program = yagl_transport_get_out_GLuint(t); + if (!yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&infolog, &infolog_maxcount, &infolog_count)) { + return false; + } yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(glIsRenderbuffer, GLuint, renderbuffer); - *retval = yagl_host_glIsRenderbuffer(renderbuffer); + 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); return true; } /* - * glIsTexture dispatcher. id = 57 + * glGetShaderiv dispatcher. id = 65 */ -static bool yagl_func_glIsTexture(struct yagl_transport *t) +static bool yagl_func_glGetShaderiv(struct yagl_transport *t) { - GLuint texture; + 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); + + return true; +} + +/* + * glGetShaderInfoLog dispatcher. id = 66 + */ +static bool yagl_func_glGetShaderInfoLog(struct yagl_transport *t) +{ + GLuint shader; + GLchar *infolog; + int32_t infolog_maxcount; + int32_t *infolog_count; GLboolean *retval; - texture = yagl_transport_get_out_GLuint(t); + shader = yagl_transport_get_out_GLuint(t); + if (!yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&infolog, &infolog_maxcount, &infolog_count)) { + return false; + } yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(glIsTexture, GLuint, texture); - *retval = yagl_host_glIsTexture(texture); + 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); return true; } /* - * glLineWidth dispatcher. id = 58 + * glGetUniformfv dispatcher. id = 67 */ -static bool yagl_func_glLineWidth(struct yagl_transport *t) +static bool yagl_func_glGetUniformfv(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); + 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); + if (!yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { + return false; + } + 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); return true; } /* - * glPixelStorei dispatcher. id = 59 + * glGetUniformiv dispatcher. id = 68 */ -static bool yagl_func_glPixelStorei(struct yagl_transport *t) +static bool 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); + if (!yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { + return false; + } + 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); + + return true; +} + +/* + * glGetUniformLocation dispatcher. id = 69 + */ +static bool 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); + if (!yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count)) { + return false; + } + 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); + + return true; +} + +/* + * glGetVertexAttribfv dispatcher. id = 70 + */ +static bool yagl_func_glGetVertexAttribfv(struct yagl_transport *t) +{ + GLuint index; GLenum pname; - GLint param; + GLfloat *params; + int32_t params_maxcount; + int32_t *params_count; + index = yagl_transport_get_out_GLuint(t); 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); + if (!yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { + return false; + } + 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); return true; } /* - * glPolygonOffset dispatcher. id = 60 + * glGetVertexAttribiv dispatcher. id = 71 */ -static bool yagl_func_glPolygonOffset(struct yagl_transport *t) +static bool yagl_func_glGetVertexAttribiv(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); + 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); + if (!yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { + return false; + } + 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); return true; } /* - * glReadPixels dispatcher. id = 61 + * glLinkProgram dispatcher. id = 72 */ -static bool yagl_func_glReadPixels(struct yagl_transport *t) +static bool yagl_func_glLinkProgram(struct yagl_transport *t) +{ + GLuint program; + program = yagl_transport_get_out_GLuint(t); + YAGL_LOG_FUNC_ENTER_SPLIT1(glLinkProgram, GLuint, program); + (void)yagl_host_glLinkProgram(program); + YAGL_LOG_FUNC_EXIT(NULL); + + return true; +} + +/* + * glUniform1f dispatcher. id = 73 + */ +static bool 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); + + return true; +} + +/* + * glUniform1fv dispatcher. id = 74 + */ +static bool 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); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count)) { + return false; + } + 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); + + return true; +} + +/* + * glUniform1i dispatcher. id = 75 + */ +static bool 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); + + return true; +} + +/* + * glUniform1iv dispatcher. id = 76 + */ +static bool 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); + if (!yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count)) { + return false; + } + 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); + + return true; +} + +/* + * glUniform2f dispatcher. id = 77 + */ +static bool 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); + + return true; +} + +/* + * glUniform2fv dispatcher. id = 78 + */ +static bool 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); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count)) { + return false; + } + 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); + + return true; +} + +/* + * glUniform2i dispatcher. id = 79 + */ +static bool yagl_func_glUniform2i(struct yagl_transport *t) { + GLboolean tl; + uint32_t location; GLint x; GLint y; - GLsizei width; - GLsizei height; - GLenum format; - GLenum type; - GLvoid *pixels; - int32_t pixels_maxcount; - int32_t *pixels_count; + 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); - 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); - if (!yagl_transport_get_in_array(t, 1, (void**)&pixels, &pixels_maxcount, &pixels_count)) { + 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); + + return true; +} + +/* + * glUniform2iv dispatcher. id = 80 + */ +static bool 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); + if (!yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count)) { return false; } - 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_ENTER_SPLIT3(glUniform2iv, GLboolean, uint32_t, void*, tl, location, v); + (void)yagl_host_glUniform2iv(tl, location, v, v_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glRenderbufferStorage dispatcher. id = 62 + * glUniform3f dispatcher. id = 81 */ -static bool yagl_func_glRenderbufferStorage(struct yagl_transport *t) +static bool yagl_func_glUniform3f(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); + 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); + + return true; +} + +/* + * glUniform3fv dispatcher. id = 82 + */ +static bool 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); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count)) { + return false; + } + 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); + + return true; +} + +/* + * glUniform3i dispatcher. id = 83 + */ +static bool 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); + + return true; +} + +/* + * glUniform3iv dispatcher. id = 84 + */ +static bool 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); + if (!yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count)) { + return false; + } + 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); return true; } /* - * glSampleCoverage dispatcher. id = 63 + * glUniform4f dispatcher. id = 85 */ -static bool yagl_func_glSampleCoverage(struct yagl_transport *t) +static bool yagl_func_glUniform4f(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); + 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); return true; } /* - * glScissor dispatcher. id = 64 + * glUniform4fv dispatcher. id = 86 */ -static bool yagl_func_glScissor(struct yagl_transport *t) +static bool yagl_func_glUniform4fv(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); + 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); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count)) { + return false; + } + 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); return true; } /* - * glStencilFunc dispatcher. id = 65 + * glUniform4i dispatcher. id = 87 */ -static bool yagl_func_glStencilFunc(struct yagl_transport *t) +static bool yagl_func_glUniform4i(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); + 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); return true; } /* - * glStencilMask dispatcher. id = 66 + * glUniform4iv dispatcher. id = 88 */ -static bool yagl_func_glStencilMask(struct yagl_transport *t) +static bool yagl_func_glUniform4iv(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); + 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); + if (!yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count)) { + return false; + } + 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); return true; } /* - * glStencilOp dispatcher. id = 67 + * glUniformMatrix2fv dispatcher. id = 89 */ -static bool yagl_func_glStencilOp(struct yagl_transport *t) +static bool yagl_func_glUniformMatrix2fv(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); + 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); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count)) { + return false; + } + 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); return true; } /* - * glTexImage2D dispatcher. id = 68 + * glUniformMatrix3fv dispatcher. id = 90 */ -static bool yagl_func_glTexImage2D(struct yagl_transport *t) +static bool yagl_func_glUniformMatrix3fv(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); - if (!yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count)) { + 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); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count)) { return false; } - 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_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); return true; } /* - * glTexParameterf dispatcher. id = 69 + * glUniformMatrix4fv dispatcher. id = 91 */ -static bool yagl_func_glTexParameterf(struct yagl_transport *t) +static bool yagl_func_glUniformMatrix4fv(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); + 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); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count)) { + return false; + } + 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); return true; } /* - * glTexParameterfv dispatcher. id = 70 + * glUseProgram dispatcher. id = 92 */ -static bool yagl_func_glTexParameterfv(struct yagl_transport *t) +static bool yagl_func_glUseProgram(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); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameterfv, GLenum, GLenum, void*, target, pname, params); - (void)yagl_host_glTexParameterfv(target, pname, params, params_count); + 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); return true; } /* - * glTexParameteri dispatcher. id = 71 + * glValidateProgram dispatcher. id = 93 */ -static bool yagl_func_glTexParameteri(struct yagl_transport *t) +static bool yagl_func_glValidateProgram(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); + 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); return true; } /* - * glTexParameteriv dispatcher. id = 72 + * glVertexAttrib1f dispatcher. id = 94 */ -static bool yagl_func_glTexParameteriv(struct yagl_transport *t) +static bool yagl_func_glVertexAttrib1f(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); - if (!yagl_transport_get_out_array(t, sizeof(GLint), (const void**)¶ms, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameteriv, GLenum, GLenum, void*, target, pname, params); - (void)yagl_host_glTexParameteriv(target, pname, params, params_count); + 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); return true; } /* - * glTexSubImage2D dispatcher. id = 73 + * glVertexAttrib1fv dispatcher. id = 95 */ -static bool yagl_func_glTexSubImage2D(struct yagl_transport *t) +static bool yagl_func_glVertexAttrib1fv(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); - if (!yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count)) { + GLuint indx; + const GLfloat *values; + int32_t values_count; + indx = yagl_transport_get_out_GLuint(t); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count)) { return false; } - 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_ENTER_SPLIT2(glVertexAttrib1fv, GLuint, void*, indx, values); + (void)yagl_host_glVertexAttrib1fv(indx, values, values_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glViewport dispatcher. id = 74 + * glVertexAttrib2f dispatcher. id = 96 */ -static bool yagl_func_glViewport(struct yagl_transport *t) +static bool yagl_func_glVertexAttrib2f(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); + 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); return true; } /* - * glTransferArrayYAGL dispatcher. id = 75 + * glVertexAttrib2fv dispatcher. id = 97 */ -static bool yagl_func_glTransferArrayYAGL(struct yagl_transport *t) +static bool yagl_func_glVertexAttrib2fv(struct yagl_transport *t) { GLuint indx; - GLint first; - const GLvoid *data; - int32_t data_count; + const GLfloat *values; + int32_t values_count; indx = yagl_transport_get_out_GLuint(t); - first = yagl_transport_get_out_GLint(t); - if (!yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count)) { + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT3(glTransferArrayYAGL, GLuint, GLint, void*, indx, first, data); - (void)yagl_host_glTransferArrayYAGL(indx, first, data, data_count); + YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib2fv, GLuint, void*, indx, values); + (void)yagl_host_glVertexAttrib2fv(indx, values, values_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glDrawElementsIndicesYAGL dispatcher. id = 76 + * glVertexAttrib3f dispatcher. id = 98 */ -static bool yagl_func_glDrawElementsIndicesYAGL(struct yagl_transport *t) +static bool yagl_func_glVertexAttrib3f(struct yagl_transport *t) { - GLenum mode; - GLenum type; - const GLvoid *indices; - int32_t indices_count; - mode = yagl_transport_get_out_GLenum(t); - type = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_out_array(t, 1, (const void**)&indices, &indices_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT3(glDrawElementsIndicesYAGL, GLenum, GLenum, void*, mode, type, indices); - (void)yagl_host_glDrawElementsIndicesYAGL(mode, type, indices, indices_count); + 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); return true; } /* - * glDrawElementsOffsetYAGL dispatcher. id = 77 + * glVertexAttrib3fv dispatcher. id = 99 */ -static bool yagl_func_glDrawElementsOffsetYAGL(struct yagl_transport *t) +static bool yagl_func_glVertexAttrib3fv(struct yagl_transport *t) { - GLenum mode; - GLenum type; - GLsizei offset; - GLsizei count; - mode = yagl_transport_get_out_GLenum(t); - type = yagl_transport_get_out_GLenum(t); - offset = yagl_transport_get_out_GLsizei(t); - count = yagl_transport_get_out_GLsizei(t); - YAGL_LOG_FUNC_ENTER_SPLIT4(glDrawElementsOffsetYAGL, GLenum, GLenum, GLsizei, GLsizei, mode, type, offset, count); - (void)yagl_host_glDrawElementsOffsetYAGL(mode, type, offset, count); + GLuint indx; + const GLfloat *values; + int32_t values_count; + indx = yagl_transport_get_out_GLuint(t); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count)) { + return false; + } + YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib3fv, GLuint, void*, indx, values); + (void)yagl_host_glVertexAttrib3fv(indx, values, values_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glGetExtensionStringYAGL dispatcher. id = 78 + * glVertexAttrib4f dispatcher. id = 100 */ -static bool yagl_func_glGetExtensionStringYAGL(struct yagl_transport *t) +static bool yagl_func_glVertexAttrib4f(struct yagl_transport *t) { - GLchar *str; - int32_t str_maxcount; - int32_t *str_count; - if (!yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&str, &str_maxcount, &str_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glGetExtensionStringYAGL, void*, str); - *str_count = 0; - (void)yagl_host_glGetExtensionStringYAGL(str, str_maxcount, str_count); + 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); return true; } /* - * glGetVertexAttribRangeYAGL dispatcher. id = 79 + * glVertexAttrib4fv dispatcher. id = 101 */ -static bool yagl_func_glGetVertexAttribRangeYAGL(struct yagl_transport *t) +static bool yagl_func_glVertexAttrib4fv(struct yagl_transport *t) { - GLenum type; - GLsizei offset; - GLsizei count; - GLint *range_first; - GLsizei *range_count; - type = yagl_transport_get_out_GLenum(t); - offset = yagl_transport_get_out_GLsizei(t); - count = yagl_transport_get_out_GLsizei(t); - yagl_transport_get_in_arg(t, (void**)&range_first); - yagl_transport_get_in_arg(t, (void**)&range_count); - YAGL_LOG_FUNC_ENTER_SPLIT5(glGetVertexAttribRangeYAGL, GLenum, GLsizei, GLsizei, void*, void*, type, offset, count, range_first, range_count); - (void)yagl_host_glGetVertexAttribRangeYAGL(type, offset, count, range_first, range_count); + GLuint indx; + const GLfloat *values; + int32_t values_count; + indx = yagl_transport_get_out_GLuint(t); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count)) { + return false; + } + YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib4fv, GLuint, void*, indx, values); + (void)yagl_host_glVertexAttrib4fv(indx, values, values_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glAttachShader dispatcher. id = 80 + * glGetIntegerv dispatcher. id = 102 */ -static bool yagl_func_glAttachShader(struct yagl_transport *t) +static bool yagl_func_glGetIntegerv(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); + GLenum pname; + GLint *params; + int32_t params_maxcount; + int32_t *params_count; + pname = yagl_transport_get_out_GLenum(t); + if (!yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { + return false; + } + 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); return true; } /* - * glBindAttribLocation dispatcher. id = 81 + * glGetFloatv dispatcher. id = 103 */ -static bool yagl_func_glBindAttribLocation(struct yagl_transport *t) +static bool yagl_func_glGetFloatv(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); - if (!yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count)) { + GLenum pname; + GLfloat *params; + int32_t params_maxcount; + int32_t *params_count; + pname = yagl_transport_get_out_GLenum(t); + if (!yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT3(glBindAttribLocation, GLuint, GLuint, void*, program, index, name); - (void)yagl_host_glBindAttribLocation(program, index, name, name_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); return true; } /* - * glBlendColor dispatcher. id = 82 + * glGetString dispatcher. id = 104 */ -static bool yagl_func_glBlendColor(struct yagl_transport *t) +static bool yagl_func_glGetString(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); + GLenum name; + GLchar *str; + int32_t str_maxcount; + int32_t *str_count; + name = yagl_transport_get_out_GLenum(t); + if (!yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&str, &str_maxcount, &str_count)) { + return false; + } + 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); return true; } /* - * glCompileShader dispatcher. id = 83 + * glIsEnabled dispatcher. id = 105 */ -static bool yagl_func_glCompileShader(struct yagl_transport *t) +static bool yagl_func_glIsEnabled(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); + 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); return true; } /* - * glCreateProgram dispatcher. id = 84 + * glDeleteObjects dispatcher. id = 106 */ -static bool yagl_func_glCreateProgram(struct yagl_transport *t) +static bool yagl_func_glDeleteObjects(struct yagl_transport *t) { - GLuint *retval; - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT0(glCreateProgram); - *retval = yagl_host_glCreateProgram(); - YAGL_LOG_FUNC_EXIT_SPLIT(GLuint, *retval); + const GLuint *objects; + int32_t objects_count; + if (!yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&objects, &objects_count)) { + return false; + } + YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteObjects, void*, objects); + (void)yagl_host_glDeleteObjects(objects, objects_count); + YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glCreateShader dispatcher. id = 85 + * glBlendEquation dispatcher. id = 107 */ -static bool yagl_func_glCreateShader(struct yagl_transport *t) +static bool yagl_func_glBlendEquation(struct yagl_transport *t) { - GLenum type; - GLuint *retval; - type = yagl_transport_get_out_GLenum(t); - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(glCreateShader, GLenum, type); - *retval = yagl_host_glCreateShader(type); - YAGL_LOG_FUNC_EXIT_SPLIT(GLuint, *retval); + 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); return true; } /* - * glDeleteProgram dispatcher. id = 86 + * glBlendEquationSeparate dispatcher. id = 108 */ -static bool yagl_func_glDeleteProgram(struct yagl_transport *t) +static bool yagl_func_glBlendEquationSeparate(struct yagl_transport *t) { - GLuint program; - program = yagl_transport_get_out_GLuint(t); - YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteProgram, GLuint, program); - (void)yagl_host_glDeleteProgram(program); + 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); return true; } /* - * glDeleteShader dispatcher. id = 87 + * glBlendFunc dispatcher. id = 109 */ -static bool yagl_func_glDeleteShader(struct yagl_transport *t) +static bool yagl_func_glBlendFunc(struct yagl_transport *t) { - GLuint shader; - shader = yagl_transport_get_out_GLuint(t); - YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteShader, GLuint, shader); - (void)yagl_host_glDeleteShader(shader); + 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); return true; } /* - * glDetachShader dispatcher. id = 88 + * glBlendFuncSeparate dispatcher. id = 110 */ -static bool yagl_func_glDetachShader(struct yagl_transport *t) +static bool yagl_func_glBlendFuncSeparate(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); + 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); return true; } /* - * glDisableVertexAttribArray dispatcher. id = 89 + * glBlendColor dispatcher. id = 111 */ -static bool yagl_func_glDisableVertexAttribArray(struct yagl_transport *t) +static bool yagl_func_glBlendColor(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); + 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); return true; } /* - * glEnableVertexAttribArray dispatcher. id = 90 + * glClear dispatcher. id = 112 */ -static bool yagl_func_glEnableVertexAttribArray(struct yagl_transport *t) +static bool yagl_func_glClear(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); + 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); return true; } /* - * glGetActiveAttrib dispatcher. id = 91 + * glClearColor dispatcher. id = 113 */ -static bool yagl_func_glGetActiveAttrib(struct yagl_transport *t) +static bool yagl_func_glClearColor(struct yagl_transport *t) { - GLuint program; - GLuint index; - GLint *size; - GLenum *type; - GLchar *name; - int32_t name_maxcount; - int32_t *name_count; - 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); - if (!yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&name, &name_maxcount, &name_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT5(glGetActiveAttrib, GLuint, GLuint, void*, void*, void*, program, index, size, type, name); - *name_count = 0; - (void)yagl_host_glGetActiveAttrib(program, index, size, type, name, name_maxcount, name_count); + 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); return true; } /* - * glGetActiveUniform dispatcher. id = 92 + * glClearDepthf dispatcher. id = 114 */ -static bool yagl_func_glGetActiveUniform(struct yagl_transport *t) +static bool yagl_func_glClearDepthf(struct yagl_transport *t) { - GLuint program; - GLuint index; - GLint *size; - GLenum *type; - GLchar *name; - int32_t name_maxcount; - int32_t *name_count; - 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); - if (!yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&name, &name_maxcount, &name_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT5(glGetActiveUniform, GLuint, GLuint, void*, void*, void*, program, index, size, type, name); - *name_count = 0; - (void)yagl_host_glGetActiveUniform(program, index, size, type, name, name_maxcount, name_count); + 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); return true; } /* - * glGetAttachedShaders dispatcher. id = 93 + * glClearStencil dispatcher. id = 115 */ -static bool yagl_func_glGetAttachedShaders(struct yagl_transport *t) +static bool yagl_func_glClearStencil(struct yagl_transport *t) { - GLuint program; - GLuint *shaders; - int32_t shaders_maxcount; - int32_t *shaders_count; - program = yagl_transport_get_out_GLuint(t); - if (!yagl_transport_get_in_array(t, sizeof(GLuint), (void**)&shaders, &shaders_maxcount, &shaders_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glGetAttachedShaders, GLuint, void*, program, shaders); - *shaders_count = 0; - (void)yagl_host_glGetAttachedShaders(program, shaders, shaders_maxcount, shaders_count); + 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); return true; } /* - * glGetAttribLocation dispatcher. id = 94 + * glColorMask dispatcher. id = 116 */ -static bool yagl_func_glGetAttribLocation(struct yagl_transport *t) +static bool yagl_func_glColorMask(struct yagl_transport *t) { - GLuint program; - const GLchar *name; - int32_t name_count; - int *retval; - program = yagl_transport_get_out_GLuint(t); - if (!yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count)) { - return false; - } - 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); + 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); return true; } /* - * glGetProgramiv dispatcher. id = 95 + * glCullFace dispatcher. id = 117 */ -static bool yagl_func_glGetProgramiv(struct yagl_transport *t) +static bool yagl_func_glCullFace(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); + 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); return true; } /* - * glGetProgramInfoLog dispatcher. id = 96 + * glDepthFunc dispatcher. id = 118 */ -static bool yagl_func_glGetProgramInfoLog(struct yagl_transport *t) +static bool yagl_func_glDepthFunc(struct yagl_transport *t) { - GLuint program; - GLchar *infolog; - int32_t infolog_maxcount; - int32_t *infolog_count; - program = yagl_transport_get_out_GLuint(t); - if (!yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&infolog, &infolog_maxcount, &infolog_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glGetProgramInfoLog, GLuint, void*, program, infolog); - *infolog_count = 0; - (void)yagl_host_glGetProgramInfoLog(program, infolog, infolog_maxcount, infolog_count); + 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); return true; } /* - * glGetShaderiv dispatcher. id = 97 + * glDepthMask dispatcher. id = 119 */ -static bool yagl_func_glGetShaderiv(struct yagl_transport *t) +static bool yagl_func_glDepthMask(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); + 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); return true; } /* - * glGetShaderInfoLog dispatcher. id = 98 + * glDepthRangef dispatcher. id = 120 */ -static bool yagl_func_glGetShaderInfoLog(struct yagl_transport *t) +static bool yagl_func_glDepthRangef(struct yagl_transport *t) { - GLuint shader; - GLchar *infolog; - int32_t infolog_maxcount; - int32_t *infolog_count; - shader = yagl_transport_get_out_GLuint(t); - if (!yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&infolog, &infolog_maxcount, &infolog_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glGetShaderInfoLog, GLuint, void*, shader, infolog); - *infolog_count = 0; - (void)yagl_host_glGetShaderInfoLog(shader, infolog, infolog_maxcount, infolog_count); + 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); return true; } /* - * glGetShaderPrecisionFormat dispatcher. id = 99 + * glEnable dispatcher. id = 121 */ -static bool yagl_func_glGetShaderPrecisionFormat(struct yagl_transport *t) +static bool yagl_func_glEnable(struct yagl_transport *t) { - GLenum shadertype; - GLenum precisiontype; - GLint *range; - int32_t range_maxcount; - int32_t *range_count; - GLint *precision; - shadertype = yagl_transport_get_out_GLenum(t); - precisiontype = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_in_array(t, sizeof(GLint), (void**)&range, &range_maxcount, &range_count)) { - return false; - } - yagl_transport_get_in_arg(t, (void**)&precision); - YAGL_LOG_FUNC_ENTER_SPLIT4(glGetShaderPrecisionFormat, GLenum, GLenum, void*, void*, shadertype, precisiontype, range, precision); - *range_count = 0; - (void)yagl_host_glGetShaderPrecisionFormat(shadertype, precisiontype, range, range_maxcount, range_count, precision); + 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); return true; } /* - * glGetShaderSource dispatcher. id = 100 + * glDisable dispatcher. id = 122 */ -static bool yagl_func_glGetShaderSource(struct yagl_transport *t) +static bool yagl_func_glDisable(struct yagl_transport *t) { - GLuint shader; - GLchar *source; - int32_t source_maxcount; - int32_t *source_count; - shader = yagl_transport_get_out_GLuint(t); - if (!yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&source, &source_maxcount, &source_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glGetShaderSource, GLuint, void*, shader, source); - *source_count = 0; - (void)yagl_host_glGetShaderSource(shader, source, source_maxcount, source_count); + 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); return true; } /* - * glGetUniformfv dispatcher. id = 101 + * glFlush dispatcher. id = 123 */ -static bool yagl_func_glGetUniformfv(struct yagl_transport *t) +static bool yagl_func_glFlush(struct yagl_transport *t) { - GLuint program; - GLint location; - GLfloat *params; - int32_t params_maxcount; - int32_t *params_count; - program = yagl_transport_get_out_GLuint(t); - location = yagl_transport_get_out_GLint(t); - if (!yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT3(glGetUniformfv, GLuint, GLint, void*, program, location, params); - *params_count = 0; - (void)yagl_host_glGetUniformfv(program, location, params, params_maxcount, params_count); + YAGL_LOG_FUNC_ENTER_SPLIT0(glFlush); + (void)yagl_host_glFlush(); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glGetUniformiv dispatcher. id = 102 + * glFrontFace dispatcher. id = 124 */ -static bool yagl_func_glGetUniformiv(struct yagl_transport *t) +static bool yagl_func_glFrontFace(struct yagl_transport *t) { - GLuint program; - GLint location; - GLint *params; - int32_t params_maxcount; - int32_t *params_count; - program = yagl_transport_get_out_GLuint(t); - location = yagl_transport_get_out_GLint(t); - if (!yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT3(glGetUniformiv, GLuint, GLint, void*, program, location, params); - *params_count = 0; - (void)yagl_host_glGetUniformiv(program, location, params, params_maxcount, params_count); + 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); return true; } /* - * glGetUniformLocation dispatcher. id = 103 + * glGenerateMipmap dispatcher. id = 125 */ -static bool yagl_func_glGetUniformLocation(struct yagl_transport *t) +static bool yagl_func_glGenerateMipmap(struct yagl_transport *t) { - GLuint program; - const GLchar *name; - int32_t name_count; - int *retval; - program = yagl_transport_get_out_GLuint(t); - if (!yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count)) { - return false; - } - 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); + 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); return true; } /* - * glGetVertexAttribfv dispatcher. id = 104 + * glHint dispatcher. id = 126 */ -static bool yagl_func_glGetVertexAttribfv(struct yagl_transport *t) +static bool yagl_func_glHint(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); - if (!yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - 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); + 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); return true; } /* - * glGetVertexAttribiv dispatcher. id = 105 + * glLineWidth dispatcher. id = 127 */ -static bool yagl_func_glGetVertexAttribiv(struct yagl_transport *t) +static bool yagl_func_glLineWidth(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); - if (!yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - 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); + 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); return true; } /* - * glGetVertexAttribPointerv dispatcher. id = 106 + * glPixelStorei dispatcher. id = 128 */ -static bool yagl_func_glGetVertexAttribPointerv(struct yagl_transport *t) +static bool yagl_func_glPixelStorei(struct yagl_transport *t) { - GLuint index; GLenum pname; - target_ulong *pointer; - index = yagl_transport_get_out_GLuint(t); + GLint param; pname = yagl_transport_get_out_GLenum(t); - yagl_transport_get_in_arg(t, (void**)&pointer); - YAGL_LOG_FUNC_ENTER_SPLIT3(glGetVertexAttribPointerv, GLuint, GLenum, target_ulong*, index, pname, pointer); - (void)yagl_host_glGetVertexAttribPointerv(index, pname, pointer); + 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); return true; } /* - * glIsProgram dispatcher. id = 107 + * glPolygonOffset dispatcher. id = 129 */ -static bool yagl_func_glIsProgram(struct yagl_transport *t) +static bool yagl_func_glPolygonOffset(struct yagl_transport *t) { - GLuint program; - GLboolean *retval; - program = yagl_transport_get_out_GLuint(t); - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(glIsProgram, GLuint, program); - *retval = yagl_host_glIsProgram(program); - YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval); + 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); return true; } /* - * glIsShader dispatcher. id = 108 + * glScissor dispatcher. id = 130 */ -static bool yagl_func_glIsShader(struct yagl_transport *t) +static bool yagl_func_glScissor(struct yagl_transport *t) { - GLuint shader; - GLboolean *retval; - shader = yagl_transport_get_out_GLuint(t); - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(glIsShader, GLuint, shader); - *retval = yagl_host_glIsShader(shader); - YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval); + 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); return true; } /* - * glLinkProgram dispatcher. id = 109 + * glStencilFunc dispatcher. id = 131 */ -static bool yagl_func_glLinkProgram(struct yagl_transport *t) +static bool 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); + + return true; +} + +/* + * glStencilMask dispatcher. id = 132 + */ +static bool yagl_func_glStencilMask(struct yagl_transport *t) { - GLuint program; - program = yagl_transport_get_out_GLuint(t); - YAGL_LOG_FUNC_ENTER_SPLIT1(glLinkProgram, GLuint, program); - (void)yagl_host_glLinkProgram(program); + 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); return true; } /* - * glReleaseShaderCompiler dispatcher. id = 110 + * glStencilOp dispatcher. id = 133 */ -static bool yagl_func_glReleaseShaderCompiler(struct yagl_transport *t) +static bool yagl_func_glStencilOp(struct yagl_transport *t) { - YAGL_LOG_FUNC_ENTER_SPLIT0(glReleaseShaderCompiler); - (void)yagl_host_glReleaseShaderCompiler(); + 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); return true; } /* - * glShaderBinary dispatcher. id = 111 + * glSampleCoverage dispatcher. id = 134 */ -static bool yagl_func_glShaderBinary(struct yagl_transport *t) +static bool yagl_func_glSampleCoverage(struct yagl_transport *t) { - const GLuint *shaders; - int32_t shaders_count; - GLenum binaryformat; - const GLvoid *binary; - int32_t binary_count; - if (!yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&shaders, &shaders_count)) { - return false; - } - binaryformat = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_out_array(t, 1, (const void**)&binary, &binary_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT3(glShaderBinary, void*, GLenum, void*, shaders, binaryformat, binary); - (void)yagl_host_glShaderBinary(shaders, shaders_count, binaryformat, binary, binary_count); + 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); return true; } /* - * glShaderSource dispatcher. id = 112 + * glViewport dispatcher. id = 135 */ -static bool yagl_func_glShaderSource(struct yagl_transport *t) +static bool yagl_func_glViewport(struct yagl_transport *t) { - GLuint shader; - const GLchar *string; - int32_t string_count; - shader = yagl_transport_get_out_GLuint(t); - if (!yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&string, &string_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glShaderSource, GLuint, void*, shader, string); - (void)yagl_host_glShaderSource(shader, string, string_count); + 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); return true; } /* - * glStencilFuncSeparate dispatcher. id = 113 + * glStencilFuncSeparate dispatcher. id = 136 */ static bool yagl_func_glStencilFuncSeparate(struct yagl_transport *t) { @@ -2115,7 +2663,7 @@ static bool yagl_func_glStencilFuncSeparate(struct yagl_transport *t) } /* - * glStencilMaskSeparate dispatcher. id = 114 + * glStencilMaskSeparate dispatcher. id = 137 */ static bool yagl_func_glStencilMaskSeparate(struct yagl_transport *t) { @@ -2131,7 +2679,7 @@ static bool yagl_func_glStencilMaskSeparate(struct yagl_transport *t) } /* - * glStencilOpSeparate dispatcher. id = 115 + * glStencilOpSeparate dispatcher. id = 138 */ static bool yagl_func_glStencilOpSeparate(struct yagl_transport *t) { @@ -2151,694 +2699,716 @@ static bool yagl_func_glStencilOpSeparate(struct yagl_transport *t) } /* - * glUniform1f dispatcher. id = 116 + * glPointSize dispatcher. id = 139 */ -static bool yagl_func_glUniform1f(struct yagl_transport *t) +static bool yagl_func_glPointSize(struct yagl_transport *t) { - GLint location; - GLfloat x; - location = yagl_transport_get_out_GLint(t); - x = yagl_transport_get_out_GLfloat(t); - YAGL_LOG_FUNC_ENTER_SPLIT2(glUniform1f, GLint, GLfloat, location, x); - (void)yagl_host_glUniform1f(location, x); + 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); return true; } /* - * glUniform1fv dispatcher. id = 117 + * glAlphaFunc dispatcher. id = 140 */ -static bool yagl_func_glUniform1fv(struct yagl_transport *t) +static bool yagl_func_glAlphaFunc(struct yagl_transport *t) { - GLint location; - const GLfloat *v; - int32_t v_count; - location = yagl_transport_get_out_GLint(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glUniform1fv, GLint, void*, location, v); - (void)yagl_host_glUniform1fv(location, v, v_count); + 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); return true; } /* - * glUniform1i dispatcher. id = 118 + * glMatrixMode dispatcher. id = 141 */ -static bool yagl_func_glUniform1i(struct yagl_transport *t) +static bool yagl_func_glMatrixMode(struct yagl_transport *t) { - GLint location; - GLint x; - location = yagl_transport_get_out_GLint(t); - x = yagl_transport_get_out_GLint(t); - YAGL_LOG_FUNC_ENTER_SPLIT2(glUniform1i, GLint, GLint, location, x); - (void)yagl_host_glUniform1i(location, x); + 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); return true; } /* - * glUniform1iv dispatcher. id = 119 + * glLoadIdentity dispatcher. id = 142 */ -static bool yagl_func_glUniform1iv(struct yagl_transport *t) +static bool yagl_func_glLoadIdentity(struct yagl_transport *t) { - GLint location; - const GLint *v; - int32_t v_count; - location = yagl_transport_get_out_GLint(t); - if (!yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glUniform1iv, GLint, void*, location, v); - (void)yagl_host_glUniform1iv(location, v, v_count); + YAGL_LOG_FUNC_ENTER_SPLIT0(glLoadIdentity); + (void)yagl_host_glLoadIdentity(); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glUniform2f dispatcher. id = 120 + * glPopMatrix dispatcher. id = 143 */ -static bool yagl_func_glUniform2f(struct yagl_transport *t) +static bool yagl_func_glPopMatrix(struct yagl_transport *t) { - GLint location; - GLfloat x; - GLfloat y; - location = yagl_transport_get_out_GLint(t); - x = yagl_transport_get_out_GLfloat(t); - y = yagl_transport_get_out_GLfloat(t); - YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform2f, GLint, GLfloat, GLfloat, location, x, y); - (void)yagl_host_glUniform2f(location, x, y); + YAGL_LOG_FUNC_ENTER_SPLIT0(glPopMatrix); + (void)yagl_host_glPopMatrix(); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glUniform2fv dispatcher. id = 121 + * glPushMatrix dispatcher. id = 144 */ -static bool yagl_func_glUniform2fv(struct yagl_transport *t) +static bool yagl_func_glPushMatrix(struct yagl_transport *t) { - GLint location; - const GLfloat *v; - int32_t v_count; - location = yagl_transport_get_out_GLint(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glUniform2fv, GLint, void*, location, v); - (void)yagl_host_glUniform2fv(location, v, v_count); + YAGL_LOG_FUNC_ENTER_SPLIT0(glPushMatrix); + (void)yagl_host_glPushMatrix(); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glUniform2i dispatcher. id = 122 + * glRotatef dispatcher. id = 145 */ -static bool yagl_func_glUniform2i(struct yagl_transport *t) +static bool yagl_func_glRotatef(struct yagl_transport *t) { - GLint location; - GLint x; - GLint y; - location = yagl_transport_get_out_GLint(t); - x = yagl_transport_get_out_GLint(t); - y = yagl_transport_get_out_GLint(t); - YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform2i, GLint, GLint, GLint, location, x, y); - (void)yagl_host_glUniform2i(location, x, y); + 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); return true; } /* - * glUniform2iv dispatcher. id = 123 + * glTranslatef dispatcher. id = 146 */ -static bool yagl_func_glUniform2iv(struct yagl_transport *t) +static bool yagl_func_glTranslatef(struct yagl_transport *t) { - GLint location; - const GLint *v; - int32_t v_count; - location = yagl_transport_get_out_GLint(t); - if (!yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glUniform2iv, GLint, void*, location, v); - (void)yagl_host_glUniform2iv(location, v, v_count); + 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); return true; } /* - * glUniform3f dispatcher. id = 124 + * glScalef dispatcher. id = 147 */ -static bool yagl_func_glUniform3f(struct yagl_transport *t) +static bool yagl_func_glScalef(struct yagl_transport *t) { - GLint location; GLfloat x; GLfloat y; GLfloat z; - location = yagl_transport_get_out_GLint(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(glUniform3f, GLint, GLfloat, GLfloat, GLfloat, location, x, y, z); - (void)yagl_host_glUniform3f(location, x, y, z); + YAGL_LOG_FUNC_ENTER_SPLIT3(glScalef, GLfloat, GLfloat, GLfloat, x, y, z); + (void)yagl_host_glScalef(x, y, z); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glUniform3fv dispatcher. id = 125 + * glOrthof dispatcher. id = 148 */ -static bool yagl_func_glUniform3fv(struct yagl_transport *t) +static bool yagl_func_glOrthof(struct yagl_transport *t) { - GLint location; - const GLfloat *v; - int32_t v_count; - location = yagl_transport_get_out_GLint(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glUniform3fv, GLint, void*, location, v); - (void)yagl_host_glUniform3fv(location, v, v_count); + 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); return true; } /* - * glUniform3i dispatcher. id = 126 + * glColor4f dispatcher. id = 149 */ -static bool yagl_func_glUniform3i(struct yagl_transport *t) +static bool yagl_func_glColor4f(struct yagl_transport *t) { - GLint location; - GLint x; - GLint y; - GLint z; - location = yagl_transport_get_out_GLint(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_SPLIT4(glUniform3i, GLint, GLint, GLint, GLint, location, x, y, z); - (void)yagl_host_glUniform3i(location, x, y, z); + 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); return true; } /* - * glUniform3iv dispatcher. id = 127 + * glColor4ub dispatcher. id = 150 */ -static bool yagl_func_glUniform3iv(struct yagl_transport *t) +static bool yagl_func_glColor4ub(struct yagl_transport *t) { - GLint location; - const GLint *v; - int32_t v_count; - location = yagl_transport_get_out_GLint(t); - if (!yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count)) { + 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); + + return true; +} + +/* + * glNormal3f dispatcher. id = 151 + */ +static bool 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); + + return true; +} + +/* + * glPointParameterf dispatcher. id = 152 + */ +static bool 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); + + return true; +} + +/* + * glPointParameterfv dispatcher. id = 153 + */ +static bool yagl_func_glPointParameterfv(struct yagl_transport *t) +{ + GLenum pname; + const GLfloat *params; + int32_t params_count; + pname = yagl_transport_get_out_GLenum(t); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT2(glUniform3iv, GLint, void*, location, v); - (void)yagl_host_glUniform3iv(location, v, v_count); + YAGL_LOG_FUNC_ENTER_SPLIT2(glPointParameterfv, GLenum, void*, pname, params); + (void)yagl_host_glPointParameterfv(pname, params, params_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glUniform4f dispatcher. id = 128 + * glFogf dispatcher. id = 154 */ -static bool yagl_func_glUniform4f(struct yagl_transport *t) +static bool yagl_func_glFogf(struct yagl_transport *t) { - GLint location; - GLfloat x; - GLfloat y; - GLfloat z; - GLfloat w; - location = yagl_transport_get_out_GLint(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(glUniform4f, GLint, GLfloat, GLfloat, GLfloat, GLfloat, location, x, y, z, w); - (void)yagl_host_glUniform4f(location, x, y, z, w); + 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); return true; } /* - * glUniform4fv dispatcher. id = 129 + * glFogfv dispatcher. id = 155 */ -static bool yagl_func_glUniform4fv(struct yagl_transport *t) +static bool yagl_func_glFogfv(struct yagl_transport *t) { - GLint location; - const GLfloat *v; - int32_t v_count; - location = yagl_transport_get_out_GLint(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count)) { + GLenum pname; + const GLfloat *params; + int32_t params_count; + pname = yagl_transport_get_out_GLenum(t); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT2(glUniform4fv, GLint, void*, location, v); - (void)yagl_host_glUniform4fv(location, v, v_count); + YAGL_LOG_FUNC_ENTER_SPLIT2(glFogfv, GLenum, void*, pname, params); + (void)yagl_host_glFogfv(pname, params, params_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glUniform4i dispatcher. id = 130 + * glFrustumf dispatcher. id = 156 */ -static bool yagl_func_glUniform4i(struct yagl_transport *t) +static bool yagl_func_glFrustumf(struct yagl_transport *t) { - GLint location; - GLint x; - GLint y; - GLint z; - GLint w; - location = yagl_transport_get_out_GLint(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_SPLIT5(glUniform4i, GLint, GLint, GLint, GLint, GLint, location, x, y, z, w); - (void)yagl_host_glUniform4i(location, x, y, z, w); + 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); return true; } /* - * glUniform4iv dispatcher. id = 131 + * glLightf dispatcher. id = 157 */ -static bool yagl_func_glUniform4iv(struct yagl_transport *t) +static bool yagl_func_glLightf(struct yagl_transport *t) { - GLint location; - const GLint *v; - int32_t v_count; - location = yagl_transport_get_out_GLint(t); - if (!yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count)) { + 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); + + return true; +} + +/* + * glLightfv dispatcher. id = 158 + */ +static bool 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); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT2(glUniform4iv, GLint, void*, location, v); - (void)yagl_host_glUniform4iv(location, v, v_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); return true; } /* - * glUniformMatrix2fv dispatcher. id = 132 + * glGetLightfv dispatcher. id = 159 */ -static bool yagl_func_glUniformMatrix2fv(struct yagl_transport *t) +static bool yagl_func_glGetLightfv(struct yagl_transport *t) { - GLint location; - GLboolean transpose; - const GLfloat *value; - int32_t value_count; - location = yagl_transport_get_out_GLint(t); - transpose = yagl_transport_get_out_GLboolean(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count)) { + 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); + if (!yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT3(glUniformMatrix2fv, GLint, GLboolean, void*, location, transpose, value); - (void)yagl_host_glUniformMatrix2fv(location, transpose, value, value_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); return true; } /* - * glUniformMatrix3fv dispatcher. id = 133 + * glLightModelf dispatcher. id = 160 */ -static bool yagl_func_glUniformMatrix3fv(struct yagl_transport *t) +static bool yagl_func_glLightModelf(struct yagl_transport *t) { - GLint location; - GLboolean transpose; - const GLfloat *value; - int32_t value_count; - location = yagl_transport_get_out_GLint(t); - transpose = yagl_transport_get_out_GLboolean(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count)) { + 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); + + return true; +} + +/* + * glLightModelfv dispatcher. id = 161 + */ +static bool yagl_func_glLightModelfv(struct yagl_transport *t) +{ + GLenum pname; + const GLfloat *params; + int32_t params_count; + pname = yagl_transport_get_out_GLenum(t); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT3(glUniformMatrix3fv, GLint, GLboolean, void*, location, transpose, value); - (void)yagl_host_glUniformMatrix3fv(location, transpose, value, value_count); + YAGL_LOG_FUNC_ENTER_SPLIT2(glLightModelfv, GLenum, void*, pname, params); + (void)yagl_host_glLightModelfv(pname, params, params_count); + YAGL_LOG_FUNC_EXIT(NULL); + + return true; +} + +/* + * glMaterialf dispatcher. id = 162 + */ +static bool 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); return true; } /* - * glUniformMatrix4fv dispatcher. id = 134 + * glMaterialfv dispatcher. id = 163 */ -static bool yagl_func_glUniformMatrix4fv(struct yagl_transport *t) +static bool yagl_func_glMaterialfv(struct yagl_transport *t) { - GLint location; - GLboolean transpose; - const GLfloat *value; - int32_t value_count; - location = yagl_transport_get_out_GLint(t); - transpose = yagl_transport_get_out_GLboolean(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count)) { + 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); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT3(glUniformMatrix4fv, GLint, GLboolean, void*, location, transpose, value); - (void)yagl_host_glUniformMatrix4fv(location, transpose, value, value_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); return true; } /* - * glUseProgram dispatcher. id = 135 + * glGetMaterialfv dispatcher. id = 164 */ -static bool yagl_func_glUseProgram(struct yagl_transport *t) +static bool yagl_func_glGetMaterialfv(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); + 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); + if (!yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { + return false; + } + 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); return true; } /* - * glValidateProgram dispatcher. id = 136 + * glShadeModel dispatcher. id = 165 */ -static bool yagl_func_glValidateProgram(struct yagl_transport *t) +static bool yagl_func_glShadeModel(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); + 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); return true; } /* - * glVertexAttrib1f dispatcher. id = 137 + * glLogicOp dispatcher. id = 166 */ -static bool yagl_func_glVertexAttrib1f(struct yagl_transport *t) +static bool yagl_func_glLogicOp(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); + 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); return true; } /* - * glVertexAttrib1fv dispatcher. id = 138 + * glMultMatrixf dispatcher. id = 167 */ -static bool yagl_func_glVertexAttrib1fv(struct yagl_transport *t) +static bool yagl_func_glMultMatrixf(struct yagl_transport *t) { - GLuint indx; - const GLfloat *values; - int32_t values_count; - indx = yagl_transport_get_out_GLuint(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count)) { + const GLfloat *m; + int32_t m_count; + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&m, &m_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib1fv, GLuint, void*, indx, values); - (void)yagl_host_glVertexAttrib1fv(indx, values, values_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glVertexAttrib2f dispatcher. id = 139 - */ -static bool 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_ENTER_SPLIT1(glMultMatrixf, void*, m); + (void)yagl_host_glMultMatrixf(m, m_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glVertexAttrib2fv dispatcher. id = 140 + * glLoadMatrixf dispatcher. id = 168 */ -static bool yagl_func_glVertexAttrib2fv(struct yagl_transport *t) +static bool yagl_func_glLoadMatrixf(struct yagl_transport *t) { - GLuint indx; - const GLfloat *values; - int32_t values_count; - indx = yagl_transport_get_out_GLuint(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count)) { + const GLfloat *m; + int32_t m_count; + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&m, &m_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib2fv, GLuint, void*, indx, values); - (void)yagl_host_glVertexAttrib2fv(indx, values, values_count); + YAGL_LOG_FUNC_ENTER_SPLIT1(glLoadMatrixf, void*, m); + (void)yagl_host_glLoadMatrixf(m, m_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glVertexAttrib3f dispatcher. id = 141 + * glClipPlanef dispatcher. id = 169 */ -static bool yagl_func_glVertexAttrib3f(struct yagl_transport *t) +static bool yagl_func_glClipPlanef(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); + GLenum plane; + const GLfloat *equation; + int32_t equation_count; + plane = yagl_transport_get_out_GLenum(t); + if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&equation, &equation_count)) { + return false; + } + YAGL_LOG_FUNC_ENTER_SPLIT2(glClipPlanef, GLenum, void*, plane, equation); + (void)yagl_host_glClipPlanef(plane, equation, equation_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } /* - * glVertexAttrib3fv dispatcher. id = 142 + * glGetClipPlanef dispatcher. id = 170 */ -static bool yagl_func_glVertexAttrib3fv(struct yagl_transport *t) +static bool yagl_func_glGetClipPlanef(struct yagl_transport *t) { - GLuint indx; - const GLfloat *values; - int32_t values_count; - indx = yagl_transport_get_out_GLuint(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count)) { + GLenum pname; + GLfloat *eqn; + int32_t eqn_maxcount; + int32_t *eqn_count; + pname = yagl_transport_get_out_GLenum(t); + if (!yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)&eqn, &eqn_maxcount, &eqn_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib3fv, GLuint, void*, indx, values); - (void)yagl_host_glVertexAttrib3fv(indx, values, values_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); return true; } /* - * glVertexAttrib4f dispatcher. id = 143 + * glUpdateOffscreenImageYAGL dispatcher. id = 171 */ -static bool yagl_func_glVertexAttrib4f(struct yagl_transport *t) +static bool yagl_func_glUpdateOffscreenImageYAGL(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); + 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); + if (!yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count)) { + return false; + } + 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); return true; } /* - * glVertexAttrib4fv dispatcher. id = 144 + * glGenUniformLocationYAGL dispatcher. id = 172 */ -static bool yagl_func_glVertexAttrib4fv(struct yagl_transport *t) +static bool yagl_func_glGenUniformLocationYAGL(struct yagl_transport *t) { - GLuint indx; - const GLfloat *values; - int32_t values_count; - indx = yagl_transport_get_out_GLuint(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count)) { + 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); + if (!yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count)) { return false; } - YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib4fv, GLuint, void*, indx, values); - (void)yagl_host_glVertexAttrib4fv(indx, values, values_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); return true; } /* - * glVertexAttribPointer dispatcher. id = 145 + * glDeleteUniformLocationsYAGL dispatcher. id = 173 */ -static bool yagl_func_glVertexAttribPointer(struct yagl_transport *t) +static bool yagl_func_glDeleteUniformLocationsYAGL(struct yagl_transport *t) { - GLuint indx; - GLint size; - GLenum type; - GLboolean normalized; - GLsizei stride; - target_ulong ptr; - 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); - ptr = yagl_transport_get_out_va(t); - YAGL_LOG_FUNC_ENTER_SPLIT6(glVertexAttribPointer, GLuint, GLint, GLenum, GLboolean, GLsizei, target_ulong, indx, size, type, normalized, stride, ptr); - (void)yagl_host_glVertexAttribPointer(indx, size, type, normalized, stride, ptr); + const uint32_t *locations; + int32_t locations_count; + if (!yagl_transport_get_out_array(t, sizeof(uint32_t), (const void**)&locations, &locations_count)) { + return false; + } + YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteUniformLocationsYAGL, void*, locations); + (void)yagl_host_glDeleteUniformLocationsYAGL(locations, locations_count); YAGL_LOG_FUNC_EXIT(NULL); return true; } -const uint32_t yagl_gles2_api_num_funcs = 145; +const uint32_t yagl_gles_api_num_funcs = 173; -yagl_api_func yagl_gles2_api_funcs[] = { - &yagl_func_glActiveTexture, +yagl_api_func yagl_gles_api_funcs[] = { + &yagl_func_glDrawArrays, + &yagl_func_glDrawElements, + &yagl_func_glReadPixels, + &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_glGenBuffers, &yagl_func_glBindBuffer, - &yagl_func_glBindFramebuffer, - &yagl_func_glBindRenderbuffer, - &yagl_func_glBindTexture, - &yagl_func_glBlendEquation, - &yagl_func_glBlendEquationSeparate, - &yagl_func_glBlendFunc, - &yagl_func_glBlendFuncSeparate, &yagl_func_glBufferData, &yagl_func_glBufferSubData, - &yagl_func_glCheckFramebufferStatus, - &yagl_func_glClear, - &yagl_func_glClearColor, - &yagl_func_glClearDepthf, - &yagl_func_glClearStencil, - &yagl_func_glColorMask, + &yagl_func_glGenTextures, + &yagl_func_glBindTexture, + &yagl_func_glActiveTexture, &yagl_func_glCompressedTexImage2D, &yagl_func_glCompressedTexSubImage2D, &yagl_func_glCopyTexImage2D, &yagl_func_glCopyTexSubImage2D, - &yagl_func_glCullFace, - &yagl_func_glDeleteBuffers, - &yagl_func_glDeleteFramebuffers, - &yagl_func_glDeleteRenderbuffers, - &yagl_func_glDeleteTextures, - &yagl_func_glDepthFunc, - &yagl_func_glDepthMask, - &yagl_func_glDepthRangef, - &yagl_func_glDisable, - &yagl_func_glDrawArrays, - &yagl_func_glEGLImageTargetTexture2DOES, - &yagl_func_glEnable, - &yagl_func_glFlush, - &yagl_func_glFramebufferTexture2D, - &yagl_func_glFramebufferRenderbuffer, - &yagl_func_glFrontFace, - &yagl_func_glGenBuffers, - &yagl_func_glGenerateMipmap, - &yagl_func_glGenFramebuffers, - &yagl_func_glGenRenderbuffers, - &yagl_func_glGenTextures, - &yagl_func_glGetBooleanv, - &yagl_func_glGetBufferParameteriv, - &yagl_func_glGetError, - &yagl_func_glGetFloatv, - &yagl_func_glGetFramebufferAttachmentParameteriv, - &yagl_func_glGetIntegerv, - &yagl_func_glGetRenderbufferParameteriv, &yagl_func_glGetTexParameterfv, &yagl_func_glGetTexParameteriv, - &yagl_func_glHint, - &yagl_func_glIsBuffer, - &yagl_func_glIsEnabled, - &yagl_func_glIsFramebuffer, - &yagl_func_glIsRenderbuffer, - &yagl_func_glIsTexture, - &yagl_func_glLineWidth, - &yagl_func_glPixelStorei, - &yagl_func_glPolygonOffset, - &yagl_func_glReadPixels, - &yagl_func_glRenderbufferStorage, - &yagl_func_glSampleCoverage, - &yagl_func_glScissor, - &yagl_func_glStencilFunc, - &yagl_func_glStencilMask, - &yagl_func_glStencilOp, &yagl_func_glTexImage2D, &yagl_func_glTexParameterf, &yagl_func_glTexParameterfv, &yagl_func_glTexParameteri, &yagl_func_glTexParameteriv, &yagl_func_glTexSubImage2D, - &yagl_func_glViewport, - &yagl_func_glTransferArrayYAGL, - &yagl_func_glDrawElementsIndicesYAGL, - &yagl_func_glDrawElementsOffsetYAGL, - &yagl_func_glGetExtensionStringYAGL, - &yagl_func_glGetVertexAttribRangeYAGL, - &yagl_func_glAttachShader, - &yagl_func_glBindAttribLocation, - &yagl_func_glBlendColor, - &yagl_func_glCompileShader, + &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_glGenRenderbuffers, + &yagl_func_glBindRenderbuffer, + &yagl_func_glRenderbufferStorage, + &yagl_func_glGetRenderbufferParameteriv, &yagl_func_glCreateProgram, &yagl_func_glCreateShader, - &yagl_func_glDeleteProgram, - &yagl_func_glDeleteShader, + &yagl_func_glShaderSource, + &yagl_func_glAttachShader, &yagl_func_glDetachShader, - &yagl_func_glDisableVertexAttribArray, - &yagl_func_glEnableVertexAttribArray, + &yagl_func_glCompileShader, + &yagl_func_glBindAttribLocation, &yagl_func_glGetActiveAttrib, &yagl_func_glGetActiveUniform, - &yagl_func_glGetAttachedShaders, &yagl_func_glGetAttribLocation, &yagl_func_glGetProgramiv, &yagl_func_glGetProgramInfoLog, &yagl_func_glGetShaderiv, &yagl_func_glGetShaderInfoLog, - &yagl_func_glGetShaderPrecisionFormat, - &yagl_func_glGetShaderSource, &yagl_func_glGetUniformfv, &yagl_func_glGetUniformiv, &yagl_func_glGetUniformLocation, &yagl_func_glGetVertexAttribfv, &yagl_func_glGetVertexAttribiv, - &yagl_func_glGetVertexAttribPointerv, - &yagl_func_glIsProgram, - &yagl_func_glIsShader, &yagl_func_glLinkProgram, - &yagl_func_glReleaseShaderCompiler, - &yagl_func_glShaderBinary, - &yagl_func_glShaderSource, - &yagl_func_glStencilFuncSeparate, - &yagl_func_glStencilMaskSeparate, - &yagl_func_glStencilOpSeparate, &yagl_func_glUniform1f, &yagl_func_glUniform1fv, &yagl_func_glUniform1i, @@ -2868,5 +3438,76 @@ yagl_api_func yagl_gles2_api_funcs[] = { &yagl_func_glVertexAttrib3fv, &yagl_func_glVertexAttrib4f, &yagl_func_glVertexAttrib4fv, - &yagl_func_glVertexAttribPointer, + &yagl_func_glGetIntegerv, + &yagl_func_glGetFloatv, + &yagl_func_glGetString, + &yagl_func_glIsEnabled, + &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, }; diff --git a/hw/yagl_apis/gles/yagl_gles_calls.h b/hw/yagl_apis/gles/yagl_gles_calls.h new file mode 100644 index 0000000..9f75169 --- /dev/null +++ b/hw/yagl_apis/gles/yagl_gles_calls.h @@ -0,0 +1,13 @@ +/* + * Generated by gen-yagl-calls.py, do not modify! + */ +#ifndef _QEMU_YAGL_GLES_CALLS_H_ +#define _QEMU_YAGL_GLES_CALLS_H_ + +#include "yagl_types.h" + +extern const uint32_t yagl_gles_api_num_funcs; + +extern yagl_api_func yagl_gles_api_funcs[]; + +#endif diff --git a/hw/yagl_apis/gles/yagl_gles_context.c b/hw/yagl_apis/gles/yagl_gles_context.c deleted file mode 100644 index bb43a13..0000000 --- a/hw/yagl_apis/gles/yagl_gles_context.c +++ /dev/null @@ -1,567 +0,0 @@ -#include -#include "yagl_gles_context.h" -#include "yagl_gles_driver.h" -#include "yagl_gles_array.h" -#include "yagl_gles_buffer.h" -#include "yagl_gles_framebuffer.h" -#include "yagl_gles_texture_unit.h" -#include "yagl_gles_validate.h" -#include "yagl_gles_image.h" -#include "yagl_gles_tex_image.h" -#include "yagl_gles_texture.h" -#include "yagl_log.h" -#include "yagl_process.h" -#include "yagl_thread.h" -#include "yagl_sharegroup.h" -#include - -static void yagl_gles_context_flush(struct yagl_client_context *ctx) -{ - struct yagl_gles_context *gles_ctx = (struct yagl_gles_context*)ctx; - - gles_ctx->driver->Flush(); -} - -static bool yagl_gles_context_read_pixels(struct yagl_client_context *ctx, - uint32_t width, - uint32_t height, - uint32_t bpp, - void *pixels) -{ - struct yagl_gles_context *gles_ctx = (struct yagl_gles_context*)ctx; - bool ret = false; - yagl_object_name current_fb = 0; - yagl_object_name current_pbo = 0; - uint32_t rp_line_size = width * bpp; - uint32_t rp_size = rp_line_size * height; - GLenum format = 0; - bool pop_attrib = false; - void *mapped_pixels = NULL; - uint32_t i; - - YAGL_LOG_FUNC_ENTER(yagl_gles_context_read_pixels, - "%ux%ux%u", width, height, bpp); - - gles_ctx->driver->GetIntegerv(GL_FRAMEBUFFER_BINDING, - (GLint*)¤t_fb); - - gles_ctx->driver->BindFramebuffer(GL_FRAMEBUFFER, 0); - - if (!gles_ctx->rp_pbo) { - /* - * No buffer yet, create one. - */ - - gles_ctx->rp_pbo = yagl_gles_buffer_create(gles_ctx->driver); - - if (!gles_ctx->rp_pbo) { - YAGL_LOG_ERROR("yagl_gles_buffer_create failed"); - goto out; - } - - YAGL_LOG_TRACE("Created pbo %u", - gles_ctx->rp_pbo->default_part.global_name); - } - - gles_ctx->driver->GetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING_ARB, - (GLint*)¤t_pbo); - - if (current_pbo != gles_ctx->rp_pbo->default_part.global_name) { - YAGL_LOG_TRACE("Binding pbo"); - gles_ctx->driver->BindBuffer(GL_PIXEL_PACK_BUFFER_ARB, - gles_ctx->rp_pbo->default_part.global_name); - } - - if ((width != gles_ctx->rp_pbo_width) || - (height != gles_ctx->rp_pbo_height) || - (bpp != gles_ctx->rp_pbo_bpp)) { - /* - * The surface was resized/changed, recreate pbo data accordingly. - */ - - gles_ctx->rp_pbo_width = width; - gles_ctx->rp_pbo_height = height; - gles_ctx->rp_pbo_bpp = bpp; - - YAGL_LOG_TRACE("Recreating pbo storage"); - - gles_ctx->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; - } - - gles_ctx->driver->PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); - - pop_attrib = true; - - gles_ctx->driver->PixelStorei(GL_PACK_ALIGNMENT, - ((bpp == 4) ? 4 : 1)); - - gles_ctx->driver->ReadPixels(0, 0, - width, height, format, GL_UNSIGNED_BYTE, - NULL); - - mapped_pixels = gles_ctx->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; - - 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_ctx->driver->UnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB); - } - if (pop_attrib) { - gles_ctx->driver->PopClientAttrib(); - } - if ((current_pbo != 0) && - (current_pbo != gles_ctx->rp_pbo->default_part.global_name)) { - YAGL_LOG_ERROR("Target binded a pbo ?"); - gles_ctx->driver->BindBuffer(GL_PIXEL_PACK_BUFFER_ARB, - current_pbo); - } - - gles_ctx->driver->BindFramebuffer(GL_FRAMEBUFFER, current_fb); - - YAGL_LOG_FUNC_EXIT(NULL); - - return ret; -} - -static struct yagl_client_image - *yagl_gles_context_create_image(struct yagl_client_context *ctx) -{ - struct yagl_gles_context *gles_ctx = (struct yagl_gles_context*)ctx; - struct yagl_gles_image *image = yagl_gles_image_create(gles_ctx->driver); - - return image ? &image->base : NULL; -} - -static struct yagl_client_tex_image - *yagl_gles_context_create_tex_image(struct yagl_client_context *ctx, - yagl_object_name tex_global_name, - struct yagl_ref *tex_data) -{ - struct yagl_gles_context *gles_ctx = (struct yagl_gles_context*)ctx; - struct yagl_gles_texture_target_state *texture_target_state = - yagl_gles_context_get_active_texture_target_state(gles_ctx, - yagl_gles_texture_target_2d); - - if (!texture_target_state->texture) { - return NULL; - } - - yagl_gles_tex_image_create(tex_global_name, - tex_data, - texture_target_state->texture); - - return texture_target_state->texture->tex_image ? - &texture_target_state->texture->tex_image->base : NULL; -} - -void yagl_gles_context_init(struct yagl_gles_context *ctx, - struct yagl_gles_driver *driver) -{ - ctx->base.flush = &yagl_gles_context_flush; - ctx->base.read_pixels = &yagl_gles_context_read_pixels; - ctx->base.create_image = &yagl_gles_context_create_image; - ctx->base.create_tex_image = &yagl_gles_context_create_tex_image; - - ctx->driver = driver; - - ctx->rp_pbo = NULL; - ctx->rp_pbo_width = 0; - ctx->rp_pbo_height = 0; - ctx->rp_pbo_bpp = 0; - - ctx->error = GL_NO_ERROR; - - ctx->malloc_buff_size = 100; - ctx->malloc_buff = g_malloc(ctx->malloc_buff_size); - - ctx->arrays = NULL; - ctx->num_arrays = 0; - - ctx->texture_units = NULL; - ctx->num_texture_units = 0; - - ctx->num_compressed_texture_formats = 0; - - ctx->pack_depth_stencil = false; - - ctx->texture_npot = false; - - ctx->texture_rectangle = false; - - ctx->texture_filter_anisotropic = false; - - ctx->active_texture_unit = 0; - - ctx->vbo = NULL; - ctx->vbo_local_name = 0; - - ctx->ebo = NULL; - ctx->ebo_local_name = 0; - - ctx->fbo = NULL; - ctx->fbo_local_name = 0; - - ctx->rbo_local_name = 0; -} - -void yagl_gles_context_prepare(struct yagl_gles_context *ctx, - struct yagl_gles_array *arrays, - int num_arrays, - int num_texture_units) -{ - int i; - const char *extensions; - - if (num_texture_units < 1) { - num_texture_units = 1; - } - - YAGL_LOG_FUNC_ENTER(yagl_gles_context_prepare, - "num_arrays = %d, num_texture_units = %d", - num_arrays, - num_texture_units); - - ctx->arrays = arrays; - ctx->num_arrays = num_arrays; - - ctx->num_texture_units = num_texture_units; - ctx->texture_units = - g_malloc(ctx->num_texture_units * sizeof(*ctx->texture_units)); - - for (i = 0; i < ctx->num_texture_units; ++i) { - yagl_gles_texture_unit_init(&ctx->texture_units[i], ctx); - } - - ctx->driver->GetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, - &ctx->num_compressed_texture_formats); - - extensions = (const char*)ctx->driver->GetString(GL_EXTENSIONS); - - ctx->pack_depth_stencil = (strstr(extensions, "GL_EXT_packed_depth_stencil ") != NULL); - - ctx->texture_npot = (strstr(extensions, "GL_OES_texture_npot ") != NULL) || - (strstr(extensions, "GL_ARB_texture_non_power_of_two ") != NULL); - - ctx->texture_rectangle = (strstr(extensions, "GL_NV_texture_rectangle ") != NULL) || - (strstr(extensions, "GL_EXT_texture_rectangle ") != NULL) || - (strstr(extensions, "GL_ARB_texture_rectangle ") != NULL); - - ctx->texture_filter_anisotropic = (strstr(extensions, "GL_EXT_texture_filter_anisotropic ") != NULL); - - YAGL_LOG_FUNC_EXIT(NULL); -} - -void yagl_gles_context_activate(struct yagl_gles_context *ctx) -{ -} - -void yagl_gles_context_deactivate(struct yagl_gles_context *ctx) -{ -} - -void yagl_gles_context_cleanup(struct yagl_gles_context *ctx) -{ - int i; - - yagl_gles_framebuffer_release(ctx->fbo); - yagl_gles_buffer_release(ctx->ebo); - yagl_gles_buffer_release(ctx->vbo); - - for (i = 0; i < ctx->num_texture_units; ++i) { - yagl_gles_texture_unit_cleanup(&ctx->texture_units[i]); - } - - for (i = 0; i < ctx->num_arrays; ++i) { - yagl_gles_array_cleanup(&ctx->arrays[i]); - } - - g_free(ctx->texture_units); - ctx->texture_units = NULL; - - g_free(ctx->arrays); - ctx->arrays = NULL; - - g_free(ctx->malloc_buff); - ctx->malloc_buff = NULL; - - yagl_gles_buffer_release(ctx->rp_pbo); -} - -void yagl_gles_context_set_error(struct yagl_gles_context *ctx, GLenum error) -{ - if (ctx->error == GL_NO_ERROR) { - ctx->error = error; - } -} - -GLenum yagl_gles_context_get_error(struct yagl_gles_context *ctx) -{ - GLenum error = ctx->error; - - ctx->error = GL_NO_ERROR; - - return error; -} - -void *yagl_gles_context_malloc(struct yagl_gles_context *ctx, GLsizei size) -{ - if (size > ctx->malloc_buff_size) { - ctx->malloc_buff_size = size; - g_free(ctx->malloc_buff); - ctx->malloc_buff = g_malloc(ctx->malloc_buff_size); - } - - return ctx->malloc_buff; -} - -void *yagl_gles_context_malloc0(struct yagl_gles_context *ctx, GLsizei size) -{ - void *tmp = yagl_gles_context_malloc(ctx, size); - - memset(tmp, 0, size); - - return tmp; -} - -struct yagl_gles_array - *yagl_gles_context_get_array(struct yagl_gles_context *ctx, GLuint index) -{ - int i; - - for (i = 0; i < ctx->num_arrays; ++i) { - if (ctx->arrays[i].index == index) { - return &ctx->arrays[i]; - } - } - - return NULL; -} - -void yagl_gles_context_transfer_arrays_vbo(struct yagl_gles_context *ctx) -{ - int i; - - for (i = 0; i < ctx->num_arrays; ++i) { - yagl_gles_array_transfer_vbo(&ctx->arrays[i]); - } -} - -bool yagl_gles_context_set_active_texture(struct yagl_gles_context *ctx, - GLenum texture) -{ - if ((texture < GL_TEXTURE0) || - (texture >= (GL_TEXTURE0 + ctx->num_texture_units))) { - return false; - } - - ctx->active_texture_unit = texture - GL_TEXTURE0; - - return true; -} - -struct yagl_gles_texture_unit - *yagl_gles_context_get_active_texture_unit(struct yagl_gles_context *ctx) -{ - return &ctx->texture_units[ctx->active_texture_unit]; -} - -struct yagl_gles_texture_target_state - *yagl_gles_context_get_active_texture_target_state(struct yagl_gles_context *ctx, - yagl_gles_texture_target texture_target) -{ - return &yagl_gles_context_get_active_texture_unit(ctx)->target_states[texture_target]; -} - -void yagl_gles_context_active_texture_set_enabled(struct yagl_gles_context *ctx, - yagl_gles_texture_target texture_target, bool enabled) -{ - struct yagl_gles_texture_target_state *texture_target_state; - - texture_target_state = - yagl_gles_context_get_active_texture_target_state(ctx, - texture_target); - texture_target_state->enabled = enabled; -} - -void yagl_gles_context_bind_texture(struct yagl_gles_context *ctx, - yagl_gles_texture_target texture_target, - struct yagl_gles_texture *texture, - yagl_object_name texture_local_name) -{ - struct yagl_gles_texture_target_state *texture_target_state = - yagl_gles_context_get_active_texture_target_state(ctx, texture_target); - - yagl_gles_texture_acquire(texture); - yagl_gles_texture_release(texture_target_state->texture); - texture_target_state->texture = texture; - texture_target_state->texture_local_name = texture_local_name; -} - -void yagl_gles_context_unbind_texture(struct yagl_gles_context *ctx, - yagl_object_name texture_local_name) -{ - int i; - struct yagl_gles_texture_unit *texture_unit = - yagl_gles_context_get_active_texture_unit(ctx); - - for (i = 0; i < YAGL_NUM_GLES_TEXTURE_TARGETS; ++i) { - if (texture_unit->target_states[i].texture_local_name == texture_local_name) { - yagl_gles_texture_release(texture_unit->target_states[i].texture); - texture_unit->target_states[i].texture = NULL; - texture_unit->target_states[i].texture_local_name = 0; - } - } -} - -bool yagl_gles_context_bind_buffer(struct yagl_gles_context *ctx, - GLenum target, - struct yagl_gles_buffer *buffer, - yagl_object_name buffer_local_name) -{ - switch (target) { - case GL_ARRAY_BUFFER: - yagl_gles_buffer_acquire(buffer); - yagl_gles_buffer_release(ctx->vbo); - ctx->vbo = buffer; - ctx->vbo_local_name = buffer_local_name; - break; - case GL_ELEMENT_ARRAY_BUFFER: - yagl_gles_buffer_acquire(buffer); - yagl_gles_buffer_release(ctx->ebo); - ctx->ebo = buffer; - ctx->ebo_local_name = buffer_local_name; - break; - default: - return false; - } - - return true; -} - -void yagl_gles_context_unbind_buffer(struct yagl_gles_context *ctx, - struct yagl_gles_buffer *buffer) -{ - if (buffer == ctx->vbo) { - yagl_gles_buffer_release(ctx->vbo); - ctx->vbo = NULL; - ctx->vbo_local_name = 0; - } else if (buffer == ctx->ebo) { - yagl_gles_buffer_release(ctx->ebo); - ctx->ebo = NULL; - ctx->ebo_local_name = 0; - } -} - -bool yagl_gles_context_bind_framebuffer(struct yagl_gles_context *ctx, - GLenum target, - struct yagl_gles_framebuffer *fbo, - yagl_object_name fbo_local_name) -{ - switch (target) { - case GL_FRAMEBUFFER: - yagl_gles_framebuffer_acquire(fbo); - yagl_gles_framebuffer_release(ctx->fbo); - ctx->fbo = fbo; - ctx->fbo_local_name = fbo_local_name; - break; - default: - return false; - } - - return true; -} - -void yagl_gles_context_unbind_framebuffer(struct yagl_gles_context *ctx, - yagl_object_name fbo_local_name) -{ - if (fbo_local_name == ctx->fbo_local_name) { - yagl_gles_framebuffer_release(ctx->fbo); - ctx->fbo = NULL; - ctx->fbo_local_name = 0; - } -} - -bool yagl_gles_context_bind_renderbuffer(struct yagl_gles_context *ctx, - GLenum target, - yagl_object_name rbo_local_name) -{ - switch (target) { - case GL_RENDERBUFFER: - ctx->rbo_local_name = rbo_local_name; - break; - default: - return false; - } - - return true; -} - -void yagl_gles_context_unbind_renderbuffer(struct yagl_gles_context *ctx, - yagl_object_name rbo_local_name) -{ - if (rbo_local_name == ctx->rbo_local_name) { - ctx->rbo_local_name = 0; - } -} - -struct yagl_gles_buffer - *yagl_gles_context_acquire_binded_buffer(struct yagl_gles_context *ctx, - GLenum target) -{ - switch (target) { - case GL_ARRAY_BUFFER: - yagl_gles_buffer_acquire(ctx->vbo); - return ctx->vbo; - case GL_ELEMENT_ARRAY_BUFFER: - yagl_gles_buffer_acquire(ctx->ebo); - return ctx->ebo; - default: - return NULL; - } -} - -struct yagl_gles_framebuffer - *yagl_gles_context_acquire_binded_framebuffer(struct yagl_gles_context *ctx, - GLenum target) -{ - switch (target) { - case GL_FRAMEBUFFER: - yagl_gles_framebuffer_acquire(ctx->fbo); - return ctx->fbo; - default: - return NULL; - } -} diff --git a/hw/yagl_apis/gles/yagl_gles_context.h b/hw/yagl_apis/gles/yagl_gles_context.h deleted file mode 100644 index a6e0aa5..0000000 --- a/hw/yagl_apis/gles/yagl_gles_context.h +++ /dev/null @@ -1,208 +0,0 @@ -#ifndef _QEMU_YAGL_GLES_CONTEXT_H -#define _QEMU_YAGL_GLES_CONTEXT_H - -#include "yagl_gles_types.h" -#include "yagl_client_context.h" - -struct yagl_gles_driver; -struct yagl_gles_array; -struct yagl_gles_buffer; -struct yagl_gles_texture; -struct yagl_gles_framebuffer; -struct yagl_gles_texture_unit; - -struct yagl_gles_context -{ - struct yagl_client_context base; - - struct yagl_gles_driver *driver; - - bool (*get_param_count)(struct yagl_gles_context */*ctx*/, - GLenum /*pname*/, - int */*count*/); - - bool (*get_booleanv)(struct yagl_gles_context */*ctx*/, - GLenum /*pname*/, - GLboolean */*params*/); - - bool (*get_integerv)(struct yagl_gles_context */*ctx*/, - GLenum /*pname*/, - GLint */*params*/); - - bool (*get_floatv)(struct yagl_gles_context */*ctx*/, - GLenum /*pname*/, - GLfloat */*params*/); - - bool (*is_enabled)(struct yagl_gles_context */*ctx*/, - GLboolean* retval/*retval*/, - GLenum /*cap*/); - - GLchar *(*get_extensions)(struct yagl_gles_context */*ctx*/); - - void (*draw_arrays)(struct yagl_gles_context *ctx, - GLenum mode, - GLint first, - GLsizei count); - - void (*draw_elements)(struct yagl_gles_context *ctx, - GLenum mode, - GLsizei count, - GLenum type, - const GLvoid *indices); - - GLenum (*compressed_tex_image)(struct yagl_gles_context *ctx, - GLenum target, - GLint level, - GLenum internalformat, - GLsizei width, - GLsizei height, - GLint border, - GLsizei imageSize, - const GLvoid *data); - - /* - * Pixel Buffer Object (PBO) for quick access to current surface pixels. - * 'read_pixels' will automatically detect surface size changes and - * will recreate this pbo accordingly. - */ - struct yagl_gles_buffer *rp_pbo; - uint32_t rp_pbo_width; - uint32_t rp_pbo_height; - uint32_t rp_pbo_bpp; - - GLenum error; - - /* - * Buffer that is used for reading target data that is - * accessed via target pointers. Instead of doing - * g_malloc/g_free every time we'll just use this. - */ - void *malloc_buff; - GLsizei malloc_buff_size; - - /* - * GLES arrays, the number of arrays is different depending on - * GLES version, 'num_arrays' holds that number. - */ - struct yagl_gles_array *arrays; - int num_arrays; - - /* - * GLES texture units, the number of texture units is determined - * at runtime. - */ - struct yagl_gles_texture_unit *texture_units; - int num_texture_units; - - int num_compressed_texture_formats; - - bool pack_depth_stencil; - - bool texture_npot; - - bool texture_rectangle; - - bool texture_filter_anisotropic; - - int active_texture_unit; - - struct yagl_gles_buffer *vbo; - yagl_object_name vbo_local_name; - - struct yagl_gles_buffer *ebo; - yagl_object_name ebo_local_name; - - struct yagl_gles_framebuffer *fbo; - yagl_object_name fbo_local_name; - - yagl_object_name rbo_local_name; -}; - -void yagl_gles_context_init(struct yagl_gles_context *ctx, - struct yagl_gles_driver *driver); - -/* - * Called when the context is being activated for the first time. - * Called before 'yagl_gles_context_activate'. - * - * Takes ownership of 'arrays'. - */ -void yagl_gles_context_prepare(struct yagl_gles_context *ctx, - struct yagl_gles_array *arrays, - int num_arrays, - int num_texture_units); - -void yagl_gles_context_activate(struct yagl_gles_context *ctx); - -void yagl_gles_context_deactivate(struct yagl_gles_context *ctx); - -void yagl_gles_context_cleanup(struct yagl_gles_context *ctx); - -void yagl_gles_context_set_error(struct yagl_gles_context *ctx, GLenum error); - -GLenum yagl_gles_context_get_error(struct yagl_gles_context *ctx); - -/* - * Allocate per-call memory, no need to free it. - */ -void *yagl_gles_context_malloc(struct yagl_gles_context *ctx, GLsizei size); -void *yagl_gles_context_malloc0(struct yagl_gles_context *ctx, GLsizei size); - -struct yagl_gles_array - *yagl_gles_context_get_array(struct yagl_gles_context *ctx, GLuint index); - -void yagl_gles_context_transfer_arrays_vbo(struct yagl_gles_context *ctx); - -bool yagl_gles_context_set_active_texture(struct yagl_gles_context *ctx, - GLenum texture); - -struct yagl_gles_texture_unit - *yagl_gles_context_get_active_texture_unit(struct yagl_gles_context *ctx); - -struct yagl_gles_texture_target_state - *yagl_gles_context_get_active_texture_target_state(struct yagl_gles_context *ctx, - yagl_gles_texture_target texture_target); - -void yagl_gles_context_active_texture_set_enabled(struct yagl_gles_context *ctx, - yagl_gles_texture_target texture_target, bool enabled); - -void yagl_gles_context_bind_texture(struct yagl_gles_context *ctx, - yagl_gles_texture_target texture_target, - struct yagl_gles_texture *texture, - yagl_object_name texture_local_name); - -void yagl_gles_context_unbind_texture(struct yagl_gles_context *ctx, - yagl_object_name texture_local_name); - -bool yagl_gles_context_bind_buffer(struct yagl_gles_context *ctx, - GLenum target, - struct yagl_gles_buffer *buffer, - yagl_object_name buffer_local_name); - -void yagl_gles_context_unbind_buffer(struct yagl_gles_context *ctx, - struct yagl_gles_buffer *buffer); - -bool yagl_gles_context_bind_framebuffer(struct yagl_gles_context *ctx, - GLenum target, - struct yagl_gles_framebuffer *fbo, - yagl_object_name fbo_local_name); - -void yagl_gles_context_unbind_framebuffer(struct yagl_gles_context *ctx, - yagl_object_name fbo_local_name); - -bool yagl_gles_context_bind_renderbuffer(struct yagl_gles_context *ctx, - GLenum target, - yagl_object_name rbo_local_name); - -void yagl_gles_context_unbind_renderbuffer(struct yagl_gles_context *ctx, - yagl_object_name rbo_local_name); - -struct yagl_gles_buffer - *yagl_gles_context_acquire_binded_buffer(struct yagl_gles_context *ctx, - GLenum target); - -struct yagl_gles_framebuffer - *yagl_gles_context_acquire_binded_framebuffer(struct yagl_gles_context *ctx, - GLenum target); - -#endif diff --git a/hw/yagl_apis/gles/yagl_gles_framebuffer.c b/hw/yagl_apis/gles/yagl_gles_framebuffer.c deleted file mode 100644 index 27aea9e..0000000 --- a/hw/yagl_apis/gles/yagl_gles_framebuffer.c +++ /dev/null @@ -1,179 +0,0 @@ -#include -#include "yagl_gles_framebuffer.h" -#include "yagl_gles_renderbuffer.h" -#include "yagl_gles_texture.h" -#include "yagl_gles_driver.h" -#include "yagl_gles_validate.h" - -static void yagl_gles_framebuffer_destroy(struct yagl_ref *ref) -{ - struct yagl_gles_framebuffer *fb = (struct yagl_gles_framebuffer*)ref; - - yagl_ensure_ctx(); - fb->driver->DeleteFramebuffers(1, &fb->global_name); - yagl_unensure_ctx(); - - yagl_object_cleanup(&fb->base); - - g_free(fb); -} - -struct yagl_gles_framebuffer - *yagl_gles_framebuffer_create(struct yagl_gles_driver *driver) -{ - GLuint global_name = 0; - struct yagl_gles_framebuffer *fb; - int i; - - driver->GenFramebuffers(1, &global_name); - - fb = g_malloc0(sizeof(*fb)); - - yagl_object_init(&fb->base, &yagl_gles_framebuffer_destroy); - - fb->driver = driver; - fb->global_name = global_name; - - for (i = 0; i < YAGL_NUM_GLES_FRAMEBUFFER_ATTACHMENTS; ++i) { - fb->attachment_states[i].type = GL_NONE; - } - - return fb; -} - -void yagl_gles_framebuffer_acquire(struct yagl_gles_framebuffer *fb) -{ - if (fb) { - yagl_object_acquire(&fb->base); - } -} - -void yagl_gles_framebuffer_release(struct yagl_gles_framebuffer *fb) -{ - if (fb) { - yagl_object_release(&fb->base); - } -} - -bool yagl_gles_framebuffer_renderbuffer(struct yagl_gles_framebuffer *fb, - GLenum target, - GLenum attachment, - GLenum renderbuffer_target, - struct yagl_gles_renderbuffer *rb, - yagl_object_name rb_local_name) -{ - yagl_gles_framebuffer_attachment framebuffer_attachment; - - if (!yagl_gles_validate_framebuffer_attachment(attachment, - &framebuffer_attachment)) { - return false; - } - - if (rb && (renderbuffer_target != GL_RENDERBUFFER)) { - return false; - } - - if (rb) { - fb->attachment_states[framebuffer_attachment].type = GL_RENDERBUFFER; - fb->attachment_states[framebuffer_attachment].local_name = rb_local_name; - } else { - fb->attachment_states[framebuffer_attachment].type = GL_NONE; - fb->attachment_states[framebuffer_attachment].local_name = 0; - } - - fb->driver->FramebufferRenderbuffer(target, - attachment, - renderbuffer_target, - (rb ? rb->global_name : 0)); - - return true; -} - -bool yagl_gles_framebuffer_texture2d(struct yagl_gles_framebuffer *fb, - GLenum target, - GLenum attachment, - GLenum textarget, - GLint level, - struct yagl_gles_texture *texture, - yagl_object_name texture_local_name) -{ - yagl_gles_framebuffer_attachment framebuffer_attachment; - GLenum squashed_textarget; - - if (!yagl_gles_validate_framebuffer_attachment(attachment, - &framebuffer_attachment)) { - return false; - } - - if (texture && (level != 0)) { - return false; - } - - if (!yagl_gles_validate_texture_target_squash(textarget, - &squashed_textarget)) { - return false; - } - - if (texture && (yagl_gles_texture_get_target(texture) != squashed_textarget)) { - return false; - } - - if (texture) { - fb->attachment_states[framebuffer_attachment].type = GL_TEXTURE; - fb->attachment_states[framebuffer_attachment].local_name = texture_local_name; - } else { - fb->attachment_states[framebuffer_attachment].type = GL_NONE; - fb->attachment_states[framebuffer_attachment].local_name = 0; - } - - fb->driver->FramebufferTexture2D(target, - attachment, - textarget, - (texture ? texture->global_name : 0), - level); - - return true; -} - -bool yagl_gles_framebuffer_get_attachment_parameter(struct yagl_gles_framebuffer *fb, - GLenum attachment, - GLenum pname, - GLint *value) -{ - yagl_gles_framebuffer_attachment framebuffer_attachment; - - if (!yagl_gles_validate_framebuffer_attachment(attachment, - &framebuffer_attachment)) { - return false; - } - - switch (pname) { - case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: - *value = fb->attachment_states[framebuffer_attachment].type; - break; - case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: - *value = fb->attachment_states[framebuffer_attachment].local_name; - break; - case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: - case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: - fb->driver->GetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, - attachment, - pname, - value); - break; - default: - return false; - } - - return true; -} - -void yagl_gles_framebuffer_set_bound(struct yagl_gles_framebuffer *fb) -{ - fb->was_bound = true; -} - -bool yagl_gles_framebuffer_was_bound(struct yagl_gles_framebuffer *fb) -{ - return fb->was_bound; -} diff --git a/hw/yagl_apis/gles/yagl_gles_framebuffer.h b/hw/yagl_apis/gles/yagl_gles_framebuffer.h deleted file mode 100644 index 1d01948..0000000 --- a/hw/yagl_apis/gles/yagl_gles_framebuffer.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef _QEMU_YAGL_GLES_FRAMEBUFFER_H -#define _QEMU_YAGL_GLES_FRAMEBUFFER_H - -#include "yagl_gles_types.h" -#include "yagl_object.h" - -#define YAGL_NS_FRAMEBUFFER 2 - -struct yagl_gles_driver; -struct yagl_gles_texture; -struct yagl_gles_renderbuffer; - -struct yagl_gles_framebuffer_attachment_state -{ - GLenum type; - - yagl_object_name local_name; -}; - -struct yagl_gles_framebuffer -{ - struct yagl_object base; - - struct yagl_gles_driver *driver; - - yagl_object_name global_name; - - struct yagl_gles_framebuffer_attachment_state attachment_states[YAGL_NUM_GLES_FRAMEBUFFER_ATTACHMENTS]; - - bool was_bound; -}; - -struct yagl_gles_framebuffer - *yagl_gles_framebuffer_create(struct yagl_gles_driver *driver); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles_framebuffer_acquire(struct yagl_gles_framebuffer *fb); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles_framebuffer_release(struct yagl_gles_framebuffer *fb); - -bool yagl_gles_framebuffer_renderbuffer(struct yagl_gles_framebuffer *fb, - GLenum target, - GLenum attachment, - GLenum renderbuffer_target, - struct yagl_gles_renderbuffer *rb, - yagl_object_name rb_local_name); - -bool yagl_gles_framebuffer_texture2d(struct yagl_gles_framebuffer *fb, - GLenum target, - GLenum attachment, - GLenum textarget, - GLint level, - struct yagl_gles_texture *texture, - yagl_object_name texture_local_name); - -bool yagl_gles_framebuffer_get_attachment_parameter(struct yagl_gles_framebuffer *fb, - GLenum attachment, - GLenum pname, - GLint *value); - -void yagl_gles_framebuffer_set_bound(struct yagl_gles_framebuffer *fb); - -bool yagl_gles_framebuffer_was_bound(struct yagl_gles_framebuffer *fb); - -#endif diff --git a/hw/yagl_apis/gles/yagl_gles_image.c b/hw/yagl_apis/gles/yagl_gles_image.c deleted file mode 100644 index 70e82eb..0000000 --- a/hw/yagl_apis/gles/yagl_gles_image.c +++ /dev/null @@ -1,74 +0,0 @@ -#include -#include "yagl_gles_image.h" -#include "yagl_gles_driver.h" -#include "yagl_host_gles_calls.h" - -static void yagl_gles_image_destroy(struct yagl_ref *ref) -{ - struct yagl_gles_image *image = (struct yagl_gles_image*)ref; - - if (image->is_owner) { - yagl_ensure_ctx(); - image->driver->DeleteTextures(1, &image->tex_global_name); - yagl_unensure_ctx(); - } - - yagl_client_image_cleanup(&image->base); - - g_free(image); -} - -struct yagl_gles_image - *yagl_gles_image_create(struct yagl_gles_driver *driver) -{ - GLuint tex_global_name = 0; - struct yagl_gles_image *image; - - driver->GenTextures(1, &tex_global_name); - - image = g_malloc0(sizeof(*image)); - - yagl_client_image_init(&image->base, &yagl_gles_image_destroy, NULL); - - image->base.update = &yagl_host_glEGLUpdateOffscreenImageYAGL; - - image->driver = driver; - image->tex_global_name = tex_global_name; - image->is_owner = true; - - return image; -} - -struct yagl_gles_image - *yagl_gles_image_create_from_texture(struct yagl_gles_driver *driver, - yagl_object_name tex_global_name, - struct yagl_ref *tex_data) -{ - struct yagl_gles_image *image; - - image = g_malloc0(sizeof(*image)); - - yagl_client_image_init(&image->base, &yagl_gles_image_destroy, tex_data); - - image->base.update = &yagl_host_glEGLUpdateOffscreenImageYAGL; - - image->driver = driver; - image->tex_global_name = tex_global_name; - image->is_owner = false; - - return image; -} - -void yagl_gles_image_acquire(struct yagl_gles_image *image) -{ - if (image) { - yagl_client_image_acquire(&image->base); - } -} - -void yagl_gles_image_release(struct yagl_gles_image *image) -{ - if (image) { - yagl_client_image_release(&image->base); - } -} diff --git a/hw/yagl_apis/gles/yagl_gles_image.h b/hw/yagl_apis/gles/yagl_gles_image.h deleted file mode 100644 index a8ef4a0..0000000 --- a/hw/yagl_apis/gles/yagl_gles_image.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef _QEMU_YAGL_GLES_IMAGE_H -#define _QEMU_YAGL_GLES_IMAGE_H - -#include "yagl_types.h" -#include "yagl_client_image.h" - -struct yagl_gles_driver; - -struct yagl_gles_image -{ - struct yagl_client_image base; - - struct yagl_gles_driver *driver; - - yagl_object_name tex_global_name; - - bool is_owner; -}; - -struct yagl_gles_image - *yagl_gles_image_create(struct yagl_gles_driver *driver); - -struct yagl_gles_image - *yagl_gles_image_create_from_texture(struct yagl_gles_driver *driver, - yagl_object_name tex_global_name, - struct yagl_ref *tex_data); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles_image_acquire(struct yagl_gles_image *image); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles_image_release(struct yagl_gles_image *image); - -#endif diff --git a/hw/yagl_apis/gles/yagl_gles_renderbuffer.c b/hw/yagl_apis/gles/yagl_gles_renderbuffer.c deleted file mode 100644 index f1a356b..0000000 --- a/hw/yagl_apis/gles/yagl_gles_renderbuffer.c +++ /dev/null @@ -1,58 +0,0 @@ -#include -#include "yagl_gles_renderbuffer.h" -#include "yagl_gles_driver.h" - -static void yagl_gles_renderbuffer_destroy(struct yagl_ref *ref) -{ - struct yagl_gles_renderbuffer *rb = (struct yagl_gles_renderbuffer*)ref; - - yagl_ensure_ctx(); - rb->driver->DeleteRenderbuffers(1, &rb->global_name); - yagl_unensure_ctx(); - - yagl_object_cleanup(&rb->base); - - g_free(rb); -} - -struct yagl_gles_renderbuffer - *yagl_gles_renderbuffer_create(struct yagl_gles_driver *driver) -{ - GLuint global_name = 0; - struct yagl_gles_renderbuffer *rb; - - driver->GenRenderbuffers(1, &global_name); - - rb = g_malloc0(sizeof(*rb)); - - yagl_object_init(&rb->base, &yagl_gles_renderbuffer_destroy); - - rb->driver = driver; - rb->global_name = global_name; - - return rb; -} - -void yagl_gles_renderbuffer_acquire(struct yagl_gles_renderbuffer *rb) -{ - if (rb) { - yagl_object_acquire(&rb->base); - } -} - -void yagl_gles_renderbuffer_release(struct yagl_gles_renderbuffer *rb) -{ - if (rb) { - yagl_object_release(&rb->base); - } -} - -void yagl_gles_renderbuffer_set_bound(struct yagl_gles_renderbuffer *rb) -{ - rb->was_bound = true; -} - -bool yagl_gles_renderbuffer_was_bound(struct yagl_gles_renderbuffer *rb) -{ - return rb->was_bound; -} diff --git a/hw/yagl_apis/gles/yagl_gles_renderbuffer.h b/hw/yagl_apis/gles/yagl_gles_renderbuffer.h deleted file mode 100644 index e5f530c..0000000 --- a/hw/yagl_apis/gles/yagl_gles_renderbuffer.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _QEMU_YAGL_GLES_RENDERBUFFER_H -#define _QEMU_YAGL_GLES_RENDERBUFFER_H - -#include "yagl_types.h" -#include "yagl_object.h" - -#define YAGL_NS_RENDERBUFFER 3 - -struct yagl_gles_driver; - -struct yagl_gles_renderbuffer -{ - struct yagl_object base; - - struct yagl_gles_driver *driver; - - yagl_object_name global_name; - - bool was_bound; -}; - -struct yagl_gles_renderbuffer - *yagl_gles_renderbuffer_create(struct yagl_gles_driver *driver); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles_renderbuffer_acquire(struct yagl_gles_renderbuffer *rb); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles_renderbuffer_release(struct yagl_gles_renderbuffer *rb); - -void yagl_gles_renderbuffer_set_bound(struct yagl_gles_renderbuffer *rb); - -bool yagl_gles_renderbuffer_was_bound(struct yagl_gles_renderbuffer *rb); - -#endif diff --git a/hw/yagl_apis/gles/yagl_gles_tex_image.c b/hw/yagl_apis/gles/yagl_gles_tex_image.c deleted file mode 100644 index 7d14afe..0000000 --- a/hw/yagl_apis/gles/yagl_gles_tex_image.c +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include "yagl_gles_tex_image.h" -#include "yagl_gles_texture.h" - -static void yagl_gles_tex_image_unbind(struct yagl_client_tex_image *tex_image) -{ - struct yagl_gles_tex_image *gles_tex_image = - (struct yagl_gles_tex_image*)tex_image; - struct yagl_ref *data = tex_image->data; - - assert(gles_tex_image->bound_texture); - - yagl_gles_texture_unset_tex_image(gles_tex_image->bound_texture); - - gles_tex_image->tex_global_name = 0; - gles_tex_image->bound_texture = NULL; - - tex_image->data = NULL; - yagl_ref_release(data); -} - -static void yagl_gles_tex_image_destroy(struct yagl_ref *ref) -{ - struct yagl_gles_tex_image *tex_image = (struct yagl_gles_tex_image*)ref; - - /* - * Can't get here if bound to texture. - */ - assert(!tex_image->bound_texture); - - yagl_client_tex_image_cleanup(&tex_image->base); - - g_free(tex_image); -} - -void yagl_gles_tex_image_create(yagl_object_name tex_global_name, - struct yagl_ref *tex_data, - struct yagl_gles_texture *bound_texture) -{ - struct yagl_gles_tex_image *tex_image; - - tex_image = g_malloc0(sizeof(*tex_image)); - - yagl_client_tex_image_init(&tex_image->base, - &yagl_gles_tex_image_destroy, - tex_data); - - tex_image->base.unbind = &yagl_gles_tex_image_unbind; - - tex_image->tex_global_name = tex_global_name; - tex_image->bound_texture = bound_texture; - - yagl_gles_texture_set_tex_image(bound_texture, tex_image); -} - -void yagl_gles_tex_image_acquire(struct yagl_gles_tex_image *tex_image) -{ - if (tex_image) { - yagl_client_tex_image_acquire(&tex_image->base); - } -} - -void yagl_gles_tex_image_release(struct yagl_gles_tex_image *tex_image) -{ - if (tex_image) { - yagl_client_tex_image_release(&tex_image->base); - } -} diff --git a/hw/yagl_apis/gles/yagl_gles_tex_image.h b/hw/yagl_apis/gles/yagl_gles_tex_image.h deleted file mode 100644 index 9efa656..0000000 --- a/hw/yagl_apis/gles/yagl_gles_tex_image.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _QEMU_YAGL_GLES_TEX_IMAGE_H -#define _QEMU_YAGL_GLES_TEX_IMAGE_H - -#include "yagl_types.h" -#include "yagl_client_tex_image.h" - -struct yagl_gles_driver; -struct yagl_gles_texture; - -struct yagl_gles_tex_image -{ - struct yagl_client_tex_image base; - - yagl_object_name tex_global_name; - - /* - * Weak pointer, no ref. - */ - struct yagl_gles_texture *bound_texture; -}; - -/* - * Does NOT take ownership of 'bound_texture'. - */ -void yagl_gles_tex_image_create(yagl_object_name tex_global_name, - struct yagl_ref *tex_data, - struct yagl_gles_texture *bound_texture); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles_tex_image_acquire(struct yagl_gles_tex_image *tex_image); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles_tex_image_release(struct yagl_gles_tex_image *tex_image); - -#endif diff --git a/hw/yagl_apis/gles/yagl_gles_texture.c b/hw/yagl_apis/gles/yagl_gles_texture.c deleted file mode 100644 index e0a8c2e..0000000 --- a/hw/yagl_apis/gles/yagl_gles_texture.c +++ /dev/null @@ -1,183 +0,0 @@ -#include -#include "yagl_gles_texture.h" -#include "yagl_gles_image.h" -#include "yagl_gles_tex_image.h" -#include "yagl_gles_driver.h" - -static bool yagl_gles_texture_unset_internal(struct yagl_gles_texture *texture) -{ - bool ret = false; - - if (texture->image) { - yagl_gles_image_release(texture->image); - texture->image = NULL; - ret = true; - } - - if (texture->tex_image) { - texture->tex_image->base.unbind(&texture->tex_image->base); - assert(!texture->tex_image); - texture->tex_image = NULL; - ret = true; - } - - return ret; -} - -static void yagl_gles_texture_destroy(struct yagl_ref *ref) -{ - struct yagl_gles_texture *texture = (struct yagl_gles_texture*)ref; - - if (!yagl_gles_texture_unset_internal(texture)) { - yagl_ensure_ctx(); - texture->driver->DeleteTextures(1, &texture->global_name); - yagl_unensure_ctx(); - } - - yagl_object_cleanup(&texture->base); - - g_free(texture); -} - -struct yagl_gles_texture - *yagl_gles_texture_create(struct yagl_gles_driver *driver) -{ - GLuint global_name = 0; - struct yagl_gles_texture *texture; - - driver->GenTextures(1, &global_name); - - texture = g_malloc0(sizeof(*texture)); - - yagl_object_init(&texture->base, &yagl_gles_texture_destroy); - - texture->driver = driver; - texture->global_name = global_name; - texture->target = 0; - - return texture; -} - -void yagl_gles_texture_acquire(struct yagl_gles_texture *texture) -{ - if (texture) { - yagl_object_acquire(&texture->base); - } -} - -void yagl_gles_texture_release(struct yagl_gles_texture *texture) -{ - if (texture) { - yagl_object_release(&texture->base); - } -} - -bool yagl_gles_texture_bind(struct yagl_gles_texture *texture, - GLenum target) -{ - if (texture->target && (texture->target != target)) { - return false; - } - - texture->driver->BindTexture(target, - texture->global_name); - - texture->target = target; - - return true; -} - -GLenum yagl_gles_texture_get_target(struct yagl_gles_texture *texture) -{ - return texture->target; -} - -void yagl_gles_texture_set_image(struct yagl_gles_texture *texture, - struct yagl_gles_image *image) -{ - assert(texture->target); - assert(image); - - if (texture->image == image) { - return; - } - - yagl_gles_image_acquire(image); - - if (!yagl_gles_texture_unset_internal(texture)) { - texture->driver->DeleteTextures(1, &texture->global_name); - } - - texture->global_name = image->tex_global_name; - texture->image = image; - - texture->driver->BindTexture(texture->target, - texture->global_name); -} - -void yagl_gles_texture_unset_image(struct yagl_gles_texture *texture) -{ - if (texture->image) { - GLuint global_name = 0; - - yagl_gles_texture_unset_internal(texture); - - texture->driver->GenTextures(1, &global_name); - - texture->global_name = global_name; - - texture->driver->BindTexture(texture->target, - texture->global_name); - } -} - -void yagl_gles_texture_set_tex_image(struct yagl_gles_texture *texture, - struct yagl_gles_tex_image *tex_image) -{ - assert(texture->target); - assert(tex_image); - - yagl_gles_tex_image_acquire(tex_image); - - if (!yagl_gles_texture_unset_internal(texture)) { - texture->driver->DeleteTextures(1, &texture->global_name); - } - - texture->global_name = tex_image->tex_global_name; - texture->tex_image = tex_image; - - texture->driver->BindTexture(texture->target, - texture->global_name); -} - -void yagl_gles_texture_unset_tex_image(struct yagl_gles_texture *texture) -{ - GLuint global_name = 0; - - assert(texture->tex_image); - - yagl_gles_tex_image_release(texture->tex_image); - texture->tex_image = NULL; - - /* - * Should ensure context here since this function - * can be called when no context is active. - */ - yagl_ensure_ctx(); - texture->driver->GenTextures(1, &global_name); - yagl_unensure_ctx(); - - texture->global_name = global_name; -} - -void yagl_gles_texture_release_tex_image(struct yagl_gles_texture *texture) -{ - if (texture->tex_image) { - yagl_gles_texture_unset_internal(texture); - - assert(texture->global_name); - - texture->driver->BindTexture(texture->target, - texture->global_name); - } -} diff --git a/hw/yagl_apis/gles/yagl_gles_texture.h b/hw/yagl_apis/gles/yagl_gles_texture.h deleted file mode 100644 index 7395ff9..0000000 --- a/hw/yagl_apis/gles/yagl_gles_texture.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef _QEMU_YAGL_GLES_TEXTURE_H -#define _QEMU_YAGL_GLES_TEXTURE_H - -#include "yagl_types.h" -#include "yagl_object.h" - -#define YAGL_NS_TEXTURE 1 - -struct yagl_gles_driver; -struct yagl_gles_image; -struct yagl_gles_tex_image; - -struct yagl_gles_texture -{ - struct yagl_object base; - - struct yagl_gles_driver *driver; - - yagl_object_name global_name; - - GLenum target; - - /* - * Non-NULL if it's an EGLImage target. - */ - struct yagl_gles_image *image; - - /* - * Non-NULL if eglBindTexImage bound. - */ - struct yagl_gles_tex_image *tex_image; -}; - -struct yagl_gles_texture - *yagl_gles_texture_create(struct yagl_gles_driver *driver); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles_texture_acquire(struct yagl_gles_texture *texture); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles_texture_release(struct yagl_gles_texture *texture); - -bool yagl_gles_texture_bind(struct yagl_gles_texture *texture, - GLenum target); - -GLenum yagl_gles_texture_get_target(struct yagl_gles_texture *texture); - -void yagl_gles_texture_set_image(struct yagl_gles_texture *texture, - struct yagl_gles_image *image); - -void yagl_gles_texture_unset_image(struct yagl_gles_texture *texture); - -/* - * Helpers for use in yagl_gles_tex_image only. - * @{ - */ -void yagl_gles_texture_set_tex_image(struct yagl_gles_texture *texture, - struct yagl_gles_tex_image *tex_image); - -void yagl_gles_texture_unset_tex_image(struct yagl_gles_texture *texture); -/* - * @} - */ - -void yagl_gles_texture_release_tex_image(struct yagl_gles_texture *texture); - -#endif diff --git a/hw/yagl_apis/gles/yagl_gles_texture_unit.c b/hw/yagl_apis/gles/yagl_gles_texture_unit.c deleted file mode 100644 index fbb99ef..0000000 --- a/hw/yagl_apis/gles/yagl_gles_texture_unit.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include "yagl_gles_texture_unit.h" -#include "yagl_gles_context.h" -#include "yagl_gles_texture.h" -#include "yagl_sharegroup.h" - -void yagl_gles_texture_unit_init(struct yagl_gles_texture_unit *texture_unit, - struct yagl_gles_context *ctx) -{ - memset(texture_unit, 0, sizeof(*texture_unit)); - - texture_unit->ctx = ctx; -} - -void yagl_gles_texture_unit_cleanup(struct yagl_gles_texture_unit *texture_unit) -{ - int i; - - for (i = 0; i < YAGL_NUM_GLES_TEXTURE_TARGETS; ++i) { - yagl_gles_texture_release(texture_unit->target_states[i].texture); - texture_unit->target_states[i].texture = NULL; - texture_unit->target_states[i].texture_local_name = 0; - } -} diff --git a/hw/yagl_apis/gles/yagl_gles_texture_unit.h b/hw/yagl_apis/gles/yagl_gles_texture_unit.h deleted file mode 100644 index c683a37..0000000 --- a/hw/yagl_apis/gles/yagl_gles_texture_unit.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef _QEMU_YAGL_GLES_TEXTURE_UNIT_H -#define _QEMU_YAGL_GLES_TEXTURE_UNIT_H - -#include "yagl_gles_types.h" - -struct yagl_gles_context; -struct yagl_gles_texture; - -struct yagl_gles_texture_target_state -{ - struct yagl_gles_texture *texture; - yagl_object_name texture_local_name; - - /* - * For GLESv1 only. In GLESv2 2D texture and cubemap textures cannot be - * enabled/disabled. Currently not used. - */ - bool enabled; -}; - -struct yagl_gles_texture_unit -{ - /* - * Owning context. - */ - struct yagl_gles_context *ctx; - - struct yagl_gles_texture_target_state target_states[YAGL_NUM_GLES_TEXTURE_TARGETS]; -}; - -void yagl_gles_texture_unit_init(struct yagl_gles_texture_unit *texture_unit, - struct yagl_gles_context *ctx); - -void yagl_gles_texture_unit_cleanup(struct yagl_gles_texture_unit *texture_unit); - -#endif diff --git a/hw/yagl_apis/gles/yagl_gles_types.h b/hw/yagl_apis/gles/yagl_gles_types.h deleted file mode 100644 index 616e90c..0000000 --- a/hw/yagl_apis/gles/yagl_gles_types.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _QEMU_YAGL_GLES_TYPES_H -#define _QEMU_YAGL_GLES_TYPES_H - -#include "yagl_types.h" - -typedef enum -{ - yagl_gles_texture_target_2d = 0, - yagl_gles_texture_target_cubemap = 1 -} yagl_gles_texture_target; - -#define YAGL_NUM_GLES_TEXTURE_TARGETS 2 - -typedef enum -{ - yagl_gles_framebuffer_attachment_color0 = 0, - yagl_gles_framebuffer_attachment_depth = 1, - yagl_gles_framebuffer_attachment_stencil = 2 -} yagl_gles_framebuffer_attachment; - -#define YAGL_NUM_GLES_FRAMEBUFFER_ATTACHMENTS 3 - -#endif diff --git a/hw/yagl_apis/gles/yagl_gles_validate.c b/hw/yagl_apis/gles/yagl_gles_validate.c deleted file mode 100644 index 4c41e80..0000000 --- a/hw/yagl_apis/gles/yagl_gles_validate.c +++ /dev/null @@ -1,113 +0,0 @@ -#include -#include "yagl_gles_validate.h" - -bool yagl_gles_is_buffer_target_valid(GLenum target) -{ - switch (target) { - case GL_ARRAY_BUFFER: - case GL_ELEMENT_ARRAY_BUFFER: - return true; - default: - return false; - } -} - -bool yagl_gles_is_buffer_usage_valid(GLenum usage) -{ - switch (usage) { - case GL_STREAM_DRAW: - case GL_STATIC_DRAW: - case GL_DYNAMIC_DRAW: - return true; - default: - return false; - } -} - -bool yagl_gles_get_index_size(GLenum type, int *index_size) -{ - switch (type) { - case GL_UNSIGNED_BYTE: - *index_size = 1; - break; - case GL_UNSIGNED_SHORT: - *index_size = 2; - break; - default: - return false; - } - return true; -} - -bool yagl_gles_buffer_target_to_binding(GLenum target, GLenum *binding) -{ - switch (target) { - case GL_ARRAY_BUFFER: - *binding = GL_ARRAY_BUFFER_BINDING; - return true; - case GL_ELEMENT_ARRAY_BUFFER: - *binding = GL_ELEMENT_ARRAY_BUFFER_BINDING; - return true; - default: - return false; - } -} - -bool yagl_gles_validate_texture_target(GLenum target, - yagl_gles_texture_target *texture_target) -{ - switch (target) { - case GL_TEXTURE_2D: - *texture_target = yagl_gles_texture_target_2d; - break; - case GL_TEXTURE_CUBE_MAP: - *texture_target = yagl_gles_texture_target_cubemap; - break; - default: - return false; - } - - return true; -} - -bool yagl_gles_validate_framebuffer_attachment(GLenum attachment, - yagl_gles_framebuffer_attachment *framebuffer_attachment) -{ - switch (attachment) { - case GL_COLOR_ATTACHMENT0: - *framebuffer_attachment = yagl_gles_framebuffer_attachment_color0; - break; - case GL_DEPTH_ATTACHMENT: - *framebuffer_attachment = yagl_gles_framebuffer_attachment_depth; - break; - case GL_STENCIL_ATTACHMENT: - *framebuffer_attachment = yagl_gles_framebuffer_attachment_stencil; - break; - default: - return false; - } - - return true; -} - -bool yagl_gles_validate_texture_target_squash(GLenum target, - GLenum *squashed_target) -{ - switch (target) { - case GL_TEXTURE_2D: - *squashed_target = GL_TEXTURE_2D; - break; - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: - *squashed_target = GL_TEXTURE_CUBE_MAP; - break; - default: - return false; - } - - return true; -} diff --git a/hw/yagl_apis/gles/yagl_gles_validate.h b/hw/yagl_apis/gles/yagl_gles_validate.h deleted file mode 100644 index 5abf8dd..0000000 --- a/hw/yagl_apis/gles/yagl_gles_validate.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef _QEMU_YAGL_GLES_VALIDATE_H -#define _QEMU_YAGL_GLES_VALIDATE_H - -#include "yagl_gles_types.h" - -bool yagl_gles_is_buffer_target_valid(GLenum target); - -bool yagl_gles_is_buffer_usage_valid(GLenum usage); - -bool yagl_gles_get_index_size(GLenum type, int *index_size); - -bool yagl_gles_buffer_target_to_binding(GLenum target, GLenum *binding); - -bool yagl_gles_validate_texture_target(GLenum target, - yagl_gles_texture_target *texture_target); - -bool yagl_gles_validate_framebuffer_attachment(GLenum attachment, - yagl_gles_framebuffer_attachment *framebuffer_attachment); - -bool yagl_gles_validate_texture_target_squash(GLenum target, - GLenum *squashed_target); - -#endif diff --git a/hw/yagl_apis/gles/yagl_host_gles_calls.c b/hw/yagl_apis/gles/yagl_host_gles_calls.c index 650e4da..d1922f5 100644 --- a/hw/yagl_apis/gles/yagl_host_gles_calls.c +++ b/hw/yagl_apis/gles/yagl_host_gles_calls.c @@ -1,1056 +1,696 @@ -#include #include "yagl_host_gles_calls.h" -#include "yagl_egl_interface.h" -#include "yagl_gles_context.h" +#include "yagl_gles_calls.h" +#include "yagl_gles_api.h" #include "yagl_gles_driver.h" -#include "yagl_gles_texture.h" -#include "yagl_gles_texture_unit.h" -#include "yagl_gles_buffer.h" -#include "yagl_gles_validate.h" -#include "yagl_gles_image.h" -#include "yagl_gles_framebuffer.h" -#include "yagl_gles_renderbuffer.h" -#include "yagl_gles_array.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_sharegroup.h" - -#define YAGL_SET_ERR(err) \ - yagl_gles_context_set_error(ctx, err); \ - YAGL_LOG_ERROR("error = 0x%X", err) - -#define YAGL_GET_CTX_IMPL(func, ret_expr) \ - struct yagl_gles_context *ctx = \ - (struct yagl_gles_context*)cur_ts->ps->egl_iface->get_ctx(cur_ts->ps->egl_iface); \ - YAGL_LOG_FUNC_SET(func); \ - if (!ctx) { \ - YAGL_LOG_WARN("no current context"); \ - ret_expr; \ - } - -#define YAGL_GET_CTX_RET(func, ret) YAGL_GET_CTX_IMPL(func, return ret) +#include "yagl_vector.h" +#include "yagl_object_map.h" -#define YAGL_GET_CTX(func) YAGL_GET_CTX_IMPL(func, return) +static YAGL_DEFINE_TLS(struct yagl_gles_api_ts*, gles_api_ts); -#define YAGL_UNIMPLEMENTED_RET(func, ret) \ - YAGL_GET_CTX_RET(func, ret); \ - YAGL_LOG_WARN("NOT IMPLEMENTED!!!"); \ - *retval = ret; \ - return true - -#define YAGL_UNIMPLEMENTED(func) \ - YAGL_GET_CTX(func); \ - YAGL_LOG_WARN("NOT IMPLEMENTED!!!"); \ - return true +struct yagl_gles_object +{ + struct yagl_object base; -/* - * We can't include GLES2/gl2ext.h here - */ -#define GL_HALF_FLOAT_OES 0x8D61 + struct yagl_gles_driver *driver; +}; -static GLenum yagl_get_actual_type(GLenum type) +typedef enum { - switch (type) { - case GL_HALF_FLOAT_OES: - return GL_HALF_FLOAT; - default: - return type; - } -} + 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; -static GLint yagl_get_actual_internalformat(GLint internalformat) +static void *yagl_gles_get_array(uint32_t indx, uint32_t size) { - switch (internalformat) { - case GL_BGRA: - return GL_RGBA; - default: - return internalformat; - } -} + struct yagl_vector *array; -static GLint yagl_get_stride(struct yagl_gles_context *ctx, - GLuint alignment_type, - GLsizei width, - GLenum format, - GLenum type, - GLsizei *stride) -{ - unsigned num_components; - GLsizei bpp; - GLsizei alignment = 0; + if (indx >= gles_api_ts->num_arrays) { + struct yagl_vector *arrays; + uint32_t i; - switch (format) { - case GL_ALPHA: - num_components = 1; - break; - case GL_RGB: - num_components = 3; - break; - case GL_RGBA: - num_components = 4; - break; - case GL_BGRA: - num_components = 4; - break; - case GL_LUMINANCE: - num_components = 1; - break; - case GL_LUMINANCE_ALPHA: - num_components = 2; - break; - case GL_DEPTH_STENCIL_EXT: - if (!ctx->pack_depth_stencil) { - return GL_INVALID_ENUM; - } - if ((type == GL_FLOAT) || (type == GL_HALF_FLOAT_OES)) { - return GL_INVALID_OPERATION; - } - num_components = 1; - break; - case GL_DEPTH_COMPONENT: - if ((type != GL_UNSIGNED_SHORT) && (type != GL_UNSIGNED_INT)) { - return GL_INVALID_OPERATION; - } - num_components = 1; - break; - default: - return GL_INVALID_ENUM; - } + arrays = g_malloc((indx + 1) * sizeof(arrays[0])); - switch (type) { - case GL_UNSIGNED_BYTE: - bpp = num_components; - break; - case GL_UNSIGNED_SHORT_5_6_5: - if (format != GL_RGB) { - return GL_INVALID_OPERATION; - } - bpp = 2; - break; - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_5_5_5_1: - if (format != GL_RGBA) { - return GL_INVALID_OPERATION; - } - bpp = 2; - break; - case GL_UNSIGNED_INT_24_8_EXT: - if (!ctx->pack_depth_stencil) { - return GL_INVALID_ENUM; - } - bpp = num_components * 4; - break; - case GL_UNSIGNED_SHORT: - if (format != GL_DEPTH_COMPONENT) { - return GL_INVALID_OPERATION; - } - bpp = num_components * 2; - break; - case GL_UNSIGNED_INT: - if (format != GL_DEPTH_COMPONENT) { - return GL_INVALID_OPERATION; + memcpy(arrays, + gles_api_ts->arrays, + gles_api_ts->num_arrays * sizeof(arrays[0])); + + for (i = gles_api_ts->num_arrays; i < (indx + 1); ++i) { + yagl_vector_init(&arrays[i], 1, 0); } - bpp = num_components * 4; - break; - case GL_FLOAT: - bpp = num_components * 4; - break; - case GL_HALF_FLOAT_OES: - bpp = num_components * 2; - break; - default: - return GL_INVALID_ENUM; - } - ctx->driver->GetIntegerv(alignment_type, &alignment); + g_free(gles_api_ts->arrays); - if (!alignment) { - alignment = 1; + gles_api_ts->arrays = arrays; + gles_api_ts->num_arrays = indx + 1; } - *stride = ((width * bpp) + alignment - 1) & ~(alignment - 1); + array = &gles_api_ts->arrays[indx]; + + yagl_vector_resize(array, size); - return GL_NO_ERROR; + return yagl_vector_data(array); } -static bool yagl_get_integer(struct yagl_gles_context *ctx, - GLenum pname, - GLint *param) +static bool yagl_gles_program_get_uniform_type(GLuint program, + GLint location, + GLenum *type) { - switch (pname) { - case GL_ACTIVE_TEXTURE: - *param = GL_TEXTURE0 + ctx->active_texture_unit; - break; - case GL_TEXTURE_BINDING_2D: - *param = yagl_gles_context_get_active_texture_target_state(ctx, - yagl_gles_texture_target_2d)->texture_local_name; - break; - case GL_TEXTURE_BINDING_CUBE_MAP: - *param = yagl_gles_context_get_active_texture_target_state(ctx, - yagl_gles_texture_target_cubemap)->texture_local_name; - break; - case GL_ARRAY_BUFFER_BINDING: - *param = ctx->vbo_local_name; - break; - case GL_ELEMENT_ARRAY_BUFFER_BINDING: - *param = ctx->ebo_local_name; - break; - default: + 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; } - return true; -} - -void yagl_host_glActiveTexture(GLenum texture) -{ - YAGL_GET_CTX(glActiveTexture); + gles_api_ts->driver->GetProgramiv(program, + GL_LINK_STATUS, + &link_status); - if (yagl_gles_context_set_active_texture(ctx, texture)) { - ctx->driver->ActiveTexture(texture); - } else { - YAGL_SET_ERR(GL_INVALID_ENUM); + if (link_status == GL_FALSE) { + return false; } -} -void yagl_host_glBindBuffer(GLenum target, - GLuint buffer) -{ - struct yagl_gles_buffer *buffer_obj = NULL; + gles_api_ts->driver->GetProgramiv(program, + GL_ACTIVE_UNIFORMS, + &num_active_uniforms); - YAGL_GET_CTX(glBindBuffer); + gles_api_ts->driver->GetProgramiv(program, + GL_ACTIVE_UNIFORM_MAX_LENGTH, + &uniform_name_max_length); - if (buffer != 0) { - buffer_obj = (struct yagl_gles_buffer*)yagl_sharegroup_acquire_object(ctx->base.sg, - YAGL_NS_BUFFER, buffer); + uniform_name = g_malloc(uniform_name_max_length + 1); - if (!buffer_obj) { - buffer_obj = yagl_gles_buffer_create(ctx->driver); + for (i = 0; i < num_active_uniforms; ++i) { + GLsizei length = 0; + GLint size = 0; + GLenum tmp_type = 0; - if (!buffer_obj) { - goto out; - } + gles_api_ts->driver->GetActiveUniform(program, + i, + uniform_name_max_length, + &length, + &size, + &tmp_type, + uniform_name); - buffer_obj = (struct yagl_gles_buffer*)yagl_sharegroup_add_named(ctx->base.sg, - YAGL_NS_BUFFER, buffer, &buffer_obj->base); + if (length == 0) { + YAGL_LOG_ERROR("Cannot get active uniform %d for program %d", i, program); + continue; } - } - if (!yagl_gles_context_bind_buffer(ctx, target, buffer_obj, buffer)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - goto out; + if (gles_api_ts->driver->GetUniformLocation(program, + uniform_name) == location) { + *type = tmp_type; + res = true; + break; + } } - if (buffer_obj) { - yagl_gles_buffer_set_bound(buffer_obj); - } + g_free(uniform_name); + + return res; +} -out: - yagl_gles_buffer_release(buffer_obj); +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; + default: return false; + } + return true; } -void yagl_host_glBindTexture(GLenum target, - GLuint texture) +static bool yagl_gles_get_array_param_count(GLenum pname, int *count) { - struct yagl_gles_texture *texture_obj = NULL; - yagl_gles_texture_target texture_target; - - YAGL_GET_CTX(glBindTexture); - - if (!yagl_gles_validate_texture_target(target, &texture_target)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - goto out; + switch (pname) { + 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; + case GL_CURRENT_VERTEX_ATTRIB: *count = 4; break; + default: return false; } + return true; +} - if (texture != 0) { - texture_obj = (struct yagl_gles_texture*)yagl_sharegroup_acquire_object(ctx->base.sg, - YAGL_NS_TEXTURE, texture); - - if (!texture_obj) { - texture_obj = yagl_gles_texture_create(ctx->driver); - - if (!texture_obj) { - goto out; - } - - texture_obj = (struct yagl_gles_texture*)yagl_sharegroup_add_named(ctx->base.sg, - YAGL_NS_TEXTURE, texture, &texture_obj->base); - } +static void yagl_gles_object_add(GLuint local_name, + GLuint global_name, + void (*destroy_func)(struct yagl_object */*obj*/)) +{ + struct yagl_gles_object *obj; - if (!yagl_gles_texture_bind(texture_obj, target)) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - } else { - ctx->driver->BindTexture(target, 0); - } + obj = g_malloc(sizeof(*obj)); - yagl_gles_context_bind_texture(ctx, texture_target, texture_obj, texture); + obj->base.global_name = global_name; + obj->base.destroy = destroy_func; + obj->driver = gles_api_ts->driver; -out: - yagl_gles_texture_release(texture_obj); + yagl_object_map_add(cur_ts->ps->object_map, + local_name, + &obj->base); } -void yagl_host_glBlendFunc(GLenum sfactor, - GLenum dfactor) +static void yagl_gles_buffer_destroy(struct yagl_object *obj) { - YAGL_GET_CTX(glBlendFunc); + struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; - ctx->driver->BlendFunc(sfactor, dfactor); -} + YAGL_LOG_FUNC_ENTER(yagl_gles_buffer_destroy, "%u", obj->global_name); -void yagl_host_glBlendEquation(GLenum mode) -{ - YAGL_GET_CTX(glBlendEquation); + yagl_ensure_ctx(); + gles_obj->driver->DeleteBuffers(1, &obj->global_name); + yagl_unensure_ctx(); - ctx->driver->BlendEquation(mode); + g_free(gles_obj); + + YAGL_LOG_FUNC_EXIT(NULL); } -void yagl_host_glBlendFuncSeparate(GLenum srcRGB, - GLenum dstRGB, - GLenum srcAlpha, - GLenum dstAlpha) +static void yagl_gles_texture_destroy(struct yagl_object *obj) { - YAGL_GET_CTX(glBlendFuncSeparate); + struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; - ctx->driver->BlendFuncSeparate(srcRGB, - dstRGB, - srcAlpha, - dstAlpha); -} + YAGL_LOG_FUNC_ENTER(yagl_gles_texture_destroy, "%u", obj->global_name); -void yagl_host_glBlendEquationSeparate(GLenum modeRGB, - GLenum modeAlpha) -{ - YAGL_GET_CTX(glBlendEquationSeparate); + yagl_ensure_ctx(); + gles_obj->driver->DeleteTextures(1, &obj->global_name); + yagl_unensure_ctx(); + + g_free(gles_obj); - ctx->driver->BlendEquationSeparate(modeRGB, modeAlpha); + YAGL_LOG_FUNC_EXIT(NULL); } -void yagl_host_glBufferData(GLenum target, - const GLvoid *data, int32_t data_count, - GLenum usage) +static void yagl_gles_framebuffer_destroy(struct yagl_object *obj) { - struct yagl_gles_buffer *buffer_obj = NULL; + struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; - YAGL_GET_CTX(glBufferData); + YAGL_LOG_FUNC_ENTER(yagl_gles_framebuffer_destroy, "%u", obj->global_name); - if (!yagl_gles_is_buffer_target_valid(target)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - goto out; - } + yagl_ensure_ctx(); + gles_obj->driver->DeleteFramebuffers(1, &obj->global_name); + yagl_unensure_ctx(); - if (data_count < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } + g_free(gles_obj); - if (!yagl_gles_is_buffer_usage_valid(usage)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - goto out; - } + 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; - buffer_obj = yagl_gles_context_acquire_binded_buffer(ctx, target); + YAGL_LOG_FUNC_ENTER(yagl_gles_renderbuffer_destroy, "%u", obj->global_name); - if (!buffer_obj) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } + yagl_ensure_ctx(); + gles_obj->driver->DeleteRenderbuffers(1, &obj->global_name); + yagl_unensure_ctx(); - yagl_gles_buffer_set_data(buffer_obj, data_count, data, usage); + g_free(gles_obj); -out: - yagl_gles_buffer_release(buffer_obj); + YAGL_LOG_FUNC_EXIT(NULL); } -void yagl_host_glBufferSubData(GLenum target, - GLsizei offset, - const GLvoid *data, int32_t data_count) +static void yagl_gles_program_destroy(struct yagl_object *obj) { - struct yagl_gles_buffer *buffer_obj = NULL; + struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; - YAGL_GET_CTX(glBufferSubData); + YAGL_LOG_FUNC_ENTER(yagl_gles_program_destroy, "%u", obj->global_name); - if (!yagl_gles_is_buffer_target_valid(target)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - goto out; - } + yagl_ensure_ctx(); + gles_obj->driver->DeleteProgram(obj->global_name); + yagl_unensure_ctx(); - if ((offset < 0) || (data_count < 0)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } + g_free(gles_obj); - buffer_obj = yagl_gles_context_acquire_binded_buffer(ctx, target); + YAGL_LOG_FUNC_EXIT(NULL); +} - if (!buffer_obj) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } +static void yagl_gles_shader_destroy(struct yagl_object *obj) +{ + struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; - if (data_count == 0) { - goto out; - } + YAGL_LOG_FUNC_ENTER(yagl_gles_shader_destroy, "%u", obj->global_name); - if (!yagl_gles_buffer_update_data(buffer_obj, offset, data_count, data)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } + yagl_ensure_ctx(); + gles_obj->driver->DeleteShader(obj->global_name); + yagl_unensure_ctx(); -out: - yagl_gles_buffer_release(buffer_obj); + g_free(gles_obj); + + YAGL_LOG_FUNC_EXIT(NULL); } -void yagl_host_glClear(GLbitfield mask) +static __inline GLuint yagl_gles_object_get(GLuint local_name) { - YAGL_GET_CTX(glClear); - - ctx->driver->Clear(mask); + return (local_name > 0) ? yagl_object_map_get(cur_ts->ps->object_map, local_name) : 0; } -void yagl_host_glClearColor(GLclampf red, - GLclampf green, - GLclampf blue, - GLclampf alpha) +static yagl_api_func yagl_host_gles_get_func(struct yagl_api_ps *api_ps, + uint32_t func_id) { - YAGL_GET_CTX(glClearColor); - - ctx->driver->ClearColor(red, green, blue, alpha); + if ((func_id <= 0) || (func_id > yagl_gles_api_num_funcs)) { + return NULL; + } else { + return yagl_gles_api_funcs[func_id - 1]; + } } -void yagl_host_glClearDepthf(GLclampf depth) +static void yagl_host_gles_thread_init(struct yagl_api_ps *api_ps) { - YAGL_GET_CTX(glClearDepthf); + struct yagl_gles_api_ps *gles_api_ps = (struct yagl_gles_api_ps*)api_ps; - ctx->driver->ClearDepth(depth); -} + YAGL_LOG_FUNC_ENTER(yagl_host_gles_thread_init, NULL); -void yagl_host_glClearStencil(GLint s) -{ - YAGL_GET_CTX(glClearStencil); + gles_api_ts = g_malloc0(sizeof(*gles_api_ts)); - ctx->driver->ClearStencil(s); -} + yagl_gles_api_ts_init(gles_api_ts, gles_api_ps->driver, gles_api_ps); -void yagl_host_glColorMask(GLboolean red, - GLboolean green, - GLboolean blue, - GLboolean alpha) -{ - YAGL_GET_CTX(glColorMask); + cur_ts->gles_api_ts = gles_api_ts; - ctx->driver->ColorMask(red, green, blue, alpha); + YAGL_LOG_FUNC_EXIT(NULL); } -void yagl_host_glCompressedTexImage2D(GLenum target, - GLint level, - GLenum internalformat, - GLsizei width, - GLsizei height, - GLint border, - const GLvoid *data, int32_t data_count) +static void yagl_host_gles_batch_start(struct yagl_api_ps *api_ps) { - GLenum err_code; - - YAGL_GET_CTX(glCompressedTexImage2D); - - if (target == GL_TEXTURE_2D) { - struct yagl_gles_texture_target_state *tex_target_state = - yagl_gles_context_get_active_texture_target_state(ctx, - yagl_gles_texture_target_2d); - if (tex_target_state->texture) { - /* - * This operation should orphan EGLImage according - * to OES_EGL_image specs. - */ - yagl_gles_texture_unset_image(tex_target_state->texture); - - /* - * This operation should release TexImage according - * to eglBindTexImage spec. - */ - yagl_gles_texture_release_tex_image(tex_target_state->texture); - } - } - - err_code = ctx->compressed_tex_image(ctx, - target, - level, - internalformat, - width, - height, - border, - data_count, - data); - - if (err_code != GL_NO_ERROR) { - YAGL_SET_ERR(err_code); - } + gles_api_ts = cur_ts->gles_api_ts; } -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) +static void yagl_host_gles_batch_end(struct yagl_api_ps *api_ps) { - YAGL_GET_CTX(glCompressedTexSubImage2D); - - if (ctx->base.client_api == yagl_client_api_gles1) { - /* No formats are supported by this call in GLES1 API */ - YAGL_SET_ERR(GL_INVALID_OPERATION); - return; - } - - ctx->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) +static void yagl_host_gles_thread_fini(struct yagl_api_ps *api_ps) { - YAGL_GET_CTX(glCopyTexImage2D); + YAGL_LOG_FUNC_ENTER(yagl_host_gles_thread_fini, NULL); - if (ctx->base.client_api == yagl_client_api_gles1 && - target != GL_TEXTURE_2D) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } + gles_api_ts = cur_ts->gles_api_ts; - if (border != 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } + yagl_gles_api_ts_cleanup(gles_api_ts); + + g_free(gles_api_ts); - ctx->driver->CopyTexImage2D(target, - level, - internalformat, - x, - y, - width, - height, - border); + gles_api_ts = cur_ts->gles_api_ts = NULL; + + YAGL_LOG_FUNC_EXIT(NULL); } -void yagl_host_glCopyTexSubImage2D(GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) +static void yagl_host_gles_process_destroy(struct yagl_api_ps *api_ps) { - YAGL_GET_CTX(glCopyTexSubImage2D); + struct yagl_gles_api_ps *gles_api_ps = (struct yagl_gles_api_ps*)api_ps; - if (ctx->base.client_api == yagl_client_api_gles1 && - target != GL_TEXTURE_2D) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } + YAGL_LOG_FUNC_ENTER(yagl_host_gles_process_destroy, NULL); - ctx->driver->CopyTexSubImage2D(target, - level, - xoffset, - yoffset, - x, - y, - width, - height); -} + yagl_gles_api_ps_cleanup(gles_api_ps); + yagl_api_ps_cleanup(&gles_api_ps->base); -void yagl_host_glCullFace(GLenum mode) -{ - YAGL_GET_CTX(glCullFace); + g_free(gles_api_ps); - ctx->driver->CullFace(mode); + YAGL_LOG_FUNC_EXIT(NULL); } -void yagl_host_glDeleteBuffers(const GLuint *buffers, int32_t buffers_count) +struct yagl_api_ps *yagl_host_gles_process_init(struct yagl_api *api) { - GLsizei i; - struct yagl_gles_buffer *buffer_obj = NULL; + struct yagl_gles_api *gles_api = (struct yagl_gles_api*)api; + struct yagl_gles_api_ps *gles_api_ps; - YAGL_GET_CTX(glDeleteBuffers); + YAGL_LOG_FUNC_ENTER(yagl_host_gles_process_init, NULL); - if (buffers_count < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } + gles_api_ps = g_malloc0(sizeof(*gles_api_ps)); - if (buffers) { - for (i = 0; i < buffers_count; ++i) { - buffer_obj = (struct yagl_gles_buffer*)yagl_sharegroup_acquire_object(ctx->base.sg, - YAGL_NS_BUFFER, buffers[i]); + yagl_api_ps_init(&gles_api_ps->base, api); - if (buffer_obj) { - yagl_gles_context_unbind_buffer(ctx, buffer_obj); - } + 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_sharegroup_remove(ctx->base.sg, - YAGL_NS_BUFFER, - buffers[i]); + yagl_gles_api_ps_init(gles_api_ps, gles_api->driver); - yagl_gles_buffer_release(buffer_obj); - } - } + YAGL_LOG_FUNC_EXIT(NULL); + + return &gles_api_ps->base; } -void yagl_host_glDeleteTextures(const GLuint *textures, int32_t textures_count) +void yagl_host_glDrawArrays(GLenum mode, + GLint first, + GLsizei count) { - GLsizei i; + gles_api_ts->driver->DrawArrays(mode, first, count); +} - YAGL_GET_CTX(glDeleteTextures); +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); + } +} - if (textures_count < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; +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); } - if (textures) { - for (i = 0; i < textures_count; ++i) { - yagl_gles_context_unbind_texture(ctx, textures[i]); + gles_api_ts->driver->ReadPixels(x, + y, + width, + height, + format, + type, + pixels); - yagl_sharegroup_remove(ctx->base.sg, - YAGL_NS_TEXTURE, - textures[i]); + *pixels_count = pixels_maxcount; - } + if (current_pbo != 0) { + gles_api_ts->driver->BindBuffer(GL_PIXEL_PACK_BUFFER_ARB, + current_pbo); } } -void yagl_host_glDepthFunc(GLenum func) +void yagl_host_glDisableVertexAttribArray(GLuint index) { - YAGL_GET_CTX(glDepthFunc); + gles_api_ts->driver->DisableVertexAttribArray(index); +} - ctx->driver->DepthFunc(func); +void yagl_host_glEnableVertexAttribArray(GLuint index) +{ + gles_api_ts->driver->EnableVertexAttribArray(index); } -void yagl_host_glDepthMask(GLboolean flag) +void yagl_host_glVertexAttribPointerData(GLuint indx, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + GLint first, + const GLvoid *data, int32_t data_count) { - YAGL_GET_CTX(glDepthMask); + void *array_data = yagl_gles_get_array(indx, first * stride + data_count); + + memcpy(array_data + (first * stride), data, data_count); - ctx->driver->DepthMask(flag); + gles_api_ts->driver->VertexAttribPointer(indx, size, type, normalized, + stride, array_data); } -void yagl_host_glDepthRangef(GLclampf zNear, - GLclampf zFar) +void yagl_host_glVertexAttribPointerOffset(GLuint indx, + GLint size, + GLenum type, + GLboolean normalized, + GLsizei stride, + GLsizei offset) { - YAGL_GET_CTX(glDepthRangef); - - ctx->driver->DepthRange(zNear, zFar); + gles_api_ts->driver->VertexAttribPointer(indx, size, type, normalized, + stride, (const GLvoid*)(uintptr_t)offset); } -void yagl_host_glDisable(GLenum cap) +void yagl_host_glVertexPointerData(GLint size, + GLenum type, + GLsizei stride, + GLint first, + const GLvoid *data, int32_t data_count) { - YAGL_GET_CTX(glDisable); + void *array_data = yagl_gles_get_array(yagl_gles1_array_vertex, first * stride + data_count); - ctx->driver->Disable(cap); + memcpy(array_data + (first * stride), data, data_count); - if (cap == GL_TEXTURE_2D) { - yagl_gles_context_active_texture_set_enabled(ctx, - yagl_gles_texture_target_2d, false); - } + gles_api_ts->driver->VertexPointer(size, type, stride, array_data); } -void yagl_host_glDrawArrays(GLenum mode, - GLint first, - GLsizei count) +void yagl_host_glVertexPointerOffset(GLint size, + GLenum type, + GLsizei stride, + GLsizei offset) { - YAGL_GET_CTX(glDrawArrays); + gles_api_ts->driver->VertexPointer(size, type, stride, (const GLvoid*)(uintptr_t)offset); +} - if ((first < 0) || (count < 0)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } +void yagl_host_glNormalPointerData(GLenum type, + GLsizei stride, + GLint first, + const GLvoid *data, int32_t data_count) +{ + void *array_data = yagl_gles_get_array(yagl_gles1_array_normal, first * stride + data_count); - if (count == 0) { - return; - } + memcpy(array_data + (first * stride), data, data_count); - yagl_gles_context_transfer_arrays_vbo(ctx); + gles_api_ts->driver->NormalPointer(type, stride, array_data); +} - ctx->draw_arrays(ctx, mode, first, count); +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_glTransferArrayYAGL(GLuint indx, +void yagl_host_glColorPointerData(GLint size, + GLenum type, + GLsizei stride, GLint first, const GLvoid *data, int32_t data_count) { - YAGL_GET_CTX(glTransferArrayYAGL); + void *array_data = yagl_gles_get_array(yagl_gles1_array_color, first * stride + data_count); - if (((int)indx < ctx->num_arrays) && - data && - (first >= 0) && - (data_count > 0)) { - yagl_gles_array_transfer(&ctx->arrays[indx], first, data, data_count); - } + memcpy(array_data + (first * stride), data, data_count); + + gles_api_ts->driver->ColorPointer(size, type, stride, array_data); } -void yagl_host_glDrawElementsIndicesYAGL(GLenum mode, +void yagl_host_glColorPointerOffset(GLint size, GLenum type, - const GLvoid *indices, int32_t indices_count) + GLsizei stride, + GLsizei offset) { - int index_size = 0; + gles_api_ts->driver->ColorPointer(size, type, stride, (const GLvoid*)(uintptr_t)offset); +} - YAGL_GET_CTX(glDrawElements); - - if (ctx->ebo) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - return; - } - - if (indices_count < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } - - if (indices_count == 0) { - return; - } - - if (!yagl_gles_get_index_size(type, &index_size)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } - - if (!indices) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } +void yagl_host_glTexCoordPointerData(GLint tex_id, + GLint size, + GLenum type, + GLsizei stride, + GLint first, + const GLvoid *data, int32_t data_count) +{ + void *array_data = yagl_gles_get_array(yagl_gles1_array_texcoord + tex_id, + first * stride + data_count); - yagl_gles_context_transfer_arrays_vbo(ctx); + memcpy(array_data + (first * stride), data, data_count); - ctx->draw_elements(ctx, - mode, - (indices_count / index_size), - type, - indices); + gles_api_ts->driver->TexCoordPointer(size, type, stride, array_data); } -void yagl_host_glDrawElementsOffsetYAGL(GLenum mode, +void yagl_host_glTexCoordPointerOffset(GLint size, GLenum type, - GLsizei offset, - GLsizei count) + GLsizei stride, + GLsizei offset) { - yagl_object_name old_buffer_name = 0; - - YAGL_GET_CTX(glDrawElements); - - if (!ctx->ebo) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - return; - } - - if (count < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } - - if (count == 0) { - return; - } - - yagl_gles_buffer_bind(ctx->ebo, - type, - false, - GL_ELEMENT_ARRAY_BUFFER, - &old_buffer_name); - - yagl_gles_buffer_transfer(ctx->ebo, - type, - GL_ELEMENT_ARRAY_BUFFER, - false); - - yagl_gles_context_transfer_arrays_vbo(ctx); - - ctx->draw_elements(ctx, - mode, - count, - type, - (const GLvoid*)offset); - - ctx->driver->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, - old_buffer_name); + gles_api_ts->driver->TexCoordPointer(size, type, stride, (const GLvoid*)(uintptr_t)offset); } -void yagl_host_glGetVertexAttribRangeYAGL(GLenum type, - GLsizei offset, - GLsizei count, - GLint *range_first, - GLsizei *range_count) +void yagl_host_glDisableClientState(GLenum array) { - uint32_t first_idx = UINT32_MAX, last_idx = 0; + gles_api_ts->driver->DisableClientState(array); +} - YAGL_GET_CTX(glGetVertexAttribRangesYAGL); +void yagl_host_glEnableClientState(GLenum array) +{ + gles_api_ts->driver->EnableClientState(array); +} - if (!ctx->ebo) { - return; - } +void yagl_host_glGenBuffers(const GLuint *buffers, int32_t buffers_count) +{ + int i; - if (!yagl_gles_buffer_get_minmax_index(ctx->ebo, - type, - offset, - count, - &first_idx, - &last_idx)) { - return; - } + for (i = 0; i < buffers_count; ++i) { + GLuint global_name; - if (range_first) { - *range_first = (GLint)first_idx; - } + gles_api_ts->driver->GenBuffers(1, &global_name); - if (range_count) { - *range_count = (GLsizei)(last_idx + 1 - first_idx); + yagl_gles_object_add(buffers[i], + global_name, + &yagl_gles_buffer_destroy); } } -void yagl_host_glEnable(GLenum cap) +void yagl_host_glBindBuffer(GLenum target, + GLuint buffer) { - YAGL_GET_CTX(glEnable); - - ctx->driver->Enable(cap); - - if (cap == GL_TEXTURE_2D) { - yagl_gles_context_active_texture_set_enabled(ctx, - yagl_gles_texture_target_2d, true); - } + gles_api_ts->driver->BindBuffer(target, yagl_gles_object_get(buffer)); } -void yagl_host_glFlush(void) +void yagl_host_glBufferData(GLenum target, + const GLvoid *data, int32_t data_count, + GLenum usage) { - YAGL_GET_CTX(glFlush); - - ctx->driver->Flush(); + gles_api_ts->driver->BufferData(target, data_count, data, usage); } -void yagl_host_glFrontFace(GLenum mode) +void yagl_host_glBufferSubData(GLenum target, + GLsizei offset, + const GLvoid *data, int32_t data_count) { - YAGL_GET_CTX(glFrontFace); - - ctx->driver->FrontFace(mode); + gles_api_ts->driver->BufferSubData(target, offset, data_count, data); } -void yagl_host_glGenBuffers(GLuint *buffer_names, int32_t buffers_maxcount, int32_t *buffers_count) +void yagl_host_glGenTextures(const GLuint *textures, int32_t textures_count) { - struct yagl_gles_buffer **buffers = NULL; - GLsizei i; - - YAGL_GET_CTX(glGenBuffers); + int i; - if (buffers_maxcount < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - buffers = g_malloc0(buffers_maxcount * sizeof(*buffers)); - - for (i = 0; i < buffers_maxcount; ++i) { - buffers[i] = yagl_gles_buffer_create(ctx->driver); - - if (!buffers[i]) { - goto out; - } - } - - for (i = 0; i < buffers_maxcount; ++i) { - yagl_object_name tmp = yagl_sharegroup_add(ctx->base.sg, - YAGL_NS_BUFFER, - &buffers[i]->base); - - if (buffer_names) { - buffer_names[i] = tmp; - } - } + for (i = 0; i < textures_count; ++i) { + GLuint global_name; - *buffers_count = buffers_maxcount; + /* + * We need ensure/unensure here for eglReleaseTexImage that + * might be called without an active context, but + * which needs to create a texture. + */ + yagl_ensure_ctx(); + gles_api_ts->driver->GenTextures(1, &global_name); + yagl_unensure_ctx(); -out: - for (i = 0; i < buffers_maxcount; ++i) { - yagl_gles_buffer_release(buffers[i]); + yagl_gles_object_add(textures[i], + global_name, + &yagl_gles_texture_destroy); } - g_free(buffers); } -void yagl_host_glGenTextures(GLuint *texture_names, int32_t textures_maxcount, int32_t *textures_count) +void yagl_host_glBindTexture(GLenum target, + GLuint texture) { - struct yagl_gles_texture **textures = NULL; - GLsizei i; - - YAGL_GET_CTX(glGenTextures); - - if (textures_maxcount < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - textures = g_malloc0(textures_maxcount * sizeof(*textures)); - - for (i = 0; i < textures_maxcount; ++i) { - textures[i] = yagl_gles_texture_create(ctx->driver); - - if (!textures[i]) { - goto out; - } - } - - for (i = 0; i < textures_maxcount; ++i) { - yagl_object_name tmp = yagl_sharegroup_add(ctx->base.sg, - YAGL_NS_TEXTURE, - &textures[i]->base); - - if (texture_names) { - texture_names[i] = tmp; - } - } - - *textures_count = textures_maxcount; - -out: - for (i = 0; i < textures_maxcount; ++i) { - yagl_gles_texture_release(textures[i]); - } - g_free(textures); + gles_api_ts->driver->BindTexture(target, yagl_gles_object_get(texture)); } -void yagl_host_glGetBooleanv(GLenum pname, - GLboolean *params, int32_t params_maxcount, int32_t *params_count) +void yagl_host_glActiveTexture(GLenum texture) { - YAGL_GET_CTX(glGetBooleanv); - - if (!ctx->get_param_count(ctx, pname, params_count)) { - YAGL_LOG_ERROR("Bad pname = 0x%X", pname); - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (!params) { - return; - } - - if (!ctx->get_booleanv(ctx, pname, params)) { - GLint param; - - if (yagl_get_integer(ctx, pname, ¶m)) { - params[0] = ((param != 0) ? GL_TRUE : GL_FALSE); - } else { - ctx->driver->GetBooleanv(pname, params); - } - } + gles_api_ts->driver->ActiveTexture(texture); } -void yagl_host_glGetBufferParameteriv(GLenum target, - GLenum pname, - GLint *param) +void yagl_host_glCompressedTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + const GLvoid *data, int32_t data_count) { - struct yagl_gles_buffer *buffer_obj = NULL; - GLint tmp = 0; - - YAGL_GET_CTX(glGetBufferParameteriv); - - if (!yagl_gles_is_buffer_target_valid(target)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - goto out; - } - - buffer_obj = yagl_gles_context_acquire_binded_buffer(ctx, target); - - if (!buffer_obj) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - if (!yagl_gles_buffer_get_parameter(buffer_obj, - pname, - &tmp)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - goto out; - } - - if (param) { - *param = tmp; - } - -out: - yagl_gles_buffer_release(buffer_obj); + gles_api_ts->driver->CompressedTexImage2D(target, + level, + internalformat, + width, + height, + border, + data_count, + data); } -GLenum yagl_host_glGetError(void) +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) { - GLenum ret; - - YAGL_GET_CTX_RET(glGetError, GL_NO_ERROR); - - ret = yagl_gles_context_get_error(ctx); - - return (ret == GL_NO_ERROR) ? ctx->driver->GetError() : ret; + gles_api_ts->driver->CompressedTexSubImage2D(target, + level, + xoffset, + yoffset, + width, + height, + format, + data_count, + data); } -void yagl_host_glGetFloatv(GLenum pname, - GLfloat *params, int32_t params_maxcount, int32_t *params_count) +void yagl_host_glCopyTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border) { - YAGL_GET_CTX(glGetFloatv); - - if (!ctx->get_param_count(ctx, pname, params_count)) { - YAGL_LOG_ERROR("Bad pname = 0x%X", pname); - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (!params) { - return; - } - - if (!ctx->get_floatv(ctx, pname, params)) { - GLint param; - - if (yagl_get_integer(ctx, pname, ¶m)) { - params[0] = (GLfloat)param; - } else { - ctx->driver->GetFloatv(pname, params); - } - } + gles_api_ts->driver->CopyTexImage2D(target, + level, + internalformat, + x, + y, + width, + height, + border); } -void yagl_host_glGetIntegerv(GLenum pname, - GLint *params, int32_t params_maxcount, int32_t *params_count) +void yagl_host_glCopyTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) { - YAGL_GET_CTX(glGetIntegerv); - - if (!ctx->get_param_count(ctx, pname, params_count)) { - YAGL_LOG_ERROR("Bad pname = 0x%X", pname); - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (!params) { - return; - } - - if (!ctx->get_integerv(ctx, pname, params)) { - if (!yagl_get_integer(ctx, pname, params)) { - ctx->driver->GetIntegerv(pname, params); - } - } + gles_api_ts->driver->CopyTexSubImage2D(target, + level, + xoffset, + yoffset, + x, + y, + width, + height); } void yagl_host_glGetTexParameterfv(GLenum target, @@ -1059,11 +699,9 @@ void yagl_host_glGetTexParameterfv(GLenum target, { GLfloat params[10]; - YAGL_GET_CTX(glGetTexParameterfv); - - ctx->driver->GetTexParameterfv(target, - pname, - params); + gles_api_ts->driver->GetTexParameterfv(target, + pname, + params); if (param) { *param = params[0]; @@ -1076,894 +714,1299 @@ void yagl_host_glGetTexParameteriv(GLenum target, { GLint params[10]; - YAGL_GET_CTX(glGetTexParameteriv); - - ctx->driver->GetTexParameteriv(target, - pname, - params); + gles_api_ts->driver->GetTexParameteriv(target, + pname, + params); if (param) { *param = params[0]; } } -void yagl_host_glHint(GLenum target, - GLenum mode) +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) { - YAGL_GET_CTX(glHint); - - ctx->driver->Hint(target, mode); + gles_api_ts->driver->TexImage2D(target, + level, + internalformat, + width, + height, + border, + format, + type, + pixels); } -GLboolean yagl_host_glIsBuffer(GLuint buffer) +void yagl_host_glTexParameterf(GLenum target, + GLenum pname, + GLfloat param) { - GLboolean res = GL_FALSE; - struct yagl_gles_buffer *buffer_obj = NULL; - - YAGL_GET_CTX_RET(glIsBuffer, GL_FALSE); - - buffer_obj = (struct yagl_gles_buffer*)yagl_sharegroup_acquire_object(ctx->base.sg, - YAGL_NS_BUFFER, buffer); - - if (buffer_obj && yagl_gles_buffer_was_bound(buffer_obj)) { - res = GL_TRUE; - } - - yagl_gles_buffer_release(buffer_obj); - - return res; + gles_api_ts->driver->TexParameterf(target, pname, param); } -GLboolean yagl_host_glIsEnabled(GLenum cap) +void yagl_host_glTexParameterfv(GLenum target, + GLenum pname, + const GLfloat *params, int32_t params_count) { - GLboolean res = GL_FALSE; + GLfloat tmp[10]; - YAGL_GET_CTX_RET(glIsEnabled, GL_FALSE); + memset(tmp, 0, sizeof(tmp)); - if (!ctx->is_enabled(ctx, &res, cap)) { - res = ctx->driver->IsEnabled(cap); + if (params) { + tmp[0] = *params; } - return res; + gles_api_ts->driver->TexParameterfv(target, + pname, + (params ? tmp : NULL)); } -GLboolean yagl_host_glIsTexture(GLuint texture) +void yagl_host_glTexParameteri(GLenum target, + GLenum pname, + GLint param) { - GLboolean res = GL_FALSE; - struct yagl_gles_texture *texture_obj = NULL; + gles_api_ts->driver->TexParameteri(target, pname, param); +} - YAGL_GET_CTX_RET(glIsTexture, GL_FALSE); +void yagl_host_glTexParameteriv(GLenum target, + GLenum pname, + const GLint *params, int32_t params_count) +{ + GLint tmp[10]; - texture_obj = (struct yagl_gles_texture*)yagl_sharegroup_acquire_object(ctx->base.sg, - YAGL_NS_TEXTURE, texture); + memset(tmp, 0, sizeof(tmp)); - if (texture_obj && (yagl_gles_texture_get_target(texture_obj) != 0)) { - res = GL_TRUE; + if (params) { + tmp[0] = *params; } - yagl_gles_texture_release(texture_obj); - - return res; + gles_api_ts->driver->TexParameteriv(target, + pname, + (params ? tmp : NULL)); } -void yagl_host_glLineWidth(GLfloat width) +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) { - YAGL_GET_CTX(glLineWidth); + gles_api_ts->driver->TexSubImage2D(target, + level, + xoffset, + yoffset, + width, + height, + format, + type, + pixels); +} - ctx->driver->LineWidth(width); +void yagl_host_glClientActiveTexture(GLenum texture) +{ + gles_api_ts->driver->ClientActiveTexture(texture); } -void yagl_host_glPixelStorei(GLenum pname, +void yagl_host_glTexEnvi(GLenum target, + GLenum pname, GLint param) { - YAGL_GET_CTX(glPixelStorei); - - ctx->driver->PixelStorei(pname, param); + gles_api_ts->driver->TexEnvi(target, pname, param); } -void yagl_host_glPolygonOffset(GLfloat factor, - GLfloat units) +void yagl_host_glTexEnvf(GLenum target, + GLenum pname, + GLfloat param) { - YAGL_GET_CTX(glPolygonOffset); - - ctx->driver->PolygonOffset(factor, units); + gles_api_ts->driver->TexEnvf(target, pname, param); } -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_glMultiTexCoord4f(GLenum target, + GLfloat s, + GLfloat tt, + GLfloat r, + GLfloat q) { - yagl_object_name current_pbo = 0; - GLint err; - GLsizei stride = 0; - GLenum actual_type = yagl_get_actual_type(type); - - YAGL_GET_CTX(glReadPixels); + gles_api_ts->driver->MultiTexCoord4f(target, s, tt, r, q); +} - if (!pixels || (width <= 0) || (height <= 0)) { - return; - } +void yagl_host_glTexEnviv(GLenum target, + GLenum pname, + const GLint *params, int32_t params_count) +{ + gles_api_ts->driver->TexEnviv(target, pname, params); +} - err = yagl_get_stride(ctx, - GL_PACK_ALIGNMENT, - width, - format, - type, - &stride); +void yagl_host_glTexEnvfv(GLenum target, + GLenum pname, + const GLfloat *params, int32_t params_count) +{ + gles_api_ts->driver->TexEnvfv(target, pname, params); +} - if (err != GL_NO_ERROR) { - YAGL_SET_ERR(err); - return; - } +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; +} - ctx->driver->GetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING_ARB, - (GLint*)¤t_pbo); - if (current_pbo != 0) { - ctx->driver->BindBuffer(GL_PIXEL_PACK_BUFFER_ARB, - 0); - } +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; - *pixels_count = stride * height; + for (i = 0; i < framebuffers_count; ++i) { + GLuint global_name; - ctx->driver->ReadPixels(x, - y, - width, - height, - format, - actual_type, - pixels); + gles_api_ts->driver->GenFramebuffers(1, &global_name); - if (current_pbo != 0) { - ctx->driver->BindBuffer(GL_PIXEL_PACK_BUFFER_ARB, - current_pbo); + yagl_gles_object_add(framebuffers[i], + global_name, + &yagl_gles_framebuffer_destroy); } } -void yagl_host_glSampleCoverage(GLclampf value, - GLboolean invert) +void yagl_host_glBindFramebuffer(GLenum target, + GLuint framebuffer) { - YAGL_GET_CTX(glSampleCoverage); - - ctx->driver->SampleCoverage(value, invert); + gles_api_ts->driver->BindFramebuffer(target, + yagl_gles_object_get(framebuffer)); } -void yagl_host_glScissor(GLint x, - GLint y, - GLsizei width, - GLsizei height) +void yagl_host_glFramebufferTexture2D(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level) { - YAGL_GET_CTX(glScissor); - - ctx->driver->Scissor(x, y, width, height); + gles_api_ts->driver->FramebufferTexture2D(target, attachment, + textarget, + yagl_gles_object_get(texture), + level); } -void yagl_host_glStencilFunc(GLenum func, - GLint ref, - GLuint mask) +void yagl_host_glFramebufferRenderbuffer(GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer) { - YAGL_GET_CTX(glStencilFunc); - - ctx->driver->StencilFunc(func, ref, mask); + gles_api_ts->driver->FramebufferRenderbuffer(target, + attachment, + renderbuffertarget, + yagl_gles_object_get(renderbuffer)); } -void yagl_host_glStencilMask(GLuint mask) +void yagl_host_glGenRenderbuffers(const GLuint *renderbuffers, int32_t renderbuffers_count) { - YAGL_GET_CTX(glStencilMask); + int i; - ctx->driver->StencilMask(mask); + 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, + &yagl_gles_renderbuffer_destroy); + } } -void yagl_host_glStencilOp(GLenum fail, - GLenum zfail, - GLenum zpass) +void yagl_host_glBindRenderbuffer(GLenum target, + GLuint renderbuffer) { - YAGL_GET_CTX(glStencilOp); - - ctx->driver->StencilOp(fail, zfail, zpass); + gles_api_ts->driver->BindRenderbuffer(target, + yagl_gles_object_get(renderbuffer)); } -void yagl_host_glTexImage2D(GLenum target, - GLint level, - GLint internalformat, +void yagl_host_glRenderbufferStorage(GLenum target, + GLenum internalformat, GLsizei width, - GLsizei height, - GLint border, - GLenum format, - GLenum type, - const GLvoid *pixels, int32_t pixels_count) + GLsizei height) { - GLsizei stride = 0; - GLenum actual_type = yagl_get_actual_type(type); - GLint actual_internalformat = yagl_get_actual_internalformat(internalformat); + gles_api_ts->driver->RenderbufferStorage(target, internalformat, width, height); +} - YAGL_GET_CTX(glTexImage2D); +void yagl_host_glGetRenderbufferParameteriv(GLenum target, + GLenum pname, + GLint *param) +{ + GLint params[10]; - if (pixels && (width > 0) && (height > 0)) { - GLint err = yagl_get_stride(ctx, - GL_UNPACK_ALIGNMENT, - width, - format, - type, - &stride); + gles_api_ts->driver->GetRenderbufferParameteriv(target, + pname, + params); - if (err != GL_NO_ERROR) { - YAGL_SET_ERR(err); - return; - } - } else { - pixels = NULL; + if (param) { + *param = params[0]; } +} - if (target == GL_TEXTURE_2D) { - struct yagl_gles_texture_target_state *tex_target_state = - yagl_gles_context_get_active_texture_target_state(ctx, - yagl_gles_texture_target_2d); - if (tex_target_state->texture) { - /* - * This operation should orphan EGLImage according - * to OES_EGL_image specs. - */ - yagl_gles_texture_unset_image(tex_target_state->texture); - - /* - * This operation should release TexImage according - * to eglBindTexImage spec. - */ - yagl_gles_texture_release_tex_image(tex_target_state->texture); - } - } +void yagl_host_glCreateProgram(GLuint program) +{ + GLuint global_name = gles_api_ts->driver->CreateProgram(); - ctx->driver->TexImage2D(target, - level, - actual_internalformat, - width, - height, - border, - format, - actual_type, - pixels); + yagl_gles_object_add(program, + global_name, + &yagl_gles_program_destroy); } -void yagl_host_glTexParameterf(GLenum target, - GLenum pname, - GLfloat param) +void yagl_host_glCreateShader(GLuint shader, + GLenum type) { - YAGL_GET_CTX(glTexParameterf); + GLuint global_name = gles_api_ts->driver->CreateShader(type); - ctx->driver->TexParameterf(target, pname, param); + yagl_gles_object_add(shader, + global_name, + &yagl_gles_shader_destroy); } -void yagl_host_glTexParameterfv(GLenum target, - GLenum pname, - const GLfloat *params, int32_t params_count) +void yagl_host_glShaderSource(GLuint shader, + const GLchar *string, int32_t string_count) { - GLfloat tmp[10]; + const GLchar *strings[1]; + GLint lenghts[1]; - YAGL_GET_CTX(glTexParameterfv); + strings[0] = string; + lenghts[0] = string_count - 1; - memset(tmp, 0, sizeof(tmp)); - - if (params) { - tmp[0] = *params; - } + gles_api_ts->driver->ShaderSource(yagl_gles_object_get(shader), + 1, + strings, + lenghts); +} - ctx->driver->TexParameterfv(target, - pname, - (params ? tmp : NULL)); +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_glTexParameteri(GLenum target, - GLenum pname, - GLint param) +void yagl_host_glDetachShader(GLuint program, + GLuint shader) { - YAGL_GET_CTX(glTexParameteri); + gles_api_ts->driver->DetachShader(yagl_gles_object_get(program), + yagl_gles_object_get(shader)); +} - ctx->driver->TexParameteri(target, pname, param); +void yagl_host_glCompileShader(GLuint shader) +{ + gles_api_ts->driver->CompileShader(yagl_gles_object_get(shader)); } -void yagl_host_glTexParameteriv(GLenum target, - GLenum pname, - const GLint *params, int32_t params_count) +void yagl_host_glBindAttribLocation(GLuint program, + GLuint index, + const GLchar *name, int32_t name_count) { - GLint tmp[10]; + gles_api_ts->driver->BindAttribLocation(yagl_gles_object_get(program), + index, + name); +} - YAGL_GET_CTX(glTexParameteriv); +GLboolean yagl_host_glGetActiveAttrib(GLuint program, + GLuint index, + GLint *size, + GLenum *type, + GLchar *name, int32_t name_maxcount, int32_t *name_count) +{ + GLsizei tmp = -1; - memset(tmp, 0, sizeof(tmp)); + gles_api_ts->driver->GetActiveAttrib(yagl_gles_object_get(program), + index, + name_maxcount, + &tmp, + size, + type, + name); - if (params) { - tmp[0] = *params; + if (tmp >= 0) { + *name_count = MIN(tmp + 1, name_maxcount); + return GL_TRUE; + } else { + return GL_FALSE; } - - ctx->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) +GLboolean yagl_host_glGetActiveUniform(GLuint program, + GLuint index, + GLint *size, + GLenum *type, + GLchar *name, int32_t name_maxcount, int32_t *name_count) { - GLsizei stride = 0; - GLenum actual_type = yagl_get_actual_type(type); + GLsizei tmp = -1; - YAGL_GET_CTX(glTexSubImage2D); - - if (pixels && (width > 0) && (height > 0)) { - GLint err = yagl_get_stride(ctx, - GL_UNPACK_ALIGNMENT, - width, - format, - type, - &stride); + gles_api_ts->driver->GetActiveUniform(yagl_gles_object_get(program), + index, + name_maxcount, + &tmp, + size, + type, + name); - if (err != GL_NO_ERROR) { - YAGL_SET_ERR(err); - return; - } + if (tmp >= 0) { + *name_count = MIN(tmp + 1, name_maxcount); + return GL_TRUE; } else { - pixels = NULL; - } - - /* - * Nvidia Windows openGL drivers doesn't account for GL_UNPACK_ALIGNMENT - * parameter when glTexSubImage2D function is called with format GL_ALPHA. - * Work around this by manually setting line stride. - */ - if (format == GL_ALPHA) { - ctx->driver->PixelStorei(GL_UNPACK_ROW_LENGTH, - stride); - } - - ctx->driver->TexSubImage2D(target, - level, - xoffset, - yoffset, - width, - height, - format, - actual_type, - pixels); - - if (format == GL_ALPHA) { - ctx->driver->PixelStorei(GL_UNPACK_ROW_LENGTH, - 0); + return GL_FALSE; } } -void yagl_host_glViewport(GLint x, - GLint y, - GLsizei width, - GLsizei height) +int yagl_host_glGetAttribLocation(GLuint program, + const GLchar *name, int32_t name_count) { - YAGL_GET_CTX(glViewport); + return gles_api_ts->driver->GetAttribLocation(yagl_gles_object_get(program), + name); +} - ctx->driver->Viewport(x, y, width, height); +void yagl_host_glGetProgramiv(GLuint program, + GLenum pname, + GLint *param) +{ + gles_api_ts->driver->GetProgramiv(yagl_gles_object_get(program), + pname, + param); } -void yagl_host_glEGLImageTargetTexture2DOES(GLenum target, - yagl_host_handle image_) +GLboolean yagl_host_glGetProgramInfoLog(GLuint program, + GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count) { - struct yagl_gles_image *image = NULL; - struct yagl_gles_texture_target_state *tex_target_state; + GLsizei tmp = -1; - YAGL_GET_CTX(glEGLImageTargetTexture2DOES); + gles_api_ts->driver->GetProgramInfoLog(yagl_gles_object_get(program), + infolog_maxcount, + &tmp, + infolog); - if (target != GL_TEXTURE_2D) { - YAGL_SET_ERR(GL_INVALID_ENUM); - goto out; + if (tmp >= 0) { + *infolog_count = MIN(tmp + 1, infolog_maxcount); + return GL_TRUE; + } else { + return GL_FALSE; } +} - image = (struct yagl_gles_image*)cur_ts->ps->egl_iface->get_image(cur_ts->ps->egl_iface, image_); +void yagl_host_glGetShaderiv(GLuint shader, + GLenum pname, + GLint *param) +{ + gles_api_ts->driver->GetShaderiv(yagl_gles_object_get(shader), + pname, + param); +} - if (!image) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } +GLboolean yagl_host_glGetShaderInfoLog(GLuint shader, + GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count) +{ + GLsizei tmp = -1; - tex_target_state = - yagl_gles_context_get_active_texture_target_state(ctx, - yagl_gles_texture_target_2d); + gles_api_ts->driver->GetShaderInfoLog(yagl_gles_object_get(shader), + infolog_maxcount, + &tmp, + infolog); - if (!tex_target_state->texture) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; + if (tmp >= 0) { + *infolog_count = MIN(tmp + 1, infolog_maxcount); + return GL_TRUE; + } else { + return GL_FALSE; } - - yagl_gles_texture_set_image(tex_target_state->texture, image); - -out: - yagl_gles_image_release(image); } -void yagl_host_glGetExtensionStringYAGL(GLchar *str, int32_t str_maxcount, int32_t *str_count) +void yagl_host_glGetUniformfv(GLboolean tl, + GLuint program, + uint32_t location, + GLfloat *params, int32_t params_maxcount, int32_t *params_count) { - GLchar *tmp = NULL; - - YAGL_GET_CTX(glGetExtensionStringYAGL); + 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); - tmp = ctx->get_extensions(ctx); - - *str_count = strlen(tmp) + 1; + if (!yagl_gles_program_get_uniform_type(global_name, + actual_location, + &type)) { + return; + } - if (str) { - memcpy(str, tmp, MIN(*str_count, str_maxcount)); + if (!yagl_gles_get_uniform_type_count(type, params_count)) { + return; } - g_free(tmp); + gles_api_ts->driver->GetUniformfv(global_name, + actual_location, + params); } -void yagl_host_glEGLUpdateOffscreenImageYAGL(struct yagl_client_image *image, - uint32_t width, - uint32_t height, - uint32_t bpp, - const void *pixels) +void yagl_host_glGetUniformiv(GLboolean tl, + GLuint program, + uint32_t location, + GLint *params, int32_t params_maxcount, int32_t *params_count) { - struct yagl_gles_image *gles_image = (struct yagl_gles_image*)image; - GLenum format = 0; - GLuint cur_tex = 0; - GLsizei unpack_alignment = 0; - - YAGL_GET_CTX(glEGLUpdateOffscreenImageYAGL); + 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); - switch (bpp) { - case 3: - format = GL_RGB; - break; - case 4: - format = GL_BGRA; - break; - default: - YAGL_LOG_ERROR("bad bpp - %u", bpp); + if (!yagl_gles_program_get_uniform_type(global_name, + actual_location, + &type)) { return; } - ctx->driver->GetIntegerv(GL_TEXTURE_BINDING_2D, - (GLint*)&cur_tex); + if (!yagl_gles_get_uniform_type_count(type, params_count)) { + return; + } - ctx->driver->GetIntegerv(GL_UNPACK_ALIGNMENT, - &unpack_alignment); + gles_api_ts->driver->GetUniformiv(global_name, + actual_location, + params); +} - ctx->driver->PixelStorei(GL_UNPACK_ALIGNMENT, - 1); +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); +} - ctx->driver->BindTexture(GL_TEXTURE_2D, - gles_image->tex_global_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; + } - ctx->driver->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - ctx->driver->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + gles_api_ts->driver->GetVertexAttribfv(index, pname, params); +} - ctx->driver->TexImage2D(GL_TEXTURE_2D, - 0, - GL_RGB, - width, - height, - 0, - format, - GL_UNSIGNED_BYTE, - pixels); +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; + } - ctx->driver->PixelStorei(GL_UNPACK_ALIGNMENT, - unpack_alignment); + gles_api_ts->driver->GetVertexAttribiv(index, pname, params); +} - ctx->driver->BindTexture(GL_TEXTURE_2D, - cur_tex); +void yagl_host_glLinkProgram(GLuint program) +{ + gles_api_ts->driver->LinkProgram(yagl_gles_object_get(program)); } -GLboolean yagl_host_glIsRenderbuffer(GLuint renderbuffer) +void yagl_host_glUniform1f(GLboolean tl, + uint32_t location, + GLfloat x) { - GLboolean res = GL_FALSE; - struct yagl_gles_renderbuffer *renderbuffer_obj = NULL; + gles_api_ts->driver->Uniform1f( + yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), x); +} - YAGL_GET_CTX_RET(glIsRenderbuffer, GL_FALSE); +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); +} - renderbuffer_obj = (struct yagl_gles_renderbuffer*)yagl_sharegroup_acquire_object(ctx->base.sg, - YAGL_NS_RENDERBUFFER, renderbuffer); +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); +} - if (renderbuffer_obj && yagl_gles_renderbuffer_was_bound(renderbuffer_obj)) { - res = GL_TRUE; - } +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); +} - yagl_gles_renderbuffer_release(renderbuffer_obj); +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); +} - return res; +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_glBindRenderbuffer(GLenum target, - GLuint renderbuffer) +void yagl_host_glUniform2i(GLboolean tl, + uint32_t location, + GLint x, + GLint y) { - struct yagl_gles_renderbuffer *renderbuffer_obj = NULL; + gles_api_ts->driver->Uniform2i( + yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + x, y); +} - YAGL_GET_CTX(glBindRenderbuffer); +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); +} - if (renderbuffer != 0) { - renderbuffer_obj = (struct yagl_gles_renderbuffer*)yagl_sharegroup_acquire_object(ctx->base.sg, - YAGL_NS_RENDERBUFFER, renderbuffer); +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); +} - if (!renderbuffer_obj) { - renderbuffer_obj = yagl_gles_renderbuffer_create(ctx->driver); +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); +} - if (!renderbuffer_obj) { - goto out; - } +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); +} - renderbuffer_obj = (struct yagl_gles_renderbuffer*)yagl_sharegroup_add_named(ctx->base.sg, - YAGL_NS_RENDERBUFFER, renderbuffer, &renderbuffer_obj->base); - } - } +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); +} - if (!yagl_gles_context_bind_renderbuffer(ctx, target, renderbuffer)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - goto out; - } +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); +} - ctx->driver->BindRenderbuffer(target, - (renderbuffer_obj ? - renderbuffer_obj->global_name : 0)); +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); +} - if (renderbuffer_obj) { - yagl_gles_renderbuffer_set_bound(renderbuffer_obj); - } +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); +} -out: - yagl_gles_renderbuffer_release(renderbuffer_obj); +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_glDeleteRenderbuffers(const GLuint *renderbuffers, int32_t renderbuffers_count) +void yagl_host_glUniformMatrix2fv(GLboolean tl, + uint32_t location, + GLboolean transpose, + const GLfloat *value, int32_t value_count) { - GLsizei i; + gles_api_ts->driver->UniformMatrix2fv( + yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + value_count / (2 * 2), transpose, value); +} - YAGL_GET_CTX(glDeleteRenderbuffers); +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); +} - if (renderbuffers_count < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } +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); +} - if (renderbuffers) { - for (i = 0; i < renderbuffers_count; ++i) { - yagl_gles_context_unbind_renderbuffer(ctx, renderbuffers[i]); +void yagl_host_glUseProgram(GLuint program) +{ + gles_api_ts->driver->UseProgram(yagl_gles_object_get(program)); +} - yagl_sharegroup_remove(ctx->base.sg, - YAGL_NS_RENDERBUFFER, - renderbuffers[i]); - } - } +void yagl_host_glValidateProgram(GLuint program) +{ + gles_api_ts->driver->ValidateProgram(yagl_gles_object_get(program)); } -void yagl_host_glGenRenderbuffers(GLuint *renderbuffer_names, int32_t renderbuffers_maxcount, int32_t *renderbuffers_count) +void yagl_host_glVertexAttrib1f(GLuint indx, + GLfloat x) { - struct yagl_gles_renderbuffer **renderbuffers = NULL; - GLsizei i; + gles_api_ts->driver->VertexAttrib1f(indx, x); +} - YAGL_GET_CTX(glGenRenderbuffers); +void yagl_host_glVertexAttrib1fv(GLuint indx, + const GLfloat *values, int32_t values_count) +{ + gles_api_ts->driver->VertexAttrib1fv(indx, values); +} - if (renderbuffers_maxcount < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } +void yagl_host_glVertexAttrib2f(GLuint indx, + GLfloat x, + GLfloat y) +{ + gles_api_ts->driver->VertexAttrib2f(indx, x, y); +} - renderbuffers = g_malloc0(renderbuffers_maxcount * sizeof(*renderbuffers)); +void yagl_host_glVertexAttrib2fv(GLuint indx, + const GLfloat *values, int32_t values_count) +{ + gles_api_ts->driver->VertexAttrib2fv(indx, values); +} - for (i = 0; i < renderbuffers_maxcount; ++i) { - renderbuffers[i] = yagl_gles_renderbuffer_create(ctx->driver); +void yagl_host_glVertexAttrib3f(GLuint indx, + GLfloat x, + GLfloat y, + GLfloat z) +{ + gles_api_ts->driver->VertexAttrib3f(indx, x, y, z); +} - if (!renderbuffers[i]) { - goto out; - } - } +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); +} - for (i = 0; i < renderbuffers_maxcount; ++i) { - yagl_object_name tmp = yagl_sharegroup_add(ctx->base.sg, - YAGL_NS_RENDERBUFFER, - &renderbuffers[i]->base); +void yagl_host_glVertexAttrib4fv(GLuint indx, + const GLfloat *values, int32_t values_count) +{ + gles_api_ts->driver->VertexAttrib4fv(indx, values); +} - if (renderbuffer_names) { - renderbuffer_names[i] = tmp; - } +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 = (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'; } +} - *renderbuffers_count = renderbuffers_maxcount; +GLboolean yagl_host_glIsEnabled(GLenum cap) +{ + return gles_api_ts->driver->IsEnabled(cap); +} -out: - for (i = 0; i < renderbuffers_maxcount; ++i) { - yagl_gles_renderbuffer_release(renderbuffers[i]); +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]); } - g_free(renderbuffers); } -void yagl_host_glRenderbufferStorage(GLenum target, - GLenum internalformat, - GLsizei width, - GLsizei height) +void yagl_host_glBlendEquation(GLenum mode) { - YAGL_GET_CTX(glRenderbufferStorage); + gles_api_ts->driver->BlendEquation(mode); +} - ctx->driver->RenderbufferStorage(target, - internalformat, - width, - height); +void yagl_host_glBlendEquationSeparate(GLenum modeRGB, + GLenum modeAlpha) +{ + gles_api_ts->driver->BlendEquationSeparate(modeRGB, modeAlpha); } -void yagl_host_glGetRenderbufferParameteriv(GLenum target, - GLenum pname, - GLint *param) +void yagl_host_glBlendFunc(GLenum sfactor, + GLenum dfactor) { - GLint params[10]; + gles_api_ts->driver->BlendFunc(sfactor, dfactor); +} - YAGL_GET_CTX(glGetRenderbufferParameteriv); +void yagl_host_glBlendFuncSeparate(GLenum srcRGB, + GLenum dstRGB, + GLenum srcAlpha, + GLenum dstAlpha) +{ + gles_api_ts->driver->BlendFuncSeparate(srcRGB, + dstRGB, + srcAlpha, + dstAlpha); +} - ctx->driver->GetRenderbufferParameteriv(target, - pname, - params); +void yagl_host_glBlendColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) +{ + gles_api_ts->driver->BlendColor(red, green, blue, alpha); +} - if (param) { - *param = params[0]; - } +void yagl_host_glClear(GLbitfield mask) +{ + gles_api_ts->driver->Clear(mask); } -GLboolean yagl_host_glIsFramebuffer(GLuint framebuffer) +void yagl_host_glClearColor(GLclampf red, + GLclampf green, + GLclampf blue, + GLclampf alpha) { - GLboolean res = GL_FALSE; - struct yagl_gles_framebuffer *framebuffer_obj = NULL; + gles_api_ts->driver->ClearColor(red, green, blue, alpha); +} - YAGL_GET_CTX_RET(glIsFramebuffer, GL_FALSE); +void yagl_host_glClearDepthf(GLclampf depth) +{ + gles_api_ts->driver->ClearDepth(depth); +} - framebuffer_obj = (struct yagl_gles_framebuffer*)yagl_sharegroup_acquire_object(ctx->base.sg, - YAGL_NS_FRAMEBUFFER, framebuffer); +void yagl_host_glClearStencil(GLint s) +{ + gles_api_ts->driver->ClearStencil(s); +} - if (framebuffer_obj && yagl_gles_framebuffer_was_bound(framebuffer_obj)) { - res = GL_TRUE; - } +void yagl_host_glColorMask(GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha) +{ + gles_api_ts->driver->ColorMask(red, green, blue, alpha); +} - yagl_gles_framebuffer_release(framebuffer_obj); +void yagl_host_glCullFace(GLenum mode) +{ + gles_api_ts->driver->CullFace(mode); +} - return res; +void yagl_host_glDepthFunc(GLenum func) +{ + gles_api_ts->driver->DepthFunc(func); } -void yagl_host_glBindFramebuffer(GLenum target, - GLuint framebuffer) +void yagl_host_glDepthMask(GLboolean flag) { - struct yagl_gles_framebuffer *framebuffer_obj = NULL; + gles_api_ts->driver->DepthMask(flag); +} - YAGL_GET_CTX(glBindFramebuffer); +void yagl_host_glDepthRangef(GLclampf zNear, + GLclampf zFar) +{ + gles_api_ts->driver->DepthRange(zNear, zFar); +} - if (framebuffer != 0) { - framebuffer_obj = (struct yagl_gles_framebuffer*)yagl_sharegroup_acquire_object(ctx->base.sg, - YAGL_NS_FRAMEBUFFER, framebuffer); +void yagl_host_glEnable(GLenum cap) +{ + gles_api_ts->driver->Enable(cap); +} - if (!framebuffer_obj) { - framebuffer_obj = yagl_gles_framebuffer_create(ctx->driver); +void yagl_host_glDisable(GLenum cap) +{ + gles_api_ts->driver->Disable(cap); +} - if (!framebuffer_obj) { - goto out; - } +void yagl_host_glFlush(void) +{ + gles_api_ts->driver->Flush(); +} - framebuffer_obj = (struct yagl_gles_framebuffer*)yagl_sharegroup_add_named(ctx->base.sg, - YAGL_NS_FRAMEBUFFER, framebuffer, &framebuffer_obj->base); - } - } +void yagl_host_glFrontFace(GLenum mode) +{ + gles_api_ts->driver->FrontFace(mode); +} - if (!yagl_gles_context_bind_framebuffer(ctx, target, framebuffer_obj, framebuffer)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - goto out; - } +void yagl_host_glGenerateMipmap(GLenum target) +{ + gles_api_ts->driver->GenerateMipmap(target); +} - ctx->driver->BindFramebuffer(target, - (framebuffer_obj ? - framebuffer_obj->global_name : 0)); +void yagl_host_glHint(GLenum target, + GLenum mode) +{ + gles_api_ts->driver->Hint(target, mode); +} - if (framebuffer_obj) { - yagl_gles_framebuffer_set_bound(framebuffer_obj); - } +void yagl_host_glLineWidth(GLfloat width) +{ + gles_api_ts->driver->LineWidth(width); +} -out: - yagl_gles_framebuffer_release(framebuffer_obj); +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_glDeleteFramebuffers(const GLuint *framebuffers, int32_t framebuffers_count) +void yagl_host_glScissor(GLint x, + GLint y, + GLsizei width, + GLsizei height) { - GLsizei i; + gles_api_ts->driver->Scissor(x, y, width, height); +} - YAGL_GET_CTX(glDeleteFramebuffers); +void yagl_host_glStencilFunc(GLenum func, + GLint ref, + GLuint mask) +{ + gles_api_ts->driver->StencilFunc(func, ref, mask); +} - if (framebuffers_count < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } +void yagl_host_glStencilMask(GLuint mask) +{ + gles_api_ts->driver->StencilMask(mask); +} - if (framebuffers) { - for (i = 0; i < framebuffers_count; ++i) { - yagl_gles_context_unbind_framebuffer(ctx, framebuffers[i]); +void yagl_host_glStencilOp(GLenum fail, + GLenum zfail, + GLenum zpass) +{ + gles_api_ts->driver->StencilOp(fail, zfail, zpass); +} - yagl_sharegroup_remove(ctx->base.sg, - YAGL_NS_FRAMEBUFFER, - framebuffers[i]); - } - } +void yagl_host_glSampleCoverage(GLclampf value, + GLboolean invert) +{ + gles_api_ts->driver->SampleCoverage(value, invert); } -void yagl_host_glGenFramebuffers(GLuint *framebuffer_names, int32_t framebuffers_maxcount, int32_t *framebuffers_count) +void yagl_host_glViewport(GLint x, + GLint y, + GLsizei width, + GLsizei height) { - struct yagl_gles_framebuffer **framebuffers = NULL; - GLsizei i; + gles_api_ts->driver->Viewport(x, y, width, height); +} - YAGL_GET_CTX(glGenFramebuffers); +void yagl_host_glStencilFuncSeparate(GLenum face, + GLenum func, + GLint ref, + GLuint mask) +{ + gles_api_ts->driver->StencilFuncSeparate(face, func, ref, mask); +} - if (framebuffers_maxcount < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } +void yagl_host_glStencilMaskSeparate(GLenum face, + GLuint mask) +{ + gles_api_ts->driver->StencilMaskSeparate(face, mask); +} - framebuffers = g_malloc0(framebuffers_maxcount * sizeof(*framebuffers)); +void yagl_host_glStencilOpSeparate(GLenum face, + GLenum fail, + GLenum zfail, + GLenum zpass) +{ + gles_api_ts->driver->StencilOpSeparate(face, fail, zfail, zpass); +} - for (i = 0; i < framebuffers_maxcount; ++i) { - framebuffers[i] = yagl_gles_framebuffer_create(ctx->driver); +void yagl_host_glPointSize(GLfloat size) +{ + gles_api_ts->driver->PointSize(size); +} - if (!framebuffers[i]) { - goto out; - } - } +void yagl_host_glAlphaFunc(GLenum func, + GLclampf ref) +{ + gles_api_ts->driver->AlphaFunc(func, ref); +} - for (i = 0; i < framebuffers_maxcount; ++i) { - yagl_object_name tmp = yagl_sharegroup_add(ctx->base.sg, - YAGL_NS_FRAMEBUFFER, - &framebuffers[i]->base); +void yagl_host_glMatrixMode(GLenum mode) +{ + gles_api_ts->driver->MatrixMode(mode); +} - if (framebuffer_names) { - framebuffer_names[i] = tmp; - } - } +void yagl_host_glLoadIdentity(void) +{ + gles_api_ts->driver->LoadIdentity(); +} - *framebuffers_count = framebuffers_maxcount; +void yagl_host_glPopMatrix(void) +{ + gles_api_ts->driver->PopMatrix(); +} -out: - for (i = 0; i < framebuffers_maxcount; ++i) { - yagl_gles_framebuffer_release(framebuffers[i]); - } - g_free(framebuffers); +void yagl_host_glPushMatrix(void) +{ + gles_api_ts->driver->PushMatrix(); } -GLenum yagl_host_glCheckFramebufferStatus(GLenum target) +void yagl_host_glRotatef(GLfloat angle, + GLfloat x, + GLfloat y, + GLfloat z) { - YAGL_GET_CTX_RET(glCheckFramebufferStatus, 0); + gles_api_ts->driver->Rotatef(angle, x, y, z); +} - return ctx->driver->CheckFramebufferStatus(target); +void yagl_host_glTranslatef(GLfloat x, + GLfloat y, + GLfloat z) +{ + gles_api_ts->driver->Translatef(x, y, z); } -void yagl_host_glFramebufferTexture2D(GLenum target, - GLenum attachment, - GLenum textarget, - GLuint texture, - GLint level) +void yagl_host_glScalef(GLfloat x, + GLfloat y, + GLfloat z) { - struct yagl_gles_framebuffer *framebuffer_obj = NULL; - struct yagl_gles_texture *texture_obj = NULL; + gles_api_ts->driver->Scalef(x, y, z); +} - YAGL_GET_CTX(glFramebufferTexture2D); +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); +} - framebuffer_obj = yagl_gles_context_acquire_binded_framebuffer(ctx, target); +void yagl_host_glColor4f(GLfloat red, + GLfloat green, + GLfloat blue, + GLfloat alpha) +{ + gles_api_ts->driver->Color4f(red, green, blue, alpha); +} - if (!framebuffer_obj) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } +void yagl_host_glColor4ub(GLubyte red, + GLubyte green, + GLubyte blue, + GLubyte alpha) +{ + gles_api_ts->driver->Color4ub(red, green, blue, alpha); +} - if (texture) { - texture_obj = (struct yagl_gles_texture*)yagl_sharegroup_acquire_object(ctx->base.sg, - YAGL_NS_TEXTURE, texture); +void yagl_host_glNormal3f(GLfloat nx, + GLfloat ny, + GLfloat nz) +{ + gles_api_ts->driver->Normal3f(nx, ny, nz); +} - if (!texture_obj) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - } +void yagl_host_glPointParameterf(GLenum pname, + GLfloat param) +{ + gles_api_ts->driver->PointParameterf(pname, param); +} - if (!yagl_gles_framebuffer_texture2d(framebuffer_obj, - target, - attachment, - textarget, - level, - texture_obj, - texture)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - goto out; - } +void yagl_host_glPointParameterfv(GLenum pname, + const GLfloat *params, int32_t params_count) +{ + gles_api_ts->driver->PointParameterfv(pname, params); +} -out: - yagl_gles_texture_release(texture_obj); - yagl_gles_framebuffer_release(framebuffer_obj); +void yagl_host_glFogf(GLenum pname, + GLfloat param) +{ + gles_api_ts->driver->Fogf(pname, param); } -void yagl_host_glFramebufferRenderbuffer(GLenum target, - GLenum attachment, - GLenum renderbuffertarget, - GLuint renderbuffer) +void yagl_host_glFogfv(GLenum pname, + const GLfloat *params, int32_t params_count) { - struct yagl_gles_framebuffer *framebuffer_obj = NULL; - struct yagl_gles_renderbuffer *renderbuffer_obj = NULL; + gles_api_ts->driver->Fogfv(pname, params); +} - YAGL_GET_CTX(glFramebufferRenderbuffer); +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); +} - framebuffer_obj = yagl_gles_context_acquire_binded_framebuffer(ctx, target); +void yagl_host_glLightf(GLenum light, + GLenum pname, + GLfloat param) +{ + gles_api_ts->driver->Lightf(light, pname, param); +} - if (!framebuffer_obj) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } +void yagl_host_glLightfv(GLenum light, + GLenum pname, + const GLfloat *params, int32_t params_count) +{ + gles_api_ts->driver->Lightfv(light, pname, params); +} - if (renderbuffer) { - renderbuffer_obj = (struct yagl_gles_renderbuffer*)yagl_sharegroup_acquire_object(ctx->base.sg, - YAGL_NS_RENDERBUFFER, renderbuffer); +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; +} - if (!renderbuffer_obj) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - } +void yagl_host_glLightModelf(GLenum pname, + GLfloat param) +{ + gles_api_ts->driver->LightModelf(pname, param); +} - if (!yagl_gles_framebuffer_renderbuffer(framebuffer_obj, - target, - attachment, - renderbuffertarget, - renderbuffer_obj, - renderbuffer)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - goto out; - } +void yagl_host_glLightModelfv(GLenum pname, + const GLfloat *params, int32_t params_count) +{ + gles_api_ts->driver->LightModelfv(pname, params); +} -out: - yagl_gles_renderbuffer_release(renderbuffer_obj); - yagl_gles_framebuffer_release(framebuffer_obj); +void yagl_host_glMaterialf(GLenum face, + GLenum pname, + GLfloat param) +{ + gles_api_ts->driver->Materialf(face, pname, param); } -void yagl_host_glGetFramebufferAttachmentParameteriv(GLenum target, - GLenum attachment, +void yagl_host_glMaterialfv(GLenum face, GLenum pname, - GLint *param) + const GLfloat *params, int32_t params_count) { - struct yagl_gles_framebuffer *framebuffer_obj = NULL; - GLint tmp = 0; + gles_api_ts->driver->Materialfv(face, pname, params); +} - YAGL_GET_CTX(glGetFramebufferAttachmentParameteriv); +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); +} - framebuffer_obj = yagl_gles_context_acquire_binded_framebuffer(ctx, target); +void yagl_host_glLogicOp(GLenum opcode) +{ + gles_api_ts->driver->LogicOp(opcode); +} - if (!framebuffer_obj) { - YAGL_SET_ERR(GL_INVALID_ENUM); - goto out; +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); } +} - if (!yagl_gles_framebuffer_get_attachment_parameter(framebuffer_obj, - attachment, - pname, - &tmp)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - goto out; +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; } +} - if (param) { - *param = tmp; +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; } -out: - yagl_gles_framebuffer_release(framebuffer_obj); + 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_BYTE, + pixels); + + gles_api_ts->driver->PixelStorei(GL_UNPACK_ALIGNMENT, + unpack_alignment); + + gles_api_ts->driver->BindTexture(GL_TEXTURE_2D, cur_tex); } -void yagl_host_glGenerateMipmap(GLenum target) +void yagl_host_glGenUniformLocationYAGL(uint32_t location, + GLuint program, + const GLchar *name, int32_t name_count) { - YAGL_GET_CTX(glGenerateMipmap); + 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; - ctx->driver->GenerateMipmap(target); + for (i = 0; i < locations_count; ++i) { + yagl_gles_api_ps_remove_location(gles_api_ts->ps, locations[i]); + } } diff --git a/hw/yagl_apis/gles/yagl_host_gles_calls.h b/hw/yagl_apis/gles/yagl_host_gles_calls.h index 1a494bc..86d4d85 100644 --- a/hw/yagl_apis/gles/yagl_host_gles_calls.h +++ b/hw/yagl_apis/gles/yagl_host_gles_calls.h @@ -2,45 +2,89 @@ #define _QEMU_YAGL_HOST_GLES_CALLS_H #include "yagl_api.h" +#include -struct yagl_client_image; +struct yagl_api_ps *yagl_host_gles_process_init(struct yagl_api *api); -void yagl_host_glActiveTexture(GLenum texture); +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_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_glGenBuffers(const GLuint *buffers, int32_t buffers_count); void yagl_host_glBindBuffer(GLenum target, GLuint buffer); -void yagl_host_glBindFramebuffer(GLenum target, - GLuint framebuffer); -void yagl_host_glBindRenderbuffer(GLenum target, - GLuint renderbuffer); -void yagl_host_glBindTexture(GLenum target, - GLuint texture); -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_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); -GLenum yagl_host_glCheckFramebufferStatus(GLenum target); -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_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, @@ -72,23 +116,69 @@ void yagl_host_glCopyTexSubImage2D(GLenum target, GLint y, GLsizei width, GLsizei height); -void yagl_host_glCullFace(GLenum mode); -void yagl_host_glDeleteBuffers(const GLuint *buffers, int32_t buffers_count); -void yagl_host_glDeleteFramebuffers(const GLuint *framebuffers, int32_t framebuffers_count); -void yagl_host_glDeleteRenderbuffers(const GLuint *renderbuffers, int32_t renderbuffers_count); -void yagl_host_glDeleteTextures(const GLuint *textures, int32_t textures_count); -void yagl_host_glDepthFunc(GLenum func); -void yagl_host_glDepthMask(GLboolean flag); -void yagl_host_glDepthRangef(GLclampf zNear, - GLclampf zFar); -void yagl_host_glDisable(GLenum cap); -void yagl_host_glDrawArrays(GLenum mode, - GLint first, - GLsizei count); -void yagl_host_glEGLImageTargetTexture2DOES(GLenum target, - yagl_host_handle image); -void yagl_host_glEnable(GLenum cap); -void yagl_host_glFlush(void); +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, @@ -98,60 +188,213 @@ void yagl_host_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -void yagl_host_glFrontFace(GLenum mode); -void yagl_host_glGenBuffers(GLuint *buffers, int32_t buffers_maxcount, int32_t *buffers_count); -void yagl_host_glGenerateMipmap(GLenum target); -void yagl_host_glGenFramebuffers(GLuint *framebuffers, int32_t framebuffers_maxcount, int32_t *framebuffers_count); -void yagl_host_glGenRenderbuffers(GLuint *renderbuffers, int32_t renderbuffers_maxcount, int32_t *renderbuffers_count); -void yagl_host_glGenTextures(GLuint *textures, int32_t textures_maxcount, int32_t *textures_count); -void yagl_host_glGetBooleanv(GLenum pname, - GLboolean *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetBufferParameteriv(GLenum target, +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); -GLenum yagl_host_glGetError(void); -void yagl_host_glGetFloatv(GLenum pname, - GLfloat *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetFramebufferAttachmentParameteriv(GLenum target, - GLenum attachment, +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_glGetActiveAttrib(GLuint program, + GLuint index, + GLint *size, + GLenum *type, + GLchar *name, int32_t name_maxcount, int32_t *name_count); +GLboolean 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); -void yagl_host_glGetIntegerv(GLenum pname, - GLint *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetRenderbufferParameteriv(GLenum target, +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); -void yagl_host_glGetTexParameterfv(GLenum target, +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 *param); -void yagl_host_glGetTexParameteriv(GLenum target, + GLfloat *params, int32_t params_maxcount, int32_t *params_count); +void yagl_host_glGetVertexAttribiv(GLuint index, GLenum pname, - GLint *param); + GLint *params, int32_t params_maxcount, int32_t *params_count); +void yagl_host_glLinkProgram(GLuint program); +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_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_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); -GLboolean yagl_host_glIsBuffer(GLuint buffer); -GLboolean yagl_host_glIsEnabled(GLenum cap); -GLboolean yagl_host_glIsFramebuffer(GLuint framebuffer); -GLboolean yagl_host_glIsRenderbuffer(GLuint renderbuffer); -GLboolean yagl_host_glIsTexture(GLuint texture); 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_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_glRenderbufferStorage(GLenum target, - GLenum internalformat, - GLsizei width, - GLsizei height); -void yagl_host_glSampleCoverage(GLclampf value, - GLboolean invert); void yagl_host_glScissor(GLint x, GLint y, GLsizei width, @@ -163,61 +406,108 @@ void yagl_host_glStencilMask(GLuint mask); void yagl_host_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass); -void yagl_host_glTexImage2D(GLenum target, - GLint level, - GLint internalformat, +void yagl_host_glSampleCoverage(GLclampf value, + GLboolean invert); +void yagl_host_glViewport(GLint x, + GLint y, GLsizei width, - GLsizei height, - GLint border, - GLenum format, - GLenum type, - const GLvoid *pixels, int32_t pixels_count); -void yagl_host_glTexParameterf(GLenum target, + 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_glTexParameterfv(GLenum target, +void yagl_host_glLightfv(GLenum light, GLenum pname, const GLfloat *params, int32_t params_count); -void yagl_host_glTexParameteri(GLenum target, +void yagl_host_glGetLightfv(GLenum light, GLenum pname, - GLint param); -void yagl_host_glTexParameteriv(GLenum target, + 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, - 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_glViewport(GLint x, - GLint y, - GLsizei width, - GLsizei height); - -void yagl_host_glTransferArrayYAGL(GLuint indx, - GLint first, - const GLvoid *data, int32_t data_count); -void yagl_host_glDrawElementsIndicesYAGL(GLenum mode, - GLenum type, - const GLvoid *indices, int32_t indices_count); -void yagl_host_glDrawElementsOffsetYAGL(GLenum mode, - GLenum type, - GLsizei offset, - GLsizei count); -void yagl_host_glGetExtensionStringYAGL(GLchar *str, int32_t str_maxcount, int32_t *str_count); -void yagl_host_glGetVertexAttribRangeYAGL(GLenum type, - GLsizei offset, - GLsizei count, - GLint *range_first, - GLsizei *range_count); -void yagl_host_glEGLUpdateOffscreenImageYAGL(struct yagl_client_image *image, + 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); + 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 diff --git a/hw/yagl_apis/gles1/yagl_gles1_api.c b/hw/yagl_apis/gles1/yagl_gles1_api.c deleted file mode 100644 index 571a0ba..0000000 --- a/hw/yagl_apis/gles1/yagl_gles1_api.c +++ /dev/null @@ -1,29 +0,0 @@ -#include "yagl_gles1_api.h" -#include "yagl_host_gles1_calls.h" -#include "yagl_gles1_driver.h" - -static void yagl_gles1_api_destroy(struct yagl_api *api) -{ - YaglGles1API *gles1_api = (YaglGles1API *)api; - - gles1_api->driver->destroy(gles1_api->driver); - gles1_api->driver = NULL; - - yagl_api_cleanup(&gles1_api->base); - - g_free(gles1_api); -} - -struct yagl_api *yagl_gles1_api_create(struct yagl_gles1_driver *driver) -{ - YaglGles1API *gles1_api = g_new0(YaglGles1API, 1); - - yagl_api_init(&gles1_api->base); - - gles1_api->base.process_init = &yagl_host_gles1_process_init; - gles1_api->base.destroy = &yagl_gles1_api_destroy; - - gles1_api->driver = driver; - - return &gles1_api->base; -} diff --git a/hw/yagl_apis/gles1/yagl_gles1_api.h b/hw/yagl_apis/gles1/yagl_gles1_api.h deleted file mode 100644 index 2e12bba..0000000 --- a/hw/yagl_apis/gles1/yagl_gles1_api.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef YAGL_GLES1_API_H_ -#define YAGL_GLES1_API_H_ - -#include "yagl_api.h" - -struct yagl_gles1_driver; - -typedef struct YaglGles1API -{ - struct yagl_api base; - - struct yagl_gles1_driver *driver; -} YaglGles1API; - -/* - * Takes ownership of 'driver' - */ -struct yagl_api *yagl_gles1_api_create(struct yagl_gles1_driver *driver); - - -#endif /* YAGL_GLES1_API_H_ */ diff --git a/hw/yagl_apis/gles1/yagl_gles1_api_ps.c b/hw/yagl_apis/gles1/yagl_gles1_api_ps.c deleted file mode 100644 index 17646a9..0000000 --- a/hw/yagl_apis/gles1/yagl_gles1_api_ps.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include "yagl_gles1_api_ps.h" -#include "yagl_gles1_driver.h" -#include "yagl_process.h" -#include "yagl_thread.h" -#include "yagl_client_interface.h" - - -void yagl_gles1_api_ps_init(YaglGles1ApiPs *gles1_api_ps, - struct yagl_gles1_driver *driver, - struct yagl_client_interface *client_iface) -{ - gles1_api_ps->driver = driver; - gles1_api_ps->client_iface = client_iface; - - yagl_process_register_client_interface(cur_ts->ps, - yagl_client_api_gles1, - gles1_api_ps->client_iface); -} - -void yagl_gles1_api_ps_fini(YaglGles1ApiPs *gles1_api_ps) -{ -} - -void yagl_gles1_api_ps_cleanup(YaglGles1ApiPs *gles1_api_ps) -{ - yagl_process_unregister_client_interface(cur_ts->ps, - yagl_client_api_gles1); - - yagl_client_interface_cleanup(gles1_api_ps->client_iface); - g_free(gles1_api_ps->client_iface); - gles1_api_ps->client_iface = NULL; -} diff --git a/hw/yagl_apis/gles1/yagl_gles1_api_ps.h b/hw/yagl_apis/gles1/yagl_gles1_api_ps.h deleted file mode 100644 index 1a4b958..0000000 --- a/hw/yagl_apis/gles1/yagl_gles1_api_ps.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef YAGL_GLES1_API_PS_H_ -#define YAGL_GLES1_API_PS_H_ - -#include "yagl_api.h" - -struct yagl_client_interface; -struct yagl_gles1_driver; - -typedef struct YaglGles1ApiPs -{ - struct yagl_api_ps base; - - struct yagl_gles1_driver *driver; - - struct yagl_client_interface *client_iface; -} YaglGles1ApiPs; - -/* - * Takes ownership of 'driver_ps' and 'client_iface'. - */ -void yagl_gles1_api_ps_init(YaglGles1ApiPs *gles1_api_ps, - struct yagl_gles1_driver *driver, - struct yagl_client_interface *client_iface); - -/* - * This MUST be called before cleanup in order to purge all resources. - * This cannot be done in 'xxx_cleanup' since by that time - * egl interface will be destroyed and it might be required in order to - * destroy some internal state. - */ -void yagl_gles1_api_ps_fini(YaglGles1ApiPs *gles1_api_ps); - -void yagl_gles1_api_ps_cleanup(YaglGles1ApiPs *gles1_api_ps); - -#endif /* YAGL_GLES1_API_PS_H_ */ diff --git a/hw/yagl_apis/gles1/yagl_gles1_api_ts.c b/hw/yagl_apis/gles1/yagl_gles1_api_ts.c deleted file mode 100644 index c2d3a5d..0000000 --- a/hw/yagl_apis/gles1/yagl_gles1_api_ts.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "yagl_gles1_api_ts.h" -#include "yagl_process.h" -#include "yagl_thread.h" - -void yagl_gles1_api_ts_init(YaglGles1ApiTs *gles1_api_ts, - struct yagl_gles1_driver *driver) -{ - gles1_api_ts->driver = driver; -} - -void yagl_gles1_api_ts_cleanup(YaglGles1ApiTs *gles1_api_ts) -{ -} diff --git a/hw/yagl_apis/gles1/yagl_gles1_api_ts.h b/hw/yagl_apis/gles1/yagl_gles1_api_ts.h deleted file mode 100644 index a69bec5..0000000 --- a/hw/yagl_apis/gles1/yagl_gles1_api_ts.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef YAGL_GLES1_API_TS_H_ -#define YAGL_GLES1_API_TS_H_ - -#include "yagl_types.h" - -struct yagl_gles1_driver; - -typedef struct YaglGles1ApiTs -{ - struct yagl_gles1_driver *driver; -} YaglGles1ApiTs; - -/* - * Does NOT take ownership of anything. - */ -void yagl_gles1_api_ts_init(YaglGles1ApiTs *gles1_api_ts, - struct yagl_gles1_driver *driver); - -void yagl_gles1_api_ts_cleanup(YaglGles1ApiTs *gles1_api_ts); - -#endif /* YAGL_GLES1_API_TS_H_ */ diff --git a/hw/yagl_apis/gles1/yagl_gles1_calls.c b/hw/yagl_apis/gles1/yagl_gles1_calls.c deleted file mode 100644 index c8cc70e..0000000 --- a/hw/yagl_apis/gles1/yagl_gles1_calls.c +++ /dev/null @@ -1,3247 +0,0 @@ -/* - * Generated by gen-yagl-calls.py, do not modify! - */ -#include "yagl_gles1_calls.h" -#include "yagl_host_gles1_calls.h" -#include "yagl_transport_gl1.h" -#include "yagl_thread.h" -#include "yagl_process.h" -#include "yagl_log.h" - -/* - * glActiveTexture dispatcher. id = 1 - */ -static bool 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); - - return true; -} - -/* - * glBindBuffer dispatcher. id = 2 - */ -static bool 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); - - return true; -} - -/* - * glBindFramebuffer dispatcher. id = 3 - */ -static bool 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); - - return true; -} - -/* - * glBindRenderbuffer dispatcher. id = 4 - */ -static bool 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); - - return true; -} - -/* - * glBindTexture dispatcher. id = 5 - */ -static bool 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); - - return true; -} - -/* - * glBlendEquation dispatcher. id = 6 - */ -static bool 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); - - return true; -} - -/* - * glBlendEquationSeparate dispatcher. id = 7 - */ -static bool 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); - - return true; -} - -/* - * glBlendFunc dispatcher. id = 8 - */ -static bool 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); - - return true; -} - -/* - * glBlendFuncSeparate dispatcher. id = 9 - */ -static bool 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); - - return true; -} - -/* - * glBufferData dispatcher. id = 10 - */ -static bool 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); - if (!yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count)) { - return false; - } - 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); - - return true; -} - -/* - * glBufferSubData dispatcher. id = 11 - */ -static bool 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); - if (!yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count)) { - return false; - } - 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); - - return true; -} - -/* - * glCheckFramebufferStatus dispatcher. id = 12 - */ -static bool yagl_func_glCheckFramebufferStatus(struct yagl_transport *t) -{ - GLenum target; - GLenum *retval; - target = yagl_transport_get_out_GLenum(t); - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(glCheckFramebufferStatus, GLenum, target); - *retval = yagl_host_glCheckFramebufferStatus(target); - YAGL_LOG_FUNC_EXIT_SPLIT(GLenum, *retval); - - return true; -} - -/* - * glClear dispatcher. id = 13 - */ -static bool 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); - - return true; -} - -/* - * glClearColor dispatcher. id = 14 - */ -static bool 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); - - return true; -} - -/* - * glClearDepthf dispatcher. id = 15 - */ -static bool 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); - - return true; -} - -/* - * glClearStencil dispatcher. id = 16 - */ -static bool 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); - - return true; -} - -/* - * glColorMask dispatcher. id = 17 - */ -static bool 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); - - return true; -} - -/* - * glCompressedTexImage2D dispatcher. id = 18 - */ -static bool 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); - if (!yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count)) { - return false; - } - 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); - - return true; -} - -/* - * glCompressedTexSubImage2D dispatcher. id = 19 - */ -static bool 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); - if (!yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count)) { - return false; - } - 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); - - return true; -} - -/* - * glCopyTexImage2D dispatcher. id = 20 - */ -static bool 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); - - return true; -} - -/* - * glCopyTexSubImage2D dispatcher. id = 21 - */ -static bool 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); - - return true; -} - -/* - * glCullFace dispatcher. id = 22 - */ -static bool 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); - - return true; -} - -/* - * glDeleteBuffers dispatcher. id = 23 - */ -static bool yagl_func_glDeleteBuffers(struct yagl_transport *t) -{ - const GLuint *buffers; - int32_t buffers_count; - if (!yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&buffers, &buffers_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteBuffers, void*, buffers); - (void)yagl_host_glDeleteBuffers(buffers, buffers_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glDeleteFramebuffers dispatcher. id = 24 - */ -static bool yagl_func_glDeleteFramebuffers(struct yagl_transport *t) -{ - const GLuint *framebuffers; - int32_t framebuffers_count; - if (!yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&framebuffers, &framebuffers_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteFramebuffers, void*, framebuffers); - (void)yagl_host_glDeleteFramebuffers(framebuffers, framebuffers_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glDeleteRenderbuffers dispatcher. id = 25 - */ -static bool yagl_func_glDeleteRenderbuffers(struct yagl_transport *t) -{ - const GLuint *renderbuffers; - int32_t renderbuffers_count; - if (!yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&renderbuffers, &renderbuffers_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteRenderbuffers, void*, renderbuffers); - (void)yagl_host_glDeleteRenderbuffers(renderbuffers, renderbuffers_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glDeleteTextures dispatcher. id = 26 - */ -static bool yagl_func_glDeleteTextures(struct yagl_transport *t) -{ - const GLuint *textures; - int32_t textures_count; - if (!yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&textures, &textures_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteTextures, void*, textures); - (void)yagl_host_glDeleteTextures(textures, textures_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glDepthFunc dispatcher. id = 27 - */ -static bool 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); - - return true; -} - -/* - * glDepthMask dispatcher. id = 28 - */ -static bool 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); - - return true; -} - -/* - * glDepthRangef dispatcher. id = 29 - */ -static bool 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); - - return true; -} - -/* - * glDisable dispatcher. id = 30 - */ -static bool 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); - - return true; -} - -/* - * glDrawArrays dispatcher. id = 31 - */ -static bool 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); - - return true; -} - -/* - * glEGLImageTargetTexture2DOES dispatcher. id = 32 - */ -static bool yagl_func_glEGLImageTargetTexture2DOES(struct yagl_transport *t) -{ - GLenum target; - yagl_host_handle image; - target = yagl_transport_get_out_GLenum(t); - image = yagl_transport_get_out_yagl_host_handle(t); - YAGL_LOG_FUNC_ENTER_SPLIT2(glEGLImageTargetTexture2DOES, GLenum, yagl_host_handle, target, image); - (void)yagl_host_glEGLImageTargetTexture2DOES(target, image); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glEnable dispatcher. id = 33 - */ -static bool 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); - - return true; -} - -/* - * glFlush dispatcher. id = 34 - */ -static bool yagl_func_glFlush(struct yagl_transport *t) -{ - YAGL_LOG_FUNC_ENTER_SPLIT0(glFlush); - (void)yagl_host_glFlush(); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glFramebufferTexture2D dispatcher. id = 35 - */ -static bool 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); - - return true; -} - -/* - * glFramebufferRenderbuffer dispatcher. id = 36 - */ -static bool 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); - - return true; -} - -/* - * glFrontFace dispatcher. id = 37 - */ -static bool 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); - - return true; -} - -/* - * glGenBuffers dispatcher. id = 38 - */ -static bool yagl_func_glGenBuffers(struct yagl_transport *t) -{ - GLuint *buffers; - int32_t buffers_maxcount; - int32_t *buffers_count; - if (!yagl_transport_get_in_array(t, sizeof(GLuint), (void**)&buffers, &buffers_maxcount, &buffers_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glGenBuffers, void*, buffers); - *buffers_count = 0; - (void)yagl_host_glGenBuffers(buffers, buffers_maxcount, buffers_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGenerateMipmap dispatcher. id = 39 - */ -static bool 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); - - return true; -} - -/* - * glGenFramebuffers dispatcher. id = 40 - */ -static bool yagl_func_glGenFramebuffers(struct yagl_transport *t) -{ - GLuint *framebuffers; - int32_t framebuffers_maxcount; - int32_t *framebuffers_count; - if (!yagl_transport_get_in_array(t, sizeof(GLuint), (void**)&framebuffers, &framebuffers_maxcount, &framebuffers_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glGenFramebuffers, void*, framebuffers); - *framebuffers_count = 0; - (void)yagl_host_glGenFramebuffers(framebuffers, framebuffers_maxcount, framebuffers_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGenRenderbuffers dispatcher. id = 41 - */ -static bool yagl_func_glGenRenderbuffers(struct yagl_transport *t) -{ - GLuint *renderbuffers; - int32_t renderbuffers_maxcount; - int32_t *renderbuffers_count; - if (!yagl_transport_get_in_array(t, sizeof(GLuint), (void**)&renderbuffers, &renderbuffers_maxcount, &renderbuffers_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glGenRenderbuffers, void*, renderbuffers); - *renderbuffers_count = 0; - (void)yagl_host_glGenRenderbuffers(renderbuffers, renderbuffers_maxcount, renderbuffers_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGenTextures dispatcher. id = 42 - */ -static bool yagl_func_glGenTextures(struct yagl_transport *t) -{ - GLuint *textures; - int32_t textures_maxcount; - int32_t *textures_count; - if (!yagl_transport_get_in_array(t, sizeof(GLuint), (void**)&textures, &textures_maxcount, &textures_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glGenTextures, void*, textures); - *textures_count = 0; - (void)yagl_host_glGenTextures(textures, textures_maxcount, textures_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGetBooleanv dispatcher. id = 43 - */ -static bool yagl_func_glGetBooleanv(struct yagl_transport *t) -{ - GLenum pname; - GLboolean *params; - int32_t params_maxcount; - int32_t *params_count; - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_in_array(t, sizeof(GLboolean), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glGetBooleanv, GLenum, void*, pname, params); - *params_count = 0; - (void)yagl_host_glGetBooleanv(pname, params, params_maxcount, params_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGetBufferParameteriv dispatcher. id = 44 - */ -static bool yagl_func_glGetBufferParameteriv(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(glGetBufferParameteriv, GLenum, GLenum, void*, target, pname, param); - (void)yagl_host_glGetBufferParameteriv(target, pname, param); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGetError dispatcher. id = 45 - */ -static bool yagl_func_glGetError(struct yagl_transport *t) -{ - GLenum *retval; - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT0(glGetError); - *retval = yagl_host_glGetError(); - YAGL_LOG_FUNC_EXIT_SPLIT(GLenum, *retval); - - return true; -} - -/* - * glGetFloatv dispatcher. id = 46 - */ -static bool 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); - if (!yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - 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); - - return true; -} - -/* - * glGetFramebufferAttachmentParameteriv dispatcher. id = 47 - */ -static bool yagl_func_glGetFramebufferAttachmentParameteriv(struct yagl_transport *t) -{ - GLenum target; - GLenum attachment; - GLenum pname; - GLint *param; - target = yagl_transport_get_out_GLenum(t); - attachment = 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_SPLIT4(glGetFramebufferAttachmentParameteriv, GLenum, GLenum, GLenum, void*, target, attachment, pname, param); - (void)yagl_host_glGetFramebufferAttachmentParameteriv(target, attachment, pname, param); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGetIntegerv dispatcher. id = 48 - */ -static bool 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); - if (!yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - 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); - - return true; -} - -/* - * glGetRenderbufferParameteriv dispatcher. id = 49 - */ -static bool 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); - - return true; -} - -/* - * glGetTexParameterfv dispatcher. id = 50 - */ -static bool 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); - - return true; -} - -/* - * glGetTexParameteriv dispatcher. id = 51 - */ -static bool 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); - - return true; -} - -/* - * glHint dispatcher. id = 52 - */ -static bool 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); - - return true; -} - -/* - * glIsBuffer dispatcher. id = 53 - */ -static bool yagl_func_glIsBuffer(struct yagl_transport *t) -{ - GLuint buffer; - GLboolean *retval; - buffer = yagl_transport_get_out_GLuint(t); - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(glIsBuffer, GLuint, buffer); - *retval = yagl_host_glIsBuffer(buffer); - YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval); - - return true; -} - -/* - * glIsEnabled dispatcher. id = 54 - */ -static bool 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); - - return true; -} - -/* - * glIsFramebuffer dispatcher. id = 55 - */ -static bool yagl_func_glIsFramebuffer(struct yagl_transport *t) -{ - GLuint framebuffer; - GLboolean *retval; - framebuffer = yagl_transport_get_out_GLuint(t); - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(glIsFramebuffer, GLuint, framebuffer); - *retval = yagl_host_glIsFramebuffer(framebuffer); - YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval); - - return true; -} - -/* - * glIsRenderbuffer dispatcher. id = 56 - */ -static bool yagl_func_glIsRenderbuffer(struct yagl_transport *t) -{ - GLuint renderbuffer; - GLboolean *retval; - renderbuffer = yagl_transport_get_out_GLuint(t); - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(glIsRenderbuffer, GLuint, renderbuffer); - *retval = yagl_host_glIsRenderbuffer(renderbuffer); - YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval); - - return true; -} - -/* - * glIsTexture dispatcher. id = 57 - */ -static bool yagl_func_glIsTexture(struct yagl_transport *t) -{ - GLuint texture; - GLboolean *retval; - texture = yagl_transport_get_out_GLuint(t); - yagl_transport_get_in_arg(t, (void**)&retval); - YAGL_LOG_FUNC_ENTER_SPLIT1(glIsTexture, GLuint, texture); - *retval = yagl_host_glIsTexture(texture); - YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval); - - return true; -} - -/* - * glLineWidth dispatcher. id = 58 - */ -static bool 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); - - return true; -} - -/* - * glPixelStorei dispatcher. id = 59 - */ -static bool 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); - - return true; -} - -/* - * glPolygonOffset dispatcher. id = 60 - */ -static bool 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); - - return true; -} - -/* - * glReadPixels dispatcher. id = 61 - */ -static bool 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); - if (!yagl_transport_get_in_array(t, 1, (void**)&pixels, &pixels_maxcount, &pixels_count)) { - return false; - } - 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); - - return true; -} - -/* - * glRenderbufferStorage dispatcher. id = 62 - */ -static bool 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); - - return true; -} - -/* - * glSampleCoverage dispatcher. id = 63 - */ -static bool 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); - - return true; -} - -/* - * glScissor dispatcher. id = 64 - */ -static bool 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); - - return true; -} - -/* - * glStencilFunc dispatcher. id = 65 - */ -static bool 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); - - return true; -} - -/* - * glStencilMask dispatcher. id = 66 - */ -static bool 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); - - return true; -} - -/* - * glStencilOp dispatcher. id = 67 - */ -static bool 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); - - return true; -} - -/* - * glTexImage2D dispatcher. id = 68 - */ -static bool 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); - if (!yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count)) { - return false; - } - 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); - - return true; -} - -/* - * glTexParameterf dispatcher. id = 69 - */ -static bool 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); - - return true; -} - -/* - * glTexParameterfv dispatcher. id = 70 - */ -static bool 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); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count)) { - return false; - } - 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); - - return true; -} - -/* - * glTexParameteri dispatcher. id = 71 - */ -static bool 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); - - return true; -} - -/* - * glTexParameteriv dispatcher. id = 72 - */ -static bool 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); - if (!yagl_transport_get_out_array(t, sizeof(GLint), (const void**)¶ms, ¶ms_count)) { - return false; - } - 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); - - return true; -} - -/* - * glTexSubImage2D dispatcher. id = 73 - */ -static bool 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); - if (!yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count)) { - return false; - } - 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); - - return true; -} - -/* - * glViewport dispatcher. id = 74 - */ -static bool 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); - - return true; -} - -/* - * glTransferArrayYAGL dispatcher. id = 75 - */ -static bool yagl_func_glTransferArrayYAGL(struct yagl_transport *t) -{ - GLuint indx; - GLint first; - const GLvoid *data; - int32_t data_count; - indx = yagl_transport_get_out_GLuint(t); - first = yagl_transport_get_out_GLint(t); - if (!yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT3(glTransferArrayYAGL, GLuint, GLint, void*, indx, first, data); - (void)yagl_host_glTransferArrayYAGL(indx, first, data, data_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glDrawElementsIndicesYAGL dispatcher. id = 76 - */ -static bool yagl_func_glDrawElementsIndicesYAGL(struct yagl_transport *t) -{ - GLenum mode; - GLenum type; - const GLvoid *indices; - int32_t indices_count; - mode = yagl_transport_get_out_GLenum(t); - type = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_out_array(t, 1, (const void**)&indices, &indices_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT3(glDrawElementsIndicesYAGL, GLenum, GLenum, void*, mode, type, indices); - (void)yagl_host_glDrawElementsIndicesYAGL(mode, type, indices, indices_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glDrawElementsOffsetYAGL dispatcher. id = 77 - */ -static bool yagl_func_glDrawElementsOffsetYAGL(struct yagl_transport *t) -{ - GLenum mode; - GLenum type; - GLsizei offset; - GLsizei count; - mode = yagl_transport_get_out_GLenum(t); - type = yagl_transport_get_out_GLenum(t); - offset = yagl_transport_get_out_GLsizei(t); - count = yagl_transport_get_out_GLsizei(t); - YAGL_LOG_FUNC_ENTER_SPLIT4(glDrawElementsOffsetYAGL, GLenum, GLenum, GLsizei, GLsizei, mode, type, offset, count); - (void)yagl_host_glDrawElementsOffsetYAGL(mode, type, offset, count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGetExtensionStringYAGL dispatcher. id = 78 - */ -static bool yagl_func_glGetExtensionStringYAGL(struct yagl_transport *t) -{ - GLchar *str; - int32_t str_maxcount; - int32_t *str_count; - if (!yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&str, &str_maxcount, &str_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glGetExtensionStringYAGL, void*, str); - *str_count = 0; - (void)yagl_host_glGetExtensionStringYAGL(str, str_maxcount, str_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGetVertexAttribRangeYAGL dispatcher. id = 79 - */ -static bool yagl_func_glGetVertexAttribRangeYAGL(struct yagl_transport *t) -{ - GLenum type; - GLsizei offset; - GLsizei count; - GLint *range_first; - GLsizei *range_count; - type = yagl_transport_get_out_GLenum(t); - offset = yagl_transport_get_out_GLsizei(t); - count = yagl_transport_get_out_GLsizei(t); - yagl_transport_get_in_arg(t, (void**)&range_first); - yagl_transport_get_in_arg(t, (void**)&range_count); - YAGL_LOG_FUNC_ENTER_SPLIT5(glGetVertexAttribRangeYAGL, GLenum, GLsizei, GLsizei, void*, void*, type, offset, count, range_first, range_count); - (void)yagl_host_glGetVertexAttribRangeYAGL(type, offset, count, range_first, range_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glAlphaFunc dispatcher. id = 80 - */ -static bool 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); - - return true; -} - -/* - * glClipPlanef dispatcher. id = 81 - */ -static bool yagl_func_glClipPlanef(struct yagl_transport *t) -{ - GLenum plane; - const GLfloat *equation; - int32_t equation_count; - plane = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&equation, &equation_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glClipPlanef, GLenum, void*, plane, equation); - (void)yagl_host_glClipPlanef(plane, equation, equation_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glColor4f dispatcher. id = 82 - */ -static bool 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); - - return true; -} - -/* - * glFogf dispatcher. id = 83 - */ -static bool 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); - - return true; -} - -/* - * glFogfv dispatcher. id = 84 - */ -static bool yagl_func_glFogfv(struct yagl_transport *t) -{ - GLenum pname; - const GLfloat *params; - int32_t params_count; - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glFogfv, GLenum, void*, pname, params); - (void)yagl_host_glFogfv(pname, params, params_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glFrustumf dispatcher. id = 85 - */ -static bool 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); - - return true; -} - -/* - * glGetClipPlanef dispatcher. id = 86 - */ -static bool 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); - if (!yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)&eqn, &eqn_maxcount, &eqn_count)) { - return false; - } - 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); - - return true; -} - -/* - * glGetLightfv dispatcher. id = 87 - */ -static bool 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); - if (!yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - 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); - - return true; -} - -/* - * glGetMaterialfv dispatcher. id = 88 - */ -static bool 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); - if (!yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - 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); - - return true; -} - -/* - * glGetTexEnvfv dispatcher. id = 89 - */ -static bool 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); - if (!yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - 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); - - return true; -} - -/* - * glLightModelf dispatcher. id = 90 - */ -static bool 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); - - return true; -} - -/* - * glLightModelfv dispatcher. id = 91 - */ -static bool yagl_func_glLightModelfv(struct yagl_transport *t) -{ - GLenum pname; - const GLfloat *params; - int32_t params_count; - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glLightModelfv, GLenum, void*, pname, params); - (void)yagl_host_glLightModelfv(pname, params, params_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glLightf dispatcher. id = 92 - */ -static bool 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); - - return true; -} - -/* - * glLightfv dispatcher. id = 93 - */ -static bool 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); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count)) { - return false; - } - 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); - - return true; -} - -/* - * glLoadMatrixf dispatcher. id = 94 - */ -static bool yagl_func_glLoadMatrixf(struct yagl_transport *t) -{ - const GLfloat *m; - int32_t m_count; - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&m, &m_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glLoadMatrixf, void*, m); - (void)yagl_host_glLoadMatrixf(m, m_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glMaterialf dispatcher. id = 95 - */ -static bool 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); - - return true; -} - -/* - * glMaterialfv dispatcher. id = 96 - */ -static bool 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); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count)) { - return false; - } - 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); - - return true; -} - -/* - * glMultMatrixf dispatcher. id = 97 - */ -static bool yagl_func_glMultMatrixf(struct yagl_transport *t) -{ - const GLfloat *m; - int32_t m_count; - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&m, &m_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glMultMatrixf, void*, m); - (void)yagl_host_glMultMatrixf(m, m_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glMultiTexCoord4f dispatcher. id = 98 - */ -static bool 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); - - return true; -} - -/* - * glNormal3f dispatcher. id = 99 - */ -static bool 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); - - return true; -} - -/* - * glOrthof dispatcher. id = 100 - */ -static bool 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); - - return true; -} - -/* - * glPointParameterf dispatcher. id = 101 - */ -static bool 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); - - return true; -} - -/* - * glPointParameterfv dispatcher. id = 102 - */ -static bool yagl_func_glPointParameterfv(struct yagl_transport *t) -{ - GLenum pname; - const GLfloat *params; - int32_t params_count; - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glPointParameterfv, GLenum, void*, pname, params); - (void)yagl_host_glPointParameterfv(pname, params, params_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glPointSize dispatcher. id = 103 - */ -static bool 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); - - return true; -} - -/* - * glPointSizePointerOES dispatcher. id = 104 - */ -static bool yagl_func_glPointSizePointerOES(struct yagl_transport *t) -{ - GLenum type; - GLsizei stride; - target_ulong pointer; - type = yagl_transport_get_out_GLenum(t); - stride = yagl_transport_get_out_GLsizei(t); - pointer = yagl_transport_get_out_va(t); - YAGL_LOG_FUNC_ENTER_SPLIT3(glPointSizePointerOES, GLenum, GLsizei, target_ulong, type, stride, pointer); - (void)yagl_host_glPointSizePointerOES(type, stride, pointer); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glRotatef dispatcher. id = 105 - */ -static bool 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); - - return true; -} - -/* - * glScalef dispatcher. id = 106 - */ -static bool 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); - - return true; -} - -/* - * glTexEnvf dispatcher. id = 107 - */ -static bool 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); - - return true; -} - -/* - * glTexEnvfv dispatcher. id = 108 - */ -static bool 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); - if (!yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count)) { - return false; - } - 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); - - return true; -} - -/* - * glTranslatef dispatcher. id = 109 - */ -static bool 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); - - return true; -} - -/* - * glAlphaFuncx dispatcher. id = 110 - */ -static bool yagl_func_glAlphaFuncx(struct yagl_transport *t) -{ - GLenum func; - GLclampx ref; - func = yagl_transport_get_out_GLenum(t); - ref = yagl_transport_get_out_GLclampx(t); - YAGL_LOG_FUNC_ENTER_SPLIT2(glAlphaFuncx, GLenum, GLclampx, func, ref); - (void)yagl_host_glAlphaFuncx(func, ref); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glClearColorx dispatcher. id = 111 - */ -static bool yagl_func_glClearColorx(struct yagl_transport *t) -{ - GLclampx red; - GLclampx green; - GLclampx blue; - GLclampx alpha; - red = yagl_transport_get_out_GLclampx(t); - green = yagl_transport_get_out_GLclampx(t); - blue = yagl_transport_get_out_GLclampx(t); - alpha = yagl_transport_get_out_GLclampx(t); - YAGL_LOG_FUNC_ENTER_SPLIT4(glClearColorx, GLclampx, GLclampx, GLclampx, GLclampx, red, green, blue, alpha); - (void)yagl_host_glClearColorx(red, green, blue, alpha); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glClearDepthx dispatcher. id = 112 - */ -static bool yagl_func_glClearDepthx(struct yagl_transport *t) -{ - GLclampx depth; - depth = yagl_transport_get_out_GLclampx(t); - YAGL_LOG_FUNC_ENTER_SPLIT1(glClearDepthx, GLclampx, depth); - (void)yagl_host_glClearDepthx(depth); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glClientActiveTexture dispatcher. id = 113 - */ -static bool 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); - - return true; -} - -/* - * glClipPlanex dispatcher. id = 114 - */ -static bool yagl_func_glClipPlanex(struct yagl_transport *t) -{ - GLenum plane; - const GLfixed *equation; - int32_t equation_count; - plane = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfixed), (const void**)&equation, &equation_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glClipPlanex, GLenum, void*, plane, equation); - (void)yagl_host_glClipPlanex(plane, equation, equation_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glColor4ub dispatcher. id = 115 - */ -static bool 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); - - return true; -} - -/* - * glColor4x dispatcher. id = 116 - */ -static bool yagl_func_glColor4x(struct yagl_transport *t) -{ - GLfixed red; - GLfixed green; - GLfixed blue; - GLfixed alpha; - red = yagl_transport_get_out_GLfixed(t); - green = yagl_transport_get_out_GLfixed(t); - blue = yagl_transport_get_out_GLfixed(t); - alpha = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT4(glColor4x, GLfixed, GLfixed, GLfixed, GLfixed, red, green, blue, alpha); - (void)yagl_host_glColor4x(red, green, blue, alpha); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glColorPointer dispatcher. id = 117 - */ -static bool yagl_func_glColorPointer(struct yagl_transport *t) -{ - GLint size; - GLenum type; - GLsizei stride; - target_ulong pointer; - size = yagl_transport_get_out_GLint(t); - type = yagl_transport_get_out_GLenum(t); - stride = yagl_transport_get_out_GLsizei(t); - pointer = yagl_transport_get_out_va(t); - YAGL_LOG_FUNC_ENTER_SPLIT4(glColorPointer, GLint, GLenum, GLsizei, target_ulong, size, type, stride, pointer); - (void)yagl_host_glColorPointer(size, type, stride, pointer); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glDepthRangex dispatcher. id = 118 - */ -static bool yagl_func_glDepthRangex(struct yagl_transport *t) -{ - GLclampx zNear; - GLclampx zFar; - zNear = yagl_transport_get_out_GLclampx(t); - zFar = yagl_transport_get_out_GLclampx(t); - YAGL_LOG_FUNC_ENTER_SPLIT2(glDepthRangex, GLclampx, GLclampx, zNear, zFar); - (void)yagl_host_glDepthRangex(zNear, zFar); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glDisableClientState dispatcher. id = 119 - */ -static bool 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); - - return true; -} - -/* - * glEnableClientState dispatcher. id = 120 - */ -static bool 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); - - return true; -} - -/* - * glFogx dispatcher. id = 121 - */ -static bool yagl_func_glFogx(struct yagl_transport *t) -{ - GLenum pname; - GLfixed param; - pname = yagl_transport_get_out_GLenum(t); - param = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT2(glFogx, GLenum, GLfixed, pname, param); - (void)yagl_host_glFogx(pname, param); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glFogxv dispatcher. id = 122 - */ -static bool yagl_func_glFogxv(struct yagl_transport *t) -{ - GLenum pname; - const GLfixed *params; - int32_t params_count; - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfixed), (const void**)¶ms, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glFogxv, GLenum, void*, pname, params); - (void)yagl_host_glFogxv(pname, params, params_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glFrustumx dispatcher. id = 123 - */ -static bool yagl_func_glFrustumx(struct yagl_transport *t) -{ - GLfixed left; - GLfixed right; - GLfixed bottom; - GLfixed top; - GLfixed zNear; - GLfixed zFar; - left = yagl_transport_get_out_GLfixed(t); - right = yagl_transport_get_out_GLfixed(t); - bottom = yagl_transport_get_out_GLfixed(t); - top = yagl_transport_get_out_GLfixed(t); - zNear = yagl_transport_get_out_GLfixed(t); - zFar = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT6(glFrustumx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, left, right, bottom, top, zNear, zFar); - (void)yagl_host_glFrustumx(left, right, bottom, top, zNear, zFar); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGetClipPlanex dispatcher. id = 124 - */ -static bool yagl_func_glGetClipPlanex(struct yagl_transport *t) -{ - GLenum pname; - GLfixed *eqn; - int32_t eqn_maxcount; - int32_t *eqn_count; - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_in_array(t, sizeof(GLfixed), (void**)&eqn, &eqn_maxcount, &eqn_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glGetClipPlanex, GLenum, void*, pname, eqn); - *eqn_count = 0; - (void)yagl_host_glGetClipPlanex(pname, eqn, eqn_maxcount, eqn_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGetFixedv dispatcher. id = 125 - */ -static bool yagl_func_glGetFixedv(struct yagl_transport *t) -{ - GLenum pname; - GLfixed *params; - int32_t params_maxcount; - int32_t *params_count; - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_in_array(t, sizeof(GLfixed), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glGetFixedv, GLenum, void*, pname, params); - *params_count = 0; - (void)yagl_host_glGetFixedv(pname, params, params_maxcount, params_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGetLightxv dispatcher. id = 126 - */ -static bool yagl_func_glGetLightxv(struct yagl_transport *t) -{ - GLenum light; - GLenum pname; - GLfixed *params; - int32_t params_maxcount; - int32_t *params_count; - light = yagl_transport_get_out_GLenum(t); - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_in_array(t, sizeof(GLfixed), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT3(glGetLightxv, GLenum, GLenum, void*, light, pname, params); - *params_count = 0; - (void)yagl_host_glGetLightxv(light, pname, params, params_maxcount, params_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGetMaterialxv dispatcher. id = 127 - */ -static bool yagl_func_glGetMaterialxv(struct yagl_transport *t) -{ - GLenum face; - GLenum pname; - GLfixed *params; - int32_t params_maxcount; - int32_t *params_count; - face = yagl_transport_get_out_GLenum(t); - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_in_array(t, sizeof(GLfixed), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT3(glGetMaterialxv, GLenum, GLenum, void*, face, pname, params); - *params_count = 0; - (void)yagl_host_glGetMaterialxv(face, pname, params, params_maxcount, params_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGetPointerv dispatcher. id = 128 - */ -static bool yagl_func_glGetPointerv(struct yagl_transport *t) -{ - GLenum pname; - target_ulong *params; - pname = yagl_transport_get_out_GLenum(t); - yagl_transport_get_in_arg(t, (void**)¶ms); - YAGL_LOG_FUNC_ENTER_SPLIT2(glGetPointerv, GLenum, target_ulong*, pname, params); - (void)yagl_host_glGetPointerv(pname, params); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGetTexEnviv dispatcher. id = 129 - */ -static bool 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); - if (!yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - 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); - - return true; -} - -/* - * glGetTexEnvxv dispatcher. id = 130 - */ -static bool yagl_func_glGetTexEnvxv(struct yagl_transport *t) -{ - GLenum env; - GLenum pname; - GLfixed *params; - int32_t params_maxcount; - int32_t *params_count; - env = yagl_transport_get_out_GLenum(t); - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_in_array(t, sizeof(GLfixed), (void**)¶ms, ¶ms_maxcount, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexEnvxv, GLenum, GLenum, void*, env, pname, params); - *params_count = 0; - (void)yagl_host_glGetTexEnvxv(env, pname, params, params_maxcount, params_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glGetTexParameterxv dispatcher. id = 131 - */ -static bool yagl_func_glGetTexParameterxv(struct yagl_transport *t) -{ - GLenum target; - GLenum pname; - GLfixed *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(glGetTexParameterxv, GLenum, GLenum, void*, target, pname, param); - (void)yagl_host_glGetTexParameterxv(target, pname, param); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glLightModelx dispatcher. id = 132 - */ -static bool yagl_func_glLightModelx(struct yagl_transport *t) -{ - GLenum pname; - GLfixed param; - pname = yagl_transport_get_out_GLenum(t); - param = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT2(glLightModelx, GLenum, GLfixed, pname, param); - (void)yagl_host_glLightModelx(pname, param); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glLightModelxv dispatcher. id = 133 - */ -static bool yagl_func_glLightModelxv(struct yagl_transport *t) -{ - GLenum pname; - const GLfixed *params; - int32_t params_count; - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfixed), (const void**)¶ms, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glLightModelxv, GLenum, void*, pname, params); - (void)yagl_host_glLightModelxv(pname, params, params_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glLightx dispatcher. id = 134 - */ -static bool yagl_func_glLightx(struct yagl_transport *t) -{ - GLenum light; - GLenum pname; - GLfixed param; - light = yagl_transport_get_out_GLenum(t); - pname = yagl_transport_get_out_GLenum(t); - param = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT3(glLightx, GLenum, GLenum, GLfixed, light, pname, param); - (void)yagl_host_glLightx(light, pname, param); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glLightxv dispatcher. id = 135 - */ -static bool yagl_func_glLightxv(struct yagl_transport *t) -{ - GLenum light; - GLenum pname; - const GLfixed *params; - int32_t params_count; - light = yagl_transport_get_out_GLenum(t); - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfixed), (const void**)¶ms, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT3(glLightxv, GLenum, GLenum, void*, light, pname, params); - (void)yagl_host_glLightxv(light, pname, params, params_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glLineWidthx dispatcher. id = 136 - */ -static bool yagl_func_glLineWidthx(struct yagl_transport *t) -{ - GLfixed width; - width = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT1(glLineWidthx, GLfixed, width); - (void)yagl_host_glLineWidthx(width); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glLoadIdentity dispatcher. id = 137 - */ -static bool yagl_func_glLoadIdentity(struct yagl_transport *t) -{ - YAGL_LOG_FUNC_ENTER_SPLIT0(glLoadIdentity); - (void)yagl_host_glLoadIdentity(); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glLoadMatrixx dispatcher. id = 138 - */ -static bool yagl_func_glLoadMatrixx(struct yagl_transport *t) -{ - const GLfixed *m; - int32_t m_count; - if (!yagl_transport_get_out_array(t, sizeof(GLfixed), (const void**)&m, &m_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glLoadMatrixx, void*, m); - (void)yagl_host_glLoadMatrixx(m, m_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glLogicOp dispatcher. id = 139 - */ -static bool 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); - - return true; -} - -/* - * glMaterialx dispatcher. id = 140 - */ -static bool yagl_func_glMaterialx(struct yagl_transport *t) -{ - GLenum face; - GLenum pname; - GLfixed param; - face = yagl_transport_get_out_GLenum(t); - pname = yagl_transport_get_out_GLenum(t); - param = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT3(glMaterialx, GLenum, GLenum, GLfixed, face, pname, param); - (void)yagl_host_glMaterialx(face, pname, param); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glMaterialxv dispatcher. id = 141 - */ -static bool yagl_func_glMaterialxv(struct yagl_transport *t) -{ - GLenum face; - GLenum pname; - const GLfixed *params; - int32_t params_count; - face = yagl_transport_get_out_GLenum(t); - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfixed), (const void**)¶ms, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT3(glMaterialxv, GLenum, GLenum, void*, face, pname, params); - (void)yagl_host_glMaterialxv(face, pname, params, params_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glMatrixMode dispatcher. id = 142 - */ -static bool 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); - - return true; -} - -/* - * glMultMatrixx dispatcher. id = 143 - */ -static bool yagl_func_glMultMatrixx(struct yagl_transport *t) -{ - const GLfixed *m; - int32_t m_count; - if (!yagl_transport_get_out_array(t, sizeof(GLfixed), (const void**)&m, &m_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT1(glMultMatrixx, void*, m); - (void)yagl_host_glMultMatrixx(m, m_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glMultiTexCoord4x dispatcher. id = 144 - */ -static bool yagl_func_glMultiTexCoord4x(struct yagl_transport *t) -{ - GLenum target; - GLfixed s; - GLfixed tt; - GLfixed r; - GLfixed q; - target = yagl_transport_get_out_GLenum(t); - s = yagl_transport_get_out_GLfixed(t); - tt = yagl_transport_get_out_GLfixed(t); - r = yagl_transport_get_out_GLfixed(t); - q = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT5(glMultiTexCoord4x, GLenum, GLfixed, GLfixed, GLfixed, GLfixed, target, s, tt, r, q); - (void)yagl_host_glMultiTexCoord4x(target, s, tt, r, q); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glNormal3x dispatcher. id = 145 - */ -static bool yagl_func_glNormal3x(struct yagl_transport *t) -{ - GLfixed nx; - GLfixed ny; - GLfixed nz; - nx = yagl_transport_get_out_GLfixed(t); - ny = yagl_transport_get_out_GLfixed(t); - nz = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT3(glNormal3x, GLfixed, GLfixed, GLfixed, nx, ny, nz); - (void)yagl_host_glNormal3x(nx, ny, nz); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glNormalPointer dispatcher. id = 146 - */ -static bool yagl_func_glNormalPointer(struct yagl_transport *t) -{ - GLenum type; - GLsizei stride; - target_ulong pointer; - type = yagl_transport_get_out_GLenum(t); - stride = yagl_transport_get_out_GLsizei(t); - pointer = yagl_transport_get_out_va(t); - YAGL_LOG_FUNC_ENTER_SPLIT3(glNormalPointer, GLenum, GLsizei, target_ulong, type, stride, pointer); - (void)yagl_host_glNormalPointer(type, stride, pointer); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glOrthox dispatcher. id = 147 - */ -static bool yagl_func_glOrthox(struct yagl_transport *t) -{ - GLfixed left; - GLfixed right; - GLfixed bottom; - GLfixed top; - GLfixed zNear; - GLfixed zFar; - left = yagl_transport_get_out_GLfixed(t); - right = yagl_transport_get_out_GLfixed(t); - bottom = yagl_transport_get_out_GLfixed(t); - top = yagl_transport_get_out_GLfixed(t); - zNear = yagl_transport_get_out_GLfixed(t); - zFar = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT6(glOrthox, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, left, right, bottom, top, zNear, zFar); - (void)yagl_host_glOrthox(left, right, bottom, top, zNear, zFar); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glPointParameterx dispatcher. id = 148 - */ -static bool yagl_func_glPointParameterx(struct yagl_transport *t) -{ - GLenum pname; - GLfixed param; - pname = yagl_transport_get_out_GLenum(t); - param = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT2(glPointParameterx, GLenum, GLfixed, pname, param); - (void)yagl_host_glPointParameterx(pname, param); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glPointParameterxv dispatcher. id = 149 - */ -static bool yagl_func_glPointParameterxv(struct yagl_transport *t) -{ - GLenum pname; - const GLfixed *params; - int32_t params_count; - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfixed), (const void**)¶ms, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT2(glPointParameterxv, GLenum, void*, pname, params); - (void)yagl_host_glPointParameterxv(pname, params, params_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glPointSizex dispatcher. id = 150 - */ -static bool yagl_func_glPointSizex(struct yagl_transport *t) -{ - GLfixed size; - size = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT1(glPointSizex, GLfixed, size); - (void)yagl_host_glPointSizex(size); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glPolygonOffsetx dispatcher. id = 151 - */ -static bool yagl_func_glPolygonOffsetx(struct yagl_transport *t) -{ - GLfixed factor; - GLfixed units; - factor = yagl_transport_get_out_GLfixed(t); - units = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT2(glPolygonOffsetx, GLfixed, GLfixed, factor, units); - (void)yagl_host_glPolygonOffsetx(factor, units); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glPopMatrix dispatcher. id = 152 - */ -static bool yagl_func_glPopMatrix(struct yagl_transport *t) -{ - YAGL_LOG_FUNC_ENTER_SPLIT0(glPopMatrix); - (void)yagl_host_glPopMatrix(); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glPushMatrix dispatcher. id = 153 - */ -static bool yagl_func_glPushMatrix(struct yagl_transport *t) -{ - YAGL_LOG_FUNC_ENTER_SPLIT0(glPushMatrix); - (void)yagl_host_glPushMatrix(); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glRotatex dispatcher. id = 154 - */ -static bool yagl_func_glRotatex(struct yagl_transport *t) -{ - GLfixed angle; - GLfixed x; - GLfixed y; - GLfixed z; - angle = yagl_transport_get_out_GLfixed(t); - x = yagl_transport_get_out_GLfixed(t); - y = yagl_transport_get_out_GLfixed(t); - z = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT4(glRotatex, GLfixed, GLfixed, GLfixed, GLfixed, angle, x, y, z); - (void)yagl_host_glRotatex(angle, x, y, z); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glSampleCoveragex dispatcher. id = 155 - */ -static bool yagl_func_glSampleCoveragex(struct yagl_transport *t) -{ - GLclampx value; - GLboolean invert; - value = yagl_transport_get_out_GLclampx(t); - invert = yagl_transport_get_out_GLboolean(t); - YAGL_LOG_FUNC_ENTER_SPLIT2(glSampleCoveragex, GLclampx, GLboolean, value, invert); - (void)yagl_host_glSampleCoveragex(value, invert); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glScalex dispatcher. id = 156 - */ -static bool yagl_func_glScalex(struct yagl_transport *t) -{ - GLfixed x; - GLfixed y; - GLfixed z; - x = yagl_transport_get_out_GLfixed(t); - y = yagl_transport_get_out_GLfixed(t); - z = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT3(glScalex, GLfixed, GLfixed, GLfixed, x, y, z); - (void)yagl_host_glScalex(x, y, z); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glShadeModel dispatcher. id = 157 - */ -static bool 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); - - return true; -} - -/* - * glTexCoordPointer dispatcher. id = 158 - */ -static bool yagl_func_glTexCoordPointer(struct yagl_transport *t) -{ - GLint size; - GLenum type; - GLsizei stride; - target_ulong pointer; - size = yagl_transport_get_out_GLint(t); - type = yagl_transport_get_out_GLenum(t); - stride = yagl_transport_get_out_GLsizei(t); - pointer = yagl_transport_get_out_va(t); - YAGL_LOG_FUNC_ENTER_SPLIT4(glTexCoordPointer, GLint, GLenum, GLsizei, target_ulong, size, type, stride, pointer); - (void)yagl_host_glTexCoordPointer(size, type, stride, pointer); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glTexEnvi dispatcher. id = 159 - */ -static bool 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); - - return true; -} - -/* - * glTexEnvx dispatcher. id = 160 - */ -static bool yagl_func_glTexEnvx(struct yagl_transport *t) -{ - GLenum target; - GLenum pname; - GLfixed param; - target = yagl_transport_get_out_GLenum(t); - pname = yagl_transport_get_out_GLenum(t); - param = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnvx, GLenum, GLenum, GLfixed, target, pname, param); - (void)yagl_host_glTexEnvx(target, pname, param); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glTexEnviv dispatcher. id = 161 - */ -static bool 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); - if (!yagl_transport_get_out_array(t, sizeof(GLint), (const void**)¶ms, ¶ms_count)) { - return false; - } - 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); - - return true; -} - -/* - * glTexEnvxv dispatcher. id = 162 - */ -static bool yagl_func_glTexEnvxv(struct yagl_transport *t) -{ - GLenum target; - GLenum pname; - const GLfixed *params; - int32_t params_count; - target = yagl_transport_get_out_GLenum(t); - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfixed), (const void**)¶ms, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnvxv, GLenum, GLenum, void*, target, pname, params); - (void)yagl_host_glTexEnvxv(target, pname, params, params_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glTexParameterx dispatcher. id = 163 - */ -static bool yagl_func_glTexParameterx(struct yagl_transport *t) -{ - GLenum target; - GLenum pname; - GLfixed param; - target = yagl_transport_get_out_GLenum(t); - pname = yagl_transport_get_out_GLenum(t); - param = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameterx, GLenum, GLenum, GLfixed, target, pname, param); - (void)yagl_host_glTexParameterx(target, pname, param); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glTexParameterxv dispatcher. id = 164 - */ -static bool yagl_func_glTexParameterxv(struct yagl_transport *t) -{ - GLenum target; - GLenum pname; - const GLfixed *params; - int32_t params_count; - target = yagl_transport_get_out_GLenum(t); - pname = yagl_transport_get_out_GLenum(t); - if (!yagl_transport_get_out_array(t, sizeof(GLfixed), (const void**)¶ms, ¶ms_count)) { - return false; - } - YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameterxv, GLenum, GLenum, void*, target, pname, params); - (void)yagl_host_glTexParameterxv(target, pname, params, params_count); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glTranslatex dispatcher. id = 165 - */ -static bool yagl_func_glTranslatex(struct yagl_transport *t) -{ - GLfixed x; - GLfixed y; - GLfixed z; - x = yagl_transport_get_out_GLfixed(t); - y = yagl_transport_get_out_GLfixed(t); - z = yagl_transport_get_out_GLfixed(t); - YAGL_LOG_FUNC_ENTER_SPLIT3(glTranslatex, GLfixed, GLfixed, GLfixed, x, y, z); - (void)yagl_host_glTranslatex(x, y, z); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -/* - * glVertexPointer dispatcher. id = 166 - */ -static bool yagl_func_glVertexPointer(struct yagl_transport *t) -{ - GLint size; - GLenum type; - GLsizei stride; - target_ulong pointer; - size = yagl_transport_get_out_GLint(t); - type = yagl_transport_get_out_GLenum(t); - stride = yagl_transport_get_out_GLsizei(t); - pointer = yagl_transport_get_out_va(t); - YAGL_LOG_FUNC_ENTER_SPLIT4(glVertexPointer, GLint, GLenum, GLsizei, target_ulong, size, type, stride, pointer); - (void)yagl_host_glVertexPointer(size, type, stride, pointer); - YAGL_LOG_FUNC_EXIT(NULL); - - return true; -} - -const uint32_t yagl_gles1_api_num_funcs = 166; - -yagl_api_func yagl_gles1_api_funcs[] = { - &yagl_func_glActiveTexture, - &yagl_func_glBindBuffer, - &yagl_func_glBindFramebuffer, - &yagl_func_glBindRenderbuffer, - &yagl_func_glBindTexture, - &yagl_func_glBlendEquation, - &yagl_func_glBlendEquationSeparate, - &yagl_func_glBlendFunc, - &yagl_func_glBlendFuncSeparate, - &yagl_func_glBufferData, - &yagl_func_glBufferSubData, - &yagl_func_glCheckFramebufferStatus, - &yagl_func_glClear, - &yagl_func_glClearColor, - &yagl_func_glClearDepthf, - &yagl_func_glClearStencil, - &yagl_func_glColorMask, - &yagl_func_glCompressedTexImage2D, - &yagl_func_glCompressedTexSubImage2D, - &yagl_func_glCopyTexImage2D, - &yagl_func_glCopyTexSubImage2D, - &yagl_func_glCullFace, - &yagl_func_glDeleteBuffers, - &yagl_func_glDeleteFramebuffers, - &yagl_func_glDeleteRenderbuffers, - &yagl_func_glDeleteTextures, - &yagl_func_glDepthFunc, - &yagl_func_glDepthMask, - &yagl_func_glDepthRangef, - &yagl_func_glDisable, - &yagl_func_glDrawArrays, - &yagl_func_glEGLImageTargetTexture2DOES, - &yagl_func_glEnable, - &yagl_func_glFlush, - &yagl_func_glFramebufferTexture2D, - &yagl_func_glFramebufferRenderbuffer, - &yagl_func_glFrontFace, - &yagl_func_glGenBuffers, - &yagl_func_glGenerateMipmap, - &yagl_func_glGenFramebuffers, - &yagl_func_glGenRenderbuffers, - &yagl_func_glGenTextures, - &yagl_func_glGetBooleanv, - &yagl_func_glGetBufferParameteriv, - &yagl_func_glGetError, - &yagl_func_glGetFloatv, - &yagl_func_glGetFramebufferAttachmentParameteriv, - &yagl_func_glGetIntegerv, - &yagl_func_glGetRenderbufferParameteriv, - &yagl_func_glGetTexParameterfv, - &yagl_func_glGetTexParameteriv, - &yagl_func_glHint, - &yagl_func_glIsBuffer, - &yagl_func_glIsEnabled, - &yagl_func_glIsFramebuffer, - &yagl_func_glIsRenderbuffer, - &yagl_func_glIsTexture, - &yagl_func_glLineWidth, - &yagl_func_glPixelStorei, - &yagl_func_glPolygonOffset, - &yagl_func_glReadPixels, - &yagl_func_glRenderbufferStorage, - &yagl_func_glSampleCoverage, - &yagl_func_glScissor, - &yagl_func_glStencilFunc, - &yagl_func_glStencilMask, - &yagl_func_glStencilOp, - &yagl_func_glTexImage2D, - &yagl_func_glTexParameterf, - &yagl_func_glTexParameterfv, - &yagl_func_glTexParameteri, - &yagl_func_glTexParameteriv, - &yagl_func_glTexSubImage2D, - &yagl_func_glViewport, - &yagl_func_glTransferArrayYAGL, - &yagl_func_glDrawElementsIndicesYAGL, - &yagl_func_glDrawElementsOffsetYAGL, - &yagl_func_glGetExtensionStringYAGL, - &yagl_func_glGetVertexAttribRangeYAGL, - &yagl_func_glAlphaFunc, - &yagl_func_glClipPlanef, - &yagl_func_glColor4f, - &yagl_func_glFogf, - &yagl_func_glFogfv, - &yagl_func_glFrustumf, - &yagl_func_glGetClipPlanef, - &yagl_func_glGetLightfv, - &yagl_func_glGetMaterialfv, - &yagl_func_glGetTexEnvfv, - &yagl_func_glLightModelf, - &yagl_func_glLightModelfv, - &yagl_func_glLightf, - &yagl_func_glLightfv, - &yagl_func_glLoadMatrixf, - &yagl_func_glMaterialf, - &yagl_func_glMaterialfv, - &yagl_func_glMultMatrixf, - &yagl_func_glMultiTexCoord4f, - &yagl_func_glNormal3f, - &yagl_func_glOrthof, - &yagl_func_glPointParameterf, - &yagl_func_glPointParameterfv, - &yagl_func_glPointSize, - &yagl_func_glPointSizePointerOES, - &yagl_func_glRotatef, - &yagl_func_glScalef, - &yagl_func_glTexEnvf, - &yagl_func_glTexEnvfv, - &yagl_func_glTranslatef, - &yagl_func_glAlphaFuncx, - &yagl_func_glClearColorx, - &yagl_func_glClearDepthx, - &yagl_func_glClientActiveTexture, - &yagl_func_glClipPlanex, - &yagl_func_glColor4ub, - &yagl_func_glColor4x, - &yagl_func_glColorPointer, - &yagl_func_glDepthRangex, - &yagl_func_glDisableClientState, - &yagl_func_glEnableClientState, - &yagl_func_glFogx, - &yagl_func_glFogxv, - &yagl_func_glFrustumx, - &yagl_func_glGetClipPlanex, - &yagl_func_glGetFixedv, - &yagl_func_glGetLightxv, - &yagl_func_glGetMaterialxv, - &yagl_func_glGetPointerv, - &yagl_func_glGetTexEnviv, - &yagl_func_glGetTexEnvxv, - &yagl_func_glGetTexParameterxv, - &yagl_func_glLightModelx, - &yagl_func_glLightModelxv, - &yagl_func_glLightx, - &yagl_func_glLightxv, - &yagl_func_glLineWidthx, - &yagl_func_glLoadIdentity, - &yagl_func_glLoadMatrixx, - &yagl_func_glLogicOp, - &yagl_func_glMaterialx, - &yagl_func_glMaterialxv, - &yagl_func_glMatrixMode, - &yagl_func_glMultMatrixx, - &yagl_func_glMultiTexCoord4x, - &yagl_func_glNormal3x, - &yagl_func_glNormalPointer, - &yagl_func_glOrthox, - &yagl_func_glPointParameterx, - &yagl_func_glPointParameterxv, - &yagl_func_glPointSizex, - &yagl_func_glPolygonOffsetx, - &yagl_func_glPopMatrix, - &yagl_func_glPushMatrix, - &yagl_func_glRotatex, - &yagl_func_glSampleCoveragex, - &yagl_func_glScalex, - &yagl_func_glShadeModel, - &yagl_func_glTexCoordPointer, - &yagl_func_glTexEnvi, - &yagl_func_glTexEnvx, - &yagl_func_glTexEnviv, - &yagl_func_glTexEnvxv, - &yagl_func_glTexParameterx, - &yagl_func_glTexParameterxv, - &yagl_func_glTranslatex, - &yagl_func_glVertexPointer, -}; diff --git a/hw/yagl_apis/gles1/yagl_gles1_calls.h b/hw/yagl_apis/gles1/yagl_gles1_calls.h deleted file mode 100644 index b9cc7ca..0000000 --- a/hw/yagl_apis/gles1/yagl_gles1_calls.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Generated by gen-yagl-calls.py, do not modify! - */ -#ifndef _QEMU_YAGL_GLES1_CALLS_H_ -#define _QEMU_YAGL_GLES1_CALLS_H_ - -#include "yagl_types.h" - -extern const uint32_t yagl_gles1_api_num_funcs; - -extern yagl_api_func yagl_gles1_api_funcs[]; - -#endif diff --git a/hw/yagl_apis/gles1/yagl_gles1_context.c b/hw/yagl_apis/gles1/yagl_gles1_context.c deleted file mode 100644 index dc03c69..0000000 --- a/hw/yagl_apis/gles1/yagl_gles1_context.c +++ /dev/null @@ -1,1237 +0,0 @@ -#include -#include -#include "yagl_gles1_context.h" -#include "yagl_apis/gles/yagl_gles_array.h" -#include "yagl_apis/gles/yagl_gles_buffer.h" -#include "yagl_log.h" -#include "yagl_process.h" -#include "yagl_thread.h" -#include "yagl_sharegroup.h" -#include "yagl_gles1_driver.h" -#include "exec/user/abitypes.h" - -#define YAGL_GLES1_NUM_COMP_TEX_FORMATS 10 -#define YAGL_TARGET_INT_MAX \ - ((1ll << ((sizeof(abi_int) * 8) - 1)) - 1) - -static void yagl_gles1_vertex_array_apply(struct yagl_gles_array *array) -{ - struct yagl_gles1_driver *driver = ((YaglGles1Context *)array->ctx)->driver; - GLenum type = array->type; - GLsizei stride = array->stride; - - if (array->vbo) { - yagl_object_name old_buffer_name = 0; - GLvoid *pointer = (GLvoid *)(uintptr_t)array->offset; - - yagl_gles_buffer_bind(array->vbo, - array->type, - array->need_convert, - GL_ARRAY_BUFFER, - &old_buffer_name); - - if (array->type == GL_BYTE) { - type = GL_SHORT; - pointer = (GLvoid *)(uintptr_t)(array->offset * sizeof(GLshort)); - stride = array->stride * sizeof(GLshort); - } else if (array->type == GL_FIXED) { - type = GL_FLOAT; - } - - driver->VertexPointer(array->size, type, stride, pointer); - - driver->base.BindBuffer(GL_ARRAY_BUFFER, old_buffer_name); - } else { - assert(array->host_data); - - if (array->type == GL_BYTE) { - type = GL_SHORT; - stride = 0; - } else if (array->type == GL_FIXED) { - type = GL_FLOAT; - } - - driver->VertexPointer(array->size, type, stride, array->host_data); - } -} - -static void yagl_gles1_normal_array_apply(struct yagl_gles_array *array) -{ - struct yagl_gles1_driver *driver = ((YaglGles1Context *)array->ctx)->driver; - GLenum type = array->type == GL_FIXED ? GL_FLOAT : array->type; - - if (array->vbo) { - yagl_object_name old_buffer_name = 0; - - yagl_gles_buffer_bind(array->vbo, - array->type, - array->need_convert, - GL_ARRAY_BUFFER, - &old_buffer_name); - - driver->NormalPointer(type, - array->stride, - (GLvoid *)(uintptr_t)array->offset); - - driver->base.BindBuffer(GL_ARRAY_BUFFER, old_buffer_name); - } else { - assert(array->host_data); - - driver->NormalPointer(type, - array->stride, - array->host_data); - } -} - -static void yagl_gles1_color_array_apply(struct yagl_gles_array *array) -{ - struct yagl_gles1_driver *driver = ((YaglGles1Context *)array->ctx)->driver; - GLenum type = array->type == GL_FIXED ? GL_FLOAT : array->type; - - if (array->vbo) { - yagl_object_name old_buffer_name = 0; - - yagl_gles_buffer_bind(array->vbo, - array->type, - array->need_convert, - GL_ARRAY_BUFFER, - &old_buffer_name); - - driver->ColorPointer(array->size, - type, - array->stride, - (GLvoid *)(uintptr_t)array->offset); - - driver->base.BindBuffer(GL_ARRAY_BUFFER, old_buffer_name); - } else { - assert(array->host_data); - - driver->ColorPointer(array->size, - type, - array->stride, - array->host_data); - } -} - -static void yagl_gles1_tex_coord_array_apply(struct yagl_gles_array *array) -{ - YaglGles1Context *gles1_ctx = (YaglGles1Context *)array->ctx; - struct yagl_gles1_driver *driver = gles1_ctx->driver; - GLenum type = array->type; - GLsizei stride = array->stride; - int tex_id = array->index - YAGL_GLES1_ARRAY_TEX_COORD; - - if (tex_id != gles1_ctx->client_active_texture) { - driver->ClientActiveTexture(tex_id + GL_TEXTURE0); - } - - if (array->vbo) { - yagl_object_name old_buffer_name = 0; - GLvoid *pointer = (GLvoid *)(uintptr_t)array->offset; - - yagl_gles_buffer_bind(array->vbo, - array->type, - array->need_convert, - GL_ARRAY_BUFFER, - &old_buffer_name); - - if (array->type == GL_BYTE) { - type = GL_SHORT; - pointer = (GLvoid *)(uintptr_t)(array->offset * sizeof(GLshort)); - stride = array->stride * sizeof(GLshort); - } else if (array->type == GL_FIXED) { - type = GL_FLOAT; - } - - driver->TexCoordPointer(array->size, type, stride, pointer); - - driver->base.BindBuffer(GL_ARRAY_BUFFER, old_buffer_name); - } else { - assert(array->host_data); - - if (array->type == GL_BYTE) { - type = GL_SHORT; - stride = 0; - } else if (array->type == GL_FIXED) { - type = GL_FLOAT; - } - - driver->TexCoordPointer(array->size, type, stride, array->host_data); - } - - if (tex_id != gles1_ctx->client_active_texture) { - driver->ClientActiveTexture(gles1_ctx->client_active_texture + - GL_TEXTURE0); - } -} - -static void yagl_gles1_point_size_array_apply(struct yagl_gles_array *array) -{ - -} - -static void yagl_gles1_context_prepare(YaglGles1Context *gles1_ctx) -{ - struct yagl_gles_driver *gles_driver = &gles1_ctx->driver->base; - GLint i, num_texture_units = 0; - struct yagl_gles_array *arrays; - const gchar *extns = NULL; - int num_arrays; - - YAGL_LOG_FUNC_ENTER(yagl_gles2_context_prepare, "%p", gles1_ctx); - - gles_driver->GetIntegerv(GL_MAX_TEXTURE_UNITS, &num_texture_units); - - /* - * We limit this by 32 for conformance. - */ - if (num_texture_units > 32) { - num_texture_units = 32; - } - - /* Each texture unit has its own client-side array state */ - num_arrays = YAGL_GLES1_ARRAY_TEX_COORD + num_texture_units; - - arrays = g_new(struct yagl_gles_array, num_arrays); - - yagl_gles_array_init(&arrays[YAGL_GLES1_ARRAY_VERTEX], - YAGL_GLES1_ARRAY_VERTEX, - &gles1_ctx->base, - &yagl_gles1_vertex_array_apply); - - yagl_gles_array_init(&arrays[YAGL_GLES1_ARRAY_COLOR], - YAGL_GLES1_ARRAY_COLOR, - &gles1_ctx->base, - &yagl_gles1_color_array_apply); - - yagl_gles_array_init(&arrays[YAGL_GLES1_ARRAY_NORMAL], - YAGL_GLES1_ARRAY_NORMAL, - &gles1_ctx->base, - &yagl_gles1_normal_array_apply); - - yagl_gles_array_init(&arrays[YAGL_GLES1_ARRAY_POINTSIZE], - YAGL_GLES1_ARRAY_POINTSIZE, - &gles1_ctx->base, - &yagl_gles1_point_size_array_apply); - - for (i = YAGL_GLES1_ARRAY_TEX_COORD; i < num_arrays; ++i) { - yagl_gles_array_init(&arrays[i], - i, - &gles1_ctx->base, - &yagl_gles1_tex_coord_array_apply); - } - - yagl_gles_context_prepare(&gles1_ctx->base, arrays, - num_arrays, num_texture_units); - - gles_driver->GetIntegerv(GL_MAX_CLIP_PLANES, &gles1_ctx->max_clip_planes); - - if (gles1_ctx->max_clip_planes < 6) { - YAGL_LOG_WARN("host GL_MAX_CLIP_PLANES=%d is less then required 6", - gles1_ctx->max_clip_planes); - } else { - /* According to OpenGLES 1.1 docs on khrnos website we only need - * to support 6 planes. This will protect us from bogus - * GL_MAX_CLIP_PLANES value reported by some drivers */ - gles1_ctx->max_clip_planes = 6; - } - - gles_driver->GetIntegerv(GL_MAX_LIGHTS, &gles1_ctx->max_lights); - - gles_driver->GetIntegerv(GL_MAX_TEXTURE_SIZE, &gles1_ctx->max_tex_size); - - extns = (const gchar *)gles_driver->GetString(GL_EXTENSIONS); - - gles1_ctx->framebuffer_object = - (g_strstr_len(extns, -1, "GL_EXT_framebuffer_object ") != NULL) || - (g_strstr_len(extns, -1, "GL_ARB_framebuffer_object ") != NULL); - - gles1_ctx->matrix_palette = - (g_strstr_len(extns, -1, "GL_ARB_vertex_blend ") != NULL) && - (g_strstr_len(extns, -1, "GL_ARB_matrix_palette ") != NULL); - - YAGL_LOG_FUNC_EXIT(NULL); -} - -static void yagl_gles1_context_activate(struct yagl_client_context *ctx) -{ - YaglGles1Context *gles1_ctx = (YaglGles1Context *)ctx; - - if (!gles1_ctx->prepared) { - yagl_gles1_context_prepare(gles1_ctx); - gles1_ctx->prepared = true; - } - - yagl_gles_context_activate(&gles1_ctx->base); -} - -static void yagl_gles1_context_deactivate(struct yagl_client_context *ctx) -{ - YaglGles1Context *gles1_ctx = (YaglGles1Context *)ctx; - - yagl_gles_context_deactivate(&gles1_ctx->base); -} - -static void yagl_gles1_context_destroy(struct yagl_client_context *ctx) -{ - YaglGles1Context *gles1_ctx = (YaglGles1Context *)ctx; - - YAGL_LOG_FUNC_ENTER(gles1_ctx->driver_ps->common->ps->id, - 0, - yagl_gles1_context_destroy, - "%p", - gles1_ctx); - - yagl_gles_context_cleanup(&gles1_ctx->base); - yagl_client_context_cleanup(&gles1_ctx->base.base); - - g_free(gles1_ctx); - - YAGL_LOG_FUNC_EXIT(NULL); -} - -static bool yagl_gles1_context_get_param_count(struct yagl_gles_context *ctx, - GLenum pname, - int *count) -{ - YaglGles1Context *gles1_ctx = (YaglGles1Context *)ctx; - - switch (pname) { - case GL_COMPRESSED_TEXTURE_FORMATS: - *count = YAGL_GLES1_NUM_COMP_TEX_FORMATS; - break; - case GL_ACTIVE_TEXTURE: - case GL_ALPHA_BITS: - case GL_ALPHA_TEST: - case GL_ALPHA_TEST_FUNC: - case GL_ALPHA_TEST_REF: - case GL_ARRAY_BUFFER_BINDING: - case GL_BLEND: - case GL_BLEND_DST: - case GL_BLEND_SRC: - case GL_BLUE_BITS: - case GL_CLIENT_ACTIVE_TEXTURE: - case GL_COLOR_ARRAY: - case GL_COLOR_ARRAY_BUFFER_BINDING: - case GL_COLOR_ARRAY_SIZE: - case GL_COLOR_ARRAY_STRIDE: - case GL_COLOR_ARRAY_TYPE: - case GL_COLOR_LOGIC_OP: - case GL_COLOR_MATERIAL: - case GL_CULL_FACE: - case GL_CULL_FACE_MODE: - case GL_DEPTH_BITS: - case GL_DEPTH_CLEAR_VALUE: - case GL_DEPTH_FUNC: - case GL_DEPTH_TEST: - case GL_DEPTH_WRITEMASK: - case GL_ELEMENT_ARRAY_BUFFER_BINDING: - case GL_FOG: - case GL_FOG_DENSITY: - case GL_FOG_END: - case GL_FOG_HINT: - case GL_FOG_MODE: - case GL_FOG_START: - case GL_FRONT_FACE: - case GL_GENERATE_MIPMAP_HINT: - case GL_GREEN_BITS: - case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: - case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: - case GL_LIGHT_MODEL_TWO_SIDE: - case GL_LIGHTING: - case GL_LINE_SMOOTH: - case GL_LINE_SMOOTH_HINT: - case GL_LINE_WIDTH: - case GL_LOGIC_OP_MODE: - case GL_MATRIX_MODE: - case GL_MAX_CLIP_PLANES: - case GL_MAX_LIGHTS: - case GL_MAX_MODELVIEW_STACK_DEPTH: - case GL_MAX_PROJECTION_STACK_DEPTH: - case GL_MAX_TEXTURE_SIZE: - case GL_MAX_TEXTURE_STACK_DEPTH: - case GL_MAX_TEXTURE_UNITS: - case GL_MODELVIEW_STACK_DEPTH: - case GL_MULTISAMPLE: - case GL_NORMAL_ARRAY: - case GL_NORMAL_ARRAY_BUFFER_BINDING: - case GL_NORMAL_ARRAY_STRIDE: - case GL_NORMAL_ARRAY_TYPE: - case GL_NORMALIZE: - case GL_NUM_COMPRESSED_TEXTURE_FORMATS: - case GL_PACK_ALIGNMENT: - case GL_PERSPECTIVE_CORRECTION_HINT: - case GL_POINT_FADE_THRESHOLD_SIZE: - case GL_POINT_SIZE: - case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: - case GL_POINT_SIZE_ARRAY_OES: - case GL_POINT_SIZE_ARRAY_STRIDE_OES: - case GL_POINT_SIZE_ARRAY_TYPE_OES: - case GL_POINT_SIZE_MAX: - case GL_POINT_SIZE_MIN: - case GL_POINT_SMOOTH: - case GL_POINT_SMOOTH_HINT: - case GL_POINT_SPRITE_OES: - case GL_POLYGON_OFFSET_FACTOR: - case GL_POLYGON_OFFSET_FILL: - case GL_POLYGON_OFFSET_UNITS: - case GL_PROJECTION_STACK_DEPTH: - case GL_RED_BITS: - case GL_RESCALE_NORMAL: - case GL_SAMPLE_ALPHA_TO_COVERAGE: - case GL_SAMPLE_ALPHA_TO_ONE: - case GL_SAMPLE_BUFFERS: - case GL_SAMPLE_COVERAGE: - case GL_SAMPLE_COVERAGE_INVERT: - case GL_SAMPLE_COVERAGE_VALUE: - case GL_SAMPLES: - case GL_SCISSOR_TEST: - case GL_SHADE_MODEL: - case GL_STENCIL_BITS: - case GL_STENCIL_CLEAR_VALUE: - case GL_STENCIL_FAIL: - case GL_STENCIL_FUNC: - case GL_STENCIL_PASS_DEPTH_FAIL: - case GL_STENCIL_PASS_DEPTH_PASS: - case GL_STENCIL_REF: - case GL_STENCIL_TEST: - case GL_STENCIL_VALUE_MASK: - case GL_STENCIL_WRITEMASK: - case GL_SUBPIXEL_BITS: - case GL_TEXTURE_2D: - case GL_TEXTURE_BINDING_2D: - case GL_TEXTURE_COORD_ARRAY: - case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING: - case GL_TEXTURE_COORD_ARRAY_SIZE: - case GL_TEXTURE_COORD_ARRAY_STRIDE: - case GL_TEXTURE_COORD_ARRAY_TYPE: - case GL_TEXTURE_STACK_DEPTH: - case GL_UNPACK_ALIGNMENT: - case GL_VERTEX_ARRAY: - case GL_VERTEX_ARRAY_BUFFER_BINDING: - case GL_VERTEX_ARRAY_SIZE: - case GL_VERTEX_ARRAY_STRIDE: - case GL_VERTEX_ARRAY_TYPE: - /* GL_OES_blend_equation_separate */ - case GL_BLEND_EQUATION_RGB_OES: - case GL_BLEND_EQUATION_ALPHA_OES: - /* OES_blend_func_separate */ - case GL_BLEND_DST_RGB_OES: - case GL_BLEND_SRC_RGB_OES: - case GL_BLEND_DST_ALPHA_OES: - case GL_BLEND_SRC_ALPHA_OES: - *count = 1; - break; - case GL_DEPTH_RANGE: - case GL_ALIASED_LINE_WIDTH_RANGE: - case GL_ALIASED_POINT_SIZE_RANGE: - case GL_MAX_VIEWPORT_DIMS: - case GL_SMOOTH_LINE_WIDTH_RANGE: - case GL_SMOOTH_POINT_SIZE_RANGE: - *count = 2; - break; - case GL_CURRENT_NORMAL: - case GL_POINT_DISTANCE_ATTENUATION: - *count = 3; - break; - case GL_COLOR_WRITEMASK: - case GL_CURRENT_COLOR: - case GL_FOG_COLOR: - case GL_COLOR_CLEAR_VALUE: - case GL_LIGHT_MODEL_AMBIENT: - case GL_CURRENT_TEXTURE_COORDS: - case GL_SCISSOR_BOX: - case GL_VIEWPORT: - *count = 4; - break; - case GL_MODELVIEW_MATRIX: - case GL_PROJECTION_MATRIX: - case GL_TEXTURE_MATRIX: - *count = 16; - break; - /* GL_OES_framebuffer_object */ - case GL_FRAMEBUFFER_BINDING_OES: - case GL_RENDERBUFFER_BINDING_OES: - case GL_MAX_RENDERBUFFER_SIZE_OES: - if (!gles1_ctx->framebuffer_object) { - return false; - } - *count = 1; - break; - /* GL_OES_matrix_palette */ - case GL_MAX_PALETTE_MATRICES_OES: - case GL_MAX_VERTEX_UNITS_OES: - case GL_CURRENT_PALETTE_MATRIX_OES: - case GL_MATRIX_INDEX_ARRAY_SIZE_OES: - case GL_MATRIX_INDEX_ARRAY_TYPE_OES: - case GL_MATRIX_INDEX_ARRAY_STRIDE_OES: - case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES: - case GL_WEIGHT_ARRAY_SIZE_OES: - case GL_WEIGHT_ARRAY_TYPE_OES: - case GL_WEIGHT_ARRAY_STRIDE_OES: - case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES: - if (!gles1_ctx->matrix_palette) { - return false; - } - *count = 1; - break; - default: - if ((pname >= GL_CLIP_PLANE0 && - pname < (GL_CLIP_PLANE0 + gles1_ctx->max_clip_planes - 1)) || - (pname >= GL_LIGHT0 && - pname < (GL_LIGHT0 + gles1_ctx->max_lights - 1))) { - *count = 1; - break; - } - return false; - } - - return true; -} - -static unsigned yagl_gles1_array_idx_from_pname(YaglGles1Context *ctx, - GLenum pname) -{ - switch (pname) { - case GL_VERTEX_ARRAY: - case GL_VERTEX_ARRAY_BUFFER_BINDING: - case GL_VERTEX_ARRAY_SIZE: - case GL_VERTEX_ARRAY_STRIDE: - case GL_VERTEX_ARRAY_TYPE: - return YAGL_GLES1_ARRAY_VERTEX; - case GL_COLOR_ARRAY: - case GL_COLOR_ARRAY_BUFFER_BINDING: - case GL_COLOR_ARRAY_SIZE: - case GL_COLOR_ARRAY_STRIDE: - case GL_COLOR_ARRAY_TYPE: - return YAGL_GLES1_ARRAY_COLOR; - case GL_NORMAL_ARRAY: - case GL_NORMAL_ARRAY_BUFFER_BINDING: - case GL_NORMAL_ARRAY_STRIDE: - case GL_NORMAL_ARRAY_TYPE: - return YAGL_GLES1_ARRAY_NORMAL; - case GL_TEXTURE_COORD_ARRAY: - case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING: - case GL_TEXTURE_COORD_ARRAY_SIZE: - case GL_TEXTURE_COORD_ARRAY_STRIDE: - case GL_TEXTURE_COORD_ARRAY_TYPE: - return YAGL_GLES1_ARRAY_TEX_COORD + ctx->client_active_texture; - case GL_POINT_SIZE_ARRAY_TYPE_OES: - case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: - case GL_POINT_SIZE_ARRAY_OES: - case GL_POINT_SIZE_ARRAY_STRIDE_OES: - return YAGL_GLES1_ARRAY_POINTSIZE; - default: - exit(1); - } -} - -static void yagl_gles1_compressed_texture_formats_fill(GLint *params) -{ - params[0] = GL_PALETTE4_RGB8_OES; - params[1] = GL_PALETTE4_RGBA8_OES; - params[2] = GL_PALETTE4_R5_G6_B5_OES; - params[3] = GL_PALETTE4_RGBA4_OES; - params[4] = GL_PALETTE4_RGB5_A1_OES; - params[5] = GL_PALETTE8_RGB8_OES; - params[6] = GL_PALETTE8_RGBA8_OES; - params[7] = GL_PALETTE8_R5_G6_B5_OES; - params[8] = GL_PALETTE8_RGBA4_OES; - params[9] = GL_PALETTE8_RGB5_A1_OES; -} - -static bool yagl_gles1_context_get_integerv(struct yagl_gles_context *ctx, - GLenum pname, - GLint *params) -{ - YaglGles1Context *gles1_ctx = (YaglGles1Context *)ctx; - - switch (pname) { - case GL_MAX_CLIP_PLANES: - params[0] = gles1_ctx->max_clip_planes; - break; - case GL_MAX_LIGHTS: - params[0] = gles1_ctx->max_lights; - break; - case GL_MAX_TEXTURE_SIZE: - params[0] = gles1_ctx->max_tex_size; - break; - case GL_VERTEX_ARRAY: - case GL_NORMAL_ARRAY: - case GL_COLOR_ARRAY: - case GL_TEXTURE_COORD_ARRAY: - case GL_POINT_SIZE_ARRAY_OES: - params[0] = ctx->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].enabled; - break; - case GL_VERTEX_ARRAY_BUFFER_BINDING: - case GL_COLOR_ARRAY_BUFFER_BINDING: - case GL_NORMAL_ARRAY_BUFFER_BINDING: - case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING: - case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: - params[0] = ctx->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].vbo_local_name; - break; - case GL_VERTEX_ARRAY_STRIDE: - case GL_COLOR_ARRAY_STRIDE: - case GL_NORMAL_ARRAY_STRIDE: - case GL_TEXTURE_COORD_ARRAY_STRIDE: - case GL_POINT_SIZE_ARRAY_STRIDE_OES: - params[0] = ctx->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].stride; - break; - case GL_VERTEX_ARRAY_TYPE: - case GL_COLOR_ARRAY_TYPE: - case GL_NORMAL_ARRAY_TYPE: - case GL_TEXTURE_COORD_ARRAY_TYPE: - case GL_POINT_SIZE_ARRAY_TYPE_OES: - params[0] = ctx->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].type; - break; - case GL_VERTEX_ARRAY_SIZE: - case GL_COLOR_ARRAY_SIZE: - case GL_TEXTURE_COORD_ARRAY_SIZE: - params[0] = ctx->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].size; - break; - case GL_FRAMEBUFFER_BINDING_OES: - params[0] = ctx->fbo_local_name; - break; - case GL_RENDERBUFFER_BINDING_OES: - params[0] = ctx->rbo_local_name; - break; - case GL_NUM_COMPRESSED_TEXTURE_FORMATS: - params[0] = YAGL_GLES1_NUM_COMP_TEX_FORMATS; - break; - case GL_COMPRESSED_TEXTURE_FORMATS: - yagl_gles1_compressed_texture_formats_fill(params); - break; - case GL_ALPHA_TEST_REF: - { - /* According to spec, GL_ALPHA_TEST_REF must be scaled to - * -INT_MAX..+INT_MAX range, but driver might not do it, we do - * it manually here */ - GLfloat tmp; - - ctx->driver->GetFloatv(GL_ALPHA_TEST_REF, &tmp); - params[0] = (GLint)(tmp * (GLfloat)YAGL_TARGET_INT_MAX) - 1; - break; - } - default: - return false; - } - - return true; -} - -static bool yagl_gles1_context_get_booleanv(struct yagl_gles_context *ctx, - GLenum pname, - GLboolean *params) -{ - if (pname == GL_COMPRESSED_TEXTURE_FORMATS) { - GLint tmp[YAGL_GLES1_NUM_COMP_TEX_FORMATS]; - int i; - - if (yagl_gles1_context_get_integerv(ctx, pname, &tmp[0])) { - for (i = 0; i < YAGL_GLES1_NUM_COMP_TEX_FORMATS; ++i) { - params[i] = (tmp[i] != 0) ? GL_TRUE : GL_FALSE; - } - return true; - } - } else { - GLint tmp; - - if (yagl_gles1_context_get_integerv(ctx, pname, &tmp)) { - params[0] = ((tmp != 0) ? GL_TRUE : GL_FALSE); - return true; - } - } - - return false; -} - -static bool yagl_gles1_context_get_floatv(struct yagl_gles_context *ctx, - GLenum pname, - GLfloat *params) -{ - if (pname == GL_COMPRESSED_TEXTURE_FORMATS) { - GLint tmp[YAGL_GLES1_NUM_COMP_TEX_FORMATS]; - int i; - - if (yagl_gles1_context_get_integerv(ctx, pname, &tmp[0])) { - for (i = 0; i < YAGL_GLES1_NUM_COMP_TEX_FORMATS; ++i) { - params[i] = (GLfloat)tmp[i]; - } - return true; - } - } else { - GLint tmp; - - if (yagl_gles1_context_get_integerv(ctx, pname, &tmp)) { - params[0] = (GLfloat)tmp; - return true; - } - } - - return false; -} - -static bool yagl_gles1_context_is_enabled(struct yagl_gles_context *ctx, - GLboolean* retval, - GLenum cap) -{ - if (cap == GL_POINT_SIZE_ARRAY_OES) { - *retval = ctx->arrays[YAGL_GLES1_ARRAY_POINTSIZE].enabled; - return true; - } - - return false; -} - -static GLchar *yagl_gles1_context_get_extensions(struct yagl_gles_context *ctx) -{ - YaglGles1Context *gles1_ctx = (YaglGles1Context *)ctx; - - const GLchar *default_ext = - "GL_OES_blend_subtract GL_OES_blend_equation_separate " - "GL_OES_blend_func_separate GL_OES_element_index_uint " - "GL_OES_texture_mirrored_repeat " - "GL_EXT_texture_format_BGRA8888 GL_OES_point_sprite " - "GL_OES_point_size_array GL_OES_stencil_wrap " - "GL_OES_compressed_paletted_texture " - "GL_OES_depth_texture "; - const GLchar *framebuffer_object_ext = - "GL_OES_framebuffer_object GL_OES_depth24 GL_OES_depth32 " - "GL_OES_rgb8_rgba8 GL_OES_stencil1 GL_OES_stencil4 " - "GL_OES_stencil8 GL_OES_EGL_image "; - const GLchar *pack_depth_stencil = "GL_OES_packed_depth_stencil "; - const GLchar *texture_npot = "GL_OES_texture_npot "; - const GLchar *texture_filter_anisotropic = "GL_EXT_texture_filter_anisotropic "; - const GLchar *matrix_palette = "GL_OES_matrix_palette "; - - size_t len = strlen(default_ext); - GLchar *str; - - if (gles1_ctx->base.texture_npot) { - len += strlen(texture_npot); - } - - if (gles1_ctx->base.texture_filter_anisotropic) { - len += strlen(texture_filter_anisotropic); - } - - if (gles1_ctx->framebuffer_object) { - len += strlen(framebuffer_object_ext); - - if (gles1_ctx->base.pack_depth_stencil) { - len += strlen(pack_depth_stencil); - } - } - - if (gles1_ctx->matrix_palette) { - len += strlen(matrix_palette); - } - - str = g_malloc0(len + 1); - - g_strlcpy(str, default_ext, len + 1); - - if (gles1_ctx->base.texture_npot) { - g_strlcat(str, texture_npot, len + 1); - } - - if (gles1_ctx->base.texture_filter_anisotropic) { - g_strlcat(str, texture_filter_anisotropic, len + 1); - } - - if (gles1_ctx->framebuffer_object) { - g_strlcat(str, framebuffer_object_ext, len + 1); - - if (gles1_ctx->base.pack_depth_stencil) { - g_strlcat(str, pack_depth_stencil, len + 1); - } - } - - if (gles1_ctx->matrix_palette) { - g_strlcat(str, matrix_palette, len + 1); - } - - return str; -} - -static void yagl_gles1_draw_arrays_psize(struct yagl_gles_context *ctx, - GLint first, - GLsizei count) -{ - struct yagl_gles1_driver *gles1_driver = ((YaglGles1Context *)ctx)->driver; - struct yagl_gles_array *parray = &ctx->arrays[YAGL_GLES1_ARRAY_POINTSIZE]; - unsigned i = 0; - const unsigned stride = parray->stride; - GLsizei points_cnt; - GLint arr_offset; - void *next_psize_p; - GLfloat cur_psize; - - if (parray->vbo) { - next_psize_p = parray->vbo->data + parray->offset + first * stride; - } else { - next_psize_p = parray->host_data + first * stride; - } - - while (i < count) { - points_cnt = 0; - arr_offset = i; - cur_psize = *((GLfloat *)next_psize_p); - - do { - ++points_cnt; - ++i; - next_psize_p += stride; - } while (i < count && cur_psize == *((GLfloat *)next_psize_p)); - - gles1_driver->PointSize(cur_psize); - - ctx->driver->DrawArrays(GL_POINTS, first + arr_offset, points_cnt); - } -} - -static inline void *yagl_get_next_psize_p(struct yagl_gles_buffer *ebo, - struct yagl_gles_array *parray, - GLenum type, - unsigned idx, - const GLvoid *indices) -{ - unsigned idx_val; - - if (ebo) { - if (type == GL_UNSIGNED_SHORT) { - idx_val = ((uint16_t *)(ebo->data + (uintptr_t)indices))[idx]; - } else { - idx_val = ((uint8_t *)(ebo->data + (uintptr_t)indices))[idx]; - } - } else { - if (type == GL_UNSIGNED_SHORT) { - idx_val = ((uint16_t *)indices)[idx]; - } else { - idx_val = ((uint8_t *)indices)[idx]; - } - } - - if (parray->vbo) { - return parray->vbo->data + parray->offset + idx_val * parray->stride; - } else { - return parray->host_data + idx_val * parray->stride; - } -} - -static void yagl_gles1_draw_elem_psize(struct yagl_gles_context *ctx, - GLsizei count, - GLenum type, - const GLvoid *indices) -{ - struct yagl_gles1_driver *gles1_driver = ((YaglGles1Context *)ctx)->driver; - struct yagl_gles_array *parray = &ctx->arrays[YAGL_GLES1_ARRAY_POINTSIZE]; - unsigned i = 0, el_size; - GLsizei points_cnt; - GLint arr_offset; - GLfloat cur_psize; - void *next_psize_p; - - switch (type) { - case GL_UNSIGNED_BYTE: - el_size = 1; - break; - case GL_UNSIGNED_SHORT: - el_size = 2; - break; - default: - el_size = 0; - break; - } - - assert(el_size > 0); - - next_psize_p = yagl_get_next_psize_p(ctx->ebo, parray, type, i, indices); - - while (i < count) { - points_cnt = 0; - arr_offset = i; - cur_psize = *((GLfloat *)next_psize_p); - - do { - ++points_cnt; - ++i; - next_psize_p = yagl_get_next_psize_p(ctx->ebo, - parray, - type, - i, - indices); - } while (i < count && cur_psize == *((GLfloat *)next_psize_p)); - - gles1_driver->PointSize(cur_psize); - - ctx->driver->DrawElements(GL_POINTS, - points_cnt, - type, - indices + arr_offset * el_size); - } -} - -static void yagl_gles1_context_draw_arrays(struct yagl_gles_context *ctx, - GLenum mode, - GLint first, - GLsizei count) -{ - if (!ctx->arrays[YAGL_GLES1_ARRAY_VERTEX].enabled) { - return; - } - - if (mode == GL_POINTS && ctx->arrays[YAGL_GLES1_ARRAY_POINTSIZE].enabled) { - yagl_gles1_draw_arrays_psize(ctx, first, count); - } else { - ctx->driver->DrawArrays(mode, first, count); - } -} - -static void yagl_gles1_context_draw_elements(struct yagl_gles_context *ctx, - GLenum mode, - GLsizei count, - GLenum type, - const GLvoid *indices) -{ - if (!ctx->arrays[YAGL_GLES1_ARRAY_VERTEX].enabled) { - return; - } - - if (mode == GL_POINTS && ctx->arrays[YAGL_GLES1_ARRAY_POINTSIZE].enabled) { - yagl_gles1_draw_elem_psize(ctx, count, type, indices); - } else { - ctx->driver->DrawElements(mode, count, type, indices); - } -} - -typedef struct YaglGles1PalFmtDesc { - GLenum uncomp_format; - GLenum pixel_type; - unsigned pixel_size; - unsigned bits_per_index; -} YaglGles1PalFmtDesc; - -static inline int yagl_log2(int val) -{ - int ret = 0; - - if (val > 0) { - while (val >>= 1) { - ret++; - } - } - - return ret; -} - -static inline bool yagl_gles1_tex_dims_valid(GLsizei width, - GLsizei height, - int max_size) -{ - if (width < 0 || height < 0 || width > max_size || height > max_size || - (width & (width - 1)) || (height & (height - 1))) { - return false; - } - - return true; -} - -static void yagl_gles1_cpal_format_get_descr(GLenum format, - YaglGles1PalFmtDesc *desc) -{ - assert(format >= GL_PALETTE4_RGB8_OES && format <= GL_PALETTE8_RGB5_A1_OES); - - switch (format) { - case GL_PALETTE4_RGB8_OES: - desc->uncomp_format = GL_RGB; - desc->bits_per_index = 4; - desc->pixel_type = GL_UNSIGNED_BYTE; - desc->pixel_size = 3; - break; - case GL_PALETTE4_RGBA8_OES: - desc->uncomp_format = GL_RGBA; - desc->bits_per_index = 4; - desc->pixel_type = GL_UNSIGNED_BYTE; - desc->pixel_size = 4; - break; - case GL_PALETTE4_R5_G6_B5_OES: - desc->uncomp_format = GL_RGB; - desc->bits_per_index = 4; - desc->pixel_type = GL_UNSIGNED_SHORT_5_6_5; - desc->pixel_size = 2; - break; - case GL_PALETTE4_RGBA4_OES: - desc->uncomp_format = GL_RGBA; - desc->bits_per_index = 4; - desc->pixel_type = GL_UNSIGNED_SHORT_4_4_4_4; - desc->pixel_size = 2; - break; - case GL_PALETTE4_RGB5_A1_OES: - desc->uncomp_format = GL_RGBA; - desc->bits_per_index = 4; - desc->pixel_type = GL_UNSIGNED_SHORT_5_5_5_1; - desc->pixel_size = 2; - break; - case GL_PALETTE8_RGB8_OES: - desc->uncomp_format = GL_RGB; - desc->bits_per_index = 8; - desc->pixel_type = GL_UNSIGNED_BYTE; - desc->pixel_size = 3; - break; - case GL_PALETTE8_RGBA8_OES: - desc->uncomp_format = GL_RGBA; - desc->bits_per_index = 8; - desc->pixel_type = GL_UNSIGNED_BYTE; - desc->pixel_size = 4; - break; - case GL_PALETTE8_R5_G6_B5_OES: - desc->uncomp_format = GL_RGB; - desc->bits_per_index = 8; - desc->pixel_type = GL_UNSIGNED_SHORT_5_6_5; - desc->pixel_size = 2; - break; - case GL_PALETTE8_RGBA4_OES: - desc->uncomp_format = GL_RGBA; - desc->bits_per_index = 8; - desc->pixel_type = GL_UNSIGNED_SHORT_4_4_4_4; - desc->pixel_size = 2; - break; - case GL_PALETTE8_RGB5_A1_OES: - desc->uncomp_format = GL_RGBA; - desc->bits_per_index = 8; - desc->pixel_type = GL_UNSIGNED_SHORT_5_5_5_1; - desc->pixel_size = 2; - break; - } -} - -static GLsizei yagl_gles1_cpal_tex_size(YaglGles1PalFmtDesc *fmt_desc, - unsigned width, - unsigned height, - unsigned max_level) -{ - GLsizei size; - - /* Palette table size */ - size = (1 << fmt_desc->bits_per_index) * fmt_desc->pixel_size; - - /* Texture palette indices array size for each miplevel */ - do { - if (fmt_desc->bits_per_index == 4) { - size += (width * height + 1) / 2; - } else { - size += width * height; - } - - width >>= 1; - if (width == 0) { - width = 1; - } - - height >>= 1; - if (height == 0) { - height = 1; - } - } while (max_level--); - - return size; -} - -static void yagl_gles1_cpal_tex_uncomp_and_apply(struct yagl_gles_context *ctx, - YaglGles1PalFmtDesc *fmt_desc, - unsigned max_level, - unsigned width, - unsigned height, - const GLvoid *data) -{ - uint8_t *tex_img_data = NULL; - uint8_t *img; - const uint8_t *indices; - unsigned cur_level, i; - unsigned num_of_texels = width * height; - GLint saved_alignment; - - if (!data) { - for (cur_level = 0; cur_level <= max_level; ++cur_level) { - ctx->driver->TexImage2D(GL_TEXTURE_2D, - cur_level, - fmt_desc->uncomp_format, - width, height, - 0, - fmt_desc->uncomp_format, - fmt_desc->pixel_type, - NULL); - width >>= 1; - height >>= 1; - - if (width == 0) { - width = 1; - } - - if (height == 0) { - height = 1; - } - } - - return; - } - - /* Jump over palette data to first image data */ - indices = data + (1 << fmt_desc->bits_per_index) * fmt_desc->pixel_size; - - /* 0 level image is the largest */ - tex_img_data = g_malloc(num_of_texels * fmt_desc->pixel_size); - - /* We will pass tightly packed data to glTexImage2D */ - ctx->driver->GetIntegerv(GL_UNPACK_ALIGNMENT, &saved_alignment); - - if (saved_alignment != 1) { - ctx->driver->PixelStorei(GL_UNPACK_ALIGNMENT, 1); - } - - for (cur_level = 0; cur_level <= max_level; ++cur_level) { - img = tex_img_data; - - if (fmt_desc->bits_per_index == 4) { - unsigned cur_idx; - - for (i = 0; i < num_of_texels; ++i) { - if ((i % 2) == 0) { - cur_idx = indices[i / 2] >> 4; - } else { - cur_idx = indices[i / 2] & 0xf; - } - - memcpy(img, - data + cur_idx * fmt_desc->pixel_size, - fmt_desc->pixel_size); - - img += fmt_desc->pixel_size; - } - - indices += (num_of_texels + 1) / 2; - } else { - for (i = 0; i < num_of_texels; ++i) { - memcpy(img, - data + indices[i] * fmt_desc->pixel_size, - fmt_desc->pixel_size); - img += fmt_desc->pixel_size; - } - - indices += num_of_texels; - } - - ctx->driver->TexImage2D(GL_TEXTURE_2D, - cur_level, - fmt_desc->uncomp_format, - width, height, - 0, - fmt_desc->uncomp_format, - fmt_desc->pixel_type, - tex_img_data); - - width >>= 1; - if (width == 0) { - width = 1; - } - - height >>= 1; - if (height == 0) { - height = 1; - } - - num_of_texels = width * height; - } - - g_free(tex_img_data); - - if (saved_alignment != 1) { - ctx->driver->PixelStorei(GL_UNPACK_ALIGNMENT, saved_alignment); - } -} - -static GLenum yagl_gles1_compressed_tex_image(struct yagl_gles_context *ctx, - GLenum target, - GLint level, - GLenum internalformat, - GLsizei width, - GLsizei height, - GLint border, - GLsizei imageSize, - const GLvoid *data) -{ - const int max_tex_size = ((YaglGles1Context *)ctx)->max_tex_size; - YaglGles1PalFmtDesc fmt_desc; - - if (target != GL_TEXTURE_2D) { - return GL_INVALID_ENUM; - } - - switch (internalformat) { - case GL_PALETTE4_RGB8_OES ... GL_PALETTE8_RGB5_A1_OES: - yagl_gles1_cpal_format_get_descr(internalformat, &fmt_desc); - - if ((level > 0) || (-level > yagl_log2(max_tex_size)) || - !yagl_gles1_tex_dims_valid(width, height, max_tex_size) || - border != 0 || (imageSize != - yagl_gles1_cpal_tex_size(&fmt_desc, width, height, -level))) { - return GL_INVALID_VALUE; - } - - yagl_gles1_cpal_tex_uncomp_and_apply(ctx, - &fmt_desc, - -level, - width, - height, - data); - break; - default: - return GL_INVALID_ENUM; - } - - return GL_NO_ERROR; -} - -YaglGles1Context *yagl_gles1_context_create(struct yagl_sharegroup *sg, - struct yagl_gles1_driver *driver) -{ - YaglGles1Context *gles1_ctx; - - YAGL_LOG_FUNC_ENTER(driver_ps->common->ps->id, - 0, - yagl_gles1_context_create, - NULL); - - gles1_ctx = g_new0(YaglGles1Context, 1); - - yagl_client_context_init(&gles1_ctx->base.base, yagl_client_api_gles1, sg); - - gles1_ctx->base.base.activate = &yagl_gles1_context_activate; - gles1_ctx->base.base.deactivate = &yagl_gles1_context_deactivate; - gles1_ctx->base.base.destroy = &yagl_gles1_context_destroy; - - yagl_gles_context_init(&gles1_ctx->base, &driver->base); - - gles1_ctx->base.get_param_count = &yagl_gles1_context_get_param_count; - gles1_ctx->base.get_booleanv = &yagl_gles1_context_get_booleanv; - gles1_ctx->base.get_integerv = &yagl_gles1_context_get_integerv; - gles1_ctx->base.get_floatv = &yagl_gles1_context_get_floatv; - gles1_ctx->base.get_extensions = &yagl_gles1_context_get_extensions; - gles1_ctx->base.draw_arrays = &yagl_gles1_context_draw_arrays; - gles1_ctx->base.draw_elements = &yagl_gles1_context_draw_elements; - gles1_ctx->base.compressed_tex_image = &yagl_gles1_compressed_tex_image; - gles1_ctx->base.is_enabled = &yagl_gles1_context_is_enabled; - - gles1_ctx->driver = driver; - gles1_ctx->prepared = false; - gles1_ctx->sg = sg; - - gles1_ctx->client_active_texture = 0; - gles1_ctx->max_clip_planes = 0; - gles1_ctx->max_lights = 0; - - YAGL_LOG_FUNC_EXIT("%p", gles1_ctx); - - return gles1_ctx; -} diff --git a/hw/yagl_apis/gles1/yagl_gles1_context.h b/hw/yagl_apis/gles1/yagl_gles1_context.h deleted file mode 100644 index 678e25e..0000000 --- a/hw/yagl_apis/gles1/yagl_gles1_context.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef YAGL_GLES1_CONTEXT_H_ -#define YAGL_GLES1_CONTEXT_H_ - -#include -#include "yagl_apis/gles/yagl_gles_context.h" - -struct yagl_gles1_driver; -struct yagl_sharegroup; - -/* GLES1 has arrays of vertices, normals, colors, texture coordinates and - * point sizes. Every texture unit has its own texture coordinates array */ -typedef enum { - YAGL_GLES1_ARRAY_VERTEX = 0, - YAGL_GLES1_ARRAY_COLOR, - YAGL_GLES1_ARRAY_NORMAL, - YAGL_GLES1_ARRAY_POINTSIZE, - YAGL_GLES1_ARRAY_TEX_COORD, -} YaglGles1ArrayType; - -typedef struct YaglGles1Context -{ - struct yagl_gles_context base; - - struct yagl_gles1_driver *driver; - - bool prepared; - - int client_active_texture; - - /* - * From 'base.base.sg' for speed. - */ - struct yagl_sharegroup *sg; - - /* GL_OES_framebuffer_object */ - bool framebuffer_object; - - /* GL_OES_matrix_palette */ - bool matrix_palette; - - int max_clip_planes; - - int max_lights; - - int max_tex_size; - -} YaglGles1Context; - -YaglGles1Context *yagl_gles1_context_create(struct yagl_sharegroup *sg, - struct yagl_gles1_driver *driver); - - -#endif /* YAGL_GLES1_CONTEXT_H_ */ diff --git a/hw/yagl_apis/gles1/yagl_host_gles1_calls.c b/hw/yagl_apis/gles1/yagl_host_gles1_calls.c deleted file mode 100644 index 604b525..0000000 --- a/hw/yagl_apis/gles1/yagl_host_gles1_calls.c +++ /dev/null @@ -1,1787 +0,0 @@ -#include "yagl_host_gles1_calls.h" -#include "yagl_apis/gles/yagl_gles_array.h" -#include "yagl_apis/gles/yagl_gles_framebuffer.h" -#include "yagl_apis/gles/yagl_gles_renderbuffer.h" -#include "yagl_apis/gles/yagl_gles_texture.h" -#include "yagl_apis/gles/yagl_gles_texture_unit.h" -#include "yagl_apis/gles/yagl_gles_image.h" -#include "yagl_gles1_calls.h" -#include "yagl_gles1_api.h" -#include "yagl_gles1_driver.h" -#include "yagl_gles1_api_ps.h" -#include "yagl_gles1_api_ts.h" -#include "yagl_gles1_context.h" -#include "yagl_egl_interface.h" -#include "yagl_process.h" -#include "yagl_thread.h" -#include "yagl_tls.h" -#include "yagl_log.h" -#include "yagl_client_interface.h" -#include "yagl_sharegroup.h" - -#define YAGL_TEX_ENV_PARAM_MAX_LEN 4 -#define YAGL_POINT_PARAM_MAX_LEN 3 -#define YAGL_FOG_PARAM_MAX_LEN 4 -#define YAGL_LIGHT_PARAM_MAX_LEN 4 -#define YAGL_LIGHT_MODEL_PARAM_MAX_LEN 4 -#define YAGL_MATERIAL_PARAM_MAX_LEN 4 - -#define YAGL_SET_ERR(err) \ - yagl_gles_context_set_error(&ctx->base, err); \ - YAGL_LOG_ERROR("error = 0x%X", err) - -static YAGL_DEFINE_TLS(YaglGles1ApiTs *, gles1_api_ts); - -#define YAGL_GET_CTX_IMPL(func, ret_expr) \ - YaglGles1Context *ctx = \ - (YaglGles1Context *)cur_ts->ps->egl_iface->get_ctx(cur_ts->ps->egl_iface); \ - YAGL_LOG_FUNC_SET(func); \ - if (!ctx || \ - (ctx->base.base.client_api != yagl_client_api_gles1)) { \ - YAGL_LOG_WARN("no current context"); \ - ret_expr; \ - } - -#define YAGL_GET_CTX_RET(func, ret) YAGL_GET_CTX_IMPL(func, return ret) - -#define YAGL_GET_CTX(func) YAGL_GET_CTX_IMPL(func, return) - -static bool yagl_gles1_get_float(struct yagl_gles_context *ctx, - GLenum pname, - GLfloat *param) -{ - switch (pname) { - case GL_ACTIVE_TEXTURE: - *param = GL_TEXTURE0 + ctx->active_texture_unit; - break; - case GL_TEXTURE_BINDING_2D: - *param = yagl_gles_context_get_active_texture_target_state(ctx, - yagl_gles_texture_target_2d)->texture_local_name; - break; - case GL_ARRAY_BUFFER_BINDING: - *param = ctx->vbo_local_name; - break; - case GL_ELEMENT_ARRAY_BUFFER_BINDING: - *param = ctx->ebo_local_name; - break; - default: - return false; - } - - return true; -} - -static struct yagl_client_context - *yagl_host_gles1_create_ctx(struct yagl_client_interface *iface, - struct yagl_sharegroup *sg) -{ - YaglGles1Context *ctx = - yagl_gles1_context_create(sg, gles1_api_ts->driver); - - if (!ctx) { - return NULL; - } - - return &ctx->base.base; -} - -static void yagl_host_gles1_thread_init(struct yagl_api_ps *api_ps) -{ - YaglGles1ApiPs *gles1_api_ps = (YaglGles1ApiPs *)api_ps; - - YAGL_LOG_FUNC_ENTER(yagl_host_gles1_thread_init, NULL); - - gles1_api_ts = g_malloc0(sizeof(*gles1_api_ts)); - - yagl_gles1_api_ts_init(gles1_api_ts, gles1_api_ps->driver); - - YAGL_LOG_FUNC_EXIT(NULL); -} - -static void yagl_host_gles1_thread_fini(struct yagl_api_ps *api_ps) -{ - YAGL_LOG_FUNC_ENTER(yagl_host_gles1_thread_fini, NULL); - - yagl_gles1_api_ts_cleanup(gles1_api_ts); - - g_free(gles1_api_ts); - - gles1_api_ts = NULL; - - YAGL_LOG_FUNC_EXIT(NULL); -} - -static yagl_api_func yagl_host_gles1_get_func(struct yagl_api_ps *api_ps, - uint32_t func_id) -{ - if ((func_id <= 0) || (func_id > yagl_gles1_api_num_funcs)) { - return NULL; - } else { - return yagl_gles1_api_funcs[func_id - 1]; - } -} - -static void yagl_host_gles1_process_fini(struct yagl_api_ps *api_ps) -{ - YaglGles1ApiPs *gles1_api_ps = (YaglGles1ApiPs *)api_ps; - - yagl_gles1_api_ps_fini(gles1_api_ps); -} - -static void yagl_host_gles1_process_destroy(struct yagl_api_ps *api_ps) -{ - YaglGles1ApiPs *gles1_api_ps = (YaglGles1ApiPs *)api_ps; - - YAGL_LOG_FUNC_ENTER(yagl_host_gles1_process_destroy, NULL); - - yagl_gles1_api_ps_cleanup(gles1_api_ps); - yagl_api_ps_cleanup(&gles1_api_ps->base); - - g_free(gles1_api_ps); - - YAGL_LOG_FUNC_EXIT(NULL); -} - -static struct yagl_client_image - *yagl_host_gles1_create_image(struct yagl_client_interface *iface, - yagl_object_name tex_global_name, - struct yagl_ref *tex_data) -{ - struct yagl_gles_image *image = - yagl_gles_image_create_from_texture(&gles1_api_ts->driver->base, - tex_global_name, - tex_data); - - return image ? &image->base : NULL; -} - -struct yagl_api_ps *yagl_host_gles1_process_init(struct yagl_api *api) -{ - YaglGles1API *gles1_api = (YaglGles1API *)api; - YaglGles1ApiPs *gles1_api_ps; - struct yagl_client_interface *client_iface; - - YAGL_LOG_FUNC_ENTER(yagl_host_gles1_process_init, NULL); - - client_iface = g_new0(struct yagl_client_interface, 1); - - yagl_client_interface_init(client_iface); - - client_iface->create_ctx = &yagl_host_gles1_create_ctx; - client_iface->create_image = &yagl_host_gles1_create_image; - - gles1_api_ps = g_new0(YaglGles1ApiPs, 1); - - yagl_api_ps_init(&gles1_api_ps->base, api); - - gles1_api_ps->base.thread_init = &yagl_host_gles1_thread_init; - gles1_api_ps->base.get_func = &yagl_host_gles1_get_func; - gles1_api_ps->base.thread_fini = &yagl_host_gles1_thread_fini; - gles1_api_ps->base.fini = &yagl_host_gles1_process_fini; - gles1_api_ps->base.destroy = &yagl_host_gles1_process_destroy; - - yagl_gles1_api_ps_init(gles1_api_ps, gles1_api->driver, client_iface); - - YAGL_LOG_FUNC_EXIT(NULL); - - return &gles1_api_ps->base; -} - -static inline bool yagl_gles1_array_idx_get(YaglGles1Context *ctx, - GLenum array, - unsigned *arr_idx_p) -{ - switch (array) { - case GL_VERTEX_ARRAY: - case GL_VERTEX_ARRAY_POINTER: - *arr_idx_p = YAGL_GLES1_ARRAY_VERTEX; - break; - case GL_COLOR_ARRAY: - case GL_COLOR_ARRAY_POINTER: - *arr_idx_p = YAGL_GLES1_ARRAY_COLOR; - break; - case GL_NORMAL_ARRAY: - case GL_NORMAL_ARRAY_POINTER: - *arr_idx_p = YAGL_GLES1_ARRAY_NORMAL; - break; - case GL_TEXTURE_COORD_ARRAY: - case GL_TEXTURE_COORD_ARRAY_POINTER: - *arr_idx_p = YAGL_GLES1_ARRAY_TEX_COORD + ctx->client_active_texture; - break; - case GL_POINT_SIZE_ARRAY_OES: - case GL_POINT_SIZE_ARRAY_POINTER_OES: - *arr_idx_p = YAGL_GLES1_ARRAY_POINTSIZE; - break; - default: - return false; - } - - return true; -} - -static inline bool yagl_gles1_light_param_len(GLenum pname, int32_t *len) -{ - switch (pname) { - case GL_AMBIENT: - case GL_DIFFUSE: - case GL_SPECULAR: - case GL_POSITION: - *len = 4; - break; - case GL_SPOT_DIRECTION: - *len = 3; - break; - case GL_SPOT_EXPONENT: - case GL_SPOT_CUTOFF: - case GL_CONSTANT_ATTENUATION: - case GL_LINEAR_ATTENUATION: - case GL_QUADRATIC_ATTENUATION: - *len = 1; - break; - default: - return false; - } - - return true; -} - -static inline bool yagl_gles1_material_param_len(GLenum pname, int32_t *len) -{ - switch (pname) { - case GL_AMBIENT: - case GL_DIFFUSE: - case GL_SPECULAR: - case GL_EMISSION: - case GL_AMBIENT_AND_DIFFUSE: - *len = 4; - break; - case GL_SHININESS: - *len = 1; - break; - default: - return false; - } - - return true; -} - -void yagl_host_glAlphaFunc(GLenum func, - GLclampf ref) -{ - YAGL_GET_CTX(glAlphaFunc); - - ctx->driver->AlphaFunc(func, ref); -} - -void yagl_host_glClipPlanef(GLenum plane, - const GLfloat *equation, int32_t equation_count) -{ - yagl_GLdouble equationd[4]; - unsigned i; - - YAGL_GET_CTX(glClipPlanef); - - if (plane < GL_CLIP_PLANE0 || plane >= (GL_CLIP_PLANE0 + ctx->max_clip_planes)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (equation) { - for (i = 0; i < 4; ++i) { - equationd[i] = (yagl_GLdouble)equation[i]; - } - - ctx->driver->ClipPlane(plane, equationd); - } else { - ctx->driver->ClipPlane(plane, NULL); - } -} - -void yagl_host_glColor4f(GLfloat red, - GLfloat green, - GLfloat blue, - GLfloat alpha) -{ - YAGL_GET_CTX(glColor4f); - - ctx->driver->Color4f(red, green, blue, alpha); -} - -void yagl_host_glFogf(GLenum pname, - GLfloat param) -{ - YAGL_GET_CTX(glFogf); - - if (pname != GL_FOG_MODE && pname != GL_FOG_DENSITY && - pname != GL_FOG_START && pname != GL_FOG_END) { - YAGL_SET_ERR(GL_INVALID_ENUM); - } else { - ctx->driver->Fogf(pname, param); - } -} - -void yagl_host_glFogfv(GLenum pname, - const GLfloat *params, int32_t params_count) -{ - YAGL_GET_CTX(glFogfv); - - if (pname != GL_FOG_MODE && pname != GL_FOG_DENSITY && - pname != GL_FOG_START && pname != GL_FOG_END && - pname != GL_FOG_COLOR) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->Fogfv(pname, params); -} - -void yagl_host_glFrustumf(GLfloat left, - GLfloat right, - GLfloat bottom, - GLfloat top, - GLfloat zNear, - GLfloat zFar) -{ - YAGL_GET_CTX(glFrustumf); - - if (zNear <= 0 || zFar <= 0 || left == right || - bottom == top || zNear == zFar) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } else { - ctx->driver->Frustum(left, right, bottom, top, zNear, zFar); - } -} - -void yagl_host_glGetClipPlanef(GLenum pname, - GLfloat *eqn, int32_t eqn_maxcount, int32_t *eqn_count) -{ - yagl_GLdouble equationd[4]; - unsigned i; - - YAGL_GET_CTX(glGetClipPlanef); - - if (pname < GL_CLIP_PLANE0 || pname >= (GL_CLIP_PLANE0 + ctx->max_clip_planes)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->GetClipPlane(pname, equationd); - - if (eqn) { - for (i = 0; i < 4; ++i) { - eqn[i] = (GLfloat)equationd[i]; - } - *eqn_count = 4; - } -} - -void yagl_host_glGetLightfv(GLenum light, - GLenum pname, - GLfloat *params, int32_t params_maxcount, int32_t *params_count) -{ - YAGL_GET_CTX(glGetLightfv); - - if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights) || - !yagl_gles1_light_param_len(pname, params_count)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->GetLightfv(light, pname, params); -} - -void yagl_host_glGetMaterialfv(GLenum face, - GLenum pname, - GLfloat *params, int32_t params_maxcount, int32_t *params_count) -{ - YAGL_GET_CTX(glGetMaterialfv); - - if (!yagl_gles1_material_param_len(pname, params_count)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->GetMaterialfv(face, pname, params); -} - -void yagl_host_glLightModelf(GLenum pname, - GLfloat param) -{ - YAGL_GET_CTX(glLightModelf); - - if (pname != GL_LIGHT_MODEL_TWO_SIDE) { - YAGL_SET_ERR(GL_INVALID_ENUM); - } else { - ctx->driver->LightModelf(pname, param); - } -} - -void yagl_host_glLightModelfv(GLenum pname, - const GLfloat *params, int32_t params_count) -{ - YAGL_GET_CTX(glLightModelfv); - - if (pname != GL_LIGHT_MODEL_TWO_SIDE && pname != GL_LIGHT_MODEL_AMBIENT) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->LightModelfv(pname, params); -} - -void yagl_host_glLightf(GLenum light, - GLenum pname, - GLfloat param) -{ - YAGL_GET_CTX(glLightf); - - if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - } else { - ctx->driver->Lightf(light, pname, param); - } -} - -void yagl_host_glLightfv(GLenum light, - GLenum pname, - const GLfloat *params, int32_t params_count) -{ - int32_t tmp; - - YAGL_GET_CTX(glLightfv); - - if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights) || - !yagl_gles1_light_param_len(pname, &tmp)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->Lightfv(light, pname, params); -} - -void yagl_host_glLoadMatrixf(const GLfloat *m, int32_t m_count) -{ - YAGL_GET_CTX(glLoadMatrixf); - - ctx->driver->LoadMatrixf(m); -} - -void yagl_host_glMaterialf(GLenum face, - GLenum pname, - GLfloat param) -{ - YAGL_GET_CTX(glMaterialf); - - if (face != GL_FRONT_AND_BACK) { - YAGL_SET_ERR(GL_INVALID_ENUM); - } else { - ctx->driver->Materialf(face, pname, param); - } -} - -void yagl_host_glMaterialfv(GLenum face, - GLenum pname, - const GLfloat *params, int32_t params_count) -{ - int32_t tmp; - - YAGL_GET_CTX(glMaterialfv); - - if (face != GL_FRONT_AND_BACK || - !yagl_gles1_material_param_len(pname, &tmp)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->Materialfv(face, pname, params); -} - -void yagl_host_glMultMatrixf(const GLfloat *m, int32_t m_count) -{ - YAGL_GET_CTX(glMultMatrixf); - - ctx->driver->MultMatrixf(m); -} - -void yagl_host_glMultiTexCoord4f(GLenum target, - GLfloat s, - GLfloat tt, - GLfloat r, - GLfloat q) -{ - YAGL_GET_CTX(glMultiTexCoord4f); - - if (target >= GL_TEXTURE0 && - target < (GL_TEXTURE0 + ctx->base.num_texture_units)) { - ctx->driver->MultiTexCoord4f(target, s, tt, r, q); - } -} - -void yagl_host_glNormal3f(GLfloat nx, - GLfloat ny, - GLfloat nz) -{ - YAGL_GET_CTX(glNormal3f); - - ctx->driver->Normal3f(nx, ny, nz); -} - -void yagl_host_glOrthof(GLfloat left, - GLfloat right, - GLfloat bottom, - GLfloat top, - GLfloat zNear, - GLfloat zFar) -{ - YAGL_GET_CTX(glOrthof); - - if (left == right || bottom == top || zNear == zFar) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } else { - ctx->driver->Ortho(left, right, bottom, top, zNear, zFar); - } -} - -void yagl_host_glPointParameterf(GLenum pname, - GLfloat param) -{ - YAGL_GET_CTX(glPointParameterf); - - if (pname != GL_POINT_SIZE_MIN && pname != GL_POINT_SIZE_MIN && - pname != GL_POINT_SIZE_MAX && pname != GL_POINT_FADE_THRESHOLD_SIZE) { - YAGL_SET_ERR(GL_INVALID_ENUM); - } else { - ctx->driver->PointParameterf(pname, param); - } -} - -void yagl_host_glPointParameterfv(GLenum pname, - const GLfloat *params, int32_t params_count) -{ - YAGL_GET_CTX(glPointParameterfv); - - if (pname != GL_POINT_SIZE_MIN && pname != GL_POINT_SIZE_MIN && - pname != GL_POINT_SIZE_MAX && pname != GL_POINT_FADE_THRESHOLD_SIZE && - pname != GL_POINT_DISTANCE_ATTENUATION) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->PointParameterfv(pname, params); -} - -void yagl_host_glPointSize(GLfloat size) -{ - YAGL_GET_CTX(glPointSize); - - if (size <= 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } else { - ctx->driver->PointSize(size); - } -} - -void yagl_host_glRotatef(GLfloat angle, - GLfloat x, - GLfloat y, - GLfloat z) -{ - YAGL_GET_CTX(glRotatef); - - ctx->driver->Rotatef(angle, x, y, z); -} - -void yagl_host_glScalef(GLfloat x, - GLfloat y, - GLfloat z) -{ - YAGL_GET_CTX(glScalef); - - ctx->driver->Scalef(x, y, z); -} - -void yagl_host_glTexEnvf(GLenum target, - GLenum pname, - GLfloat param) -{ - YAGL_GET_CTX(glTexEnvf); - - ctx->driver->TexEnvf(target, pname, param); -} - -void yagl_host_glTexEnvfv(GLenum target, - GLenum pname, - const GLfloat *params, int32_t params_count) -{ - YAGL_GET_CTX(glTexEnvfv); - - ctx->driver->TexEnvfv(target, pname, params); -} - -void yagl_host_glTranslatef(GLfloat x, - GLfloat y, - GLfloat z) -{ - YAGL_GET_CTX(glTranslatef); - - ctx->driver->Translatef(x, y, z); -} - -void yagl_host_glAlphaFuncx(GLenum func, - GLclampx ref) -{ - YAGL_GET_CTX(glAlphaFuncx); - - ctx->driver->AlphaFunc(func, yagl_fixed_to_float(ref)); -} - -void yagl_host_glClearColorx(GLclampx red, - GLclampx green, - GLclampx blue, - GLclampx alpha) -{ - YAGL_GET_CTX(glClearColorx); - - ctx->driver->base.ClearColor(yagl_fixed_to_float(red), - yagl_fixed_to_float(green), - yagl_fixed_to_float(blue), - yagl_fixed_to_float(alpha)); -} - -void yagl_host_glClearDepthx(GLclampx depth) -{ - YAGL_GET_CTX(glClearDepthx); - - ctx->driver->base.ClearDepth(yagl_fixed_to_double(depth)); -} - -void yagl_host_glClientActiveTexture(GLenum texture) -{ - YAGL_GET_CTX(glClientActiveTexture); - - if ((texture < GL_TEXTURE0) || - (texture >= (GL_TEXTURE0 + ctx->base.num_texture_units))) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - ctx->client_active_texture = texture - GL_TEXTURE0; - - ctx->driver->ClientActiveTexture(texture); -} - -void yagl_host_glClipPlanex(GLenum plane, - const GLfixed *equation, int32_t equation_count) -{ - yagl_GLdouble equationd[4]; - unsigned i; - - YAGL_GET_CTX(glClipPlanex); - - if (plane < GL_CLIP_PLANE0 || - plane >= (GL_CLIP_PLANE0 + ctx->max_clip_planes)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (equation) { - for (i = 0; i < 4; ++i) { - equationd[i] = yagl_fixed_to_double(equation[i]); - } - - ctx->driver->ClipPlane(plane, equationd); - } else { - ctx->driver->ClipPlane(plane, NULL); - } -} - -void yagl_host_glColor4ub(GLubyte red, - GLubyte green, - GLubyte blue, - GLubyte alpha) -{ - YAGL_GET_CTX(glColor4ub); - - ctx->driver->Color4ub(red, green, blue, alpha); -} - -void yagl_host_glColor4x(GLfixed red, - GLfixed green, - GLfixed blue, - GLfixed alpha) -{ - YAGL_GET_CTX(glColor4x); - - ctx->driver->Color4f(yagl_fixed_to_float(red), - yagl_fixed_to_float(green), - yagl_fixed_to_float(blue), - yagl_fixed_to_float(alpha)); -} - -void yagl_host_glColorPointer(GLint size, - GLenum type, - GLsizei stride, - target_ulong pointer) -{ - struct yagl_gles_array *carray; - - YAGL_GET_CTX(glColorPointer); - - if (size != 4 || stride < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } - - if (type != GL_FLOAT && type != GL_FIXED && type != GL_UNSIGNED_BYTE) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - carray = yagl_gles_context_get_array(&ctx->base, YAGL_GLES1_ARRAY_COLOR); - - assert(carray); - - if (ctx->base.vbo) { - if (!yagl_gles_array_update_vbo(carray, - size, - type, - type == GL_FIXED, - GL_FALSE, - stride, - ctx->base.vbo, - ctx->base.vbo_local_name, - pointer)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } - } else { - if (!yagl_gles_array_update(carray, - size, - type, - type == GL_FIXED, - GL_FALSE, - stride, - pointer)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } - } -} - -void yagl_host_glDepthRangex(GLclampx zNear, - GLclampx zFar) -{ - YAGL_GET_CTX(glDepthRangex); - - ctx->driver->base.DepthRange(yagl_fixed_to_double(zNear), - yagl_fixed_to_double(zFar)); -} - -void yagl_host_glDisableClientState(GLenum array_name) -{ - struct yagl_gles_array *array; - unsigned arr_idx; - - YAGL_GET_CTX(glDisableClientState); - - if (!yagl_gles1_array_idx_get(ctx, array_name, &arr_idx)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - array = yagl_gles_context_get_array(&ctx->base, arr_idx); - - assert(array); - - yagl_gles_array_enable(array, false); - - if (array_name != GL_POINT_SIZE_ARRAY_OES) { - ctx->driver->DisableClientState(array_name); - } -} - -void yagl_host_glEnableClientState(GLenum array_name) -{ - struct yagl_gles_array *array; - unsigned arr_idx; - - YAGL_GET_CTX(glEnableClientState); - - if (!yagl_gles1_array_idx_get(ctx, array_name, &arr_idx)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - array = yagl_gles_context_get_array(&ctx->base, arr_idx); - - assert(array); - - yagl_gles_array_enable(array, true); - - if (array_name != GL_POINT_SIZE_ARRAY_OES) { - ctx->driver->EnableClientState(array_name); - } -} - -void yagl_host_glFogx(GLenum pname, - GLfixed param) -{ - YAGL_GET_CTX(glFogx); - - if (pname != GL_FOG_MODE && pname != GL_FOG_DENSITY && - pname != GL_FOG_START && pname != GL_FOG_END) { - YAGL_SET_ERR(GL_INVALID_ENUM); - } else { - if (pname == GL_FOG_MODE) { - ctx->driver->Fogf(pname, (GLfloat)param); - } else { - ctx->driver->Fogf(pname, yagl_fixed_to_float(param)); - } - } -} - -void yagl_host_glFogxv(GLenum pname, - const GLfixed *params, int32_t params_count) -{ - GLfixed paramsx[YAGL_FOG_PARAM_MAX_LEN]; - GLfloat paramsf[YAGL_FOG_PARAM_MAX_LEN]; - int32_t i; - - YAGL_GET_CTX(glFogxv); - - if (pname != GL_FOG_MODE && pname != GL_FOG_DENSITY && - pname != GL_FOG_START && pname != GL_FOG_END && - pname != GL_FOG_COLOR) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (pname == GL_FOG_MODE) { - paramsf[0] = (GLfloat)paramsx[0]; - } else { - for (i = 0; i < params_count; ++i) { - paramsf[i] = yagl_fixed_to_float(paramsx[i]); - } - } - - ctx->driver->Fogfv(pname, paramsf); -} - -void yagl_host_glFrustumx(GLfixed left, - GLfixed right, - GLfixed bottom, - GLfixed top, - GLfixed zNear, - GLfixed zFar) -{ - YAGL_GET_CTX(glFrustumx); - - if (zNear <= 0 || zFar <= 0 ||left == right || - bottom == top || zNear == zFar) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } else { - ctx->driver->Frustum(yagl_fixed_to_double(left), - yagl_fixed_to_double(right), - yagl_fixed_to_double(bottom), - yagl_fixed_to_double(top), - yagl_fixed_to_double(zNear), - yagl_fixed_to_double(zFar)); - } -} - -void yagl_host_glGetClipPlanex(GLenum pname, - GLfixed *eqn, int32_t eqn_maxcount, int32_t *eqn_count) -{ - yagl_GLdouble equationd[4]; - unsigned i; - - YAGL_GET_CTX(glGetClipPlanex); - - if (pname < GL_CLIP_PLANE0 || - pname >= (GL_CLIP_PLANE0 + ctx->max_clip_planes)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->GetClipPlane(pname, equationd); - - if (eqn) { - for (i = 0; i < 4; ++i) { - eqn[i] = yagl_double_to_fixed((GLfloat)equationd[i]); - } - *eqn_count = 4; - } -} - -void yagl_host_glGetFixedv(GLenum pname, - GLfixed *params, int32_t params_maxcount, int32_t *params_count) -{ - GLfloat *tmp; - int32_t i; - - YAGL_GET_CTX(glGetFixedv); - - if (!ctx->base.get_param_count(&ctx->base, pname, params_count)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (!params) { - return; - } - - tmp = yagl_gles_context_malloc0(&ctx->base, *params_count * sizeof(GLfloat)); - - if (!ctx->base.get_floatv(&ctx->base, pname, tmp)) { - if (!yagl_gles1_get_float(&ctx->base, pname, tmp)) { - ctx->driver->base.GetFloatv(pname, tmp); - } - } - - for (i = 0; i < *params_count; ++i) { - params[i] = yagl_float_to_fixed(tmp[i]); - } -} - -void yagl_host_glGetLightxv(GLenum light, - GLenum pname, - GLfixed *params, int32_t params_maxcount, int32_t *params_count) -{ - GLfloat paramsf[YAGL_LIGHT_PARAM_MAX_LEN]; - int32_t i; - - YAGL_GET_CTX(glGetLightxv); - - if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights) || - !yagl_gles1_light_param_len(pname, params_count)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->GetLightfv(light, pname, paramsf); - - if (params) { - for (i = 0; i < *params_count; ++i) { - params[i] = yagl_float_to_fixed(paramsf[i]); - } - } -} - -void yagl_host_glGetMaterialxv(GLenum face, - GLenum pname, - GLfixed *params, int32_t params_maxcount, int32_t *params_count) -{ - GLfloat paramsf[YAGL_MATERIAL_PARAM_MAX_LEN]; - int32_t i; - - YAGL_GET_CTX(glGetMaterialxv); - - if (!yagl_gles1_material_param_len(pname, params_count)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->GetMaterialfv(face, pname, paramsf); - - if (params) { - for (i = 0; i < *params_count; ++i) { - params[i] = yagl_float_to_fixed(paramsf[i]); - } - } -} - -void yagl_host_glGetPointerv(GLenum pname, - target_ulong *params) -{ - struct yagl_gles_array *array; - unsigned arr_idx; - target_ulong pointer = 0; - - YAGL_GET_CTX(glGetPointerv); - - if (!yagl_gles1_array_idx_get(ctx, pname, &arr_idx)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - array = yagl_gles_context_get_array(&ctx->base, arr_idx); - - assert(array); - - if (array->vbo) { - pointer = array->offset; - } else { - pointer = array->target_data; - } - - if (params) { - *params = pointer; - } -} - -void yagl_host_glGetTexEnviv(GLenum env, - GLenum pname, - GLint *params, int32_t params_maxcount, int32_t *params_count) -{ - YAGL_GET_CTX(glGetTexEnviv); - - if (env != GL_TEXTURE_ENV && env != GL_POINT_SPRITE_OES) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (pname == GL_TEXTURE_ENV_COLOR) { - *params_count = YAGL_TEX_ENV_PARAM_MAX_LEN; - } else { - *params_count = 1; - } - - ctx->driver->GetTexEnviv(env, pname, params); -} - -void yagl_host_glGetTexEnvfv(GLenum env, - GLenum pname, - GLfloat *params, int32_t params_maxcount, int32_t *params_count) -{ - YAGL_GET_CTX(glGetTexEnvfv); - - if (env != GL_TEXTURE_ENV && env != GL_POINT_SPRITE_OES) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (pname == GL_TEXTURE_ENV_COLOR) { - *params_count = YAGL_TEX_ENV_PARAM_MAX_LEN; - } else { - *params_count = 1; - } - - ctx->driver->GetTexEnvfv(env, pname, params); -} - -void yagl_host_glGetTexEnvxv(GLenum env, - GLenum pname, - GLfixed *params, int32_t params_maxcount, int32_t *params_count) -{ - GLfloat paramsf[YAGL_TEX_ENV_PARAM_MAX_LEN]; - - YAGL_GET_CTX(glGetTexEnvxv); - - if (env != GL_TEXTURE_ENV && env != GL_POINT_SPRITE_OES) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (pname == GL_TEXTURE_ENV_COLOR) { - *params_count = YAGL_TEX_ENV_PARAM_MAX_LEN; - } else { - *params_count = 1; - } - - ctx->driver->GetTexEnvfv(env, pname, paramsf); - - if (params) { - if (pname == GL_TEXTURE_ENV_COLOR || pname == GL_RGB_SCALE || - pname == GL_ALPHA_SCALE) { - unsigned i; - - for (i = 0; i < *params_count; ++i) { - params[i] = yagl_float_to_fixed(paramsf[i]); - } - } else { - params[0] = (GLfixed)paramsf[0]; - } - } -} - -void yagl_host_glGetTexParameterxv(GLenum target, - GLenum pname, - GLfixed *param) -{ - GLfloat paramf; - - YAGL_GET_CTX(glGetTexParameterxv); - - if (target != GL_TEXTURE_2D) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->base.GetTexParameterfv(target, pname, ¶mf); - - if (param) { - *param = (GLfixed)paramf; - } -} - -void yagl_host_glLightModelx(GLenum pname, - GLfixed param) -{ - YAGL_GET_CTX(glLightModelx); - - if (pname != GL_LIGHT_MODEL_TWO_SIDE) { - YAGL_SET_ERR(GL_INVALID_ENUM); - } else { - ctx->driver->LightModelf(pname, (GLfloat)param); - } -} - -void yagl_host_glLightModelxv(GLenum pname, - const GLfixed *params, int32_t params_count) -{ - GLfloat paramsf[YAGL_LIGHT_MODEL_PARAM_MAX_LEN]; - uint32_t i; - - YAGL_GET_CTX(glLightModelxv); - - if (params) { - if (pname == GL_LIGHT_MODEL_TWO_SIDE) { - paramsf[0] = (GLfloat)params[0]; - } else if (pname == GL_LIGHT_MODEL_AMBIENT) { - for (i = 0; i < YAGL_LIGHT_MODEL_PARAM_MAX_LEN; ++i) { - paramsf[i] = yagl_fixed_to_float(params[i]); - } - } else { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->LightModelfv(pname, paramsf); - } else { - ctx->driver->LightModelfv(pname, NULL); - } -} - -void yagl_host_glLightx(GLenum light, - GLenum pname, - GLfixed param) -{ - YAGL_GET_CTX(glLightx); - - if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - } else { - ctx->driver->Lightf(light, pname, yagl_fixed_to_float(param)); - } -} - -void yagl_host_glLightxv(GLenum light, - GLenum pname, - const GLfixed *params, int32_t params_count) -{ - GLfloat paramsf[YAGL_LIGHT_PARAM_MAX_LEN]; - int32_t tmp, i; - - YAGL_GET_CTX(glLightxv); - - if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights) || - !yagl_gles1_light_param_len(pname, &tmp)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (params) { - for (i = 0; i < params_count; ++i) { - paramsf[i] = yagl_fixed_to_float(params[i]); - } - ctx->driver->Lightfv(light, pname, paramsf); - } else { - ctx->driver->Lightfv(light, pname, NULL); - } -} - -void yagl_host_glLineWidthx(GLfixed width) -{ - GLfloat widthf; - - YAGL_GET_CTX(glLineWidthx); - - widthf = yagl_fixed_to_float(width); - - if (widthf <= 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } - - ctx->driver->base.LineWidth(widthf); -} - -void yagl_host_glLoadIdentity(void) -{ - YAGL_GET_CTX(glLoadIdentity); - - ctx->driver->LoadIdentity(); -} - -void yagl_host_glLoadMatrixx(const GLfixed *m, int32_t m_count) -{ - unsigned i; - GLfloat *tmp = NULL; - - YAGL_GET_CTX(glLoadMatrixx); - - if (m) { - tmp = yagl_gles_context_malloc(&ctx->base, 16 * sizeof(GLfloat)); - - for (i = 0; i < 16; ++i) { - tmp[i] = yagl_fixed_to_float(m[i]); - } - } - - ctx->driver->LoadMatrixf(tmp); -} - -void yagl_host_glLogicOp(GLenum opcode) -{ - YAGL_GET_CTX(glLogicOp); - - ctx->driver->LogicOp(opcode); -} - -void yagl_host_glMaterialx(GLenum face, - GLenum pname, - GLfixed param) -{ - YAGL_GET_CTX(glMaterialx); - - if (face != GL_FRONT_AND_BACK) { - YAGL_SET_ERR(GL_INVALID_ENUM); - } else { - ctx->driver->Materialf(face, pname, yagl_fixed_to_float(param)); - } -} - -void yagl_host_glMaterialxv(GLenum face, - GLenum pname, - const GLfixed *params, int32_t params_count) -{ - GLfloat paramsf[YAGL_MATERIAL_PARAM_MAX_LEN]; - int32_t tmp, i; - - YAGL_GET_CTX(glMaterialxv); - - if (face != GL_FRONT_AND_BACK || - !yagl_gles1_material_param_len(pname, &tmp)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (params) { - for (i = 0; i < params_count; ++i) { - paramsf[i] = yagl_fixed_to_float(params[i]); - } - ctx->driver->Materialfv(face, pname, paramsf); - } else { - ctx->driver->Materialfv(face, pname, NULL); - } -} - -void yagl_host_glMatrixMode(GLenum mode) -{ - YAGL_GET_CTX(glMatrixMode); - - ctx->driver->MatrixMode(mode); -} - -void yagl_host_glMultMatrixx(const GLfixed *m, int32_t m_count) -{ - GLfloat *tmp = NULL; - int32_t i; - - YAGL_GET_CTX(glMultMatrixf); - - if (m) { - tmp = yagl_gles_context_malloc(&ctx->base, 16 * sizeof(GLfloat)); - - for (i = 0; i < 16; ++i) { - tmp[i] = yagl_fixed_to_float(m[i]); - } - } - - ctx->driver->MultMatrixf(tmp); -} - -void yagl_host_glMultiTexCoord4x(GLenum target, - GLfixed s, - GLfixed tt, - GLfixed r, - GLfixed q) -{ - YAGL_GET_CTX(glMultiTexCoord4x); - - if (target >= GL_TEXTURE0 && - target < (GL_TEXTURE0 + ctx->base.num_texture_units)) { - ctx->driver->MultiTexCoord4f(target, - yagl_fixed_to_float(s), - yagl_fixed_to_float(tt), - yagl_fixed_to_float(r), - yagl_fixed_to_float(q)); - } -} - -void yagl_host_glNormal3x(GLfixed nx, - GLfixed ny, - GLfixed nz) -{ - YAGL_GET_CTX(glNormal3x); - - ctx->driver->Normal3f(yagl_fixed_to_float(nx), - yagl_fixed_to_float(ny), - yagl_fixed_to_float(nz)); -} - -void yagl_host_glNormalPointer(GLenum type, - GLsizei stride, - target_ulong pointer) -{ - struct yagl_gles_array *narray; - - YAGL_GET_CTX(glNormalPointer); - - if (stride < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } - - if (type != GL_FLOAT && type != GL_FIXED && - type != GL_SHORT && type != GL_BYTE) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - narray = yagl_gles_context_get_array(&ctx->base, YAGL_GLES1_ARRAY_NORMAL); - - assert(narray); - - if (ctx->base.vbo) { - if (!yagl_gles_array_update_vbo(narray, - 3, - type, - type == GL_FIXED, - GL_FALSE, - stride, - ctx->base.vbo, - ctx->base.vbo_local_name, - pointer)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } - } else { - if (!yagl_gles_array_update(narray, - 3, - type, - type == GL_FIXED, - GL_FALSE, - stride, - pointer)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } - } -} - -void yagl_host_glOrthox(GLfixed left, - GLfixed right, - GLfixed bottom, - GLfixed top, - GLfixed zNear, - GLfixed zFar) -{ - YAGL_GET_CTX(glOrthox); - - if (left == right || bottom == top || zNear == zFar) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } else { - ctx->driver->Ortho(yagl_fixed_to_double(left), - yagl_fixed_to_double(right), - yagl_fixed_to_double(bottom), - yagl_fixed_to_double(top), - yagl_fixed_to_double(zNear), - yagl_fixed_to_double(zFar)); - } -} - -void yagl_host_glPointParameterx(GLenum pname, - GLfixed param) -{ - YAGL_GET_CTX(glPointParameterx); - - if (pname != GL_POINT_SIZE_MIN && pname != GL_POINT_SIZE_MIN && - pname != GL_POINT_SIZE_MAX && pname != GL_POINT_FADE_THRESHOLD_SIZE) { - YAGL_SET_ERR(GL_INVALID_ENUM); - } else { - ctx->driver->PointParameterf(pname, yagl_fixed_to_float(param)); - } -} - -void yagl_host_glPointParameterxv(GLenum pname, - const GLfixed *params, int32_t params_count) -{ - GLfloat paramsf[YAGL_POINT_PARAM_MAX_LEN]; - int32_t i; - - YAGL_GET_CTX(glPointParameterxv); - - if (pname != GL_POINT_SIZE_MIN && pname != GL_POINT_SIZE_MIN && - pname != GL_POINT_SIZE_MAX && pname != GL_POINT_FADE_THRESHOLD_SIZE && - pname != GL_POINT_DISTANCE_ATTENUATION) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (params) { - for (i = 0; i < params_count; ++i) { - paramsf[i] = yagl_fixed_to_float(params[i]); - } - ctx->driver->PointParameterfv(pname, paramsf); - } else { - ctx->driver->PointParameterfv(pname, NULL); - } -} - -void yagl_host_glPointSizex(GLfixed size) -{ - GLfloat sizef; - - YAGL_GET_CTX(glPointSizex); - - sizef = yagl_fixed_to_float(size); - - if (sizef <= 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } else { - ctx->driver->PointSize(sizef); - } -} - -void yagl_host_glPointSizePointerOES(GLenum type, - GLsizei stride, - target_ulong pointer) -{ - struct yagl_gles_array *parray; - - YAGL_GET_CTX(glPointSizePointerOES); - - if (stride < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } - - if (type != GL_FLOAT && type != GL_FIXED) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - parray = yagl_gles_context_get_array(&ctx->base, YAGL_GLES1_ARRAY_POINTSIZE); - - assert(parray); - - if (ctx->base.vbo) { - if (!yagl_gles_array_update_vbo(parray, - 1, - type, - type == GL_FIXED, - GL_FALSE, - stride, - ctx->base.vbo, - ctx->base.vbo_local_name, - pointer)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } - } else { - if (!yagl_gles_array_update(parray, - 1, - type, - type == GL_FIXED, - GL_FALSE, - stride, - pointer)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } - } -} - -void yagl_host_glPolygonOffsetx(GLfixed factor, - GLfixed units) -{ - YAGL_GET_CTX(glPolygonOffsetx); - - ctx->driver->base.PolygonOffset(yagl_fixed_to_float(factor), - yagl_fixed_to_float(units)); -} - -void yagl_host_glPopMatrix(void) -{ - YAGL_GET_CTX(glPopMatrix); - - ctx->driver->PopMatrix(); -} - -void yagl_host_glPushMatrix(void) -{ - YAGL_GET_CTX(glPushMatrix); - - ctx->driver->PushMatrix(); -} - -void yagl_host_glRotatex(GLfixed angle, - GLfixed x, - GLfixed y, - GLfixed z) -{ - YAGL_GET_CTX(glRotatex); - - ctx->driver->Rotatef(yagl_fixed_to_float(angle), - yagl_fixed_to_float(x), - yagl_fixed_to_float(y), - yagl_fixed_to_float(z)); -} - -void yagl_host_glSampleCoveragex(GLclampx value, - GLboolean invert) -{ - YAGL_GET_CTX(glSampleCoveragex); - - ctx->driver->base.SampleCoverage(yagl_fixed_to_float(value), invert); -} - -void yagl_host_glScalex(GLfixed x, - GLfixed y, - GLfixed z) -{ - YAGL_GET_CTX(glScalex); - - ctx->driver->Scalef(yagl_fixed_to_float(x), - yagl_fixed_to_float(y), - yagl_fixed_to_float(z)); -} - -void yagl_host_glShadeModel(GLenum mode) -{ - YAGL_GET_CTX(glShadeModel); - - ctx->driver->ShadeModel(mode); -} - -void yagl_host_glTexCoordPointer(GLint size, - GLenum type, - GLsizei stride, - target_ulong pointer) -{ - struct yagl_gles_array *texarray; - - YAGL_GET_CTX(glTexCoordPointer); - - if ((size < 2) || (size > 4) || (stride < 0)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } - - if (type != GL_FLOAT && type != GL_FIXED && - type != GL_SHORT && type != GL_BYTE) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - texarray = yagl_gles_context_get_array(&ctx->base, - YAGL_GLES1_ARRAY_TEX_COORD + - ctx->client_active_texture); - - assert(texarray); - - if (ctx->base.vbo) { - if (!yagl_gles_array_update_vbo(texarray, - size, - type, - type == GL_FIXED || type == GL_BYTE, - GL_FALSE, - stride, - ctx->base.vbo, - ctx->base.vbo_local_name, - pointer)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } - } else { - if (!yagl_gles_array_update(texarray, - size, - type, - type == GL_FIXED || type == GL_BYTE, - GL_FALSE, - stride, - pointer)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } - } -} - -void yagl_host_glTexEnvi(GLenum target, - GLenum pname, - GLint param) -{ - YAGL_GET_CTX(glTexEnvi); - - if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->TexEnvi(target, pname, param); -} - -void yagl_host_glTexEnvx(GLenum target, - GLenum pname, - GLfixed param) -{ - GLfloat paramf; - - YAGL_GET_CTX(glTexEnvx); - - if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (pname == GL_RGB_SCALE || pname == GL_ALPHA_SCALE) { - paramf = yagl_fixed_to_float(param); - } else { - paramf = (GLfloat)param; - } - - ctx->driver->TexEnvf(target, pname, paramf); -} - -void yagl_host_glTexEnviv(GLenum target, - GLenum pname, - const GLint *params, int32_t params_count) -{ - YAGL_GET_CTX(glTexEnviv); - - if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->TexEnviv(target, pname, params); -} - -void yagl_host_glTexEnvxv(GLenum target, - GLenum pname, - const GLfixed *params, int32_t params_count) -{ - GLfloat paramsf[YAGL_TEX_ENV_PARAM_MAX_LEN]; - int32_t i; - - YAGL_GET_CTX(glTexEnvxv); - - if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (params) { - if (pname == GL_TEXTURE_ENV_COLOR) { - for (i = 0; i < YAGL_TEX_ENV_PARAM_MAX_LEN; ++i) { - paramsf[i] = yagl_fixed_to_float(params[i]); - } - } else { - if (pname == GL_RGB_SCALE || pname == GL_ALPHA_SCALE) { - paramsf[0] = yagl_fixed_to_float(params[0]); - } else { - paramsf[0] = (GLfloat)params[0]; - } - } - ctx->driver->TexEnvfv(target, pname, paramsf); - } else { - ctx->driver->TexEnvfv(target, pname, NULL); - } -} - -void yagl_host_glTexParameterx(GLenum target, - GLenum pname, - GLfixed param) -{ - YAGL_GET_CTX(glTexParameterx); - - if (target != GL_TEXTURE_2D) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - ctx->driver->base.TexParameterf(target, pname, (GLfloat)param); -} - -void yagl_host_glTexParameterxv(GLenum target, - GLenum pname, - const GLfixed *params, int32_t params_count) -{ - GLfloat paramf; - - YAGL_GET_CTX(glTexParameterxv); - - if (target != GL_TEXTURE_2D) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (params) { - paramf = (GLfloat)params[0]; - ctx->driver->base.TexParameterfv(target, pname, ¶mf); - } else { - ctx->driver->base.TexParameterfv(target, pname, NULL); - } -} - -void yagl_host_glTranslatex(GLfixed x, - GLfixed y, - GLfixed z) -{ - YAGL_GET_CTX(glTranslatex); - - ctx->driver->Translatef(yagl_fixed_to_float(x), - yagl_fixed_to_float(y), - yagl_fixed_to_float(z)); -} - -void yagl_host_glVertexPointer(GLint size, - GLenum type, - GLsizei stride, - target_ulong pointer) -{ - struct yagl_gles_array *varray; - - YAGL_GET_CTX(glVertexPointer); - - if ((size < 2) || (size > 4) || (stride < 0)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } - - if (type != GL_FLOAT && type != GL_FIXED && - type != GL_SHORT && type != GL_BYTE) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - varray = yagl_gles_context_get_array(&ctx->base, YAGL_GLES1_ARRAY_VERTEX); - - assert(varray); - - if (ctx->base.vbo) { - if (!yagl_gles_array_update_vbo(varray, - size, - type, - type == GL_FIXED || type == GL_BYTE, - GL_FALSE, - stride, - ctx->base.vbo, - ctx->base.vbo_local_name, - pointer)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } - } else { - if (!yagl_gles_array_update(varray, - size, - type, - type == GL_FIXED || type == GL_BYTE, - GL_FALSE, - stride, - pointer)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } - } -} diff --git a/hw/yagl_apis/gles1/yagl_host_gles1_calls.h b/hw/yagl_apis/gles1/yagl_host_gles1_calls.h deleted file mode 100644 index 852dcc6..0000000 --- a/hw/yagl_apis/gles1/yagl_host_gles1_calls.h +++ /dev/null @@ -1,240 +0,0 @@ -#ifndef _QEMU_YAGL_HOST_GLES1_CALLS_H -#define _QEMU_YAGL_HOST_GLES1_CALLS_H - -#include "yagl_api.h" -#include -#include "yagl_apis/gles/yagl_host_gles_calls.h" - -struct yagl_api_ps *yagl_host_gles1_process_init(struct yagl_api *api); - -void yagl_host_glAlphaFunc(GLenum func, - GLclampf ref); -void yagl_host_glClipPlanef(GLenum plane, - const GLfloat *equation, int32_t equation_count); -void yagl_host_glColor4f(GLfloat red, - GLfloat green, - GLfloat blue, - GLfloat alpha); -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_glGetClipPlanef(GLenum pname, - GLfloat *eqn, int32_t eqn_maxcount, int32_t *eqn_count); -void yagl_host_glGetLightfv(GLenum light, - GLenum pname, - GLfloat *params, int32_t params_maxcount, 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_glGetTexEnvfv(GLenum env, - 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_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_glLoadMatrixf(const GLfloat *m, int32_t m_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_glMultMatrixf(const GLfloat *m, int32_t m_count); -void yagl_host_glMultiTexCoord4f(GLenum target, - GLfloat s, - GLfloat tt, - GLfloat r, - GLfloat q); -void yagl_host_glNormal3f(GLfloat nx, - GLfloat ny, - GLfloat nz); -void yagl_host_glOrthof(GLfloat left, - GLfloat right, - GLfloat bottom, - GLfloat top, - GLfloat zNear, - GLfloat zFar); -void yagl_host_glPointParameterf(GLenum pname, - GLfloat param); -void yagl_host_glPointParameterfv(GLenum pname, - const GLfloat *params, int32_t params_count); -void yagl_host_glPointSize(GLfloat size); -void yagl_host_glPointSizePointerOES(GLenum type, - GLsizei stride, - target_ulong pointer); -void yagl_host_glRotatef(GLfloat angle, - GLfloat x, - GLfloat y, - GLfloat z); -void yagl_host_glScalef(GLfloat x, - GLfloat y, - GLfloat z); -void yagl_host_glTexEnvf(GLenum target, - GLenum pname, - GLfloat param); -void yagl_host_glTexEnvfv(GLenum target, - GLenum pname, - const GLfloat *params, int32_t params_count); -void yagl_host_glTranslatef(GLfloat x, - GLfloat y, - GLfloat z); -void yagl_host_glAlphaFuncx(GLenum func, - GLclampx ref); -void yagl_host_glClearColorx(GLclampx red, - GLclampx green, - GLclampx blue, - GLclampx alpha); -void yagl_host_glClearDepthx(GLclampx depth); -void yagl_host_glClientActiveTexture(GLenum texture); -void yagl_host_glClipPlanex(GLenum plane, - const GLfixed *equation, int32_t equation_count); -void yagl_host_glColor4ub(GLubyte red, - GLubyte green, - GLubyte blue, - GLubyte alpha); -void yagl_host_glColor4x(GLfixed red, - GLfixed green, - GLfixed blue, - GLfixed alpha); -void yagl_host_glColorPointer(GLint size, - GLenum type, - GLsizei stride, - target_ulong pointer); -void yagl_host_glDepthRangex(GLclampx zNear, - GLclampx zFar); -void yagl_host_glDisableClientState(GLenum array); -void yagl_host_glEnableClientState(GLenum array); -void yagl_host_glFogx(GLenum pname, - GLfixed param); -void yagl_host_glFogxv(GLenum pname, - const GLfixed *params, int32_t params_count); -void yagl_host_glFrustumx(GLfixed left, - GLfixed right, - GLfixed bottom, - GLfixed top, - GLfixed zNear, - GLfixed zFar); -void yagl_host_glGetClipPlanex(GLenum pname, - GLfixed *eqn, int32_t eqn_maxcount, int32_t *eqn_count); -void yagl_host_glGetFixedv(GLenum pname, - GLfixed *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetLightxv(GLenum light, - GLenum pname, - GLfixed *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetMaterialxv(GLenum face, - GLenum pname, - GLfixed *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetPointerv(GLenum pname, - target_ulong *params); -void yagl_host_glGetTexEnviv(GLenum env, - GLenum pname, - GLint *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetTexEnvxv(GLenum env, - GLenum pname, - GLfixed *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetTexParameterxv(GLenum target, - GLenum pname, - GLfixed *param); -void yagl_host_glLightModelx(GLenum pname, - GLfixed param); -void yagl_host_glLightModelxv(GLenum pname, - const GLfixed *params, int32_t params_count); -void yagl_host_glLightx(GLenum light, - GLenum pname, - GLfixed param); -void yagl_host_glLightxv(GLenum light, - GLenum pname, - const GLfixed *params, int32_t params_count); -void yagl_host_glLineWidthx(GLfixed width); -void yagl_host_glLoadIdentity(void); -void yagl_host_glLoadMatrixx(const GLfixed *m, int32_t m_count); -void yagl_host_glLogicOp(GLenum opcode); -void yagl_host_glMaterialx(GLenum face, - GLenum pname, - GLfixed param); -void yagl_host_glMaterialxv(GLenum face, - GLenum pname, - const GLfixed *params, int32_t params_count); -void yagl_host_glMatrixMode(GLenum mode); -void yagl_host_glMultMatrixx(const GLfixed *m, int32_t m_count); -void yagl_host_glMultiTexCoord4x(GLenum target, - GLfixed s, - GLfixed tt, - GLfixed r, - GLfixed q); -void yagl_host_glNormal3x(GLfixed nx, - GLfixed ny, - GLfixed nz); -void yagl_host_glNormalPointer(GLenum type, - GLsizei stride, - target_ulong pointer); -void yagl_host_glOrthox(GLfixed left, - GLfixed right, - GLfixed bottom, - GLfixed top, - GLfixed zNear, - GLfixed zFar); -void yagl_host_glPointParameterx(GLenum pname, - GLfixed param); -void yagl_host_glPointParameterxv(GLenum pname, - const GLfixed *params, int32_t params_count); -void yagl_host_glPointSizex(GLfixed size); -void yagl_host_glPolygonOffsetx(GLfixed factor, - GLfixed units); -void yagl_host_glPopMatrix(void); -void yagl_host_glPushMatrix(void); -void yagl_host_glRotatex(GLfixed angle, - GLfixed x, - GLfixed y, - GLfixed z); -void yagl_host_glSampleCoveragex(GLclampx value, - GLboolean invert); -void yagl_host_glScalex(GLfixed x, - GLfixed y, - GLfixed z); -void yagl_host_glShadeModel(GLenum mode); -void yagl_host_glTexCoordPointer(GLint size, - GLenum type, - GLsizei stride, - target_ulong pointer); -void yagl_host_glTexEnvi(GLenum target, - GLenum pname, - GLint param); -void yagl_host_glTexEnvx(GLenum target, - GLenum pname, - GLfixed param); -void yagl_host_glTexEnviv(GLenum target, - GLenum pname, - const GLint *params, int32_t params_count); -void yagl_host_glTexEnvxv(GLenum target, - GLenum pname, - const GLfixed *params, int32_t params_count); -void yagl_host_glTexParameterx(GLenum target, - GLenum pname, - GLfixed param); -void yagl_host_glTexParameterxv(GLenum target, - GLenum pname, - const GLfixed *params, int32_t params_count); -void yagl_host_glTranslatex(GLfixed x, - GLfixed y, - GLfixed z); -void yagl_host_glVertexPointer(GLint size, - GLenum type, - GLsizei stride, - target_ulong pointer); - -#endif diff --git a/hw/yagl_apis/gles2/yagl_gles2_api.c b/hw/yagl_apis/gles2/yagl_gles2_api.c deleted file mode 100644 index 5b1ed7e..0000000 --- a/hw/yagl_apis/gles2/yagl_gles2_api.c +++ /dev/null @@ -1,29 +0,0 @@ -#include "yagl_gles2_api.h" -#include "yagl_host_gles2_calls.h" -#include "yagl_gles2_driver.h" - -static void yagl_gles2_api_destroy(struct yagl_api *api) -{ - struct yagl_gles2_api *gles2_api = (struct yagl_gles2_api*)api; - - gles2_api->driver->destroy(gles2_api->driver); - gles2_api->driver = NULL; - - yagl_api_cleanup(&gles2_api->base); - - g_free(gles2_api); -} - -struct yagl_api *yagl_gles2_api_create(struct yagl_gles2_driver *driver) -{ - struct yagl_gles2_api *gles2_api = g_malloc0(sizeof(struct yagl_gles2_api)); - - yagl_api_init(&gles2_api->base); - - gles2_api->base.process_init = &yagl_host_gles2_process_init; - gles2_api->base.destroy = &yagl_gles2_api_destroy; - - gles2_api->driver = driver; - - return &gles2_api->base; -} diff --git a/hw/yagl_apis/gles2/yagl_gles2_api.h b/hw/yagl_apis/gles2/yagl_gles2_api.h deleted file mode 100644 index d3ec179..0000000 --- a/hw/yagl_apis/gles2/yagl_gles2_api.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef _QEMU_YAGL_GLES2_API_H -#define _QEMU_YAGL_GLES2_API_H - -#include "yagl_api.h" - -struct yagl_gles2_driver; - -struct yagl_gles2_api -{ - struct yagl_api base; - - struct yagl_gles2_driver *driver; -}; - -/* - * Takes ownership of 'driver' - */ -struct yagl_api *yagl_gles2_api_create(struct yagl_gles2_driver *driver); - -#endif diff --git a/hw/yagl_apis/gles2/yagl_gles2_api_ps.c b/hw/yagl_apis/gles2/yagl_gles2_api_ps.c deleted file mode 100644 index ab159be..0000000 --- a/hw/yagl_apis/gles2/yagl_gles2_api_ps.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include "yagl_gles2_api_ps.h" -#include "yagl_gles2_driver.h" -#include "yagl_process.h" -#include "yagl_thread.h" -#include "yagl_client_interface.h" - -void yagl_gles2_api_ps_init(struct yagl_gles2_api_ps *gles2_api_ps, - struct yagl_gles2_driver *driver, - struct yagl_client_interface *client_iface) -{ - gles2_api_ps->driver = driver; - gles2_api_ps->client_iface = client_iface; - - yagl_process_register_client_interface(cur_ts->ps, - yagl_client_api_gles2, - gles2_api_ps->client_iface); -} - -void yagl_gles2_api_ps_fini(struct yagl_gles2_api_ps *gles2_api_ps) -{ -} - -void yagl_gles2_api_ps_cleanup(struct yagl_gles2_api_ps *gles2_api_ps) -{ - yagl_process_unregister_client_interface(cur_ts->ps, - yagl_client_api_gles2); - - yagl_client_interface_cleanup(gles2_api_ps->client_iface); - g_free(gles2_api_ps->client_iface); - gles2_api_ps->client_iface = NULL; -} diff --git a/hw/yagl_apis/gles2/yagl_gles2_api_ps.h b/hw/yagl_apis/gles2/yagl_gles2_api_ps.h deleted file mode 100644 index 5d71109..0000000 --- a/hw/yagl_apis/gles2/yagl_gles2_api_ps.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _QEMU_YAGL_GLES2_API_PS_H -#define _QEMU_YAGL_GLES2_API_PS_H - -#include "yagl_api.h" - -struct yagl_client_interface; -struct yagl_gles2_driver; - -struct yagl_gles2_api_ps -{ - struct yagl_api_ps base; - - struct yagl_gles2_driver *driver; - - struct yagl_client_interface *client_iface; -}; - -/* - * Takes ownership of 'client_iface'. - */ -void yagl_gles2_api_ps_init(struct yagl_gles2_api_ps *gles2_api_ps, - struct yagl_gles2_driver *driver, - struct yagl_client_interface *client_iface); - -/* - * This MUST be called before cleanup in order to purge all resources. - * This cannot be done in 'xxx_cleanup' since by that time - * egl interface will be destroyed and it might be required in order to - * destroy some internal state. - */ -void yagl_gles2_api_ps_fini(struct yagl_gles2_api_ps *gles2_api_ps); - -void yagl_gles2_api_ps_cleanup(struct yagl_gles2_api_ps *gles2_api_ps); - -#endif diff --git a/hw/yagl_apis/gles2/yagl_gles2_api_ts.c b/hw/yagl_apis/gles2/yagl_gles2_api_ts.c deleted file mode 100644 index 5904716..0000000 --- a/hw/yagl_apis/gles2/yagl_gles2_api_ts.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "yagl_gles2_api_ts.h" -#include "yagl_process.h" -#include "yagl_thread.h" - -void yagl_gles2_api_ts_init(struct yagl_gles2_api_ts *gles2_api_ts, - struct yagl_gles2_driver *driver) -{ - gles2_api_ts->driver = driver; -} - -void yagl_gles2_api_ts_cleanup(struct yagl_gles2_api_ts *gles2_api_ts) -{ -} diff --git a/hw/yagl_apis/gles2/yagl_gles2_api_ts.h b/hw/yagl_apis/gles2/yagl_gles2_api_ts.h deleted file mode 100644 index 888ebd5..0000000 --- a/hw/yagl_apis/gles2/yagl_gles2_api_ts.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _QEMU_YAGL_GLES2_API_TS_H -#define _QEMU_YAGL_GLES2_API_TS_H - -#include "yagl_types.h" - -struct yagl_gles2_driver; -struct yagl_egl_interface; - -struct yagl_gles2_api_ts -{ - struct yagl_gles2_driver *driver; -}; - -/* - * Does NOT take ownership of anything. - */ -void yagl_gles2_api_ts_init(struct yagl_gles2_api_ts *gles2_api_ts, - struct yagl_gles2_driver *driver); - -void yagl_gles2_api_ts_cleanup(struct yagl_gles2_api_ts *gles2_api_ts); - -#endif diff --git a/hw/yagl_apis/gles2/yagl_gles2_calls.h b/hw/yagl_apis/gles2/yagl_gles2_calls.h deleted file mode 100644 index 5bb30f8..0000000 --- a/hw/yagl_apis/gles2/yagl_gles2_calls.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Generated by gen-yagl-calls.py, do not modify! - */ -#ifndef _QEMU_YAGL_GLES2_CALLS_H_ -#define _QEMU_YAGL_GLES2_CALLS_H_ - -#include "yagl_types.h" - -extern const uint32_t yagl_gles2_api_num_funcs; - -extern yagl_api_func yagl_gles2_api_funcs[]; - -#endif diff --git a/hw/yagl_apis/gles2/yagl_gles2_context.c b/hw/yagl_apis/gles2/yagl_gles2_context.c deleted file mode 100644 index 15357e8..0000000 --- a/hw/yagl_apis/gles2/yagl_gles2_context.c +++ /dev/null @@ -1,527 +0,0 @@ -#include "yagl_gles2_context.h" -#include "yagl_apis/gles/yagl_gles_array.h" -#include "yagl_apis/gles/yagl_gles_buffer.h" -#include "yagl_log.h" -#include "yagl_process.h" -#include "yagl_thread.h" -#include "yagl_sharegroup.h" -#include -#include -#include "yagl_gles2_driver.h" - -/* - * We can't include GL/glext.h here - */ -#define GL_POINT_SPRITE 0x8861 -#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 - -static void yagl_gles2_array_apply(struct yagl_gles_array *array) -{ - struct yagl_gles2_context *gles2_ctx = (struct yagl_gles2_context*)array->ctx; - - if (array->vbo) { - yagl_object_name old_buffer_name = 0; - - yagl_gles_buffer_bind(array->vbo, - array->type, - false, - GL_ARRAY_BUFFER, - &old_buffer_name); - - gles2_ctx->driver->VertexAttribPointer(array->index, - array->size, - array->type, - array->normalized, - array->stride, - (GLvoid*)(uintptr_t)array->offset); - - gles2_ctx->driver->base.BindBuffer(GL_ARRAY_BUFFER, - old_buffer_name); - } else { - assert(array->host_data); - - gles2_ctx->driver->VertexAttribPointer(array->index, - array->size, - array->type, - array->normalized, - array->stride, - array->host_data); - } -} - -static bool yagl_gles2_context_get_param_count(struct yagl_gles_context *ctx, - GLenum pname, - int *count) -{ - struct yagl_gles2_context *gles2_ctx = (struct yagl_gles2_context*)ctx; - - switch (pname) { - case GL_ACTIVE_TEXTURE: *count = 1; break; - case GL_ALIASED_LINE_WIDTH_RANGE: *count = 2; break; - case GL_ALIASED_POINT_SIZE_RANGE: *count = 2; break; - case GL_ALPHA_BITS: *count = 1; break; - case GL_ARRAY_BUFFER_BINDING: *count = 1; break; - case GL_BLEND: *count = 1; break; - case GL_BLEND_COLOR: *count = 4; break; - case GL_BLEND_DST_ALPHA: *count = 1; break; - case GL_BLEND_DST_RGB: *count = 1; break; - case GL_BLEND_EQUATION_ALPHA: *count = 1; break; - case GL_BLEND_EQUATION_RGB: *count = 1; break; - case GL_BLEND_SRC_ALPHA: *count = 1; break; - case GL_BLEND_SRC_RGB: *count = 1; break; - case GL_BLUE_BITS: *count = 1; break; - case GL_COLOR_CLEAR_VALUE: *count = 4; break; - case GL_COLOR_WRITEMASK: *count = 4; break; - case GL_COMPRESSED_TEXTURE_FORMATS: *count = ctx->num_compressed_texture_formats; break; - case GL_CULL_FACE: *count = 1; break; - case GL_CULL_FACE_MODE: *count = 1; break; - case GL_CURRENT_PROGRAM: *count = 1; break; - case GL_DEPTH_BITS: *count = 1; break; - case GL_DEPTH_CLEAR_VALUE: *count = 1; break; - case GL_DEPTH_FUNC: *count = 1; break; - case GL_DEPTH_RANGE: *count = 2; break; - case GL_DEPTH_TEST: *count = 1; break; - case GL_DEPTH_WRITEMASK: *count = 1; break; - case GL_DITHER: *count = 1; break; - case GL_ELEMENT_ARRAY_BUFFER_BINDING: *count = 1; break; - case GL_FRAMEBUFFER_BINDING: *count = 1; break; - case GL_FRONT_FACE: *count = 1; break; - case GL_GENERATE_MIPMAP_HINT: *count = 1; break; - case GL_GREEN_BITS: *count = 1; break; - case GL_IMPLEMENTATION_COLOR_READ_FORMAT: *count = 1; break; - case GL_IMPLEMENTATION_COLOR_READ_TYPE: *count = 1; break; - case GL_LINE_WIDTH: *count = 1; break; - case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: *count = 1; break; - case GL_MAX_CUBE_MAP_TEXTURE_SIZE: *count = 1; break; - case GL_MAX_FRAGMENT_UNIFORM_VECTORS: *count = 1; break; - case GL_MAX_RENDERBUFFER_SIZE: *count = 1; break; - case GL_MAX_TEXTURE_IMAGE_UNITS: *count = 1; break; - case GL_MAX_TEXTURE_SIZE: *count = 1; break; - case GL_MAX_VARYING_VECTORS: *count = 1; break; - case GL_MAX_VERTEX_ATTRIBS: *count = 1; break; - case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: *count = 1; break; - case GL_MAX_VERTEX_UNIFORM_VECTORS: *count = 1; break; - case GL_MAX_VIEWPORT_DIMS: *count = 2; break; - case GL_NUM_COMPRESSED_TEXTURE_FORMATS: *count = 1; break; - case GL_NUM_SHADER_BINARY_FORMATS: *count = 1; break; - case GL_PACK_ALIGNMENT: *count = 1; break; - case GL_POLYGON_OFFSET_FACTOR: *count = 1; break; - case GL_POLYGON_OFFSET_FILL: *count = 1; break; - case GL_POLYGON_OFFSET_UNITS: *count = 1; break; - case GL_RED_BITS: *count = 1; break; - case GL_RENDERBUFFER_BINDING: *count = 1; break; - case GL_SAMPLE_ALPHA_TO_COVERAGE: *count = 1; break; - case GL_SAMPLE_BUFFERS: *count = 1; break; - case GL_SAMPLE_COVERAGE: *count = 1; break; - case GL_SAMPLE_COVERAGE_INVERT: *count = 1; break; - case GL_SAMPLE_COVERAGE_VALUE: *count = 1; break; - case GL_SAMPLES: *count = 1; break; - case GL_SCISSOR_BOX: *count = 4; break; - case GL_SCISSOR_TEST: *count = 1; break; - case GL_SHADER_BINARY_FORMATS: *count = gles2_ctx->num_shader_binary_formats; break; - case GL_SHADER_COMPILER: *count = 1; break; - case GL_STENCIL_BACK_FAIL: *count = 1; break; - case GL_STENCIL_BACK_FUNC: *count = 1; break; - case GL_STENCIL_BACK_PASS_DEPTH_FAIL: *count = 1; break; - case GL_STENCIL_BACK_PASS_DEPTH_PASS: *count = 1; break; - case GL_STENCIL_BACK_REF: *count = 1; break; - case GL_STENCIL_BACK_VALUE_MASK: *count = 1; break; - case GL_STENCIL_BACK_WRITEMASK: *count = 1; break; - case GL_STENCIL_BITS: *count = 1; break; - case GL_STENCIL_CLEAR_VALUE: *count = 1; break; - case GL_STENCIL_FAIL: *count = 1; break; - case GL_STENCIL_FUNC: *count = 1; break; - case GL_STENCIL_PASS_DEPTH_FAIL: *count = 1; break; - case GL_STENCIL_PASS_DEPTH_PASS: *count = 1; break; - case GL_STENCIL_REF: *count = 1; break; - case GL_STENCIL_TEST: *count = 1; break; - case GL_STENCIL_VALUE_MASK: *count = 1; break; - case GL_STENCIL_WRITEMASK: *count = 1; break; - case GL_SUBPIXEL_BITS: *count = 1; break; - case GL_TEXTURE_BINDING_2D: *count = 1; break; - case GL_TEXTURE_BINDING_CUBE_MAP: *count = 1; break; - case GL_UNPACK_ALIGNMENT: *count = 1; break; - case GL_VIEWPORT: *count = 4; break; - case GL_MAX_SAMPLES_IMG: *count = 1; break; - case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: *count = 1; break; - default: return false; - } - return true; -} - -static bool yagl_gles2_context_get_integerv(struct yagl_gles_context *ctx, - GLenum pname, - GLint *params) -{ - struct yagl_gles2_context *gles2_ctx = (struct yagl_gles2_context*)ctx; - - switch (pname) { - case GL_CURRENT_PROGRAM: - params[0] = gles2_ctx->program_local_name; - break; - case GL_FRAMEBUFFER_BINDING: - params[0] = ctx->fbo_local_name; - break; - case GL_RENDERBUFFER_BINDING: - params[0] = ctx->rbo_local_name; - break; - case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: - params[0] = ctx->num_texture_units; - break; - default: - return false; - } - - return true; -} - -static bool yagl_gles2_context_get_booleanv(struct yagl_gles_context *ctx, - GLenum pname, - GLboolean *params) -{ - GLint tmp; - - switch (pname) { - case GL_CURRENT_PROGRAM: - case GL_FRAMEBUFFER_BINDING: - case GL_RENDERBUFFER_BINDING: - case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: - if (!yagl_gles2_context_get_integerv(ctx, pname, &tmp)) { - return false; - } - params[0] = ((tmp != 0) ? GL_TRUE : GL_FALSE); - break; - default: - return false; - } - - return true; -} - -static bool yagl_gles2_context_get_floatv(struct yagl_gles_context *ctx, - GLenum pname, - GLfloat *params) -{ - GLint tmp; - - switch (pname) { - case GL_CURRENT_PROGRAM: - case GL_FRAMEBUFFER_BINDING: - case GL_RENDERBUFFER_BINDING: - case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: - if (!yagl_gles2_context_get_integerv(ctx, pname, &tmp)) { - return false; - } - params[0] = (GLfloat)tmp; - break; - default: - return false; - } - - return true; -} - -static bool yagl_gles2_context_is_enabled(struct yagl_gles_context *ctx, - GLboolean* retval, - GLenum cap) -{ - return false; -} - -static GLchar *yagl_gles2_context_get_extensions(struct yagl_gles_context *ctx) -{ - struct yagl_gles2_context *gles2_ctx = (struct yagl_gles2_context*)ctx; - - const GLchar *mandatory_extensions = - "GL_OES_EGL_image GL_OES_depth24 GL_OES_depth32 " - "GL_OES_texture_float GL_OES_texture_float_linear " - "GL_EXT_texture_format_BGRA8888 GL_OES_depth_texture "; - const GLchar *pack_depth_stencil = "GL_OES_packed_depth_stencil "; - const GLchar *texture_npot = "GL_OES_texture_npot "; - const GLchar *texture_rectangle = "GL_ARB_texture_rectangle "; - const GLchar *texture_filter_anisotropic = "GL_EXT_texture_filter_anisotropic "; - const GLchar *texture_half_float = "GL_OES_texture_half_float GL_OES_texture_half_float_linear "; - const GLchar *vertex_half_float = "GL_OES_vertex_half_float "; - const GLchar *standard_derivatives = "GL_OES_standard_derivatives "; - - GLuint len = strlen(mandatory_extensions); - GLchar *str; - - if (gles2_ctx->base.pack_depth_stencil) { - len += strlen(pack_depth_stencil); - } - - if (gles2_ctx->base.texture_npot) { - len += strlen(texture_npot); - } - - if (gles2_ctx->base.texture_rectangle) { - len += strlen(texture_rectangle); - } - - if (gles2_ctx->base.texture_filter_anisotropic) { - len += strlen(texture_filter_anisotropic); - } - - if (gles2_ctx->texture_half_float) { - len += strlen(texture_half_float); - } - - if (gles2_ctx->vertex_half_float) { - len += strlen(vertex_half_float); - } - - if (gles2_ctx->standard_derivatives) { - len += strlen(standard_derivatives); - } - - str = g_malloc0(len + 1); - - strcpy(str, mandatory_extensions); - - if (gles2_ctx->base.pack_depth_stencil) { - strcat(str, pack_depth_stencil); - } - - if (gles2_ctx->base.texture_npot) { - strcat(str, texture_npot); - } - - if (gles2_ctx->base.texture_rectangle) { - strcat(str, texture_rectangle); - } - - if (gles2_ctx->base.texture_filter_anisotropic) { - strcat(str, texture_filter_anisotropic); - } - - if (gles2_ctx->texture_half_float) { - strcat(str, texture_half_float); - } - - if (gles2_ctx->vertex_half_float) { - strcat(str, vertex_half_float); - } - - if (gles2_ctx->standard_derivatives) { - strcat(str, standard_derivatives); - } - - return str; -} - -static inline void yagl_gles2_context_pre_draw(struct yagl_gles_context *ctx, GLenum mode) -{ - /* - * Enable texture generation for GL_POINTS and gl_PointSize shader variable. - * GLESv2 assumes this is enabled by default, we need to set this - * state for GL. - */ - - if (mode == GL_POINTS) { - ctx->driver->Enable(GL_POINT_SPRITE); - ctx->driver->Enable(GL_VERTEX_PROGRAM_POINT_SIZE); - } -} - -static inline void yagl_gles2_context_post_draw(struct yagl_gles_context *ctx, GLenum mode) -{ - if (mode == GL_POINTS) { - ctx->driver->Disable(GL_VERTEX_PROGRAM_POINT_SIZE); - ctx->driver->Disable(GL_POINT_SPRITE); - } -} - -static void yagl_gles2_context_draw_arrays(struct yagl_gles_context *ctx, - GLenum mode, - GLint first, - GLsizei count) -{ - yagl_gles2_context_pre_draw(ctx, mode); - - ctx->driver->DrawArrays(mode, first, count); - - yagl_gles2_context_post_draw(ctx, mode); -} - -static void yagl_gles2_context_draw_elements(struct yagl_gles_context *ctx, - GLenum mode, - GLsizei count, - GLenum type, - const GLvoid *indices) -{ - yagl_gles2_context_pre_draw(ctx, mode); - - ctx->driver->DrawElements(mode, count, type, indices); - - yagl_gles2_context_post_draw(ctx, mode); -} - -static void yagl_gles2_context_destroy(struct yagl_client_context *ctx) -{ - struct yagl_gles2_context *gles2_ctx = (struct yagl_gles2_context*)ctx; - - YAGL_LOG_FUNC_ENTER(yagl_gles2_context_destroy, - "%p", - gles2_ctx); - - yagl_gles_context_cleanup(&gles2_ctx->base); - yagl_client_context_cleanup(&gles2_ctx->base.base); - - g_free(gles2_ctx); - - YAGL_LOG_FUNC_EXIT(NULL); -} - -static void yagl_gles2_context_prepare(struct yagl_gles2_context *gles2_ctx) -{ - struct yagl_gles_driver *gles_driver = &gles2_ctx->driver->base; - GLint i, num_arrays = 0, num_texture_units = 0; - struct yagl_gles_array *arrays; - const char *extensions; - - YAGL_LOG_FUNC_ENTER(yagl_gles2_context_prepare, - "%p", - gles2_ctx); - - gles_driver->GetIntegerv(GL_MAX_VERTEX_ATTRIBS, &num_arrays); - - arrays = g_malloc(num_arrays * sizeof(*arrays)); - - for (i = 0; i < num_arrays; ++i) { - yagl_gles_array_init(&arrays[i], - i, - &gles2_ctx->base, - &yagl_gles2_array_apply); - } - - gles_driver->GetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, - &num_texture_units); - - /* - * We limit this by 32 for conformance. - */ - if (num_texture_units > 32) { - num_texture_units = 32; - } - - yagl_gles_context_prepare(&gles2_ctx->base, arrays, num_arrays, - num_texture_units); - - /* - * We don't support it for now... - */ - gles2_ctx->num_shader_binary_formats = 0; - - extensions = (const char*)gles_driver->GetString(GL_EXTENSIONS); - - gles2_ctx->texture_half_float = (strstr(extensions, "GL_ARB_half_float_pixel ") != NULL) || - (strstr(extensions, "GL_NV_half_float ") != NULL); - - gles2_ctx->vertex_half_float = (strstr(extensions, "GL_ARB_half_float_vertex ") != NULL); - - gles2_ctx->standard_derivatives = (strstr(extensions, "GL_OES_standard_derivatives ") != NULL); - - YAGL_LOG_FUNC_EXIT(NULL); -} - -static void yagl_gles2_context_activate(struct yagl_client_context *ctx) -{ - struct yagl_gles2_context *gles2_ctx = (struct yagl_gles2_context*)ctx; - - if (!gles2_ctx->prepared) { - yagl_gles2_context_prepare(gles2_ctx); - gles2_ctx->prepared = true; - } - - yagl_gles_context_activate(&gles2_ctx->base); -} - -static void yagl_gles2_context_deactivate(struct yagl_client_context *ctx) -{ - struct yagl_gles2_context *gles2_ctx = (struct yagl_gles2_context*)ctx; - - yagl_gles_context_deactivate(&gles2_ctx->base); -} - -static GLenum yagl_gles2_compressed_tex_image(struct yagl_gles_context *ctx, - GLenum target, - GLint level, - GLenum internalformat, - GLsizei width, - GLsizei height, - GLint border, - GLsizei imageSize, - const GLvoid *data) -{ - ctx->driver->CompressedTexImage2D(target, - level, - internalformat, - width, - height, - border, - imageSize, - data); - - return GL_NO_ERROR; -} - -struct yagl_gles2_context - *yagl_gles2_context_create(struct yagl_sharegroup *sg, - struct yagl_gles2_driver *driver) -{ - struct yagl_gles2_context *gles2_ctx; - - YAGL_LOG_FUNC_ENTER(yagl_gles2_context_create, - NULL); - - gles2_ctx = g_malloc0(sizeof(*gles2_ctx)); - - yagl_client_context_init(&gles2_ctx->base.base, yagl_client_api_gles2, sg); - - gles2_ctx->base.base.activate = &yagl_gles2_context_activate; - gles2_ctx->base.base.deactivate = &yagl_gles2_context_deactivate; - gles2_ctx->base.base.destroy = &yagl_gles2_context_destroy; - - yagl_gles_context_init(&gles2_ctx->base, &driver->base); - - gles2_ctx->base.get_param_count = &yagl_gles2_context_get_param_count; - gles2_ctx->base.get_booleanv = &yagl_gles2_context_get_booleanv; - gles2_ctx->base.get_integerv = &yagl_gles2_context_get_integerv; - gles2_ctx->base.get_floatv = &yagl_gles2_context_get_floatv; - gles2_ctx->base.get_extensions = &yagl_gles2_context_get_extensions; - gles2_ctx->base.draw_arrays = &yagl_gles2_context_draw_arrays; - gles2_ctx->base.draw_elements = &yagl_gles2_context_draw_elements; - gles2_ctx->base.compressed_tex_image = &yagl_gles2_compressed_tex_image; - gles2_ctx->base.is_enabled = &yagl_gles2_context_is_enabled; - - gles2_ctx->driver = driver; - gles2_ctx->prepared = false; - gles2_ctx->sg = sg; - - gles2_ctx->num_shader_binary_formats = 0; - - gles2_ctx->texture_half_float = false; - gles2_ctx->vertex_half_float = false; - gles2_ctx->standard_derivatives = false; - - gles2_ctx->program_local_name = 0; - - YAGL_LOG_FUNC_EXIT("%p", gles2_ctx); - - return gles2_ctx; -} - -void yagl_gles2_context_use_program(struct yagl_gles2_context *ctx, - yagl_object_name program_local_name) -{ - ctx->program_local_name = program_local_name; -} - -void yagl_gles2_context_unuse_program(struct yagl_gles2_context *ctx, - yagl_object_name program_local_name) -{ - if (program_local_name == ctx->program_local_name) { - ctx->program_local_name = 0; - } -} diff --git a/hw/yagl_apis/gles2/yagl_gles2_context.h b/hw/yagl_apis/gles2/yagl_gles2_context.h deleted file mode 100644 index 7261888..0000000 --- a/hw/yagl_apis/gles2/yagl_gles2_context.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _QEMU_YAGL_GLES2_CONTEXT_H -#define _QEMU_YAGL_GLES2_CONTEXT_H - -#include -#include "yagl_apis/gles/yagl_gles_context.h" - -struct yagl_gles2_driver; -struct yagl_sharegroup; - -struct yagl_gles2_context -{ - struct yagl_gles_context base; - - struct yagl_gles2_driver *driver; - - bool prepared; - - /* - * From 'base.base.sg' for speed. - */ - struct yagl_sharegroup *sg; - - int num_shader_binary_formats; - - bool texture_half_float; - - bool vertex_half_float; - - bool standard_derivatives; - - yagl_object_name program_local_name; -}; - -struct yagl_gles2_context - *yagl_gles2_context_create(struct yagl_sharegroup *sg, - struct yagl_gles2_driver *driver); - -void yagl_gles2_context_use_program(struct yagl_gles2_context *ctx, - yagl_object_name program_local_name); - -void yagl_gles2_context_unuse_program(struct yagl_gles2_context *ctx, - yagl_object_name program_local_name); - -#endif diff --git a/hw/yagl_apis/gles2/yagl_gles2_program.c b/hw/yagl_apis/gles2/yagl_gles2_program.c deleted file mode 100644 index 3d34c2b..0000000 --- a/hw/yagl_apis/gles2/yagl_gles2_program.c +++ /dev/null @@ -1,268 +0,0 @@ -#include -#include "yagl_gles2_program.h" -#include "yagl_gles2_shader.h" -#include "yagl_gles2_driver.h" -#include "yagl_log.h" -#include "yagl_process.h" -#include "yagl_thread.h" - -static void yagl_gles2_program_destroy(struct yagl_ref *ref) -{ - struct yagl_gles2_program *program = (struct yagl_gles2_program*)ref; - - yagl_ensure_ctx(); - program->driver->DeleteProgram(program->global_name); - yagl_unensure_ctx(); - - yagl_object_cleanup(&program->base); - - g_free(program); -} - -struct yagl_gles2_program - *yagl_gles2_program_create(struct yagl_gles2_driver *driver) -{ - GLuint global_name; - struct yagl_gles2_program *program; - - global_name = driver->CreateProgram(); - - program = g_malloc0(sizeof(*program)); - - yagl_object_init(&program->base, &yagl_gles2_program_destroy); - - program->is_shader = false; - program->driver = driver; - program->global_name = global_name; - - return program; -} - -bool yagl_gles2_program_attach_shader(struct yagl_gles2_program *program, - struct yagl_gles2_shader *shader, - yagl_object_name shader_local_name) -{ - switch (shader->type) { - case GL_VERTEX_SHADER: - if (program->vertex_shader_local_name) { - return false; - } - program->vertex_shader_local_name = shader_local_name; - break; - case GL_FRAGMENT_SHADER: - if (program->fragment_shader_local_name) { - return false; - } - program->fragment_shader_local_name = shader_local_name; - break; - default: - return false; - } - - program->driver->AttachShader(program->global_name, - shader->global_name); - - return true; -} - -bool yagl_gles2_program_detach_shader(struct yagl_gles2_program *program, - struct yagl_gles2_shader *shader, - yagl_object_name shader_local_name) -{ - if (program->vertex_shader_local_name == shader_local_name) { - program->vertex_shader_local_name = 0; - } else if (program->fragment_shader_local_name == shader_local_name) { - program->fragment_shader_local_name = 0; - } else { - return false; - } - - program->driver->DetachShader(program->global_name, - shader->global_name); - - return true; -} - -void yagl_gles2_program_link(struct yagl_gles2_program *program) -{ - program->driver->LinkProgram(program->global_name); -} - -int yagl_gles2_program_get_attrib_location(struct yagl_gles2_program *program, - const GLchar *name) -{ - return program->driver->GetAttribLocation(program->global_name, - name); -} - -int yagl_gles2_program_get_uniform_location(struct yagl_gles2_program *program, - const GLchar *name) -{ - return program->driver->GetUniformLocation(program->global_name, - name); -} - -void yagl_gles2_program_bind_attrib_location(struct yagl_gles2_program *program, - GLuint index, - const GLchar *name) -{ - program->driver->BindAttribLocation(program->global_name, - index, - name); -} - -void yagl_gles2_program_get_param(struct yagl_gles2_program *program, - GLenum pname, - GLint *param) -{ - program->driver->GetProgramiv(program->global_name, - pname, - param); -} - -void yagl_gles2_program_get_active_attrib(struct yagl_gles2_program *program, - GLuint index, - GLsizei bufsize, - GLsizei *length, - GLint *size, - GLenum *type, - GLchar *name) -{ - program->driver->GetActiveAttrib(program->global_name, - index, - bufsize, - length, - size, - type, - name); -} - -void yagl_gles2_program_get_active_uniform(struct yagl_gles2_program *program, - GLuint index, - GLsizei bufsize, - GLsizei *length, - GLint *size, - GLenum *type, - GLchar *name) -{ - program->driver->GetActiveUniform(program->global_name, - index, - bufsize, - length, - size, - type, - name); -} - -void yagl_gles2_program_get_info_log(struct yagl_gles2_program *program, - GLsizei bufsize, - GLsizei *length, - GLchar *infolog) -{ - program->driver->GetProgramInfoLog(program->global_name, - bufsize, - length, - infolog); -} - -void yagl_gles2_program_validate(struct yagl_gles2_program *program) -{ - program->driver->ValidateProgram(program->global_name); -} - -bool yagl_gles2_program_get_uniform_type(struct yagl_gles2_program *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_gles2_program_get_uniform_type); - - if (location < 0) { - return false; - } - - program->driver->GetProgramiv(program->global_name, - GL_LINK_STATUS, - &link_status); - - if (link_status == GL_FALSE) { - return false; - } - - program->driver->GetProgramiv(program->global_name, - GL_ACTIVE_UNIFORMS, - &num_active_uniforms); - - program->driver->GetProgramiv(program->global_name, - 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; - - program->driver->GetActiveUniform(program->global_name, - 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->global_name); - continue; - } - - if (program->driver->GetUniformLocation(program->global_name, - uniform_name) == location) { - *type = tmp_type; - res = true; - break; - } - } - - g_free(uniform_name); - - return res; -} - -void yagl_gles2_program_get_uniform_float(struct yagl_gles2_program *program, - GLint location, - GLfloat *params) -{ - program->driver->GetUniformfv(program->global_name, - location, - params); -} - -void yagl_gles2_program_get_uniform_int(struct yagl_gles2_program *program, - GLint location, - GLint *params) -{ - program->driver->GetUniformiv(program->global_name, - location, - params); -} - -void yagl_gles2_program_acquire(struct yagl_gles2_program *program) -{ - if (program) { - yagl_object_acquire(&program->base); - } -} - -void yagl_gles2_program_release(struct yagl_gles2_program *program) -{ - if (program) { - yagl_object_release(&program->base); - } -} diff --git a/hw/yagl_apis/gles2/yagl_gles2_program.h b/hw/yagl_apis/gles2/yagl_gles2_program.h deleted file mode 100644 index aaf3aa4..0000000 --- a/hw/yagl_apis/gles2/yagl_gles2_program.h +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef _QEMU_YAGL_GLES2_PROGRAM_H -#define _QEMU_YAGL_GLES2_PROGRAM_H - -#include "yagl_types.h" -#include "yagl_object.h" - -struct yagl_gles2_driver; -struct yagl_gles2_shader; - -struct yagl_gles2_program -{ - /* - * These members must be exactly as in yagl_gles2_shader - * @{ - */ - struct yagl_object base; - - bool is_shader; - /* - * @} - */ - - struct yagl_gles2_driver *driver; - - yagl_object_name global_name; - - yagl_object_name vertex_shader_local_name; - - yagl_object_name fragment_shader_local_name; -}; - -struct yagl_gles2_program - *yagl_gles2_program_create(struct yagl_gles2_driver *driver); - -bool yagl_gles2_program_attach_shader(struct yagl_gles2_program *program, - struct yagl_gles2_shader *shader, - yagl_object_name shader_local_name); - -bool yagl_gles2_program_detach_shader(struct yagl_gles2_program *program, - struct yagl_gles2_shader *shader, - yagl_object_name shader_local_name); - -void yagl_gles2_program_link(struct yagl_gles2_program *program); - -int yagl_gles2_program_get_attrib_location(struct yagl_gles2_program *program, - const GLchar *name); - -int yagl_gles2_program_get_uniform_location(struct yagl_gles2_program *program, - const GLchar *name); - -void yagl_gles2_program_bind_attrib_location(struct yagl_gles2_program *program, - GLuint index, - const GLchar *name); - -void yagl_gles2_program_get_param(struct yagl_gles2_program *program, - GLenum pname, - GLint *param); - -void yagl_gles2_program_get_active_attrib(struct yagl_gles2_program *program, - GLuint index, - GLsizei bufsize, - GLsizei *length, - GLint *size, - GLenum *type, - GLchar *name); - -void yagl_gles2_program_get_active_uniform(struct yagl_gles2_program *program, - GLuint index, - GLsizei bufsize, - GLsizei *length, - GLint *size, - GLenum *type, - GLchar *name); - -void yagl_gles2_program_get_info_log(struct yagl_gles2_program *program, - GLsizei bufsize, - GLsizei *length, - GLchar *infolog); - -void yagl_gles2_program_validate(struct yagl_gles2_program *program); - -bool yagl_gles2_program_get_uniform_type(struct yagl_gles2_program *program, - GLint location, - GLenum *type); - -void yagl_gles2_program_get_uniform_float(struct yagl_gles2_program *program, - GLint location, - GLfloat *params); - -void yagl_gles2_program_get_uniform_int(struct yagl_gles2_program *program, - GLint location, - GLint *params); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles2_program_acquire(struct yagl_gles2_program *program); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles2_program_release(struct yagl_gles2_program *program); - -#endif diff --git a/hw/yagl_apis/gles2/yagl_gles2_shader.c b/hw/yagl_apis/gles2/yagl_gles2_shader.c deleted file mode 100644 index b59f6b4..0000000 --- a/hw/yagl_apis/gles2/yagl_gles2_shader.c +++ /dev/null @@ -1,281 +0,0 @@ -#include -#include "yagl_gles2_shader.h" -#include "yagl_gles2_driver.h" - -struct yagl_gles2_shader_strtok -{ - char *buffer; - int buffersize; - const char *prev; -}; - -static void yagl_gles2_shader_destroy(struct yagl_ref *ref) -{ - struct yagl_gles2_shader *shader = (struct yagl_gles2_shader*)ref; - - yagl_ensure_ctx(); - shader->driver->DeleteShader(shader->global_name); - yagl_unensure_ctx(); - - yagl_object_cleanup(&shader->base); - - g_free(shader); -} - -struct yagl_gles2_shader - *yagl_gles2_shader_create(struct yagl_gles2_driver *driver, - GLenum type) -{ - GLuint global_name; - struct yagl_gles2_shader *shader; - - global_name = driver->CreateShader(type); - - if (global_name == 0) { - return NULL; - } - - shader = g_malloc0(sizeof(*shader)); - - yagl_object_init(&shader->base, &yagl_gles2_shader_destroy); - - shader->is_shader = true; - shader->driver = driver; - shader->global_name = global_name; - shader->type = type; - - return shader; -} - -static const char *g_delim = " \t\n\r()[]{},;?:/%*&|^!+-=<>"; - -static const char *yagl_gles2_shader_opengl_strtok(struct yagl_gles2_shader_strtok *st, - const char *s, - int *n) -{ - if (!s) { - if (!*(st->prev) || !*n) { - if (st->buffer) { - g_free(st->buffer); - st->buffer = 0; - st->buffersize = -1; - } - st->prev = 0; - return 0; - } - s = st->prev; - } else { - if (st->buffer) { - g_free(st->buffer); - st->buffer = 0; - st->buffersize = -1; - } - st->prev = s; - } - for (; *n && strchr(g_delim, *s); s++, (*n)--) { - if (*s == '/' && *n > 1) { - if (s[1] == '/') { - do { - s++, (*n)--; - } while (*n > 1 && s[1] != '\n' && s[1] != '\r'); - } else if (s[1] == '*') { - do { - s++, (*n)--; - } while (*n > 2 && (s[1] != '*' || s[2] != '/')); - s++, (*n)--; - } - } - } - const char *e = s; - if (s > st->prev) { - s = st->prev; - } else { - for (; *n && *e && !strchr(g_delim, *e); e++, (*n)--); - } - st->prev = e; - if (st->buffersize < e - s) { - st->buffersize = e - s; - if (st->buffer) { - g_free(st->buffer); - } - st->buffer = g_malloc(st->buffersize + 1); - } - /* never return comment fields so caller does not need to handle them */ - char *p = st->buffer; - int m = e - s; - while (m > 0) { - if (*s == '/' && m > 1) { - if (s[1] == '/') { - do { - s++, m--; - } while (m > 1 && s[1] != '\n' && s[1] != '\r'); - s++, m--; - continue; - } else if (s[1] == '*') { - do { - s++, m--; - } while (m > 2 && (s[1] != '*' || s[2] != '/')); - s += 3, m -= 3; - continue; - } - } - *(p++) = *(s++), m--; - } - *p = 0; - return st->buffer; -} - -static char *yagl_gles2_shader_patch(const char *source, - int length, - int *patched_len) -{ - /* DISCLAIMER: this is not a full-blown shader parser but a simple - * implementation which tries to remove the OpenGL ES shader - * "precision" statements and precision qualifiers "lowp", "mediump" - * and "highp" from the specified shader source. It also replaces - * OpenGL ES shading language built-in constants gl_MaxVertexUniformVectors, - * gl_MaxFragmentUniformVectors and gl_MaxVaryingVectors with corresponding - * values from OpenGL shading language. */ - - struct yagl_gles2_shader_strtok st; - char *sp; - - st.buffer = NULL; - st.buffersize = -1; - st.prev = NULL; - - if (!length) { - length = strlen(source); - } - *patched_len = 0; - int patched_size = length; - char *patched = g_malloc(patched_size + 1); - const char *p = yagl_gles2_shader_opengl_strtok(&st, source, &length); - for (; p; p = yagl_gles2_shader_opengl_strtok(&st, 0, &length)) { - if (!strcmp(p, "lowp") || !strcmp(p, "mediump") || !strcmp(p, "highp")) { - continue; - } else if (!strcmp(p, "precision")) { - while ((p = yagl_gles2_shader_opengl_strtok(&st, 0, &length)) && !strchr(p, ';')); - } else { - if (!strcmp(p, "gl_MaxVertexUniformVectors")) { - p = "(gl_MaxVertexUniformComponents / 4)"; - } else if (!strcmp(p, "gl_MaxFragmentUniformVectors")) { - p = "(gl_MaxFragmentUniformComponents / 4)"; - } else if (!strcmp(p, "gl_MaxVaryingVectors")) { - p = "(gl_MaxVaryingFloats / 4)"; - } - int new_len = strlen(p); - if (*patched_len + new_len > patched_size) { - patched_size *= 2; - patched = g_realloc(patched, patched_size + 1); - } - memcpy(patched + *patched_len, p, new_len); - *patched_len += new_len; - } - } - patched[*patched_len] = 0; - /* check that we don't leave dummy preprocessor lines */ - for (sp = patched; *sp;) { - for (; *sp == ' ' || *sp == '\t'; sp++); - if (!strncmp(sp, "#define", 7)) { - for (p = sp + 7; *p == ' ' || *p == '\t'; p++); - if (*p == '\n' || *p == '\r' || *p == '/') { - memset(sp, 0x20, 7); - } - } - for (; *sp && *sp != '\n' && *sp != '\r'; sp++); - for (; *sp == '\n' || *sp == '\r'; sp++); - } - - g_free(st.buffer); - - return patched; -} - -void yagl_gles2_shader_source(struct yagl_gles2_shader *shader, - const GLchar *string) -{ - const GLchar *strings[1]; - GLint patched_len = 0; - GLchar *patched_string = yagl_gles2_shader_patch(string, - strlen(string), - &patched_len); - - /* - * On some GPUs (like Ivybridge Desktop) it's necessary to add - * "#version" directive as the first line of the shader, otherwise - * some of the features might not be available to the shader. - * - * For example, on Ivybridge Desktop, if we don't add the "#version" - * line to the fragment shader then "gl_PointCoord" - * won't be available. - */ - - if (strstr(patched_string, "#version") == NULL) { - patched_len += sizeof("#version 120\n\n"); - char *tmp = g_malloc(patched_len); - strcpy(tmp, "#version 120\n\n"); - strcat(tmp, patched_string); - g_free(patched_string); - patched_string = tmp; - } - - strings[0] = patched_string; - - shader->driver->ShaderSource(shader->global_name, - 1, - strings, - &patched_len); - - g_free(patched_string); -} - -void yagl_gles2_shader_compile(struct yagl_gles2_shader *shader) -{ - shader->driver->CompileShader(shader->global_name); -} - -void yagl_gles2_shader_get_param(struct yagl_gles2_shader *shader, - GLenum pname, - GLint *param) -{ - shader->driver->GetShaderiv(shader->global_name, - pname, - param); -} - -void yagl_gles2_shader_get_source(struct yagl_gles2_shader *shader, - GLsizei bufsize, - GLsizei *length, - GLchar *source) -{ - shader->driver->GetShaderSource(shader->global_name, - bufsize, - length, - source); -} - -void yagl_gles2_shader_get_info_log(struct yagl_gles2_shader *shader, - GLsizei bufsize, - GLsizei *length, - GLchar *infolog) -{ - shader->driver->GetShaderInfoLog(shader->global_name, - bufsize, - length, - infolog); -} - -void yagl_gles2_shader_acquire(struct yagl_gles2_shader *shader) -{ - if (shader) { - yagl_object_acquire(&shader->base); - } -} - -void yagl_gles2_shader_release(struct yagl_gles2_shader *shader) -{ - if (shader) { - yagl_object_release(&shader->base); - } -} diff --git a/hw/yagl_apis/gles2/yagl_gles2_shader.h b/hw/yagl_apis/gles2/yagl_gles2_shader.h deleted file mode 100644 index 9f80187..0000000 --- a/hw/yagl_apis/gles2/yagl_gles2_shader.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef _QEMU_YAGL_GLES2_SHADER_H -#define _QEMU_YAGL_GLES2_SHADER_H - -#include "yagl_types.h" -#include "yagl_object.h" - -/* - * Programs and shaders share the same namespace, - * pretty clumsy! - */ -#define YAGL_NS_SHADER_PROGRAM 4 - -struct yagl_gles2_driver; - -struct yagl_gles2_shader -{ - /* - * These members must be exactly as in yagl_gles2_program - * @{ - */ - struct yagl_object base; - - bool is_shader; - /* - * @} - */ - - struct yagl_gles2_driver *driver; - - yagl_object_name global_name; - - GLenum type; -}; - -struct yagl_gles2_shader - *yagl_gles2_shader_create(struct yagl_gles2_driver *driver, - GLenum type); - -void yagl_gles2_shader_source(struct yagl_gles2_shader *shader, - const GLchar *string); - -void yagl_gles2_shader_compile(struct yagl_gles2_shader *shader); - -void yagl_gles2_shader_get_param(struct yagl_gles2_shader *shader, - GLenum pname, - GLint *param); - -void yagl_gles2_shader_get_source(struct yagl_gles2_shader *shader, - GLsizei bufsize, - GLsizei *length, - GLchar *source); - -void yagl_gles2_shader_get_info_log(struct yagl_gles2_shader *shader, - GLsizei bufsize, - GLsizei *length, - GLchar *infolog); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles2_shader_acquire(struct yagl_gles2_shader *shader); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_gles2_shader_release(struct yagl_gles2_shader *shader); - -#endif diff --git a/hw/yagl_apis/gles2/yagl_gles2_validate.c b/hw/yagl_apis/gles2/yagl_gles2_validate.c deleted file mode 100644 index 454adc5..0000000 --- a/hw/yagl_apis/gles2/yagl_gles2_validate.c +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include "yagl_gles2_validate.h" - -bool yagl_gles2_get_array_param_count(GLenum pname, int *count) -{ - switch (pname) { - 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; - case GL_CURRENT_VERTEX_ATTRIB: *count = 4; break; - default: return false; - } - return true; -} - -bool yagl_gles2_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; - default: return false; - } - return true; -} diff --git a/hw/yagl_apis/gles2/yagl_gles2_validate.h b/hw/yagl_apis/gles2/yagl_gles2_validate.h deleted file mode 100644 index f51089c..0000000 --- a/hw/yagl_apis/gles2/yagl_gles2_validate.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _QEMU_YAGL_GLES2_VALIDATE_H -#define _QEMU_YAGL_GLES2_VALIDATE_H - -#include "yagl_types.h" - -bool yagl_gles2_get_array_param_count(GLenum pname, int *count); - -bool yagl_gles2_get_uniform_type_count(GLenum uniform_type, int *count); - -#endif diff --git a/hw/yagl_apis/gles2/yagl_host_gles2_calls.c b/hw/yagl_apis/gles2/yagl_host_gles2_calls.c deleted file mode 100644 index c710a8a..0000000 --- a/hw/yagl_apis/gles2/yagl_host_gles2_calls.c +++ /dev/null @@ -1,1536 +0,0 @@ -#include "yagl_host_gles2_calls.h" -#include "yagl_apis/gles/yagl_gles_array.h" -#include "yagl_apis/gles/yagl_gles_texture.h" -#include "yagl_apis/gles/yagl_gles_image.h" -#include "yagl_gles2_calls.h" -#include "yagl_gles2_api.h" -#include "yagl_gles2_driver.h" -#include "yagl_gles2_api_ps.h" -#include "yagl_gles2_api_ts.h" -#include "yagl_gles2_context.h" -#include "yagl_gles2_shader.h" -#include "yagl_gles2_program.h" -#include "yagl_gles2_validate.h" -#include "yagl_egl_interface.h" -#include "yagl_tls.h" -#include "yagl_log.h" -#include "yagl_thread.h" -#include "yagl_process.h" -#include "yagl_client_interface.h" -#include "yagl_sharegroup.h" - -#define YAGL_SET_ERR(err) \ - yagl_gles_context_set_error(&ctx->base, err); \ - YAGL_LOG_ERROR("error = 0x%X", err) - -static YAGL_DEFINE_TLS(struct yagl_gles2_api_ts*, gles2_api_ts); - -#define YAGL_GET_CTX_IMPL(func, ret_expr) \ - struct yagl_gles2_context *ctx = \ - (struct yagl_gles2_context*)cur_ts->ps->egl_iface->get_ctx(cur_ts->ps->egl_iface); \ - YAGL_LOG_FUNC_SET(func); \ - if (!ctx || \ - (ctx->base.base.client_api != yagl_client_api_gles2)) { \ - YAGL_LOG_WARN("no current context"); \ - ret_expr; \ - } - -#define YAGL_GET_CTX_RET(func, ret) YAGL_GET_CTX_IMPL(func, return ret) - -#define YAGL_GET_CTX(func) YAGL_GET_CTX_IMPL(func, return) - -#define YAGL_UNIMPLEMENTED_RET(func, ret) \ - YAGL_GET_CTX_RET(func, ret); \ - YAGL_LOG_WARN("NOT IMPLEMENTED!!!"); \ - *retval = ret; \ - return true - -#define YAGL_UNIMPLEMENTED(func) \ - YAGL_GET_CTX(func); \ - YAGL_LOG_WARN("NOT IMPLEMENTED!!!"); \ - return - -static bool yagl_get_array_param(struct yagl_gles_array *array, - GLenum pname, - GLint *param) -{ - switch (pname) { - case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: - *param = array->vbo_local_name; - break; - case GL_VERTEX_ATTRIB_ARRAY_ENABLED: - *param = array->enabled; - break; - case GL_VERTEX_ATTRIB_ARRAY_SIZE: - *param = array->size; - break; - case GL_VERTEX_ATTRIB_ARRAY_STRIDE: - *param = array->stride; - break; - case GL_VERTEX_ATTRIB_ARRAY_TYPE: - *param = array->type; - break; - case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED: - *param = array->normalized; - break; - default: - return false; - } - - return true; -} - -static struct yagl_client_context - *yagl_host_gles2_create_ctx(struct yagl_client_interface *iface, - struct yagl_sharegroup *sg) -{ - struct yagl_gles2_context *ctx = - yagl_gles2_context_create(sg, gles2_api_ts->driver); - - if (!ctx) { - return NULL; - } - - return &ctx->base.base; -} - -static struct yagl_client_image - *yagl_host_gles2_create_image(struct yagl_client_interface *iface, - yagl_object_name tex_global_name, - struct yagl_ref *tex_data) -{ - struct yagl_gles_image *image = - yagl_gles_image_create_from_texture(&gles2_api_ts->driver->base, - tex_global_name, - tex_data); - - return image ? &image->base : NULL; -} - -static yagl_api_func yagl_host_gles2_get_func(struct yagl_api_ps *api_ps, - uint32_t func_id) -{ - if ((func_id <= 0) || (func_id > yagl_gles2_api_num_funcs)) { - return NULL; - } else { - return yagl_gles2_api_funcs[func_id - 1]; - } -} - -static void yagl_host_gles2_thread_init(struct yagl_api_ps *api_ps) -{ - struct yagl_gles2_api_ps *gles2_api_ps = (struct yagl_gles2_api_ps*)api_ps; - - YAGL_LOG_FUNC_ENTER(yagl_host_gles2_thread_init, NULL); - - gles2_api_ts = g_malloc0(sizeof(*gles2_api_ts)); - - yagl_gles2_api_ts_init(gles2_api_ts, gles2_api_ps->driver); - - YAGL_LOG_FUNC_EXIT(NULL); -} - -static void yagl_host_gles2_thread_fini(struct yagl_api_ps *api_ps) -{ - YAGL_LOG_FUNC_ENTER(yagl_host_gles2_thread_fini, NULL); - - yagl_gles2_api_ts_cleanup(gles2_api_ts); - - g_free(gles2_api_ts); - - gles2_api_ts = NULL; - - YAGL_LOG_FUNC_EXIT(NULL); -} - -static void yagl_host_gles2_process_fini(struct yagl_api_ps *api_ps) -{ - struct yagl_gles2_api_ps *gles2_api_ps = (struct yagl_gles2_api_ps*)api_ps; - - yagl_gles2_api_ps_fini(gles2_api_ps); -} - -static void yagl_host_gles2_process_destroy(struct yagl_api_ps *api_ps) -{ - struct yagl_gles2_api_ps *gles2_api_ps = (struct yagl_gles2_api_ps*)api_ps; - - YAGL_LOG_FUNC_ENTER(yagl_host_gles2_process_destroy, NULL); - - yagl_gles2_api_ps_cleanup(gles2_api_ps); - yagl_api_ps_cleanup(&gles2_api_ps->base); - - g_free(gles2_api_ps); - - YAGL_LOG_FUNC_EXIT(NULL); -} - -struct yagl_api_ps *yagl_host_gles2_process_init(struct yagl_api *api) -{ - struct yagl_gles2_api *gles2_api = (struct yagl_gles2_api*)api; - struct yagl_gles2_api_ps *gles2_api_ps; - struct yagl_client_interface *client_iface; - - YAGL_LOG_FUNC_ENTER(yagl_host_gles2_process_init, NULL); - - /* - * Create GLES2 interface. - */ - - client_iface = g_malloc0(sizeof(*client_iface)); - - yagl_client_interface_init(client_iface); - - client_iface->create_ctx = &yagl_host_gles2_create_ctx; - client_iface->create_image = &yagl_host_gles2_create_image; - - /* - * Finally, create API ps. - */ - - gles2_api_ps = g_malloc0(sizeof(*gles2_api_ps)); - - yagl_api_ps_init(&gles2_api_ps->base, api); - - gles2_api_ps->base.thread_init = &yagl_host_gles2_thread_init; - gles2_api_ps->base.get_func = &yagl_host_gles2_get_func; - gles2_api_ps->base.thread_fini = &yagl_host_gles2_thread_fini; - gles2_api_ps->base.fini = &yagl_host_gles2_process_fini; - gles2_api_ps->base.destroy = &yagl_host_gles2_process_destroy; - - yagl_gles2_api_ps_init(gles2_api_ps, gles2_api->driver, client_iface); - - YAGL_LOG_FUNC_EXIT(NULL); - - return &gles2_api_ps->base; -} - -void yagl_host_glAttachShader(GLuint program, - GLuint shader) -{ - struct yagl_gles2_program *program_obj = NULL; - struct yagl_gles2_shader *shader_obj = NULL; - - YAGL_GET_CTX(glAttachShader); - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, shader); - - if (!shader_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (!shader_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - if (!yagl_gles2_program_attach_shader(program_obj, shader_obj, shader)) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - -out: - yagl_gles2_shader_release(shader_obj); - yagl_gles2_program_release(program_obj); -} - -void yagl_host_glBindAttribLocation(GLuint program, - GLuint index, - const GLchar *name, int32_t name_count) -{ - struct yagl_gles2_program *program_obj = NULL; - - YAGL_GET_CTX(glBindAttribLocation); - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - if (name) { - YAGL_LOG_TRACE("binding attrib %s location to %d", name, index); - } - - yagl_gles2_program_bind_attrib_location(program_obj, index, name); - -out: - yagl_gles2_program_release(program_obj); -} - -void yagl_host_glBlendColor(GLclampf red, - GLclampf green, - GLclampf blue, - GLclampf alpha) -{ - YAGL_GET_CTX(glBlendColor); - - ctx->driver->BlendColor(red, green, blue, alpha); -} - -void yagl_host_glCompileShader(GLuint shader) -{ - struct yagl_gles2_shader *shader_obj = NULL; - - YAGL_GET_CTX(glCompileShader); - - shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, shader); - - if (!shader_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (!shader_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - yagl_gles2_shader_compile(shader_obj); - -out: - yagl_gles2_shader_release(shader_obj); -} - -GLuint yagl_host_glCreateProgram(void) -{ - GLuint res = 0; - struct yagl_gles2_program *program = NULL; - - YAGL_GET_CTX_RET(glCreateProgram, 0); - - program = yagl_gles2_program_create(ctx->driver); - - if (!program) { - goto out; - } - - res = yagl_sharegroup_add(ctx->sg, YAGL_NS_SHADER_PROGRAM, &program->base); - -out: - yagl_gles2_program_release(program); - - return res; -} - -GLuint yagl_host_glCreateShader(GLenum type) -{ - GLuint res = 0; - struct yagl_gles2_shader *shader = NULL; - - YAGL_GET_CTX_RET(glCreateShader, 0); - - shader = yagl_gles2_shader_create(ctx->driver, type); - - if (!shader) { - YAGL_SET_ERR(GL_INVALID_ENUM); - goto out; - } - - res = yagl_sharegroup_add(ctx->sg, YAGL_NS_SHADER_PROGRAM, &shader->base); - -out: - yagl_gles2_shader_release(shader); - - return res; -} - -void yagl_host_glDeleteProgram(GLuint program) -{ - struct yagl_gles2_program *program_obj = NULL; - - YAGL_GET_CTX(glDeleteProgram); - - if (program == 0) { - goto out; - } - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - goto out; - } - - yagl_gles2_context_unuse_program(ctx, program); - - yagl_sharegroup_remove_check(ctx->sg, - YAGL_NS_SHADER_PROGRAM, - program, - &program_obj->base); - -out: - yagl_gles2_program_release(program_obj); -} - -void yagl_host_glDeleteShader(GLuint shader) -{ - struct yagl_gles2_shader *shader_obj = NULL; - - YAGL_GET_CTX(glDeleteShader); - - if (shader == 0) { - goto out; - } - - shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, shader); - - if (!shader_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (!shader_obj->is_shader) { - goto out; - } - - yagl_sharegroup_remove_check(ctx->sg, - YAGL_NS_SHADER_PROGRAM, - shader, - &shader_obj->base); - -out: - yagl_gles2_shader_release(shader_obj); -} - -void yagl_host_glDetachShader(GLuint program, - GLuint shader) -{ - struct yagl_gles2_program *program_obj = NULL; - struct yagl_gles2_shader *shader_obj = NULL; - - YAGL_GET_CTX(glDetachShader); - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, shader); - - if (!shader_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (!shader_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - if (!yagl_gles2_program_detach_shader(program_obj, shader_obj, shader)) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - -out: - yagl_gles2_shader_release(shader_obj); - yagl_gles2_program_release(program_obj); -} - -void yagl_host_glDisableVertexAttribArray(GLuint index) -{ - struct yagl_gles_array *array = NULL; - - YAGL_GET_CTX(glDisableVertexAttribArray); - - array = yagl_gles_context_get_array(&ctx->base, index); - - if (!array) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } - - yagl_gles_array_enable(array, false); - - ctx->driver->DisableVertexAttribArray(index); -} - -void yagl_host_glEnableVertexAttribArray(GLuint index) -{ - struct yagl_gles_array *array = NULL; - - YAGL_GET_CTX(glEnableVertexAttribArray); - - array = yagl_gles_context_get_array(&ctx->base, index); - - if (!array) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } - - yagl_gles_array_enable(array, true); - - ctx->driver->EnableVertexAttribArray(index); -} - -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; - struct yagl_gles2_program *program_obj = NULL; - - YAGL_GET_CTX(glGetActiveAttrib); - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - yagl_gles2_program_get_active_attrib(program_obj, - index, - name_maxcount, - &tmp, - size, - type, - name); - - if (tmp >= 0) { - YAGL_LOG_TRACE("got active attrib: size = %d, type = %u, name = %s", - (size ? *size : -1), (type ? *type : -1), name); - *name_count = tmp + 1; - } - -out: - yagl_gles2_program_release(program_obj); -} - -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; - struct yagl_gles2_program *program_obj = NULL; - - YAGL_GET_CTX(glGetActiveUniform); - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - yagl_gles2_program_get_active_uniform(program_obj, - index, - name_maxcount, - &tmp, - size, - type, - name); - - if (tmp >= 0) { - YAGL_LOG_TRACE("got active uniform: size = %d, type = %u, name = %s", - (size ? *size : -1), (type ? *type : -1), name); - *name_count = tmp + 1; - } - -out: - yagl_gles2_program_release(program_obj); -} - -void yagl_host_glGetAttachedShaders(GLuint program, - GLuint *shaders, int32_t shaders_maxcount, int32_t *shaders_count) -{ - struct yagl_gles2_program *program_obj = NULL; - - YAGL_GET_CTX(glGetAttachedShaders); - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - if (shaders_maxcount < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->vertex_shader_local_name != 0) { - if (*shaders_count < shaders_maxcount) { - if (shaders) { - shaders[*shaders_count] = program_obj->vertex_shader_local_name; - } - ++*shaders_count; - } - } - - if (program_obj->fragment_shader_local_name != 0) { - if (*shaders_count < shaders_maxcount) { - if (shaders) { - shaders[*shaders_count] = program_obj->fragment_shader_local_name; - } - ++*shaders_count; - } - } - -out: - yagl_gles2_program_release(program_obj); -} - -int yagl_host_glGetAttribLocation(GLuint program, - const GLchar *name, int32_t name_count) -{ - int res = 0; - struct yagl_gles2_program *program_obj = NULL; - - YAGL_GET_CTX_RET(glGetAttribLocation, 0); - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - res = yagl_gles2_program_get_attrib_location(program_obj, name); - -out: - yagl_gles2_program_release(program_obj); - - return res; -} - -void yagl_host_glGetProgramiv(GLuint program, - GLenum pname, - GLint *param) -{ - struct yagl_gles2_program *program_obj = NULL; - - YAGL_GET_CTX(glGetProgramiv); - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - yagl_gles2_program_get_param(program_obj, pname, param); - -out: - yagl_gles2_program_release(program_obj); -} - -void yagl_host_glGetProgramInfoLog(GLuint program, - GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count) -{ - GLsizei tmp = -1; - struct yagl_gles2_program *program_obj = NULL; - - YAGL_GET_CTX(glGetProgramInfoLog); - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - if (infolog_maxcount < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - yagl_gles2_program_get_info_log(program_obj, infolog_maxcount, &tmp, infolog); - - if (tmp >= 0) { - *infolog_count = tmp + 1; - } - -out: - yagl_gles2_program_release(program_obj); -} - -void yagl_host_glGetShaderiv(GLuint shader, - GLenum pname, - GLint *param) -{ - struct yagl_gles2_shader *shader_obj = NULL; - - YAGL_GET_CTX(glGetShaderiv); - - shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, shader); - - if (!shader_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (!shader_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - yagl_gles2_shader_get_param(shader_obj, pname, param); - -out: - yagl_gles2_shader_release(shader_obj); -} - -void yagl_host_glGetShaderInfoLog(GLuint shader, - GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count) -{ - GLsizei tmp = -1; - struct yagl_gles2_shader *shader_obj = NULL; - - YAGL_GET_CTX(glGetShaderInfoLog); - - shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, shader); - - if (!shader_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (!shader_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - if (infolog_maxcount < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - yagl_gles2_shader_get_info_log(shader_obj, infolog_maxcount, &tmp, infolog); - - if (tmp >= 0) { - *infolog_count = tmp + 1; - } - -out: - yagl_gles2_shader_release(shader_obj); -} - -void yagl_host_glGetShaderPrecisionFormat(GLenum shadertype, - GLenum precisiontype, - GLint *range, int32_t range_maxcount, int32_t *range_count, - GLint *precision) -{ - YAGL_GET_CTX(glGetShaderPrecisionFormat); - - switch (precisiontype) { - case GL_LOW_INT: - case GL_MEDIUM_INT: - case GL_HIGH_INT: - if (range) { - range[0] = range[1] = 16; - *range_count = 2; - } - if (precision) { - *precision = 0; - } - break; - case GL_LOW_FLOAT: - case GL_MEDIUM_FLOAT: - case GL_HIGH_FLOAT: - if (range) { - range[0] = range[1] = 127; - *range_count = 2; - } - if (precision) { - *precision = 24; - } - break; - default: - YAGL_SET_ERR(GL_INVALID_ENUM); - break; - } -} - -void yagl_host_glGetShaderSource(GLuint shader, - GLchar *source, int32_t source_maxcount, int32_t *source_count) -{ - GLsizei tmp = -1; - struct yagl_gles2_shader *shader_obj = NULL; - - YAGL_GET_CTX(glGetShaderSource); - - shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, shader); - - if (!shader_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (!shader_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - if (source_maxcount < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - yagl_gles2_shader_get_source(shader_obj, source_maxcount, &tmp, source); - - if (tmp >= 0) { - *source_count = tmp + 1; - } - -out: - yagl_gles2_shader_release(shader_obj); -} - -void yagl_host_glGetUniformfv(GLuint program, - GLint location, - GLfloat *params, int32_t params_maxcount, int32_t *params_count) -{ - struct yagl_gles2_program *program_obj = NULL; - GLenum type; - - YAGL_GET_CTX(glGetUniformfv); - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - if (!yagl_gles2_program_get_uniform_type(program_obj, - location, - &type)) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - if (!yagl_gles2_get_uniform_type_count(type, params_count)) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - yagl_gles2_program_get_uniform_float(program_obj, location, params); - -out: - yagl_gles2_program_release(program_obj); -} - -void yagl_host_glGetUniformiv(GLuint program, - GLint location, - GLint *params, int32_t params_maxcount, int32_t *params_count) -{ - struct yagl_gles2_program *program_obj = NULL; - GLenum type; - - YAGL_GET_CTX(glGetUniformiv); - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - if (!yagl_gles2_program_get_uniform_type(program_obj, - location, - &type)) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - if (!yagl_gles2_get_uniform_type_count(type, params_count)) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - yagl_gles2_program_get_uniform_int(program_obj, location, params); - -out: - yagl_gles2_program_release(program_obj); -} - -int yagl_host_glGetUniformLocation(GLuint program, - const GLchar *name, int32_t name_count) -{ - int res = 0; - struct yagl_gles2_program *program_obj = NULL; - - YAGL_GET_CTX_RET(glGetUniformLocation, 0); - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - if (name) { - YAGL_LOG_TRACE("getting uniform %s location", name); - } - - res = yagl_gles2_program_get_uniform_location(program_obj, name); - -out: - yagl_gles2_program_release(program_obj); - - return res; -} - -void yagl_host_glGetVertexAttribfv(GLuint index, - GLenum pname, - GLfloat *params, int32_t params_maxcount, int32_t *params_count) -{ - struct yagl_gles_array *array = NULL; - GLint param = 0; - - YAGL_GET_CTX(glGetVertexAttribfv); - - array = yagl_gles_context_get_array(&ctx->base, index); - - if (!array) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } - - if (!yagl_gles2_get_array_param_count(pname, params_count)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (yagl_get_array_param(array, pname, ¶m)) { - params[0] = param; - } else { - ctx->driver->GetVertexAttribfv(index, pname, params); - } -} - -void yagl_host_glGetVertexAttribiv(GLuint index, - GLenum pname, - GLint *params, int32_t params_maxcount, int32_t *params_count) -{ - struct yagl_gles_array *array = NULL; - - YAGL_GET_CTX(glGetVertexAttribiv); - - array = yagl_gles_context_get_array(&ctx->base, index); - - if (!array) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } - - if (!yagl_gles2_get_array_param_count(pname, params_count)) { - YAGL_SET_ERR(GL_INVALID_ENUM); - return; - } - - if (!yagl_get_array_param(array, pname, params)) { - ctx->driver->GetVertexAttribiv(index, pname, params); - } -} - -void yagl_host_glGetVertexAttribPointerv(GLuint index, - GLenum pname, - target_ulong *pointer) -{ - struct yagl_gles_array *array = NULL; - target_ulong tmp = 0; - - YAGL_GET_CTX(glGetVertexAttribPointerv); - - array = yagl_gles_context_get_array(&ctx->base, index); - - if (!array) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } - - if (array->vbo) { - tmp = array->offset; - } else { - tmp = array->target_data; - } - - if (pointer) { - *pointer = tmp; - } -} - -GLboolean yagl_host_glIsProgram(GLuint program) -{ - GLboolean res = GL_FALSE; - struct yagl_gles2_program *program_obj = NULL; - - YAGL_GET_CTX_RET(glIsProgram, GL_FALSE); - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (program_obj) { - res = program_obj->is_shader ? GL_FALSE : GL_TRUE; - } - - yagl_gles2_program_release(program_obj); - - return res; -} - -GLboolean yagl_host_glIsShader(GLuint shader) -{ - GLboolean res = GL_FALSE; - struct yagl_gles2_shader *shader_obj = NULL; - - YAGL_GET_CTX_RET(glIsShader, GL_FALSE); - - shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, shader); - - if (shader_obj) { - res = shader_obj->is_shader ? GL_TRUE : GL_FALSE; - } - - yagl_gles2_shader_release(shader_obj); - - return res; -} - -void yagl_host_glLinkProgram(GLuint program) -{ - struct yagl_gles2_program *program_obj = NULL; - - YAGL_GET_CTX(glLinkProgram); - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - yagl_gles2_program_link(program_obj); - -out: - yagl_gles2_program_release(program_obj); -} - -void yagl_host_glReleaseShaderCompiler(void) -{ - YAGL_GET_CTX(glReleaseShaderCompiler); - - /* - * No-op. - */ -} - -void yagl_host_glShaderBinary(const GLuint *shaders, int32_t shaders_count, - GLenum binaryformat, - const GLvoid *binary, int32_t binary_count) -{ - /* - * Don't allow to load precompiled shaders. - */ - - YAGL_UNIMPLEMENTED(glShaderBinary); -} - -void yagl_host_glShaderSource(GLuint shader, - const GLchar *string, int32_t string_count) -{ - struct yagl_gles2_shader *shader_obj = NULL; - - YAGL_GET_CTX(glShaderSource); - - if (string_count < 0) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, shader); - - if (!shader_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (!shader_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - if (!string) { - goto out; - } - - YAGL_LOG_TRACE("string 0 = %s", string); - - yagl_gles2_shader_source(shader_obj, string); - -out: - yagl_gles2_shader_release(shader_obj); -} - -void yagl_host_glStencilFuncSeparate(GLenum face, - GLenum func, - GLint ref, - GLuint mask) -{ - YAGL_GET_CTX(glStencilFuncSeparate); - - ctx->driver->StencilFuncSeparate(face, func, ref, mask); -} - -void yagl_host_glStencilMaskSeparate(GLenum face, - GLuint mask) -{ - YAGL_GET_CTX(glStencilMaskSeparate); - - ctx->driver->StencilMaskSeparate(face, mask); -} - -void yagl_host_glStencilOpSeparate(GLenum face, - GLenum fail, - GLenum zfail, - GLenum zpass) -{ - YAGL_GET_CTX(glStencilOpSeparate); - - ctx->driver->StencilOpSeparate(face, fail, zfail, zpass); -} - -void yagl_host_glUniform1f(GLint location, - GLfloat x) -{ - YAGL_GET_CTX(glUniform1f); - - ctx->driver->Uniform1f(location, x); -} - -void yagl_host_glUniform1fv(GLint location, - const GLfloat *v, int32_t v_count) -{ - - YAGL_GET_CTX(glUniform1fv); - - ctx->driver->Uniform1fv(location, v_count, v); -} - -void yagl_host_glUniform1i(GLint location, - GLint x) -{ - YAGL_GET_CTX(glUniform1i); - - ctx->driver->Uniform1i(location, x); -} - -void yagl_host_glUniform1iv(GLint location, - const GLint *v, int32_t v_count) -{ - YAGL_GET_CTX(glUniform1iv); - - ctx->driver->Uniform1iv(location, v_count, v); -} - -void yagl_host_glUniform2f(GLint location, - GLfloat x, - GLfloat y) -{ - YAGL_GET_CTX(glUniform2f); - - ctx->driver->Uniform2f(location, x, y); -} - -void yagl_host_glUniform2fv(GLint location, - const GLfloat *v, int32_t v_count) -{ - YAGL_GET_CTX(glUniform2fv); - - ctx->driver->Uniform2fv(location, (v_count / 2), v); -} - -void yagl_host_glUniform2i(GLint location, - GLint x, - GLint y) -{ - YAGL_GET_CTX(glUniform2i); - - ctx->driver->Uniform2i(location, x, y); -} - -void yagl_host_glUniform2iv(GLint location, - const GLint *v, int32_t v_count) -{ - YAGL_GET_CTX(glUniform2iv); - - ctx->driver->Uniform2iv(location, (v_count / 2), v); -} - -void yagl_host_glUniform3f(GLint location, - GLfloat x, - GLfloat y, - GLfloat z) -{ - YAGL_GET_CTX(glUniform3f); - - ctx->driver->Uniform3f(location, x, y, z); -} - -void yagl_host_glUniform3fv(GLint location, - const GLfloat *v, int32_t v_count) -{ - YAGL_GET_CTX(glUniform3fv); - - ctx->driver->Uniform3fv(location, (v_count / 3), v); -} - -void yagl_host_glUniform3i(GLint location, - GLint x, - GLint y, - GLint z) -{ - YAGL_GET_CTX(glUniform3i); - - ctx->driver->Uniform3i(location, x, y, z); -} - -void yagl_host_glUniform3iv(GLint location, - const GLint *v, int32_t v_count) -{ - YAGL_GET_CTX(glUniform3iv); - - ctx->driver->Uniform3iv(location, (v_count / 3), v); -} - -void yagl_host_glUniform4f(GLint location, - GLfloat x, - GLfloat y, - GLfloat z, - GLfloat w) -{ - YAGL_GET_CTX(glUniform4f); - - ctx->driver->Uniform4f(location, x, y, z, w); -} - -void yagl_host_glUniform4fv(GLint location, - const GLfloat *v, int32_t v_count) -{ - YAGL_GET_CTX(glUniform4fv); - - ctx->driver->Uniform4fv(location, (v_count / 4), v); -} - -void yagl_host_glUniform4i(GLint location, - GLint x, - GLint y, - GLint z, - GLint w) -{ - YAGL_GET_CTX(glUniform4i); - - ctx->driver->Uniform4i(location, x, y, z, w); -} - -void yagl_host_glUniform4iv(GLint location, - const GLint *v, int32_t v_count) -{ - YAGL_GET_CTX(glUniform4iv); - - ctx->driver->Uniform4iv(location, (v_count / 4), v); -} - -void yagl_host_glUniformMatrix2fv(GLint location, - GLboolean transpose, - const GLfloat *value, int32_t value_count) -{ - YAGL_GET_CTX(glUniformMatrix2fv); - - ctx->driver->UniformMatrix2fv(location, value_count / (2 * 2), transpose, value); -} - -void yagl_host_glUniformMatrix3fv(GLint location, - GLboolean transpose, - const GLfloat *value, int32_t value_count) -{ - YAGL_GET_CTX(glUniformMatrix3fv); - - ctx->driver->UniformMatrix3fv(location, value_count / (3 * 3), transpose, value); -} - -void yagl_host_glUniformMatrix4fv(GLint location, - GLboolean transpose, - const GLfloat *value, int32_t value_count) -{ - YAGL_GET_CTX(glUniformMatrix4fv); - - ctx->driver->UniformMatrix4fv(location, value_count / (4 * 4), transpose, value); -} - -void yagl_host_glUseProgram(GLuint program) -{ - struct yagl_gles2_program *program_obj = NULL; - - YAGL_GET_CTX(glUseProgram); - - if (program != 0) { - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - } - - yagl_gles2_context_use_program(ctx, program); - - ctx->driver->UseProgram((program_obj ? program_obj->global_name : 0)); - -out: - yagl_gles2_program_release(program_obj); -} - -void yagl_host_glValidateProgram(GLuint program) -{ - struct yagl_gles2_program *program_obj = NULL; - - YAGL_GET_CTX(glValidateProgram); - - program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg, - YAGL_NS_SHADER_PROGRAM, program); - - if (!program_obj) { - YAGL_SET_ERR(GL_INVALID_VALUE); - goto out; - } - - if (program_obj->is_shader) { - YAGL_SET_ERR(GL_INVALID_OPERATION); - goto out; - } - - yagl_gles2_program_validate(program_obj); - -out: - yagl_gles2_program_release(program_obj); -} - -void yagl_host_glVertexAttrib1f(GLuint indx, - GLfloat x) -{ - YAGL_GET_CTX(glVertexAttrib1f); - - ctx->driver->VertexAttrib1f(indx, x); -} - -void yagl_host_glVertexAttrib1fv(GLuint indx, - const GLfloat *values, int32_t values_count) -{ - YAGL_GET_CTX(glVertexAttrib1fv); - - ctx->driver->VertexAttrib1fv(indx, values); -} - -void yagl_host_glVertexAttrib2f(GLuint indx, - GLfloat x, - GLfloat y) -{ - YAGL_GET_CTX(glVertexAttrib2f); - - ctx->driver->VertexAttrib2f(indx, x, y); -} - -void yagl_host_glVertexAttrib2fv(GLuint indx, - const GLfloat *values, int32_t values_count) -{ - YAGL_GET_CTX(glVertexAttrib2fv); - - ctx->driver->VertexAttrib2fv(indx, values); -} - -void yagl_host_glVertexAttrib3f(GLuint indx, - GLfloat x, - GLfloat y, - GLfloat z) -{ - YAGL_GET_CTX(glVertexAttrib3f); - - ctx->driver->VertexAttrib3f(indx, x, y, z); -} - -void yagl_host_glVertexAttrib3fv(GLuint indx, - const GLfloat *values, int32_t values_count) -{ - YAGL_GET_CTX(glVertexAttrib3fv); - - ctx->driver->VertexAttrib3fv(indx, values); -} - -void yagl_host_glVertexAttrib4f(GLuint indx, - GLfloat x, - GLfloat y, - GLfloat z, - GLfloat w) -{ - YAGL_GET_CTX(glVertexAttrib4f); - - ctx->driver->VertexAttrib4f(indx, x, y, z, w); -} - -void yagl_host_glVertexAttrib4fv(GLuint indx, - const GLfloat *values, int32_t values_count) -{ - YAGL_GET_CTX(glVertexAttrib4fv); - - ctx->driver->VertexAttrib4fv(indx, values); -} - -void yagl_host_glVertexAttribPointer(GLuint indx, - GLint size, - GLenum type, - GLboolean normalized, - GLsizei stride, - target_ulong ptr) -{ - struct yagl_gles_array *array = NULL; - - YAGL_GET_CTX(glVertexAttribPointer); - - array = yagl_gles_context_get_array(&ctx->base, indx); - - if (!array) { - YAGL_SET_ERR(GL_INVALID_VALUE); - return; - } - - if (ctx->base.vbo) { - if (!yagl_gles_array_update_vbo(array, - size, - type, - false, - normalized, - stride, - ctx->base.vbo, - ctx->base.vbo_local_name, - ptr)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } - } else { - if (!yagl_gles_array_update(array, - size, - type, - false, - normalized, - stride, - ptr)) { - YAGL_SET_ERR(GL_INVALID_VALUE); - } - } -} diff --git a/hw/yagl_apis/gles2/yagl_host_gles2_calls.h b/hw/yagl_apis/gles2/yagl_host_gles2_calls.h deleted file mode 100644 index 9d190a2..0000000 --- a/hw/yagl_apis/gles2/yagl_host_gles2_calls.h +++ /dev/null @@ -1,178 +0,0 @@ -#ifndef _QEMU_YAGL_HOST_GLES2_CALLS_H -#define _QEMU_YAGL_HOST_GLES2_CALLS_H - -#include "yagl_api.h" -#include -#include "yagl_apis/gles/yagl_host_gles_calls.h" - -struct yagl_api_ps *yagl_host_gles2_process_init(struct yagl_api *api); - -void yagl_host_glAttachShader(GLuint program, - GLuint shader); -void yagl_host_glBindAttribLocation(GLuint program, - GLuint index, - const GLchar *name, int32_t name_count); -void yagl_host_glBlendColor(GLclampf red, - GLclampf green, - GLclampf blue, - GLclampf alpha); -void yagl_host_glCompileShader(GLuint shader); -GLuint yagl_host_glCreateProgram(void); -GLuint yagl_host_glCreateShader(GLenum type); -void yagl_host_glDeleteProgram(GLuint program); -void yagl_host_glDeleteShader(GLuint shader); -void yagl_host_glDetachShader(GLuint program, - GLuint shader); -void yagl_host_glDisableVertexAttribArray(GLuint index); -void yagl_host_glEnableVertexAttribArray(GLuint index); -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_glGetActiveUniform(GLuint program, - GLuint index, - GLint *size, - GLenum *type, - GLchar *name, int32_t name_maxcount, int32_t *name_count); -void yagl_host_glGetAttachedShaders(GLuint program, - GLuint *shaders, int32_t shaders_maxcount, int32_t *shaders_count); -int yagl_host_glGetAttribLocation(GLuint program, - const GLchar *name, int32_t name_count); -void yagl_host_glGetProgramiv(GLuint program, - GLenum pname, - GLint *param); -void 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); -void yagl_host_glGetShaderInfoLog(GLuint shader, - GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count); -void yagl_host_glGetShaderPrecisionFormat(GLenum shadertype, - GLenum precisiontype, - GLint *range, int32_t range_maxcount, int32_t *range_count, - GLint *precision); -void yagl_host_glGetShaderSource(GLuint shader, - GLchar *source, int32_t source_maxcount, int32_t *source_count); -void yagl_host_glGetUniformfv(GLuint program, - GLint location, - GLfloat *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetUniformiv(GLuint program, - GLint 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_glGetVertexAttribPointerv(GLuint index, - GLenum pname, - target_ulong *pointer); -GLboolean yagl_host_glIsProgram(GLuint program); -GLboolean yagl_host_glIsShader(GLuint shader); -void yagl_host_glLinkProgram(GLuint program); -void yagl_host_glReleaseShaderCompiler(void); -void yagl_host_glShaderBinary(const GLuint *shaders, int32_t shaders_count, - GLenum binaryformat, - const GLvoid *binary, int32_t binary_count); -void yagl_host_glShaderSource(GLuint shader, - const GLchar *string, int32_t string_count); -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_glUniform1f(GLint location, - GLfloat x); -void yagl_host_glUniform1fv(GLint location, - const GLfloat *v, int32_t v_count); -void yagl_host_glUniform1i(GLint location, - GLint x); -void yagl_host_glUniform1iv(GLint location, - const GLint *v, int32_t v_count); -void yagl_host_glUniform2f(GLint location, - GLfloat x, - GLfloat y); -void yagl_host_glUniform2fv(GLint location, - const GLfloat *v, int32_t v_count); -void yagl_host_glUniform2i(GLint location, - GLint x, - GLint y); -void yagl_host_glUniform2iv(GLint location, - const GLint *v, int32_t v_count); -void yagl_host_glUniform3f(GLint location, - GLfloat x, - GLfloat y, - GLfloat z); -void yagl_host_glUniform3fv(GLint location, - const GLfloat *v, int32_t v_count); -void yagl_host_glUniform3i(GLint location, - GLint x, - GLint y, - GLint z); -void yagl_host_glUniform3iv(GLint location, - const GLint *v, int32_t v_count); -void yagl_host_glUniform4f(GLint location, - GLfloat x, - GLfloat y, - GLfloat z, - GLfloat w); -void yagl_host_glUniform4fv(GLint location, - const GLfloat *v, int32_t v_count); -void yagl_host_glUniform4i(GLint location, - GLint x, - GLint y, - GLint z, - GLint w); -void yagl_host_glUniform4iv(GLint location, - const GLint *v, int32_t v_count); -void yagl_host_glUniformMatrix2fv(GLint location, - GLboolean transpose, - const GLfloat *value, int32_t value_count); -void yagl_host_glUniformMatrix3fv(GLint location, - GLboolean transpose, - const GLfloat *value, int32_t value_count); -void yagl_host_glUniformMatrix4fv(GLint 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_glVertexAttribPointer(GLuint indx, - GLint size, - GLenum type, - GLboolean normalized, - GLsizei stride, - target_ulong ptr); - -#endif diff --git a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen.c b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen.c index dc76056..1ccf98a 100644 --- a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen.c +++ b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen.c @@ -1,3 +1,4 @@ +#include #include "yagl_egl_offscreen.h" #include "yagl_egl_offscreen_display.h" #include "yagl_egl_offscreen_context.h" @@ -15,9 +16,43 @@ static void yagl_egl_offscreen_thread_init(struct yagl_egl_backend *backend) 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; @@ -43,15 +78,17 @@ static bool yagl_egl_offscreen_make_current(struct yagl_egl_backend *backend, YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_make_current, NULL); if (draw && read) { - res = egl_offscreen->driver->make_current(egl_offscreen->driver, - egl_offscreen_dpy->native_dpy, - egl_offscreen_draw->native_sfc, - egl_offscreen_read->native_sfc, - egl_offscreen_ctx->native_ctx); + 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 { /* @@ -79,15 +116,17 @@ static bool yagl_egl_offscreen_release_current(struct yagl_egl_backend *backend, return false; } - res = egl_offscreen->driver->make_current(egl_offscreen->driver, - egl_offscreen_ts->dpy->native_dpy, - EGL_NO_SURFACE, - EGL_NO_SURFACE, - EGL_NO_CONTEXT); + 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); @@ -100,7 +139,7 @@ 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 = NULL; + egl_offscreen_ts = cur_ts->egl_offscreen_ts = NULL; YAGL_LOG_FUNC_EXIT(NULL); } @@ -113,11 +152,11 @@ static void yagl_egl_offscreen_ensure_current(struct yagl_egl_backend *backend) return; } - egl_offscreen->driver->make_current(egl_offscreen->driver, - egl_offscreen->ensure_dpy, - egl_offscreen->ensure_sfc, - egl_offscreen->ensure_sfc, - egl_offscreen->ensure_ctx); + 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) @@ -128,11 +167,11 @@ static void yagl_egl_offscreen_unensure_current(struct yagl_egl_backend *backend return; } - egl_offscreen->driver->make_current(egl_offscreen->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->ensure_dpy, + EGL_NO_SURFACE, + EGL_NO_SURFACE, + EGL_NO_CONTEXT); } static void yagl_egl_offscreen_destroy(struct yagl_egl_backend *backend) @@ -141,23 +180,24 @@ static void yagl_egl_offscreen_destroy(struct yagl_egl_backend *backend) YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_destroy, NULL); - egl_offscreen->driver->context_destroy(egl_offscreen->driver, - egl_offscreen->ensure_dpy, - egl_offscreen->global_ctx); - egl_offscreen->driver->context_destroy(egl_offscreen->driver, - egl_offscreen->ensure_dpy, - egl_offscreen->ensure_ctx); - egl_offscreen->driver->pbuffer_surface_destroy(egl_offscreen->driver, - egl_offscreen->ensure_dpy, - egl_offscreen->ensure_sfc); - egl_offscreen->driver->config_cleanup(egl_offscreen->driver, - egl_offscreen->ensure_dpy, - &egl_offscreen->ensure_config); - egl_offscreen->driver->display_close(egl_offscreen->driver, - egl_offscreen->ensure_dpy); - - egl_offscreen->driver->destroy(egl_offscreen->driver); - egl_offscreen->driver = 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); @@ -166,7 +206,8 @@ static void yagl_egl_offscreen_destroy(struct yagl_egl_backend *backend) YAGL_LOG_FUNC_EXIT(NULL); } -struct yagl_egl_backend *yagl_egl_offscreen_create(struct yagl_egl_driver *driver) +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; @@ -183,49 +224,50 @@ struct yagl_egl_backend *yagl_egl_offscreen_create(struct yagl_egl_driver *drive yagl_egl_backend_init(&egl_offscreen->base, yagl_render_type_offscreen); - dpy = driver->display_open(driver); + dpy = egl_driver->display_open(egl_driver); if (!dpy) { goto fail; } - configs = driver->config_enum(driver, dpy, &num_configs); + configs = egl_driver->config_enum(egl_driver, dpy, &num_configs); if (!configs || (num_configs <= 0)) { goto fail; } - sfc = driver->pbuffer_surface_create(driver, dpy, &configs[0], - 1, 1, &attribs); + sfc = egl_driver->pbuffer_surface_create(egl_driver, dpy, &configs[0], + 1, 1, &attribs); if (sfc == EGL_NO_SURFACE) { goto fail; } - ctx = driver->context_create(driver, dpy, &configs[0], - yagl_client_api_gles2, NULL); + ctx = egl_driver->context_create(egl_driver, dpy, &configs[0], NULL); if (ctx == EGL_NO_CONTEXT) { goto fail; } - global_ctx = driver->context_create(driver, dpy, &configs[0], - yagl_client_api_gles2, ctx); + 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->driver = driver; + 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; @@ -233,7 +275,7 @@ struct yagl_egl_backend *yagl_egl_offscreen_create(struct yagl_egl_driver *drive egl_offscreen->global_ctx = global_ctx; for (i = 1; i < num_configs; ++i) { - driver->config_cleanup(driver, dpy, &configs[i]); + egl_driver->config_cleanup(egl_driver, dpy, &configs[i]); } g_free(configs); @@ -243,22 +285,22 @@ struct yagl_egl_backend *yagl_egl_offscreen_create(struct yagl_egl_driver *drive fail: if (ctx != EGL_NO_CONTEXT) { - driver->context_destroy(driver, dpy, ctx); + egl_driver->context_destroy(egl_driver, dpy, ctx); } if (sfc != EGL_NO_SURFACE) { - driver->pbuffer_surface_destroy(driver, dpy, sfc); + egl_driver->pbuffer_surface_destroy(egl_driver, dpy, sfc); } if (configs) { for (i = 0; i < num_configs; ++i) { - driver->config_cleanup(driver, dpy, &configs[i]); + egl_driver->config_cleanup(egl_driver, dpy, &configs[i]); } g_free(configs); } if (dpy) { - driver->display_close(driver, dpy); + egl_driver->display_close(egl_driver, dpy); } yagl_egl_backend_cleanup(&egl_offscreen->base); diff --git a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen.h b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen.h index e13f1bc..9d91fe9 100644 --- a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen.h +++ b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen.h @@ -5,11 +5,15 @@ #include "yagl_egl_driver.h" #include "yagl_egl_native_config.h" +struct yagl_gles_driver; + struct yagl_egl_offscreen { struct yagl_egl_backend base; - struct yagl_egl_driver *driver; + struct yagl_egl_driver *egl_driver; + + struct yagl_gles_driver *gles_driver; /* * Display, config, context and surface which'll be used @@ -31,8 +35,9 @@ struct yagl_egl_offscreen }; /* - * Takes ownership of 'driver' + * Takes ownership of 'egl_driver' */ -struct yagl_egl_backend *yagl_egl_offscreen_create(struct yagl_egl_driver *driver); +struct yagl_egl_backend *yagl_egl_offscreen_create(struct yagl_egl_driver *egl_driver, + struct yagl_gles_driver *gles_driver); #endif diff --git a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.c b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.c index 3b231b5..1357abe 100644 --- a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.c +++ b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.c @@ -1,8 +1,9 @@ +#include #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_client_context.h" +#include "yagl_gles_driver.h" #include "yagl_log.h" #include "yagl_tls.h" #include "yagl_process.h" @@ -19,9 +20,15 @@ static void yagl_egl_offscreen_context_destroy(struct yagl_eglb_context *ctx) YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_context_destroy, NULL); - egl_offscreen->driver->context_destroy(egl_offscreen->driver, - dpy->native_dpy, - egl_offscreen_ctx->native_ctx); + if (egl_offscreen_ctx->rp_pbo) { + yagl_ensure_ctx(); + egl_offscreen->gles_driver->DeleteBuffers(1, &egl_offscreen_ctx->rp_pbo); + yagl_unensure_ctx(); + } + + egl_offscreen->egl_driver->context_destroy(egl_offscreen->egl_driver, + dpy->native_dpy, + egl_offscreen_ctx->native_ctx); yagl_eglb_context_cleanup(ctx); @@ -33,7 +40,6 @@ static void yagl_egl_offscreen_context_destroy(struct yagl_eglb_context *ctx) 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_client_context *client_ctx, struct yagl_egl_offscreen_context *share_context) { struct yagl_egl_offscreen *egl_offscreen = @@ -46,11 +52,10 @@ struct yagl_egl_offscreen_context dpy, cfg->config_id); - native_ctx = egl_offscreen->driver->context_create( - egl_offscreen->driver, + native_ctx = egl_offscreen->egl_driver->context_create( + egl_offscreen->egl_driver, dpy->native_dpy, cfg, - client_ctx->client_api, egl_offscreen->global_ctx); if (!native_ctx) { @@ -60,7 +65,7 @@ struct yagl_egl_offscreen_context ctx = g_malloc0(sizeof(*ctx)); - yagl_eglb_context_init(&ctx->base, &dpy->base, client_ctx); + yagl_eglb_context_init(&ctx->base, &dpy->base); ctx->base.destroy = &yagl_egl_offscreen_context_destroy; @@ -70,3 +75,136 @@ struct yagl_egl_offscreen_context 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; + GLuint current_pbo = 0; + uint32_t rp_line_size = width * bpp; + uint32_t rp_size = rp_line_size * height; + GLenum format = 0; + bool pop_attrib = false; + 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->GetIntegerv(GL_FRAMEBUFFER_BINDING, + (GLint*)¤t_fb); + + gles_driver->BindFramebuffer(GL_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; + } + + gles_driver->PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); + + pop_attrib = true; + + gles_driver->PixelStorei(GL_PACK_ALIGNMENT, + ((bpp == 4) ? 4 : 1)); + + gles_driver->ReadPixels(0, 0, + width, height, format, GL_UNSIGNED_BYTE, + 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; + + 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); + } + if (pop_attrib) { + gles_driver->PopClientAttrib(); + } + 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_FRAMEBUFFER, current_fb); + + YAGL_LOG_FUNC_EXIT(NULL); + + return ret; +} diff --git a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.h b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.h index 971c62e..4664aa1 100644 --- a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.h +++ b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.h @@ -12,12 +12,22 @@ struct yagl_egl_offscreen_context struct yagl_eglb_context base; EGLContext native_ctx; + + GLuint rp_pbo; + uint32_t rp_pbo_width; + uint32_t rp_pbo_height; + uint32_t rp_pbo_bpp; }; 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_client_context *client_ctx, struct yagl_egl_offscreen_context *share_context); +bool yagl_egl_offscreen_context_read_pixels(struct yagl_egl_offscreen_context *ctx, + uint32_t width, + uint32_t height, + uint32_t bpp, + void *pixels); + #endif diff --git a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_display.c b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_display.c index 4ae7dd2..094a824 100644 --- a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_display.c +++ b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_display.c @@ -1,13 +1,37 @@ +#include #include "yagl_egl_offscreen_display.h" #include "yagl_egl_offscreen_context.h" #include "yagl_egl_offscreen_surface.h" -#include "yagl_egl_offscreen_image.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_ensure_ctx(); + image->driver->DeleteTextures(1, &obj->global_name); + yagl_unensure_ctx(); + + 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, @@ -23,9 +47,9 @@ static struct yagl_egl_native_config "dpy = %p", dpy); native_configs = - egl_offscreen->driver->config_enum(egl_offscreen->driver, - egl_offscreen_dpy->native_dpy, - num_configs); + egl_offscreen->egl_driver->config_enum(egl_offscreen->egl_driver, + egl_offscreen_dpy->native_dpy, + num_configs); YAGL_LOG_FUNC_EXIT(NULL); @@ -45,9 +69,9 @@ static void yagl_egl_offscreen_display_config_cleanup(struct yagl_eglb_display * dpy, cfg->config_id); - egl_offscreen->driver->config_cleanup(egl_offscreen->driver, - egl_offscreen_dpy->native_dpy, - cfg); + egl_offscreen->egl_driver->config_cleanup(egl_offscreen->egl_driver, + egl_offscreen_dpy->native_dpy, + cfg); YAGL_LOG_FUNC_EXIT(NULL); } @@ -55,7 +79,6 @@ static void yagl_egl_offscreen_display_config_cleanup(struct yagl_eglb_display * 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_client_context *client_ctx, struct yagl_eglb_context *share_context) { struct yagl_egl_offscreen_display *egl_offscreen_dpy = @@ -63,7 +86,6 @@ static struct yagl_eglb_context struct yagl_egl_offscreen_context *ctx = yagl_egl_offscreen_context_create(egl_offscreen_dpy, cfg, - client_ctx, (struct yagl_egl_offscreen_context*)share_context); return ctx ? &ctx->base : NULL; @@ -94,16 +116,22 @@ static struct yagl_eglb_surface return sfc ? &sfc->base : NULL; } -static struct yagl_eglb_image - *yagl_egl_offscreen_display_create_image(struct yagl_eglb_display *dpy, - yagl_winsys_id buffer) +static struct yagl_object *yagl_egl_offscreen_display_create_image(struct yagl_eglb_display *dpy, + yagl_winsys_id buffer) { - struct yagl_egl_offscreen_display *egl_offscreen_dpy = - (struct yagl_egl_offscreen_display*)dpy; - struct yagl_egl_offscreen_image *image = - yagl_egl_offscreen_image_create(egl_offscreen_dpy, 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_ensure_ctx(); + egl_offscreen->gles_driver->GenTextures(1, &image->base.global_name); + yagl_unensure_ctx(); + image->base.destroy = &yagl_egl_offscreen_image_destroy; + image->driver = egl_offscreen->gles_driver; - return image ? &image->base : NULL; + return &image->base; } static void yagl_egl_offscreen_display_destroy(struct yagl_eglb_display *dpy) @@ -116,8 +144,8 @@ static void yagl_egl_offscreen_display_destroy(struct yagl_eglb_display *dpy) YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_display_destroy, "dpy = %p", dpy); - egl_offscreen->driver->display_close(egl_offscreen->driver, - egl_offscreen_dpy->native_dpy); + egl_offscreen->egl_driver->display_close(egl_offscreen->egl_driver, + egl_offscreen_dpy->native_dpy); yagl_eglb_display_cleanup(dpy); @@ -134,7 +162,7 @@ struct yagl_egl_offscreen_display YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_display_create, NULL); - native_dpy = egl_offscreen->driver->display_open(egl_offscreen->driver); + native_dpy = egl_offscreen->egl_driver->display_open(egl_offscreen->egl_driver); if (!native_dpy) { YAGL_LOG_FUNC_EXIT(NULL); diff --git a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_image.c b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_image.c deleted file mode 100644 index 49c85e0..0000000 --- a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_image.c +++ /dev/null @@ -1,70 +0,0 @@ -#include "yagl_egl_offscreen_image.h" -#include "yagl_egl_offscreen_display.h" -#include "yagl_egl_offscreen_context.h" -#include "yagl_egl_offscreen_ts.h" -#include "yagl_client_context.h" -#include "yagl_client_image.h" -#include "yagl_log.h" -#include "yagl_tls.h" -#include "yagl_process.h" -#include "yagl_thread.h" - -YAGL_DECLARE_TLS(struct yagl_egl_offscreen_ts*, egl_offscreen_ts); - -static void yagl_egl_offscreen_image_update(struct yagl_eglb_image *image, - uint32_t width, - uint32_t height, - uint32_t bpp, - const void *pixels) -{ - struct yagl_eglb_context *ctx = - (egl_offscreen_ts->ctx ? &egl_offscreen_ts->ctx->base : NULL); - - if (!ctx) { - return; - } - - if (!image->glegl_image) { - image->glegl_image = ctx->client_ctx->create_image(ctx->client_ctx); - if (!image->glegl_image) { - return; - } - } - - image->glegl_image->update(image->glegl_image, width, height, bpp, pixels); -} - -static void yagl_egl_offscreen_image_destroy(struct yagl_eglb_image *image) -{ - struct yagl_egl_offscreen_image *oimage = - (struct yagl_egl_offscreen_image*)image; - - YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_image_destroy, NULL); - - yagl_eglb_image_cleanup(image); - - g_free(oimage); - - YAGL_LOG_FUNC_EXIT(NULL); -} - -struct yagl_egl_offscreen_image - *yagl_egl_offscreen_image_create(struct yagl_egl_offscreen_display *dpy, - yagl_winsys_id buffer) -{ - struct yagl_egl_offscreen_image *image; - - YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_image_create, - "dpy = %p", dpy); - - image = g_malloc0(sizeof(*image)); - - yagl_eglb_image_init(&image->base, buffer, &dpy->base); - - image->base.update_offscreen = &yagl_egl_offscreen_image_update; - image->base.destroy = &yagl_egl_offscreen_image_destroy; - - YAGL_LOG_FUNC_EXIT(NULL); - - return image; -} diff --git a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_image.h b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_image.h deleted file mode 100644 index 1ea25e5..0000000 --- a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_image.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _QEMU_YAGL_EGL_OFFSCREEN_IMAGE_H -#define _QEMU_YAGL_EGL_OFFSCREEN_IMAGE_H - -#include "yagl_eglb_image.h" - -struct yagl_egl_offscreen_display; - -struct yagl_egl_offscreen_image -{ - struct yagl_eglb_image base; -}; - -struct yagl_egl_offscreen_image - *yagl_egl_offscreen_image_create(struct yagl_egl_offscreen_display *dpy, - yagl_winsys_id buffer); - -#endif diff --git a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_surface.c b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_surface.c index 71370a2..2daa387 100644 --- a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_surface.c +++ b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_surface.c @@ -1,3 +1,4 @@ +#include #include "yagl_egl_offscreen_surface.h" #include "yagl_egl_offscreen_display.h" #include "yagl_egl_offscreen_context.h" @@ -9,7 +10,6 @@ #include "yagl_process.h" #include "yagl_thread.h" #include "yagl_compiled_transfer.h" -#include "yagl_client_context.h" YAGL_DECLARE_TLS(struct yagl_egl_offscreen_ts*, egl_offscreen_ts); @@ -25,9 +25,9 @@ static void yagl_egl_offscreen_surface_cleanup(struct yagl_egl_offscreen_surface g_free(sfc->host_pixels); sfc->host_pixels = NULL; - egl_offscreen->driver->pbuffer_surface_destroy(egl_offscreen->driver, - dpy->native_dpy, - sfc->native_sfc); + egl_offscreen->egl_driver->pbuffer_surface_destroy(egl_offscreen->egl_driver, + dpy->native_dpy, + sfc->native_sfc); sfc->native_sfc = EGL_NO_SURFACE; if (sfc->bimage_ct) { @@ -97,16 +97,16 @@ static bool yagl_egl_offscreen_surface_swap_buffers(struct yagl_eglb_surface *sf assert(octx); - if (!octx->base.client_ctx->read_pixels(octx->base.client_ctx, - osfc->width, - osfc->height, - osfc->bpp, - osfc->host_pixels)) { + if (!yagl_egl_offscreen_context_read_pixels(octx, + osfc->width, + osfc->height, + osfc->bpp, + osfc->host_pixels)) { YAGL_LOG_ERROR("read_pixels failed"); return false; } - assert (osfc->bimage_ct); + assert(osfc->bimage_ct); yagl_compiled_transfer_exec(osfc->bimage_ct, osfc->host_pixels); @@ -123,11 +123,11 @@ static bool yagl_egl_offscreen_surface_copy_buffers(struct yagl_eglb_surface *sf assert(octx); - if (!octx->base.client_ctx->read_pixels(octx->base.client_ctx, - osfc->width, - osfc->height, - osfc->bpp, - osfc->host_pixels)) { + if (!yagl_egl_offscreen_context_read_pixels(octx, + osfc->width, + osfc->height, + osfc->bpp, + osfc->host_pixels)) { YAGL_LOG_ERROR("read_pixels failed"); return false; } @@ -143,24 +143,6 @@ static void yagl_egl_offscreen_surface_wait_gl(struct yagl_eglb_surface *sfc) { } -static bool yagl_egl_offscreen_surface_bind_tex_image(struct yagl_eglb_surface *sfc) -{ - YAGL_LOG_FUNC_SET(eglBindTexImage); - - YAGL_LOG_WARN("Not supported!"); - - return false; -} - -static bool yagl_egl_offscreen_surface_release_tex_image(struct yagl_eglb_surface *sfc) -{ - YAGL_LOG_FUNC_SET(eglReleaseTexImage); - - YAGL_LOG_WARN("Not supported!"); - - return false; -} - static void yagl_egl_offscreen_surface_destroy(struct yagl_eglb_surface *sfc) { struct yagl_egl_offscreen_surface *egl_offscreen_sfc = @@ -226,12 +208,12 @@ struct yagl_egl_offscreen_surface return NULL; } - native_sfc = egl_offscreen->driver->pbuffer_surface_create(egl_offscreen->driver, - dpy->native_dpy, - cfg, - width, - height, - &pbuffer_attribs); + native_sfc = egl_offscreen->egl_driver->pbuffer_surface_create(egl_offscreen->egl_driver, + dpy->native_dpy, + cfg, + width, + height, + &pbuffer_attribs); if (!native_sfc) { yagl_compiled_transfer_destroy(bimage_ct); @@ -257,8 +239,6 @@ struct yagl_egl_offscreen_surface sfc->base.swap_buffers = &yagl_egl_offscreen_surface_swap_buffers; sfc->base.copy_buffers = &yagl_egl_offscreen_surface_copy_buffers; sfc->base.wait_gl = &yagl_egl_offscreen_surface_wait_gl; - sfc->base.bind_tex_image = &yagl_egl_offscreen_surface_bind_tex_image; - sfc->base.release_tex_image = &yagl_egl_offscreen_surface_release_tex_image; sfc->base.destroy = &yagl_egl_offscreen_surface_destroy; YAGL_LOG_FUNC_EXIT(NULL); diff --git a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_ts.h b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_ts.h index 615009c..92ce9f6 100644 --- a/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_ts.h +++ b/hw/yagl_backends/egl_offscreen/yagl_egl_offscreen_ts.h @@ -2,14 +2,18 @@ #define _QEMU_YAGL_EGL_OFFSCREEN_TS_H #include "yagl_types.h" +#include struct yagl_egl_offscreen_display; struct yagl_egl_offscreen_context; +struct yagl_egl_offscreen_surface; struct yagl_egl_offscreen_ts { struct yagl_egl_offscreen_display *dpy; struct yagl_egl_offscreen_context *ctx; + EGLSurface sfc_draw; + EGLSurface sfc_read; }; struct yagl_egl_offscreen_ts *yagl_egl_offscreen_ts_create(void); diff --git a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen.c b/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen.c index d700823..8d98f71 100644 --- a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen.c +++ b/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen.c @@ -47,9 +47,51 @@ static void yagl_egl_onscreen_thread_init(struct yagl_egl_backend *backend) 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; @@ -179,7 +221,7 @@ 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 = NULL; + egl_onscreen_ts = cur_ts->egl_onscreen_ts = NULL; YAGL_LOG_FUNC_EXIT(NULL); } @@ -237,6 +279,7 @@ static void yagl_egl_onscreen_destroy(struct yagl_egl_backend *backend) 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); @@ -285,24 +328,24 @@ struct yagl_egl_backend *yagl_egl_onscreen_create(struct winsys_interface *wsi, } ctx = egl_driver->context_create(egl_driver, dpy, &configs[0], - yagl_client_api_gles2, (EGLContext)ws_info->context); if (ctx == EGL_NO_CONTEXT) { goto fail; } - global_ctx = egl_driver->context_create(egl_driver, dpy, &configs[0], - yagl_client_api_gles2, ctx); + 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; diff --git a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.c b/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.c index 713abb4..a7ad48d 100644 --- a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.c +++ b/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.c @@ -3,7 +3,6 @@ #include "yagl_egl_onscreen_display.h" #include "yagl_egl_onscreen.h" #include "yagl_egl_surface_attribs.h" -#include "yagl_client_context.h" #include "yagl_gles_driver.h" #include "yagl_log.h" #include "yagl_tls.h" @@ -49,7 +48,6 @@ static void yagl_egl_onscreen_context_destroy(struct yagl_eglb_context *ctx) 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_client_context *client_ctx, struct yagl_egl_onscreen_context *share_context) { struct yagl_egl_onscreen *egl_onscreen = @@ -66,7 +64,6 @@ struct yagl_egl_onscreen_context egl_onscreen->egl_driver, dpy->native_dpy, cfg, - client_ctx->client_api, egl_onscreen->global_ctx); if (!native_ctx) { @@ -76,7 +73,7 @@ struct yagl_egl_onscreen_context ctx = g_malloc0(sizeof(*ctx)); - yagl_eglb_context_init(&ctx->base, &dpy->base, client_ctx); + yagl_eglb_context_init(&ctx->base, &dpy->base); ctx->base.destroy = &yagl_egl_onscreen_context_destroy; diff --git a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.h b/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.h index 9c326f7..2715909 100644 --- a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.h +++ b/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.h @@ -44,7 +44,6 @@ struct yagl_egl_onscreen_context 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_client_context *client_ctx, struct yagl_egl_onscreen_context *share_context); void yagl_egl_onscreen_context_setup(struct yagl_egl_onscreen_context *ctx); diff --git a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_display.c b/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_display.c index 978cc2a..0977179 100644 --- a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_display.c +++ b/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_display.c @@ -2,13 +2,34 @@ #include #include "yagl_egl_onscreen_context.h" #include "yagl_egl_onscreen_surface.h" -#include "yagl_egl_onscreen_image.h" #include "yagl_egl_onscreen.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 "winsys_gl.h" + +struct yagl_egl_onscreen_image +{ + struct yagl_object base; + + struct winsys_gl_surface *ws_sfc; +}; + +static void yagl_egl_onscreen_image_destroy(struct yagl_object *obj) +{ + struct yagl_egl_onscreen_image *image = (struct yagl_egl_onscreen_image*)obj; + + YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_image_destroy, "%u", obj->global_name); + + image->ws_sfc->base.release(&image->ws_sfc->base); + + g_free(image); + + YAGL_LOG_FUNC_EXIT(NULL); +} static struct yagl_egl_native_config *yagl_egl_onscreen_display_config_enum(struct yagl_eglb_display *dpy, @@ -56,7 +77,6 @@ static void yagl_egl_onscreen_display_config_cleanup(struct yagl_eglb_display *d static struct yagl_eglb_context *yagl_egl_onscreen_display_create_context(struct yagl_eglb_display *dpy, const struct yagl_egl_native_config *cfg, - struct yagl_client_context *client_ctx, struct yagl_eglb_context *share_context) { struct yagl_egl_onscreen_display *egl_onscreen_dpy = @@ -64,7 +84,6 @@ static struct yagl_eglb_context struct yagl_egl_onscreen_context *ctx = yagl_egl_onscreen_context_create(egl_onscreen_dpy, cfg, - client_ctx, (struct yagl_egl_onscreen_context*)share_context); return ctx ? &ctx->base : NULL; @@ -121,16 +140,27 @@ static struct yagl_eglb_surface return sfc ? &sfc->base : NULL; } -static struct yagl_eglb_image - *yagl_egl_onscreen_display_create_image(struct yagl_eglb_display *dpy, - yagl_winsys_id buffer) +static struct yagl_object *yagl_egl_onscreen_display_create_image(struct yagl_eglb_display *dpy, + yagl_winsys_id buffer) { - struct yagl_egl_onscreen_display *egl_onscreen_dpy = - (struct yagl_egl_onscreen_display*)dpy; - struct yagl_egl_onscreen_image *image = - yagl_egl_onscreen_image_create(egl_onscreen_dpy, buffer); + struct yagl_egl_onscreen *egl_onscreen = + (struct yagl_egl_onscreen*)dpy->backend; + struct winsys_gl_surface *ws_sfc = NULL; + struct yagl_egl_onscreen_image *image; + + ws_sfc = (struct winsys_gl_surface*)egl_onscreen->wsi->acquire_surface(egl_onscreen->wsi, buffer); + + if (!ws_sfc) { + return NULL; + } + + image = g_malloc(sizeof(*image)); + + image->base.global_name = ws_sfc->get_texture(ws_sfc); + image->base.destroy = &yagl_egl_onscreen_image_destroy; + image->ws_sfc = ws_sfc; - return image ? &image->base : NULL; + return &image->base; } static void yagl_egl_onscreen_display_destroy(struct yagl_eglb_display *dpy) diff --git a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_image.c b/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_image.c deleted file mode 100644 index 33e6152..0000000 --- a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_image.c +++ /dev/null @@ -1,104 +0,0 @@ -#include "yagl_egl_onscreen_image.h" -#include "yagl_egl_onscreen_display.h" -#include "yagl_egl_onscreen.h" -#include "yagl_log.h" -#include "yagl_process.h" -#include "yagl_thread.h" -#include "yagl_ref.h" -#include "yagl_client_interface.h" -#include -#include "winsys_gl.h" - -struct yagl_egl_onscreen_image_data -{ - struct yagl_ref ref; - - struct winsys_gl_surface *ws_sfc; -}; - -static void yagl_egl_onscreen_image_data_destroy(struct yagl_ref *ref) -{ - struct yagl_egl_onscreen_image_data *image_data = - (struct yagl_egl_onscreen_image_data*)ref; - - image_data->ws_sfc->base.release(&image_data->ws_sfc->base); - - yagl_ref_cleanup(ref); - - g_free(image_data); -} - -static void yagl_egl_onscreen_image_destroy(struct yagl_eglb_image *image) -{ - struct yagl_egl_onscreen_image *oimage = - (struct yagl_egl_onscreen_image*)image; - - YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_image_destroy, NULL); - - yagl_eglb_image_cleanup(image); - - g_free(oimage); - - YAGL_LOG_FUNC_EXIT(NULL); -} - -struct yagl_egl_onscreen_image - *yagl_egl_onscreen_image_create(struct yagl_egl_onscreen_display *dpy, - yagl_winsys_id buffer) -{ - struct yagl_egl_onscreen *egl_onscreen = - (struct yagl_egl_onscreen*)dpy->base.backend; - struct winsys_gl_surface *ws_sfc = NULL; - struct yagl_client_interface *client_iface = NULL; - struct yagl_egl_onscreen_image_data *image_data = NULL; - struct yagl_client_image *glegl_image = NULL; - struct yagl_egl_onscreen_image *image = NULL; - - YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_image_create, - "dpy = %p, buffer = %u", dpy, buffer); - - client_iface = cur_ts->ps->client_ifaces[yagl_client_api_gles2]; - - if (!client_iface) { - YAGL_LOG_ERROR("No GLESv2 API, can't create image"); - goto out; - } - - ws_sfc = (struct winsys_gl_surface*)egl_onscreen->wsi->acquire_surface(egl_onscreen->wsi, buffer); - - if (!ws_sfc) { - goto out; - } - - image_data = g_malloc0(sizeof(*image_data)); - - yagl_ref_init(&image_data->ref, &yagl_egl_onscreen_image_data_destroy); - ws_sfc->base.acquire(&ws_sfc->base); - image_data->ws_sfc = ws_sfc; - - glegl_image = client_iface->create_image(client_iface, - ws_sfc->get_texture(ws_sfc), - &image_data->ref); - - yagl_ref_release(&image_data->ref); - - if (!glegl_image) { - goto out; - } - - image = g_malloc0(sizeof(*image)); - - yagl_eglb_image_init(&image->base, buffer, &dpy->base); - - image->base.glegl_image = glegl_image; - image->base.destroy = &yagl_egl_onscreen_image_destroy; - -out: - if (ws_sfc) { - ws_sfc->base.release(&ws_sfc->base); - } - - YAGL_LOG_FUNC_EXIT(NULL); - - return image; -} diff --git a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_image.h b/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_image.h deleted file mode 100644 index e40ef49..0000000 --- a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_image.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _QEMU_YAGL_EGL_onscreen_IMAGE_H -#define _QEMU_YAGL_EGL_onscreen_IMAGE_H - -#include "yagl_eglb_image.h" - -struct yagl_egl_onscreen_display; - -struct yagl_egl_onscreen_image -{ - struct yagl_eglb_image base; -}; - -struct yagl_egl_onscreen_image - *yagl_egl_onscreen_image_create(struct yagl_egl_onscreen_display *dpy, - yagl_winsys_id buffer); - -#endif diff --git a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.c b/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.c index 170f0b4..1f10101 100644 --- a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.c +++ b/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.c @@ -8,34 +8,10 @@ #include "yagl_process.h" #include "yagl_thread.h" #include "yagl_gles_driver.h" -#include "yagl_client_tex_image.h" -#include "yagl_client_context.h" #include "winsys_gl.h" YAGL_DECLARE_TLS(struct yagl_egl_onscreen_ts*, egl_onscreen_ts); -struct yagl_egl_onscreen_surface_data -{ - struct yagl_ref ref; - - struct yagl_egl_onscreen_surface *sfc; -}; - -static void yagl_egl_onscreen_surface_data_destroy(struct yagl_ref *ref) -{ - struct yagl_egl_onscreen_surface_data *surface_data = - (struct yagl_egl_onscreen_surface_data*)ref; - - if (surface_data->sfc->tex_image) { - yagl_client_tex_image_release(surface_data->sfc->tex_image); - surface_data->sfc->tex_image = NULL; - } - - yagl_ref_cleanup(ref); - - g_free(surface_data); -} - static void yagl_egl_onscreen_surface_invalidate(struct yagl_eglb_surface *sfc, yagl_winsys_id id) { @@ -106,10 +82,6 @@ static bool 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); @@ -120,10 +92,6 @@ static bool 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); @@ -134,61 +102,14 @@ 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(); + /* + * M.b. glFinish here ? + */ osfc->ws_sfc->base.set_dirty(&osfc->ws_sfc->base); } -static bool yagl_egl_onscreen_surface_bind_tex_image(struct yagl_eglb_surface *sfc) -{ - struct yagl_egl_onscreen_surface *osfc = - (struct yagl_egl_onscreen_surface*)sfc; - struct yagl_eglb_context *ctx = - (egl_onscreen_ts->ctx ? &egl_onscreen_ts->ctx->base : NULL); - struct yagl_egl_onscreen_surface_data *surface_data = NULL; - - if (osfc->tex_image) { - return false; - } - - if (!ctx) { - return true; - } - - surface_data = g_malloc0(sizeof(*surface_data)); - - yagl_ref_init(&surface_data->ref, &yagl_egl_onscreen_surface_data_destroy); - surface_data->sfc = osfc; - - osfc->tex_image = - ctx->client_ctx->create_tex_image(ctx->client_ctx, - osfc->ws_sfc->get_texture(osfc->ws_sfc), - &surface_data->ref); - - yagl_ref_release(&surface_data->ref); - - return osfc->tex_image != NULL; -} - -static bool yagl_egl_onscreen_surface_release_tex_image(struct yagl_eglb_surface *sfc) -{ - struct yagl_egl_onscreen_surface *osfc = - (struct yagl_egl_onscreen_surface*)sfc; - - if (!osfc->tex_image) { - return true; - } - - osfc->tex_image->unbind(osfc->tex_image); - assert(!osfc->tex_image); - osfc->tex_image = NULL; - - return true; -} - static void yagl_egl_onscreen_surface_destroy(struct yagl_eglb_surface *sfc) { struct yagl_egl_onscreen_surface *osfc = @@ -198,12 +119,6 @@ static void yagl_egl_onscreen_surface_destroy(struct yagl_eglb_surface *sfc) YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_surface_destroy, NULL); - if (osfc->tex_image) { - osfc->tex_image->unbind(osfc->tex_image); - assert(!osfc->tex_image); - osfc->tex_image = NULL; - } - egl_onscreen->egl_driver->pbuffer_surface_destroy( egl_onscreen->egl_driver, ((struct yagl_egl_onscreen_display*)sfc->dpy)->native_dpy, @@ -278,8 +193,6 @@ struct yagl_egl_onscreen_surface 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.bind_tex_image = &yagl_egl_onscreen_surface_bind_tex_image; - sfc->base.release_tex_image = &yagl_egl_onscreen_surface_release_tex_image; sfc->base.destroy = &yagl_egl_onscreen_surface_destroy; YAGL_LOG_FUNC_EXIT(NULL); @@ -346,8 +259,6 @@ struct yagl_egl_onscreen_surface 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.bind_tex_image = &yagl_egl_onscreen_surface_bind_tex_image; - sfc->base.release_tex_image = &yagl_egl_onscreen_surface_release_tex_image; sfc->base.destroy = &yagl_egl_onscreen_surface_destroy; YAGL_LOG_FUNC_EXIT(NULL); @@ -414,8 +325,6 @@ struct yagl_egl_onscreen_surface 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.bind_tex_image = &yagl_egl_onscreen_surface_bind_tex_image; - sfc->base.release_tex_image = &yagl_egl_onscreen_surface_release_tex_image; sfc->base.destroy = &yagl_egl_onscreen_surface_destroy; YAGL_LOG_FUNC_EXIT(NULL); diff --git a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.h b/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.h index ae826fa..fe1a424 100644 --- a/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.h +++ b/hw/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.h @@ -6,7 +6,6 @@ struct yagl_egl_onscreen_display; struct yagl_egl_native_config; -struct yagl_client_tex_image; struct winsys_gl_surface; @@ -30,11 +29,6 @@ struct yagl_egl_onscreen_surface * when this surface is made current for the first time. */ GLuint rb; - - /* - * eglBindTexImage result. - */ - struct yagl_client_tex_image *tex_image; }; struct yagl_egl_onscreen_surface diff --git a/hw/yagl_client_context.c b/hw/yagl_client_context.c deleted file mode 100644 index 0c0932d..0000000 --- a/hw/yagl_client_context.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "yagl_client_context.h" -#include "yagl_sharegroup.h" - -void yagl_client_context_init(struct yagl_client_context *ctx, - yagl_client_api client_api, - struct yagl_sharegroup *sg) -{ - ctx->client_api = client_api; - yagl_sharegroup_acquire(sg); - ctx->sg = sg; -} - -void yagl_client_context_cleanup(struct yagl_client_context *ctx) -{ - yagl_sharegroup_release(ctx->sg); -} diff --git a/hw/yagl_client_context.h b/hw/yagl_client_context.h deleted file mode 100644 index 78dc24f..0000000 --- a/hw/yagl_client_context.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef _QEMU_YAGL_CLIENT_CONTEXT_H -#define _QEMU_YAGL_CLIENT_CONTEXT_H - -#include "yagl_types.h" - -struct yagl_ref; -struct yagl_sharegroup; -struct yagl_client_image; -struct yagl_client_tex_image; - -struct yagl_client_context -{ - yagl_client_api client_api; - - struct yagl_sharegroup *sg; - - /* - * 'activate' will be called whenever this context becomes - * current. This function is essential for - * context-dependent resources set up, since all host GL calls - * influence the current context only, this is the place where - * you can actually do host GL calls. - */ - void (*activate)(struct yagl_client_context */*ctx*/); - - void (*flush)(struct yagl_client_context */*ctx*/); - - /* - * Read pixel data from framebuffer. - */ - bool (*read_pixels)(struct yagl_client_context */*ctx*/, - uint32_t /*width*/, - uint32_t /*height*/, - uint32_t /*bpp*/, - void */*pixels*/); - - struct yagl_client_image - *(*create_image)(struct yagl_client_context */*ctx*/); - - struct yagl_client_tex_image - *(*create_tex_image)(struct yagl_client_context */*ctx*/, - yagl_object_name /*tex_global_name*/, - struct yagl_ref */*tex_data*/); - - /* - * 'deactivate' is called whenever this context resigns - * current state for the thread. This is the last - * place where you can still make GL calls. - * - * This function is always called if 'activate' was called, even - * if the target process is terminating. - */ - void (*deactivate)(struct yagl_client_context */*ctx*/); - - void (*destroy)(struct yagl_client_context */*ctx*/); -}; - -void yagl_client_context_init(struct yagl_client_context *ctx, - yagl_client_api client_api, - struct yagl_sharegroup *sg); - -void yagl_client_context_cleanup(struct yagl_client_context *ctx); - -#endif diff --git a/hw/yagl_client_image.c b/hw/yagl_client_image.c deleted file mode 100644 index 0734e5f..0000000 --- a/hw/yagl_client_image.c +++ /dev/null @@ -1,34 +0,0 @@ -#include "yagl_client_image.h" - -void yagl_client_image_init(struct yagl_client_image *image, - yagl_ref_destroy_func destroy_func, - struct yagl_ref *data) -{ - yagl_object_init(&image->base, destroy_func); - if (data) { - yagl_ref_acquire(data); - } - image->data = data; -} - -void yagl_client_image_cleanup(struct yagl_client_image *image) -{ - if (image->data) { - yagl_ref_release(image->data); - } - yagl_object_cleanup(&image->base); -} - -void yagl_client_image_acquire(struct yagl_client_image *image) -{ - if (image) { - yagl_object_acquire(&image->base); - } -} - -void yagl_client_image_release(struct yagl_client_image *image) -{ - if (image) { - yagl_object_release(&image->base); - } -} diff --git a/hw/yagl_client_image.h b/hw/yagl_client_image.h deleted file mode 100644 index 8bec3ea..0000000 --- a/hw/yagl_client_image.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _QEMU_YAGL_CLIENT_IMAGE_H -#define _QEMU_YAGL_CLIENT_IMAGE_H - -#include "yagl_types.h" -#include "yagl_object.h" - -struct yagl_client_image -{ - struct yagl_object base; - - struct yagl_ref *data; - - void (*update)(struct yagl_client_image */*image*/, - uint32_t /*width*/, - uint32_t /*height*/, - uint32_t /*bpp*/, - const void */*pixels*/); -}; - -void yagl_client_image_init(struct yagl_client_image *image, - yagl_ref_destroy_func destroy_func, - struct yagl_ref *data /* = NULL*/); - -void yagl_client_image_cleanup(struct yagl_client_image *image); - -/* - * Helper functions that simply acquire/release yagl_client_image::ref - * @{ - */ - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_client_image_acquire(struct yagl_client_image *image); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_client_image_release(struct yagl_client_image *image); - -/* - * @} - */ - -#endif diff --git a/hw/yagl_client_interface.c b/hw/yagl_client_interface.c deleted file mode 100644 index db4a417..0000000 --- a/hw/yagl_client_interface.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "yagl_client_interface.h" - -void yagl_client_interface_init(struct yagl_client_interface *iface) -{ -} - -void yagl_client_interface_cleanup(struct yagl_client_interface *iface) -{ -} diff --git a/hw/yagl_client_interface.h b/hw/yagl_client_interface.h deleted file mode 100644 index b7e8584..0000000 --- a/hw/yagl_client_interface.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _QEMU_YAGL_CLIENT_INTERFACE_H -#define _QEMU_YAGL_CLIENT_INTERFACE_H - -#include "yagl_types.h" - -struct yagl_client_context; -struct yagl_client_image; -struct yagl_sharegroup; -struct yagl_ref; - -struct yagl_client_interface -{ - struct yagl_client_context *(*create_ctx)(struct yagl_client_interface */*iface*/, - struct yagl_sharegroup */*sg*/); - - struct yagl_client_image - *(*create_image)(struct yagl_client_interface */*iface*/, - yagl_object_name /*tex_global_name*/, - struct yagl_ref */*tex_data*/); -}; - -void yagl_client_interface_init(struct yagl_client_interface *iface); - -void yagl_client_interface_cleanup(struct yagl_client_interface *iface); - -#endif diff --git a/hw/yagl_client_tex_image.c b/hw/yagl_client_tex_image.c deleted file mode 100644 index 9c8740c..0000000 --- a/hw/yagl_client_tex_image.c +++ /dev/null @@ -1,32 +0,0 @@ -#include "yagl_client_tex_image.h" - -void yagl_client_tex_image_init(struct yagl_client_tex_image *tex_image, - yagl_ref_destroy_func destroy_func, - struct yagl_ref *data) -{ - yagl_object_init(&tex_image->base, destroy_func); - yagl_ref_acquire(data); - tex_image->data = data; -} - -void yagl_client_tex_image_cleanup(struct yagl_client_tex_image *tex_image) -{ - if (tex_image->data) { - yagl_ref_release(tex_image->data); - } - yagl_object_cleanup(&tex_image->base); -} - -void yagl_client_tex_image_acquire(struct yagl_client_tex_image *tex_image) -{ - if (tex_image) { - yagl_object_acquire(&tex_image->base); - } -} - -void yagl_client_tex_image_release(struct yagl_client_tex_image *tex_image) -{ - if (tex_image) { - yagl_object_release(&tex_image->base); - } -} diff --git a/hw/yagl_client_tex_image.h b/hw/yagl_client_tex_image.h deleted file mode 100644 index 53d8565..0000000 --- a/hw/yagl_client_tex_image.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef _QEMU_YAGL_CLIENT_TEX_IMAGE_H -#define _QEMU_YAGL_CLIENT_TEX_IMAGE_H - -#include "yagl_types.h" -#include "yagl_object.h" - -struct yagl_client_tex_image -{ - struct yagl_object base; - - struct yagl_ref *data; - - void (*unbind)(struct yagl_client_tex_image */*tex_image*/); -}; - -void yagl_client_tex_image_init(struct yagl_client_tex_image *tex_image, - yagl_ref_destroy_func destroy_func, - struct yagl_ref *data); - -void yagl_client_tex_image_cleanup(struct yagl_client_tex_image *tex_image); - -/* - * Helper functions that simply acquire/release yagl_client_tex_image::ref - * @{ - */ - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_client_tex_image_acquire(struct yagl_client_tex_image *tex_image); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_client_tex_image_release(struct yagl_client_tex_image *tex_image); - -/* - * @} - */ - -#endif diff --git a/hw/yagl_compiled_transfer.c b/hw/yagl_compiled_transfer.c index d89062f..9f47091 100644 --- a/hw/yagl_compiled_transfer.c +++ b/hw/yagl_compiled_transfer.c @@ -12,7 +12,7 @@ static hwaddr yagl_pa(target_ulong va) { hwaddr ret = - cpu_get_phys_page_debug(cur_ts->current_env, va); + cpu_get_phys_page_debug(current_cpu, va); if (ret == -1) { return 0; diff --git a/hw/yagl_device.c b/hw/yagl_device.c index 54b808d..b6561d8 100644 --- a/hw/yagl_device.c +++ b/hw/yagl_device.c @@ -5,10 +5,8 @@ #include "yagl_process.h" #include "yagl_thread.h" #include "yagl_egl_driver.h" -#include "yagl_drivers/gles1_ogl/yagl_gles1_ogl.h" -#include "yagl_drivers/gles2_ogl/yagl_gles2_ogl.h" -#include "yagl_drivers/gles1_onscreen/yagl_gles1_onscreen.h" -#include "yagl_drivers/gles2_onscreen/yagl_gles2_onscreen.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" @@ -16,8 +14,7 @@ #include "hw/pci/pci.h" #include #include "winsys.h" -#include "yagl_gles1_driver.h" -#include "yagl_gles2_driver.h" +#include "yagl_gles_driver.h" #define PCI_VENDOR_ID_YAGL 0x19B1 #define PCI_DEVICE_ID_YAGL 0x1010 @@ -192,8 +189,7 @@ 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_gles1_driver *gles1_driver = NULL; - struct yagl_gles2_driver *gles2_driver = NULL; + struct yagl_gles_driver *gles_driver = NULL; yagl_log_init(); @@ -213,26 +209,19 @@ static int yagl_device_init(PCIDevice *dev) goto fail; } - gles1_driver = yagl_gles1_ogl_create(egl_driver->dyn_lib); + gles_driver = yagl_gles_ogl_create(egl_driver->dyn_lib); - if (!gles1_driver) { - goto fail; - } - - gles2_driver = yagl_gles2_ogl_create(egl_driver->dyn_lib); - - if (!gles2_driver) { + if (!gles_driver) { goto fail; } if (s->wsi) { egl_backend = yagl_egl_onscreen_create(s->wsi, egl_driver, - &gles2_driver->base); - gles1_driver = yagl_gles1_onscreen_create(gles1_driver); - gles2_driver = yagl_gles2_onscreen_create(gles2_driver); + gles_driver); + gles_driver = yagl_gles_onscreen_create(gles_driver); } else { - egl_backend = yagl_egl_offscreen_create(egl_driver); + egl_backend = yagl_egl_offscreen_create(egl_driver, gles_driver); } if (!egl_backend) { @@ -244,14 +233,13 @@ static int yagl_device_init(PCIDevice *dev) */ egl_driver = NULL; - s->ss = yagl_server_state_create(egl_backend, gles1_driver, gles2_driver); + s->ss = yagl_server_state_create(egl_backend, gles_driver); /* * Owned/destroyed by server state. */ egl_backend = NULL; - gles1_driver = NULL; - gles2_driver = NULL; + gles_driver = NULL; if (!s->ss) { goto fail; @@ -268,12 +256,8 @@ fail: egl_backend->destroy(egl_backend); } - if (gles1_driver) { - gles1_driver->destroy(gles1_driver); - } - - if (gles2_driver) { - gles2_driver->destroy(gles2_driver); + if (gles_driver) { + gles_driver->destroy(gles_driver); } if (egl_driver) { diff --git a/hw/yagl_drivers/egl_agl/yagl_egl_agl.c b/hw/yagl_drivers/egl_agl/yagl_egl_agl.c index d2d73d0..e3d270e 100644 --- a/hw/yagl_drivers/egl_agl/yagl_egl_agl.c +++ b/hw/yagl_drivers/egl_agl/yagl_egl_agl.c @@ -140,17 +140,15 @@ static void yagl_egl_agl_config_cleanup(struct yagl_egl_driver *driver, static EGLContext yagl_egl_agl_context_create(struct yagl_egl_driver *driver, EGLNativeDisplayType egl_dpy, - const struct - yagl_egl_native_config *cfg, - yagl_client_api client_api, + const struct yagl_egl_native_config *cfg, EGLContext share_context) { YaglEglAglContext *egl_glc; AGLContext agl_share_glc; YAGL_LOG_FUNC_ENTER(yagl_egl_agl_context_create, - "dpy = %p, api = %u, share_context = %p, cfgid=%d", - egl_dpy, client_api, share_context, cfg->config_id); + "dpy = %p, share_context = %p, cfgid=%d", + egl_dpy, share_context, cfg->config_id); egl_glc = g_new0(YaglEglAglContext, 1); diff --git a/hw/yagl_drivers/egl_glx/yagl_egl_glx.c b/hw/yagl_drivers/egl_glx/yagl_egl_glx.c index 15874d2..7d35d45 100644 --- a/hw/yagl_drivers/egl_glx/yagl_egl_glx.c +++ b/hw/yagl_drivers/egl_glx/yagl_egl_glx.c @@ -365,16 +365,14 @@ static void yagl_egl_glx_pbuffer_surface_destroy(struct yagl_egl_driver *driver, static EGLContext yagl_egl_glx_context_create(struct yagl_egl_driver *driver, EGLNativeDisplayType dpy, const struct yagl_egl_native_config *cfg, - yagl_client_api client_api, EGLContext share_context) { struct yagl_egl_glx *egl_glx = (struct yagl_egl_glx*)driver; GLXContext ctx; YAGL_EGL_GLX_ENTER(yagl_egl_glx_context_create, - "dpy = %p, client_api = %u, share_context = %p", + "dpy = %p, share_context = %p", dpy, - client_api, share_context); ctx = egl_glx->glXCreateNewContext(dpy, diff --git a/hw/yagl_drivers/egl_wgl/yagl_egl_wgl.c b/hw/yagl_drivers/egl_wgl/yagl_egl_wgl.c index 3a14353..ec71557 100644 --- a/hw/yagl_drivers/egl_wgl/yagl_egl_wgl.c +++ b/hw/yagl_drivers/egl_wgl/yagl_egl_wgl.c @@ -466,7 +466,6 @@ fail: static EGLContext yagl_egl_wgl_context_create(struct yagl_egl_driver *driver, EGLNativeDisplayType egl_dpy, const struct yagl_egl_native_config *cfg, - yagl_client_api client_api, EGLContext share_context) { YaglEglWglDriver *egl_wgl = (YaglEglWglDriver *)(driver); @@ -475,8 +474,8 @@ static EGLContext yagl_egl_wgl_context_create(struct yagl_egl_driver *driver, HDC dc; YAGL_EGL_WGL_ENTER(yagl_egl_wgl_context_create, - "dpy = %p, api = %u, share_context = %p, cfgid=%d", - dpy, client_api, share_context, cfg->config_id); + "dpy = %p, share_context = %p, cfgid=%d", + dpy, share_context, cfg->config_id); dc = yagl_egl_wgl_get_dc_by_cfgid(dpy, cfg); if (!dc) { diff --git a/hw/yagl_drivers/gles1_ogl/yagl_gles1_ogl.c b/hw/yagl_drivers/gles1_ogl/yagl_gles1_ogl.c deleted file mode 100644 index fe67e55..0000000 --- a/hw/yagl_drivers/gles1_ogl/yagl_gles1_ogl.c +++ /dev/null @@ -1,100 +0,0 @@ -#include -#include "yagl_gles1_ogl.h" -#include "yagl_drivers/gles_ogl/yagl_gles_ogl_macros.h" -#include "yagl_drivers/gles_ogl/yagl_gles_ogl.h" -#include "yagl_gles1_driver.h" -#include "yagl_dyn_lib.h" -#include "yagl_log.h" -#include "yagl_process.h" -#include "yagl_thread.h" - -static void yagl_gles1_ogl_destroy(struct yagl_gles1_driver *driver) -{ - YAGL_LOG_FUNC_ENTER(yagl_gles1_ogl_destroy, NULL); - - yagl_gles1_driver_cleanup(driver); - yagl_gles_ogl_cleanup(&driver->base); - g_free(driver); - - YAGL_LOG_FUNC_EXIT(NULL); -} - -struct yagl_gles1_driver *yagl_gles1_ogl_create(struct yagl_dyn_lib *dyn_lib) -{ - struct yagl_gles1_driver *gles1_ogl = NULL; - - YAGL_LOG_FUNC_ENTER(yagl_gles1_ogl_create, NULL); - - gles1_ogl = g_malloc0(sizeof(*gles1_ogl)); - - if (!yagl_gles_ogl_init(&gles1_ogl->base, dyn_lib)) { - goto fail_free; - } - - yagl_gles1_driver_init(gles1_ogl); - - YAGL_GLES_OGL_GET_PROC(gles1_ogl, AlphaFunc, glAlphaFunc); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, Color4f, glColor4f); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, DepthRangef, glDepthRangef); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, Frustum, glFrustum); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, Fogf, glFogf); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, Fogfv, glFogfv); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, GetLightfv, glGetLightfv); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, GetMaterialfv, glGetMaterialfv); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, GetTexEnvfv, glGetTexEnvfv); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, LightModelf, glLightModelf); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, LightModelfv, glLightModelfv); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, Lightf, glLightf); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, Lightfv, glLightfv); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, LoadMatrixf, glLoadMatrixf); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, Materialf, glMaterialf); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, Materialfv, glMaterialfv); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, MultMatrixf, glMultMatrixf); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, MultiTexCoord4f, glMultiTexCoord4f); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, Normal3f, glNormal3f); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, Ortho, glOrtho); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, PointParameterf, glPointParameterf); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, PointParameterfv, glPointParameterfv); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, PointSize, glPointSize); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, Rotatef, glRotatef); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, Scalef, glScalef); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, TexEnvf, glTexEnvf); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, TexEnvfv, glTexEnvfv); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, Translatef, glTranslatef); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, ClientActiveTexture, glClientActiveTexture); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, ClipPlane, glClipPlane); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, Color4ub, glColor4ub); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, ColorPointer, glColorPointer); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, DisableClientState, glDisableClientState); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, EnableClientState, glEnableClientState); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, GetClipPlane, glGetClipPlane); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, GetPointerv, glGetPointerv); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, GetTexEnviv, glGetTexEnviv); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, LoadIdentity, glLoadIdentity); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, LogicOp, glLogicOp); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, MatrixMode, glMatrixMode); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, NormalPointer, glNormalPointer); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, PopMatrix, glPopMatrix); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, PushMatrix, glPushMatrix); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, ShadeModel, glShadeModel); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, TexCoordPointer, glTexCoordPointer); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, TexEnvi, glTexEnvi); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, TexEnviv, glTexEnviv); - YAGL_GLES_OGL_GET_PROC(gles1_ogl, VertexPointer, glVertexPointer); - - gles1_ogl->destroy = &yagl_gles1_ogl_destroy; - - YAGL_LOG_FUNC_EXIT(NULL); - - return gles1_ogl; - -fail: - yagl_gles1_driver_cleanup(gles1_ogl); - yagl_gles_ogl_cleanup(&gles1_ogl->base); -fail_free: - g_free(gles1_ogl); - - YAGL_LOG_FUNC_EXIT(NULL); - - return NULL; -} diff --git a/hw/yagl_drivers/gles1_ogl/yagl_gles1_ogl.h b/hw/yagl_drivers/gles1_ogl/yagl_gles1_ogl.h deleted file mode 100644 index dae6147..0000000 --- a/hw/yagl_drivers/gles1_ogl/yagl_gles1_ogl.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _QEMU_YAGL_GLES1_OGL_H -#define _QEMU_YAGL_GLES1_OGL_H - -#include "yagl_types.h" - -struct yagl_gles1_driver; -struct yagl_dyn_lib; - -struct yagl_gles1_driver *yagl_gles1_ogl_create(struct yagl_dyn_lib *dyn_lib); - -#endif diff --git a/hw/yagl_drivers/gles1_onscreen/yagl_gles1_onscreen.c b/hw/yagl_drivers/gles1_onscreen/yagl_gles1_onscreen.c deleted file mode 100644 index f3dbf90..0000000 --- a/hw/yagl_drivers/gles1_onscreen/yagl_gles1_onscreen.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include "yagl_gles1_onscreen.h" -#include "yagl_drivers/gles_onscreen/yagl_gles_onscreen.h" -#include "yagl_gles1_driver.h" -#include "yagl_log.h" -#include "yagl_process.h" -#include "yagl_thread.h" - -struct yagl_gles1_onscreen -{ - struct yagl_gles1_driver base; - - struct yagl_gles1_driver *orig_driver; -}; - -static void yagl_gles1_onscreen_destroy(struct yagl_gles1_driver *driver) -{ - struct yagl_gles1_onscreen *gles1_onscreen = (struct yagl_gles1_onscreen*)driver; - - YAGL_LOG_FUNC_ENTER(yagl_gles1_onscreen_destroy, NULL); - - gles1_onscreen->orig_driver->destroy(gles1_onscreen->orig_driver); - gles1_onscreen->orig_driver = NULL; - - yagl_gles1_driver_cleanup(driver); - yagl_gles_onscreen_cleanup(&driver->base); - g_free(gles1_onscreen); - - YAGL_LOG_FUNC_EXIT(NULL); -} - -struct yagl_gles1_driver - *yagl_gles1_onscreen_create(struct yagl_gles1_driver *orig_driver) -{ - struct yagl_gles1_onscreen *gles1_onscreen = NULL; - - YAGL_LOG_FUNC_ENTER(yagl_gles1_onscreen_create, NULL); - - gles1_onscreen = g_malloc0(sizeof(*gles1_onscreen)); - - /* - * Just copy over everything, then init our fields. - */ - memcpy(&gles1_onscreen->base, orig_driver, sizeof(*orig_driver)); - gles1_onscreen->orig_driver = orig_driver; - - yagl_gles_onscreen_init(&gles1_onscreen->base.base); - - yagl_gles1_driver_init(&gles1_onscreen->base); - - gles1_onscreen->base.destroy = &yagl_gles1_onscreen_destroy; - - YAGL_LOG_FUNC_EXIT(NULL); - - return &gles1_onscreen->base; -} diff --git a/hw/yagl_drivers/gles1_onscreen/yagl_gles1_onscreen.h b/hw/yagl_drivers/gles1_onscreen/yagl_gles1_onscreen.h deleted file mode 100644 index d255b23..0000000 --- a/hw/yagl_drivers/gles1_onscreen/yagl_gles1_onscreen.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _QEMU_YAGL_GLES1_ONSCREEN_H -#define _QEMU_YAGL_GLES1_ONSCREEN_H - -#include "yagl_types.h" - -struct yagl_gles1_driver; - -/* - * Takes ownership of 'orig_driver'. - */ -struct yagl_gles1_driver - *yagl_gles1_onscreen_create(struct yagl_gles1_driver *orig_driver); - -#endif diff --git a/hw/yagl_drivers/gles2_ogl/yagl_gles2_ogl.c b/hw/yagl_drivers/gles2_ogl/yagl_gles2_ogl.c deleted file mode 100644 index fe7afe3..0000000 --- a/hw/yagl_drivers/gles2_ogl/yagl_gles2_ogl.c +++ /dev/null @@ -1,116 +0,0 @@ -#include -#include "yagl_gles2_ogl.h" -#include "yagl_drivers/gles_ogl/yagl_gles_ogl_macros.h" -#include "yagl_drivers/gles_ogl/yagl_gles_ogl.h" -#include "yagl_gles2_driver.h" -#include "yagl_dyn_lib.h" -#include "yagl_log.h" -#include "yagl_process.h" -#include "yagl_thread.h" - -static void yagl_gles2_ogl_destroy(struct yagl_gles2_driver *driver) -{ - YAGL_LOG_FUNC_ENTER(yagl_gles2_ogl_destroy, NULL); - - yagl_gles2_driver_cleanup(driver); - yagl_gles_ogl_cleanup(&driver->base); - g_free(driver); - - YAGL_LOG_FUNC_EXIT(NULL); -} - -struct yagl_gles2_driver *yagl_gles2_ogl_create(struct yagl_dyn_lib *dyn_lib) -{ - struct yagl_gles2_driver *gles2_ogl = NULL; - - YAGL_LOG_FUNC_ENTER(yagl_gles2_ogl_create, NULL); - - gles2_ogl = g_malloc0(sizeof(*gles2_ogl)); - - if (!yagl_gles_ogl_init(&gles2_ogl->base, dyn_lib)) { - goto fail_free; - } - - yagl_gles2_driver_init(gles2_ogl); - - YAGL_GLES_OGL_GET_PROC(gles2_ogl, AttachShader, glAttachShader); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, BindAttribLocation, glBindAttribLocation); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, BlendColor, glBlendColor); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, CompileShader, glCompileShader); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, CreateProgram, glCreateProgram); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, CreateShader, glCreateShader); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, DeleteProgram, glDeleteProgram); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, DeleteShader, glDeleteShader); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, DetachShader, glDetachShader); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, DisableVertexAttribArray, glDisableVertexAttribArray); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, EnableVertexAttribArray, glEnableVertexAttribArray); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetActiveAttrib, glGetActiveAttrib); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetActiveUniform, glGetActiveUniform); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetAttachedShaders, glGetAttachedShaders); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetAttribLocation, glGetAttribLocation); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetProgramiv, glGetProgramiv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetProgramInfoLog, glGetProgramInfoLog); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetShaderiv, glGetShaderiv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetShaderInfoLog, glGetShaderInfoLog); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetShaderPrecisionFormat, glGetShaderPrecisionFormat); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetShaderSource, glGetShaderSource); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetUniformfv, glGetUniformfv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetUniformiv, glGetUniformiv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetUniformLocation, glGetUniformLocation); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetVertexAttribfv, glGetVertexAttribfv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetVertexAttribiv, glGetVertexAttribiv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, GetVertexAttribPointerv, glGetVertexAttribPointerv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, IsProgram, glIsProgram); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, IsShader, glIsShader); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, LinkProgram, glLinkProgram); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, ShaderSource, glShaderSource); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, StencilFuncSeparate, glStencilFuncSeparate); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, StencilMaskSeparate, glStencilMaskSeparate); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, StencilOpSeparate, glStencilOpSeparate); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform1f, glUniform1f); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform1fv, glUniform1fv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform1i, glUniform1i); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform1iv, glUniform1iv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform2f, glUniform2f); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform2fv, glUniform2fv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform2i, glUniform2i); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform2iv, glUniform2iv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform3f, glUniform3f); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform3fv, glUniform3fv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform3i, glUniform3i); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform3iv, glUniform3iv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform4f, glUniform4f); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform4fv, glUniform4fv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform4i, glUniform4i); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, Uniform4iv, glUniform4iv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, UniformMatrix2fv, glUniformMatrix2fv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, UniformMatrix3fv, glUniformMatrix3fv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, UniformMatrix4fv, glUniformMatrix4fv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, UseProgram, glUseProgram); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, ValidateProgram, glValidateProgram); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, VertexAttrib1f, glVertexAttrib1f); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, VertexAttrib1fv, glVertexAttrib1fv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, VertexAttrib2f, glVertexAttrib2f); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, VertexAttrib2fv, glVertexAttrib2fv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, VertexAttrib3f, glVertexAttrib3f); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, VertexAttrib3fv, glVertexAttrib3fv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, VertexAttrib4f, glVertexAttrib4f); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, VertexAttrib4fv, glVertexAttrib4fv); - YAGL_GLES_OGL_GET_PROC(gles2_ogl, VertexAttribPointer, glVertexAttribPointer); - - gles2_ogl->destroy = &yagl_gles2_ogl_destroy; - - YAGL_LOG_FUNC_EXIT(NULL); - - return gles2_ogl; - -fail: - yagl_gles2_driver_cleanup(gles2_ogl); - yagl_gles_ogl_cleanup(&gles2_ogl->base); -fail_free: - g_free(gles2_ogl); - - YAGL_LOG_FUNC_EXIT(NULL); - - return NULL; -} diff --git a/hw/yagl_drivers/gles2_ogl/yagl_gles2_ogl.h b/hw/yagl_drivers/gles2_ogl/yagl_gles2_ogl.h deleted file mode 100644 index fcd98d7..0000000 --- a/hw/yagl_drivers/gles2_ogl/yagl_gles2_ogl.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _QEMU_YAGL_GLES2_OGL_H -#define _QEMU_YAGL_GLES2_OGL_H - -#include "yagl_types.h" - -struct yagl_gles2_driver; -struct yagl_dyn_lib; - -struct yagl_gles2_driver *yagl_gles2_ogl_create(struct yagl_dyn_lib *dyn_lib); - -#endif diff --git a/hw/yagl_drivers/gles2_onscreen/yagl_gles2_onscreen.c b/hw/yagl_drivers/gles2_onscreen/yagl_gles2_onscreen.c deleted file mode 100644 index c60644a..0000000 --- a/hw/yagl_drivers/gles2_onscreen/yagl_gles2_onscreen.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include "yagl_gles2_onscreen.h" -#include "yagl_drivers/gles_onscreen/yagl_gles_onscreen.h" -#include "yagl_gles2_driver.h" -#include "yagl_log.h" -#include "yagl_process.h" -#include "yagl_thread.h" - -struct yagl_gles2_onscreen -{ - struct yagl_gles2_driver base; - - struct yagl_gles2_driver *orig_driver; -}; - -static void yagl_gles2_onscreen_destroy(struct yagl_gles2_driver *driver) -{ - struct yagl_gles2_onscreen *gles2_onscreen = (struct yagl_gles2_onscreen*)driver; - - YAGL_LOG_FUNC_ENTER(yagl_gles2_onscreen_destroy, NULL); - - gles2_onscreen->orig_driver->destroy(gles2_onscreen->orig_driver); - gles2_onscreen->orig_driver = NULL; - - yagl_gles2_driver_cleanup(driver); - yagl_gles_onscreen_cleanup(&driver->base); - g_free(gles2_onscreen); - - YAGL_LOG_FUNC_EXIT(NULL); -} - -struct yagl_gles2_driver - *yagl_gles2_onscreen_create(struct yagl_gles2_driver *orig_driver) -{ - struct yagl_gles2_onscreen *gles2_onscreen = NULL; - - YAGL_LOG_FUNC_ENTER(yagl_gles2_onscreen_create, NULL); - - gles2_onscreen = g_malloc0(sizeof(*gles2_onscreen)); - - /* - * Just copy over everything, then init our fields. - */ - memcpy(&gles2_onscreen->base, orig_driver, sizeof(*orig_driver)); - gles2_onscreen->orig_driver = orig_driver; - - yagl_gles_onscreen_init(&gles2_onscreen->base.base); - - yagl_gles2_driver_init(&gles2_onscreen->base); - - gles2_onscreen->base.destroy = &yagl_gles2_onscreen_destroy; - - YAGL_LOG_FUNC_EXIT(NULL); - - return &gles2_onscreen->base; -} diff --git a/hw/yagl_drivers/gles2_onscreen/yagl_gles2_onscreen.h b/hw/yagl_drivers/gles2_onscreen/yagl_gles2_onscreen.h deleted file mode 100644 index 168d7d9..0000000 --- a/hw/yagl_drivers/gles2_onscreen/yagl_gles2_onscreen.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _QEMU_YAGL_GLES2_ONSCREEN_H -#define _QEMU_YAGL_GLES2_ONSCREEN_H - -#include "yagl_types.h" - -struct yagl_gles2_driver; - -/* - * Takes ownership of 'orig_driver'. - */ -struct yagl_gles2_driver - *yagl_gles2_onscreen_create(struct yagl_gles2_driver *orig_driver); - -#endif diff --git a/hw/yagl_drivers/gles_ogl/yagl_gles_ogl.c b/hw/yagl_drivers/gles_ogl/yagl_gles_ogl.c index db97d6d..6a5fde6 100644 --- a/hw/yagl_drivers/gles_ogl/yagl_gles_ogl.c +++ b/hw/yagl_drivers/gles_ogl/yagl_gles_ogl.c @@ -7,106 +7,213 @@ #include "yagl_process.h" #include "yagl_thread.h" -bool yagl_gles_ogl_init(struct yagl_gles_driver *driver, - struct yagl_dyn_lib *dyn_lib) +static void yagl_gles_ogl_destroy(struct yagl_gles_driver *driver) { - YAGL_LOG_FUNC_ENTER(yagl_gles_ogl_init, NULL); + YAGL_LOG_FUNC_ENTER(yagl_gles_ogl_destroy, NULL); + + yagl_gles_driver_cleanup(driver); + g_free(driver); + + YAGL_LOG_FUNC_EXIT(NULL); +} + +struct yagl_gles_driver *yagl_gles_ogl_create(struct yagl_dyn_lib *dyn_lib) +{ + struct yagl_gles_driver *driver = NULL; + + YAGL_LOG_FUNC_ENTER(yagl_gles_ogl_create, NULL); + + driver = g_malloc0(sizeof(*driver)); yagl_gles_driver_init(driver); - YAGL_GLES_OGL_GET_PROC(driver, ActiveTexture, glActiveTexture); + 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, 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, BufferData, glBufferData); - YAGL_GLES_OGL_GET_PROC(driver, BufferSubData, glBufferSubData); + 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, 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, CullFace, glCullFace); - YAGL_GLES_OGL_GET_PROC(driver, DeleteBuffers, glDeleteBuffers); - YAGL_GLES_OGL_GET_PROC(driver, DeleteTextures, glDeleteTextures); 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, Disable, glDisable); - YAGL_GLES_OGL_GET_PROC(driver, DrawArrays, glDrawArrays); - YAGL_GLES_OGL_GET_PROC(driver, DrawElements, glDrawElements); YAGL_GLES_OGL_GET_PROC(driver, Enable, glEnable); - YAGL_GLES_OGL_GET_PROC(driver, Finish, glFinish); + 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, GenBuffers, glGenBuffers); - YAGL_GLES_OGL_GET_PROC(driver, GenTextures, glGenTextures); - YAGL_GLES_OGL_GET_PROC(driver, GetBooleanv, glGetBooleanv); - YAGL_GLES_OGL_GET_PROC(driver, GetBufferParameteriv, glGetBufferParameteriv); - YAGL_GLES_OGL_GET_PROC(driver, GetError, glGetError); - YAGL_GLES_OGL_GET_PROC(driver, GetFloatv, glGetFloatv); - YAGL_GLES_OGL_GET_PROC(driver, GetIntegerv, glGetIntegerv); - YAGL_GLES_OGL_GET_PROC(driver, GetTexParameterfv, glGetTexParameterfv); - YAGL_GLES_OGL_GET_PROC(driver, GetTexParameteriv, glGetTexParameteriv); + YAGL_GLES_OGL_GET_PROC(driver, GenerateMipmap, glGenerateMipmapEXT); YAGL_GLES_OGL_GET_PROC(driver, Hint, glHint); - YAGL_GLES_OGL_GET_PROC(driver, IsBuffer, glIsBuffer); - YAGL_GLES_OGL_GET_PROC(driver, IsEnabled, glIsEnabled); - YAGL_GLES_OGL_GET_PROC(driver, IsTexture, glIsTexture); 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, ReadPixels, glReadPixels); - YAGL_GLES_OGL_GET_PROC(driver, SampleCoverage, glSampleCoverage); 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, 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, 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, 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, GenFramebuffers, glGenFramebuffersEXT); - YAGL_GLES_OGL_GET_PROC(driver, DeleteFramebuffers, glDeleteFramebuffersEXT); - YAGL_GLES_OGL_GET_PROC(driver, GenRenderbuffers, glGenRenderbuffersEXT); - YAGL_GLES_OGL_GET_PROC(driver, DeleteRenderbuffers, glDeleteRenderbuffersEXT); - YAGL_GLES_OGL_GET_PROC(driver, BindFramebuffer, glBindFramebufferEXT); - YAGL_GLES_OGL_GET_PROC(driver, BindRenderbuffer, glBindRenderbufferEXT); - YAGL_GLES_OGL_GET_PROC(driver, FramebufferTexture2D, glFramebufferTexture2DEXT); - YAGL_GLES_OGL_GET_PROC(driver, RenderbufferStorage, glRenderbufferStorageEXT); - YAGL_GLES_OGL_GET_PROC(driver, FramebufferRenderbuffer, glFramebufferRenderbufferEXT); - YAGL_GLES_OGL_GET_PROC(driver, CheckFramebufferStatus, glCheckFramebufferStatusEXT); - YAGL_GLES_OGL_GET_PROC(driver, GenerateMipmap, glGenerateMipmapEXT); - YAGL_GLES_OGL_GET_PROC(driver, GetString, glGetString); - YAGL_GLES_OGL_GET_PROC(driver, GetFramebufferAttachmentParameteriv, glGetFramebufferAttachmentParameterivEXT); - YAGL_GLES_OGL_GET_PROC(driver, GetRenderbufferParameteriv, glGetRenderbufferParameterivEXT); - YAGL_GLES_OGL_GET_PROC(driver, BlitFramebuffer, glBlitFramebufferEXT); + YAGL_GLES_OGL_GET_PROC(driver, Finish, glFinish); + 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); + + driver->destroy = &yagl_gles_ogl_destroy; YAGL_LOG_FUNC_EXIT(NULL); - return true; + return driver; fail: yagl_gles_driver_cleanup(driver); + g_free(driver); YAGL_LOG_FUNC_EXIT(NULL); - return false; -} - -void yagl_gles_ogl_cleanup(struct yagl_gles_driver *driver) -{ - yagl_gles_driver_cleanup(driver); + return NULL; } diff --git a/hw/yagl_drivers/gles_ogl/yagl_gles_ogl.h b/hw/yagl_drivers/gles_ogl/yagl_gles_ogl.h index 29d253c..d023574 100644 --- a/hw/yagl_drivers/gles_ogl/yagl_gles_ogl.h +++ b/hw/yagl_drivers/gles_ogl/yagl_gles_ogl.h @@ -6,9 +6,6 @@ struct yagl_gles_driver; struct yagl_dyn_lib; -bool yagl_gles_ogl_init(struct yagl_gles_driver *driver, - struct yagl_dyn_lib *dyn_lib); - -void yagl_gles_ogl_cleanup(struct yagl_gles_driver *driver); +struct yagl_gles_driver *yagl_gles_ogl_create(struct yagl_dyn_lib *dyn_lib); #endif diff --git a/hw/yagl_drivers/gles_onscreen/yagl_gles_onscreen.c b/hw/yagl_drivers/gles_onscreen/yagl_gles_onscreen.c index c747c78..a889aec 100644 --- a/hw/yagl_drivers/gles_onscreen/yagl_gles_onscreen.c +++ b/hw/yagl_drivers/gles_onscreen/yagl_gles_onscreen.c @@ -8,71 +8,14 @@ #include "yagl_backends/egl_onscreen/yagl_egl_onscreen_ts.h" #include "yagl_backends/egl_onscreen/yagl_egl_onscreen_context.h" -YAGL_DECLARE_TLS(struct yagl_egl_onscreen_ts*, egl_onscreen_ts); - -static void YAGL_GLES_APIENTRY yagl_gles_onscreen_GetBooleanv(GLenum pname, GLboolean* params) -{ - GLuint cur_fb = 0; - - if (!egl_onscreen_ts || !egl_onscreen_ts->dpy) { - return; - } - - if ((pname == GL_FRAMEBUFFER_BINDING) && params) { - egl_onscreen_ts->gles_driver->GetIntegerv(pname, (GLint*)&cur_fb); - params[0] = (cur_fb == egl_onscreen_ts->ctx->fb) ? 0 : cur_fb; - } else { - egl_onscreen_ts->gles_driver->GetBooleanv(pname, params); - } -} - -static void YAGL_GLES_APIENTRY yagl_gles_onscreen_GetFloatv(GLenum pname, GLfloat* params) -{ - GLuint cur_fb = 0; - - if (!egl_onscreen_ts || !egl_onscreen_ts->dpy) { - return; - } - - if ((pname == GL_FRAMEBUFFER_BINDING) && params) { - egl_onscreen_ts->gles_driver->GetIntegerv(pname, (GLint*)&cur_fb); - params[0] = (cur_fb == egl_onscreen_ts->ctx->fb) ? 0 : cur_fb; - } else { - egl_onscreen_ts->gles_driver->GetFloatv(pname, params); - } -} - -static void YAGL_GLES_APIENTRY yagl_gles_onscreen_GetIntegerv(GLenum pname, GLint* params) +struct yagl_gles_onscreen { - GLuint cur_fb = 0; + struct yagl_gles_driver base; - if (!egl_onscreen_ts || !egl_onscreen_ts->dpy) { - return; - } - - if ((pname == GL_FRAMEBUFFER_BINDING) && params) { - egl_onscreen_ts->gles_driver->GetIntegerv(pname, (GLint*)&cur_fb); - params[0] = (cur_fb == egl_onscreen_ts->ctx->fb) ? 0 : cur_fb; - } else { - egl_onscreen_ts->gles_driver->GetIntegerv(pname, params); - } -} + struct yagl_gles_driver *orig_driver; +}; -static void YAGL_GLES_APIENTRY yagl_gles_onscreen_DeleteFramebuffers(GLsizei n, - const GLuint* framebuffers) -{ - GLsizei i; - - if (!egl_onscreen_ts || !egl_onscreen_ts->dpy) { - return; - } - - for (i = 0; i < n; ++i) { - if (framebuffers[i] != egl_onscreen_ts->ctx->fb) { - egl_onscreen_ts->gles_driver->DeleteFramebuffers(1, &framebuffers[i]); - } - } -} +YAGL_DECLARE_TLS(struct yagl_egl_onscreen_ts*, egl_onscreen_ts); static void YAGL_GLES_APIENTRY yagl_gles_onscreen_BindFramebuffer(GLenum target, GLuint framebuffer) @@ -81,13 +24,7 @@ static void YAGL_GLES_APIENTRY yagl_gles_onscreen_BindFramebuffer(GLenum target, return; } - if (framebuffer == egl_onscreen_ts->ctx->fb) { - /* - * TODO: Generate GL_INVALID_OPERATION error. - */ - - return; - } + assert(framebuffer != egl_onscreen_ts->ctx->fb); if (framebuffer == 0) { framebuffer = egl_onscreen_ts->ctx->fb; @@ -96,117 +33,43 @@ static void YAGL_GLES_APIENTRY yagl_gles_onscreen_BindFramebuffer(GLenum target, egl_onscreen_ts->gles_driver->BindFramebuffer(target, framebuffer); } -static void YAGL_GLES_APIENTRY yagl_gles_onscreen_FramebufferTexture2D(GLenum target, - GLenum attachment, GLenum textarget, GLuint texture, GLint level) +static void yagl_gles_onscreen_destroy(struct yagl_gles_driver *driver) { - GLuint cur_fb = 0; + struct yagl_gles_onscreen *gles_onscreen = (struct yagl_gles_onscreen*)driver; - if (!egl_onscreen_ts || !egl_onscreen_ts->dpy) { - return; - } + YAGL_LOG_FUNC_ENTER(yagl_gles_onscreen_destroy, NULL); - egl_onscreen_ts->gles_driver->GetIntegerv(GL_FRAMEBUFFER_BINDING, - (GLint*)&cur_fb); - - if (cur_fb != egl_onscreen_ts->ctx->fb) { - egl_onscreen_ts->gles_driver->FramebufferTexture2D(target, - attachment, - textarget, - texture, - level); - } else { - /* - * TODO: Generate GL_INVALID_OPERATION error. - */ - } -} + gles_onscreen->orig_driver->destroy(gles_onscreen->orig_driver); + gles_onscreen->orig_driver = NULL; -static void YAGL_GLES_APIENTRY yagl_gles_onscreen_FramebufferRenderbuffer(GLenum target, - GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) -{ - GLuint cur_fb = 0; - - if (!egl_onscreen_ts || !egl_onscreen_ts->dpy) { - return; - } + yagl_gles_driver_cleanup(driver); + g_free(gles_onscreen); - egl_onscreen_ts->gles_driver->GetIntegerv(GL_FRAMEBUFFER_BINDING, - (GLint*)&cur_fb); - - if (cur_fb != egl_onscreen_ts->ctx->fb) { - egl_onscreen_ts->gles_driver->FramebufferRenderbuffer(target, - attachment, - renderbuffertarget, - renderbuffer); - } else { - /* - * TODO: Generate GL_INVALID_OPERATION error. - */ - } + YAGL_LOG_FUNC_EXIT(NULL); } -static GLenum YAGL_GLES_APIENTRY yagl_gles_onscreen_CheckFramebufferStatus(GLenum target) +struct yagl_gles_driver + *yagl_gles_onscreen_create(struct yagl_gles_driver *orig_driver) { - GLuint cur_fb = 0; + struct yagl_gles_onscreen *driver = NULL; - if (!egl_onscreen_ts || !egl_onscreen_ts->dpy) { - return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT; - } + YAGL_LOG_FUNC_ENTER(yagl_gles_onscreen_create, NULL); - egl_onscreen_ts->gles_driver->GetIntegerv(GL_FRAMEBUFFER_BINDING, - (GLint*)&cur_fb); + driver = g_malloc0(sizeof(*driver)); - if (cur_fb != egl_onscreen_ts->ctx->fb) { - return egl_onscreen_ts->gles_driver->CheckFramebufferStatus(target); - } else { - return GL_FRAMEBUFFER_COMPLETE; - } -} + /* + * Just copy over everything, then init our fields. + */ + memcpy(&driver->base, orig_driver, sizeof(*orig_driver)); + driver->orig_driver = orig_driver; -static void YAGL_GLES_APIENTRY yagl_gles_onscreen_GetFramebufferAttachmentParameteriv(GLenum target, - GLenum attachment, GLenum pname, GLint* params) -{ - GLuint cur_fb = 0; + yagl_gles_driver_init(&driver->base); - if (!egl_onscreen_ts || !egl_onscreen_ts->dpy) { - return; - } + driver->base.BindFramebuffer = &yagl_gles_onscreen_BindFramebuffer; - egl_onscreen_ts->gles_driver->GetIntegerv(GL_FRAMEBUFFER_BINDING, - (GLint*)&cur_fb); - - if (cur_fb != egl_onscreen_ts->ctx->fb) { - egl_onscreen_ts->gles_driver->GetFramebufferAttachmentParameteriv(target, - attachment, - pname, - params); - } else { - /* - * TODO: Generate GL_INVALID_OPERATION error. - */ - } -} - -void yagl_gles_onscreen_init(struct yagl_gles_driver *driver) -{ - YAGL_LOG_FUNC_ENTER(yagl_gles_onscreen_init, NULL); - - yagl_gles_driver_init(driver); - - driver->GetBooleanv = &yagl_gles_onscreen_GetBooleanv; - driver->GetFloatv = &yagl_gles_onscreen_GetFloatv; - driver->GetIntegerv = &yagl_gles_onscreen_GetIntegerv; - driver->DeleteFramebuffers = &yagl_gles_onscreen_DeleteFramebuffers; - driver->BindFramebuffer = &yagl_gles_onscreen_BindFramebuffer; - driver->FramebufferTexture2D = &yagl_gles_onscreen_FramebufferTexture2D; - driver->FramebufferRenderbuffer = &yagl_gles_onscreen_FramebufferRenderbuffer; - driver->CheckFramebufferStatus = &yagl_gles_onscreen_CheckFramebufferStatus; - driver->GetFramebufferAttachmentParameteriv = &yagl_gles_onscreen_GetFramebufferAttachmentParameteriv; + driver->base.destroy = &yagl_gles_onscreen_destroy; YAGL_LOG_FUNC_EXIT(NULL); -} -void yagl_gles_onscreen_cleanup(struct yagl_gles_driver *driver) -{ - yagl_gles_driver_cleanup(driver); + return &driver->base; } diff --git a/hw/yagl_drivers/gles_onscreen/yagl_gles_onscreen.h b/hw/yagl_drivers/gles_onscreen/yagl_gles_onscreen.h index 9b22195..3a1f563 100644 --- a/hw/yagl_drivers/gles_onscreen/yagl_gles_onscreen.h +++ b/hw/yagl_drivers/gles_onscreen/yagl_gles_onscreen.h @@ -5,7 +5,10 @@ struct yagl_gles_driver; -void yagl_gles_onscreen_init(struct yagl_gles_driver *driver); -void yagl_gles_onscreen_cleanup(struct yagl_gles_driver *driver); +/* + * Takes ownership of 'orig_driver'. + */ +struct yagl_gles_driver + *yagl_gles_onscreen_create(struct yagl_gles_driver *orig_driver); #endif diff --git a/hw/yagl_egl_backend.h b/hw/yagl_egl_backend.h index caf64ff..6188c42 100644 --- a/hw/yagl_egl_backend.h +++ b/hw/yagl_egl_backend.h @@ -18,6 +18,8 @@ struct yagl_egl_backend 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*/, @@ -29,6 +31,8 @@ struct yagl_egl_backend 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*/); /* diff --git a/hw/yagl_egl_driver.h b/hw/yagl_egl_driver.h index 18ca0c4..0bb7ade 100644 --- a/hw/yagl_egl_driver.h +++ b/hw/yagl_egl_driver.h @@ -59,7 +59,6 @@ struct yagl_egl_driver EGLContext (*context_create)(struct yagl_egl_driver */*driver*/, EGLNativeDisplayType /*dpy*/, const struct yagl_egl_native_config */*cfg*/, - yagl_client_api /*client_api*/, EGLContext /*share_context*/); void (*context_destroy)(struct yagl_egl_driver */*driver*/, diff --git a/hw/yagl_egl_interface.c b/hw/yagl_egl_interface.c deleted file mode 100644 index 1325331..0000000 --- a/hw/yagl_egl_interface.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "yagl_egl_interface.h" - -void yagl_egl_interface_init(struct yagl_egl_interface *iface, - yagl_render_type render_type) -{ - iface->render_type = render_type; -} - -void yagl_egl_interface_cleanup(struct yagl_egl_interface *iface) -{ -} diff --git a/hw/yagl_egl_interface.h b/hw/yagl_egl_interface.h index f3a8362..f4c7665 100644 --- a/hw/yagl_egl_interface.h +++ b/hw/yagl_egl_interface.h @@ -3,26 +3,11 @@ #include "yagl_types.h" -struct yagl_client_context; -struct yagl_client_image; - struct yagl_egl_interface { - yagl_render_type render_type; - - struct yagl_client_context *(*get_ctx)(struct yagl_egl_interface */*iface*/); - - struct yagl_client_image *(*get_image)(struct yagl_egl_interface */*iface*/, - yagl_host_handle /*image*/); - void (*ensure_ctx)(struct yagl_egl_interface */*iface*/); void (*unensure_ctx)(struct yagl_egl_interface */*iface*/); }; -void yagl_egl_interface_init(struct yagl_egl_interface *iface, - yagl_render_type render_type); - -void yagl_egl_interface_cleanup(struct yagl_egl_interface *iface); - #endif diff --git a/hw/yagl_eglb_context.c b/hw/yagl_eglb_context.c index e619d15..12c5597 100644 --- a/hw/yagl_eglb_context.c +++ b/hw/yagl_eglb_context.c @@ -1,11 +1,9 @@ #include "yagl_eglb_context.h" void yagl_eglb_context_init(struct yagl_eglb_context *ctx, - struct yagl_eglb_display *dpy, - struct yagl_client_context *client_ctx) + struct yagl_eglb_display *dpy) { ctx->dpy = dpy; - ctx->client_ctx = client_ctx; } void yagl_eglb_context_cleanup(struct yagl_eglb_context *ctx) diff --git a/hw/yagl_eglb_context.h b/hw/yagl_eglb_context.h index 6b68e9d..43474e7 100644 --- a/hw/yagl_eglb_context.h +++ b/hw/yagl_eglb_context.h @@ -4,20 +4,16 @@ #include "yagl_types.h" struct yagl_eglb_display; -struct yagl_client_context; struct yagl_eglb_context { struct yagl_eglb_display *dpy; - struct yagl_client_context *client_ctx; - void (*destroy)(struct yagl_eglb_context */*ctx*/); }; void yagl_eglb_context_init(struct yagl_eglb_context *ctx, - struct yagl_eglb_display *dpy, - struct yagl_client_context *client_ctx); + struct yagl_eglb_display *dpy); void yagl_eglb_context_cleanup(struct yagl_eglb_context *ctx); #endif diff --git a/hw/yagl_eglb_display.h b/hw/yagl_eglb_display.h index e706b50..febd801 100644 --- a/hw/yagl_eglb_display.h +++ b/hw/yagl_eglb_display.h @@ -7,12 +7,11 @@ struct yagl_egl_backend; struct yagl_eglb_context; struct yagl_eglb_surface; -struct yagl_eglb_image; struct yagl_egl_native_config; struct yagl_egl_window_attribs; struct yagl_egl_pixmap_attribs; struct yagl_egl_pbuffer_attribs; -struct yagl_client_context; +struct yagl_object; struct yagl_eglb_display { @@ -26,7 +25,6 @@ struct yagl_eglb_display struct yagl_eglb_context *(*create_context)(struct yagl_eglb_display */*dpy*/, const struct yagl_egl_native_config */*cfg*/, - struct yagl_client_context */*client_ctx*/, struct yagl_eglb_context */*share_context*/); /* @@ -56,8 +54,8 @@ struct yagl_eglb_display const struct yagl_egl_pbuffer_attribs */*attribs*/, yagl_winsys_id /*id*/); - struct yagl_eglb_image *(*create_image)(struct yagl_eglb_display */*dpy*/, - yagl_winsys_id /*buffer*/); + struct yagl_object *(*create_image)(struct yagl_eglb_display */*dpy*/, + yagl_winsys_id /*buffer*/); void (*destroy)(struct yagl_eglb_display */*dpy*/); }; diff --git a/hw/yagl_eglb_image.c b/hw/yagl_eglb_image.c deleted file mode 100644 index e28c423..0000000 --- a/hw/yagl_eglb_image.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "yagl_eglb_image.h" -#include "yagl_client_image.h" - -void yagl_eglb_image_init(struct yagl_eglb_image *image, - yagl_winsys_id buffer, - struct yagl_eglb_display *dpy) -{ - image->buffer = buffer; - image->dpy = dpy; -} - -void yagl_eglb_image_cleanup(struct yagl_eglb_image *image) -{ - yagl_client_image_release(image->glegl_image); -} diff --git a/hw/yagl_eglb_image.h b/hw/yagl_eglb_image.h deleted file mode 100644 index 7e485cd..0000000 --- a/hw/yagl_eglb_image.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef _QEMU_YAGL_EGLB_IMAGE_H -#define _QEMU_YAGL_EGLB_IMAGE_H - -#include "yagl_types.h" - -struct yagl_eglb_display; -struct yagl_client_image; - -struct yagl_eglb_image -{ - yagl_winsys_id buffer; - - struct yagl_eglb_display *dpy; - - /* - * This is GLES part of EGLImageKHR - GLeglImageOES. - */ - struct yagl_client_image *glegl_image; - - void (*update_offscreen)(struct yagl_eglb_image */*image*/, - uint32_t /*width*/, - uint32_t /*height*/, - uint32_t /*bpp*/, - const void */*pixels*/); - - void (*destroy)(struct yagl_eglb_image */*image*/); -}; - -void yagl_eglb_image_init(struct yagl_eglb_image *image, - yagl_winsys_id buffer, - struct yagl_eglb_display *dpy); -void yagl_eglb_image_cleanup(struct yagl_eglb_image *image); - -#endif diff --git a/hw/yagl_eglb_surface.h b/hw/yagl_eglb_surface.h index 4b7c3f8..8bd6da0 100644 --- a/hw/yagl_eglb_surface.h +++ b/hw/yagl_eglb_surface.h @@ -48,17 +48,6 @@ struct yagl_eglb_surface void (*wait_gl)(struct yagl_eglb_surface */*sfc*/); - /* - * Can be called even when this surface is not current! - * @{ - */ - bool (*bind_tex_image)(struct yagl_eglb_surface */*sfc*/); - - bool (*release_tex_image)(struct yagl_eglb_surface */*sfc*/); - /* - * @} - */ - void (*destroy)(struct yagl_eglb_surface */*sfc*/); }; diff --git a/hw/yagl_gles1_driver.c b/hw/yagl_gles1_driver.c deleted file mode 100644 index 18a8cc4..0000000 --- a/hw/yagl_gles1_driver.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include "yagl_gles1_driver.h" - -void yagl_gles1_driver_init(struct yagl_gles1_driver *driver) -{ -} - -void yagl_gles1_driver_cleanup(struct yagl_gles1_driver *driver) -{ -} diff --git a/hw/yagl_gles1_driver.h b/hw/yagl_gles1_driver.h deleted file mode 100644 index bdfaa90..0000000 --- a/hw/yagl_gles1_driver.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef _QEMU_YAGL_GLES1_DRIVER_H -#define _QEMU_YAGL_GLES1_DRIVER_H - -#include "yagl_types.h" -#include "yagl_gles_driver.h" - -/* - * YaGL GLES1 driver. - * @{ - */ - -struct yagl_gles1_driver -{ - struct yagl_gles_driver base; - - YAGL_GLES_DRIVER_FUNC2(AlphaFunc, GLenum, GLclampf, func, ref) - YAGL_GLES_DRIVER_FUNC4(Color4f, GLfloat, GLfloat, GLfloat, GLfloat, red, green, blue, alpha) - YAGL_GLES_DRIVER_FUNC2(DepthRangef, GLclampf, GLclampf, zNear, zFar) - 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(GetLightfv, GLenum, GLenum, GLfloat*, light, pname, params) - YAGL_GLES_DRIVER_FUNC3(GetMaterialfv, GLenum, GLenum, GLfloat*, face, pname, params) - YAGL_GLES_DRIVER_FUNC3(GetTexEnvfv, GLenum, GLenum, GLfloat*, env, 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(Lightf, GLenum, GLenum, GLfloat, light, pname, param) - YAGL_GLES_DRIVER_FUNC3(Lightfv, GLenum, GLenum, const GLfloat*, light, pname, params) - YAGL_GLES_DRIVER_FUNC1(LoadMatrixf, const GLfloat*, m) - 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_FUNC1(MultMatrixf, const GLfloat*, m) - YAGL_GLES_DRIVER_FUNC5(MultiTexCoord4f, GLenum, GLfloat, GLfloat, GLfloat, GLfloat, target, s, t, r, q) - YAGL_GLES_DRIVER_FUNC3(Normal3f, GLfloat, GLfloat, GLfloat, nx, ny, nz) - 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_FUNC2(PointParameterf, GLenum, GLfloat, pname, param) - YAGL_GLES_DRIVER_FUNC2(PointParameterfv, GLenum, const GLfloat*, pname, params) - YAGL_GLES_DRIVER_FUNC1(PointSize, GLfloat, size) - YAGL_GLES_DRIVER_FUNC4(Rotatef, GLfloat, GLfloat, GLfloat, GLfloat, angle, x, y, z) - YAGL_GLES_DRIVER_FUNC3(Scalef, GLfloat, GLfloat, GLfloat, x, y, z) - YAGL_GLES_DRIVER_FUNC3(TexEnvf, GLenum, GLenum, GLfloat, target, pname, param) - YAGL_GLES_DRIVER_FUNC3(TexEnvfv, GLenum, GLenum, const GLfloat*, target, pname, params) - YAGL_GLES_DRIVER_FUNC3(Translatef, GLfloat, GLfloat, GLfloat, x, y, z) - YAGL_GLES_DRIVER_FUNC1(ClientActiveTexture, GLenum, texture) - YAGL_GLES_DRIVER_FUNC2(ClipPlane, GLenum, const yagl_GLdouble *, plane, equation) - YAGL_GLES_DRIVER_FUNC4(Color4ub, GLubyte, GLubyte, GLubyte, GLubyte, red, green, blue, alpha) - YAGL_GLES_DRIVER_FUNC4(ColorPointer, 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(GetClipPlane, GLenum, const yagl_GLdouble *, plane, equation) - YAGL_GLES_DRIVER_FUNC2(GetPointerv, GLenum, GLvoid**, pname, params) - YAGL_GLES_DRIVER_FUNC3(GetTexEnviv, GLenum, GLenum, GLint*, env, pname, params) - YAGL_GLES_DRIVER_FUNC0(LoadIdentity) - YAGL_GLES_DRIVER_FUNC1(LogicOp, GLenum, opcode) - YAGL_GLES_DRIVER_FUNC1(MatrixMode, GLenum, mode) - YAGL_GLES_DRIVER_FUNC3(NormalPointer, GLenum, GLsizei, const GLvoid*, type, stride, pointer) - YAGL_GLES_DRIVER_FUNC0(PopMatrix) - YAGL_GLES_DRIVER_FUNC0(PushMatrix) - YAGL_GLES_DRIVER_FUNC1(ShadeModel, GLenum, mode) - YAGL_GLES_DRIVER_FUNC4(TexCoordPointer, GLint, GLenum, GLsizei, const GLvoid*, size, type, stride, pointer) - YAGL_GLES_DRIVER_FUNC3(TexEnvi, GLenum, GLenum, GLint, target, pname, param) - YAGL_GLES_DRIVER_FUNC3(TexEnviv, GLenum, GLenum, const GLint*, target, pname, params) - YAGL_GLES_DRIVER_FUNC4(VertexPointer, GLint, GLenum, GLsizei, const GLvoid*, size, type, stride, pointer) - - void (*destroy)(struct yagl_gles1_driver */*driver*/); -}; - -void yagl_gles1_driver_init(struct yagl_gles1_driver *driver); -void yagl_gles1_driver_cleanup(struct yagl_gles1_driver *driver); - -/* - * @} - */ - -#endif diff --git a/hw/yagl_gles2_driver.c b/hw/yagl_gles2_driver.c deleted file mode 100644 index 8682c91..0000000 --- a/hw/yagl_gles2_driver.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include "yagl_gles2_driver.h" - -void yagl_gles2_driver_init(struct yagl_gles2_driver *driver) -{ -} - -void yagl_gles2_driver_cleanup(struct yagl_gles2_driver *driver) -{ -} diff --git a/hw/yagl_gles2_driver.h b/hw/yagl_gles2_driver.h deleted file mode 100644 index 817d180..0000000 --- a/hw/yagl_gles2_driver.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef _QEMU_YAGL_GLES2_DRIVER_H -#define _QEMU_YAGL_GLES2_DRIVER_H - -#include "yagl_types.h" -#include "yagl_gles_driver.h" - -/* - * YaGL GLES2 driver. - * @{ - */ - -struct yagl_gles2_driver -{ - struct yagl_gles_driver base; - - YAGL_GLES_DRIVER_FUNC2(AttachShader, GLuint, GLuint, program, shader) - YAGL_GLES_DRIVER_FUNC3(BindAttribLocation, GLuint, GLuint, const GLchar*, program, index, name) - YAGL_GLES_DRIVER_FUNC4(BlendColor, GLclampf, GLclampf, GLclampf, GLclampf, red, green, blue, alpha) - YAGL_GLES_DRIVER_FUNC1(CompileShader, GLuint, shader) - 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_FUNC2(DetachShader, GLuint, GLuint, program, shader) - YAGL_GLES_DRIVER_FUNC1(DisableVertexAttribArray, GLuint, index) - YAGL_GLES_DRIVER_FUNC1(EnableVertexAttribArray, GLuint, index) - 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_FUNC4(GetAttachedShaders, GLuint, GLsizei, GLsizei*, GLuint*, program, maxcount, count, shaders) - 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_FUNC4(GetShaderPrecisionFormat, GLenum, GLenum, GLint*, GLint*, shadertype, precisiontype, range, precision) - YAGL_GLES_DRIVER_FUNC4(GetShaderSource, GLuint, GLsizei, GLsizei*, GLchar*, shader, bufsize, length, source) - 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_FUNC3(GetVertexAttribPointerv, GLuint, GLenum, GLvoid**, index, pname, pointer) - YAGL_GLES_DRIVER_FUNC_RET1(GLboolean, IsProgram, GLuint, program) - YAGL_GLES_DRIVER_FUNC_RET1(GLboolean, IsShader, GLuint, shader) - YAGL_GLES_DRIVER_FUNC1(LinkProgram, GLuint, program) - YAGL_GLES_DRIVER_FUNC4(ShaderSource, GLuint, GLsizei, const GLchar**, const GLint*, shader, count, string, length) - 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_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_FUNC6(VertexAttribPointer, GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid*, indx, size, type, normalized, stride, ptr) - - void (*destroy)(struct yagl_gles2_driver */*driver*/); -}; - -/* - * Does NOT take ownership of 'common', you must destroy it yourself when - * you're done! - */ -void yagl_gles2_driver_init(struct yagl_gles2_driver *driver); -void yagl_gles2_driver_cleanup(struct yagl_gles2_driver *driver); - -/* - * @} - */ - -#endif diff --git a/hw/yagl_gles_driver.h b/hw/yagl_gles_driver.h index fa45896..6dc3502 100644 --- a/hw/yagl_gles_driver.h +++ b/hw/yagl_gles_driver.h @@ -63,91 +63,190 @@ void (YAGL_GLES_APIENTRY *func)(arg0_type arg0, arg1_type arg1, arg2_type arg2, typedef double yagl_GLdouble; /* - * YaGL GLES driver per-process state. + * YaGL GLES driver. * @{ */ struct yagl_gles_driver { - YAGL_GLES_DRIVER_FUNC1(ActiveTexture, GLenum, texture) + 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_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(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_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_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_FUNC1(CullFace, GLenum, mode) - YAGL_GLES_DRIVER_FUNC2(DeleteBuffers, GLsizei, const GLuint*, n, buffers) - YAGL_GLES_DRIVER_FUNC2(DeleteTextures, GLsizei, const GLuint*, n, textures) 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(Disable, GLenum, cap) - 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_FUNC1(Enable, GLenum, cap) - YAGL_GLES_DRIVER_FUNC0(Finish) + YAGL_GLES_DRIVER_FUNC1(Disable, GLenum, cap) YAGL_GLES_DRIVER_FUNC0(Flush) YAGL_GLES_DRIVER_FUNC1(FrontFace, GLenum, mode) - YAGL_GLES_DRIVER_FUNC2(GenBuffers, GLsizei, GLuint*, n, buffers) - YAGL_GLES_DRIVER_FUNC2(GenTextures, GLsizei, GLuint*, n, textures) - YAGL_GLES_DRIVER_FUNC2(GetBooleanv, GLenum, GLboolean*, pname, params) - YAGL_GLES_DRIVER_FUNC3(GetBufferParameteriv, GLenum, GLenum, GLint*, target, pname, params) - YAGL_GLES_DRIVER_FUNC_RET0(GLenum, GetError) - YAGL_GLES_DRIVER_FUNC2(GetFloatv, GLenum, GLfloat*, pname, params) - YAGL_GLES_DRIVER_FUNC2(GetIntegerv, GLenum, GLint*, pname, params) - 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_FUNC1(GenerateMipmap, GLenum, target) YAGL_GLES_DRIVER_FUNC2(Hint, GLenum, GLenum, target, mode) - YAGL_GLES_DRIVER_FUNC_RET1(GLboolean, IsBuffer, GLuint, buffer) - YAGL_GLES_DRIVER_FUNC_RET1(GLboolean, IsEnabled, GLenum, cap) - YAGL_GLES_DRIVER_FUNC_RET1(GLboolean, IsTexture, GLuint, texture) 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_FUNC7(ReadPixels, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*, x, y, width, height, format, type, pixels) - YAGL_GLES_DRIVER_FUNC2(SampleCoverage, GLclampf, GLboolean, value, invert) 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_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_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) + YAGL_GLES_DRIVER_FUNC1(PushClientAttrib, GLbitfield, mask) YAGL_GLES_DRIVER_FUNC0(PopClientAttrib) YAGL_GLES_DRIVER_FUNC_RET2(void*, MapBuffer, GLenum, GLenum, target, access) YAGL_GLES_DRIVER_FUNC_RET1(GLboolean, UnmapBuffer, GLenum, target) - YAGL_GLES_DRIVER_FUNC2(GenFramebuffers, GLsizei, GLuint*, n, framebuffers) - YAGL_GLES_DRIVER_FUNC2(DeleteFramebuffers, GLsizei, const GLuint*, n, framebuffers) - YAGL_GLES_DRIVER_FUNC2(GenRenderbuffers, GLsizei, GLuint*, n, renderbuffers) - YAGL_GLES_DRIVER_FUNC2(DeleteRenderbuffers, GLsizei, const GLuint*, n, renderbuffers) - YAGL_GLES_DRIVER_FUNC2(BindFramebuffer, GLenum, GLuint, target, framebuffer) - YAGL_GLES_DRIVER_FUNC2(BindRenderbuffer, GLenum, GLuint, target, renderbuffer) - YAGL_GLES_DRIVER_FUNC5(FramebufferTexture2D, GLenum, GLenum, GLenum, GLuint, GLint, target, attachment, textarget, texture, level) - YAGL_GLES_DRIVER_FUNC4(RenderbufferStorage, GLenum, GLenum, GLsizei, GLsizei, target, internalformat, width, height) - YAGL_GLES_DRIVER_FUNC4(FramebufferRenderbuffer, GLenum, GLenum, GLenum, GLuint, target, attachment, renderbuffertarget, renderbuffer) - YAGL_GLES_DRIVER_FUNC_RET1(GLenum, CheckFramebufferStatus, GLenum, target) - YAGL_GLES_DRIVER_FUNC1(GenerateMipmap, GLenum, target) - YAGL_GLES_DRIVER_FUNC_RET1(const GLubyte*, GetString, GLenum, name) - YAGL_GLES_DRIVER_FUNC4(GetFramebufferAttachmentParameteriv, GLenum, GLenum, GLenum, GLint*, target, attachment, pname, params); - YAGL_GLES_DRIVER_FUNC3(GetRenderbufferParameteriv, GLenum, GLenum, GLint*, target, pname, params); - 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_FUNC0(Finish) + + void (*destroy)(struct yagl_gles_driver */*driver*/); }; void yagl_gles_driver_init(struct yagl_gles_driver *driver); diff --git a/hw/yagl_mem.c b/hw/yagl_mem.c index 7f98087..eb63713 100644 --- a/hw/yagl_mem.c +++ b/hw/yagl_mem.c @@ -49,7 +49,7 @@ bool yagl_mem_prepare(struct yagl_mem_transfer *mt, if (va) { while (len > 0) { page_va = va & TARGET_PAGE_MASK; - page_pa = cpu_get_phys_page_debug(cur_ts->current_env, page_va); + page_pa = cpu_get_phys_page_debug(current_cpu, page_va); if (page_pa == -1) { YAGL_LOG_WARN("page fault at 0x%X", (uint32_t)page_va); @@ -111,7 +111,7 @@ bool yagl_mem_get(target_ulong va, uint32_t len, void* data) YAGL_LOG_FUNC_ENTER(yagl_mem_get, "va = 0x%X, len = %u", (uint32_t)va, len); - ret = cpu_memory_rw_debug(cur_ts->current_env, va, data, len, 0); + ret = cpu_memory_rw_debug(current_cpu, va, data, len, 0); if (ret == -1) { YAGL_LOG_WARN("page fault at 0x%X", (uint32_t)va, len); diff --git a/hw/yagl_namespace.c b/hw/yagl_namespace.c deleted file mode 100644 index 3aa2b49..0000000 --- a/hw/yagl_namespace.c +++ /dev/null @@ -1,139 +0,0 @@ -#include "yagl_namespace.h" -#include "yagl_avl.h" -#include "yagl_object.h" - -struct yagl_namespace_entry -{ - yagl_object_name local_name; - - struct yagl_object *obj; -}; - -static int yagl_namespace_entry_comparison_func(const void *avl_a, - const void *avl_b, - void *avl_param) -{ - const struct yagl_namespace_entry *a = avl_a; - const struct yagl_namespace_entry *b = avl_b; - - if (a->local_name < b->local_name) { - return -1; - } else if (a->local_name > b->local_name) { - return 1; - } else { - return 0; - } -} - -static void yagl_namespace_entry_destroy_func(void *avl_item, void *avl_param) -{ - struct yagl_namespace_entry *item = avl_item; - - yagl_object_release(item->obj); - - g_free(item); -} - -void yagl_namespace_init(struct yagl_namespace *ns) -{ - ns->entries = yagl_avl_create(&yagl_namespace_entry_comparison_func, - ns, - NULL); - assert(ns->entries); - ns->next_local_name = 1; -} - -void yagl_namespace_cleanup(struct yagl_namespace *ns) -{ - yagl_avl_destroy(ns->entries, &yagl_namespace_entry_destroy_func); - ns->entries = NULL; - ns->next_local_name = 0; -} - -yagl_object_name yagl_namespace_add(struct yagl_namespace *ns, - struct yagl_object *obj) -{ - struct yagl_namespace_entry *item = - g_malloc0(sizeof(struct yagl_namespace_entry)); - - yagl_object_acquire(obj); - - item->obj = obj; - - do { - if (!ns->next_local_name) { - /* - * 0 names are invalid. - */ - - ++ns->next_local_name; - } - - item->local_name = ns->next_local_name++; - - /* - * Find a free local name. - */ - } while (yagl_avl_insert(ns->entries, item)); - - return item->local_name; -} - -struct yagl_object *yagl_namespace_add_named(struct yagl_namespace *ns, - yagl_object_name local_name, - struct yagl_object *obj) -{ - struct yagl_namespace_entry *dup_item; - struct yagl_namespace_entry *item = - g_malloc0(sizeof(struct yagl_namespace_entry)); - - item->local_name = local_name; - item->obj = obj; - - dup_item = yagl_avl_insert(ns->entries, item); - - if (dup_item) { - yagl_namespace_entry_destroy_func(item, ns->entries->avl_param); - - yagl_object_acquire(dup_item->obj); - - return dup_item->obj; - } else { - yagl_object_acquire(obj); - - return obj; - } -} - -void yagl_namespace_remove(struct yagl_namespace *ns, - yagl_object_name local_name) -{ - void *item; - struct yagl_namespace_entry dummy; - - dummy.local_name = local_name; - - item = yagl_avl_delete(ns->entries, &dummy); - - if (item) { - yagl_namespace_entry_destroy_func(item, ns->entries->avl_param); - } -} - -struct yagl_object *yagl_namespace_acquire(struct yagl_namespace *ns, - yagl_object_name local_name) -{ - struct yagl_namespace_entry *item; - struct yagl_namespace_entry dummy; - - dummy.local_name = local_name; - - item = yagl_avl_find(ns->entries, &dummy); - - if (item) { - yagl_object_acquire(item->obj); - return item->obj; - } else { - return NULL; - } -} diff --git a/hw/yagl_namespace.h b/hw/yagl_namespace.h deleted file mode 100644 index 55d8ca1..0000000 --- a/hw/yagl_namespace.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef _QEMU_YAGL_NAMESPACE_H -#define _QEMU_YAGL_NAMESPACE_H - -#include "yagl_types.h" - -struct yagl_object; -struct yagl_avl_table; - -struct yagl_namespace -{ - struct yagl_avl_table *entries; - - yagl_object_name next_local_name; -}; - -void yagl_namespace_init(struct yagl_namespace *ns); - -void yagl_namespace_cleanup(struct yagl_namespace *ns); - -/* - * Adds an object to namespace and returns its local name, - * this acquires 'obj', so the - * caller should release 'obj' if he doesn't want to use it and wants - * it to belong to this namespace alone. - */ -yagl_object_name yagl_namespace_add(struct yagl_namespace *ns, - struct yagl_object *obj); - -/* - * Same as the above, but adds an object with local name. - * If an object with such local name already exists then 'obj' will be - * released and the existing object will be acquired and returned. - * Otherwise, 'obj' is acquired and returned. - * Typical use-case for this function is: - * - * yagl_object *obj; - * obj = yagl_namespace_acquire(ns, local_name); - * if (!obj) { - * obj = yagl_xxx_create(...); - * obj = yagl_namespace_add_named(ns, local_name, obj); - * } - * // use 'obj'. - * yagl_object_release(obj); - */ -struct yagl_object *yagl_namespace_add_named(struct yagl_namespace *ns, - yagl_object_name local_name, - struct yagl_object *obj); - -/* - * Removes an object from the namespace, this also releases the - * object. - */ -void yagl_namespace_remove(struct yagl_namespace *ns, - yagl_object_name local_name); - -/* - * Acquires an object by its local name. Be sure to release the object when - * you're done. - */ -struct yagl_object *yagl_namespace_acquire(struct yagl_namespace *ns, - yagl_object_name local_name); - -#endif diff --git a/hw/yagl_object.c b/hw/yagl_object.c deleted file mode 100644 index 25848c7..0000000 --- a/hw/yagl_object.c +++ /dev/null @@ -1,26 +0,0 @@ -#include "yagl_object.h" - -void yagl_object_init(struct yagl_object *obj, - yagl_ref_destroy_func destroy) -{ - yagl_ref_init(&obj->ref, destroy); -} - -void yagl_object_cleanup(struct yagl_object *obj) -{ - yagl_ref_cleanup(&obj->ref); -} - -void yagl_object_acquire(struct yagl_object *obj) -{ - if (obj) { - yagl_ref_acquire(&obj->ref); - } -} - -void yagl_object_release(struct yagl_object *obj) -{ - if (obj) { - yagl_ref_release(&obj->ref); - } -} diff --git a/hw/yagl_object.h b/hw/yagl_object.h deleted file mode 100644 index 5bc6d7c..0000000 --- a/hw/yagl_object.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _QEMU_YAGL_OBJECT_H -#define _QEMU_YAGL_OBJECT_H - -#include "yagl_types.h" -#include "yagl_ref.h" - -struct yagl_object -{ - struct yagl_ref ref; -}; - -/* - * For implementations. - * @{ - */ - -void yagl_object_init(struct yagl_object *obj, - yagl_ref_destroy_func destroy); -void yagl_object_cleanup(struct yagl_object *obj); - -/* - * @} - */ - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_object_acquire(struct yagl_object *obj); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_object_release(struct yagl_object *obj); - -#endif diff --git a/hw/yagl_object_map.c b/hw/yagl_object_map.c new file mode 100644 index 0000000..aec5cec --- /dev/null +++ b/hw/yagl_object_map.c @@ -0,0 +1,108 @@ +#include "yagl_object_map.h" +#include "yagl_avl.h" + +struct yagl_object_map_entry +{ + yagl_object_name local_name; + + struct yagl_object *obj; +}; + +static int yagl_object_map_entry_comparison_func(const void *avl_a, + const void *avl_b, + void *avl_param) +{ + const struct yagl_object_map_entry *a = avl_a; + const struct yagl_object_map_entry *b = avl_b; + + if (a->local_name < b->local_name) { + return -1; + } else if (a->local_name > b->local_name) { + return 1; + } else { + return 0; + } +} + +static void yagl_object_map_entry_destroy_func(void *avl_item, void *avl_param) +{ + struct yagl_object_map_entry *item = avl_item; + + item->obj->destroy(item->obj); + + g_free(item); +} + +struct yagl_object_map *yagl_object_map_create(void) +{ + struct yagl_object_map *object_map = g_malloc0(sizeof(struct yagl_object_map)); + + object_map->entries = yagl_avl_create(&yagl_object_map_entry_comparison_func, + object_map, + NULL); + assert(object_map->entries); + + return object_map; +} + +void yagl_object_map_destroy(struct yagl_object_map *object_map) +{ + yagl_avl_destroy(object_map->entries, &yagl_object_map_entry_destroy_func); + object_map->entries = NULL; + + g_free(object_map); +} + +void yagl_object_map_add(struct yagl_object_map *object_map, + yagl_object_name local_name, + struct yagl_object *obj) +{ + struct yagl_object_map_entry *item = + g_malloc0(sizeof(struct yagl_object_map_entry)); + + item->local_name = local_name; + item->obj = obj; + + yagl_avl_assert_insert(object_map->entries, item); +} + +void yagl_object_map_remove(struct yagl_object_map *object_map, + yagl_object_name local_name) +{ + void *item; + struct yagl_object_map_entry dummy; + + dummy.local_name = local_name; + + item = yagl_avl_assert_delete(object_map->entries, &dummy); + + yagl_object_map_entry_destroy_func(item, object_map->entries->avl_param); +} + +void yagl_object_map_remove_all(struct yagl_object_map *object_map) +{ + yagl_avl_destroy(object_map->entries, &yagl_object_map_entry_destroy_func); + + object_map->entries = yagl_avl_create(&yagl_object_map_entry_comparison_func, + object_map, + NULL); + assert(object_map->entries); +} + +yagl_object_name yagl_object_map_get(struct yagl_object_map *object_map, + yagl_object_name local_name) +{ + struct yagl_object_map_entry *item; + struct yagl_object_map_entry dummy; + + dummy.local_name = local_name; + + item = yagl_avl_find(object_map->entries, &dummy); + + if (item) { + return item->obj->global_name; + } else { + assert(0); + return 0; + } +} diff --git a/hw/yagl_object_map.h b/hw/yagl_object_map.h new file mode 100644 index 0000000..a5bc632 --- /dev/null +++ b/hw/yagl_object_map.h @@ -0,0 +1,36 @@ +#ifndef _QEMU_YAGL_OBJECT_MAP_H +#define _QEMU_YAGL_OBJECT_MAP_H + +#include "yagl_types.h" + +struct yagl_avl_table; + +struct yagl_object +{ + yagl_object_name global_name; + + void (*destroy)(struct yagl_object */*obj*/); +}; + +struct yagl_object_map +{ + struct yagl_avl_table *entries; +}; + +struct yagl_object_map *yagl_object_map_create(void); + +void yagl_object_map_destroy(struct yagl_object_map *object_map); + +void yagl_object_map_add(struct yagl_object_map *object_map, + yagl_object_name local_name, + struct yagl_object *obj); + +void yagl_object_map_remove(struct yagl_object_map *object_map, + yagl_object_name local_name); + +void yagl_object_map_remove_all(struct yagl_object_map *object_map); + +yagl_object_name yagl_object_map_get(struct yagl_object_map *object_map, + yagl_object_name local_name); + +#endif diff --git a/hw/yagl_process.c b/hw/yagl_process.c index 2c672aa..b87e9aa 100644 --- a/hw/yagl_process.c +++ b/hw/yagl_process.c @@ -3,6 +3,7 @@ #include "yagl_server.h" #include "yagl_log.h" #include "yagl_stats.h" +#include "yagl_object_map.h" #include "sysemu/kvm.h" struct yagl_process_state @@ -14,6 +15,7 @@ struct yagl_process_state ps->ss = ss; ps->id = id; + ps->object_map = yagl_object_map_create(); QLIST_INIT(&ps->threads); #ifdef CONFIG_KVM @@ -39,6 +41,8 @@ void yagl_process_state_destroy(struct yagl_process_state *ps) assert(QLIST_EMPTY(&ps->threads)); + yagl_object_map_destroy(ps->object_map); + g_free(ps); yagl_stats_dump(); @@ -86,49 +90,6 @@ void yagl_process_unregister_egl_interface(struct yagl_process_state *ps) YAGL_LOG_FUNC_EXIT(NULL); } -void yagl_process_register_client_interface(struct yagl_process_state *ps, - yagl_client_api client_api, - struct yagl_client_interface *client_iface) -{ - YAGL_LOG_FUNC_ENTER(yagl_process_register_client_interface, NULL); - - assert(!ps->client_ifaces[client_api]); - - if (ps->client_ifaces[client_api]) { - YAGL_LOG_CRITICAL("client interface %d is already registered", - client_api); - - YAGL_LOG_FUNC_EXIT(NULL); - - return; - } - - ps->client_ifaces[client_api] = client_iface; - - YAGL_LOG_FUNC_EXIT(NULL); -} - -void yagl_process_unregister_client_interface(struct yagl_process_state *ps, - yagl_client_api client_api) -{ - YAGL_LOG_FUNC_ENTER(yagl_process_unregister_client_interface, NULL); - - assert(ps->client_ifaces[client_api]); - - if (!ps->client_ifaces[client_api]) { - YAGL_LOG_CRITICAL("client interface %d was not registered", - client_api); - - YAGL_LOG_FUNC_EXIT(NULL); - - return; - } - - ps->client_ifaces[client_api] = NULL; - - YAGL_LOG_FUNC_EXIT(NULL); -} - struct yagl_thread_state* yagl_process_find_thread(struct yagl_process_state *ps, yagl_tid id) diff --git a/hw/yagl_process.h b/hw/yagl_process.h index 95033f1..1704d8c 100644 --- a/hw/yagl_process.h +++ b/hw/yagl_process.h @@ -6,9 +6,9 @@ struct yagl_server_state; struct yagl_thread_state; -struct yagl_egl_interface; -struct yagl_client_interface; +struct yagl_object_map; struct yagl_api_ps; +struct yagl_egl_interface; struct yagl_process_state { @@ -21,7 +21,8 @@ struct yagl_process_state struct yagl_api_ps *api_states[YAGL_NUM_APIS]; struct yagl_egl_interface *egl_iface; - struct yagl_client_interface *client_ifaces[YAGL_NUM_CLIENT_APIS]; + + struct yagl_object_map *object_map; QLIST_HEAD(, yagl_thread_state) threads; @@ -41,13 +42,6 @@ void yagl_process_register_egl_interface(struct yagl_process_state *ps, void yagl_process_unregister_egl_interface(struct yagl_process_state *ps); -void yagl_process_register_client_interface(struct yagl_process_state *ps, - yagl_client_api client_api, - struct yagl_client_interface *client_iface); - -void yagl_process_unregister_client_interface(struct yagl_process_state *ps, - yagl_client_api client_api); - struct yagl_thread_state* yagl_process_find_thread(struct yagl_process_state *ps, yagl_tid id); diff --git a/hw/yagl_range_list.c b/hw/yagl_range_list.c deleted file mode 100644 index 824d277..0000000 --- a/hw/yagl_range_list.c +++ /dev/null @@ -1,94 +0,0 @@ -#include "yagl_range_list.h" - -struct yagl_range -{ - int start; - int size; -}; - -void yagl_range_list_init(struct yagl_range_list *range_list) -{ - yagl_vector_init(&range_list->ranges, sizeof(struct yagl_range), 0); -} - -void yagl_range_list_cleanup(struct yagl_range_list *range_list) -{ - yagl_vector_cleanup(&range_list->ranges); -} - -void yagl_range_list_add(struct yagl_range_list *range_list, - int start, - int size) -{ - int actual_start = start, actual_end = start + size; - int remove_first = -1, remove_last = -1; - int i; - struct yagl_range *ranges = yagl_vector_data(&range_list->ranges); - int num_ranges = yagl_vector_size(&range_list->ranges); - - for (i = 0; i < num_ranges; ++i) { - if ((remove_first == -1) && - ((ranges[i].start + ranges[i].size) >= start)) { - if (ranges[i].start < actual_start) { - actual_start = ranges[i].start; - } - remove_first = i; - remove_last = i; - } - if (remove_first != -1) { - if ((ranges[i].start <= actual_end)) { - if ((ranges[i].start + ranges[i].size) > actual_end) { - actual_end = (ranges[i].start + ranges[i].size); - } - remove_last = i + 1; - } else { - break; - } - } - } - - if (remove_first == -1) { - remove_first = 0; - remove_last = 0; - } - - if (remove_first == remove_last) { - yagl_vector_resize(&range_list->ranges, num_ranges + 1); - ranges = yagl_vector_data(&range_list->ranges); - memmove(ranges + remove_first + 1, - ranges + remove_first, - (num_ranges - remove_first) * sizeof(*ranges)); - } else { - memmove(ranges + remove_first + 1, - ranges + remove_last, - (num_ranges - remove_last) * sizeof(*ranges)); - yagl_vector_resize(&range_list->ranges, - num_ranges + 1 - (remove_last - remove_first)); - ranges = yagl_vector_data(&range_list->ranges); - } - - ranges[remove_first].start = actual_start; - ranges[remove_first].size = (actual_end - actual_start); -} - -int yagl_range_list_size(struct yagl_range_list *range_list) -{ - return yagl_vector_size(&range_list->ranges); -} - -void yagl_range_list_get(struct yagl_range_list *range_list, - int i, - int *start, - int *size) -{ - struct yagl_range *ranges = - yagl_vector_data(&range_list->ranges); - - *start = ranges[i].start; - *size = ranges[i].size; -} - -void yagl_range_list_clear(struct yagl_range_list *range_list) -{ - yagl_vector_resize(&range_list->ranges, 0); -} diff --git a/hw/yagl_range_list.h b/hw/yagl_range_list.h deleted file mode 100644 index 7b23f9f..0000000 --- a/hw/yagl_range_list.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef _QEMU_YAGL_RANGE_LIST_H -#define _QEMU_YAGL_RANGE_LIST_H - -#include "yagl_types.h" -#include "yagl_vector.h" - -struct yagl_range_list -{ - struct yagl_vector ranges; -}; - -void yagl_range_list_init(struct yagl_range_list *range_list); - -void yagl_range_list_cleanup(struct yagl_range_list *range_list); - -void yagl_range_list_add(struct yagl_range_list *range_list, - int start, - int size); - -int yagl_range_list_size(struct yagl_range_list *range_list); - -void yagl_range_list_get(struct yagl_range_list *range_list, - int i, - int *start, - int *size); - -void yagl_range_list_clear(struct yagl_range_list *range_list); - -#endif diff --git a/hw/yagl_server.c b/hw/yagl_server.c index 8bd852a..0638d31 100644 --- a/hw/yagl_server.c +++ b/hw/yagl_server.c @@ -6,13 +6,10 @@ #include "yagl_log.h" #include "yagl_transport.h" #include "yagl_egl_backend.h" -#include "yagl_egl_interface.h" #include "yagl_apis/egl/yagl_egl_api.h" -#include "yagl_apis/gles1/yagl_gles1_api.h" -#include "yagl_apis/gles2/yagl_gles2_api.h" +#include "yagl_apis/gles/yagl_gles_api.h" #include -#include "yagl_gles1_driver.h" -#include "yagl_gles2_driver.h" +#include "yagl_gles_driver.h" static __inline void yagl_marshal_put_uint32_t(uint8_t** buff, uint32_t value) { @@ -45,8 +42,7 @@ static struct yagl_thread_state struct yagl_server_state *yagl_server_state_create(struct yagl_egl_backend *egl_backend, - struct yagl_gles1_driver *gles1_driver, - struct yagl_gles2_driver *gles2_driver) + struct yagl_gles_driver *gles_driver) { int i; struct yagl_server_state *ss = @@ -58,8 +54,7 @@ struct yagl_server_state if (!ss->t) { egl_backend->destroy(egl_backend); - gles1_driver->destroy(gles1_driver); - gles2_driver->destroy(gles2_driver); + gles_driver->destroy(gles_driver); goto fail; } @@ -68,28 +63,20 @@ struct yagl_server_state if (!ss->apis[yagl_api_id_egl - 1]) { egl_backend->destroy(egl_backend); - gles1_driver->destroy(gles1_driver); - gles2_driver->destroy(gles2_driver); + gles_driver->destroy(gles_driver); goto fail; } - ss->apis[yagl_api_id_gles1 - 1] = yagl_gles1_api_create(gles1_driver); + ss->apis[yagl_api_id_gles - 1] = yagl_gles_api_create(gles_driver); - if (!ss->apis[yagl_api_id_gles1 - 1]) { - gles1_driver->destroy(gles1_driver); - gles2_driver->destroy(gles2_driver); + if (!ss->apis[yagl_api_id_gles - 1]) { + gles_driver->destroy(gles_driver); goto fail; } - ss->apis[yagl_api_id_gles2 - 1] = yagl_gles2_api_create(gles2_driver); - - if (!ss->apis[yagl_api_id_gles2 - 1]) { - gles2_driver->destroy(gles2_driver); - - goto fail; - } + ss->render_type = egl_backend->render_type; return ss; @@ -262,7 +249,7 @@ out: yagl_thread_set_buffer(ts, pages); yagl_marshal_put_uint32_t(&buff, 1); - yagl_marshal_put_uint32_t(&buff, ps->egl_iface->render_type); + yagl_marshal_put_uint32_t(&buff, ss->render_type); YAGL_LOG_FUNC_EXIT(NULL); diff --git a/hw/yagl_server.h b/hw/yagl_server.h index 4122a1c..ccc56a8 100644 --- a/hw/yagl_server.h +++ b/hw/yagl_server.h @@ -7,12 +7,13 @@ struct yagl_api; struct yagl_process_state; struct yagl_egl_backend; -struct yagl_gles1_driver; -struct yagl_gles2_driver; +struct yagl_gles_driver; struct yagl_transport; struct yagl_server_state { + yagl_render_type render_type; + struct yagl_api *apis[YAGL_NUM_APIS]; QLIST_HEAD(, yagl_process_state) processes; @@ -30,13 +31,12 @@ struct yagl_server_state */ /* - * 'egl_backend', 'gles1_driver' and 'gles2_driver' will be owned by + * '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_gles1_driver *gles1_driver, - struct yagl_gles2_driver *gles2_driver); + struct yagl_gles_driver *gles_driver); void yagl_server_state_destroy(struct yagl_server_state *ss); /* diff --git a/hw/yagl_sharegroup.c b/hw/yagl_sharegroup.c deleted file mode 100644 index fa7a4e6..0000000 --- a/hw/yagl_sharegroup.c +++ /dev/null @@ -1,89 +0,0 @@ -#include "yagl_sharegroup.h" -#include "yagl_object.h" - -static void yagl_sharegroup_destroy(struct yagl_ref *ref) -{ - struct yagl_sharegroup *sg = (struct yagl_sharegroup*)ref; - int i; - - for (i = 0; i < YAGL_NUM_NAMESPACES; ++i) { - yagl_namespace_cleanup(&sg->namespaces[i]); - } - - yagl_ref_cleanup(&sg->ref); - - g_free(sg); -} - -struct yagl_sharegroup *yagl_sharegroup_create(void) -{ - struct yagl_sharegroup *sg = g_malloc0(sizeof(struct yagl_sharegroup)); - int i; - - yagl_ref_init(&sg->ref, &yagl_sharegroup_destroy); - - for (i = 0; i < YAGL_NUM_NAMESPACES; ++i) { - yagl_namespace_init(&sg->namespaces[i]); - } - - return sg; -} - -void yagl_sharegroup_acquire(struct yagl_sharegroup *sg) -{ - if (sg) { - yagl_ref_acquire(&sg->ref); - } -} - -void yagl_sharegroup_release(struct yagl_sharegroup *sg) -{ - if (sg) { - yagl_ref_release(&sg->ref); - } -} - -yagl_object_name yagl_sharegroup_add(struct yagl_sharegroup *sg, - int ns, - struct yagl_object *obj) -{ - return yagl_namespace_add(&sg->namespaces[ns], obj); -} - -struct yagl_object *yagl_sharegroup_add_named(struct yagl_sharegroup *sg, - int ns, - yagl_object_name local_name, - struct yagl_object *obj) -{ - return yagl_namespace_add_named(&sg->namespaces[ns], local_name, obj); -} - -void yagl_sharegroup_remove(struct yagl_sharegroup *sg, - int ns, - yagl_object_name local_name) -{ - yagl_namespace_remove(&sg->namespaces[ns], local_name); -} - -void yagl_sharegroup_remove_check(struct yagl_sharegroup *sg, - int ns, - yagl_object_name local_name, - struct yagl_object *obj) -{ - struct yagl_object *actual_obj; - - actual_obj = yagl_namespace_acquire(&sg->namespaces[ns], local_name); - - if (actual_obj == obj) { - yagl_namespace_remove(&sg->namespaces[ns], local_name); - } - - yagl_object_release(actual_obj); -} - -struct yagl_object *yagl_sharegroup_acquire_object(struct yagl_sharegroup *sg, - int ns, - yagl_object_name local_name) -{ - return yagl_namespace_acquire(&sg->namespaces[ns], local_name); -} diff --git a/hw/yagl_sharegroup.h b/hw/yagl_sharegroup.h deleted file mode 100644 index 813af05..0000000 --- a/hw/yagl_sharegroup.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef _QEMU_YAGL_SHAREGROUP_H -#define _QEMU_YAGL_SHAREGROUP_H - -#include "yagl_types.h" -#include "yagl_ref.h" -#include "yagl_namespace.h" - -#define YAGL_NUM_NAMESPACES 5 - -struct yagl_sharegroup -{ - struct yagl_ref ref; - - struct yagl_namespace namespaces[YAGL_NUM_NAMESPACES]; -}; - -struct yagl_sharegroup *yagl_sharegroup_create(void); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_sharegroup_acquire(struct yagl_sharegroup *sg); - -/* - * Passing NULL won't hurt, this is for convenience. - */ -void yagl_sharegroup_release(struct yagl_sharegroup *sg); - -/* - * Adds an object to share group and returns its local name, - * this acquires 'obj', so the - * caller should release 'obj' if he doesn't want to use it and wants - * it to belong to this share group alone. - * - * This function must be called only when the context using 'sg' is the current - * context. - */ -yagl_object_name yagl_sharegroup_add(struct yagl_sharegroup *sg, - int ns, - struct yagl_object *obj); - -/* - * Same as the above, but adds an object with local name. - * If an object with such local name already exists then 'obj' will be - * released and the existing object will be acquired and returned. - * Otherwise, 'obj' is acquired and returned. - * Typical use-case for this function is: - * - * yagl_object *obj; - * obj = yagl_sharegroup_acquire_object(sg, ns, local_name); - * if (!obj) { - * obj = yagl_xxx_create(...); - * obj = yagl_sharegroup_add_named(sg, ns, local_name, obj); - * } - * // use 'obj'. - * yagl_object_release(obj); - * - * This function must be called only when the context using 'sg' is the current - * context. - */ -struct yagl_object *yagl_sharegroup_add_named(struct yagl_sharegroup *sg, - int ns, - yagl_object_name local_name, - struct yagl_object *obj); - -/* - * Removes an object from the share group, this also releases the - * object. - * - * This function must be called only when the context using 'sg' is the current - * context. - */ -void yagl_sharegroup_remove(struct yagl_sharegroup *sg, - int ns, - yagl_object_name local_name); - -/* - * Same as 'yagl_sharegroup_remove', but removes only if and object - * behind 'local_name' is 'obj' - */ -void yagl_sharegroup_remove_check(struct yagl_sharegroup *sg, - int ns, - yagl_object_name local_name, - struct yagl_object *obj); - -/* - * Acquires an object by its local name. Be sure to release the object when - * you're done. - * - * This function must be called only when the context using 'sg' is the current - * context. - */ -struct yagl_object *yagl_sharegroup_acquire_object(struct yagl_sharegroup *sg, - int ns, - yagl_object_name local_name); - -#endif diff --git a/hw/yagl_thread.c b/hw/yagl_thread.c index 92ff3ef..d3e93b7 100644 --- a/hw/yagl_thread.c +++ b/hw/yagl_thread.c @@ -5,6 +5,7 @@ #include "yagl_log.h" #include "yagl_stats.h" #include "yagl_transport.h" +#include "yagl_object_map.h" #include "sysemu/kvm.h" #include "sysemu/hax.h" @@ -23,17 +24,22 @@ static __inline void yagl_cpu_synchronize_state(struct yagl_process_state *ps) } #endif -static void *yagl_thread_func(void* arg) +struct yagl_thread_state + *yagl_thread_state_create(struct yagl_process_state *ps, + yagl_tid id, + bool is_first) { - struct yagl_thread_state *ts = arg; - struct yagl_transport *t = ts->ps->ss->t; int i; - cur_ts = ts; + struct yagl_thread_state *ts = + g_malloc0(sizeof(struct yagl_thread_state)); - YAGL_LOG_FUNC_ENTER(yagl_thread_func, NULL); + ts->ps = ps; + ts->id = id; + + cur_ts = ts; - if (ts->is_first) { + if (is_first) { /* * Init APIs (process). */ @@ -44,8 +50,6 @@ static void *yagl_thread_func(void* arg) assert(ts->ps->api_states[i]); } } - - yagl_event_set(&ts->call_processed_event); } /* @@ -58,73 +62,15 @@ static void *yagl_thread_func(void* arg) } } - while (true) { - uint32_t num_calls = 0; - - yagl_event_wait(&ts->call_event); - - if (ts->destroying) { - break; - } - - YAGL_LOG_TRACE("batch started"); - - yagl_transport_begin(t, ts->pages, ts->offset); - - while (true) { - yagl_api_id api_id; - yagl_func_id func_id; - struct yagl_api_ps *api_ps; - yagl_api_func func; - - yagl_transport_begin_call(t, &api_id, &func_id); - - if (api_id == 0) { - /* - * Batch ended. - */ - break; - } - - if ((api_id <= 0) || (api_id > YAGL_NUM_APIS)) { - YAGL_LOG_CRITICAL("target-host protocol error, bad api_id - %u", api_id); - break; - } - - api_ps = ts->ps->api_states[api_id - 1]; - - if (!api_ps) { - YAGL_LOG_CRITICAL("uninitialized api - %u. host logic error", api_id); - break; - } - - func = api_ps->get_func(api_ps, func_id); - - if (func) { - if (func(t)) { - yagl_transport_end_call(t); - } else { - /* - * Retry is requested. - */ - break; - } - } else { - YAGL_LOG_CRITICAL("bad function call (api = %u, func = %u)", - api_id, - func_id); - break; - } - - ++num_calls; - } - - YAGL_LOG_TRACE("batch ended"); + return ts; +} - yagl_stats_batch(num_calls, yagl_transport_bytes_processed(t)); +void yagl_thread_state_destroy(struct yagl_thread_state *ts, + bool is_last) +{ + int i; - yagl_event_set(&ts->call_processed_event); - } + cur_ts = ts; /* * Fini APIs (thread). @@ -136,16 +82,12 @@ static void *yagl_thread_func(void* arg) } } - if (ts->is_last) { + if (is_last) { /* - * Fini APIs (process). + * First, remove all objects. */ - for (i = 0; i < YAGL_NUM_APIS; ++i) { - if (ts->ps->api_states[i]) { - ts->ps->api_states[i]->fini(ts->ps->api_states[i]); - } - } + yagl_object_map_remove_all(ts->ps->object_map); /* * Destroy APIs (process). @@ -159,56 +101,8 @@ static void *yagl_thread_func(void* arg) } } - YAGL_LOG_FUNC_EXIT(NULL); - cur_ts = NULL; - return NULL; -} - -struct yagl_thread_state - *yagl_thread_state_create(struct yagl_process_state *ps, - yagl_tid id, - bool is_first) -{ - struct yagl_thread_state *ts = - g_malloc0(sizeof(struct yagl_thread_state)); - - ts->ps = ps; - ts->id = id; - ts->is_first = is_first; - - yagl_event_init(&ts->call_event, 0, 0); - yagl_event_init(&ts->call_processed_event, 0, 0); - - qemu_thread_create(&ts->host_thread, - yagl_thread_func, - ts, - QEMU_THREAD_JOINABLE); - - if (is_first) { - /* - * If this is the first thread wait until API process states are - * initialized. - */ - - yagl_event_wait(&ts->call_processed_event); - } - - return ts; -} - -void yagl_thread_state_destroy(struct yagl_thread_state *ts, - bool is_last) -{ - ts->is_last = is_last; - ts->destroying = true; - yagl_event_set(&ts->call_event); - qemu_thread_join(&ts->host_thread); - - yagl_event_cleanup(&ts->call_processed_event); - yagl_event_cleanup(&ts->call_event); - yagl_thread_set_buffer(ts, NULL); g_free(ts); @@ -235,16 +129,83 @@ void yagl_thread_set_buffer(struct yagl_thread_state *ts, uint8_t **pages) void yagl_thread_call(struct yagl_thread_state *ts, uint32_t offset) { - assert(current_cpu); + int i; + uint32_t num_calls = 0; + struct yagl_transport *t = ts->ps->ss->t; + + YAGL_LOG_FUNC_SET(yagl_thread_call); - ts->current_env = current_cpu; - ts->offset = offset; + assert(current_cpu); yagl_cpu_synchronize_state(ts->ps); - yagl_event_set(&ts->call_event); - yagl_event_wait(&ts->call_processed_event); + YAGL_LOG_TRACE("batch started"); + + cur_ts = ts; + + for (i = 0; i < YAGL_NUM_APIS; ++i) { + if (ts->ps->api_states[i]) { + ts->ps->api_states[i]->batch_start(ts->ps->api_states[i]); + } + } - ts->current_env = NULL; - ts->offset = 0; + yagl_transport_begin(t, ts->pages, offset); + + while (true) { + yagl_api_id api_id; + yagl_func_id func_id; + struct yagl_api_ps *api_ps; + yagl_api_func func; + + yagl_transport_begin_call(t, &api_id, &func_id); + + if (api_id == 0) { + /* + * Batch ended. + */ + break; + } + + if ((api_id <= 0) || (api_id > YAGL_NUM_APIS)) { + YAGL_LOG_CRITICAL("target-host protocol error, bad api_id - %u", api_id); + break; + } + + api_ps = ts->ps->api_states[api_id - 1]; + + if (!api_ps) { + YAGL_LOG_CRITICAL("uninitialized api - %u. host logic error", api_id); + break; + } + + func = api_ps->get_func(api_ps, func_id); + + if (func) { + if (func(t)) { + yagl_transport_end_call(t); + } else { + /* + * Retry is requested. + */ + break; + } + } else { + YAGL_LOG_CRITICAL("bad function call (api = %u, func = %u)", + api_id, + func_id); + break; + } + + ++num_calls; + } + + YAGL_LOG_TRACE("batch ended: %u calls", num_calls); + + yagl_stats_batch(num_calls, yagl_transport_bytes_processed(t)); + + for (i = 0; i < YAGL_NUM_APIS; ++i) { + if (ts->ps->api_states[i]) { + ts->ps->api_states[i]->batch_end(ts->ps->api_states[i]); + } + } } diff --git a/hw/yagl_thread.h b/hw/yagl_thread.h index 95b67d4..f43dab7 100644 --- a/hw/yagl_thread.h +++ b/hw/yagl_thread.h @@ -17,31 +17,19 @@ struct yagl_thread_state yagl_tid id; - QemuThread host_thread; - - bool destroying; /* true when thread is being destroyed */ - - bool is_first; /* true when this is first thread of a process */ - bool is_last; /* true when this is last thread of a process */ + uint8_t **pages; /* - * These events are auto reset. + * Fake TLS. * @{ */ - struct yagl_event call_event; /* Set whenever target calls us */ - struct yagl_event call_processed_event; /* Set whenever host processed target call */ + void *egl_api_ts; + void *gles_api_ts; + void *egl_offscreen_ts; + void *egl_onscreen_ts; /* * @} */ - - uint8_t **pages; - - /* - * Set by the caller of yagl_thread_call for - * the time of call. - */ - uint32_t offset; - CPUState *current_env; }; YAGL_DECLARE_TLS(struct yagl_thread_state*, cur_ts); diff --git a/hw/yagl_tls.h b/hw/yagl_tls.h index b435df4..86bd048 100644 --- a/hw/yagl_tls.h +++ b/hw/yagl_tls.h @@ -3,7 +3,7 @@ #include "yagl_types.h" -#define YAGL_DEFINE_TLS(type, x) __thread type x +#define YAGL_DEFINE_TLS(type, x) type x #define YAGL_DECLARE_TLS(type, x) extern YAGL_DEFINE_TLS(type, x) #endif diff --git a/hw/yagl_transport_gl2.h b/hw/yagl_transport_gl.h similarity index 90% rename from hw/yagl_transport_gl2.h rename to hw/yagl_transport_gl.h index 13d4505..3d22d70 100644 --- a/hw/yagl_transport_gl2.h +++ b/hw/yagl_transport_gl.h @@ -14,6 +14,11 @@ static __inline GLboolean yagl_transport_get_out_GLboolean(struct yagl_transport return yagl_transport_get_out_uint8_t(t); } +static __inline GLubyte yagl_transport_get_out_GLubyte(struct yagl_transport *t) +{ + return yagl_transport_get_out_uint8_t(t); +} + static __inline GLclampf yagl_transport_get_out_GLclampf(struct yagl_transport *t) { return yagl_transport_get_out_float(t); diff --git a/hw/yagl_transport_gl1.h b/hw/yagl_transport_gl1.h deleted file mode 100644 index 304c567..0000000 --- a/hw/yagl_transport_gl1.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef _QEMU_YAGL_TRANSPORT_GL_H -#define _QEMU_YAGL_TRANSPORT_GL_H - -#include "yagl_types.h" -#include "yagl_transport.h" - -static __inline GLbitfield yagl_transport_get_out_GLbitfield(struct yagl_transport *t) -{ - return yagl_transport_get_out_uint32_t(t); -} - -static __inline GLboolean yagl_transport_get_out_GLboolean(struct yagl_transport *t) -{ - return yagl_transport_get_out_uint8_t(t); -} - -static __inline GLubyte yagl_transport_get_out_GLubyte(struct yagl_transport *t) -{ - return yagl_transport_get_out_uint8_t(t); -} - -static __inline GLclampf yagl_transport_get_out_GLclampf(struct yagl_transport *t) -{ - return yagl_transport_get_out_float(t); -} - -static __inline GLclampx yagl_transport_get_out_GLclampx(struct yagl_transport *t) -{ - return yagl_transport_get_out_uint32_t(t); -} - -static __inline GLfixed yagl_transport_get_out_GLfixed(struct yagl_transport *t) -{ - return yagl_transport_get_out_uint32_t(t); -} - -static __inline GLenum yagl_transport_get_out_GLenum(struct yagl_transport *t) -{ - return yagl_transport_get_out_uint32_t(t); -} - -static __inline GLfloat yagl_transport_get_out_GLfloat(struct yagl_transport *t) -{ - return yagl_transport_get_out_float(t); -} - -static __inline GLint yagl_transport_get_out_GLint(struct yagl_transport *t) -{ - return yagl_transport_get_out_uint32_t(t); -} - -static __inline GLsizei yagl_transport_get_out_GLsizei(struct yagl_transport *t) -{ - return yagl_transport_get_out_uint32_t(t); -} - -static __inline GLuint yagl_transport_get_out_GLuint(struct yagl_transport *t) -{ - return yagl_transport_get_out_uint32_t(t); -} - -#endif diff --git a/hw/yagl_types.h b/hw/yagl_types.h index df09306..ddcf5b7 100644 --- a/hw/yagl_types.h +++ b/hw/yagl_types.h @@ -27,11 +27,10 @@ typedef enum typedef enum { yagl_api_id_egl = 1, - yagl_api_id_gles1 = 2, - yagl_api_id_gles2 = 3, + yagl_api_id_gles = 2 } yagl_api_id; -#define YAGL_NUM_APIS 3 +#define YAGL_NUM_APIS 2 /* * EGL client APIs. @@ -48,34 +47,4 @@ typedef enum typedef bool (*yagl_api_func)(struct yagl_transport */*t*/); -static inline float yagl_fixed_to_float(int32_t x) -{ - return (float)x * (1.0f / 65536.0f); -} - -static inline double yagl_fixed_to_double(int32_t x) -{ - return (double)x * (1.0f / 65536.0f); -} - -static inline int32_t yagl_fixed_to_int(int32_t x) -{ - return (x + 0x0800) >> 16; -} - -static inline int32_t yagl_float_to_fixed(float f) -{ - return (int32_t)(f * 65536.0f + 0.5f); -} - -static inline int32_t yagl_double_to_fixed(double d) -{ - return (int32_t)(d * 65536.0f + 0.5f); -} - -static inline int32_t yagl_int_to_fixed(int32_t i) -{ - return i << 16; -} - #endif diff --git a/hw/yagl_version.h b/hw/yagl_version.h index 5eee7ee..ae66752 100644 --- a/hw/yagl_version.h +++ b/hw/yagl_version.h @@ -6,6 +6,6 @@ /* * Whenever protocol changes be sure to bump this. */ -#define YAGL_VERSION 20 +#define YAGL_VERSION 21 #endif