From: Varinder Pratap Date: Fri, 10 Jun 2022 17:45:33 +0000 (+0530) Subject: Sync yagl/vigs from branch tizen_studio_5.0_p7.0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=041015890e6d571fdce9cb34b0415689219cedd1;p=sdk%2Femulator%2Fqemu.git Sync yagl/vigs from branch tizen_studio_5.0_p7.0 Change-Id: I86623d21f6b3154f42c1f63f0d1b44a49cf71295 Signed-off-by: Varinder Pratap --- diff --git a/configure b/configure index bedd3bb79d..1cfddefca5 100755 --- a/configure +++ b/configure @@ -829,7 +829,6 @@ MINGW32*) else audio_drv_list="" fi - QEMU_INCLUDES="-I\$(SRC_PATH)/hosts/w32/include $QEMU_INCLUDES" supported_os="yes" pie="no" ;; diff --git a/hw/vigs/vigs_gl_backend.c b/hw/vigs/vigs_gl_backend.c index fa5182a463..c9f2d4a545 100644 --- a/hw/vigs/vigs_gl_backend.c +++ b/hw/vigs/vigs_gl_backend.c @@ -455,7 +455,9 @@ static void vigs_gl_backend_release_framebuffer(void *user_data, GLuint id) { struct vigs_gl_backend *backend = (struct vigs_gl_backend*)user_data; - backend->DeleteFramebuffers(1, &id); + if (id) { + backend->DeleteFramebuffers(1, &id); + } } static GLuint vigs_gl_create_shader(struct vigs_gl_backend *backend, @@ -1993,8 +1995,13 @@ static void vigs_gl_surface_destroy(struct vigs_surface *sfc) sfc->ws_sfc->height, sfc->format); } - - gl_backend->DeleteTextures(3, &gl_sfc->yuv_textures[0]); + if (gl_backend != NULL) { + if (&gl_sfc->yuv_textures[0] != NULL) { + if (gl_sfc->yuv_textures[0] != 0) { + gl_backend->DeleteTextures(3, &gl_sfc->yuv_textures[0]); + } + } + } vigs_surface_cleanup(&gl_sfc->base); diff --git a/hw/yagl/Makefile.objs b/hw/yagl/Makefile.objs index fcd358f7d2..7f017bd5bf 100644 --- a/hw/yagl/Makefile.objs +++ b/hw/yagl/Makefile.objs @@ -1,5 +1,6 @@ obj-y += yagl_device.o obj-y += yagl_log.o +obj-y += yagl_util.o obj-y += yagl_process.o obj-y += yagl_thread.o obj-y += yagl_server.o diff --git a/hw/yagl/yagl_api.h b/hw/yagl/yagl_api.h index bf11c0a159..64547b1c77 100644 --- a/hw/yagl/yagl_api.h +++ b/hw/yagl/yagl_api.h @@ -41,18 +41,18 @@ struct yagl_api_ps { struct yagl_api *api; - void (*thread_init)(struct yagl_api_ps */*api_ps*/); + void (*thread_init)(struct yagl_thread_state */*ts*/, struct yagl_api_ps */*api_ps*/); - void (*batch_start)(struct yagl_api_ps */*api_ps*/); + void (*batch_start)(struct yagl_thread_state */*ts*/, struct yagl_api_ps */*api_ps*/); yagl_api_func (*get_func)(struct yagl_api_ps */*api_ps*/, uint32_t /*func_id*/); - void (*batch_end)(struct yagl_api_ps */*api_ps*/); + void (*batch_end)(struct yagl_thread_state */*ts*/, struct yagl_api_ps */*api_ps*/); - void (*thread_fini)(struct yagl_api_ps */*api_ps*/); + void (*thread_fini)(struct yagl_thread_state */*ts*/, struct yagl_api_ps */*api_ps*/); - void (*destroy)(struct yagl_api_ps */*api_ps*/); + void (*destroy)(struct yagl_thread_state */*ts*/, struct yagl_api_ps */*api_ps*/); }; void yagl_api_ps_init(struct yagl_api_ps *api_ps, @@ -70,7 +70,7 @@ void yagl_api_ps_cleanup(struct yagl_api_ps *api_ps); struct yagl_api { - struct yagl_api_ps *(*process_init)(struct yagl_api */*api*/); + struct yagl_api_ps *(*process_init)(struct yagl_process_state *ps, struct yagl_api */*api*/); void (*destroy)(struct yagl_api */*api*/); }; diff --git a/hw/yagl/yagl_apis/egl/yagl_egl_api_ps.c b/hw/yagl/yagl_apis/egl/yagl_egl_api_ps.c index ab10cae325..43e30512e5 100644 --- a/hw/yagl/yagl_apis/egl/yagl_egl_api_ps.c +++ b/hw/yagl/yagl_apis/egl/yagl_egl_api_ps.c @@ -40,23 +40,20 @@ void yagl_egl_api_ps_init(struct yagl_egl_api_ps *egl_api_ps, egl_api_ps->backend = backend; egl_api_ps->egl_iface = egl_iface; - yagl_process_register_egl_interface(cur_ts->ps, egl_api_ps->egl_iface); - QLIST_INIT(&egl_api_ps->displays); } -void yagl_egl_api_ps_cleanup(struct yagl_egl_api_ps *egl_api_ps) +void yagl_egl_api_ps_cleanup(struct yagl_thread_state *cur_ts, + struct yagl_egl_api_ps *egl_api_ps) { struct yagl_egl_display *dpy, *next; QLIST_FOREACH_SAFE(dpy, &egl_api_ps->displays, entry, next) { QLIST_REMOVE(dpy, entry); - yagl_egl_display_destroy(dpy); + yagl_egl_display_destroy(cur_ts, dpy); } assert(QLIST_EMPTY(&egl_api_ps->displays)); - - yagl_process_unregister_egl_interface(cur_ts->ps); } struct yagl_egl_display *yagl_egl_api_ps_display_get(struct yagl_egl_api_ps *egl_api_ps, @@ -73,7 +70,8 @@ struct yagl_egl_display *yagl_egl_api_ps_display_get(struct yagl_egl_api_ps *egl return NULL; } -struct yagl_egl_display *yagl_egl_api_ps_display_add(struct yagl_egl_api_ps *egl_api_ps, +struct yagl_egl_display *yagl_egl_api_ps_display_add(struct yagl_thread_state *cur_ts, + struct yagl_egl_api_ps *egl_api_ps, uint32_t display_id) { struct yagl_egl_display *dpy; @@ -84,7 +82,7 @@ struct yagl_egl_display *yagl_egl_api_ps_display_add(struct yagl_egl_api_ps *egl } } - dpy = yagl_egl_display_create(egl_api_ps->backend, display_id); + dpy = yagl_egl_display_create(cur_ts, egl_api_ps->backend, display_id); if (!dpy) { return NULL; diff --git a/hw/yagl/yagl_apis/egl/yagl_egl_api_ps.h b/hw/yagl/yagl_apis/egl/yagl_egl_api_ps.h index f963540bd2..95fd1dfe14 100644 --- a/hw/yagl/yagl_apis/egl/yagl_egl_api_ps.h +++ b/hw/yagl/yagl_apis/egl/yagl_egl_api_ps.h @@ -52,12 +52,14 @@ 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); -void yagl_egl_api_ps_cleanup(struct yagl_egl_api_ps *egl_api_ps); +void yagl_egl_api_ps_cleanup(struct yagl_thread_state *cur_ts, + 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, yagl_host_handle handle); -struct yagl_egl_display *yagl_egl_api_ps_display_add(struct yagl_egl_api_ps *egl_api_ps, +struct yagl_egl_display *yagl_egl_api_ps_display_add(struct yagl_thread_state *cur_ts, + struct yagl_egl_api_ps *egl_api_ps, uint32_t display_id); #endif diff --git a/hw/yagl/yagl_apis/egl/yagl_egl_api_ts.c b/hw/yagl/yagl_apis/egl/yagl_egl_api_ts.c index 0b938d0fd0..d3da85739f 100644 --- a/hw/yagl/yagl_apis/egl/yagl_egl_api_ts.c +++ b/hw/yagl/yagl_apis/egl/yagl_egl_api_ts.c @@ -33,7 +33,8 @@ #include "yagl_eglb_context.h" #include "yagl_egl_backend.h" -void yagl_egl_api_ts_init(struct yagl_egl_api_ts *egl_api_ts, +void yagl_egl_api_ts_init(struct yagl_thread_state *cur_ts, + struct yagl_egl_api_ts *egl_api_ts, struct yagl_egl_api_ps *api_ps) { egl_api_ts->api_ps = api_ps; @@ -43,26 +44,28 @@ void yagl_egl_api_ts_init(struct yagl_egl_api_ts *egl_api_ts, yagl_egl_api_ts_reset(egl_api_ts); } -void yagl_egl_api_ts_cleanup(struct yagl_egl_api_ts *egl_api_ts) +void yagl_egl_api_ts_cleanup(struct yagl_thread_state *cur_ts, + struct yagl_egl_api_ts *egl_api_ts) { if (egl_api_ts->context) { /* * Force release current. */ - egl_api_ts->backend->release_current(egl_api_ts->backend, true); + egl_api_ts->backend->release_current(cur_ts, egl_api_ts->backend, true); - yagl_egl_context_update_surfaces(egl_api_ts->context, NULL, NULL); + yagl_egl_context_update_surfaces(cur_ts, egl_api_ts->context, NULL, NULL); } - yagl_egl_api_ts_update_context(egl_api_ts, NULL); + yagl_egl_api_ts_update_context(cur_ts, egl_api_ts, NULL); } -void yagl_egl_api_ts_update_context(struct yagl_egl_api_ts *egl_api_ts, +void yagl_egl_api_ts_update_context(struct yagl_thread_state *cur_ts, + struct yagl_egl_api_ts *egl_api_ts, struct yagl_egl_context *ctx) { yagl_egl_context_acquire(ctx); - yagl_egl_context_release(egl_api_ts->context); + yagl_egl_context_release(cur_ts, egl_api_ts->context); egl_api_ts->context = ctx; } diff --git a/hw/yagl/yagl_apis/egl/yagl_egl_api_ts.h b/hw/yagl/yagl_apis/egl/yagl_egl_api_ts.h index 86b6bc0e03..3d95bda1ab 100644 --- a/hw/yagl/yagl_apis/egl/yagl_egl_api_ts.h +++ b/hw/yagl/yagl_apis/egl/yagl_egl_api_ts.h @@ -54,12 +54,15 @@ struct yagl_egl_api_ts struct yagl_egl_context *context; }; -void yagl_egl_api_ts_init(struct yagl_egl_api_ts *egl_api_ts, +void yagl_egl_api_ts_init(struct yagl_thread_state *cur_ts, + struct yagl_egl_api_ts *egl_api_ts, struct yagl_egl_api_ps *api_ps); -void yagl_egl_api_ts_cleanup(struct yagl_egl_api_ts *egl_api_ts); +void yagl_egl_api_ts_cleanup(struct yagl_thread_state *cur_ts, + struct yagl_egl_api_ts *egl_api_ts); -void yagl_egl_api_ts_update_context(struct yagl_egl_api_ts *egl_api_ts, +void yagl_egl_api_ts_update_context(struct yagl_thread_state *cur_ts, + struct yagl_egl_api_ts *egl_api_ts, struct yagl_egl_context *ctx); void yagl_egl_api_ts_reset(struct yagl_egl_api_ts *egl_api_ts); diff --git a/hw/yagl/yagl_apis/egl/yagl_egl_calls.c b/hw/yagl/yagl_apis/egl/yagl_egl_calls.c index 8f114dadcd..7ae62a0f0c 100644 --- a/hw/yagl/yagl_apis/egl/yagl_egl_calls.c +++ b/hw/yagl/yagl_apis/egl/yagl_egl_calls.c @@ -42,6 +42,7 @@ */ static void yagl_func_eglGetDisplay(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; uint32_t display_id; EGLint *error; yagl_host_handle *retval; @@ -49,7 +50,7 @@ static void yagl_func_eglGetDisplay(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT2(eglGetDisplay, uint32_t, void*, display_id, error); - *retval = yagl_host_eglGetDisplay(display_id, error); + *retval = yagl_host_eglGetDisplay(cur_ts, display_id, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); } @@ -58,6 +59,7 @@ static void yagl_func_eglGetDisplay(struct yagl_transport *t) */ static void yagl_func_eglInitialize(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; EGLint *major; EGLint *minor; @@ -69,7 +71,7 @@ static void yagl_func_eglInitialize(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT4(eglInitialize, yagl_host_handle, void*, void*, void*, dpy, major, minor, error); - *retval = yagl_host_eglInitialize(dpy, major, minor, error); + *retval = yagl_host_eglInitialize(cur_ts, dpy, major, minor, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); } @@ -78,6 +80,7 @@ static void yagl_func_eglInitialize(struct yagl_transport *t) */ static void yagl_func_eglTerminate(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; EGLint *error; EGLBoolean *retval; @@ -85,7 +88,7 @@ static void yagl_func_eglTerminate(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT2(eglTerminate, yagl_host_handle, void*, dpy, error); - *retval = yagl_host_eglTerminate(dpy, error); + *retval = yagl_host_eglTerminate(cur_ts, dpy, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); } @@ -94,6 +97,7 @@ static void yagl_func_eglTerminate(struct yagl_transport *t) */ static void yagl_func_eglGetConfigs(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle *configs; int32_t configs_maxcount; @@ -106,7 +110,7 @@ static void yagl_func_eglGetConfigs(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&retval); 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, error); + *retval = yagl_host_eglGetConfigs(cur_ts, dpy, configs, configs_maxcount, configs_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); } @@ -115,6 +119,7 @@ static void yagl_func_eglGetConfigs(struct yagl_transport *t) */ static void yagl_func_eglChooseConfig(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; const EGLint *attrib_list; int32_t attrib_list_count; @@ -130,7 +135,7 @@ static void yagl_func_eglChooseConfig(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&retval); 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, error); + *retval = yagl_host_eglChooseConfig(cur_ts, dpy, attrib_list, attrib_list_count, configs, configs_maxcount, configs_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); } @@ -139,6 +144,7 @@ static void yagl_func_eglChooseConfig(struct yagl_transport *t) */ static void yagl_func_eglGetConfigAttrib(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle config; EGLint attribute; @@ -152,7 +158,7 @@ static void yagl_func_eglGetConfigAttrib(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); 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); + *retval = yagl_host_eglGetConfigAttrib(cur_ts, dpy, config, attribute, value, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); } @@ -161,6 +167,7 @@ static void yagl_func_eglGetConfigAttrib(struct yagl_transport *t) */ static void yagl_func_eglDestroySurface(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle surface; EGLint *error; @@ -170,7 +177,7 @@ static void yagl_func_eglDestroySurface(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT3(eglDestroySurface, yagl_host_handle, yagl_host_handle, void*, dpy, surface, error); - *retval = yagl_host_eglDestroySurface(dpy, surface, error); + *retval = yagl_host_eglDestroySurface(cur_ts, dpy, surface, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); } @@ -179,6 +186,7 @@ static void yagl_func_eglDestroySurface(struct yagl_transport *t) */ static void yagl_func_eglQuerySurface(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle surface; EGLint attribute; @@ -192,7 +200,7 @@ static void yagl_func_eglQuerySurface(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); 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); + *retval = yagl_host_eglQuerySurface(cur_ts, dpy, surface, attribute, value, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); } @@ -201,10 +209,11 @@ static void yagl_func_eglQuerySurface(struct yagl_transport *t) */ static void yagl_func_eglBindAPI(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; EGLenum api; api = yagl_transport_get_out_EGLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(eglBindAPI, EGLenum, api); - (void)yagl_host_eglBindAPI(api); + (void)yagl_host_eglBindAPI(cur_ts, api); YAGL_LOG_FUNC_EXIT(NULL); } @@ -213,8 +222,9 @@ static void yagl_func_eglBindAPI(struct yagl_transport *t) */ static void yagl_func_eglWaitClient(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; YAGL_LOG_FUNC_ENTER_SPLIT0(eglWaitClient); - (void)yagl_host_eglWaitClient(); + (void)yagl_host_eglWaitClient(t->ts); YAGL_LOG_FUNC_EXIT(NULL); } @@ -223,12 +233,13 @@ static void yagl_func_eglWaitClient(struct yagl_transport *t) */ static void yagl_func_eglReleaseThread(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; EGLint *error; EGLBoolean *retval; yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT1(eglReleaseThread, void*, error); - *retval = yagl_host_eglReleaseThread(error); + *retval = yagl_host_eglReleaseThread(t->ts, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); } @@ -237,6 +248,7 @@ static void yagl_func_eglReleaseThread(struct yagl_transport *t) */ static void yagl_func_eglSurfaceAttrib(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle surface; EGLint attribute; @@ -250,7 +262,7 @@ static void yagl_func_eglSurfaceAttrib(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); 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); + *retval = yagl_host_eglSurfaceAttrib(cur_ts, dpy, surface, attribute, value, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); } @@ -259,6 +271,7 @@ static void yagl_func_eglSurfaceAttrib(struct yagl_transport *t) */ static void yagl_func_eglCreateContext(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle config; yagl_host_handle share_context; @@ -273,7 +286,7 @@ static void yagl_func_eglCreateContext(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); 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); + *retval = yagl_host_eglCreateContext(cur_ts, dpy, config, share_context, attrib_list, attrib_list_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); } @@ -282,6 +295,7 @@ static void yagl_func_eglCreateContext(struct yagl_transport *t) */ static void yagl_func_eglDestroyContext(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle ctx; EGLint *error; @@ -291,7 +305,7 @@ static void yagl_func_eglDestroyContext(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT3(eglDestroyContext, yagl_host_handle, yagl_host_handle, void*, dpy, ctx, error); - *retval = yagl_host_eglDestroyContext(dpy, ctx, error); + *retval = yagl_host_eglDestroyContext(cur_ts, dpy, ctx, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); } @@ -300,6 +314,7 @@ static void yagl_func_eglDestroyContext(struct yagl_transport *t) */ static void yagl_func_eglMakeCurrent(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle draw; yagl_host_handle read; @@ -309,7 +324,7 @@ static void yagl_func_eglMakeCurrent(struct yagl_transport *t) read = yagl_transport_get_out_yagl_host_handle(t); ctx = yagl_transport_get_out_yagl_host_handle(t); YAGL_LOG_FUNC_ENTER_SPLIT4(eglMakeCurrent, yagl_host_handle, yagl_host_handle, yagl_host_handle, yagl_host_handle, dpy, draw, read, ctx); - (void)yagl_host_eglMakeCurrent(dpy, draw, read, ctx); + (void)yagl_host_eglMakeCurrent(cur_ts, dpy, draw, read, ctx); YAGL_LOG_FUNC_EXIT(NULL); } @@ -318,6 +333,7 @@ static void yagl_func_eglMakeCurrent(struct yagl_transport *t) */ static void yagl_func_eglQueryContext(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle ctx; EGLint attribute; @@ -331,7 +347,7 @@ static void yagl_func_eglQueryContext(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); 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); + *retval = yagl_host_eglQueryContext(cur_ts, dpy, ctx, attribute, value, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); } @@ -340,12 +356,13 @@ static void yagl_func_eglQueryContext(struct yagl_transport *t) */ static void yagl_func_eglSwapBuffers(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle surface; dpy = yagl_transport_get_out_yagl_host_handle(t); surface = yagl_transport_get_out_yagl_host_handle(t); YAGL_LOG_FUNC_ENTER_SPLIT2(eglSwapBuffers, yagl_host_handle, yagl_host_handle, dpy, surface); - (void)yagl_host_eglSwapBuffers(dpy, surface); + (void)yagl_host_eglSwapBuffers(cur_ts, dpy, surface); YAGL_LOG_FUNC_EXIT(NULL); } @@ -354,12 +371,13 @@ static void yagl_func_eglSwapBuffers(struct yagl_transport *t) */ static void yagl_func_eglCopyBuffers(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle surface; dpy = yagl_transport_get_out_yagl_host_handle(t); surface = yagl_transport_get_out_yagl_host_handle(t); YAGL_LOG_FUNC_ENTER_SPLIT2(eglCopyBuffers, yagl_host_handle, yagl_host_handle, dpy, surface); - (void)yagl_host_eglCopyBuffers(dpy, surface); + (void)yagl_host_eglCopyBuffers(cur_ts, dpy, surface); YAGL_LOG_FUNC_EXIT(NULL); } @@ -368,6 +386,7 @@ static void yagl_func_eglCopyBuffers(struct yagl_transport *t) */ static void yagl_func_eglCreateWindowSurfaceOffscreenYAGL(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle config; uint32_t width; @@ -388,7 +407,7 @@ static void yagl_func_eglCreateWindowSurfaceOffscreenYAGL(struct yagl_transport yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); 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); + *retval = yagl_host_eglCreateWindowSurfaceOffscreenYAGL(cur_ts, dpy, config, width, height, bpp, pixels, attrib_list, attrib_list_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); } @@ -397,6 +416,7 @@ static void yagl_func_eglCreateWindowSurfaceOffscreenYAGL(struct yagl_transport */ static void yagl_func_eglCreatePbufferSurfaceOffscreenYAGL(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle config; uint32_t width; @@ -417,7 +437,7 @@ static void yagl_func_eglCreatePbufferSurfaceOffscreenYAGL(struct yagl_transport yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); 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); + *retval = yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(cur_ts, dpy, config, width, height, bpp, pixels, attrib_list, attrib_list_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); } @@ -426,6 +446,7 @@ static void yagl_func_eglCreatePbufferSurfaceOffscreenYAGL(struct yagl_transport */ static void yagl_func_eglCreatePixmapSurfaceOffscreenYAGL(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle config; uint32_t width; @@ -446,7 +467,7 @@ static void yagl_func_eglCreatePixmapSurfaceOffscreenYAGL(struct yagl_transport yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); 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); + *retval = yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(cur_ts, dpy, config, width, height, bpp, pixels, attrib_list, attrib_list_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); } @@ -455,6 +476,7 @@ static void yagl_func_eglCreatePixmapSurfaceOffscreenYAGL(struct yagl_transport */ static void yagl_func_eglResizeOffscreenSurfaceYAGL(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle surface; uint32_t width; @@ -472,7 +494,7 @@ static void yagl_func_eglResizeOffscreenSurfaceYAGL(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); 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); + *retval = yagl_host_eglResizeOffscreenSurfaceYAGL(cur_ts, dpy, surface, width, height, bpp, pixels, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); } @@ -481,6 +503,7 @@ static void yagl_func_eglResizeOffscreenSurfaceYAGL(struct yagl_transport *t) */ static void yagl_func_eglCreateWindowSurfaceOnscreenYAGL(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle config; yagl_winsys_id win; @@ -495,7 +518,7 @@ static void yagl_func_eglCreateWindowSurfaceOnscreenYAGL(struct yagl_transport * yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); 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); + *retval = yagl_host_eglCreateWindowSurfaceOnscreenYAGL(cur_ts, dpy, config, win, attrib_list, attrib_list_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); } @@ -504,6 +527,7 @@ static void yagl_func_eglCreateWindowSurfaceOnscreenYAGL(struct yagl_transport * */ static void yagl_func_eglCreatePbufferSurfaceOnscreenYAGL(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle config; yagl_winsys_id buffer; @@ -518,7 +542,7 @@ static void yagl_func_eglCreatePbufferSurfaceOnscreenYAGL(struct yagl_transport yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); 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); + *retval = yagl_host_eglCreatePbufferSurfaceOnscreenYAGL(cur_ts, dpy, config, buffer, attrib_list, attrib_list_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); } @@ -527,6 +551,7 @@ static void yagl_func_eglCreatePbufferSurfaceOnscreenYAGL(struct yagl_transport */ static void yagl_func_eglCreatePixmapSurfaceOnscreenYAGL(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle config; yagl_winsys_id pixmap; @@ -541,7 +566,7 @@ static void yagl_func_eglCreatePixmapSurfaceOnscreenYAGL(struct yagl_transport * yagl_transport_get_in_arg(t, (void**)&error); yagl_transport_get_in_arg(t, (void**)&retval); 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); + *retval = yagl_host_eglCreatePixmapSurfaceOnscreenYAGL(cur_ts, dpy, config, pixmap, attrib_list, attrib_list_count, error); YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, *retval); } @@ -550,6 +575,7 @@ static void yagl_func_eglCreatePixmapSurfaceOnscreenYAGL(struct yagl_transport * */ static void yagl_func_eglInvalidateOnscreenSurfaceYAGL(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; yagl_host_handle dpy; yagl_host_handle surface; yagl_winsys_id buffer; @@ -557,7 +583,7 @@ static void yagl_func_eglInvalidateOnscreenSurfaceYAGL(struct yagl_transport *t) surface = yagl_transport_get_out_yagl_host_handle(t); buffer = yagl_transport_get_out_yagl_winsys_id(t); YAGL_LOG_FUNC_ENTER_SPLIT3(eglInvalidateOnscreenSurfaceYAGL, yagl_host_handle, yagl_host_handle, yagl_winsys_id, dpy, surface, buffer); - (void)yagl_host_eglInvalidateOnscreenSurfaceYAGL(dpy, surface, buffer); + (void)yagl_host_eglInvalidateOnscreenSurfaceYAGL(cur_ts, dpy, surface, buffer); YAGL_LOG_FUNC_EXIT(NULL); } @@ -566,6 +592,7 @@ static void yagl_func_eglInvalidateOnscreenSurfaceYAGL(struct yagl_transport *t) */ static void yagl_func_eglCreateImageYAGL(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; uint32_t texture; yagl_host_handle dpy; yagl_winsys_id buffer; @@ -577,7 +604,7 @@ static void yagl_func_eglCreateImageYAGL(struct yagl_transport *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); + *retval = yagl_host_eglCreateImageYAGL(cur_ts, texture, dpy, buffer, error); YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, *retval); } diff --git a/hw/yagl/yagl_apis/egl/yagl_egl_config.c b/hw/yagl/yagl_apis/egl/yagl_egl_config.c index 71bcf23585..0a365a6ed7 100644 --- a/hw/yagl/yagl_apis/egl/yagl_egl_config.c +++ b/hw/yagl/yagl_apis/egl/yagl_egl_config.c @@ -36,7 +36,7 @@ #include "yagl_thread.h" #include -static void yagl_egl_config_destroy(struct yagl_ref *ref) +static void yagl_egl_config_destroy(struct yagl_thread_state *cur_ts, struct yagl_ref *ref) { struct yagl_egl_config *cfg = (struct yagl_egl_config*)ref; @@ -437,9 +437,9 @@ void yagl_egl_config_acquire(struct yagl_egl_config *cfg) } } -void yagl_egl_config_release(struct yagl_egl_config *cfg) +void yagl_egl_config_release(struct yagl_thread_state *cur_ts, struct yagl_egl_config *cfg) { if (cfg) { - yagl_resource_release(&cfg->res); + yagl_resource_release(cur_ts, &cfg->res); } } diff --git a/hw/yagl/yagl_apis/egl/yagl_egl_config.h b/hw/yagl/yagl_apis/egl/yagl_egl_config.h index c58548566c..3d851c4f71 100644 --- a/hw/yagl/yagl_apis/egl/yagl_egl_config.h +++ b/hw/yagl/yagl_apis/egl/yagl_egl_config.h @@ -85,7 +85,7 @@ void yagl_egl_config_acquire(struct yagl_egl_config *cfg); /* * Passing NULL won't hurt, this is for convenience. */ -void yagl_egl_config_release(struct yagl_egl_config *cfg); +void yagl_egl_config_release(struct yagl_thread_state *cur_ts, struct yagl_egl_config *cfg); /* * @} diff --git a/hw/yagl/yagl_apis/egl/yagl_egl_context.c b/hw/yagl/yagl_apis/egl/yagl_egl_context.c index 467d521bc1..55387a57a8 100644 --- a/hw/yagl/yagl_apis/egl/yagl_egl_context.c +++ b/hw/yagl/yagl_apis/egl/yagl_egl_context.c @@ -34,16 +34,16 @@ #include "yagl_eglb_context.h" #include "yagl_eglb_display.h" -static void yagl_egl_context_destroy(struct yagl_ref *ref) +static void yagl_egl_context_destroy(struct yagl_thread_state *cur_ts, struct yagl_ref *ref) { struct yagl_egl_context *ctx = (struct yagl_egl_context*)ref; assert(!ctx->draw); assert(!ctx->read); - ctx->backend_ctx->destroy(ctx->backend_ctx); + ctx->backend_ctx->destroy(cur_ts, ctx->backend_ctx); - yagl_egl_config_release(ctx->cfg); + yagl_egl_config_release(cur_ts, ctx->cfg); yagl_resource_cleanup(&ctx->res); @@ -51,7 +51,8 @@ static void yagl_egl_context_destroy(struct yagl_ref *ref) } struct yagl_egl_context - *yagl_egl_context_create(struct yagl_egl_display *dpy, + *yagl_egl_context_create(struct yagl_thread_state *cur_ts, + struct yagl_egl_display *dpy, struct yagl_egl_config *cfg, struct yagl_eglb_context *backend_share_ctx, int version) @@ -59,7 +60,8 @@ struct yagl_egl_context struct yagl_eglb_context *backend_ctx; struct yagl_egl_context *ctx; - backend_ctx = dpy->backend_dpy->create_context(dpy->backend_dpy, + backend_ctx = dpy->backend_dpy->create_context(cur_ts, + dpy->backend_dpy, &cfg->native, backend_share_ctx, version); @@ -82,7 +84,8 @@ struct yagl_egl_context return ctx; } -void yagl_egl_context_update_surfaces(struct yagl_egl_context *ctx, +void yagl_egl_context_update_surfaces(struct yagl_thread_state *cur_ts, + struct yagl_egl_context *ctx, struct yagl_egl_surface *draw, struct yagl_egl_surface *read) { @@ -97,8 +100,8 @@ void yagl_egl_context_update_surfaces(struct yagl_egl_context *ctx, ctx->draw = draw; ctx->read = read; - yagl_egl_surface_release(tmp_draw); - yagl_egl_surface_release(tmp_read); + yagl_egl_surface_release(cur_ts, tmp_draw); + yagl_egl_surface_release(cur_ts, tmp_read); } void yagl_egl_context_acquire(struct yagl_egl_context *ctx) @@ -108,9 +111,9 @@ void yagl_egl_context_acquire(struct yagl_egl_context *ctx) } } -void yagl_egl_context_release(struct yagl_egl_context *ctx) +void yagl_egl_context_release(struct yagl_thread_state *cur_ts, struct yagl_egl_context *ctx) { if (ctx) { - yagl_resource_release(&ctx->res); + yagl_resource_release(cur_ts, &ctx->res); } } diff --git a/hw/yagl/yagl_apis/egl/yagl_egl_context.h b/hw/yagl/yagl_apis/egl/yagl_egl_context.h index 1a6a9391cb..d6f065b9e2 100644 --- a/hw/yagl/yagl_apis/egl/yagl_egl_context.h +++ b/hw/yagl/yagl_apis/egl/yagl_egl_context.h @@ -57,12 +57,14 @@ struct yagl_egl_context * Takes ownership of 'client_ctx'. */ struct yagl_egl_context - *yagl_egl_context_create(struct yagl_egl_display *dpy, + *yagl_egl_context_create(struct yagl_thread_state *cur_ts, + struct yagl_egl_display *dpy, struct yagl_egl_config *cfg, struct yagl_eglb_context *backend_share_ctx, int version); -void yagl_egl_context_update_surfaces(struct yagl_egl_context *ctx, +void yagl_egl_context_update_surfaces(struct yagl_thread_state *cur_ts, + struct yagl_egl_context *ctx, struct yagl_egl_surface *draw, struct yagl_egl_surface *read); @@ -79,7 +81,7 @@ void yagl_egl_context_acquire(struct yagl_egl_context *ctx); /* * Passing NULL won't hurt, this is for convenience. */ -void yagl_egl_context_release(struct yagl_egl_context *ctx); +void yagl_egl_context_release(struct yagl_thread_state *cur_ts, struct yagl_egl_context *ctx); /* * @} diff --git a/hw/yagl/yagl_apis/egl/yagl_egl_display.c b/hw/yagl/yagl_apis/egl/yagl_egl_display.c index 11fed5278a..13272eb01e 100644 --- a/hw/yagl/yagl_apis/egl/yagl_egl_display.c +++ b/hw/yagl/yagl_apis/egl/yagl_egl_display.c @@ -39,7 +39,8 @@ #include "yagl_handle_gen.h" struct yagl_egl_display - *yagl_egl_display_create(struct yagl_egl_backend *backend, + *yagl_egl_display_create(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend, uint32_t display_id) { struct yagl_eglb_display *backend_dpy; @@ -67,20 +68,20 @@ struct yagl_egl_display return dpy; } -void yagl_egl_display_destroy(struct yagl_egl_display *dpy) +void yagl_egl_display_destroy(struct yagl_thread_state *cur_ts, struct yagl_egl_display *dpy) { - yagl_egl_display_terminate(dpy); + yagl_egl_display_terminate(cur_ts, dpy); - yagl_resource_list_cleanup(&dpy->surfaces); - yagl_resource_list_cleanup(&dpy->contexts); - yagl_resource_list_cleanup(&dpy->configs); + yagl_resource_list_cleanup(cur_ts, &dpy->surfaces); + yagl_resource_list_cleanup(cur_ts, &dpy->contexts); + yagl_resource_list_cleanup(cur_ts, &dpy->configs); dpy->backend_dpy->destroy(dpy->backend_dpy); g_free(dpy); } -void yagl_egl_display_initialize(struct yagl_egl_display *dpy) +void yagl_egl_display_initialize(struct yagl_thread_state *cur_ts, struct yagl_egl_display *dpy) { struct yagl_egl_config **cfgs; int i, num_configs = 0; @@ -101,7 +102,7 @@ void yagl_egl_display_initialize(struct yagl_egl_display *dpy) for (i = 0; i < num_configs; ++i) { yagl_resource_list_add(&dpy->configs, &cfgs[i]->res); - yagl_egl_config_release(cfgs[i]); + yagl_egl_config_release(cur_ts, cfgs[i]); } g_free(cfgs); @@ -123,7 +124,7 @@ bool yagl_egl_display_is_initialized(struct yagl_egl_display *dpy) return ret; } -void yagl_egl_display_terminate(struct yagl_egl_display *dpy) +void yagl_egl_display_terminate(struct yagl_thread_state *cur_ts, struct yagl_egl_display *dpy) { struct yagl_resource_list tmp_list; @@ -139,7 +140,7 @@ void yagl_egl_display_terminate(struct yagl_egl_display *dpy) dpy->initialized = false; - yagl_resource_list_cleanup(&tmp_list); + yagl_resource_list_cleanup(cur_ts, &tmp_list); } int32_t yagl_egl_display_get_config_count(struct yagl_egl_display *dpy) @@ -225,10 +226,11 @@ struct yagl_egl_context return (struct yagl_egl_context*)yagl_resource_list_acquire(&dpy->contexts, handle); } -bool yagl_egl_display_remove_context(struct yagl_egl_display *dpy, +bool yagl_egl_display_remove_context(struct yagl_thread_state *cur_ts, + struct yagl_egl_display *dpy, yagl_host_handle handle) { - return yagl_resource_list_remove(&dpy->contexts, handle); + return yagl_resource_list_remove(cur_ts, &dpy->contexts, handle); } void yagl_egl_display_add_surface(struct yagl_egl_display *dpy, @@ -244,8 +246,9 @@ struct yagl_egl_surface return (struct yagl_egl_surface*)yagl_resource_list_acquire(&dpy->surfaces, handle); } -bool yagl_egl_display_remove_surface(struct yagl_egl_display *dpy, +bool yagl_egl_display_remove_surface(struct yagl_thread_state *cur_ts, + struct yagl_egl_display *dpy, yagl_host_handle handle) { - return yagl_resource_list_remove(&dpy->surfaces, handle); + return yagl_resource_list_remove(cur_ts, &dpy->surfaces, handle); } diff --git a/hw/yagl/yagl_apis/egl/yagl_egl_display.h b/hw/yagl/yagl_apis/egl/yagl_egl_display.h index 182af02b0d..f60c9dfb99 100644 --- a/hw/yagl/yagl_apis/egl/yagl_egl_display.h +++ b/hw/yagl/yagl_apis/egl/yagl_egl_display.h @@ -64,16 +64,19 @@ struct yagl_egl_display }; struct yagl_egl_display - *yagl_egl_display_create(struct yagl_egl_backend *backend, + *yagl_egl_display_create(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend, uint32_t display_id); -void yagl_egl_display_destroy(struct yagl_egl_display *dpy); +void yagl_egl_display_destroy(struct yagl_thread_state *cur_ts, + struct yagl_egl_display *dpy); -void yagl_egl_display_initialize(struct yagl_egl_display *dpy); +void yagl_egl_display_initialize(struct yagl_thread_state *cur_ts, + struct yagl_egl_display *dpy); bool yagl_egl_display_is_initialized(struct yagl_egl_display *dpy); -void yagl_egl_display_terminate(struct yagl_egl_display *dpy); +void yagl_egl_display_terminate(struct yagl_thread_state *cur_ts, struct yagl_egl_display *dpy); /* * Configs. @@ -134,7 +137,8 @@ struct yagl_egl_context *yagl_egl_display_acquire_context(struct yagl_egl_display *dpy, yagl_host_handle handle); -bool yagl_egl_display_remove_context(struct yagl_egl_display *dpy, +bool yagl_egl_display_remove_context(struct yagl_thread_state *cur_ts, + struct yagl_egl_display *dpy, yagl_host_handle handle); /* @@ -158,7 +162,8 @@ struct yagl_egl_surface *yagl_egl_display_acquire_surface(struct yagl_egl_display *dpy, yagl_host_handle handle); -bool yagl_egl_display_remove_surface(struct yagl_egl_display *dpy, +bool yagl_egl_display_remove_surface(struct yagl_thread_state *cur_ts, + struct yagl_egl_display *dpy, yagl_host_handle handle); /* diff --git a/hw/yagl/yagl_apis/egl/yagl_egl_surface.c b/hw/yagl/yagl_apis/egl/yagl_egl_surface.c index 386dc903db..356c6832c2 100644 --- a/hw/yagl/yagl_apis/egl/yagl_egl_surface.c +++ b/hw/yagl/yagl_apis/egl/yagl_egl_surface.c @@ -32,13 +32,13 @@ #include "yagl_egl_config.h" #include "yagl_eglb_surface.h" -static void yagl_egl_surface_destroy(struct yagl_ref *ref) +static void yagl_egl_surface_destroy(struct yagl_thread_state *cur_ts, struct yagl_ref *ref) { struct yagl_egl_surface *sfc = (struct yagl_egl_surface*)ref; - sfc->backend_sfc->destroy(sfc->backend_sfc); + sfc->backend_sfc->destroy(cur_ts, sfc->backend_sfc); - yagl_egl_config_release(sfc->cfg); + yagl_egl_config_release(cur_ts, sfc->cfg); yagl_resource_cleanup(&sfc->res); @@ -69,9 +69,9 @@ void yagl_egl_surface_acquire(struct yagl_egl_surface *sfc) } } -void yagl_egl_surface_release(struct yagl_egl_surface *sfc) +void yagl_egl_surface_release(struct yagl_thread_state *cur_ts, struct yagl_egl_surface *sfc) { if (sfc) { - yagl_resource_release(&sfc->res); + yagl_resource_release(cur_ts, &sfc->res); } } diff --git a/hw/yagl/yagl_apis/egl/yagl_egl_surface.h b/hw/yagl/yagl_apis/egl/yagl_egl_surface.h index c16fb04194..5b67af1312 100644 --- a/hw/yagl/yagl_apis/egl/yagl_egl_surface.h +++ b/hw/yagl/yagl_apis/egl/yagl_egl_surface.h @@ -69,7 +69,7 @@ void yagl_egl_surface_acquire(struct yagl_egl_surface *sfc); /* * Passing NULL won't hurt, this is for convenience. */ -void yagl_egl_surface_release(struct yagl_egl_surface *sfc); +void yagl_egl_surface_release(struct yagl_thread_state *cur_ts, struct yagl_egl_surface *sfc); /* * @} diff --git a/hw/yagl/yagl_apis/egl/yagl_host_egl_calls.c b/hw/yagl/yagl_apis/egl/yagl_host_egl_calls.c index e52ab90390..a8fbb570ad 100644 --- a/hw/yagl/yagl_apis/egl/yagl_host_egl_calls.c +++ b/hw/yagl/yagl_apis/egl/yagl_host_egl_calls.c @@ -43,7 +43,6 @@ #include "yagl_eglb_context.h" #include "yagl_eglb_surface.h" #include "yagl_log.h" -#include "yagl_tls.h" #include "yagl_thread.h" #include "yagl_process.h" #include "yagl_object_map.h" @@ -69,44 +68,47 @@ struct yagl_egl_interface_impl struct yagl_egl_backend *backend; }; -static YAGL_DEFINE_TLS(struct yagl_egl_api_ts*, egl_api_ts); - -static uint32_t yagl_egl_get_ctx_id(struct yagl_egl_interface *iface) +static uint32_t yagl_egl_get_ctx_id(struct yagl_thread_state *cur_ts, struct yagl_egl_interface *iface) { - if (egl_api_ts) { - return egl_api_ts->context ? egl_api_ts->context->res.handle : 0; + if (cur_ts->egl_api_ts) { + return cur_ts->egl_api_ts->context ? cur_ts->egl_api_ts->context->res.handle : 0; } else { return 0; } } -static void yagl_egl_ensure_ctx(struct yagl_egl_interface *iface, uint32_t ctx_id) +static void yagl_egl_ensure_ctx(struct yagl_thread_state *cur_ts, + struct yagl_egl_interface *iface, + uint32_t ctx_id) { struct yagl_egl_interface_impl *egl_iface = (struct yagl_egl_interface_impl*)iface; - uint32_t current_ctx_id = yagl_egl_get_ctx_id(iface); + uint32_t current_ctx_id = yagl_egl_get_ctx_id(cur_ts, iface); if (!current_ctx_id || (ctx_id && (current_ctx_id != ctx_id))) { - egl_iface->backend->ensure_current(egl_iface->backend); + egl_iface->backend->ensure_current(cur_ts, egl_iface->backend); } } -static void yagl_egl_unensure_ctx(struct yagl_egl_interface *iface, uint32_t ctx_id) +static void yagl_egl_unensure_ctx(struct yagl_thread_state *cur_ts, + struct yagl_egl_interface *iface, + uint32_t ctx_id) { struct yagl_egl_interface_impl *egl_iface = (struct yagl_egl_interface_impl*)iface; - uint32_t current_ctx_id = yagl_egl_get_ctx_id(iface); + uint32_t current_ctx_id = yagl_egl_get_ctx_id(cur_ts, iface); if (!current_ctx_id || (ctx_id && (current_ctx_id != ctx_id))) { - egl_iface->backend->unensure_current(egl_iface->backend); + egl_iface->backend->unensure_current(cur_ts, egl_iface->backend); } } -static __inline bool yagl_validate_display(yagl_host_handle dpy_, +static __inline bool yagl_validate_display(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, struct yagl_egl_display **dpy, EGLint *error) { YAGL_LOG_FUNC_SET(yagl_validate_display); - *dpy = yagl_egl_api_ps_display_get(egl_api_ts->api_ps, dpy_); + *dpy = yagl_egl_api_ps_display_get(cur_ts->egl_api_ts->api_ps, dpy_); if (!*dpy) { YAGL_SET_ERR(EGL_BAD_DISPLAY); @@ -121,7 +123,8 @@ static __inline bool yagl_validate_display(yagl_host_handle dpy_, return true; } -static __inline bool yagl_validate_config(struct yagl_egl_display *dpy, +static __inline bool yagl_validate_config(struct yagl_thread_state *cur_ts, + struct yagl_egl_display *dpy, yagl_host_handle cfg_, struct yagl_egl_config **cfg, EGLint *error) @@ -138,7 +141,8 @@ static __inline bool yagl_validate_config(struct yagl_egl_display *dpy, return true; } -static __inline bool yagl_validate_surface(struct yagl_egl_display *dpy, +static __inline bool yagl_validate_surface(struct yagl_thread_state *cur_ts, + struct yagl_egl_display *dpy, yagl_host_handle sfc_, struct yagl_egl_surface **sfc, EGLint *error) @@ -155,7 +159,8 @@ static __inline bool yagl_validate_surface(struct yagl_egl_display *dpy, return true; } -static __inline bool yagl_validate_context(struct yagl_egl_display *dpy, +static __inline bool yagl_validate_context(struct yagl_thread_state *cur_ts, + struct yagl_egl_display *dpy, yagl_host_handle ctx_, struct yagl_egl_context **ctx, EGLint *error) @@ -172,19 +177,27 @@ static __inline bool yagl_validate_context(struct yagl_egl_display *dpy, return true; } -static bool yagl_egl_release_current_context(struct yagl_egl_display *dpy) +static bool yagl_egl_release_current_context(struct yagl_thread_state *cur_ts, struct yagl_egl_display *dpy) { + struct yagl_egl_api_ts *egl_api_ts; + + if (!cur_ts) { + return false; + } + + egl_api_ts = cur_ts->egl_api_ts; + if (!egl_api_ts->context) { return true; } - if (!egl_api_ts->backend->release_current(egl_api_ts->backend, false)) { + if (!egl_api_ts->backend->release_current(cur_ts, egl_api_ts->backend, false)) { return false; } - yagl_egl_context_update_surfaces(egl_api_ts->context, NULL, NULL); + yagl_egl_context_update_surfaces(cur_ts, egl_api_ts->context, NULL, NULL); - yagl_egl_api_ts_update_context(egl_api_ts, NULL); + yagl_egl_api_ts_update_context(cur_ts, egl_api_ts, NULL); return true; } @@ -199,68 +212,64 @@ static yagl_api_func yagl_host_egl_get_func(struct yagl_api_ps *api_ps, } } -static void yagl_host_egl_thread_init(struct yagl_api_ps *api_ps) +static void yagl_host_egl_thread_init(struct yagl_thread_state *cur_ts, struct yagl_api_ps *api_ps) { struct yagl_egl_api_ps *egl_api_ps = (struct yagl_egl_api_ps*)api_ps; YAGL_LOG_FUNC_ENTER(yagl_host_egl_thread_init, NULL); - egl_api_ps->backend->thread_init(egl_api_ps->backend); + egl_api_ps->backend->thread_init(cur_ts, egl_api_ps->backend); - egl_api_ts = g_malloc0(sizeof(*egl_api_ts)); + cur_ts->egl_api_ts = g_malloc0(sizeof(struct yagl_egl_api_ts)); - yagl_egl_api_ts_init(egl_api_ts, egl_api_ps); - - cur_ts->egl_api_ts = egl_api_ts; + yagl_egl_api_ts_init(cur_ts, cur_ts->egl_api_ts, egl_api_ps); YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_host_egl_batch_start(struct yagl_api_ps *api_ps) +static void yagl_host_egl_batch_start(struct yagl_thread_state *cur_ts, 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); + egl_api_ps->backend->batch_start(cur_ts, egl_api_ps->backend); } -static void yagl_host_egl_batch_end(struct yagl_api_ps *api_ps) +static void yagl_host_egl_batch_end(struct yagl_thread_state *cur_ts, 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); + egl_api_ps->backend->batch_end(cur_ts, egl_api_ps->backend); } -static void yagl_host_egl_thread_fini(struct yagl_api_ps *api_ps) +static void yagl_host_egl_thread_fini(struct yagl_thread_state *cur_ts, 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); + egl_api_ps->backend->batch_start(cur_ts, egl_api_ps->backend); - yagl_egl_api_ts_cleanup(egl_api_ts); + yagl_egl_api_ts_cleanup(cur_ts, cur_ts->egl_api_ts); - g_free(egl_api_ts); + g_free(cur_ts->egl_api_ts); - egl_api_ts = cur_ts->egl_api_ts = NULL; + 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); + egl_api_ps->backend->batch_end(cur_ts, egl_api_ps->backend); + egl_api_ps->backend->thread_fini(cur_ts, egl_api_ps->backend); YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_host_egl_process_destroy(struct yagl_api_ps *api_ps) +static void yagl_host_egl_process_destroy(struct yagl_thread_state *cur_ts, struct yagl_api_ps *api_ps) { struct yagl_egl_api_ps *egl_api_ps = (struct yagl_egl_api_ps*)api_ps; YAGL_LOG_FUNC_ENTER(yagl_host_egl_process_destroy, NULL); - yagl_egl_api_ps_cleanup(egl_api_ps); + yagl_egl_api_ps_cleanup(cur_ts, egl_api_ps); + + yagl_process_unregister_egl_interface(cur_ts->ps); g_free(egl_api_ps->egl_iface); @@ -271,11 +280,12 @@ static void yagl_host_egl_process_destroy(struct yagl_api_ps *api_ps) YAGL_LOG_FUNC_EXIT(NULL); } -struct yagl_api_ps *yagl_host_egl_process_init(struct yagl_api *api) +struct yagl_api_ps *yagl_host_egl_process_init(struct yagl_process_state *ps, struct yagl_api *api) { struct yagl_egl_api *egl_api = (struct yagl_egl_api*)api; struct yagl_egl_interface_impl *egl_iface; struct yagl_egl_api_ps *egl_api_ps; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_host_egl_process_init, NULL); @@ -307,22 +317,26 @@ struct yagl_api_ps *yagl_host_egl_process_init(struct yagl_api *api) yagl_egl_api_ps_init(egl_api_ps, egl_api->backend, &egl_iface->base); + yagl_process_register_egl_interface(ps, egl_api_ps->egl_iface); + YAGL_LOG_FUNC_EXIT(NULL); return &egl_api_ps->base; } -yagl_host_handle yagl_host_eglGetDisplay(uint32_t display_id, +yagl_host_handle yagl_host_eglGetDisplay(struct yagl_thread_state *cur_ts, + uint32_t display_id, EGLint *error) { struct yagl_egl_display *dpy; - dpy = yagl_egl_api_ps_display_add(egl_api_ts->api_ps, display_id); + dpy = yagl_egl_api_ps_display_add(cur_ts, cur_ts->egl_api_ts->api_ps, display_id); return (dpy ? dpy->handle : 0); } -EGLBoolean yagl_host_eglInitialize(yagl_host_handle dpy_, +EGLBoolean yagl_host_eglInitialize(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, EGLint *major, EGLint *minor, EGLint *error) @@ -331,14 +345,14 @@ EGLBoolean yagl_host_eglInitialize(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglInitialize); - dpy = yagl_egl_api_ps_display_get(egl_api_ts->api_ps, dpy_); + dpy = yagl_egl_api_ps_display_get(cur_ts->egl_api_ts->api_ps, dpy_); if (!dpy) { YAGL_SET_ERR(EGL_BAD_DISPLAY); return EGL_FALSE; } - yagl_egl_display_initialize(dpy); + yagl_egl_display_initialize(cur_ts, dpy); if (major) { *major = YAGL_EGL_VERSION_MAJOR; @@ -351,27 +365,28 @@ EGLBoolean yagl_host_eglInitialize(yagl_host_handle dpy_, return EGL_TRUE; } -EGLBoolean yagl_host_eglTerminate(yagl_host_handle dpy_, +EGLBoolean yagl_host_eglTerminate(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, EGLint *error) { struct yagl_egl_display *dpy = NULL; - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { return EGL_FALSE; } - yagl_egl_display_terminate(dpy); + yagl_egl_display_terminate(cur_ts, dpy); return EGL_TRUE; } -EGLBoolean yagl_host_eglGetConfigs(yagl_host_handle dpy_, +EGLBoolean yagl_host_eglGetConfigs(struct yagl_thread_state *cur_ts, yagl_host_handle dpy_, yagl_host_handle *configs, int32_t configs_maxcount, int32_t *configs_count, EGLint *error) { struct yagl_egl_display *dpy = NULL; - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { return EGL_FALSE; } @@ -385,7 +400,7 @@ EGLBoolean yagl_host_eglGetConfigs(yagl_host_handle dpy_, return EGL_TRUE; } -EGLBoolean yagl_host_eglChooseConfig(yagl_host_handle dpy_, +EGLBoolean yagl_host_eglChooseConfig(struct yagl_thread_state *cur_ts, yagl_host_handle dpy_, const EGLint *attrib_list, int32_t attrib_list_count, yagl_host_handle *configs, int32_t configs_maxcount, int32_t *configs_count, EGLint *error) @@ -399,7 +414,7 @@ EGLBoolean yagl_host_eglChooseConfig(yagl_host_handle dpy_, yagl_egl_native_config_init(&dummy); - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } @@ -624,7 +639,7 @@ EGLBoolean yagl_host_eglChooseConfig(yagl_host_handle dpy_, if (cfg) { handle = cfg->res.handle; - yagl_egl_config_release(cfg); + yagl_egl_config_release(cur_ts, cfg); } YAGL_LOG_DEBUG("requesting config with id = %d", config_id); @@ -656,7 +671,8 @@ out: return res; } -EGLBoolean yagl_host_eglGetConfigAttrib(yagl_host_handle dpy_, +EGLBoolean yagl_host_eglGetConfigAttrib(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle config_, EGLint attribute, EGLint *value, @@ -669,11 +685,11 @@ EGLBoolean yagl_host_eglGetConfigAttrib(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglGetConfigAttrib); - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_config(dpy, config_, &config, error)) { + if (!yagl_validate_config(cur_ts, dpy, config_, &config, error)) { goto out; } @@ -689,12 +705,13 @@ EGLBoolean yagl_host_eglGetConfigAttrib(yagl_host_handle dpy_, res = EGL_TRUE; out: - yagl_egl_config_release(config); + yagl_egl_config_release(cur_ts, config); return res; } -EGLBoolean yagl_host_eglDestroySurface(yagl_host_handle dpy_, +EGLBoolean yagl_host_eglDestroySurface(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle surface_, EGLint *error) { @@ -704,15 +721,15 @@ EGLBoolean yagl_host_eglDestroySurface(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglDestroySurface); - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_surface(dpy, surface_, &surface, error)) { + if (!yagl_validate_surface(cur_ts, dpy, surface_, &surface, error)) { goto out; } - if (!yagl_egl_display_remove_surface(dpy, surface->res.handle)) { + if (!yagl_egl_display_remove_surface(cur_ts, dpy, surface->res.handle)) { YAGL_SET_ERR(EGL_BAD_SURFACE); goto out; } @@ -720,12 +737,13 @@ EGLBoolean yagl_host_eglDestroySurface(yagl_host_handle dpy_, res = EGL_TRUE; out: - yagl_egl_surface_release(surface); + yagl_egl_surface_release(cur_ts, surface); return res; } -EGLBoolean yagl_host_eglQuerySurface(yagl_host_handle dpy_, +EGLBoolean yagl_host_eglQuerySurface(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle surface_, EGLint attribute, EGLint *value, @@ -738,11 +756,11 @@ EGLBoolean yagl_host_eglQuerySurface(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglQuerySurface); - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_surface(dpy, surface_, &surface, error)) { + if (!yagl_validate_surface(cur_ts, dpy, surface_, &surface, error)) { goto out; } @@ -812,7 +830,8 @@ EGLBoolean yagl_host_eglQuerySurface(yagl_host_handle dpy_, } break; default: - if (!surface->backend_sfc->query(surface->backend_sfc, + if (!surface->backend_sfc->query(cur_ts, + surface->backend_sfc, attribute, &tmp)) { YAGL_SET_ERR(EGL_BAD_ATTRIBUTE); @@ -827,47 +846,48 @@ EGLBoolean yagl_host_eglQuerySurface(yagl_host_handle dpy_, res = EGL_TRUE; out: - yagl_egl_surface_release(surface); + yagl_egl_surface_release(cur_ts, surface); return res; } -void yagl_host_eglBindAPI(EGLenum api) +void yagl_host_eglBindAPI(struct yagl_thread_state *cur_ts, EGLenum api) { - egl_api_ts->api = api; + cur_ts->egl_api_ts->api = api; } -void yagl_host_eglWaitClient(void) +void yagl_host_eglWaitClient(struct yagl_thread_state *cur_ts) { struct yagl_egl_surface *sfc = NULL; - if (!egl_api_ts->context) { + if (!cur_ts->egl_api_ts->context) { return; } - sfc = egl_api_ts->context->draw; + sfc = cur_ts->egl_api_ts->context->draw; if (!sfc) { return; } - sfc->backend_sfc->wait_gl(sfc->backend_sfc); + sfc->backend_sfc->wait_gl(cur_ts, + sfc->backend_sfc); } -EGLBoolean yagl_host_eglReleaseThread(EGLint *error) +EGLBoolean yagl_host_eglReleaseThread(struct yagl_thread_state *cur_ts, EGLint *error) { EGLBoolean res = EGL_FALSE; YAGL_LOG_FUNC_SET(eglReleaseThread); - if (egl_api_ts->context) { - if (!yagl_egl_release_current_context(egl_api_ts->context->dpy)) { + if (cur_ts->egl_api_ts->context) { + if (!yagl_egl_release_current_context(cur_ts, cur_ts->egl_api_ts->context->dpy)) { YAGL_SET_ERR(EGL_BAD_ACCESS); goto out; } } - yagl_egl_api_ts_reset(egl_api_ts); + yagl_egl_api_ts_reset(cur_ts->egl_api_ts); res = EGL_TRUE; @@ -875,7 +895,8 @@ out: return res; } -EGLBoolean yagl_host_eglSurfaceAttrib(yagl_host_handle dpy_, +EGLBoolean yagl_host_eglSurfaceAttrib(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle surface_, EGLint attribute, EGLint value, @@ -885,11 +906,11 @@ EGLBoolean yagl_host_eglSurfaceAttrib(yagl_host_handle dpy_, struct yagl_egl_display *dpy = NULL; struct yagl_egl_surface *surface = NULL; - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_surface(dpy, surface_, &surface, error)) { + if (!yagl_validate_surface(cur_ts, dpy, surface_, &surface, error)) { goto out; } @@ -900,12 +921,13 @@ EGLBoolean yagl_host_eglSurfaceAttrib(yagl_host_handle dpy_, res = EGL_TRUE; out: - yagl_egl_surface_release(surface); + yagl_egl_surface_release(cur_ts, surface); return res; } -yagl_host_handle yagl_host_eglCreateContext(yagl_host_handle dpy_, +yagl_host_handle yagl_host_eglCreateContext(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle config_, yagl_host_handle share_context_, const EGLint *attrib_list, int32_t attrib_list_count, @@ -920,15 +942,15 @@ yagl_host_handle yagl_host_eglCreateContext(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglCreateContext); - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_config(dpy, config_, &config, error)) { + if (!yagl_validate_config(cur_ts, dpy, config_, &config, error)) { goto out; } - if (egl_api_ts->api == EGL_OPENGL_ES_API) { + if (cur_ts->egl_api_ts->api == EGL_OPENGL_ES_API) { if (!yagl_egl_is_attrib_list_empty(attrib_list)) { while (attrib_list[i] != EGL_NONE) { switch (attrib_list[i]) { @@ -945,12 +967,13 @@ yagl_host_handle yagl_host_eglCreateContext(yagl_host_handle dpy_, } if (share_context_) { - if (!yagl_validate_context(dpy, share_context_, &share_context, error)) { + if (!yagl_validate_context(cur_ts, dpy, share_context_, &share_context, error)) { goto out; } } - ctx = yagl_egl_context_create(dpy, + ctx = yagl_egl_context_create(cur_ts, + dpy, config, (share_context ? share_context->backend_ctx : NULL), @@ -962,18 +985,19 @@ yagl_host_handle yagl_host_eglCreateContext(yagl_host_handle dpy_, } yagl_egl_display_add_context(dpy, ctx); - yagl_egl_context_release(ctx); + yagl_egl_context_release(cur_ts, ctx); res = ctx->res.handle; out: - yagl_egl_context_release(share_context); - yagl_egl_config_release(config); + yagl_egl_context_release(cur_ts, share_context); + yagl_egl_config_release(cur_ts, config); return res; } -EGLBoolean yagl_host_eglDestroyContext(yagl_host_handle dpy_, +EGLBoolean yagl_host_eglDestroyContext(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle ctx_, EGLint *error) { @@ -983,27 +1007,28 @@ EGLBoolean yagl_host_eglDestroyContext(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglDestroyContext); - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_context(dpy, ctx_, &ctx, error)) { + if (!yagl_validate_context(cur_ts, dpy, ctx_, &ctx, error)) { goto out; } - if (yagl_egl_display_remove_context(dpy, ctx->res.handle)) { + if (yagl_egl_display_remove_context(cur_ts, dpy, ctx->res.handle)) { res = EGL_TRUE; } else { YAGL_SET_ERR(EGL_BAD_CONTEXT); } out: - yagl_egl_context_release(ctx); + yagl_egl_context_release(cur_ts, ctx); return res; } -void yagl_host_eglMakeCurrent(yagl_host_handle dpy_, +void yagl_host_eglMakeCurrent(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle draw_, yagl_host_handle read_, yagl_host_handle ctx_) @@ -1015,10 +1040,11 @@ void yagl_host_eglMakeCurrent(yagl_host_handle dpy_, struct yagl_egl_context *ctx = NULL; struct yagl_egl_surface *draw = NULL; struct yagl_egl_surface *read = NULL; + struct yagl_egl_api_ts *egl_api_ts = cur_ts->egl_api_ts; YAGL_LOG_FUNC_SET(eglMakeCurrent); - if (!yagl_validate_display(dpy_, &dpy, &error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, &error)) { goto out; } @@ -1026,20 +1052,20 @@ void yagl_host_eglMakeCurrent(yagl_host_handle dpy_, yagl_egl_context_acquire(prev_ctx); if (release_context) { - if (!yagl_egl_release_current_context(dpy)) { + if (!yagl_egl_release_current_context(cur_ts, dpy)) { YAGL_LOG_ERROR("cannot release current context"); goto out; } } else { - if (!yagl_validate_context(dpy, ctx_, &ctx, &error)) { + if (!yagl_validate_context(cur_ts, dpy, ctx_, &ctx, &error)) { goto out; } - if (draw_ && !yagl_validate_surface(dpy, draw_, &draw, &error)) { + if (draw_ && !yagl_validate_surface(cur_ts, dpy, draw_, &draw, &error)) { goto out; } - if (read_ && !yagl_validate_surface(dpy, read_, &read, &error)) { + if (read_ && !yagl_validate_surface(cur_ts, dpy, read_, &read, &error)) { goto out; } @@ -1051,7 +1077,8 @@ void yagl_host_eglMakeCurrent(yagl_host_handle dpy_, release_context = true; } - if (!egl_api_ts->backend->make_current(egl_api_ts->backend, + if (!egl_api_ts->backend->make_current(cur_ts, + egl_api_ts->backend, dpy->backend_dpy, ctx->backend_ctx, (draw ? draw->backend_sfc : NULL), @@ -1060,13 +1087,13 @@ void yagl_host_eglMakeCurrent(yagl_host_handle dpy_, goto out; } - yagl_egl_context_update_surfaces(ctx, draw, read); + yagl_egl_context_update_surfaces(cur_ts, ctx, draw, read); - yagl_egl_api_ts_update_context(egl_api_ts, ctx); + yagl_egl_api_ts_update_context(cur_ts, egl_api_ts, ctx); } if (release_context && prev_ctx) { - yagl_egl_context_update_surfaces(prev_ctx, NULL, NULL); + yagl_egl_context_update_surfaces(cur_ts, prev_ctx, NULL, NULL); } YAGL_LOG_TRACE("Context switched (%u, %u, %u, %u)", @@ -1076,13 +1103,14 @@ void yagl_host_eglMakeCurrent(yagl_host_handle dpy_, ctx_); out: - yagl_egl_surface_release(read); - yagl_egl_surface_release(draw); - yagl_egl_context_release(ctx); - yagl_egl_context_release(prev_ctx); + yagl_egl_surface_release(cur_ts, read); + yagl_egl_surface_release(cur_ts, draw); + yagl_egl_context_release(cur_ts, ctx); + yagl_egl_context_release(cur_ts, prev_ctx); } -EGLBoolean yagl_host_eglQueryContext(yagl_host_handle dpy_, +EGLBoolean yagl_host_eglQueryContext(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle ctx_, EGLint attribute, EGLint *value, @@ -1094,11 +1122,11 @@ EGLBoolean yagl_host_eglQueryContext(yagl_host_handle dpy_, YAGL_LOG_FUNC_SET(eglQueryContext); - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_context(dpy, ctx_, &ctx, error)) { + if (!yagl_validate_context(cur_ts, dpy, ctx_, &ctx, error)) { goto out; } @@ -1140,54 +1168,57 @@ EGLBoolean yagl_host_eglQueryContext(yagl_host_handle dpy_, res = EGL_TRUE; out: - yagl_egl_context_release(ctx); + yagl_egl_context_release(cur_ts, ctx); return res; } -void yagl_host_eglSwapBuffers(yagl_host_handle dpy_, +void yagl_host_eglSwapBuffers(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle surface_) { EGLint error = 0; struct yagl_egl_display *dpy = NULL; struct yagl_egl_surface *surface = NULL; - if (!yagl_validate_display(dpy_, &dpy, &error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, &error)) { goto out; } - if (!yagl_validate_surface(dpy, surface_, &surface, &error)) { + if (!yagl_validate_surface(cur_ts, dpy, surface_, &surface, &error)) { goto out; } - surface->backend_sfc->swap_buffers(surface->backend_sfc); + surface->backend_sfc->swap_buffers(cur_ts, surface->backend_sfc); out: - yagl_egl_surface_release(surface); + yagl_egl_surface_release(cur_ts, surface); } -void yagl_host_eglCopyBuffers(yagl_host_handle dpy_, +void yagl_host_eglCopyBuffers(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle surface_) { EGLint error = 0; struct yagl_egl_display *dpy = NULL; struct yagl_egl_surface *surface = NULL; - if (!yagl_validate_display(dpy_, &dpy, &error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, &error)) { goto out; } - if (!yagl_validate_surface(dpy, surface_, &surface, &error)) { + if (!yagl_validate_surface(cur_ts, dpy, surface_, &surface, &error)) { goto out; } - surface->backend_sfc->copy_buffers(surface->backend_sfc); + surface->backend_sfc->copy_buffers(cur_ts, surface->backend_sfc); out: - yagl_egl_surface_release(surface); + yagl_egl_surface_release(cur_ts, surface); } -yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle dpy_, +yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle config_, uint32_t width, uint32_t height, @@ -1222,11 +1253,11 @@ yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle } } - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_config(dpy, config_, &config, error)) { + if (!yagl_validate_config(cur_ts, dpy, config_, &config, error)) { goto out; } @@ -1236,7 +1267,8 @@ yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle goto out; } - backend_sfc = dpy->backend_dpy->create_offscreen_surface(dpy->backend_dpy, + backend_sfc = dpy->backend_dpy->create_offscreen_surface(cur_ts, + dpy->backend_dpy, &config->native, EGL_WINDOW_BIT, &attribs, @@ -1263,20 +1295,21 @@ yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle backend_sfc = NULL; yagl_egl_display_add_surface(dpy, surface); - yagl_egl_surface_release(surface); + yagl_egl_surface_release(cur_ts, surface); res = surface->res.handle; out: - yagl_egl_config_release(config); + yagl_egl_config_release(cur_ts, config); if (backend_sfc) { - backend_sfc->destroy(backend_sfc); + backend_sfc->destroy(cur_ts, backend_sfc); } return res; } -yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle dpy_, +yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle config_, uint32_t width, uint32_t height, @@ -1341,11 +1374,11 @@ yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle } } - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_config(dpy, config_, &config, error)) { + if (!yagl_validate_config(cur_ts, dpy, config_, &config, error)) { goto out; } @@ -1355,7 +1388,8 @@ yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle goto out; } - backend_sfc = dpy->backend_dpy->create_offscreen_surface(dpy->backend_dpy, + backend_sfc = dpy->backend_dpy->create_offscreen_surface(cur_ts, + dpy->backend_dpy, &config->native, EGL_PBUFFER_BIT, &attribs, @@ -1382,20 +1416,21 @@ yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle backend_sfc = NULL; yagl_egl_display_add_surface(dpy, surface); - yagl_egl_surface_release(surface); + yagl_egl_surface_release(cur_ts, surface); res = surface->res.handle; out: - yagl_egl_config_release(config); + yagl_egl_config_release(cur_ts, config); if (backend_sfc) { - backend_sfc->destroy(backend_sfc); + backend_sfc->destroy(cur_ts, backend_sfc); } return res; } -yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle dpy_, +yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle config_, uint32_t width, uint32_t height, @@ -1420,11 +1455,11 @@ yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle goto out; } - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_config(dpy, config_, &config, error)) { + if (!yagl_validate_config(cur_ts, dpy, config_, &config, error)) { goto out; } @@ -1434,7 +1469,8 @@ yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle goto out; } - backend_sfc = dpy->backend_dpy->create_offscreen_surface(dpy->backend_dpy, + backend_sfc = dpy->backend_dpy->create_offscreen_surface(cur_ts, + dpy->backend_dpy, &config->native, EGL_PIXMAP_BIT, &attribs, @@ -1461,20 +1497,21 @@ yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle backend_sfc = NULL; yagl_egl_display_add_surface(dpy, surface); - yagl_egl_surface_release(surface); + yagl_egl_surface_release(cur_ts, surface); res = surface->res.handle; out: - yagl_egl_config_release(config); + yagl_egl_config_release(cur_ts, config); if (backend_sfc) { - backend_sfc->destroy(backend_sfc); + backend_sfc->destroy(cur_ts, backend_sfc); } return res; } -EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy_, +EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle surface_, uint32_t width, uint32_t height, @@ -1488,14 +1525,15 @@ EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy_, struct yagl_eglb_surface *backend_sfc = NULL; struct yagl_eglb_surface *draw_sfc = NULL; struct yagl_eglb_surface *read_sfc = NULL; + struct yagl_egl_api_ts *egl_api_ts = cur_ts->egl_api_ts; YAGL_LOG_FUNC_SET(eglResizeOffscreenSurfaceYAGL); - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_surface(dpy, surface_, &surface, error)) { + if (!yagl_validate_surface(cur_ts, dpy, surface_, &surface, error)) { goto out; } @@ -1505,7 +1543,8 @@ EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy_, goto out; } - backend_sfc = dpy->backend_dpy->create_offscreen_surface(dpy->backend_dpy, + backend_sfc = dpy->backend_dpy->create_offscreen_surface(cur_ts, + dpy->backend_dpy, &surface->cfg->native, surface->backend_sfc->type, &surface->backend_sfc->attribs, @@ -1535,7 +1574,8 @@ EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy_, } } - if (!egl_api_ts->backend->make_current(egl_api_ts->backend, + if (!egl_api_ts->backend->make_current(cur_ts, + egl_api_ts->backend, dpy->backend_dpy, egl_api_ts->context->backend_ctx, draw_sfc, @@ -1545,7 +1585,7 @@ EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy_, goto out; } - surface->backend_sfc->replace(surface->backend_sfc, backend_sfc); + surface->backend_sfc->replace(cur_ts, surface->backend_sfc, backend_sfc); backend_sfc = NULL; @@ -1553,14 +1593,15 @@ EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy_, out: if (backend_sfc) { - backend_sfc->destroy(backend_sfc); + backend_sfc->destroy(cur_ts, backend_sfc); } - yagl_egl_surface_release(surface); + yagl_egl_surface_release(cur_ts, surface); return res; } -yagl_host_handle yagl_host_eglCreateWindowSurfaceOnscreenYAGL(yagl_host_handle dpy_, +yagl_host_handle yagl_host_eglCreateWindowSurfaceOnscreenYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle config_, yagl_winsys_id win, const EGLint *attrib_list, int32_t attrib_list_count, @@ -1592,11 +1633,11 @@ yagl_host_handle yagl_host_eglCreateWindowSurfaceOnscreenYAGL(yagl_host_handle d } } - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_config(dpy, config_, &config, error)) { + if (!yagl_validate_config(cur_ts, dpy, config_, &config, error)) { goto out; } @@ -1606,7 +1647,8 @@ yagl_host_handle yagl_host_eglCreateWindowSurfaceOnscreenYAGL(yagl_host_handle d goto out; } - backend_sfc = dpy->backend_dpy->create_onscreen_window_surface(dpy->backend_dpy, + backend_sfc = dpy->backend_dpy->create_onscreen_window_surface(cur_ts, + dpy->backend_dpy, &config->native, &attribs, win); @@ -1630,20 +1672,21 @@ yagl_host_handle yagl_host_eglCreateWindowSurfaceOnscreenYAGL(yagl_host_handle d backend_sfc = NULL; yagl_egl_display_add_surface(dpy, surface); - yagl_egl_surface_release(surface); + yagl_egl_surface_release(cur_ts, surface); res = surface->res.handle; out: - yagl_egl_config_release(config); + yagl_egl_config_release(cur_ts, config); if (backend_sfc) { - backend_sfc->destroy(backend_sfc); + backend_sfc->destroy(cur_ts, backend_sfc); } return res; } -yagl_host_handle yagl_host_eglCreatePbufferSurfaceOnscreenYAGL(yagl_host_handle dpy_, +yagl_host_handle yagl_host_eglCreatePbufferSurfaceOnscreenYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle config_, yagl_winsys_id buffer, const EGLint *attrib_list, int32_t attrib_list_count, @@ -1705,11 +1748,11 @@ yagl_host_handle yagl_host_eglCreatePbufferSurfaceOnscreenYAGL(yagl_host_handle } } - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_config(dpy, config_, &config, error)) { + if (!yagl_validate_config(cur_ts, dpy, config_, &config, error)) { goto out; } @@ -1719,7 +1762,8 @@ yagl_host_handle yagl_host_eglCreatePbufferSurfaceOnscreenYAGL(yagl_host_handle goto out; } - backend_sfc = dpy->backend_dpy->create_onscreen_pbuffer_surface(dpy->backend_dpy, + backend_sfc = dpy->backend_dpy->create_onscreen_pbuffer_surface(cur_ts, + dpy->backend_dpy, &config->native, &attribs, buffer); @@ -1742,20 +1786,21 @@ yagl_host_handle yagl_host_eglCreatePbufferSurfaceOnscreenYAGL(yagl_host_handle backend_sfc = NULL; yagl_egl_display_add_surface(dpy, surface); - yagl_egl_surface_release(surface); + yagl_egl_surface_release(cur_ts, surface); res = surface->res.handle; out: - yagl_egl_config_release(config); + yagl_egl_config_release(cur_ts, config); if (backend_sfc) { - backend_sfc->destroy(backend_sfc); + backend_sfc->destroy(cur_ts, backend_sfc); } return res; } -yagl_host_handle yagl_host_eglCreatePixmapSurfaceOnscreenYAGL(yagl_host_handle dpy_, +yagl_host_handle yagl_host_eglCreatePixmapSurfaceOnscreenYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle config_, yagl_winsys_id pixmap, const EGLint *attrib_list, int32_t attrib_list_count, @@ -1777,11 +1822,11 @@ yagl_host_handle yagl_host_eglCreatePixmapSurfaceOnscreenYAGL(yagl_host_handle d goto out; } - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } - if (!yagl_validate_config(dpy, config_, &config, error)) { + if (!yagl_validate_config(cur_ts, dpy, config_, &config, error)) { goto out; } @@ -1791,7 +1836,8 @@ yagl_host_handle yagl_host_eglCreatePixmapSurfaceOnscreenYAGL(yagl_host_handle d goto out; } - backend_sfc = dpy->backend_dpy->create_onscreen_pixmap_surface(dpy->backend_dpy, + backend_sfc = dpy->backend_dpy->create_onscreen_pixmap_surface(cur_ts, + dpy->backend_dpy, &config->native, &attribs, pixmap); @@ -1815,20 +1861,21 @@ yagl_host_handle yagl_host_eglCreatePixmapSurfaceOnscreenYAGL(yagl_host_handle d backend_sfc = NULL; yagl_egl_display_add_surface(dpy, surface); - yagl_egl_surface_release(surface); + yagl_egl_surface_release(cur_ts, surface); res = surface->res.handle; out: - yagl_egl_config_release(config); + yagl_egl_config_release(cur_ts, config); if (backend_sfc) { - backend_sfc->destroy(backend_sfc); + backend_sfc->destroy(cur_ts, backend_sfc); } return res; } -void yagl_host_eglInvalidateOnscreenSurfaceYAGL(yagl_host_handle dpy_, +void yagl_host_eglInvalidateOnscreenSurfaceYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy_, yagl_host_handle surface_, yagl_winsys_id buffer) { @@ -1836,21 +1883,22 @@ void yagl_host_eglInvalidateOnscreenSurfaceYAGL(yagl_host_handle dpy_, struct yagl_egl_display *dpy = NULL; struct yagl_egl_surface *surface = NULL; - if (!yagl_validate_display(dpy_, &dpy, &error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, &error)) { goto out; } - if (!yagl_validate_surface(dpy, surface_, &surface, &error)) { + if (!yagl_validate_surface(cur_ts, dpy, surface_, &surface, &error)) { goto out; } - surface->backend_sfc->invalidate(surface->backend_sfc, buffer); + surface->backend_sfc->invalidate(cur_ts, surface->backend_sfc, buffer); out: - yagl_egl_surface_release(surface); + yagl_egl_surface_release(cur_ts, surface); } -EGLBoolean yagl_host_eglCreateImageYAGL(uint32_t texture, +EGLBoolean yagl_host_eglCreateImageYAGL(struct yagl_thread_state *cur_ts, + uint32_t texture, yagl_host_handle dpy_, yagl_winsys_id buffer, EGLint *error) @@ -1861,11 +1909,11 @@ EGLBoolean yagl_host_eglCreateImageYAGL(uint32_t texture, YAGL_LOG_FUNC_SET(eglCreateImageYAGL); - if (!yagl_validate_display(dpy_, &dpy, error)) { + if (!yagl_validate_display(cur_ts, dpy_, &dpy, error)) { goto out; } - image = dpy->backend_dpy->create_image(dpy->backend_dpy, buffer); + image = dpy->backend_dpy->create_image(cur_ts, dpy->backend_dpy, buffer); if (!image) { YAGL_SET_ERR(EGL_BAD_ALLOC); diff --git a/hw/yagl/yagl_apis/egl/yagl_host_egl_calls.h b/hw/yagl/yagl_apis/egl/yagl_host_egl_calls.h index e110a91263..6012dc3cc3 100644 --- a/hw/yagl/yagl_apis/egl/yagl_host_egl_calls.h +++ b/hw/yagl/yagl_apis/egl/yagl_host_egl_calls.h @@ -33,66 +33,80 @@ #include "yagl_api.h" #include -struct yagl_api_ps *yagl_host_egl_process_init(struct yagl_api *api); +struct yagl_api_ps *yagl_host_egl_process_init(struct yagl_process_state *ps, struct yagl_api *api); -yagl_host_handle yagl_host_eglGetDisplay(uint32_t display_id, +yagl_host_handle yagl_host_eglGetDisplay(struct yagl_thread_state *cur_ts, + uint32_t display_id, EGLint *error); -EGLBoolean yagl_host_eglInitialize(yagl_host_handle dpy, +EGLBoolean yagl_host_eglInitialize(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, EGLint *major, EGLint *minor, EGLint *error); -EGLBoolean yagl_host_eglTerminate(yagl_host_handle dpy, +EGLBoolean yagl_host_eglTerminate(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, EGLint *error); -EGLBoolean yagl_host_eglGetConfigs(yagl_host_handle dpy, +EGLBoolean yagl_host_eglGetConfigs(struct yagl_thread_state *cur_ts, yagl_host_handle dpy, yagl_host_handle *configs, int32_t configs_maxcount, int32_t *configs_count, EGLint *error); -EGLBoolean yagl_host_eglChooseConfig(yagl_host_handle dpy, +EGLBoolean yagl_host_eglChooseConfig(struct yagl_thread_state *cur_ts, yagl_host_handle dpy, const EGLint *attrib_list, int32_t attrib_list_count, yagl_host_handle *configs, int32_t configs_maxcount, int32_t *configs_count, EGLint *error); -EGLBoolean yagl_host_eglGetConfigAttrib(yagl_host_handle dpy, +EGLBoolean yagl_host_eglGetConfigAttrib(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle config, EGLint attribute, EGLint *value, EGLint *error); -EGLBoolean yagl_host_eglDestroySurface(yagl_host_handle dpy, +EGLBoolean yagl_host_eglDestroySurface(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle surface, EGLint *error); -EGLBoolean yagl_host_eglQuerySurface(yagl_host_handle dpy, +EGLBoolean yagl_host_eglQuerySurface(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle surface, EGLint attribute, 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, +void yagl_host_eglBindAPI(struct yagl_thread_state *cur_ts, EGLenum api); +void yagl_host_eglWaitClient(struct yagl_thread_state *cur_ts); +EGLBoolean yagl_host_eglReleaseThread(struct yagl_thread_state *cur_ts, EGLint *error); +EGLBoolean yagl_host_eglSurfaceAttrib(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle surface, EGLint attribute, EGLint value, EGLint *error); -yagl_host_handle yagl_host_eglCreateContext(yagl_host_handle dpy, +yagl_host_handle yagl_host_eglCreateContext(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle config, yagl_host_handle share_context, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error); -EGLBoolean yagl_host_eglDestroyContext(yagl_host_handle dpy, +EGLBoolean yagl_host_eglDestroyContext(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle ctx, EGLint *error); -void yagl_host_eglMakeCurrent(yagl_host_handle dpy, +void yagl_host_eglMakeCurrent(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle draw, yagl_host_handle read, yagl_host_handle ctx); -EGLBoolean yagl_host_eglQueryContext(yagl_host_handle dpy, +EGLBoolean yagl_host_eglQueryContext(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle ctx, EGLint attribute, EGLint *value, EGLint *error); -void yagl_host_eglSwapBuffers(yagl_host_handle dpy, +void yagl_host_eglSwapBuffers(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle surface); -void yagl_host_eglCopyBuffers(yagl_host_handle dpy, +void yagl_host_eglCopyBuffers(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle surface); -yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle dpy, +yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle config, uint32_t width, uint32_t height, @@ -100,7 +114,8 @@ yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle target_ulong pixels, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error); -yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle dpy, +yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle config, uint32_t width, uint32_t height, @@ -108,7 +123,8 @@ yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle target_ulong pixels, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error); -yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle dpy, +yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle config, uint32_t width, uint32_t height, @@ -116,32 +132,38 @@ yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle target_ulong pixels, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error); -EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy, +EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle surface, uint32_t width, uint32_t height, uint32_t bpp, target_ulong pixels, EGLint *error); -yagl_host_handle yagl_host_eglCreateWindowSurfaceOnscreenYAGL(yagl_host_handle dpy, +yagl_host_handle yagl_host_eglCreateWindowSurfaceOnscreenYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle config, yagl_winsys_id win, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error); -yagl_host_handle yagl_host_eglCreatePbufferSurfaceOnscreenYAGL(yagl_host_handle dpy, +yagl_host_handle yagl_host_eglCreatePbufferSurfaceOnscreenYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle config, yagl_winsys_id buffer, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error); -yagl_host_handle yagl_host_eglCreatePixmapSurfaceOnscreenYAGL(yagl_host_handle dpy, +yagl_host_handle yagl_host_eglCreatePixmapSurfaceOnscreenYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle config, yagl_winsys_id pixmap, const EGLint *attrib_list, int32_t attrib_list_count, EGLint *error); -void yagl_host_eglInvalidateOnscreenSurfaceYAGL(yagl_host_handle dpy, +void yagl_host_eglInvalidateOnscreenSurfaceYAGL(struct yagl_thread_state *cur_ts, + yagl_host_handle dpy, yagl_host_handle surface, yagl_winsys_id buffer); -EGLBoolean yagl_host_eglCreateImageYAGL(uint32_t texture, +EGLBoolean yagl_host_eglCreateImageYAGL(struct yagl_thread_state *cur_ts, + uint32_t texture, yagl_host_handle dpy, yagl_winsys_id buffer, EGLint *error); diff --git a/hw/yagl/yagl_apis/gles/yagl_gles_api_ts.c b/hw/yagl/yagl_apis/gles/yagl_gles_api_ts.c index 7285176dd8..23b153b850 100644 --- a/hw/yagl/yagl_apis/gles/yagl_gles_api_ts.c +++ b/hw/yagl/yagl_apis/gles/yagl_gles_api_ts.c @@ -36,7 +36,8 @@ #include "yagl_thread.h" #include "yagl_log.h" -static GLuint yagl_gles_api_ts_create_shader(struct yagl_gles_driver *driver, +static GLuint yagl_gles_api_ts_create_shader(struct yagl_thread_state *cur_ts, + struct yagl_gles_driver *driver, const char *source, GLenum type) { @@ -102,7 +103,8 @@ static GLuint yagl_gles_api_ts_create_shader(struct yagl_gles_driver *driver, * To (partially) work around the problem we must patch * index lookups by UB name. */ -static bool yagl_gles_api_ts_broken_ubo_test(struct yagl_gles_driver *driver) +static bool yagl_gles_api_ts_broken_ubo_test(struct yagl_thread_state *cur_ts, + struct yagl_gles_driver *driver) { static const char *vs_source_es3 = "#version 300 es\n\n" @@ -155,7 +157,7 @@ static bool yagl_gles_api_ts_broken_ubo_test(struct yagl_gles_driver *driver) YAGL_LOG_FUNC_SET(yagl_gles_api_ts_broken_ubo_test); - vs = yagl_gles_api_ts_create_shader(driver, + vs = yagl_gles_api_ts_create_shader(cur_ts, driver, ((driver->gl_version == yagl_gl_3_1_es3) ? vs_source_es3 : vs_source_3_2), GL_VERTEX_SHADER); @@ -163,7 +165,7 @@ static bool yagl_gles_api_ts_broken_ubo_test(struct yagl_gles_driver *driver) goto out1; } - fs = yagl_gles_api_ts_create_shader(driver, + fs = yagl_gles_api_ts_create_shader(cur_ts, driver, ((driver->gl_version == yagl_gl_3_1_es3) ? fs_source_es3 : fs_source_3_2), GL_FRAGMENT_SHADER); @@ -228,7 +230,8 @@ out1: return res; } -void yagl_gles_api_ts_init(struct yagl_gles_api_ts *gles_api_ts, +void yagl_gles_api_ts_init(struct yagl_thread_state *cur_ts, + struct yagl_gles_api_ts *gles_api_ts, struct yagl_gles_driver *driver, struct yagl_gles_api_ps *ps) { @@ -242,7 +245,7 @@ void yagl_gles_api_ts_init(struct yagl_gles_api_ts *gles_api_ts, return; } - yagl_ensure_ctx(0); + yagl_ensure_ctx(cur_ts, 0); if (driver->gl_version > yagl_gl_2) { gles_api_ts->api->use_map_buffer_range = true; @@ -258,22 +261,23 @@ void yagl_gles_api_ts_init(struct yagl_gles_api_ts *gles_api_ts, } if (driver->gl_version >= yagl_gl_3_1_es3) { - gles_api_ts->api->broken_ubo = yagl_gles_api_ts_broken_ubo_test(driver); + gles_api_ts->api->broken_ubo = yagl_gles_api_ts_broken_ubo_test(cur_ts, driver); } else { gles_api_ts->api->broken_ubo = false; } - yagl_unensure_ctx(0); + yagl_unensure_ctx(cur_ts, 0); gles_api_ts->api->checked = true; } -void yagl_gles_api_ts_cleanup(struct yagl_gles_api_ts *gles_api_ts) +void yagl_gles_api_ts_cleanup(struct yagl_thread_state *cur_ts, + struct yagl_gles_api_ts *gles_api_ts) { if (gles_api_ts->num_arrays > 0) { uint32_t i; - yagl_ensure_ctx(0); + yagl_ensure_ctx(cur_ts, 0); if (gles_api_ts->ebo) { gles_api_ts->driver->DeleteBuffers(1, &gles_api_ts->ebo); @@ -284,7 +288,7 @@ void yagl_gles_api_ts_cleanup(struct yagl_gles_api_ts *gles_api_ts) &gles_api_ts->arrays[i].vbo); } - yagl_unensure_ctx(0); + yagl_unensure_ctx(cur_ts, 0); } g_free(gles_api_ts->arrays); diff --git a/hw/yagl/yagl_apis/gles/yagl_gles_api_ts.h b/hw/yagl/yagl_apis/gles/yagl_gles_api_ts.h index 0a881e7c3b..720d536837 100644 --- a/hw/yagl/yagl_apis/gles/yagl_gles_api_ts.h +++ b/hw/yagl/yagl_apis/gles/yagl_gles_api_ts.h @@ -68,10 +68,12 @@ struct yagl_gles_api_ts uint32_t ebo_size; }; -void yagl_gles_api_ts_init(struct yagl_gles_api_ts *gles_api_ts, +void yagl_gles_api_ts_init(struct yagl_thread_state *cur_ts, + 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); +void yagl_gles_api_ts_cleanup(struct yagl_thread_state *cur_ts, + struct yagl_gles_api_ts *gles_api_ts); #endif diff --git a/hw/yagl/yagl_apis/gles/yagl_gles_calls.c b/hw/yagl/yagl_apis/gles/yagl_gles_calls.c index 97dcff6c46..0063c38c4f 100644 --- a/hw/yagl/yagl_apis/gles/yagl_gles_calls.c +++ b/hw/yagl/yagl_apis/gles/yagl_gles_calls.c @@ -42,6 +42,7 @@ */ static void yagl_func_glDrawArrays(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum mode; GLint first; GLsizei count; @@ -49,7 +50,7 @@ static void yagl_func_glDrawArrays(struct yagl_transport *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); + (void)yagl_host_glDrawArrays(cur_ts, mode, first, count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -58,6 +59,7 @@ static void yagl_func_glDrawArrays(struct yagl_transport *t) */ static void yagl_func_glDrawElements(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum mode; GLsizei count; GLenum type; @@ -68,7 +70,7 @@ static void yagl_func_glDrawElements(struct yagl_transport *t) type = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, 1, (const void**)&indices, &indices_count); YAGL_LOG_FUNC_ENTER_SPLIT4(glDrawElements, GLenum, GLsizei, GLenum, void*, mode, count, type, indices); - (void)yagl_host_glDrawElements(mode, count, type, indices, indices_count); + (void)yagl_host_glDrawElements(cur_ts, mode, count, type, indices, indices_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -77,6 +79,7 @@ static void yagl_func_glDrawElements(struct yagl_transport *t) */ static void yagl_func_glReadPixelsData(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLint x; GLint y; GLsizei width; @@ -95,7 +98,7 @@ static void yagl_func_glReadPixelsData(struct yagl_transport *t) yagl_transport_get_in_array(t, 1, (void**)&pixels, &pixels_maxcount, &pixels_count); YAGL_LOG_FUNC_ENTER_SPLIT7(glReadPixelsData, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void*, x, y, width, height, format, type, pixels); *pixels_count = 0; - (void)yagl_host_glReadPixelsData(x, y, width, height, format, type, pixels, pixels_maxcount, pixels_count); + (void)yagl_host_glReadPixelsData(cur_ts, x, y, width, height, format, type, pixels, pixels_maxcount, pixels_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -104,6 +107,7 @@ static void yagl_func_glReadPixelsData(struct yagl_transport *t) */ static void yagl_func_glReadPixelsOffset(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLint x; GLint y; GLsizei width; @@ -119,7 +123,7 @@ static void yagl_func_glReadPixelsOffset(struct yagl_transport *t) type = yagl_transport_get_out_GLenum(t); pixels = yagl_transport_get_out_uintptr_t(t); YAGL_LOG_FUNC_ENTER_SPLIT7(glReadPixelsOffset, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, uintptr_t, x, y, width, height, format, type, pixels); - (void)yagl_host_glReadPixelsOffset(x, y, width, height, format, type, pixels); + (void)yagl_host_glReadPixelsOffset(cur_ts, x, y, width, height, format, type, pixels); YAGL_LOG_FUNC_EXIT(NULL); } @@ -128,6 +132,7 @@ static void yagl_func_glReadPixelsOffset(struct yagl_transport *t) */ static void yagl_func_glDrawArraysInstanced(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum mode; GLint start; GLsizei count; @@ -137,7 +142,7 @@ static void yagl_func_glDrawArraysInstanced(struct yagl_transport *t) count = yagl_transport_get_out_GLsizei(t); primcount = yagl_transport_get_out_GLsizei(t); YAGL_LOG_FUNC_ENTER_SPLIT4(glDrawArraysInstanced, GLenum, GLint, GLsizei, GLsizei, mode, start, count, primcount); - (void)yagl_host_glDrawArraysInstanced(mode, start, count, primcount); + (void)yagl_host_glDrawArraysInstanced(cur_ts, mode, start, count, primcount); YAGL_LOG_FUNC_EXIT(NULL); } @@ -146,6 +151,7 @@ static void yagl_func_glDrawArraysInstanced(struct yagl_transport *t) */ static void yagl_func_glDrawElementsInstanced(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum mode; GLsizei count; GLenum type; @@ -158,7 +164,7 @@ static void yagl_func_glDrawElementsInstanced(struct yagl_transport *t) yagl_transport_get_out_array(t, 1, (const void**)&indices, &indices_count); primcount = yagl_transport_get_out_GLsizei(t); YAGL_LOG_FUNC_ENTER_SPLIT5(glDrawElementsInstanced, GLenum, GLsizei, GLenum, void*, GLsizei, mode, count, type, indices, primcount); - (void)yagl_host_glDrawElementsInstanced(mode, count, type, indices, indices_count, primcount); + (void)yagl_host_glDrawElementsInstanced(cur_ts, mode, count, type, indices, indices_count, primcount); YAGL_LOG_FUNC_EXIT(NULL); } @@ -167,6 +173,7 @@ static void yagl_func_glDrawElementsInstanced(struct yagl_transport *t) */ static void yagl_func_glDrawRangeElements(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum mode; GLuint start; GLuint end; @@ -181,7 +188,7 @@ static void yagl_func_glDrawRangeElements(struct yagl_transport *t) type = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, 1, (const void**)&indices, &indices_count); YAGL_LOG_FUNC_ENTER_SPLIT6(glDrawRangeElements, GLenum, GLuint, GLuint, GLsizei, GLenum, void*, mode, start, end, count, type, indices); - (void)yagl_host_glDrawRangeElements(mode, start, end, count, type, indices, indices_count); + (void)yagl_host_glDrawRangeElements(cur_ts, mode, start, end, count, type, indices, indices_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -190,11 +197,12 @@ static void yagl_func_glDrawRangeElements(struct yagl_transport *t) */ static void yagl_func_glGenVertexArrays(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; const GLuint *arrays; int32_t arrays_count; yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&arrays, &arrays_count); YAGL_LOG_FUNC_ENTER_SPLIT1(glGenVertexArrays, void*, arrays); - (void)yagl_host_glGenVertexArrays(arrays, arrays_count); + (void)yagl_host_glGenVertexArrays(cur_ts, arrays, arrays_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -203,10 +211,11 @@ static void yagl_func_glGenVertexArrays(struct yagl_transport *t) */ static void yagl_func_glBindVertexArray(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint array; array = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glBindVertexArray, GLuint, array); - (void)yagl_host_glBindVertexArray(array); + (void)yagl_host_glBindVertexArray(cur_ts, array); YAGL_LOG_FUNC_EXIT(NULL); } @@ -215,10 +224,11 @@ static void yagl_func_glBindVertexArray(struct yagl_transport *t) */ static void yagl_func_glDisableVertexAttribArray(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint index; index = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glDisableVertexAttribArray, GLuint, index); - (void)yagl_host_glDisableVertexAttribArray(index); + (void)yagl_host_glDisableVertexAttribArray(cur_ts, index); YAGL_LOG_FUNC_EXIT(NULL); } @@ -227,10 +237,11 @@ static void yagl_func_glDisableVertexAttribArray(struct yagl_transport *t) */ static void yagl_func_glEnableVertexAttribArray(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint index; index = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glEnableVertexAttribArray, GLuint, index); - (void)yagl_host_glEnableVertexAttribArray(index); + (void)yagl_host_glEnableVertexAttribArray(cur_ts, index); YAGL_LOG_FUNC_EXIT(NULL); } @@ -239,6 +250,7 @@ static void yagl_func_glEnableVertexAttribArray(struct yagl_transport *t) */ static void yagl_func_glVertexAttribPointerData(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint indx; GLint size; GLenum type; @@ -255,7 +267,7 @@ static void yagl_func_glVertexAttribPointerData(struct yagl_transport *t) first = yagl_transport_get_out_GLint(t); yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count); YAGL_LOG_FUNC_ENTER_SPLIT7(glVertexAttribPointerData, GLuint, GLint, GLenum, GLboolean, GLsizei, GLint, void*, indx, size, type, normalized, stride, first, data); - (void)yagl_host_glVertexAttribPointerData(indx, size, type, normalized, stride, first, data, data_count); + (void)yagl_host_glVertexAttribPointerData(cur_ts, indx, size, type, normalized, stride, first, data, data_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -264,6 +276,7 @@ static void yagl_func_glVertexAttribPointerData(struct yagl_transport *t) */ static void yagl_func_glVertexAttribPointerOffset(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint indx; GLint size; GLenum type; @@ -277,7 +290,7 @@ static void yagl_func_glVertexAttribPointerOffset(struct yagl_transport *t) stride = yagl_transport_get_out_GLsizei(t); offset = yagl_transport_get_out_uintptr_t(t); YAGL_LOG_FUNC_ENTER_SPLIT6(glVertexAttribPointerOffset, GLuint, GLint, GLenum, GLboolean, GLsizei, uintptr_t, indx, size, type, normalized, stride, offset); - (void)yagl_host_glVertexAttribPointerOffset(indx, size, type, normalized, stride, offset); + (void)yagl_host_glVertexAttribPointerOffset(cur_ts, indx, size, type, normalized, stride, offset); YAGL_LOG_FUNC_EXIT(NULL); } @@ -286,6 +299,7 @@ static void yagl_func_glVertexAttribPointerOffset(struct yagl_transport *t) */ static void yagl_func_glVertexPointerData(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLint size; GLenum type; GLsizei stride; @@ -298,7 +312,7 @@ static void yagl_func_glVertexPointerData(struct yagl_transport *t) first = yagl_transport_get_out_GLint(t); yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count); YAGL_LOG_FUNC_ENTER_SPLIT5(glVertexPointerData, GLint, GLenum, GLsizei, GLint, void*, size, type, stride, first, data); - (void)yagl_host_glVertexPointerData(size, type, stride, first, data, data_count); + (void)yagl_host_glVertexPointerData(cur_ts, size, type, stride, first, data, data_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -307,6 +321,7 @@ static void yagl_func_glVertexPointerData(struct yagl_transport *t) */ static void yagl_func_glVertexPointerOffset(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLint size; GLenum type; GLsizei stride; @@ -316,7 +331,7 @@ static void yagl_func_glVertexPointerOffset(struct yagl_transport *t) stride = yagl_transport_get_out_GLsizei(t); offset = yagl_transport_get_out_uintptr_t(t); YAGL_LOG_FUNC_ENTER_SPLIT4(glVertexPointerOffset, GLint, GLenum, GLsizei, uintptr_t, size, type, stride, offset); - (void)yagl_host_glVertexPointerOffset(size, type, stride, offset); + (void)yagl_host_glVertexPointerOffset(cur_ts, size, type, stride, offset); YAGL_LOG_FUNC_EXIT(NULL); } @@ -325,6 +340,7 @@ static void yagl_func_glVertexPointerOffset(struct yagl_transport *t) */ static void yagl_func_glNormalPointerData(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum type; GLsizei stride; GLint first; @@ -335,7 +351,7 @@ static void yagl_func_glNormalPointerData(struct yagl_transport *t) first = yagl_transport_get_out_GLint(t); yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count); YAGL_LOG_FUNC_ENTER_SPLIT4(glNormalPointerData, GLenum, GLsizei, GLint, void*, type, stride, first, data); - (void)yagl_host_glNormalPointerData(type, stride, first, data, data_count); + (void)yagl_host_glNormalPointerData(cur_ts, type, stride, first, data, data_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -344,6 +360,7 @@ static void yagl_func_glNormalPointerData(struct yagl_transport *t) */ static void yagl_func_glNormalPointerOffset(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum type; GLsizei stride; uintptr_t offset; @@ -351,7 +368,7 @@ static void yagl_func_glNormalPointerOffset(struct yagl_transport *t) stride = yagl_transport_get_out_GLsizei(t); offset = yagl_transport_get_out_uintptr_t(t); YAGL_LOG_FUNC_ENTER_SPLIT3(glNormalPointerOffset, GLenum, GLsizei, uintptr_t, type, stride, offset); - (void)yagl_host_glNormalPointerOffset(type, stride, offset); + (void)yagl_host_glNormalPointerOffset(cur_ts, type, stride, offset); YAGL_LOG_FUNC_EXIT(NULL); } @@ -360,6 +377,7 @@ static void yagl_func_glNormalPointerOffset(struct yagl_transport *t) */ static void yagl_func_glColorPointerData(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLint size; GLenum type; GLsizei stride; @@ -372,7 +390,7 @@ static void yagl_func_glColorPointerData(struct yagl_transport *t) first = yagl_transport_get_out_GLint(t); yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count); YAGL_LOG_FUNC_ENTER_SPLIT5(glColorPointerData, GLint, GLenum, GLsizei, GLint, void*, size, type, stride, first, data); - (void)yagl_host_glColorPointerData(size, type, stride, first, data, data_count); + (void)yagl_host_glColorPointerData(cur_ts, size, type, stride, first, data, data_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -381,6 +399,7 @@ static void yagl_func_glColorPointerData(struct yagl_transport *t) */ static void yagl_func_glColorPointerOffset(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLint size; GLenum type; GLsizei stride; @@ -390,7 +409,7 @@ static void yagl_func_glColorPointerOffset(struct yagl_transport *t) stride = yagl_transport_get_out_GLsizei(t); offset = yagl_transport_get_out_uintptr_t(t); YAGL_LOG_FUNC_ENTER_SPLIT4(glColorPointerOffset, GLint, GLenum, GLsizei, uintptr_t, size, type, stride, offset); - (void)yagl_host_glColorPointerOffset(size, type, stride, offset); + (void)yagl_host_glColorPointerOffset(cur_ts, size, type, stride, offset); YAGL_LOG_FUNC_EXIT(NULL); } @@ -399,6 +418,7 @@ static void yagl_func_glColorPointerOffset(struct yagl_transport *t) */ static void yagl_func_glTexCoordPointerData(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLint tex_id; GLint size; GLenum type; @@ -413,7 +433,7 @@ static void yagl_func_glTexCoordPointerData(struct yagl_transport *t) first = yagl_transport_get_out_GLint(t); yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count); YAGL_LOG_FUNC_ENTER_SPLIT6(glTexCoordPointerData, GLint, GLint, GLenum, GLsizei, GLint, void*, tex_id, size, type, stride, first, data); - (void)yagl_host_glTexCoordPointerData(tex_id, size, type, stride, first, data, data_count); + (void)yagl_host_glTexCoordPointerData(cur_ts, tex_id, size, type, stride, first, data, data_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -422,6 +442,7 @@ static void yagl_func_glTexCoordPointerData(struct yagl_transport *t) */ static void yagl_func_glTexCoordPointerOffset(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLint size; GLenum type; GLsizei stride; @@ -431,7 +452,7 @@ static void yagl_func_glTexCoordPointerOffset(struct yagl_transport *t) stride = yagl_transport_get_out_GLsizei(t); offset = yagl_transport_get_out_uintptr_t(t); YAGL_LOG_FUNC_ENTER_SPLIT4(glTexCoordPointerOffset, GLint, GLenum, GLsizei, uintptr_t, size, type, stride, offset); - (void)yagl_host_glTexCoordPointerOffset(size, type, stride, offset); + (void)yagl_host_glTexCoordPointerOffset(cur_ts, size, type, stride, offset); YAGL_LOG_FUNC_EXIT(NULL); } @@ -440,10 +461,11 @@ static void yagl_func_glTexCoordPointerOffset(struct yagl_transport *t) */ static void yagl_func_glDisableClientState(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum array; array = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glDisableClientState, GLenum, array); - (void)yagl_host_glDisableClientState(array); + (void)yagl_host_glDisableClientState(cur_ts, array); YAGL_LOG_FUNC_EXIT(NULL); } @@ -452,10 +474,11 @@ static void yagl_func_glDisableClientState(struct yagl_transport *t) */ static void yagl_func_glEnableClientState(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum array; array = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glEnableClientState, GLenum, array); - (void)yagl_host_glEnableClientState(array); + (void)yagl_host_glEnableClientState(cur_ts, array); YAGL_LOG_FUNC_EXIT(NULL); } @@ -464,12 +487,13 @@ static void yagl_func_glEnableClientState(struct yagl_transport *t) */ static void yagl_func_glVertexAttribDivisor(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint index; GLuint divisor; index = yagl_transport_get_out_GLuint(t); divisor = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttribDivisor, GLuint, GLuint, index, divisor); - (void)yagl_host_glVertexAttribDivisor(index, divisor); + (void)yagl_host_glVertexAttribDivisor(cur_ts, index, divisor); YAGL_LOG_FUNC_EXIT(NULL); } @@ -478,6 +502,7 @@ static void yagl_func_glVertexAttribDivisor(struct yagl_transport *t) */ static void yagl_func_glVertexAttribIPointerData(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint index; GLint size; GLenum type; @@ -492,7 +517,7 @@ static void yagl_func_glVertexAttribIPointerData(struct yagl_transport *t) first = yagl_transport_get_out_GLint(t); yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count); YAGL_LOG_FUNC_ENTER_SPLIT6(glVertexAttribIPointerData, GLuint, GLint, GLenum, GLsizei, GLint, void*, index, size, type, stride, first, data); - (void)yagl_host_glVertexAttribIPointerData(index, size, type, stride, first, data, data_count); + (void)yagl_host_glVertexAttribIPointerData(cur_ts, index, size, type, stride, first, data, data_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -501,6 +526,7 @@ static void yagl_func_glVertexAttribIPointerData(struct yagl_transport *t) */ static void yagl_func_glVertexAttribIPointerOffset(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint index; GLint size; GLenum type; @@ -512,7 +538,7 @@ static void yagl_func_glVertexAttribIPointerOffset(struct yagl_transport *t) stride = yagl_transport_get_out_GLsizei(t); offset = yagl_transport_get_out_uintptr_t(t); YAGL_LOG_FUNC_ENTER_SPLIT5(glVertexAttribIPointerOffset, GLuint, GLint, GLenum, GLsizei, uintptr_t, index, size, type, stride, offset); - (void)yagl_host_glVertexAttribIPointerOffset(index, size, type, stride, offset); + (void)yagl_host_glVertexAttribIPointerOffset(cur_ts, index, size, type, stride, offset); YAGL_LOG_FUNC_EXIT(NULL); } @@ -521,11 +547,12 @@ static void yagl_func_glVertexAttribIPointerOffset(struct yagl_transport *t) */ static void yagl_func_glGenBuffers(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; const GLuint *buffers; int32_t buffers_count; yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&buffers, &buffers_count); YAGL_LOG_FUNC_ENTER_SPLIT1(glGenBuffers, void*, buffers); - (void)yagl_host_glGenBuffers(buffers, buffers_count); + (void)yagl_host_glGenBuffers(cur_ts, buffers, buffers_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -534,12 +561,13 @@ static void yagl_func_glGenBuffers(struct yagl_transport *t) */ static void yagl_func_glBindBuffer(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glBindBuffer(cur_ts, target, buffer); YAGL_LOG_FUNC_EXIT(NULL); } @@ -548,6 +576,7 @@ static void yagl_func_glBindBuffer(struct yagl_transport *t) */ static void yagl_func_glBufferData(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; const GLvoid *data; int32_t data_count; @@ -556,7 +585,7 @@ static void yagl_func_glBufferData(struct yagl_transport *t) yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count); usage = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT3(glBufferData, GLenum, void*, GLenum, target, data, usage); - (void)yagl_host_glBufferData(target, data, data_count, usage); + (void)yagl_host_glBufferData(cur_ts, target, data, data_count, usage); YAGL_LOG_FUNC_EXIT(NULL); } @@ -565,6 +594,7 @@ static void yagl_func_glBufferData(struct yagl_transport *t) */ static void yagl_func_glBufferSubData(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLsizei offset; const GLvoid *data; @@ -573,7 +603,7 @@ static void yagl_func_glBufferSubData(struct yagl_transport *t) offset = yagl_transport_get_out_GLsizei(t); yagl_transport_get_out_array(t, 1, (const void**)&data, &data_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glBufferSubData, GLenum, GLsizei, void*, target, offset, data); - (void)yagl_host_glBufferSubData(target, offset, data, data_count); + (void)yagl_host_glBufferSubData(cur_ts, target, offset, data, data_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -582,6 +612,7 @@ static void yagl_func_glBufferSubData(struct yagl_transport *t) */ static void yagl_func_glBindBufferBase(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLuint index; GLuint buffer; @@ -589,7 +620,7 @@ static void yagl_func_glBindBufferBase(struct yagl_transport *t) index = yagl_transport_get_out_GLuint(t); buffer = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT3(glBindBufferBase, GLenum, GLuint, GLuint, target, index, buffer); - (void)yagl_host_glBindBufferBase(target, index, buffer); + (void)yagl_host_glBindBufferBase(cur_ts, target, index, buffer); YAGL_LOG_FUNC_EXIT(NULL); } @@ -598,6 +629,7 @@ static void yagl_func_glBindBufferBase(struct yagl_transport *t) */ static void yagl_func_glBindBufferRange(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLuint index; GLuint buffer; @@ -609,7 +641,7 @@ static void yagl_func_glBindBufferRange(struct yagl_transport *t) offset = yagl_transport_get_out_GLint(t); size = yagl_transport_get_out_GLsizei(t); YAGL_LOG_FUNC_ENTER_SPLIT5(glBindBufferRange, GLenum, GLuint, GLuint, GLint, GLsizei, target, index, buffer, offset, size); - (void)yagl_host_glBindBufferRange(target, index, buffer, offset, size); + (void)yagl_host_glBindBufferRange(cur_ts, target, index, buffer, offset, size); YAGL_LOG_FUNC_EXIT(NULL); } @@ -618,6 +650,7 @@ static void yagl_func_glBindBufferRange(struct yagl_transport *t) */ static void yagl_func_glMapBuffer(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint buffer; const GLuint *ranges; int32_t ranges_count; @@ -629,7 +662,7 @@ static void yagl_func_glMapBuffer(struct yagl_transport *t) yagl_transport_get_in_array(t, 1, (void**)&data, &data_maxcount, &data_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glMapBuffer, GLuint, void*, void*, buffer, ranges, data); *data_count = 0; - (void)yagl_host_glMapBuffer(buffer, ranges, ranges_count, data, data_maxcount, data_count); + (void)yagl_host_glMapBuffer(cur_ts, buffer, ranges, ranges_count, data, data_maxcount, data_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -638,6 +671,7 @@ static void yagl_func_glMapBuffer(struct yagl_transport *t) */ static void yagl_func_glCopyBufferSubData(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum readTarget; GLenum writeTarget; GLintptr readOffset; @@ -649,7 +683,7 @@ static void yagl_func_glCopyBufferSubData(struct yagl_transport *t) writeOffset = yagl_transport_get_out_GLintptr(t); size = yagl_transport_get_out_GLsizei(t); YAGL_LOG_FUNC_ENTER_SPLIT5(glCopyBufferSubData, GLenum, GLenum, GLintptr, GLintptr, GLsizei, readTarget, writeTarget, readOffset, writeOffset, size); - (void)yagl_host_glCopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size); + (void)yagl_host_glCopyBufferSubData(cur_ts, readTarget, writeTarget, readOffset, writeOffset, size); YAGL_LOG_FUNC_EXIT(NULL); } @@ -658,11 +692,12 @@ static void yagl_func_glCopyBufferSubData(struct yagl_transport *t) */ static void yagl_func_glGenTextures(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; const GLuint *textures; int32_t textures_count; yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&textures, &textures_count); YAGL_LOG_FUNC_ENTER_SPLIT1(glGenTextures, void*, textures); - (void)yagl_host_glGenTextures(textures, textures_count); + (void)yagl_host_glGenTextures(cur_ts, textures, textures_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -671,12 +706,13 @@ static void yagl_func_glGenTextures(struct yagl_transport *t) */ static void yagl_func_glBindTexture(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glBindTexture(cur_ts, target, texture); YAGL_LOG_FUNC_EXIT(NULL); } @@ -685,10 +721,11 @@ static void yagl_func_glBindTexture(struct yagl_transport *t) */ static void yagl_func_glActiveTexture(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum texture; texture = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glActiveTexture, GLenum, texture); - (void)yagl_host_glActiveTexture(texture); + (void)yagl_host_glActiveTexture(cur_ts, texture); YAGL_LOG_FUNC_EXIT(NULL); } @@ -697,6 +734,7 @@ static void yagl_func_glActiveTexture(struct yagl_transport *t) */ static void yagl_func_glCopyTexImage2D(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLint level; GLenum internalformat; @@ -714,7 +752,7 @@ static void yagl_func_glCopyTexImage2D(struct yagl_transport *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); + (void)yagl_host_glCopyTexImage2D(cur_ts, target, level, internalformat, x, y, width, height, border); YAGL_LOG_FUNC_EXIT(NULL); } @@ -723,6 +761,7 @@ static void yagl_func_glCopyTexImage2D(struct yagl_transport *t) */ static void yagl_func_glCopyTexSubImage2D(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLint level; GLint xoffset; @@ -740,7 +779,7 @@ static void yagl_func_glCopyTexSubImage2D(struct yagl_transport *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); + (void)yagl_host_glCopyTexSubImage2D(cur_ts, target, level, xoffset, yoffset, x, y, width, height); YAGL_LOG_FUNC_EXIT(NULL); } @@ -749,6 +788,7 @@ static void yagl_func_glCopyTexSubImage2D(struct yagl_transport *t) */ static void yagl_func_glGetTexParameterfv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum pname; GLfloat *param; @@ -756,7 +796,7 @@ static void yagl_func_glGetTexParameterfv(struct yagl_transport *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); + (void)yagl_host_glGetTexParameterfv(cur_ts, target, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -765,6 +805,7 @@ static void yagl_func_glGetTexParameterfv(struct yagl_transport *t) */ static void yagl_func_glGetTexParameteriv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum pname; GLint *param; @@ -772,7 +813,7 @@ static void yagl_func_glGetTexParameteriv(struct yagl_transport *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); + (void)yagl_host_glGetTexParameteriv(cur_ts, target, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -781,6 +822,7 @@ static void yagl_func_glGetTexParameteriv(struct yagl_transport *t) */ static void yagl_func_glTexImage2DData(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLint level; GLint internalformat; @@ -801,7 +843,7 @@ static void yagl_func_glTexImage2DData(struct yagl_transport *t) type = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count); YAGL_LOG_FUNC_ENTER_SPLIT9(glTexImage2DData, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, void*, target, level, internalformat, width, height, border, format, type, pixels); - (void)yagl_host_glTexImage2DData(target, level, internalformat, width, height, border, format, type, pixels, pixels_count); + (void)yagl_host_glTexImage2DData(cur_ts, target, level, internalformat, width, height, border, format, type, pixels, pixels_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -810,6 +852,7 @@ static void yagl_func_glTexImage2DData(struct yagl_transport *t) */ static void yagl_func_glTexImage2DOffset(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLint level; GLint internalformat; @@ -829,7 +872,7 @@ static void yagl_func_glTexImage2DOffset(struct yagl_transport *t) type = yagl_transport_get_out_GLenum(t); pixels = yagl_transport_get_out_uintptr_t(t); YAGL_LOG_FUNC_ENTER_SPLIT9(glTexImage2DOffset, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, uintptr_t, target, level, internalformat, width, height, border, format, type, pixels); - (void)yagl_host_glTexImage2DOffset(target, level, internalformat, width, height, border, format, type, pixels); + (void)yagl_host_glTexImage2DOffset(cur_ts, target, level, internalformat, width, height, border, format, type, pixels); YAGL_LOG_FUNC_EXIT(NULL); } @@ -838,6 +881,7 @@ static void yagl_func_glTexImage2DOffset(struct yagl_transport *t) */ static void yagl_func_glTexParameterf(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum pname; GLfloat param; @@ -845,7 +889,7 @@ static void yagl_func_glTexParameterf(struct yagl_transport *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); + (void)yagl_host_glTexParameterf(cur_ts, target, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -854,6 +898,7 @@ static void yagl_func_glTexParameterf(struct yagl_transport *t) */ static void yagl_func_glTexParameterfv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum pname; const GLfloat *params; @@ -862,7 +907,7 @@ static void yagl_func_glTexParameterfv(struct yagl_transport *t) pname = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameterfv, GLenum, GLenum, void*, target, pname, params); - (void)yagl_host_glTexParameterfv(target, pname, params, params_count); + (void)yagl_host_glTexParameterfv(cur_ts, target, pname, params, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -871,6 +916,7 @@ static void yagl_func_glTexParameterfv(struct yagl_transport *t) */ static void yagl_func_glTexParameteri(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum pname; GLint param; @@ -878,7 +924,7 @@ static void yagl_func_glTexParameteri(struct yagl_transport *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); + (void)yagl_host_glTexParameteri(cur_ts, target, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -887,6 +933,7 @@ static void yagl_func_glTexParameteri(struct yagl_transport *t) */ static void yagl_func_glTexParameteriv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum pname; const GLint *params; @@ -895,7 +942,7 @@ static void yagl_func_glTexParameteriv(struct yagl_transport *t) pname = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, sizeof(GLint), (const void**)¶ms, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameteriv, GLenum, GLenum, void*, target, pname, params); - (void)yagl_host_glTexParameteriv(target, pname, params, params_count); + (void)yagl_host_glTexParameteriv(cur_ts, target, pname, params, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -904,6 +951,7 @@ static void yagl_func_glTexParameteriv(struct yagl_transport *t) */ static void yagl_func_glTexSubImage2DData(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLint level; GLint xoffset; @@ -924,7 +972,7 @@ static void yagl_func_glTexSubImage2DData(struct yagl_transport *t) type = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count); YAGL_LOG_FUNC_ENTER_SPLIT9(glTexSubImage2DData, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, void*, target, level, xoffset, yoffset, width, height, format, type, pixels); - (void)yagl_host_glTexSubImage2DData(target, level, xoffset, yoffset, width, height, format, type, pixels, pixels_count); + (void)yagl_host_glTexSubImage2DData(cur_ts, target, level, xoffset, yoffset, width, height, format, type, pixels, pixels_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -933,6 +981,7 @@ static void yagl_func_glTexSubImage2DData(struct yagl_transport *t) */ static void yagl_func_glTexSubImage2DOffset(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLint level; GLint xoffset; @@ -952,7 +1001,7 @@ static void yagl_func_glTexSubImage2DOffset(struct yagl_transport *t) type = yagl_transport_get_out_GLenum(t); pixels = yagl_transport_get_out_uintptr_t(t); YAGL_LOG_FUNC_ENTER_SPLIT9(glTexSubImage2DOffset, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, uintptr_t, target, level, xoffset, yoffset, width, height, format, type, pixels); - (void)yagl_host_glTexSubImage2DOffset(target, level, xoffset, yoffset, width, height, format, type, pixels); + (void)yagl_host_glTexSubImage2DOffset(cur_ts, target, level, xoffset, yoffset, width, height, format, type, pixels); YAGL_LOG_FUNC_EXIT(NULL); } @@ -961,10 +1010,11 @@ static void yagl_func_glTexSubImage2DOffset(struct yagl_transport *t) */ static void yagl_func_glClientActiveTexture(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum texture; texture = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glClientActiveTexture, GLenum, texture); - (void)yagl_host_glClientActiveTexture(texture); + (void)yagl_host_glClientActiveTexture(cur_ts, texture); YAGL_LOG_FUNC_EXIT(NULL); } @@ -973,6 +1023,7 @@ static void yagl_func_glClientActiveTexture(struct yagl_transport *t) */ static void yagl_func_glTexEnvi(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum pname; GLint param; @@ -980,7 +1031,7 @@ static void yagl_func_glTexEnvi(struct yagl_transport *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); + (void)yagl_host_glTexEnvi(cur_ts, target, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -989,6 +1040,7 @@ static void yagl_func_glTexEnvi(struct yagl_transport *t) */ static void yagl_func_glTexEnvf(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum pname; GLfloat param; @@ -996,7 +1048,7 @@ static void yagl_func_glTexEnvf(struct yagl_transport *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); + (void)yagl_host_glTexEnvf(cur_ts, target, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1005,6 +1057,7 @@ static void yagl_func_glTexEnvf(struct yagl_transport *t) */ static void yagl_func_glMultiTexCoord4f(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLfloat s; GLfloat tt; @@ -1016,7 +1069,7 @@ static void yagl_func_glMultiTexCoord4f(struct yagl_transport *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); + (void)yagl_host_glMultiTexCoord4f(cur_ts, target, s, tt, r, q); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1025,6 +1078,7 @@ static void yagl_func_glMultiTexCoord4f(struct yagl_transport *t) */ static void yagl_func_glTexEnviv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum pname; const GLint *params; @@ -1033,7 +1087,7 @@ static void yagl_func_glTexEnviv(struct yagl_transport *t) pname = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, sizeof(GLint), (const void**)¶ms, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnviv, GLenum, GLenum, void*, target, pname, params); - (void)yagl_host_glTexEnviv(target, pname, params, params_count); + (void)yagl_host_glTexEnviv(cur_ts, target, pname, params, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1042,6 +1096,7 @@ static void yagl_func_glTexEnviv(struct yagl_transport *t) */ static void yagl_func_glTexEnvfv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum pname; const GLfloat *params; @@ -1050,7 +1105,7 @@ static void yagl_func_glTexEnvfv(struct yagl_transport *t) pname = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnvfv, GLenum, GLenum, void*, target, pname, params); - (void)yagl_host_glTexEnvfv(target, pname, params, params_count); + (void)yagl_host_glTexEnvfv(cur_ts, target, pname, params, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1059,6 +1114,7 @@ static void yagl_func_glTexEnvfv(struct yagl_transport *t) */ static void yagl_func_glGetTexEnviv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum env; GLenum pname; GLint *params; @@ -1069,7 +1125,7 @@ static void yagl_func_glGetTexEnviv(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexEnviv, GLenum, GLenum, void*, env, pname, params); *params_count = 0; - (void)yagl_host_glGetTexEnviv(env, pname, params, params_maxcount, params_count); + (void)yagl_host_glGetTexEnviv(cur_ts, env, pname, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1078,6 +1134,7 @@ static void yagl_func_glGetTexEnviv(struct yagl_transport *t) */ static void yagl_func_glGetTexEnvfv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum env; GLenum pname; GLfloat *params; @@ -1088,7 +1145,7 @@ static void yagl_func_glGetTexEnvfv(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexEnvfv, GLenum, GLenum, void*, env, pname, params); *params_count = 0; - (void)yagl_host_glGetTexEnvfv(env, pname, params, params_maxcount, params_count); + (void)yagl_host_glGetTexEnvfv(cur_ts, env, pname, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1097,6 +1154,7 @@ static void yagl_func_glGetTexEnvfv(struct yagl_transport *t) */ static void yagl_func_glTexImage3DData(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLint level; GLint internalformat; @@ -1119,7 +1177,7 @@ static void yagl_func_glTexImage3DData(struct yagl_transport *t) type = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count); YAGL_LOG_FUNC_ENTER_SPLIT10(glTexImage3DData, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, void*, target, level, internalformat, width, height, depth, border, format, type, pixels); - (void)yagl_host_glTexImage3DData(target, level, internalformat, width, height, depth, border, format, type, pixels, pixels_count); + (void)yagl_host_glTexImage3DData(cur_ts, target, level, internalformat, width, height, depth, border, format, type, pixels, pixels_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1128,6 +1186,7 @@ static void yagl_func_glTexImage3DData(struct yagl_transport *t) */ static void yagl_func_glTexImage3DOffset(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLint level; GLint internalformat; @@ -1149,7 +1208,7 @@ static void yagl_func_glTexImage3DOffset(struct yagl_transport *t) type = yagl_transport_get_out_GLenum(t); pixels = yagl_transport_get_out_uintptr_t(t); YAGL_LOG_FUNC_ENTER_SPLIT10(glTexImage3DOffset, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, uintptr_t, target, level, internalformat, width, height, depth, border, format, type, pixels); - (void)yagl_host_glTexImage3DOffset(target, level, internalformat, width, height, depth, border, format, type, pixels); + (void)yagl_host_glTexImage3DOffset(cur_ts, target, level, internalformat, width, height, depth, border, format, type, pixels); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1158,6 +1217,7 @@ static void yagl_func_glTexImage3DOffset(struct yagl_transport *t) */ static void yagl_func_glTexSubImage3DData(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLint level; GLint xoffset; @@ -1182,7 +1242,7 @@ static void yagl_func_glTexSubImage3DData(struct yagl_transport *t) type = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count); YAGL_LOG_FUNC_ENTER_SPLIT11(glTexSubImage3DData, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, void*, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); - (void)yagl_host_glTexSubImage3DData(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, pixels_count); + (void)yagl_host_glTexSubImage3DData(cur_ts, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels, pixels_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1191,6 +1251,7 @@ static void yagl_func_glTexSubImage3DData(struct yagl_transport *t) */ static void yagl_func_glTexSubImage3DOffset(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLint level; GLint xoffset; @@ -1214,7 +1275,7 @@ static void yagl_func_glTexSubImage3DOffset(struct yagl_transport *t) type = yagl_transport_get_out_GLenum(t); pixels = yagl_transport_get_out_uintptr_t(t); YAGL_LOG_FUNC_ENTER_SPLIT11(glTexSubImage3DOffset, GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, uintptr_t, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); - (void)yagl_host_glTexSubImage3DOffset(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); + (void)yagl_host_glTexSubImage3DOffset(cur_ts, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1223,6 +1284,7 @@ static void yagl_func_glTexSubImage3DOffset(struct yagl_transport *t) */ static void yagl_func_glCopyTexSubImage3D(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLint level; GLint xoffset; @@ -1242,7 +1304,7 @@ static void yagl_func_glCopyTexSubImage3D(struct yagl_transport *t) width = yagl_transport_get_out_GLsizei(t); height = yagl_transport_get_out_GLsizei(t); YAGL_LOG_FUNC_ENTER_SPLIT9(glCopyTexSubImage3D, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, target, level, xoffset, yoffset, zoffset, x, y, width, height); - (void)yagl_host_glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height); + (void)yagl_host_glCopyTexSubImage3D(cur_ts, target, level, xoffset, yoffset, zoffset, x, y, width, height); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1251,11 +1313,12 @@ static void yagl_func_glCopyTexSubImage3D(struct yagl_transport *t) */ static void yagl_func_glGenFramebuffers(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; const GLuint *framebuffers; int32_t framebuffers_count; yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&framebuffers, &framebuffers_count); YAGL_LOG_FUNC_ENTER_SPLIT1(glGenFramebuffers, void*, framebuffers); - (void)yagl_host_glGenFramebuffers(framebuffers, framebuffers_count); + (void)yagl_host_glGenFramebuffers(cur_ts, framebuffers, framebuffers_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1264,12 +1327,13 @@ static void yagl_func_glGenFramebuffers(struct yagl_transport *t) */ static void yagl_func_glBindFramebuffer(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glBindFramebuffer(cur_ts, target, framebuffer); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1278,6 +1342,7 @@ static void yagl_func_glBindFramebuffer(struct yagl_transport *t) */ static void yagl_func_glFramebufferTexture2D(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum attachment; GLenum textarget; @@ -1289,7 +1354,7 @@ static void yagl_func_glFramebufferTexture2D(struct yagl_transport *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); + (void)yagl_host_glFramebufferTexture2D(cur_ts, target, attachment, textarget, texture, level); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1298,6 +1363,7 @@ static void yagl_func_glFramebufferTexture2D(struct yagl_transport *t) */ static void yagl_func_glFramebufferRenderbuffer(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum attachment; GLenum renderbuffertarget; @@ -1307,7 +1373,7 @@ static void yagl_func_glFramebufferRenderbuffer(struct yagl_transport *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); + (void)yagl_host_glFramebufferRenderbuffer(cur_ts, target, attachment, renderbuffertarget, renderbuffer); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1316,6 +1382,7 @@ static void yagl_func_glFramebufferRenderbuffer(struct yagl_transport *t) */ static void yagl_func_glBlitFramebuffer(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLint srcX0; GLint srcY0; GLint srcX1; @@ -1337,7 +1404,7 @@ static void yagl_func_glBlitFramebuffer(struct yagl_transport *t) mask = yagl_transport_get_out_GLbitfield(t); filter = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT10(glBlitFramebuffer, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); - (void)yagl_host_glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); + (void)yagl_host_glBlitFramebuffer(cur_ts, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1346,11 +1413,12 @@ static void yagl_func_glBlitFramebuffer(struct yagl_transport *t) */ static void yagl_func_glDrawBuffers(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; const GLenum *bufs; int32_t bufs_count; yagl_transport_get_out_array(t, sizeof(GLenum), (const void**)&bufs, &bufs_count); YAGL_LOG_FUNC_ENTER_SPLIT1(glDrawBuffers, void*, bufs); - (void)yagl_host_glDrawBuffers(bufs, bufs_count); + (void)yagl_host_glDrawBuffers(cur_ts, bufs, bufs_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1359,10 +1427,11 @@ static void yagl_func_glDrawBuffers(struct yagl_transport *t) */ static void yagl_func_glReadBuffer(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum mode; mode = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glReadBuffer, GLenum, mode); - (void)yagl_host_glReadBuffer(mode); + (void)yagl_host_glReadBuffer(cur_ts, mode); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1371,6 +1440,7 @@ static void yagl_func_glReadBuffer(struct yagl_transport *t) */ static void yagl_func_glFramebufferTexture3D(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum attachment; GLenum textarget; @@ -1384,7 +1454,7 @@ static void yagl_func_glFramebufferTexture3D(struct yagl_transport *t) level = yagl_transport_get_out_GLint(t); zoffset = yagl_transport_get_out_GLint(t); YAGL_LOG_FUNC_ENTER_SPLIT6(glFramebufferTexture3D, GLenum, GLenum, GLenum, GLuint, GLint, GLint, target, attachment, textarget, texture, level, zoffset); - (void)yagl_host_glFramebufferTexture3D(target, attachment, textarget, texture, level, zoffset); + (void)yagl_host_glFramebufferTexture3D(cur_ts, target, attachment, textarget, texture, level, zoffset); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1393,6 +1463,7 @@ static void yagl_func_glFramebufferTexture3D(struct yagl_transport *t) */ static void yagl_func_glFramebufferTextureLayer(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum attachment; GLuint texture; @@ -1404,7 +1475,7 @@ static void yagl_func_glFramebufferTextureLayer(struct yagl_transport *t) level = yagl_transport_get_out_GLint(t); layer = yagl_transport_get_out_GLint(t); YAGL_LOG_FUNC_ENTER_SPLIT5(glFramebufferTextureLayer, GLenum, GLenum, GLuint, GLint, GLint, target, attachment, texture, level, layer); - (void)yagl_host_glFramebufferTextureLayer(target, attachment, texture, level, layer); + (void)yagl_host_glFramebufferTextureLayer(cur_ts, target, attachment, texture, level, layer); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1413,6 +1484,7 @@ static void yagl_func_glFramebufferTextureLayer(struct yagl_transport *t) */ static void yagl_func_glClearBufferiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum buffer; GLint drawbuffer; const GLint *value; @@ -1421,7 +1493,7 @@ static void yagl_func_glClearBufferiv(struct yagl_transport *t) drawbuffer = yagl_transport_get_out_GLint(t); yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&value, &value_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glClearBufferiv, GLenum, GLint, void*, buffer, drawbuffer, value); - (void)yagl_host_glClearBufferiv(buffer, drawbuffer, value, value_count); + (void)yagl_host_glClearBufferiv(cur_ts, buffer, drawbuffer, value, value_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1430,6 +1502,7 @@ static void yagl_func_glClearBufferiv(struct yagl_transport *t) */ static void yagl_func_glClearBufferuiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum buffer; GLint drawbuffer; const GLuint *value; @@ -1438,7 +1511,7 @@ static void yagl_func_glClearBufferuiv(struct yagl_transport *t) drawbuffer = yagl_transport_get_out_GLint(t); yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&value, &value_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glClearBufferuiv, GLenum, GLint, void*, buffer, drawbuffer, value); - (void)yagl_host_glClearBufferuiv(buffer, drawbuffer, value, value_count); + (void)yagl_host_glClearBufferuiv(cur_ts, buffer, drawbuffer, value, value_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1447,6 +1520,7 @@ static void yagl_func_glClearBufferuiv(struct yagl_transport *t) */ static void yagl_func_glClearBufferfi(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum buffer; GLint drawbuffer; GLfloat depth; @@ -1456,7 +1530,7 @@ static void yagl_func_glClearBufferfi(struct yagl_transport *t) depth = yagl_transport_get_out_GLfloat(t); stencil = yagl_transport_get_out_GLint(t); YAGL_LOG_FUNC_ENTER_SPLIT4(glClearBufferfi, GLenum, GLint, GLfloat, GLint, buffer, drawbuffer, depth, stencil); - (void)yagl_host_glClearBufferfi(buffer, drawbuffer, depth, stencil); + (void)yagl_host_glClearBufferfi(cur_ts, buffer, drawbuffer, depth, stencil); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1465,6 +1539,7 @@ static void yagl_func_glClearBufferfi(struct yagl_transport *t) */ static void yagl_func_glClearBufferfv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum buffer; GLint drawbuffer; const GLfloat *value; @@ -1473,7 +1548,7 @@ static void yagl_func_glClearBufferfv(struct yagl_transport *t) drawbuffer = yagl_transport_get_out_GLint(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glClearBufferfv, GLenum, GLint, void*, buffer, drawbuffer, value); - (void)yagl_host_glClearBufferfv(buffer, drawbuffer, value, value_count); + (void)yagl_host_glClearBufferfv(cur_ts, buffer, drawbuffer, value, value_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1482,11 +1557,12 @@ static void yagl_func_glClearBufferfv(struct yagl_transport *t) */ static void yagl_func_glGenRenderbuffers(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; const GLuint *renderbuffers; int32_t renderbuffers_count; yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&renderbuffers, &renderbuffers_count); YAGL_LOG_FUNC_ENTER_SPLIT1(glGenRenderbuffers, void*, renderbuffers); - (void)yagl_host_glGenRenderbuffers(renderbuffers, renderbuffers_count); + (void)yagl_host_glGenRenderbuffers(cur_ts, renderbuffers, renderbuffers_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1495,12 +1571,13 @@ static void yagl_func_glGenRenderbuffers(struct yagl_transport *t) */ static void yagl_func_glBindRenderbuffer(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glBindRenderbuffer(cur_ts, target, renderbuffer); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1509,6 +1586,7 @@ static void yagl_func_glBindRenderbuffer(struct yagl_transport *t) */ static void yagl_func_glRenderbufferStorage(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum internalformat; GLsizei width; @@ -1518,7 +1596,7 @@ static void yagl_func_glRenderbufferStorage(struct yagl_transport *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); + (void)yagl_host_glRenderbufferStorage(cur_ts, target, internalformat, width, height); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1527,6 +1605,7 @@ static void yagl_func_glRenderbufferStorage(struct yagl_transport *t) */ static void yagl_func_glGetRenderbufferParameteriv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLenum pname; GLint *param; @@ -1534,7 +1613,7 @@ static void yagl_func_glGetRenderbufferParameteriv(struct yagl_transport *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); + (void)yagl_host_glGetRenderbufferParameteriv(cur_ts, target, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1543,6 +1622,7 @@ static void yagl_func_glGetRenderbufferParameteriv(struct yagl_transport *t) */ static void yagl_func_glRenderbufferStorageMultisample(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLsizei samples; GLenum internalformat; @@ -1554,7 +1634,7 @@ static void yagl_func_glRenderbufferStorageMultisample(struct yagl_transport *t) width = yagl_transport_get_out_GLsizei(t); height = yagl_transport_get_out_GLsizei(t); YAGL_LOG_FUNC_ENTER_SPLIT5(glRenderbufferStorageMultisample, GLenum, GLsizei, GLenum, GLsizei, GLsizei, target, samples, internalformat, width, height); - (void)yagl_host_glRenderbufferStorageMultisample(target, samples, internalformat, width, height); + (void)yagl_host_glRenderbufferStorageMultisample(cur_ts, target, samples, internalformat, width, height); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1563,10 +1643,11 @@ static void yagl_func_glRenderbufferStorageMultisample(struct yagl_transport *t) */ static void yagl_func_glCreateProgram(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; program = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glCreateProgram, GLuint, program); - (void)yagl_host_glCreateProgram(program); + (void)yagl_host_glCreateProgram(cur_ts, program); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1575,12 +1656,13 @@ static void yagl_func_glCreateProgram(struct yagl_transport *t) */ static void yagl_func_glCreateShader(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glCreateShader(cur_ts, shader, type); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1589,13 +1671,14 @@ static void yagl_func_glCreateShader(struct yagl_transport *t) */ static void yagl_func_glShaderSource(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint shader; const GLchar *string; int32_t string_count; shader = yagl_transport_get_out_GLuint(t); yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&string, &string_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glShaderSource, GLuint, void*, shader, string); - (void)yagl_host_glShaderSource(shader, string, string_count); + (void)yagl_host_glShaderSource(cur_ts, shader, string, string_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1604,12 +1687,13 @@ static void yagl_func_glShaderSource(struct yagl_transport *t) */ static void yagl_func_glAttachShader(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glAttachShader(cur_ts, program, shader); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1618,12 +1702,13 @@ static void yagl_func_glAttachShader(struct yagl_transport *t) */ static void yagl_func_glDetachShader(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glDetachShader(cur_ts, program, shader); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1632,10 +1717,11 @@ static void yagl_func_glDetachShader(struct yagl_transport *t) */ static void yagl_func_glCompileShader(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint shader; shader = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glCompileShader, GLuint, shader); - (void)yagl_host_glCompileShader(shader); + (void)yagl_host_glCompileShader(cur_ts, shader); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1644,6 +1730,7 @@ static void yagl_func_glCompileShader(struct yagl_transport *t) */ static void yagl_func_glBindAttribLocation(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; GLuint index; const GLchar *name; @@ -1652,7 +1739,7 @@ static void yagl_func_glBindAttribLocation(struct yagl_transport *t) index = yagl_transport_get_out_GLuint(t); yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glBindAttribLocation, GLuint, GLuint, void*, program, index, name); - (void)yagl_host_glBindAttribLocation(program, index, name, name_count); + (void)yagl_host_glBindAttribLocation(cur_ts, program, index, name, name_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1661,6 +1748,7 @@ static void yagl_func_glBindAttribLocation(struct yagl_transport *t) */ static void yagl_func_glGetActiveAttrib(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; GLuint index; GLint *size; @@ -1675,7 +1763,7 @@ static void yagl_func_glGetActiveAttrib(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&name, &name_maxcount, &name_count); 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); + (void)yagl_host_glGetActiveAttrib(cur_ts, program, index, size, type, name, name_maxcount, name_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1684,6 +1772,7 @@ static void yagl_func_glGetActiveAttrib(struct yagl_transport *t) */ static void yagl_func_glGetActiveUniform(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; GLuint index; GLint *size; @@ -1698,7 +1787,7 @@ static void yagl_func_glGetActiveUniform(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&name, &name_maxcount, &name_count); 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); + (void)yagl_host_glGetActiveUniform(cur_ts, program, index, size, type, name, name_maxcount, name_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1707,6 +1796,7 @@ static void yagl_func_glGetActiveUniform(struct yagl_transport *t) */ static void yagl_func_glGetAttribLocation(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; const GLchar *name; int32_t name_count; @@ -1715,7 +1805,7 @@ static void yagl_func_glGetAttribLocation(struct yagl_transport *t) yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count); yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT2(glGetAttribLocation, GLuint, void*, program, name); - *retval = yagl_host_glGetAttribLocation(program, name, name_count); + *retval = yagl_host_glGetAttribLocation(cur_ts, program, name, name_count); YAGL_LOG_FUNC_EXIT_SPLIT(int, *retval); } @@ -1724,6 +1814,7 @@ static void yagl_func_glGetAttribLocation(struct yagl_transport *t) */ static void yagl_func_glGetProgramiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; GLenum pname; GLint *param; @@ -1731,7 +1822,7 @@ static void yagl_func_glGetProgramiv(struct yagl_transport *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); + (void)yagl_host_glGetProgramiv(cur_ts, program, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1740,6 +1831,7 @@ static void yagl_func_glGetProgramiv(struct yagl_transport *t) */ static void yagl_func_glGetProgramInfoLog(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; GLchar *infolog; int32_t infolog_maxcount; @@ -1750,7 +1842,7 @@ static void yagl_func_glGetProgramInfoLog(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT2(glGetProgramInfoLog, GLuint, void*, program, infolog); *infolog_count = 0; - *retval = yagl_host_glGetProgramInfoLog(program, infolog, infolog_maxcount, infolog_count); + *retval = yagl_host_glGetProgramInfoLog(cur_ts, program, infolog, infolog_maxcount, infolog_count); YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval); } @@ -1759,6 +1851,7 @@ static void yagl_func_glGetProgramInfoLog(struct yagl_transport *t) */ static void yagl_func_glGetShaderiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint shader; GLenum pname; GLint *param; @@ -1766,7 +1859,7 @@ static void yagl_func_glGetShaderiv(struct yagl_transport *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); + (void)yagl_host_glGetShaderiv(cur_ts, shader, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1775,6 +1868,7 @@ static void yagl_func_glGetShaderiv(struct yagl_transport *t) */ static void yagl_func_glGetShaderInfoLog(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint shader; GLchar *infolog; int32_t infolog_maxcount; @@ -1785,7 +1879,7 @@ static void yagl_func_glGetShaderInfoLog(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT2(glGetShaderInfoLog, GLuint, void*, shader, infolog); *infolog_count = 0; - *retval = yagl_host_glGetShaderInfoLog(shader, infolog, infolog_maxcount, infolog_count); + *retval = yagl_host_glGetShaderInfoLog(cur_ts, shader, infolog, infolog_maxcount, infolog_count); YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval); } @@ -1794,6 +1888,7 @@ static void yagl_func_glGetShaderInfoLog(struct yagl_transport *t) */ static void yagl_func_glGetUniformfv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; GLuint program; uint32_t location; @@ -1806,7 +1901,7 @@ static void yagl_func_glGetUniformfv(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT4(glGetUniformfv, GLboolean, GLuint, uint32_t, void*, tl, program, location, params); *params_count = 0; - (void)yagl_host_glGetUniformfv(tl, program, location, params, params_maxcount, params_count); + (void)yagl_host_glGetUniformfv(cur_ts, tl, program, location, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1815,6 +1910,7 @@ static void yagl_func_glGetUniformfv(struct yagl_transport *t) */ static void yagl_func_glGetUniformiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; GLuint program; uint32_t location; @@ -1827,7 +1923,7 @@ static void yagl_func_glGetUniformiv(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT4(glGetUniformiv, GLboolean, GLuint, uint32_t, void*, tl, program, location, params); *params_count = 0; - (void)yagl_host_glGetUniformiv(tl, program, location, params, params_maxcount, params_count); + (void)yagl_host_glGetUniformiv(cur_ts, tl, program, location, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1836,6 +1932,7 @@ static void yagl_func_glGetUniformiv(struct yagl_transport *t) */ static void yagl_func_glGetUniformLocation(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; const GLchar *name; int32_t name_count; @@ -1844,7 +1941,7 @@ static void yagl_func_glGetUniformLocation(struct yagl_transport *t) yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count); yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT2(glGetUniformLocation, GLuint, void*, program, name); - *retval = yagl_host_glGetUniformLocation(program, name, name_count); + *retval = yagl_host_glGetUniformLocation(cur_ts, program, name, name_count); YAGL_LOG_FUNC_EXIT_SPLIT(int, *retval); } @@ -1853,6 +1950,7 @@ static void yagl_func_glGetUniformLocation(struct yagl_transport *t) */ static void yagl_func_glGetVertexAttribfv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint index; GLenum pname; GLfloat *params; @@ -1863,7 +1961,7 @@ static void yagl_func_glGetVertexAttribfv(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glGetVertexAttribfv, GLuint, GLenum, void*, index, pname, params); *params_count = 0; - (void)yagl_host_glGetVertexAttribfv(index, pname, params, params_maxcount, params_count); + (void)yagl_host_glGetVertexAttribfv(cur_ts, index, pname, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1872,6 +1970,7 @@ static void yagl_func_glGetVertexAttribfv(struct yagl_transport *t) */ static void yagl_func_glGetVertexAttribiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint index; GLenum pname; GLint *params; @@ -1882,7 +1981,7 @@ static void yagl_func_glGetVertexAttribiv(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glGetVertexAttribiv, GLuint, GLenum, void*, index, pname, params); *params_count = 0; - (void)yagl_host_glGetVertexAttribiv(index, pname, params, params_maxcount, params_count); + (void)yagl_host_glGetVertexAttribiv(cur_ts, index, pname, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1891,6 +1990,7 @@ static void yagl_func_glGetVertexAttribiv(struct yagl_transport *t) */ static void yagl_func_glLinkProgram(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; GLint *params; int32_t params_maxcount; @@ -1899,7 +1999,7 @@ static void yagl_func_glLinkProgram(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glLinkProgram, GLuint, void*, program, params); *params_count = 0; - (void)yagl_host_glLinkProgram(program, params, params_maxcount, params_count); + (void)yagl_host_glLinkProgram(cur_ts, program, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1908,6 +2008,7 @@ static void yagl_func_glLinkProgram(struct yagl_transport *t) */ static void yagl_func_glUniform1f(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLfloat x; @@ -1915,7 +2016,7 @@ static void yagl_func_glUniform1f(struct yagl_transport *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); + (void)yagl_host_glUniform1f(cur_ts, tl, location, x); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1924,6 +2025,7 @@ static void yagl_func_glUniform1f(struct yagl_transport *t) */ static void yagl_func_glUniform1fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; const GLfloat *v; @@ -1932,7 +2034,7 @@ static void yagl_func_glUniform1fv(struct yagl_transport *t) location = yagl_transport_get_out_uint32_t(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform1fv, GLboolean, uint32_t, void*, tl, location, v); - (void)yagl_host_glUniform1fv(tl, location, v, v_count); + (void)yagl_host_glUniform1fv(cur_ts, tl, location, v, v_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1941,6 +2043,7 @@ static void yagl_func_glUniform1fv(struct yagl_transport *t) */ static void yagl_func_glUniform1i(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLint x; @@ -1948,7 +2051,7 @@ static void yagl_func_glUniform1i(struct yagl_transport *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); + (void)yagl_host_glUniform1i(cur_ts, tl, location, x); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1957,6 +2060,7 @@ static void yagl_func_glUniform1i(struct yagl_transport *t) */ static void yagl_func_glUniform1iv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; const GLint *v; @@ -1965,7 +2069,7 @@ static void yagl_func_glUniform1iv(struct yagl_transport *t) location = yagl_transport_get_out_uint32_t(t); yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform1iv, GLboolean, uint32_t, void*, tl, location, v); - (void)yagl_host_glUniform1iv(tl, location, v, v_count); + (void)yagl_host_glUniform1iv(cur_ts, tl, location, v, v_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1974,6 +2078,7 @@ static void yagl_func_glUniform1iv(struct yagl_transport *t) */ static void yagl_func_glUniform2f(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLfloat x; @@ -1983,7 +2088,7 @@ static void yagl_func_glUniform2f(struct yagl_transport *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); + (void)yagl_host_glUniform2f(cur_ts, tl, location, x, y); YAGL_LOG_FUNC_EXIT(NULL); } @@ -1992,6 +2097,7 @@ static void yagl_func_glUniform2f(struct yagl_transport *t) */ static void yagl_func_glUniform2fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; const GLfloat *v; @@ -2000,7 +2106,7 @@ static void yagl_func_glUniform2fv(struct yagl_transport *t) location = yagl_transport_get_out_uint32_t(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform2fv, GLboolean, uint32_t, void*, tl, location, v); - (void)yagl_host_glUniform2fv(tl, location, v, v_count); + (void)yagl_host_glUniform2fv(cur_ts, tl, location, v, v_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2009,6 +2115,7 @@ static void yagl_func_glUniform2fv(struct yagl_transport *t) */ static void yagl_func_glUniform2i(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLint x; @@ -2018,7 +2125,7 @@ static void yagl_func_glUniform2i(struct yagl_transport *t) x = yagl_transport_get_out_GLint(t); y = yagl_transport_get_out_GLint(t); YAGL_LOG_FUNC_ENTER_SPLIT4(glUniform2i, GLboolean, uint32_t, GLint, GLint, tl, location, x, y); - (void)yagl_host_glUniform2i(tl, location, x, y); + (void)yagl_host_glUniform2i(cur_ts, tl, location, x, y); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2027,6 +2134,7 @@ static void yagl_func_glUniform2i(struct yagl_transport *t) */ static void yagl_func_glUniform2iv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; const GLint *v; @@ -2035,7 +2143,7 @@ static void yagl_func_glUniform2iv(struct yagl_transport *t) location = yagl_transport_get_out_uint32_t(t); yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform2iv, GLboolean, uint32_t, void*, tl, location, v); - (void)yagl_host_glUniform2iv(tl, location, v, v_count); + (void)yagl_host_glUniform2iv(cur_ts, tl, location, v, v_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2044,6 +2152,7 @@ static void yagl_func_glUniform2iv(struct yagl_transport *t) */ static void yagl_func_glUniform3f(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLfloat x; @@ -2055,7 +2164,7 @@ static void yagl_func_glUniform3f(struct yagl_transport *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); + (void)yagl_host_glUniform3f(cur_ts, tl, location, x, y, z); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2064,6 +2173,7 @@ static void yagl_func_glUniform3f(struct yagl_transport *t) */ static void yagl_func_glUniform3fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; const GLfloat *v; @@ -2072,7 +2182,7 @@ static void yagl_func_glUniform3fv(struct yagl_transport *t) location = yagl_transport_get_out_uint32_t(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform3fv, GLboolean, uint32_t, void*, tl, location, v); - (void)yagl_host_glUniform3fv(tl, location, v, v_count); + (void)yagl_host_glUniform3fv(cur_ts, tl, location, v, v_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2081,6 +2191,7 @@ static void yagl_func_glUniform3fv(struct yagl_transport *t) */ static void yagl_func_glUniform3i(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLint x; @@ -2092,7 +2203,7 @@ static void yagl_func_glUniform3i(struct yagl_transport *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); + (void)yagl_host_glUniform3i(cur_ts, tl, location, x, y, z); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2101,6 +2212,7 @@ static void yagl_func_glUniform3i(struct yagl_transport *t) */ static void yagl_func_glUniform3iv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; const GLint *v; @@ -2109,7 +2221,7 @@ static void yagl_func_glUniform3iv(struct yagl_transport *t) location = yagl_transport_get_out_uint32_t(t); yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform3iv, GLboolean, uint32_t, void*, tl, location, v); - (void)yagl_host_glUniform3iv(tl, location, v, v_count); + (void)yagl_host_glUniform3iv(cur_ts, tl, location, v, v_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2118,6 +2230,7 @@ static void yagl_func_glUniform3iv(struct yagl_transport *t) */ static void yagl_func_glUniform4f(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLfloat x; @@ -2131,7 +2244,7 @@ static void yagl_func_glUniform4f(struct yagl_transport *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); + (void)yagl_host_glUniform4f(cur_ts, tl, location, x, y, z, w); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2140,6 +2253,7 @@ static void yagl_func_glUniform4f(struct yagl_transport *t) */ static void yagl_func_glUniform4fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; const GLfloat *v; @@ -2148,7 +2262,7 @@ static void yagl_func_glUniform4fv(struct yagl_transport *t) location = yagl_transport_get_out_uint32_t(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&v, &v_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform4fv, GLboolean, uint32_t, void*, tl, location, v); - (void)yagl_host_glUniform4fv(tl, location, v, v_count); + (void)yagl_host_glUniform4fv(cur_ts, tl, location, v, v_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2157,6 +2271,7 @@ static void yagl_func_glUniform4fv(struct yagl_transport *t) */ static void yagl_func_glUniform4i(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLint x; @@ -2170,7 +2285,7 @@ static void yagl_func_glUniform4i(struct yagl_transport *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); + (void)yagl_host_glUniform4i(cur_ts, tl, location, x, y, z, w); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2179,6 +2294,7 @@ static void yagl_func_glUniform4i(struct yagl_transport *t) */ static void yagl_func_glUniform4iv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; const GLint *v; @@ -2187,7 +2303,7 @@ static void yagl_func_glUniform4iv(struct yagl_transport *t) location = yagl_transport_get_out_uint32_t(t); yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform4iv, GLboolean, uint32_t, void*, tl, location, v); - (void)yagl_host_glUniform4iv(tl, location, v, v_count); + (void)yagl_host_glUniform4iv(cur_ts, tl, location, v, v_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2196,6 +2312,7 @@ static void yagl_func_glUniform4iv(struct yagl_transport *t) */ static void yagl_func_glUniformMatrix2fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLboolean transpose; @@ -2206,7 +2323,7 @@ static void yagl_func_glUniformMatrix2fv(struct yagl_transport *t) transpose = yagl_transport_get_out_GLboolean(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count); YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix2fv, GLboolean, uint32_t, GLboolean, void*, tl, location, transpose, value); - (void)yagl_host_glUniformMatrix2fv(tl, location, transpose, value, value_count); + (void)yagl_host_glUniformMatrix2fv(cur_ts, tl, location, transpose, value, value_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2215,6 +2332,7 @@ static void yagl_func_glUniformMatrix2fv(struct yagl_transport *t) */ static void yagl_func_glUniformMatrix3fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLboolean transpose; @@ -2225,7 +2343,7 @@ static void yagl_func_glUniformMatrix3fv(struct yagl_transport *t) transpose = yagl_transport_get_out_GLboolean(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count); YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix3fv, GLboolean, uint32_t, GLboolean, void*, tl, location, transpose, value); - (void)yagl_host_glUniformMatrix3fv(tl, location, transpose, value, value_count); + (void)yagl_host_glUniformMatrix3fv(cur_ts, tl, location, transpose, value, value_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2234,6 +2352,7 @@ static void yagl_func_glUniformMatrix3fv(struct yagl_transport *t) */ static void yagl_func_glUniformMatrix4fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLboolean transpose; @@ -2244,7 +2363,7 @@ static void yagl_func_glUniformMatrix4fv(struct yagl_transport *t) transpose = yagl_transport_get_out_GLboolean(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count); YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix4fv, GLboolean, uint32_t, GLboolean, void*, tl, location, transpose, value); - (void)yagl_host_glUniformMatrix4fv(tl, location, transpose, value, value_count); + (void)yagl_host_glUniformMatrix4fv(cur_ts, tl, location, transpose, value, value_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2253,10 +2372,11 @@ static void yagl_func_glUniformMatrix4fv(struct yagl_transport *t) */ static void yagl_func_glUseProgram(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; program = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glUseProgram, GLuint, program); - (void)yagl_host_glUseProgram(program); + (void)yagl_host_glUseProgram(cur_ts, program); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2265,10 +2385,11 @@ static void yagl_func_glUseProgram(struct yagl_transport *t) */ static void yagl_func_glValidateProgram(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; program = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glValidateProgram, GLuint, program); - (void)yagl_host_glValidateProgram(program); + (void)yagl_host_glValidateProgram(cur_ts, program); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2277,12 +2398,13 @@ static void yagl_func_glValidateProgram(struct yagl_transport *t) */ static void yagl_func_glVertexAttrib1f(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glVertexAttrib1f(cur_ts, indx, x); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2291,13 +2413,14 @@ static void yagl_func_glVertexAttrib1f(struct yagl_transport *t) */ static void yagl_func_glVertexAttrib1fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint indx; const GLfloat *values; int32_t values_count; indx = yagl_transport_get_out_GLuint(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib1fv, GLuint, void*, indx, values); - (void)yagl_host_glVertexAttrib1fv(indx, values, values_count); + (void)yagl_host_glVertexAttrib1fv(cur_ts, indx, values, values_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2306,6 +2429,7 @@ static void yagl_func_glVertexAttrib1fv(struct yagl_transport *t) */ static void yagl_func_glVertexAttrib2f(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint indx; GLfloat x; GLfloat y; @@ -2313,7 +2437,7 @@ static void yagl_func_glVertexAttrib2f(struct yagl_transport *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); + (void)yagl_host_glVertexAttrib2f(cur_ts, indx, x, y); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2322,13 +2446,14 @@ static void yagl_func_glVertexAttrib2f(struct yagl_transport *t) */ static void yagl_func_glVertexAttrib2fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint indx; const GLfloat *values; int32_t values_count; indx = yagl_transport_get_out_GLuint(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib2fv, GLuint, void*, indx, values); - (void)yagl_host_glVertexAttrib2fv(indx, values, values_count); + (void)yagl_host_glVertexAttrib2fv(cur_ts, indx, values, values_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2337,6 +2462,7 @@ static void yagl_func_glVertexAttrib2fv(struct yagl_transport *t) */ static void yagl_func_glVertexAttrib3f(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint indx; GLfloat x; GLfloat y; @@ -2346,7 +2472,7 @@ static void yagl_func_glVertexAttrib3f(struct yagl_transport *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); + (void)yagl_host_glVertexAttrib3f(cur_ts, indx, x, y, z); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2355,13 +2481,14 @@ static void yagl_func_glVertexAttrib3f(struct yagl_transport *t) */ static void yagl_func_glVertexAttrib3fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint indx; const GLfloat *values; int32_t values_count; indx = yagl_transport_get_out_GLuint(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib3fv, GLuint, void*, indx, values); - (void)yagl_host_glVertexAttrib3fv(indx, values, values_count); + (void)yagl_host_glVertexAttrib3fv(cur_ts, indx, values, values_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2370,6 +2497,7 @@ static void yagl_func_glVertexAttrib3fv(struct yagl_transport *t) */ static void yagl_func_glVertexAttrib4f(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint indx; GLfloat x; GLfloat y; @@ -2381,7 +2509,7 @@ static void yagl_func_glVertexAttrib4f(struct yagl_transport *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); + (void)yagl_host_glVertexAttrib4f(cur_ts, indx, x, y, z, w); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2390,13 +2518,14 @@ static void yagl_func_glVertexAttrib4f(struct yagl_transport *t) */ static void yagl_func_glVertexAttrib4fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint indx; const GLfloat *values; int32_t values_count; indx = yagl_transport_get_out_GLuint(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&values, &values_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttrib4fv, GLuint, void*, indx, values); - (void)yagl_host_glVertexAttrib4fv(indx, values, values_count); + (void)yagl_host_glVertexAttrib4fv(cur_ts, indx, values, values_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2405,6 +2534,7 @@ static void yagl_func_glVertexAttrib4fv(struct yagl_transport *t) */ static void yagl_func_glGetActiveUniformsiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; const GLuint *uniformIndices; int32_t uniformIndices_count; @@ -2416,7 +2546,7 @@ static void yagl_func_glGetActiveUniformsiv(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glGetActiveUniformsiv, GLuint, void*, void*, program, uniformIndices, params); *params_count = 0; - (void)yagl_host_glGetActiveUniformsiv(program, uniformIndices, uniformIndices_count, params, params_maxcount, params_count); + (void)yagl_host_glGetActiveUniformsiv(cur_ts, program, uniformIndices, uniformIndices_count, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2425,6 +2555,7 @@ static void yagl_func_glGetActiveUniformsiv(struct yagl_transport *t) */ static void yagl_func_glGetUniformIndices(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; const GLchar *uniformNames; int32_t uniformNames_count; @@ -2436,7 +2567,7 @@ static void yagl_func_glGetUniformIndices(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLuint), (void**)&uniformIndices, &uniformIndices_maxcount, &uniformIndices_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glGetUniformIndices, GLuint, void*, void*, program, uniformNames, uniformIndices); *uniformIndices_count = 0; - (void)yagl_host_glGetUniformIndices(program, uniformNames, uniformNames_count, uniformIndices, uniformIndices_maxcount, uniformIndices_count); + (void)yagl_host_glGetUniformIndices(cur_ts, program, uniformNames, uniformNames_count, uniformIndices, uniformIndices_maxcount, uniformIndices_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2445,6 +2576,7 @@ static void yagl_func_glGetUniformIndices(struct yagl_transport *t) */ static void yagl_func_glGetUniformBlockIndex(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; const GLchar *uniformBlockName; int32_t uniformBlockName_count; @@ -2453,7 +2585,7 @@ static void yagl_func_glGetUniformBlockIndex(struct yagl_transport *t) yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&uniformBlockName, &uniformBlockName_count); yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT2(glGetUniformBlockIndex, GLuint, void*, program, uniformBlockName); - *retval = yagl_host_glGetUniformBlockIndex(program, uniformBlockName, uniformBlockName_count); + *retval = yagl_host_glGetUniformBlockIndex(cur_ts, program, uniformBlockName, uniformBlockName_count); YAGL_LOG_FUNC_EXIT_SPLIT(GLuint, *retval); } @@ -2462,6 +2594,7 @@ static void yagl_func_glGetUniformBlockIndex(struct yagl_transport *t) */ static void yagl_func_glUniformBlockBinding(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; GLuint uniformBlockIndex; GLuint uniformBlockBinding; @@ -2469,7 +2602,7 @@ static void yagl_func_glUniformBlockBinding(struct yagl_transport *t) uniformBlockIndex = yagl_transport_get_out_GLuint(t); uniformBlockBinding = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT3(glUniformBlockBinding, GLuint, GLuint, GLuint, program, uniformBlockIndex, uniformBlockBinding); - (void)yagl_host_glUniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding); + (void)yagl_host_glUniformBlockBinding(cur_ts, program, uniformBlockIndex, uniformBlockBinding); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2478,6 +2611,7 @@ static void yagl_func_glUniformBlockBinding(struct yagl_transport *t) */ static void yagl_func_glGetActiveUniformBlockName(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; GLuint uniformBlockIndex; GLchar *uniformBlockName; @@ -2488,7 +2622,7 @@ static void yagl_func_glGetActiveUniformBlockName(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&uniformBlockName, &uniformBlockName_maxcount, &uniformBlockName_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glGetActiveUniformBlockName, GLuint, GLuint, void*, program, uniformBlockIndex, uniformBlockName); *uniformBlockName_count = 0; - (void)yagl_host_glGetActiveUniformBlockName(program, uniformBlockIndex, uniformBlockName, uniformBlockName_maxcount, uniformBlockName_count); + (void)yagl_host_glGetActiveUniformBlockName(cur_ts, program, uniformBlockIndex, uniformBlockName, uniformBlockName_maxcount, uniformBlockName_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2497,6 +2631,7 @@ static void yagl_func_glGetActiveUniformBlockName(struct yagl_transport *t) */ static void yagl_func_glGetActiveUniformBlockiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; GLuint uniformBlockIndex; GLenum pname; @@ -2509,7 +2644,7 @@ static void yagl_func_glGetActiveUniformBlockiv(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT4(glGetActiveUniformBlockiv, GLuint, GLuint, GLenum, void*, program, uniformBlockIndex, pname, params); *params_count = 0; - (void)yagl_host_glGetActiveUniformBlockiv(program, uniformBlockIndex, pname, params, params_maxcount, params_count); + (void)yagl_host_glGetActiveUniformBlockiv(cur_ts, program, uniformBlockIndex, pname, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2518,6 +2653,7 @@ static void yagl_func_glGetActiveUniformBlockiv(struct yagl_transport *t) */ static void yagl_func_glGetVertexAttribIiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint index; GLenum pname; GLint *params; @@ -2528,7 +2664,7 @@ static void yagl_func_glGetVertexAttribIiv(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glGetVertexAttribIiv, GLuint, GLenum, void*, index, pname, params); *params_count = 0; - (void)yagl_host_glGetVertexAttribIiv(index, pname, params, params_maxcount, params_count); + (void)yagl_host_glGetVertexAttribIiv(cur_ts, index, pname, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2537,6 +2673,7 @@ static void yagl_func_glGetVertexAttribIiv(struct yagl_transport *t) */ static void yagl_func_glGetVertexAttribIuiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint index; GLenum pname; GLuint *params; @@ -2547,7 +2684,7 @@ static void yagl_func_glGetVertexAttribIuiv(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLuint), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glGetVertexAttribIuiv, GLuint, GLenum, void*, index, pname, params); *params_count = 0; - (void)yagl_host_glGetVertexAttribIuiv(index, pname, params, params_maxcount, params_count); + (void)yagl_host_glGetVertexAttribIuiv(cur_ts, index, pname, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2556,6 +2693,7 @@ static void yagl_func_glGetVertexAttribIuiv(struct yagl_transport *t) */ static void yagl_func_glVertexAttribI4i(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint index; GLint x; GLint y; @@ -2567,7 +2705,7 @@ static void yagl_func_glVertexAttribI4i(struct yagl_transport *t) z = yagl_transport_get_out_GLint(t); w = yagl_transport_get_out_GLint(t); YAGL_LOG_FUNC_ENTER_SPLIT5(glVertexAttribI4i, GLuint, GLint, GLint, GLint, GLint, index, x, y, z, w); - (void)yagl_host_glVertexAttribI4i(index, x, y, z, w); + (void)yagl_host_glVertexAttribI4i(cur_ts, index, x, y, z, w); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2576,6 +2714,7 @@ static void yagl_func_glVertexAttribI4i(struct yagl_transport *t) */ static void yagl_func_glVertexAttribI4ui(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint index; GLuint x; GLuint y; @@ -2587,7 +2726,7 @@ static void yagl_func_glVertexAttribI4ui(struct yagl_transport *t) z = yagl_transport_get_out_GLuint(t); w = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT5(glVertexAttribI4ui, GLuint, GLuint, GLuint, GLuint, GLuint, index, x, y, z, w); - (void)yagl_host_glVertexAttribI4ui(index, x, y, z, w); + (void)yagl_host_glVertexAttribI4ui(cur_ts, index, x, y, z, w); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2596,13 +2735,14 @@ static void yagl_func_glVertexAttribI4ui(struct yagl_transport *t) */ static void yagl_func_glVertexAttribI4iv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint index; const GLint *v; int32_t v_count; index = yagl_transport_get_out_GLuint(t); yagl_transport_get_out_array(t, sizeof(GLint), (const void**)&v, &v_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttribI4iv, GLuint, void*, index, v); - (void)yagl_host_glVertexAttribI4iv(index, v, v_count); + (void)yagl_host_glVertexAttribI4iv(cur_ts, index, v, v_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2611,13 +2751,14 @@ static void yagl_func_glVertexAttribI4iv(struct yagl_transport *t) */ static void yagl_func_glVertexAttribI4uiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint index; const GLuint *v; int32_t v_count; index = yagl_transport_get_out_GLuint(t); yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&v, &v_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glVertexAttribI4uiv, GLuint, void*, index, v); - (void)yagl_host_glVertexAttribI4uiv(index, v, v_count); + (void)yagl_host_glVertexAttribI4uiv(cur_ts, index, v, v_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2626,6 +2767,7 @@ static void yagl_func_glVertexAttribI4uiv(struct yagl_transport *t) */ static void yagl_func_glGetUniformuiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; GLuint program; uint32_t location; @@ -2638,7 +2780,7 @@ static void yagl_func_glGetUniformuiv(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLuint), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT4(glGetUniformuiv, GLboolean, GLuint, uint32_t, void*, tl, program, location, params); *params_count = 0; - (void)yagl_host_glGetUniformuiv(tl, program, location, params, params_maxcount, params_count); + (void)yagl_host_glGetUniformuiv(cur_ts, tl, program, location, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2647,6 +2789,7 @@ static void yagl_func_glGetUniformuiv(struct yagl_transport *t) */ static void yagl_func_glUniform1ui(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLuint v0; @@ -2654,7 +2797,7 @@ static void yagl_func_glUniform1ui(struct yagl_transport *t) location = yagl_transport_get_out_uint32_t(t); v0 = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform1ui, GLboolean, uint32_t, GLuint, tl, location, v0); - (void)yagl_host_glUniform1ui(tl, location, v0); + (void)yagl_host_glUniform1ui(cur_ts, tl, location, v0); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2663,6 +2806,7 @@ static void yagl_func_glUniform1ui(struct yagl_transport *t) */ static void yagl_func_glUniform2ui(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLuint v0; @@ -2672,7 +2816,7 @@ static void yagl_func_glUniform2ui(struct yagl_transport *t) v0 = yagl_transport_get_out_GLuint(t); v1 = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT4(glUniform2ui, GLboolean, uint32_t, GLuint, GLuint, tl, location, v0, v1); - (void)yagl_host_glUniform2ui(tl, location, v0, v1); + (void)yagl_host_glUniform2ui(cur_ts, tl, location, v0, v1); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2681,6 +2825,7 @@ static void yagl_func_glUniform2ui(struct yagl_transport *t) */ static void yagl_func_glUniform3ui(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLuint v0; @@ -2692,7 +2837,7 @@ static void yagl_func_glUniform3ui(struct yagl_transport *t) v1 = yagl_transport_get_out_GLuint(t); v2 = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT5(glUniform3ui, GLboolean, uint32_t, GLuint, GLuint, GLuint, tl, location, v0, v1, v2); - (void)yagl_host_glUniform3ui(tl, location, v0, v1, v2); + (void)yagl_host_glUniform3ui(cur_ts, tl, location, v0, v1, v2); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2701,6 +2846,7 @@ static void yagl_func_glUniform3ui(struct yagl_transport *t) */ static void yagl_func_glUniform4ui(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLuint v0; @@ -2714,7 +2860,7 @@ static void yagl_func_glUniform4ui(struct yagl_transport *t) v2 = yagl_transport_get_out_GLuint(t); v3 = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT6(glUniform4ui, GLboolean, uint32_t, GLuint, GLuint, GLuint, GLuint, tl, location, v0, v1, v2, v3); - (void)yagl_host_glUniform4ui(tl, location, v0, v1, v2, v3); + (void)yagl_host_glUniform4ui(cur_ts, tl, location, v0, v1, v2, v3); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2723,6 +2869,7 @@ static void yagl_func_glUniform4ui(struct yagl_transport *t) */ static void yagl_func_glUniform1uiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; const GLuint *v; @@ -2731,7 +2878,7 @@ static void yagl_func_glUniform1uiv(struct yagl_transport *t) location = yagl_transport_get_out_uint32_t(t); yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&v, &v_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform1uiv, GLboolean, uint32_t, void*, tl, location, v); - (void)yagl_host_glUniform1uiv(tl, location, v, v_count); + (void)yagl_host_glUniform1uiv(cur_ts, tl, location, v, v_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2740,6 +2887,7 @@ static void yagl_func_glUniform1uiv(struct yagl_transport *t) */ static void yagl_func_glUniform2uiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; const GLuint *v; @@ -2748,7 +2896,7 @@ static void yagl_func_glUniform2uiv(struct yagl_transport *t) location = yagl_transport_get_out_uint32_t(t); yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&v, &v_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform2uiv, GLboolean, uint32_t, void*, tl, location, v); - (void)yagl_host_glUniform2uiv(tl, location, v, v_count); + (void)yagl_host_glUniform2uiv(cur_ts, tl, location, v, v_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2757,6 +2905,7 @@ static void yagl_func_glUniform2uiv(struct yagl_transport *t) */ static void yagl_func_glUniform3uiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; const GLuint *v; @@ -2765,7 +2914,7 @@ static void yagl_func_glUniform3uiv(struct yagl_transport *t) location = yagl_transport_get_out_uint32_t(t); yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&v, &v_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform3uiv, GLboolean, uint32_t, void*, tl, location, v); - (void)yagl_host_glUniform3uiv(tl, location, v, v_count); + (void)yagl_host_glUniform3uiv(cur_ts, tl, location, v, v_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2774,6 +2923,7 @@ static void yagl_func_glUniform3uiv(struct yagl_transport *t) */ static void yagl_func_glUniform4uiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; const GLuint *v; @@ -2782,7 +2932,7 @@ static void yagl_func_glUniform4uiv(struct yagl_transport *t) location = yagl_transport_get_out_uint32_t(t); yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&v, &v_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glUniform4uiv, GLboolean, uint32_t, void*, tl, location, v); - (void)yagl_host_glUniform4uiv(tl, location, v, v_count); + (void)yagl_host_glUniform4uiv(cur_ts, tl, location, v, v_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2791,6 +2941,7 @@ static void yagl_func_glUniform4uiv(struct yagl_transport *t) */ static void yagl_func_glUniformMatrix2x3fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLboolean transpose; @@ -2801,7 +2952,7 @@ static void yagl_func_glUniformMatrix2x3fv(struct yagl_transport *t) transpose = yagl_transport_get_out_GLboolean(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count); YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix2x3fv, GLboolean, uint32_t, GLboolean, void*, tl, location, transpose, value); - (void)yagl_host_glUniformMatrix2x3fv(tl, location, transpose, value, value_count); + (void)yagl_host_glUniformMatrix2x3fv(cur_ts, tl, location, transpose, value, value_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2810,6 +2961,7 @@ static void yagl_func_glUniformMatrix2x3fv(struct yagl_transport *t) */ static void yagl_func_glUniformMatrix2x4fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLboolean transpose; @@ -2820,7 +2972,7 @@ static void yagl_func_glUniformMatrix2x4fv(struct yagl_transport *t) transpose = yagl_transport_get_out_GLboolean(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count); YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix2x4fv, GLboolean, uint32_t, GLboolean, void*, tl, location, transpose, value); - (void)yagl_host_glUniformMatrix2x4fv(tl, location, transpose, value, value_count); + (void)yagl_host_glUniformMatrix2x4fv(cur_ts, tl, location, transpose, value, value_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2829,6 +2981,7 @@ static void yagl_func_glUniformMatrix2x4fv(struct yagl_transport *t) */ static void yagl_func_glUniformMatrix3x2fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLboolean transpose; @@ -2839,7 +2992,7 @@ static void yagl_func_glUniformMatrix3x2fv(struct yagl_transport *t) transpose = yagl_transport_get_out_GLboolean(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count); YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix3x2fv, GLboolean, uint32_t, GLboolean, void*, tl, location, transpose, value); - (void)yagl_host_glUniformMatrix3x2fv(tl, location, transpose, value, value_count); + (void)yagl_host_glUniformMatrix3x2fv(cur_ts, tl, location, transpose, value, value_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2848,6 +3001,7 @@ static void yagl_func_glUniformMatrix3x2fv(struct yagl_transport *t) */ static void yagl_func_glUniformMatrix3x4fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLboolean transpose; @@ -2858,7 +3012,7 @@ static void yagl_func_glUniformMatrix3x4fv(struct yagl_transport *t) transpose = yagl_transport_get_out_GLboolean(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count); YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix3x4fv, GLboolean, uint32_t, GLboolean, void*, tl, location, transpose, value); - (void)yagl_host_glUniformMatrix3x4fv(tl, location, transpose, value, value_count); + (void)yagl_host_glUniformMatrix3x4fv(cur_ts, tl, location, transpose, value, value_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2867,6 +3021,7 @@ static void yagl_func_glUniformMatrix3x4fv(struct yagl_transport *t) */ static void yagl_func_glUniformMatrix4x2fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLboolean transpose; @@ -2877,7 +3032,7 @@ static void yagl_func_glUniformMatrix4x2fv(struct yagl_transport *t) transpose = yagl_transport_get_out_GLboolean(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count); YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix4x2fv, GLboolean, uint32_t, GLboolean, void*, tl, location, transpose, value); - (void)yagl_host_glUniformMatrix4x2fv(tl, location, transpose, value, value_count); + (void)yagl_host_glUniformMatrix4x2fv(cur_ts, tl, location, transpose, value, value_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2886,6 +3041,7 @@ static void yagl_func_glUniformMatrix4x2fv(struct yagl_transport *t) */ static void yagl_func_glUniformMatrix4x3fv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean tl; uint32_t location; GLboolean transpose; @@ -2896,7 +3052,7 @@ static void yagl_func_glUniformMatrix4x3fv(struct yagl_transport *t) transpose = yagl_transport_get_out_GLboolean(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&value, &value_count); YAGL_LOG_FUNC_ENTER_SPLIT4(glUniformMatrix4x3fv, GLboolean, uint32_t, GLboolean, void*, tl, location, transpose, value); - (void)yagl_host_glUniformMatrix4x3fv(tl, location, transpose, value, value_count); + (void)yagl_host_glUniformMatrix4x3fv(cur_ts, tl, location, transpose, value, value_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2905,6 +3061,7 @@ static void yagl_func_glUniformMatrix4x3fv(struct yagl_transport *t) */ static void yagl_func_glGetFragDataLocation(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; const GLchar *name; int32_t name_count; @@ -2913,7 +3070,7 @@ static void yagl_func_glGetFragDataLocation(struct yagl_transport *t) yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count); yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT2(glGetFragDataLocation, GLuint, void*, program, name); - *retval = yagl_host_glGetFragDataLocation(program, name, name_count); + *retval = yagl_host_glGetFragDataLocation(cur_ts, program, name, name_count); YAGL_LOG_FUNC_EXIT_SPLIT(int, *retval); } @@ -2922,6 +3079,7 @@ static void yagl_func_glGetFragDataLocation(struct yagl_transport *t) */ static void yagl_func_glGetIntegerv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum pname; GLint *params; int32_t params_maxcount; @@ -2930,7 +3088,7 @@ static void yagl_func_glGetIntegerv(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLint), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glGetIntegerv, GLenum, void*, pname, params); *params_count = 0; - (void)yagl_host_glGetIntegerv(pname, params, params_maxcount, params_count); + (void)yagl_host_glGetIntegerv(cur_ts, pname, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2939,6 +3097,7 @@ static void yagl_func_glGetIntegerv(struct yagl_transport *t) */ static void yagl_func_glGetFloatv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum pname; GLfloat *params; int32_t params_maxcount; @@ -2947,7 +3106,7 @@ static void yagl_func_glGetFloatv(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glGetFloatv, GLenum, void*, pname, params); *params_count = 0; - (void)yagl_host_glGetFloatv(pname, params, params_maxcount, params_count); + (void)yagl_host_glGetFloatv(cur_ts, pname, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2956,6 +3115,7 @@ static void yagl_func_glGetFloatv(struct yagl_transport *t) */ static void yagl_func_glGetString(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum name; GLchar *str; int32_t str_maxcount; @@ -2964,7 +3124,7 @@ static void yagl_func_glGetString(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLchar), (void**)&str, &str_maxcount, &str_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glGetString, GLenum, void*, name, str); *str_count = 0; - (void)yagl_host_glGetString(name, str, str_maxcount, str_count); + (void)yagl_host_glGetString(cur_ts, name, str, str_maxcount, str_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -2973,12 +3133,13 @@ static void yagl_func_glGetString(struct yagl_transport *t) */ static void yagl_func_glIsEnabled(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + *retval = yagl_host_glIsEnabled(cur_ts, cap); YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval); } @@ -2987,11 +3148,12 @@ static void yagl_func_glIsEnabled(struct yagl_transport *t) */ static void yagl_func_glGenTransformFeedbacks(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; const GLuint *ids; int32_t ids_count; yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&ids, &ids_count); YAGL_LOG_FUNC_ENTER_SPLIT1(glGenTransformFeedbacks, void*, ids); - (void)yagl_host_glGenTransformFeedbacks(ids, ids_count); + (void)yagl_host_glGenTransformFeedbacks(cur_ts, ids, ids_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3000,12 +3162,13 @@ static void yagl_func_glGenTransformFeedbacks(struct yagl_transport *t) */ static void yagl_func_glBindTransformFeedback(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLuint id; target = yagl_transport_get_out_GLenum(t); id = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT2(glBindTransformFeedback, GLenum, GLuint, target, id); - (void)yagl_host_glBindTransformFeedback(target, id); + (void)yagl_host_glBindTransformFeedback(cur_ts, target, id); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3014,10 +3177,11 @@ static void yagl_func_glBindTransformFeedback(struct yagl_transport *t) */ static void yagl_func_glBeginTransformFeedback(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum primitiveMode; primitiveMode = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glBeginTransformFeedback, GLenum, primitiveMode); - (void)yagl_host_glBeginTransformFeedback(primitiveMode); + (void)yagl_host_glBeginTransformFeedback(cur_ts, primitiveMode); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3026,8 +3190,9 @@ static void yagl_func_glBeginTransformFeedback(struct yagl_transport *t) */ static void yagl_func_glEndTransformFeedback(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; YAGL_LOG_FUNC_ENTER_SPLIT0(glEndTransformFeedback); - (void)yagl_host_glEndTransformFeedback(); + (void)yagl_host_glEndTransformFeedback(cur_ts); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3036,8 +3201,9 @@ static void yagl_func_glEndTransformFeedback(struct yagl_transport *t) */ static void yagl_func_glPauseTransformFeedback(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; YAGL_LOG_FUNC_ENTER_SPLIT0(glPauseTransformFeedback); - (void)yagl_host_glPauseTransformFeedback(); + (void)yagl_host_glPauseTransformFeedback(cur_ts); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3046,8 +3212,9 @@ static void yagl_func_glPauseTransformFeedback(struct yagl_transport *t) */ static void yagl_func_glResumeTransformFeedback(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; YAGL_LOG_FUNC_ENTER_SPLIT0(glResumeTransformFeedback); - (void)yagl_host_glResumeTransformFeedback(); + (void)yagl_host_glResumeTransformFeedback(cur_ts); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3056,6 +3223,7 @@ static void yagl_func_glResumeTransformFeedback(struct yagl_transport *t) */ static void yagl_func_glTransformFeedbackVaryings(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; const GLchar *varyings; int32_t varyings_count; @@ -3064,15 +3232,17 @@ static void yagl_func_glTransformFeedbackVaryings(struct yagl_transport *t) yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&varyings, &varyings_count); bufferMode = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT3(glTransformFeedbackVaryings, GLuint, void*, GLenum, program, varyings, bufferMode); - (void)yagl_host_glTransformFeedbackVaryings(program, varyings, varyings_count, bufferMode); + (void)yagl_host_glTransformFeedbackVaryings(cur_ts, t, program, varyings, varyings_count, bufferMode); YAGL_LOG_FUNC_EXIT(NULL); } + /* * glGetTransformFeedbackVaryings dispatcher. id = 169 */ static void yagl_func_glGetTransformFeedbackVaryings(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint program; GLsizei *sizes; int32_t sizes_maxcount; @@ -3086,7 +3256,7 @@ static void yagl_func_glGetTransformFeedbackVaryings(struct yagl_transport *t) YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTransformFeedbackVaryings, GLuint, void*, void*, program, sizes, types); *sizes_count = 0; *types_count = 0; - (void)yagl_host_glGetTransformFeedbackVaryings(program, sizes, sizes_maxcount, sizes_count, types, types_maxcount, types_count); + (void)yagl_host_glGetTransformFeedbackVaryings(cur_ts, program, sizes, sizes_maxcount, sizes_count, types, types_maxcount, types_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3095,11 +3265,12 @@ static void yagl_func_glGetTransformFeedbackVaryings(struct yagl_transport *t) */ static void yagl_func_glGenQueries(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; const GLuint *ids; int32_t ids_count; yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&ids, &ids_count); YAGL_LOG_FUNC_ENTER_SPLIT1(glGenQueries, void*, ids); - (void)yagl_host_glGenQueries(ids, ids_count); + (void)yagl_host_glGenQueries(cur_ts, ids, ids_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3108,12 +3279,13 @@ static void yagl_func_glGenQueries(struct yagl_transport *t) */ static void yagl_func_glBeginQuery(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; GLuint id; target = yagl_transport_get_out_GLenum(t); id = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT2(glBeginQuery, GLenum, GLuint, target, id); - (void)yagl_host_glBeginQuery(target, id); + (void)yagl_host_glBeginQuery(cur_ts, target, id); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3122,10 +3294,11 @@ static void yagl_func_glBeginQuery(struct yagl_transport *t) */ static void yagl_func_glEndQuery(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; target = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glEndQuery, GLenum, target); - (void)yagl_host_glEndQuery(target); + (void)yagl_host_glEndQuery(cur_ts, target); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3134,6 +3307,7 @@ static void yagl_func_glEndQuery(struct yagl_transport *t) */ static void yagl_func_glGetQueryObjectuiv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint id; GLenum pname; GLuint *result; @@ -3143,7 +3317,7 @@ static void yagl_func_glGetQueryObjectuiv(struct yagl_transport *t) yagl_transport_get_in_arg(t, (void**)&result); yagl_transport_get_in_arg(t, (void**)&retval); YAGL_LOG_FUNC_ENTER_SPLIT3(glGetQueryObjectuiv, GLuint, GLenum, void*, id, pname, result); - *retval = yagl_host_glGetQueryObjectuiv(id, pname, result); + *retval = yagl_host_glGetQueryObjectuiv(cur_ts, id, pname, result); YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, *retval); } @@ -3152,11 +3326,12 @@ static void yagl_func_glGetQueryObjectuiv(struct yagl_transport *t) */ static void yagl_func_glGenSamplers(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; const GLuint *samplers; int32_t samplers_count; yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&samplers, &samplers_count); YAGL_LOG_FUNC_ENTER_SPLIT1(glGenSamplers, void*, samplers); - (void)yagl_host_glGenSamplers(samplers, samplers_count); + (void)yagl_host_glGenSamplers(cur_ts, samplers, samplers_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3165,12 +3340,13 @@ static void yagl_func_glGenSamplers(struct yagl_transport *t) */ static void yagl_func_glBindSampler(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint unit; GLuint sampler; unit = yagl_transport_get_out_GLuint(t); sampler = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT2(glBindSampler, GLuint, GLuint, unit, sampler); - (void)yagl_host_glBindSampler(unit, sampler); + (void)yagl_host_glBindSampler(cur_ts, unit, sampler); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3179,6 +3355,7 @@ static void yagl_func_glBindSampler(struct yagl_transport *t) */ static void yagl_func_glSamplerParameteri(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint sampler; GLenum pname; GLint param; @@ -3186,7 +3363,7 @@ static void yagl_func_glSamplerParameteri(struct yagl_transport *t) pname = yagl_transport_get_out_GLenum(t); param = yagl_transport_get_out_GLint(t); YAGL_LOG_FUNC_ENTER_SPLIT3(glSamplerParameteri, GLuint, GLenum, GLint, sampler, pname, param); - (void)yagl_host_glSamplerParameteri(sampler, pname, param); + (void)yagl_host_glSamplerParameteri(cur_ts, sampler, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3195,6 +3372,7 @@ static void yagl_func_glSamplerParameteri(struct yagl_transport *t) */ static void yagl_func_glSamplerParameteriv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint sampler; GLenum pname; const GLint *param; @@ -3203,7 +3381,7 @@ static void yagl_func_glSamplerParameteriv(struct yagl_transport *t) pname = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, sizeof(GLint), (const void**)¶m, ¶m_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glSamplerParameteriv, GLuint, GLenum, void*, sampler, pname, param); - (void)yagl_host_glSamplerParameteriv(sampler, pname, param, param_count); + (void)yagl_host_glSamplerParameteriv(cur_ts, sampler, pname, param, param_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3212,6 +3390,7 @@ static void yagl_func_glSamplerParameteriv(struct yagl_transport *t) */ static void yagl_func_glSamplerParameterf(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint sampler; GLenum pname; GLfloat param; @@ -3219,7 +3398,7 @@ static void yagl_func_glSamplerParameterf(struct yagl_transport *t) pname = yagl_transport_get_out_GLenum(t); param = yagl_transport_get_out_GLfloat(t); YAGL_LOG_FUNC_ENTER_SPLIT3(glSamplerParameterf, GLuint, GLenum, GLfloat, sampler, pname, param); - (void)yagl_host_glSamplerParameterf(sampler, pname, param); + (void)yagl_host_glSamplerParameterf(cur_ts, sampler, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3228,6 +3407,7 @@ static void yagl_func_glSamplerParameterf(struct yagl_transport *t) */ static void yagl_func_glSamplerParameterfv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint sampler; GLenum pname; const GLfloat *param; @@ -3236,7 +3416,7 @@ static void yagl_func_glSamplerParameterfv(struct yagl_transport *t) pname = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶m, ¶m_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glSamplerParameterfv, GLuint, GLenum, void*, sampler, pname, param); - (void)yagl_host_glSamplerParameterfv(sampler, pname, param, param_count); + (void)yagl_host_glSamplerParameterfv(cur_ts, sampler, pname, param, param_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3245,11 +3425,12 @@ static void yagl_func_glSamplerParameterfv(struct yagl_transport *t) */ static void yagl_func_glDeleteObjects(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; const GLuint *objects; int32_t objects_count; yagl_transport_get_out_array(t, sizeof(GLuint), (const void**)&objects, &objects_count); YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteObjects, void*, objects); - (void)yagl_host_glDeleteObjects(objects, objects_count); + (void)yagl_host_glDeleteObjects(cur_ts, objects, objects_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3258,10 +3439,11 @@ static void yagl_func_glDeleteObjects(struct yagl_transport *t) */ static void yagl_func_glBlendEquation(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum mode; mode = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glBlendEquation, GLenum, mode); - (void)yagl_host_glBlendEquation(mode); + (void)yagl_host_glBlendEquation(cur_ts, mode); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3270,12 +3452,13 @@ static void yagl_func_glBlendEquation(struct yagl_transport *t) */ static void yagl_func_glBlendEquationSeparate(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glBlendEquationSeparate(cur_ts, modeRGB, modeAlpha); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3284,12 +3467,13 @@ static void yagl_func_glBlendEquationSeparate(struct yagl_transport *t) */ static void yagl_func_glBlendFunc(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glBlendFunc(cur_ts, sfactor, dfactor); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3298,6 +3482,7 @@ static void yagl_func_glBlendFunc(struct yagl_transport *t) */ static void yagl_func_glBlendFuncSeparate(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum srcRGB; GLenum dstRGB; GLenum srcAlpha; @@ -3307,7 +3492,7 @@ static void yagl_func_glBlendFuncSeparate(struct yagl_transport *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); + (void)yagl_host_glBlendFuncSeparate(cur_ts, srcRGB, dstRGB, srcAlpha, dstAlpha); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3316,6 +3501,7 @@ static void yagl_func_glBlendFuncSeparate(struct yagl_transport *t) */ static void yagl_func_glBlendColor(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLclampf red; GLclampf green; GLclampf blue; @@ -3325,7 +3511,7 @@ static void yagl_func_glBlendColor(struct yagl_transport *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); + (void)yagl_host_glBlendColor(cur_ts, red, green, blue, alpha); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3334,10 +3520,11 @@ static void yagl_func_glBlendColor(struct yagl_transport *t) */ static void yagl_func_glClear(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLbitfield mask; mask = yagl_transport_get_out_GLbitfield(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glClear, GLbitfield, mask); - (void)yagl_host_glClear(mask); + (void)yagl_host_glClear(cur_ts, mask); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3346,6 +3533,7 @@ static void yagl_func_glClear(struct yagl_transport *t) */ static void yagl_func_glClearColor(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLclampf red; GLclampf green; GLclampf blue; @@ -3355,7 +3543,7 @@ static void yagl_func_glClearColor(struct yagl_transport *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); + (void)yagl_host_glClearColor(cur_ts, red, green, blue, alpha); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3364,10 +3552,11 @@ static void yagl_func_glClearColor(struct yagl_transport *t) */ static void yagl_func_glClearDepthf(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLclampf depth; depth = yagl_transport_get_out_GLclampf(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glClearDepthf, GLclampf, depth); - (void)yagl_host_glClearDepthf(depth); + (void)yagl_host_glClearDepthf(cur_ts, depth); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3376,10 +3565,11 @@ static void yagl_func_glClearDepthf(struct yagl_transport *t) */ static void yagl_func_glClearStencil(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLint s; s = yagl_transport_get_out_GLint(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glClearStencil, GLint, s); - (void)yagl_host_glClearStencil(s); + (void)yagl_host_glClearStencil(cur_ts, s); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3388,6 +3578,7 @@ static void yagl_func_glClearStencil(struct yagl_transport *t) */ static void yagl_func_glColorMask(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean red; GLboolean green; GLboolean blue; @@ -3397,7 +3588,7 @@ static void yagl_func_glColorMask(struct yagl_transport *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); + (void)yagl_host_glColorMask(cur_ts, red, green, blue, alpha); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3406,10 +3597,11 @@ static void yagl_func_glColorMask(struct yagl_transport *t) */ static void yagl_func_glCullFace(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum mode; mode = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glCullFace, GLenum, mode); - (void)yagl_host_glCullFace(mode); + (void)yagl_host_glCullFace(cur_ts, mode); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3418,10 +3610,11 @@ static void yagl_func_glCullFace(struct yagl_transport *t) */ static void yagl_func_glDepthFunc(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum func; func = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glDepthFunc, GLenum, func); - (void)yagl_host_glDepthFunc(func); + (void)yagl_host_glDepthFunc(cur_ts, func); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3430,10 +3623,11 @@ static void yagl_func_glDepthFunc(struct yagl_transport *t) */ static void yagl_func_glDepthMask(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLboolean flag; flag = yagl_transport_get_out_GLboolean(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glDepthMask, GLboolean, flag); - (void)yagl_host_glDepthMask(flag); + (void)yagl_host_glDepthMask(cur_ts, flag); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3442,12 +3636,13 @@ static void yagl_func_glDepthMask(struct yagl_transport *t) */ static void yagl_func_glDepthRangef(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glDepthRangef(cur_ts, zNear, zFar); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3456,10 +3651,11 @@ static void yagl_func_glDepthRangef(struct yagl_transport *t) */ static void yagl_func_glEnable(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum cap; cap = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glEnable, GLenum, cap); - (void)yagl_host_glEnable(cap); + (void)yagl_host_glEnable(cur_ts, cap); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3468,10 +3664,11 @@ static void yagl_func_glEnable(struct yagl_transport *t) */ static void yagl_func_glDisable(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum cap; cap = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glDisable, GLenum, cap); - (void)yagl_host_glDisable(cap); + (void)yagl_host_glDisable(cur_ts, cap); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3480,8 +3677,9 @@ static void yagl_func_glDisable(struct yagl_transport *t) */ static void yagl_func_glFlush(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; YAGL_LOG_FUNC_ENTER_SPLIT0(glFlush); - (void)yagl_host_glFlush(); + (void)yagl_host_glFlush(cur_ts); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3490,10 +3688,11 @@ static void yagl_func_glFlush(struct yagl_transport *t) */ static void yagl_func_glFrontFace(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum mode; mode = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glFrontFace, GLenum, mode); - (void)yagl_host_glFrontFace(mode); + (void)yagl_host_glFrontFace(cur_ts, mode); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3502,10 +3701,11 @@ static void yagl_func_glFrontFace(struct yagl_transport *t) */ static void yagl_func_glGenerateMipmap(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum target; target = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glGenerateMipmap, GLenum, target); - (void)yagl_host_glGenerateMipmap(target); + (void)yagl_host_glGenerateMipmap(cur_ts, target); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3514,12 +3714,13 @@ static void yagl_func_glGenerateMipmap(struct yagl_transport *t) */ static void yagl_func_glHint(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glHint(cur_ts, target, mode); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3528,10 +3729,11 @@ static void yagl_func_glHint(struct yagl_transport *t) */ static void yagl_func_glLineWidth(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLfloat width; width = yagl_transport_get_out_GLfloat(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glLineWidth, GLfloat, width); - (void)yagl_host_glLineWidth(width); + (void)yagl_host_glLineWidth(cur_ts, width); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3540,12 +3742,13 @@ static void yagl_func_glLineWidth(struct yagl_transport *t) */ static void yagl_func_glPixelStorei(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glPixelStorei(cur_ts, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3554,12 +3757,13 @@ static void yagl_func_glPixelStorei(struct yagl_transport *t) */ static void yagl_func_glPolygonOffset(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glPolygonOffset(cur_ts, factor, units); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3568,6 +3772,7 @@ static void yagl_func_glPolygonOffset(struct yagl_transport *t) */ static void yagl_func_glScissor(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLint x; GLint y; GLsizei width; @@ -3577,7 +3782,7 @@ static void yagl_func_glScissor(struct yagl_transport *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); + (void)yagl_host_glScissor(cur_ts, x, y, width, height); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3586,6 +3791,7 @@ static void yagl_func_glScissor(struct yagl_transport *t) */ static void yagl_func_glStencilFunc(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum func; GLint ref; GLuint mask; @@ -3593,7 +3799,7 @@ static void yagl_func_glStencilFunc(struct yagl_transport *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); + (void)yagl_host_glStencilFunc(cur_ts, func, ref, mask); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3602,10 +3808,11 @@ static void yagl_func_glStencilFunc(struct yagl_transport *t) */ static void yagl_func_glStencilMask(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint mask; mask = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glStencilMask, GLuint, mask); - (void)yagl_host_glStencilMask(mask); + (void)yagl_host_glStencilMask(cur_ts, mask); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3614,6 +3821,7 @@ static void yagl_func_glStencilMask(struct yagl_transport *t) */ static void yagl_func_glStencilOp(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum fail; GLenum zfail; GLenum zpass; @@ -3621,7 +3829,7 @@ static void yagl_func_glStencilOp(struct yagl_transport *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); + (void)yagl_host_glStencilOp(cur_ts, fail, zfail, zpass); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3630,12 +3838,13 @@ static void yagl_func_glStencilOp(struct yagl_transport *t) */ static void yagl_func_glSampleCoverage(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glSampleCoverage(cur_ts, value, invert); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3644,6 +3853,7 @@ static void yagl_func_glSampleCoverage(struct yagl_transport *t) */ static void yagl_func_glViewport(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLint x; GLint y; GLsizei width; @@ -3653,7 +3863,7 @@ static void yagl_func_glViewport(struct yagl_transport *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); + (void)yagl_host_glViewport(cur_ts, x, y, width, height); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3662,6 +3872,7 @@ static void yagl_func_glViewport(struct yagl_transport *t) */ static void yagl_func_glStencilFuncSeparate(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum face; GLenum func; GLint ref; @@ -3671,7 +3882,7 @@ static void yagl_func_glStencilFuncSeparate(struct yagl_transport *t) ref = yagl_transport_get_out_GLint(t); mask = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT4(glStencilFuncSeparate, GLenum, GLenum, GLint, GLuint, face, func, ref, mask); - (void)yagl_host_glStencilFuncSeparate(face, func, ref, mask); + (void)yagl_host_glStencilFuncSeparate(cur_ts, face, func, ref, mask); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3680,12 +3891,13 @@ static void yagl_func_glStencilFuncSeparate(struct yagl_transport *t) */ static void yagl_func_glStencilMaskSeparate(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum face; GLuint mask; face = yagl_transport_get_out_GLenum(t); mask = yagl_transport_get_out_GLuint(t); YAGL_LOG_FUNC_ENTER_SPLIT2(glStencilMaskSeparate, GLenum, GLuint, face, mask); - (void)yagl_host_glStencilMaskSeparate(face, mask); + (void)yagl_host_glStencilMaskSeparate(cur_ts, face, mask); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3694,6 +3906,7 @@ static void yagl_func_glStencilMaskSeparate(struct yagl_transport *t) */ static void yagl_func_glStencilOpSeparate(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum face; GLenum fail; GLenum zfail; @@ -3703,7 +3916,7 @@ static void yagl_func_glStencilOpSeparate(struct yagl_transport *t) zfail = yagl_transport_get_out_GLenum(t); zpass = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT4(glStencilOpSeparate, GLenum, GLenum, GLenum, GLenum, face, fail, zfail, zpass); - (void)yagl_host_glStencilOpSeparate(face, fail, zfail, zpass); + (void)yagl_host_glStencilOpSeparate(cur_ts, face, fail, zfail, zpass); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3712,10 +3925,11 @@ static void yagl_func_glStencilOpSeparate(struct yagl_transport *t) */ static void yagl_func_glPointSize(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLfloat size; size = yagl_transport_get_out_GLfloat(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glPointSize, GLfloat, size); - (void)yagl_host_glPointSize(size); + (void)yagl_host_glPointSize(cur_ts, size); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3724,12 +3938,13 @@ static void yagl_func_glPointSize(struct yagl_transport *t) */ static void yagl_func_glAlphaFunc(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glAlphaFunc(cur_ts, func, ref); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3738,10 +3953,11 @@ static void yagl_func_glAlphaFunc(struct yagl_transport *t) */ static void yagl_func_glMatrixMode(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum mode; mode = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glMatrixMode, GLenum, mode); - (void)yagl_host_glMatrixMode(mode); + (void)yagl_host_glMatrixMode(cur_ts, mode); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3750,8 +3966,9 @@ static void yagl_func_glMatrixMode(struct yagl_transport *t) */ static void yagl_func_glLoadIdentity(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; YAGL_LOG_FUNC_ENTER_SPLIT0(glLoadIdentity); - (void)yagl_host_glLoadIdentity(); + (void)yagl_host_glLoadIdentity(cur_ts); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3760,8 +3977,9 @@ static void yagl_func_glLoadIdentity(struct yagl_transport *t) */ static void yagl_func_glPopMatrix(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; YAGL_LOG_FUNC_ENTER_SPLIT0(glPopMatrix); - (void)yagl_host_glPopMatrix(); + (void)yagl_host_glPopMatrix(cur_ts); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3770,8 +3988,9 @@ static void yagl_func_glPopMatrix(struct yagl_transport *t) */ static void yagl_func_glPushMatrix(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; YAGL_LOG_FUNC_ENTER_SPLIT0(glPushMatrix); - (void)yagl_host_glPushMatrix(); + (void)yagl_host_glPushMatrix(cur_ts); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3780,6 +3999,7 @@ static void yagl_func_glPushMatrix(struct yagl_transport *t) */ static void yagl_func_glRotatef(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLfloat angle; GLfloat x; GLfloat y; @@ -3789,7 +4009,7 @@ static void yagl_func_glRotatef(struct yagl_transport *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); + (void)yagl_host_glRotatef(cur_ts, angle, x, y, z); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3798,6 +4018,7 @@ static void yagl_func_glRotatef(struct yagl_transport *t) */ static void yagl_func_glTranslatef(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLfloat x; GLfloat y; GLfloat z; @@ -3805,7 +4026,7 @@ static void yagl_func_glTranslatef(struct yagl_transport *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); + (void)yagl_host_glTranslatef(cur_ts, x, y, z); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3814,6 +4035,7 @@ static void yagl_func_glTranslatef(struct yagl_transport *t) */ static void yagl_func_glScalef(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLfloat x; GLfloat y; GLfloat z; @@ -3821,7 +4043,7 @@ static void yagl_func_glScalef(struct yagl_transport *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); + (void)yagl_host_glScalef(cur_ts, x, y, z); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3830,6 +4052,7 @@ static void yagl_func_glScalef(struct yagl_transport *t) */ static void yagl_func_glOrthof(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLfloat left; GLfloat right; GLfloat bottom; @@ -3843,7 +4066,7 @@ static void yagl_func_glOrthof(struct yagl_transport *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); + (void)yagl_host_glOrthof(cur_ts, left, right, bottom, top, zNear, zFar); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3852,6 +4075,7 @@ static void yagl_func_glOrthof(struct yagl_transport *t) */ static void yagl_func_glColor4f(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLfloat red; GLfloat green; GLfloat blue; @@ -3861,7 +4085,7 @@ static void yagl_func_glColor4f(struct yagl_transport *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); + (void)yagl_host_glColor4f(cur_ts, red, green, blue, alpha); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3870,6 +4094,7 @@ static void yagl_func_glColor4f(struct yagl_transport *t) */ static void yagl_func_glColor4ub(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLubyte red; GLubyte green; GLubyte blue; @@ -3879,7 +4104,7 @@ static void yagl_func_glColor4ub(struct yagl_transport *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); + (void)yagl_host_glColor4ub(cur_ts, red, green, blue, alpha); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3888,6 +4113,7 @@ static void yagl_func_glColor4ub(struct yagl_transport *t) */ static void yagl_func_glNormal3f(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLfloat nx; GLfloat ny; GLfloat nz; @@ -3895,7 +4121,7 @@ static void yagl_func_glNormal3f(struct yagl_transport *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); + (void)yagl_host_glNormal3f(cur_ts, nx, ny, nz); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3904,12 +4130,13 @@ static void yagl_func_glNormal3f(struct yagl_transport *t) */ static void yagl_func_glPointParameterf(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glPointParameterf(cur_ts, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3918,13 +4145,14 @@ static void yagl_func_glPointParameterf(struct yagl_transport *t) */ static void yagl_func_glPointParameterfv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum pname; const GLfloat *params; int32_t params_count; pname = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glPointParameterfv, GLenum, void*, pname, params); - (void)yagl_host_glPointParameterfv(pname, params, params_count); + (void)yagl_host_glPointParameterfv(cur_ts, pname, params, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3933,12 +4161,13 @@ static void yagl_func_glPointParameterfv(struct yagl_transport *t) */ static void yagl_func_glFogf(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glFogf(cur_ts, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3947,13 +4176,14 @@ static void yagl_func_glFogf(struct yagl_transport *t) */ static void yagl_func_glFogfv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum pname; const GLfloat *params; int32_t params_count; pname = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glFogfv, GLenum, void*, pname, params); - (void)yagl_host_glFogfv(pname, params, params_count); + (void)yagl_host_glFogfv(cur_ts, pname, params, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3962,6 +4192,7 @@ static void yagl_func_glFogfv(struct yagl_transport *t) */ static void yagl_func_glFrustumf(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLfloat left; GLfloat right; GLfloat bottom; @@ -3975,7 +4206,7 @@ static void yagl_func_glFrustumf(struct yagl_transport *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); + (void)yagl_host_glFrustumf(cur_ts, left, right, bottom, top, zNear, zFar); YAGL_LOG_FUNC_EXIT(NULL); } @@ -3984,6 +4215,7 @@ static void yagl_func_glFrustumf(struct yagl_transport *t) */ static void yagl_func_glLightf(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum light; GLenum pname; GLfloat param; @@ -3991,7 +4223,7 @@ static void yagl_func_glLightf(struct yagl_transport *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); + (void)yagl_host_glLightf(cur_ts, light, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4000,6 +4232,7 @@ static void yagl_func_glLightf(struct yagl_transport *t) */ static void yagl_func_glLightfv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum light; GLenum pname; const GLfloat *params; @@ -4008,7 +4241,7 @@ static void yagl_func_glLightfv(struct yagl_transport *t) pname = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glLightfv, GLenum, GLenum, void*, light, pname, params); - (void)yagl_host_glLightfv(light, pname, params, params_count); + (void)yagl_host_glLightfv(cur_ts, light, pname, params, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4017,6 +4250,7 @@ static void yagl_func_glLightfv(struct yagl_transport *t) */ static void yagl_func_glGetLightfv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum light; GLenum pname; GLfloat *params; @@ -4027,7 +4261,7 @@ static void yagl_func_glGetLightfv(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glGetLightfv, GLenum, GLenum, void*, light, pname, params); *params_count = 0; - (void)yagl_host_glGetLightfv(light, pname, params, params_maxcount, params_count); + (void)yagl_host_glGetLightfv(cur_ts, light, pname, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4036,12 +4270,13 @@ static void yagl_func_glGetLightfv(struct yagl_transport *t) */ static void yagl_func_glLightModelf(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; 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); + (void)yagl_host_glLightModelf(cur_ts, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4050,13 +4285,14 @@ static void yagl_func_glLightModelf(struct yagl_transport *t) */ static void yagl_func_glLightModelfv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum pname; const GLfloat *params; int32_t params_count; pname = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glLightModelfv, GLenum, void*, pname, params); - (void)yagl_host_glLightModelfv(pname, params, params_count); + (void)yagl_host_glLightModelfv(cur_ts, pname, params, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4065,6 +4301,7 @@ static void yagl_func_glLightModelfv(struct yagl_transport *t) */ static void yagl_func_glMaterialf(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum face; GLenum pname; GLfloat param; @@ -4072,7 +4309,7 @@ static void yagl_func_glMaterialf(struct yagl_transport *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); + (void)yagl_host_glMaterialf(cur_ts, face, pname, param); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4081,6 +4318,7 @@ static void yagl_func_glMaterialf(struct yagl_transport *t) */ static void yagl_func_glMaterialfv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum face; GLenum pname; const GLfloat *params; @@ -4089,7 +4327,7 @@ static void yagl_func_glMaterialfv(struct yagl_transport *t) pname = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)¶ms, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glMaterialfv, GLenum, GLenum, void*, face, pname, params); - (void)yagl_host_glMaterialfv(face, pname, params, params_count); + (void)yagl_host_glMaterialfv(cur_ts, face, pname, params, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4098,6 +4336,7 @@ static void yagl_func_glMaterialfv(struct yagl_transport *t) */ static void yagl_func_glGetMaterialfv(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum face; GLenum pname; GLfloat *params; @@ -4108,7 +4347,7 @@ static void yagl_func_glGetMaterialfv(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)¶ms, ¶ms_maxcount, ¶ms_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glGetMaterialfv, GLenum, GLenum, void*, face, pname, params); *params_count = 0; - (void)yagl_host_glGetMaterialfv(face, pname, params, params_maxcount, params_count); + (void)yagl_host_glGetMaterialfv(cur_ts, face, pname, params, params_maxcount, params_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4117,10 +4356,11 @@ static void yagl_func_glGetMaterialfv(struct yagl_transport *t) */ static void yagl_func_glShadeModel(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum mode; mode = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glShadeModel, GLenum, mode); - (void)yagl_host_glShadeModel(mode); + (void)yagl_host_glShadeModel(cur_ts, mode); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4129,10 +4369,11 @@ static void yagl_func_glShadeModel(struct yagl_transport *t) */ static void yagl_func_glLogicOp(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum opcode; opcode = yagl_transport_get_out_GLenum(t); YAGL_LOG_FUNC_ENTER_SPLIT1(glLogicOp, GLenum, opcode); - (void)yagl_host_glLogicOp(opcode); + (void)yagl_host_glLogicOp(cur_ts, opcode); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4141,11 +4382,12 @@ static void yagl_func_glLogicOp(struct yagl_transport *t) */ static void yagl_func_glMultMatrixf(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; const GLfloat *m; int32_t m_count; yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&m, &m_count); YAGL_LOG_FUNC_ENTER_SPLIT1(glMultMatrixf, void*, m); - (void)yagl_host_glMultMatrixf(m, m_count); + (void)yagl_host_glMultMatrixf(cur_ts, m, m_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4154,11 +4396,12 @@ static void yagl_func_glMultMatrixf(struct yagl_transport *t) */ static void yagl_func_glLoadMatrixf(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; const GLfloat *m; int32_t m_count; yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&m, &m_count); YAGL_LOG_FUNC_ENTER_SPLIT1(glLoadMatrixf, void*, m); - (void)yagl_host_glLoadMatrixf(m, m_count); + (void)yagl_host_glLoadMatrixf(cur_ts, m, m_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4167,13 +4410,14 @@ static void yagl_func_glLoadMatrixf(struct yagl_transport *t) */ static void yagl_func_glClipPlanef(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum plane; const GLfloat *equation; int32_t equation_count; plane = yagl_transport_get_out_GLenum(t); yagl_transport_get_out_array(t, sizeof(GLfloat), (const void**)&equation, &equation_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glClipPlanef, GLenum, void*, plane, equation); - (void)yagl_host_glClipPlanef(plane, equation, equation_count); + (void)yagl_host_glClipPlanef(cur_ts, plane, equation, equation_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4182,6 +4426,7 @@ static void yagl_func_glClipPlanef(struct yagl_transport *t) */ static void yagl_func_glGetClipPlanef(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLenum pname; GLfloat *eqn; int32_t eqn_maxcount; @@ -4190,7 +4435,7 @@ static void yagl_func_glGetClipPlanef(struct yagl_transport *t) yagl_transport_get_in_array(t, sizeof(GLfloat), (void**)&eqn, &eqn_maxcount, &eqn_count); YAGL_LOG_FUNC_ENTER_SPLIT2(glGetClipPlanef, GLenum, void*, pname, eqn); *eqn_count = 0; - (void)yagl_host_glGetClipPlanef(pname, eqn, eqn_maxcount, eqn_count); + (void)yagl_host_glGetClipPlanef(cur_ts, pname, eqn, eqn_maxcount, eqn_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4199,6 +4444,7 @@ static void yagl_func_glGetClipPlanef(struct yagl_transport *t) */ static void yagl_func_glUpdateOffscreenImageYAGL(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; GLuint texture; uint32_t width; uint32_t height; @@ -4211,7 +4457,7 @@ static void yagl_func_glUpdateOffscreenImageYAGL(struct yagl_transport *t) bpp = yagl_transport_get_out_uint32_t(t); yagl_transport_get_out_array(t, 1, (const void**)&pixels, &pixels_count); YAGL_LOG_FUNC_ENTER_SPLIT5(glUpdateOffscreenImageYAGL, GLuint, uint32_t, uint32_t, uint32_t, void*, texture, width, height, bpp, pixels); - (void)yagl_host_glUpdateOffscreenImageYAGL(texture, width, height, bpp, pixels, pixels_count); + (void)yagl_host_glUpdateOffscreenImageYAGL(cur_ts, texture, width, height, bpp, pixels, pixels_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4220,6 +4466,7 @@ static void yagl_func_glUpdateOffscreenImageYAGL(struct yagl_transport *t) */ static void yagl_func_glGenUniformLocationYAGL(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; uint32_t location; GLuint program; const GLchar *name; @@ -4228,7 +4475,7 @@ static void yagl_func_glGenUniformLocationYAGL(struct yagl_transport *t) program = yagl_transport_get_out_GLuint(t); yagl_transport_get_out_array(t, sizeof(GLchar), (const void**)&name, &name_count); YAGL_LOG_FUNC_ENTER_SPLIT3(glGenUniformLocationYAGL, uint32_t, GLuint, void*, location, program, name); - (void)yagl_host_glGenUniformLocationYAGL(location, program, name, name_count); + (void)yagl_host_glGenUniformLocationYAGL(cur_ts, location, program, name, name_count); YAGL_LOG_FUNC_EXIT(NULL); } @@ -4237,11 +4484,12 @@ static void yagl_func_glGenUniformLocationYAGL(struct yagl_transport *t) */ static void yagl_func_glDeleteUniformLocationsYAGL(struct yagl_transport *t) { + struct yagl_thread_state *cur_ts = t->ts; const uint32_t *locations; int32_t locations_count; yagl_transport_get_out_array(t, sizeof(uint32_t), (const void**)&locations, &locations_count); YAGL_LOG_FUNC_ENTER_SPLIT1(glDeleteUniformLocationsYAGL, void*, locations); - (void)yagl_host_glDeleteUniformLocationsYAGL(locations, locations_count); + (void)yagl_host_glDeleteUniformLocationsYAGL(cur_ts, locations, locations_count); YAGL_LOG_FUNC_EXIT(NULL); } diff --git a/hw/yagl/yagl_apis/gles/yagl_host_gles_calls.c b/hw/yagl/yagl_apis/gles/yagl_host_gles_calls.c index 93bc7ac977..09131dc566 100644 --- a/hw/yagl/yagl_apis/gles/yagl_host_gles_calls.c +++ b/hw/yagl/yagl_apis/gles/yagl_host_gles_calls.c @@ -33,7 +33,6 @@ #include "yagl_gles_driver.h" #include "yagl_gles_api_ps.h" #include "yagl_gles_api_ts.h" -#include "yagl_tls.h" #include "yagl_log.h" #include "yagl_process.h" #include "yagl_thread.h" @@ -41,8 +40,6 @@ #include "yagl_object_map.h" #include "yagl_transport.h" -static YAGL_DEFINE_TLS(struct yagl_gles_api_ts*, gles_api_ts); - struct yagl_gles_object { struct yagl_object base; @@ -61,7 +58,8 @@ typedef enum yagl_gles1_array_texcoord, } yagl_gles1_array_type; -static GLuint yagl_gles_bind_array(uint32_t indx, +static GLuint yagl_gles_bind_array(struct yagl_thread_state *cur_ts, + uint32_t indx, GLint first, GLsizei stride, const GLvoid *data, @@ -70,6 +68,7 @@ static GLuint yagl_gles_bind_array(uint32_t indx, GLuint current_vbo; uint32_t size; void *ptr; + struct yagl_gles_api_ts *gles_api_ts = cur_ts->gles_api_ts; YAGL_LOG_FUNC_SET(yagl_gles_bind_array); @@ -94,10 +93,10 @@ static GLuint yagl_gles_bind_array(uint32_t indx, gles_api_ts->num_arrays = indx + 1; } - gles_api_ts->driver->GetIntegerv(GL_ARRAY_BUFFER_BINDING, + cur_ts->gles_api_ts->driver->GetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint*)¤t_vbo); - gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, gles_api_ts->arrays[indx].vbo); + cur_ts->gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, gles_api_ts->arrays[indx].vbo); size = first * stride + data_count; @@ -141,10 +140,12 @@ static GLuint yagl_gles_bind_array(uint32_t indx, return current_vbo; } -static GLuint yagl_gles_bind_ebo(const GLvoid *data, int32_t size) +static GLuint yagl_gles_bind_ebo(struct yagl_thread_state *cur_ts, + const GLvoid *data, int32_t size) { GLuint current_ebo; void *ptr; + struct yagl_gles_api_ts *gles_api_ts = cur_ts->gles_api_ts; YAGL_LOG_FUNC_SET(yagl_gles_bind_ebo); @@ -152,10 +153,10 @@ static GLuint yagl_gles_bind_ebo(const GLvoid *data, int32_t size) gles_api_ts->driver->GenBuffers(1, &gles_api_ts->ebo); } - gles_api_ts->driver->GetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, + cur_ts->gles_api_ts->driver->GetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING, (GLint*)¤t_ebo); - gles_api_ts->driver->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, gles_api_ts->ebo); + cur_ts->gles_api_ts->driver->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, gles_api_ts->ebo); if (size > gles_api_ts->ebo_size) { gles_api_ts->driver->BufferData(GL_ELEMENT_ARRAY_BUFFER, @@ -195,7 +196,8 @@ static GLuint yagl_gles_bind_ebo(const GLvoid *data, int32_t size) return current_ebo; } -static bool yagl_gles_program_get_uniform_type(GLuint program, +static bool yagl_gles_program_get_uniform_type(struct yagl_thread_state *cur_ts, + GLuint program, GLint location, GLenum *type) { @@ -204,6 +206,7 @@ static bool yagl_gles_program_get_uniform_type(GLuint program, GLint uniform_name_max_length = 0; GLchar *uniform_name = NULL; bool res = false; + struct yagl_gles_api_ts *gles_api_ts = cur_ts->gles_api_ts; YAGL_LOG_FUNC_SET(yagl_gles_program_get_uniform_type); @@ -211,7 +214,7 @@ static bool yagl_gles_program_get_uniform_type(GLuint program, return false; } - gles_api_ts->driver->GetProgramiv(program, + cur_ts->gles_api_ts->driver->GetProgramiv(program, GL_LINK_STATUS, &link_status); @@ -219,11 +222,11 @@ static bool yagl_gles_program_get_uniform_type(GLuint program, return false; } - gles_api_ts->driver->GetProgramiv(program, + cur_ts->gles_api_ts->driver->GetProgramiv(program, GL_ACTIVE_UNIFORMS, &num_active_uniforms); - gles_api_ts->driver->GetProgramiv(program, + cur_ts->gles_api_ts->driver->GetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &uniform_name_max_length); @@ -317,10 +320,11 @@ static bool yagl_gles_get_array_param_count(GLenum pname, int *count) return true; } -static void yagl_gles_object_add(GLuint local_name, +static void yagl_gles_object_add(struct yagl_thread_state *cur_ts, + GLuint local_name, GLuint global_name, uint32_t ctx_id, - void (*destroy_func)(struct yagl_object */*obj*/)) + yagl_object_destroy_func destroy_func) { struct yagl_gles_object *obj; @@ -328,7 +332,7 @@ static void yagl_gles_object_add(GLuint local_name, obj->base.global_name = global_name; obj->base.destroy = destroy_func; - obj->driver = gles_api_ts->driver; + obj->driver = cur_ts->gles_api_ts->driver; obj->ctx_id = ctx_id; yagl_object_map_add(cur_ts->ps->object_map, @@ -336,157 +340,168 @@ static void yagl_gles_object_add(GLuint local_name, &obj->base); } -static void yagl_gles_buffer_destroy(struct yagl_object *obj) +static void yagl_gles_buffer_destroy(struct yagl_thread_state *cur_ts, + struct yagl_object *obj) { struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; YAGL_LOG_FUNC_ENTER(yagl_gles_buffer_destroy, "%u", obj->global_name); - yagl_ensure_ctx(0); + yagl_ensure_ctx(cur_ts, 0); gles_obj->driver->DeleteBuffers(1, &obj->global_name); - yagl_unensure_ctx(0); + yagl_unensure_ctx(cur_ts, 0); g_free(gles_obj); YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_gles_texture_destroy(struct yagl_object *obj) +static void yagl_gles_texture_destroy(struct yagl_thread_state *cur_ts, + struct yagl_object *obj) { struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; YAGL_LOG_FUNC_ENTER(yagl_gles_texture_destroy, "%u", obj->global_name); - yagl_ensure_ctx(0); + yagl_ensure_ctx(cur_ts, 0); gles_obj->driver->DeleteTextures(1, &obj->global_name); - yagl_unensure_ctx(0); + yagl_unensure_ctx(cur_ts, 0); g_free(gles_obj); YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_gles_framebuffer_destroy(struct yagl_object *obj) +static void yagl_gles_framebuffer_destroy(struct yagl_thread_state *cur_ts, + struct yagl_object *obj) { struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; YAGL_LOG_FUNC_ENTER(yagl_gles_framebuffer_destroy, "%u", obj->global_name); - yagl_ensure_ctx(gles_obj->ctx_id); + yagl_ensure_ctx(cur_ts, gles_obj->ctx_id); gles_obj->driver->DeleteFramebuffers(1, &obj->global_name); - yagl_unensure_ctx(gles_obj->ctx_id); + yagl_unensure_ctx(cur_ts, gles_obj->ctx_id); g_free(gles_obj); YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_gles_renderbuffer_destroy(struct yagl_object *obj) +static void yagl_gles_renderbuffer_destroy(struct yagl_thread_state *cur_ts, + struct yagl_object *obj) { struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; YAGL_LOG_FUNC_ENTER(yagl_gles_renderbuffer_destroy, "%u", obj->global_name); - yagl_ensure_ctx(0); + yagl_ensure_ctx(cur_ts, 0); gles_obj->driver->DeleteRenderbuffers(1, &obj->global_name); - yagl_unensure_ctx(0); + yagl_unensure_ctx(cur_ts, 0); g_free(gles_obj); YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_gles_program_destroy(struct yagl_object *obj) +static void yagl_gles_program_destroy(struct yagl_thread_state *cur_ts, + struct yagl_object *obj) { struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; YAGL_LOG_FUNC_ENTER(yagl_gles_program_destroy, "%u", obj->global_name); - yagl_ensure_ctx(0); + yagl_ensure_ctx(cur_ts, 0); gles_obj->driver->DeleteProgram(obj->global_name); - yagl_unensure_ctx(0); + yagl_unensure_ctx(cur_ts, 0); g_free(gles_obj); YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_gles_shader_destroy(struct yagl_object *obj) +static void yagl_gles_shader_destroy(struct yagl_thread_state *cur_ts, + struct yagl_object *obj) { struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; YAGL_LOG_FUNC_ENTER(yagl_gles_shader_destroy, "%u", obj->global_name); - yagl_ensure_ctx(0); + yagl_ensure_ctx(cur_ts, 0); gles_obj->driver->DeleteShader(obj->global_name); - yagl_unensure_ctx(0); + yagl_unensure_ctx(cur_ts, 0); g_free(gles_obj); YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_gles_vertex_array_destroy(struct yagl_object *obj) +static void yagl_gles_vertex_array_destroy(struct yagl_thread_state *cur_ts, + struct yagl_object *obj) { struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; YAGL_LOG_FUNC_ENTER(yagl_gles_vertex_array_destroy, "%u", obj->global_name); - yagl_ensure_ctx(gles_obj->ctx_id); + yagl_ensure_ctx(cur_ts, gles_obj->ctx_id); gles_obj->driver->DeleteVertexArrays(1, &obj->global_name); - yagl_unensure_ctx(gles_obj->ctx_id); + yagl_unensure_ctx(cur_ts, gles_obj->ctx_id); g_free(gles_obj); YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_gles_transform_feedback_destroy(struct yagl_object *obj) +static void yagl_gles_transform_feedback_destroy(struct yagl_thread_state *cur_ts, + struct yagl_object *obj) { struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; YAGL_LOG_FUNC_ENTER(yagl_gles_transform_feedback_destroy, "%u", obj->global_name); - yagl_ensure_ctx(gles_obj->ctx_id); + yagl_ensure_ctx(cur_ts, gles_obj->ctx_id); gles_obj->driver->DeleteTransformFeedbacks(1, &obj->global_name); - yagl_unensure_ctx(gles_obj->ctx_id); + yagl_unensure_ctx(cur_ts, gles_obj->ctx_id); g_free(gles_obj); YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_gles_query_destroy(struct yagl_object *obj) +static void yagl_gles_query_destroy(struct yagl_thread_state *cur_ts, + struct yagl_object *obj) { struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; YAGL_LOG_FUNC_ENTER(yagl_gles_query_destroy, "%u", obj->global_name); - yagl_ensure_ctx(gles_obj->ctx_id); + yagl_ensure_ctx(cur_ts, gles_obj->ctx_id); gles_obj->driver->DeleteQueries(1, &obj->global_name); - yagl_unensure_ctx(gles_obj->ctx_id); + yagl_unensure_ctx(cur_ts, gles_obj->ctx_id); g_free(gles_obj); YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_gles_sampler_destroy(struct yagl_object *obj) +static void yagl_gles_sampler_destroy(struct yagl_thread_state *cur_ts, + struct yagl_object *obj) { struct yagl_gles_object *gles_obj = (struct yagl_gles_object*)obj; YAGL_LOG_FUNC_ENTER(yagl_gles_sampler_destroy, "%u", obj->global_name); - yagl_ensure_ctx(0); + yagl_ensure_ctx(cur_ts, 0); gles_obj->driver->DeleteSamplers(1, &obj->global_name); - yagl_unensure_ctx(0); + yagl_unensure_ctx(cur_ts, 0); g_free(gles_obj); YAGL_LOG_FUNC_EXIT(NULL); } -static __inline GLuint yagl_gles_object_get(GLuint local_name) +static __inline GLuint yagl_gles_object_get(struct yagl_thread_state *cur_ts, + GLuint local_name) { return (local_name > 0) ? yagl_object_map_get(cur_ts->ps->object_map, local_name) : 0; } @@ -501,46 +516,46 @@ static yagl_api_func yagl_host_gles_get_func(struct yagl_api_ps *api_ps, } } -static void yagl_host_gles_thread_init(struct yagl_api_ps *api_ps) +static void yagl_host_gles_thread_init(struct yagl_thread_state *cur_ts, + struct yagl_api_ps *api_ps) { struct yagl_gles_api_ps *gles_api_ps = (struct yagl_gles_api_ps*)api_ps; YAGL_LOG_FUNC_ENTER(yagl_host_gles_thread_init, NULL); - gles_api_ts = g_malloc0(sizeof(*gles_api_ts)); - - yagl_gles_api_ts_init(gles_api_ts, gles_api_ps->driver, gles_api_ps); + cur_ts->gles_api_ts = g_malloc0(sizeof(struct yagl_gles_api_ts)); - cur_ts->gles_api_ts = gles_api_ts; + yagl_gles_api_ts_init(cur_ts, cur_ts->gles_api_ts, gles_api_ps->driver, gles_api_ps); YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_host_gles_batch_start(struct yagl_api_ps *api_ps) +static void yagl_host_gles_batch_start(struct yagl_thread_state *cur_ts, + struct yagl_api_ps *api_ps) { - gles_api_ts = cur_ts->gles_api_ts; } -static void yagl_host_gles_batch_end(struct yagl_api_ps *api_ps) +static void yagl_host_gles_batch_end(struct yagl_thread_state *cur_ts, + struct yagl_api_ps *api_ps) { } -static void yagl_host_gles_thread_fini(struct yagl_api_ps *api_ps) +static void yagl_host_gles_thread_fini(struct yagl_thread_state *cur_ts, + struct yagl_api_ps *api_ps) { YAGL_LOG_FUNC_ENTER(yagl_host_gles_thread_fini, NULL); - gles_api_ts = cur_ts->gles_api_ts; - - yagl_gles_api_ts_cleanup(gles_api_ts); + yagl_gles_api_ts_cleanup(cur_ts, cur_ts->gles_api_ts); - g_free(gles_api_ts); + g_free(cur_ts->gles_api_ts); - gles_api_ts = cur_ts->gles_api_ts = NULL; + cur_ts->gles_api_ts = NULL; YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_host_gles_process_destroy(struct yagl_api_ps *api_ps) +static void yagl_host_gles_process_destroy(struct yagl_thread_state *cur_ts, + struct yagl_api_ps *api_ps) { struct yagl_gles_api_ps *gles_api_ps = (struct yagl_gles_api_ps*)api_ps; @@ -554,10 +569,12 @@ static void yagl_host_gles_process_destroy(struct yagl_api_ps *api_ps) YAGL_LOG_FUNC_EXIT(NULL); } -struct yagl_api_ps *yagl_host_gles_process_init(struct yagl_api *api) +struct yagl_api_ps *yagl_host_gles_process_init(struct yagl_process_state *ps, + struct yagl_api *api) { struct yagl_gles_api *gles_api = (struct yagl_gles_api*)api; struct yagl_gles_api_ps *gles_api_ps; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_host_gles_process_init, NULL); @@ -579,31 +596,34 @@ struct yagl_api_ps *yagl_host_gles_process_init(struct yagl_api *api) return &gles_api_ps->base; } -void yagl_host_glDrawArrays(GLenum mode, +void yagl_host_glDrawArrays(struct yagl_thread_state *cur_ts, + GLenum mode, GLint first, GLsizei count) { - gles_api_ts->driver->DrawArrays(mode, first, count); + cur_ts->gles_api_ts->driver->DrawArrays(mode, first, count); } -void yagl_host_glDrawElements(GLenum mode, +void yagl_host_glDrawElements(struct yagl_thread_state *cur_ts, + GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, int32_t indices_count) { if (indices) { - GLuint current_ebo = yagl_gles_bind_ebo(indices, indices_count); + GLuint current_ebo = yagl_gles_bind_ebo(cur_ts, indices, indices_count); - gles_api_ts->driver->DrawElements(mode, count, type, NULL); + cur_ts->gles_api_ts->driver->DrawElements(mode, count, type, NULL); - gles_api_ts->driver->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, current_ebo); + cur_ts->gles_api_ts->driver->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, current_ebo); } else { - gles_api_ts->driver->DrawElements(mode, count, type, - (const GLvoid*)(uintptr_t)indices_count); + cur_ts->gles_api_ts->driver->DrawElements(mode, count, type, + (const GLvoid*)(uintptr_t)indices_count); } } -void yagl_host_glReadPixelsData(GLint x, +void yagl_host_glReadPixelsData(struct yagl_thread_state *cur_ts, + GLint x, GLint y, GLsizei width, GLsizei height, @@ -611,18 +631,19 @@ void yagl_host_glReadPixelsData(GLint x, GLenum type, GLvoid *pixels, int32_t pixels_maxcount, int32_t *pixels_count) { - gles_api_ts->driver->ReadPixels(x, - y, - width, - height, - format, - type, - pixels); + cur_ts->gles_api_ts->driver->ReadPixels(x, + y, + width, + height, + format, + type, + pixels); *pixels_count = pixels_maxcount; } -void yagl_host_glReadPixelsOffset(GLint x, +void yagl_host_glReadPixelsOffset(struct yagl_thread_state *cur_ts, + GLint x, GLint y, GLsizei width, GLsizei height, @@ -630,45 +651,48 @@ void yagl_host_glReadPixelsOffset(GLint x, GLenum type, uintptr_t pixels) { - gles_api_ts->driver->ReadPixels(x, - y, - width, - height, - format, - type, - (GLvoid*)pixels); + cur_ts->gles_api_ts->driver->ReadPixels(x, + y, + width, + height, + format, + type, + (GLvoid*)pixels); } -void yagl_host_glDrawArraysInstanced(GLenum mode, +void yagl_host_glDrawArraysInstanced(struct yagl_thread_state *cur_ts, + GLenum mode, GLint start, GLsizei count, GLsizei primcount) { - gles_api_ts->driver->DrawArraysInstanced(mode, start, count, primcount); + cur_ts->gles_api_ts->driver->DrawArraysInstanced(mode, start, count, primcount); } -void yagl_host_glDrawElementsInstanced(GLenum mode, +void yagl_host_glDrawElementsInstanced(struct yagl_thread_state *cur_ts, + GLenum mode, GLsizei count, GLenum type, const void *indices, int32_t indices_count, GLsizei primcount) { if (indices) { - GLuint current_ebo = yagl_gles_bind_ebo(indices, indices_count); + GLuint current_ebo = yagl_gles_bind_ebo(cur_ts, indices, indices_count); - gles_api_ts->driver->DrawElementsInstanced(mode, count, type, NULL, primcount); + cur_ts->gles_api_ts->driver->DrawElementsInstanced(mode, count, type, NULL, primcount); - gles_api_ts->driver->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, current_ebo); + cur_ts->gles_api_ts->driver->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, current_ebo); } else { - gles_api_ts->driver->DrawElementsInstanced(mode, - count, - type, - (const GLvoid*)(uintptr_t)indices_count, - primcount); + cur_ts->gles_api_ts->driver->DrawElementsInstanced(mode, + count, + type, + (const GLvoid*)(uintptr_t)indices_count, + primcount); } } -void yagl_host_glDrawRangeElements(GLenum mode, +void yagl_host_glDrawRangeElements(struct yagl_thread_state *cur_ts, + GLenum mode, GLuint start, GLuint end, GLsizei count, @@ -676,49 +700,55 @@ void yagl_host_glDrawRangeElements(GLenum mode, const GLvoid *indices, int32_t indices_count) { if (indices) { - GLuint current_ebo = yagl_gles_bind_ebo(indices, indices_count); + GLuint current_ebo = yagl_gles_bind_ebo(cur_ts, indices, indices_count); - gles_api_ts->driver->DrawRangeElements(mode, start, end, count, type, NULL); + cur_ts->gles_api_ts->driver->DrawRangeElements(mode, start, end, count, type, NULL); - gles_api_ts->driver->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, current_ebo); + cur_ts->gles_api_ts->driver->BindBuffer(GL_ELEMENT_ARRAY_BUFFER, current_ebo); } else { - gles_api_ts->driver->DrawRangeElements(mode, start, end, count, type, - (const GLvoid*)(uintptr_t)indices_count); + cur_ts->gles_api_ts->driver->DrawRangeElements(mode, start, end, count, type, + (const GLvoid*)(uintptr_t)indices_count); } } -void yagl_host_glGenVertexArrays(const GLuint *arrays, int32_t arrays_count) +void yagl_host_glGenVertexArrays(struct yagl_thread_state *cur_ts, + const GLuint *arrays, int32_t arrays_count) { int i; for (i = 0; i < arrays_count; ++i) { GLuint global_name; - gles_api_ts->driver->GenVertexArrays(1, &global_name); + cur_ts->gles_api_ts->driver->GenVertexArrays(1, &global_name); - yagl_gles_object_add(arrays[i], + yagl_gles_object_add(cur_ts, + arrays[i], global_name, - yagl_get_ctx_id(), + yagl_get_ctx_id(cur_ts), &yagl_gles_vertex_array_destroy); } } -void yagl_host_glBindVertexArray(GLuint array) +void yagl_host_glBindVertexArray(struct yagl_thread_state *cur_ts, + GLuint array) { - gles_api_ts->driver->BindVertexArray(yagl_gles_object_get(array)); + cur_ts->gles_api_ts->driver->BindVertexArray(yagl_gles_object_get(cur_ts, array)); } -void yagl_host_glDisableVertexAttribArray(GLuint index) +void yagl_host_glDisableVertexAttribArray(struct yagl_thread_state *cur_ts, + GLuint index) { - gles_api_ts->driver->DisableVertexAttribArray(index); + cur_ts->gles_api_ts->driver->DisableVertexAttribArray(index); } -void yagl_host_glEnableVertexAttribArray(GLuint index) +void yagl_host_glEnableVertexAttribArray(struct yagl_thread_state *cur_ts, + GLuint index) { - gles_api_ts->driver->EnableVertexAttribArray(index); + cur_ts->gles_api_ts->driver->EnableVertexAttribArray(index); } -void yagl_host_glVertexAttribPointerData(GLuint indx, +void yagl_host_glVertexAttribPointerData(struct yagl_thread_state *cur_ts, + GLuint indx, GLint size, GLenum type, GLboolean normalized, @@ -726,195 +756,215 @@ void yagl_host_glVertexAttribPointerData(GLuint indx, GLint first, const GLvoid *data, int32_t data_count) { - GLuint current_vbo = yagl_gles_bind_array(indx, first, stride, + GLuint current_vbo = yagl_gles_bind_array(cur_ts, indx, first, stride, data, data_count); - gles_api_ts->driver->VertexAttribPointer(indx, size, type, normalized, - stride, - NULL); + cur_ts->gles_api_ts->driver->VertexAttribPointer(indx, size, type, normalized, + stride, + NULL); - gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo); + cur_ts->gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo); } -void yagl_host_glVertexAttribPointerOffset(GLuint indx, +void yagl_host_glVertexAttribPointerOffset(struct yagl_thread_state *cur_ts, + GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, uintptr_t offset) { - gles_api_ts->driver->VertexAttribPointer(indx, size, type, normalized, - stride, - (const GLvoid*)offset); + cur_ts->gles_api_ts->driver->VertexAttribPointer(indx, size, type, normalized, + stride, + (const GLvoid*)offset); } -void yagl_host_glVertexPointerData(GLint size, +void yagl_host_glVertexPointerData(struct yagl_thread_state *cur_ts, + GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count) { - GLuint current_vbo = yagl_gles_bind_array(yagl_gles1_array_vertex, + GLuint current_vbo = yagl_gles_bind_array(cur_ts, yagl_gles1_array_vertex, first, stride, data, data_count); - gles_api_ts->driver->VertexPointer(size, type, stride, NULL); + cur_ts->gles_api_ts->driver->VertexPointer(size, type, stride, NULL); - gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo); + cur_ts->gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo); } -void yagl_host_glVertexPointerOffset(GLint size, +void yagl_host_glVertexPointerOffset(struct yagl_thread_state *cur_ts, + GLint size, GLenum type, GLsizei stride, uintptr_t offset) { - gles_api_ts->driver->VertexPointer(size, type, stride, (const GLvoid*)offset); + cur_ts->gles_api_ts->driver->VertexPointer(size, type, stride, (const GLvoid*)offset); } -void yagl_host_glNormalPointerData(GLenum type, +void yagl_host_glNormalPointerData(struct yagl_thread_state *cur_ts, + GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count) { - GLuint current_vbo = yagl_gles_bind_array(yagl_gles1_array_normal, + GLuint current_vbo = yagl_gles_bind_array(cur_ts, yagl_gles1_array_normal, first, stride, data, data_count); - gles_api_ts->driver->NormalPointer(type, stride, NULL); + cur_ts->gles_api_ts->driver->NormalPointer(type, stride, NULL); - gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo); + cur_ts->gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo); } -void yagl_host_glNormalPointerOffset(GLenum type, +void yagl_host_glNormalPointerOffset(struct yagl_thread_state *cur_ts, + GLenum type, GLsizei stride, uintptr_t offset) { - gles_api_ts->driver->NormalPointer(type, stride, (const GLvoid*)offset); + cur_ts->gles_api_ts->driver->NormalPointer(type, stride, (const GLvoid*)offset); } -void yagl_host_glColorPointerData(GLint size, +void yagl_host_glColorPointerData(struct yagl_thread_state *cur_ts, + GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count) { - GLuint current_vbo = yagl_gles_bind_array(yagl_gles1_array_color, + GLuint current_vbo = yagl_gles_bind_array(cur_ts, yagl_gles1_array_color, first, stride, data, data_count); - gles_api_ts->driver->ColorPointer(size, type, stride, NULL); + cur_ts->gles_api_ts->driver->ColorPointer(size, type, stride, NULL); - gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo); + cur_ts->gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo); } -void yagl_host_glColorPointerOffset(GLint size, +void yagl_host_glColorPointerOffset(struct yagl_thread_state *cur_ts, + GLint size, GLenum type, GLsizei stride, uintptr_t offset) { - gles_api_ts->driver->ColorPointer(size, type, stride, (const GLvoid*)offset); + cur_ts->gles_api_ts->driver->ColorPointer(size, type, stride, (const GLvoid*)offset); } -void yagl_host_glTexCoordPointerData(GLint tex_id, +void yagl_host_glTexCoordPointerData(struct yagl_thread_state *cur_ts, + GLint tex_id, GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count) { - GLuint current_vbo = yagl_gles_bind_array(yagl_gles1_array_texcoord + tex_id, + GLuint current_vbo = yagl_gles_bind_array(cur_ts, yagl_gles1_array_texcoord + tex_id, first, stride, data, data_count); - gles_api_ts->driver->TexCoordPointer(size, type, stride, NULL); + cur_ts->gles_api_ts->driver->TexCoordPointer(size, type, stride, NULL); - gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo); + cur_ts->gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo); } -void yagl_host_glTexCoordPointerOffset(GLint size, +void yagl_host_glTexCoordPointerOffset(struct yagl_thread_state *cur_ts, + GLint size, GLenum type, GLsizei stride, uintptr_t offset) { - gles_api_ts->driver->TexCoordPointer(size, type, stride, (const GLvoid*)offset); + cur_ts->gles_api_ts->driver->TexCoordPointer(size, type, stride, (const GLvoid*)offset); } -void yagl_host_glDisableClientState(GLenum array) +void yagl_host_glDisableClientState(struct yagl_thread_state *cur_ts, + GLenum array) { - gles_api_ts->driver->DisableClientState(array); + cur_ts->gles_api_ts->driver->DisableClientState(array); } -void yagl_host_glEnableClientState(GLenum array) +void yagl_host_glEnableClientState(struct yagl_thread_state *cur_ts, + GLenum array) { - gles_api_ts->driver->EnableClientState(array); + cur_ts->gles_api_ts->driver->EnableClientState(array); } -void yagl_host_glVertexAttribDivisor(GLuint index, +void yagl_host_glVertexAttribDivisor(struct yagl_thread_state *cur_ts, + GLuint index, GLuint divisor) { - gles_api_ts->driver->VertexAttribDivisor(index, divisor); + cur_ts->gles_api_ts->driver->VertexAttribDivisor(index, divisor); } -void yagl_host_glVertexAttribIPointerData(GLuint index, +void yagl_host_glVertexAttribIPointerData(struct yagl_thread_state *cur_ts, + GLuint index, GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count) { - GLuint current_vbo = yagl_gles_bind_array(index, first, stride, + GLuint current_vbo = yagl_gles_bind_array(cur_ts, index, first, stride, data, data_count); - gles_api_ts->driver->VertexAttribIPointer(index, size, type, stride, NULL); + cur_ts->gles_api_ts->driver->VertexAttribIPointer(index, size, type, stride, NULL); - gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo); + cur_ts->gles_api_ts->driver->BindBuffer(GL_ARRAY_BUFFER, current_vbo); } -void yagl_host_glVertexAttribIPointerOffset(GLuint index, +void yagl_host_glVertexAttribIPointerOffset(struct yagl_thread_state *cur_ts, + GLuint index, GLint size, GLenum type, GLsizei stride, uintptr_t offset) { - gles_api_ts->driver->VertexAttribIPointer(index, size, type, - stride, - (const GLvoid*)offset); + cur_ts->gles_api_ts->driver->VertexAttribIPointer(index, size, type, + stride, + (const GLvoid*)offset); } -void yagl_host_glGenBuffers(const GLuint *buffers, int32_t buffers_count) +void yagl_host_glGenBuffers(struct yagl_thread_state *cur_ts, + const GLuint *buffers, int32_t buffers_count) { int i; for (i = 0; i < buffers_count; ++i) { GLuint global_name; - gles_api_ts->driver->GenBuffers(1, &global_name); + cur_ts->gles_api_ts->driver->GenBuffers(1, &global_name); - yagl_gles_object_add(buffers[i], + yagl_gles_object_add(cur_ts, + buffers[i], global_name, 0, &yagl_gles_buffer_destroy); } } -void yagl_host_glBindBuffer(GLenum target, +void yagl_host_glBindBuffer(struct yagl_thread_state *cur_ts, + GLenum target, GLuint buffer) { - gles_api_ts->driver->BindBuffer(target, yagl_gles_object_get(buffer)); + cur_ts->gles_api_ts->driver->BindBuffer(target, yagl_gles_object_get(cur_ts, buffer)); } -void yagl_host_glBufferData(GLenum target, +void yagl_host_glBufferData(struct yagl_thread_state *cur_ts, + GLenum target, const GLvoid *data, int32_t data_count, GLenum usage) { - gles_api_ts->driver->BufferData(target, data_count, data, usage); + cur_ts->gles_api_ts->driver->BufferData(target, data_count, data, usage); } -void yagl_host_glBufferSubData(GLenum target, +void yagl_host_glBufferSubData(struct yagl_thread_state *cur_ts, + GLenum target, GLsizei offset, const GLvoid *data, int32_t data_count) { void *ptr; + struct yagl_gles_api_ts *gles_api_ts = cur_ts->gles_api_ts; YAGL_LOG_FUNC_SET(glBufferSubData); @@ -954,26 +1004,29 @@ void yagl_host_glBufferSubData(GLenum target, } } -void yagl_host_glBindBufferBase(GLenum target, +void yagl_host_glBindBufferBase(struct yagl_thread_state *cur_ts, + GLenum target, GLuint index, GLuint buffer) { - gles_api_ts->driver->BindBufferBase(target, index, - yagl_gles_object_get(buffer)); + cur_ts->gles_api_ts->driver->BindBufferBase(target, index, + yagl_gles_object_get(cur_ts, buffer)); } -void yagl_host_glBindBufferRange(GLenum target, +void yagl_host_glBindBufferRange(struct yagl_thread_state *cur_ts, + GLenum target, GLuint index, GLuint buffer, GLint offset, GLsizei size) { - gles_api_ts->driver->BindBufferRange(target, index, - yagl_gles_object_get(buffer), - offset, size); + cur_ts->gles_api_ts->driver->BindBufferRange(target, index, + yagl_gles_object_get(cur_ts, buffer), + offset, size); } -void yagl_host_glMapBuffer(GLuint buffer, +void yagl_host_glMapBuffer(struct yagl_thread_state *cur_ts, + GLuint buffer, const GLuint *ranges, int32_t ranges_count, GLvoid *data, int32_t data_maxcount, int32_t *data_count) { @@ -983,12 +1036,12 @@ void yagl_host_glMapBuffer(GLuint buffer, YAGL_LOG_FUNC_SET(glMapBuffer); - gles_api_ts->driver->GetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING_ARB, + cur_ts->gles_api_ts->driver->GetIntegerv(GL_PIXEL_PACK_BUFFER_BINDING_ARB, (GLint*)¤t_pbo); - gles_api_ts->driver->BindBuffer(GL_PIXEL_PACK_BUFFER_ARB, yagl_gles_object_get(buffer)); + cur_ts->gles_api_ts->driver->BindBuffer(GL_PIXEL_PACK_BUFFER_ARB, yagl_gles_object_get(cur_ts, buffer)); - map_ptr = gles_api_ts->driver->MapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY); + map_ptr = cur_ts->gles_api_ts->driver->MapBuffer(GL_PIXEL_PACK_BUFFER_ARB, GL_READ_ONLY); if (!map_ptr) { YAGL_LOG_ERROR("glMapBuffer failed"); @@ -1018,22 +1071,24 @@ void yagl_host_glMapBuffer(GLuint buffer, *data_count = data_ptr - data; out2: - gles_api_ts->driver->UnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB); + cur_ts->gles_api_ts->driver->UnmapBuffer(GL_PIXEL_PACK_BUFFER_ARB); out1: - gles_api_ts->driver->BindBuffer(GL_PIXEL_PACK_BUFFER_ARB, current_pbo); + cur_ts->gles_api_ts->driver->BindBuffer(GL_PIXEL_PACK_BUFFER_ARB, current_pbo); } -void yagl_host_glCopyBufferSubData(GLenum readTarget, +void yagl_host_glCopyBufferSubData(struct yagl_thread_state *cur_ts, + GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizei size) { - gles_api_ts->driver->CopyBufferSubData(readTarget, writeTarget, - readOffset, writeOffset, size); + cur_ts->gles_api_ts->driver->CopyBufferSubData(readTarget, writeTarget, + readOffset, writeOffset, size); } -void yagl_host_glGenTextures(const GLuint *textures, int32_t textures_count) +void yagl_host_glGenTextures(struct yagl_thread_state *cur_ts, + const GLuint *textures, int32_t textures_count) { int i; @@ -1045,29 +1100,33 @@ void yagl_host_glGenTextures(const GLuint *textures, int32_t textures_count) * might be called without an active context, but * which needs to create a texture. */ - yagl_ensure_ctx(0); - gles_api_ts->driver->GenTextures(1, &global_name); - yagl_unensure_ctx(0); + yagl_ensure_ctx(cur_ts, 0); + cur_ts->gles_api_ts->driver->GenTextures(1, &global_name); + yagl_unensure_ctx(cur_ts, 0); - yagl_gles_object_add(textures[i], + yagl_gles_object_add(cur_ts, + textures[i], global_name, 0, &yagl_gles_texture_destroy); } } -void yagl_host_glBindTexture(GLenum target, +void yagl_host_glBindTexture(struct yagl_thread_state *cur_ts, + GLenum target, GLuint texture) { - gles_api_ts->driver->BindTexture(target, yagl_gles_object_get(texture)); + cur_ts->gles_api_ts->driver->BindTexture(target, yagl_gles_object_get(cur_ts, texture)); } -void yagl_host_glActiveTexture(GLenum texture) +void yagl_host_glActiveTexture(struct yagl_thread_state *cur_ts, + GLenum texture) { - gles_api_ts->driver->ActiveTexture(texture); + cur_ts->gles_api_ts->driver->ActiveTexture(texture); } -void yagl_host_glCopyTexImage2D(GLenum target, +void yagl_host_glCopyTexImage2D(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLenum internalformat, GLint x, @@ -1076,7 +1135,7 @@ void yagl_host_glCopyTexImage2D(GLenum target, GLsizei height, GLint border) { - gles_api_ts->driver->CopyTexImage2D(target, + cur_ts->gles_api_ts->driver->CopyTexImage2D(target, level, internalformat, x, @@ -1086,7 +1145,8 @@ void yagl_host_glCopyTexImage2D(GLenum target, border); } -void yagl_host_glCopyTexSubImage2D(GLenum target, +void yagl_host_glCopyTexSubImage2D(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -1095,7 +1155,7 @@ void yagl_host_glCopyTexSubImage2D(GLenum target, GLsizei width, GLsizei height) { - gles_api_ts->driver->CopyTexSubImage2D(target, + cur_ts->gles_api_ts->driver->CopyTexSubImage2D(target, level, xoffset, yoffset, @@ -1105,13 +1165,14 @@ void yagl_host_glCopyTexSubImage2D(GLenum target, height); } -void yagl_host_glGetTexParameterfv(GLenum target, +void yagl_host_glGetTexParameterfv(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, GLfloat *param) { GLfloat params[10]; - gles_api_ts->driver->GetTexParameterfv(target, + cur_ts->gles_api_ts->driver->GetTexParameterfv(target, pname, params); @@ -1120,13 +1181,14 @@ void yagl_host_glGetTexParameterfv(GLenum target, } } -void yagl_host_glGetTexParameteriv(GLenum target, +void yagl_host_glGetTexParameteriv(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, GLint *param) { GLint params[10]; - gles_api_ts->driver->GetTexParameteriv(target, + cur_ts->gles_api_ts->driver->GetTexParameteriv(target, pname, params); @@ -1135,7 +1197,8 @@ void yagl_host_glGetTexParameteriv(GLenum target, } } -void yagl_host_glTexImage2DData(GLenum target, +void yagl_host_glTexImage2DData(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint internalformat, GLsizei width, @@ -1145,7 +1208,7 @@ void yagl_host_glTexImage2DData(GLenum target, GLenum type, const GLvoid *pixels, int32_t pixels_count) { - gles_api_ts->driver->TexImage2D(target, + cur_ts->gles_api_ts->driver->TexImage2D(target, level, internalformat, width, @@ -1156,7 +1219,8 @@ void yagl_host_glTexImage2DData(GLenum target, pixels); } -void yagl_host_glTexImage2DOffset(GLenum target, +void yagl_host_glTexImage2DOffset(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint internalformat, GLsizei width, @@ -1166,7 +1230,7 @@ void yagl_host_glTexImage2DOffset(GLenum target, GLenum type, uintptr_t pixels) { - gles_api_ts->driver->TexImage2D(target, + cur_ts->gles_api_ts->driver->TexImage2D(target, level, internalformat, width, @@ -1177,14 +1241,16 @@ void yagl_host_glTexImage2DOffset(GLenum target, (const GLvoid*)pixels); } -void yagl_host_glTexParameterf(GLenum target, +void yagl_host_glTexParameterf(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, GLfloat param) { - gles_api_ts->driver->TexParameterf(target, pname, param); + cur_ts->gles_api_ts->driver->TexParameterf(target, pname, param); } -void yagl_host_glTexParameterfv(GLenum target, +void yagl_host_glTexParameterfv(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, const GLfloat *params, int32_t params_count) { @@ -1196,19 +1262,21 @@ void yagl_host_glTexParameterfv(GLenum target, tmp[0] = *params; } - gles_api_ts->driver->TexParameterfv(target, - pname, - (params ? tmp : NULL)); + cur_ts->gles_api_ts->driver->TexParameterfv(target, + pname, + (params ? tmp : NULL)); } -void yagl_host_glTexParameteri(GLenum target, +void yagl_host_glTexParameteri(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, GLint param) { - gles_api_ts->driver->TexParameteri(target, pname, param); + cur_ts->gles_api_ts->driver->TexParameteri(target, pname, param); } -void yagl_host_glTexParameteriv(GLenum target, +void yagl_host_glTexParameteriv(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, const GLint *params, int32_t params_count) { @@ -1220,12 +1288,13 @@ void yagl_host_glTexParameteriv(GLenum target, tmp[0] = *params; } - gles_api_ts->driver->TexParameteriv(target, - pname, - (params ? tmp : NULL)); + cur_ts->gles_api_ts->driver->TexParameteriv(target, + pname, + (params ? tmp : NULL)); } -void yagl_host_glTexSubImage2DData(GLenum target, +void yagl_host_glTexSubImage2DData(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -1236,6 +1305,7 @@ void yagl_host_glTexSubImage2DData(GLenum target, const GLvoid *pixels, int32_t pixels_count) { GLint row_length; + struct yagl_gles_api_ts *gles_api_ts = cur_ts->gles_api_ts; /* * Nvidia Windows OpenGL drivers don't account for GL_UNPACK_ALIGNMENT @@ -1271,7 +1341,8 @@ void yagl_host_glTexSubImage2DData(GLenum target, } } -void yagl_host_glTexSubImage2DOffset(GLenum target, +void yagl_host_glTexSubImage2DOffset(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -1282,6 +1353,7 @@ void yagl_host_glTexSubImage2DOffset(GLenum target, uintptr_t pixels) { GLint row_length; + struct yagl_gles_api_ts *gles_api_ts = cur_ts->gles_api_ts; /* * Nvidia Windows OpenGL drivers don't account for GL_UNPACK_ALIGNMENT @@ -1317,65 +1389,74 @@ void yagl_host_glTexSubImage2DOffset(GLenum target, } } -void yagl_host_glClientActiveTexture(GLenum texture) +void yagl_host_glClientActiveTexture(struct yagl_thread_state *cur_ts, + GLenum texture) { - gles_api_ts->driver->ClientActiveTexture(texture); + cur_ts->gles_api_ts->driver->ClientActiveTexture(texture); } -void yagl_host_glTexEnvi(GLenum target, +void yagl_host_glTexEnvi(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, GLint param) { - gles_api_ts->driver->TexEnvi(target, pname, param); + cur_ts->gles_api_ts->driver->TexEnvi(target, pname, param); } -void yagl_host_glTexEnvf(GLenum target, +void yagl_host_glTexEnvf(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, GLfloat param) { - gles_api_ts->driver->TexEnvf(target, pname, param); + cur_ts->gles_api_ts->driver->TexEnvf(target, pname, param); } -void yagl_host_glMultiTexCoord4f(GLenum target, +void yagl_host_glMultiTexCoord4f(struct yagl_thread_state *cur_ts, + GLenum target, GLfloat s, GLfloat tt, GLfloat r, GLfloat q) { - gles_api_ts->driver->MultiTexCoord4f(target, s, tt, r, q); + cur_ts->gles_api_ts->driver->MultiTexCoord4f(target, s, tt, r, q); } -void yagl_host_glTexEnviv(GLenum target, +void yagl_host_glTexEnviv(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, const GLint *params, int32_t params_count) { - gles_api_ts->driver->TexEnviv(target, pname, params); + cur_ts->gles_api_ts->driver->TexEnviv(target, pname, params); } -void yagl_host_glTexEnvfv(GLenum target, +void yagl_host_glTexEnvfv(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, const GLfloat *params, int32_t params_count) { - gles_api_ts->driver->TexEnvfv(target, pname, params); + cur_ts->gles_api_ts->driver->TexEnvfv(target, pname, params); } -void yagl_host_glGetTexEnviv(GLenum env, +void yagl_host_glGetTexEnviv(struct yagl_thread_state *cur_ts, + GLenum env, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count) { - gles_api_ts->driver->GetTexEnviv(env, pname, params); + cur_ts->gles_api_ts->driver->GetTexEnviv(env, pname, params); *params_count = params_maxcount; } -void yagl_host_glGetTexEnvfv(GLenum env, +void yagl_host_glGetTexEnvfv(struct yagl_thread_state *cur_ts, + GLenum env, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count) { - gles_api_ts->driver->GetTexEnvfv(env, pname, params); + cur_ts->gles_api_ts->driver->GetTexEnvfv(env, pname, params); *params_count = params_maxcount; } -void yagl_host_glTexImage3DData(GLenum target, +void yagl_host_glTexImage3DData(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint internalformat, GLsizei width, @@ -1386,19 +1467,20 @@ void yagl_host_glTexImage3DData(GLenum target, GLenum type, const void *pixels, int32_t pixels_count) { - gles_api_ts->driver->TexImage3D(target, - level, - internalformat, - width, - height, - depth, - border, - format, - type, - pixels); + cur_ts->gles_api_ts->driver->TexImage3D(target, + level, + internalformat, + width, + height, + depth, + border, + format, + type, + pixels); } -void yagl_host_glTexImage3DOffset(GLenum target, +void yagl_host_glTexImage3DOffset(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint internalformat, GLsizei width, @@ -1409,19 +1491,20 @@ void yagl_host_glTexImage3DOffset(GLenum target, GLenum type, uintptr_t pixels) { - gles_api_ts->driver->TexImage3D(target, - level, - internalformat, - width, - height, - depth, - border, - format, - type, - (const void*)pixels); + cur_ts->gles_api_ts->driver->TexImage3D(target, + level, + internalformat, + width, + height, + depth, + border, + format, + type, + (const void*)pixels); } -void yagl_host_glTexSubImage3DData(GLenum target, +void yagl_host_glTexSubImage3DData(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -1433,20 +1516,21 @@ void yagl_host_glTexSubImage3DData(GLenum target, GLenum type, const void *pixels, int32_t pixels_count) { - gles_api_ts->driver->TexSubImage3D(target, - level, - xoffset, - yoffset, - zoffset, - width, - height, - depth, - format, - type, - pixels); -} - -void yagl_host_glTexSubImage3DOffset(GLenum target, + cur_ts->gles_api_ts->driver->TexSubImage3D(target, + level, + xoffset, + yoffset, + zoffset, + width, + height, + depth, + format, + type, + pixels); +} + +void yagl_host_glTexSubImage3DOffset(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -1458,20 +1542,21 @@ void yagl_host_glTexSubImage3DOffset(GLenum target, GLenum type, uintptr_t pixels) { - gles_api_ts->driver->TexSubImage3D(target, - level, - xoffset, - yoffset, - zoffset, - width, - height, - depth, - format, - type, - (const void*)pixels); -} - -void yagl_host_glCopyTexSubImage3D(GLenum target, + cur_ts->gles_api_ts->driver->TexSubImage3D(target, + level, + xoffset, + yoffset, + zoffset, + width, + height, + depth, + format, + type, + (const void*)pixels); +} + +void yagl_host_glCopyTexSubImage3D(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -1481,64 +1566,71 @@ void yagl_host_glCopyTexSubImage3D(GLenum target, GLsizei width, GLsizei height) { - gles_api_ts->driver->CopyTexSubImage3D(target, - level, - xoffset, - yoffset, - zoffset, - x, - y, - width, - height); + cur_ts->gles_api_ts->driver->CopyTexSubImage3D(target, + level, + xoffset, + yoffset, + zoffset, + x, + y, + width, + height); } -void yagl_host_glGenFramebuffers(const GLuint *framebuffers, int32_t framebuffers_count) +void yagl_host_glGenFramebuffers(struct yagl_thread_state *cur_ts, + const GLuint *framebuffers, int32_t framebuffers_count) { int i; for (i = 0; i < framebuffers_count; ++i) { GLuint global_name; - gles_api_ts->driver->GenFramebuffers(1, &global_name); + cur_ts->gles_api_ts->driver->GenFramebuffers(1, &global_name); - yagl_gles_object_add(framebuffers[i], + yagl_gles_object_add(cur_ts, + framebuffers[i], global_name, - yagl_get_ctx_id(), + yagl_get_ctx_id(cur_ts), &yagl_gles_framebuffer_destroy); } } -void yagl_host_glBindFramebuffer(GLenum target, +void yagl_host_glBindFramebuffer(struct yagl_thread_state *cur_ts, + GLenum target, GLuint framebuffer) { - gles_api_ts->driver->BindFramebuffer(target, - yagl_gles_object_get(framebuffer)); + cur_ts->gles_api_ts->driver->BindFramebufferYAGL(cur_ts, + target, + yagl_gles_object_get(cur_ts, framebuffer)); } -void yagl_host_glFramebufferTexture2D(GLenum target, +void yagl_host_glFramebufferTexture2D(struct yagl_thread_state *cur_ts, + GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { - gles_api_ts->driver->FramebufferTexture2D(target, attachment, - textarget, - yagl_gles_object_get(texture), - level); + cur_ts->gles_api_ts->driver->FramebufferTexture2D(target, attachment, + textarget, + yagl_gles_object_get(cur_ts, texture), + level); } -void yagl_host_glFramebufferRenderbuffer(GLenum target, +void yagl_host_glFramebufferRenderbuffer(struct yagl_thread_state *cur_ts, + GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { - gles_api_ts->driver->FramebufferRenderbuffer(target, - attachment, - renderbuffertarget, - yagl_gles_object_get(renderbuffer)); + cur_ts->gles_api_ts->driver->FramebufferRenderbuffer(target, + attachment, + renderbuffertarget, + yagl_gles_object_get(cur_ts, renderbuffer)); } -void yagl_host_glBlitFramebuffer(GLint srcX0, +void yagl_host_glBlitFramebuffer(struct yagl_thread_state *cur_ts, + GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, @@ -1549,112 +1641,125 @@ void yagl_host_glBlitFramebuffer(GLint srcX0, GLbitfield mask, GLenum filter) { - gles_api_ts->driver->BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, - dstX0, dstY0, dstX1, dstY1, - mask, filter); + cur_ts->gles_api_ts->driver->BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, + mask, filter); } -void yagl_host_glDrawBuffers(const GLenum *bufs, int32_t bufs_count) +void yagl_host_glDrawBuffers(struct yagl_thread_state *cur_ts, + const GLenum *bufs, int32_t bufs_count) { - gles_api_ts->driver->DrawBuffers(bufs_count, bufs); + cur_ts->gles_api_ts->driver->DrawBuffers(bufs_count, bufs); } -void yagl_host_glReadBuffer(GLenum mode) +void yagl_host_glReadBuffer(struct yagl_thread_state *cur_ts, + GLenum mode) { - gles_api_ts->driver->ReadBuffer(mode); + cur_ts->gles_api_ts->driver->ReadBuffer(mode); } -void yagl_host_glFramebufferTexture3D(GLenum target, +void yagl_host_glFramebufferTexture3D(struct yagl_thread_state *cur_ts, + GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) { - gles_api_ts->driver->FramebufferTexture3D(target, attachment, - textarget, - yagl_gles_object_get(texture), - level, zoffset); + cur_ts->gles_api_ts->driver->FramebufferTexture3D(target, attachment, + textarget, + yagl_gles_object_get(cur_ts, texture), + level, zoffset); } -void yagl_host_glFramebufferTextureLayer(GLenum target, +void yagl_host_glFramebufferTextureLayer(struct yagl_thread_state *cur_ts, + GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) { - gles_api_ts->driver->FramebufferTextureLayer(target, attachment, - yagl_gles_object_get(texture), - level, layer); + cur_ts->gles_api_ts->driver->FramebufferTextureLayer(target, attachment, + yagl_gles_object_get(cur_ts, texture), + level, layer); } -void yagl_host_glClearBufferiv(GLenum buffer, +void yagl_host_glClearBufferiv(struct yagl_thread_state *cur_ts, + GLenum buffer, GLint drawbuffer, const GLint *value, int32_t value_count) { - gles_api_ts->driver->ClearBufferiv(buffer, drawbuffer, value); + cur_ts->gles_api_ts->driver->ClearBufferiv(buffer, drawbuffer, value); } -void yagl_host_glClearBufferuiv(GLenum buffer, +void yagl_host_glClearBufferuiv(struct yagl_thread_state *cur_ts, + GLenum buffer, GLint drawbuffer, const GLuint *value, int32_t value_count) { - gles_api_ts->driver->ClearBufferuiv(buffer, drawbuffer, value); + cur_ts->gles_api_ts->driver->ClearBufferuiv(buffer, drawbuffer, value); } -void yagl_host_glClearBufferfi(GLenum buffer, +void yagl_host_glClearBufferfi(struct yagl_thread_state *cur_ts, + GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) { - gles_api_ts->driver->ClearBufferfi(buffer, drawbuffer, depth, stencil); + cur_ts->gles_api_ts->driver->ClearBufferfi(buffer, drawbuffer, depth, stencil); } -void yagl_host_glClearBufferfv(GLenum buffer, +void yagl_host_glClearBufferfv(struct yagl_thread_state *cur_ts, + GLenum buffer, GLint drawbuffer, const GLfloat *value, int32_t value_count) { - gles_api_ts->driver->ClearBufferfv(buffer, drawbuffer, value); + cur_ts->gles_api_ts->driver->ClearBufferfv(buffer, drawbuffer, value); } -void yagl_host_glGenRenderbuffers(const GLuint *renderbuffers, int32_t renderbuffers_count) +void yagl_host_glGenRenderbuffers(struct yagl_thread_state *cur_ts, + const GLuint *renderbuffers, int32_t renderbuffers_count) { int i; for (i = 0; i < renderbuffers_count; ++i) { GLuint global_name; - gles_api_ts->driver->GenRenderbuffers(1, &global_name); + cur_ts->gles_api_ts->driver->GenRenderbuffers(1, &global_name); - yagl_gles_object_add(renderbuffers[i], + yagl_gles_object_add(cur_ts, + renderbuffers[i], global_name, 0, &yagl_gles_renderbuffer_destroy); } } -void yagl_host_glBindRenderbuffer(GLenum target, +void yagl_host_glBindRenderbuffer(struct yagl_thread_state *cur_ts, + GLenum target, GLuint renderbuffer) { - gles_api_ts->driver->BindRenderbuffer(target, - yagl_gles_object_get(renderbuffer)); + cur_ts->gles_api_ts->driver->BindRenderbuffer(target, + yagl_gles_object_get(cur_ts, renderbuffer)); } -void yagl_host_glRenderbufferStorage(GLenum target, +void yagl_host_glRenderbufferStorage(struct yagl_thread_state *cur_ts, + GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { - gles_api_ts->driver->RenderbufferStorage(target, internalformat, width, height); + cur_ts->gles_api_ts->driver->RenderbufferStorage(target, internalformat, width, height); } -void yagl_host_glGetRenderbufferParameteriv(GLenum target, +void yagl_host_glGetRenderbufferParameteriv(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, GLint *param) { GLint params[10]; - gles_api_ts->driver->GetRenderbufferParameteriv(target, + cur_ts->gles_api_ts->driver->GetRenderbufferParameteriv(target, pname, params); @@ -1663,37 +1768,43 @@ void yagl_host_glGetRenderbufferParameteriv(GLenum target, } } -void yagl_host_glRenderbufferStorageMultisample(GLenum target, +void yagl_host_glRenderbufferStorageMultisample(struct yagl_thread_state *cur_ts, + GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { - gles_api_ts->driver->RenderbufferStorageMultisample(target, samples, internalformat, width, height); + cur_ts->gles_api_ts->driver->RenderbufferStorageMultisample(target, samples, internalformat, width, height); } -void yagl_host_glCreateProgram(GLuint program) +void yagl_host_glCreateProgram(struct yagl_thread_state *cur_ts, + GLuint program) { - GLuint global_name = gles_api_ts->driver->CreateProgram(); + GLuint global_name = cur_ts->gles_api_ts->driver->CreateProgram(); - yagl_gles_object_add(program, + yagl_gles_object_add(cur_ts, + program, global_name, 0, &yagl_gles_program_destroy); } -void yagl_host_glCreateShader(GLuint shader, +void yagl_host_glCreateShader(struct yagl_thread_state *cur_ts, + GLuint shader, GLenum type) { - GLuint global_name = gles_api_ts->driver->CreateShader(type); + GLuint global_name = cur_ts->gles_api_ts->driver->CreateShader(type); - yagl_gles_object_add(shader, + yagl_gles_object_add(cur_ts, + shader, global_name, 0, &yagl_gles_shader_destroy); } -void yagl_host_glShaderSource(GLuint shader, +void yagl_host_glShaderSource(struct yagl_thread_state *cur_ts, + GLuint shader, const GLchar *string, int32_t string_count) { const GLchar *strings[1]; @@ -1702,38 +1813,42 @@ void yagl_host_glShaderSource(GLuint shader, strings[0] = string; lenghts[0] = string_count - 1; - gles_api_ts->driver->ShaderSource(yagl_gles_object_get(shader), - 1, - strings, - lenghts); + cur_ts->gles_api_ts->driver->ShaderSource(yagl_gles_object_get(cur_ts, shader), + 1, + strings, + lenghts); } -void yagl_host_glAttachShader(GLuint program, +void yagl_host_glAttachShader(struct yagl_thread_state *cur_ts, + GLuint program, GLuint shader) { - gles_api_ts->driver->AttachShader(yagl_gles_object_get(program), - yagl_gles_object_get(shader)); + cur_ts->gles_api_ts->driver->AttachShader(yagl_gles_object_get(cur_ts, program), + yagl_gles_object_get(cur_ts, shader)); } -void yagl_host_glDetachShader(GLuint program, +void yagl_host_glDetachShader(struct yagl_thread_state *cur_ts, + GLuint program, GLuint shader) { - gles_api_ts->driver->DetachShader(yagl_gles_object_get(program), - yagl_gles_object_get(shader)); + cur_ts->gles_api_ts->driver->DetachShader(yagl_gles_object_get(cur_ts, program), + yagl_gles_object_get(cur_ts, shader)); } -void yagl_host_glCompileShader(GLuint shader) +void yagl_host_glCompileShader(struct yagl_thread_state *cur_ts, + GLuint shader) { + struct yagl_gles_api_ts *gles_api_ts = cur_ts->gles_api_ts; #ifndef CONFIG_DARWIN - gles_api_ts->driver->CompileShader(yagl_gles_object_get(shader)); + gles_api_ts->driver->CompileShader(yagl_gles_object_get(cur_ts, shader)); #else GLint tmp = 0; YAGL_LOG_FUNC_SET(glCompileShader); - gles_api_ts->driver->CompileShader(yagl_gles_object_get(shader)); + gles_api_ts->driver->CompileShader(yagl_gles_object_get(cur_ts, shader)); - gles_api_ts->driver->GetShaderiv(yagl_gles_object_get(shader), GL_COMPILE_STATUS, &tmp); + gles_api_ts->driver->GetShaderiv(yagl_gles_object_get(cur_ts, shader), GL_COMPILE_STATUS, &tmp); if (tmp == GL_FALSE) { char *buff; char *substring; @@ -1741,9 +1856,9 @@ void yagl_host_glCompileShader(GLuint shader) const char texture_lookup_define[] = "#define TextureLookup texture2D"; tmp = 0; - gles_api_ts->driver->GetShaderiv(yagl_gles_object_get(shader), GL_INFO_LOG_LENGTH, &tmp); + gles_api_ts->driver->GetShaderiv(yagl_gles_object_get(cur_ts, shader), GL_INFO_LOG_LENGTH, &tmp); buff = g_malloc0(tmp); - gles_api_ts->driver->GetShaderInfoLog(yagl_gles_object_get(shader), tmp, NULL, buff); + gles_api_ts->driver->GetShaderInfoLog(yagl_gles_object_get(cur_ts, shader), tmp, NULL, buff); if (gles_api_ts->driver->gl_version < yagl_gl_3_2 || strstr(buff, textue2d_err) == NULL) { YAGL_LOG_ERROR("Unable to compile shader %s", buff); @@ -1754,9 +1869,9 @@ void yagl_host_glCompileShader(GLuint shader) g_free(buff); tmp = 0; - gles_api_ts->driver->GetShaderiv(yagl_gles_object_get(shader), GL_SHADER_SOURCE_LENGTH, &tmp); + gles_api_ts->driver->GetShaderiv(yagl_gles_object_get(cur_ts, shader), GL_SHADER_SOURCE_LENGTH, &tmp); buff = g_malloc0(tmp); - gles_api_ts->driver->GetShaderSource(yagl_gles_object_get(shader), tmp, NULL, buff); + gles_api_ts->driver->GetShaderSource(yagl_gles_object_get(cur_ts, shader), tmp, NULL, buff); YAGL_LOG_DEBUG("Shader Source: \n%s", buff); substring = strstr(buff, texture_lookup_define); @@ -1771,20 +1886,20 @@ void yagl_host_glCompileShader(GLuint shader) strings[0] = buff; lenghts[0] = tmp - 1; - gles_api_ts->driver->ShaderSource(yagl_gles_object_get(shader), + gles_api_ts->driver->ShaderSource(yagl_gles_object_get(cur_ts, shader), 1, strings, lenghts); - gles_api_ts->driver->CompileShader(yagl_gles_object_get(shader)); - gles_api_ts->driver->GetShaderiv(yagl_gles_object_get(shader), GL_COMPILE_STATUS, &tmp); + gles_api_ts->driver->CompileShader(yagl_gles_object_get(cur_ts, shader)); + gles_api_ts->driver->GetShaderiv(yagl_gles_object_get(cur_ts, shader), GL_COMPILE_STATUS, &tmp); if (!tmp) { YAGL_LOG_ERROR("Unable to compile the patched shader source: \n%s", buff); g_free(buff); tmp = 0; - gles_api_ts->driver->GetShaderiv(yagl_gles_object_get(shader), GL_INFO_LOG_LENGTH, &tmp); + gles_api_ts->driver->GetShaderiv(yagl_gles_object_get(cur_ts, shader), GL_INFO_LOG_LENGTH, &tmp); buff = g_malloc0(tmp); - gles_api_ts->driver->GetShaderInfoLog(yagl_gles_object_get(shader), tmp, NULL, buff); + gles_api_ts->driver->GetShaderInfoLog(yagl_gles_object_get(cur_ts, shader), tmp, NULL, buff); YAGL_LOG_ERROR("Cause of compilation failure: %s", buff); } } @@ -1793,16 +1908,18 @@ void yagl_host_glCompileShader(GLuint shader) #endif } -void yagl_host_glBindAttribLocation(GLuint program, +void yagl_host_glBindAttribLocation(struct yagl_thread_state *cur_ts, + GLuint program, GLuint index, const GLchar *name, int32_t name_count) { - gles_api_ts->driver->BindAttribLocation(yagl_gles_object_get(program), - index, - name); + cur_ts->gles_api_ts->driver->BindAttribLocation(yagl_gles_object_get(cur_ts, program), + index, + name); } -void yagl_host_glGetActiveAttrib(GLuint program, +void yagl_host_glGetActiveAttrib(struct yagl_thread_state *cur_ts, + GLuint program, GLuint index, GLint *size, GLenum *type, @@ -1810,20 +1927,21 @@ void yagl_host_glGetActiveAttrib(GLuint program, { GLsizei tmp = -1; - gles_api_ts->driver->GetActiveAttrib(yagl_gles_object_get(program), - index, - name_maxcount, - &tmp, - size, - type, - name); + cur_ts->gles_api_ts->driver->GetActiveAttrib(yagl_gles_object_get(cur_ts, program), + index, + name_maxcount, + &tmp, + size, + type, + name); if (tmp >= 0) { *name_count = MIN(tmp + 1, name_maxcount); } } -void yagl_host_glGetActiveUniform(GLuint program, +void yagl_host_glGetActiveUniform(struct yagl_thread_state *cur_ts, + GLuint program, GLuint index, GLint *size, GLenum *type, @@ -1831,44 +1949,47 @@ void yagl_host_glGetActiveUniform(GLuint program, { GLsizei tmp = -1; - gles_api_ts->driver->GetActiveUniform(yagl_gles_object_get(program), - index, - name_maxcount, - &tmp, - size, - type, - name); + cur_ts->gles_api_ts->driver->GetActiveUniform(yagl_gles_object_get(cur_ts, program), + index, + name_maxcount, + &tmp, + size, + type, + name); if (tmp >= 0) { *name_count = MIN(tmp + 1, name_maxcount); } } -int yagl_host_glGetAttribLocation(GLuint program, +int yagl_host_glGetAttribLocation(struct yagl_thread_state *cur_ts, + GLuint program, const GLchar *name, int32_t name_count) { - return gles_api_ts->driver->GetAttribLocation(yagl_gles_object_get(program), - name); + return cur_ts->gles_api_ts->driver->GetAttribLocation(yagl_gles_object_get(cur_ts, program), + name); } -void yagl_host_glGetProgramiv(GLuint program, +void yagl_host_glGetProgramiv(struct yagl_thread_state *cur_ts, + GLuint program, GLenum pname, GLint *param) { - gles_api_ts->driver->GetProgramiv(yagl_gles_object_get(program), - pname, - param); + cur_ts->gles_api_ts->driver->GetProgramiv(yagl_gles_object_get(cur_ts, program), + pname, + param); } -GLboolean yagl_host_glGetProgramInfoLog(GLuint program, +GLboolean yagl_host_glGetProgramInfoLog(struct yagl_thread_state *cur_ts, + GLuint program, GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count) { GLsizei tmp = -1; - gles_api_ts->driver->GetProgramInfoLog(yagl_gles_object_get(program), - infolog_maxcount, - &tmp, - infolog); + cur_ts->gles_api_ts->driver->GetProgramInfoLog(yagl_gles_object_get(cur_ts, program), + infolog_maxcount, + &tmp, + infolog); if (tmp >= 0) { *infolog_count = MIN(tmp + 1, infolog_maxcount); @@ -1878,24 +1999,26 @@ GLboolean yagl_host_glGetProgramInfoLog(GLuint program, } } -void yagl_host_glGetShaderiv(GLuint shader, +void yagl_host_glGetShaderiv(struct yagl_thread_state *cur_ts, + GLuint shader, GLenum pname, GLint *param) { - gles_api_ts->driver->GetShaderiv(yagl_gles_object_get(shader), - pname, - param); + cur_ts->gles_api_ts->driver->GetShaderiv(yagl_gles_object_get(cur_ts, shader), + pname, + param); } -GLboolean yagl_host_glGetShaderInfoLog(GLuint shader, +GLboolean yagl_host_glGetShaderInfoLog(struct yagl_thread_state *cur_ts, + GLuint shader, GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count) { GLsizei tmp = -1; - gles_api_ts->driver->GetShaderInfoLog(yagl_gles_object_get(shader), - infolog_maxcount, - &tmp, - infolog); + cur_ts->gles_api_ts->driver->GetShaderInfoLog(yagl_gles_object_get(cur_ts, shader), + infolog_maxcount, + &tmp, + infolog); if (tmp >= 0) { *infolog_count = MIN(tmp + 1, infolog_maxcount); @@ -1905,18 +2028,20 @@ GLboolean yagl_host_glGetShaderInfoLog(GLuint shader, } } -void yagl_host_glGetUniformfv(GLboolean tl, +void yagl_host_glGetUniformfv(struct yagl_thread_state *cur_ts, + GLboolean tl, GLuint program, uint32_t location, GLfloat *params, int32_t params_maxcount, int32_t *params_count) { GLenum type; - GLuint global_name = yagl_gles_object_get(program); - GLint actual_location = yagl_gles_api_ps_translate_location(gles_api_ts->ps, + GLuint global_name = yagl_gles_object_get(cur_ts, program); + GLint actual_location = yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location); - if (!yagl_gles_program_get_uniform_type(global_name, + if (!yagl_gles_program_get_uniform_type(cur_ts, + global_name, actual_location, &type)) { return; @@ -1926,23 +2051,25 @@ void yagl_host_glGetUniformfv(GLboolean tl, return; } - gles_api_ts->driver->GetUniformfv(global_name, - actual_location, - params); + cur_ts->gles_api_ts->driver->GetUniformfv(global_name, + actual_location, + params); } -void yagl_host_glGetUniformiv(GLboolean tl, +void yagl_host_glGetUniformiv(struct yagl_thread_state *cur_ts, + GLboolean tl, GLuint program, uint32_t location, GLint *params, int32_t params_maxcount, int32_t *params_count) { GLenum type; - GLuint global_name = yagl_gles_object_get(program); - GLint actual_location = yagl_gles_api_ps_translate_location(gles_api_ts->ps, + GLuint global_name = yagl_gles_object_get(cur_ts, program); + GLint actual_location = yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location); - if (!yagl_gles_program_get_uniform_type(global_name, + if (!yagl_gles_program_get_uniform_type(cur_ts, + global_name, actual_location, &type)) { return; @@ -1952,19 +2079,21 @@ void yagl_host_glGetUniformiv(GLboolean tl, return; } - gles_api_ts->driver->GetUniformiv(global_name, - actual_location, - params); + cur_ts->gles_api_ts->driver->GetUniformiv(global_name, + actual_location, + params); } -int yagl_host_glGetUniformLocation(GLuint program, +int yagl_host_glGetUniformLocation(struct yagl_thread_state *cur_ts, + GLuint program, const GLchar *name, int32_t name_count) { - return gles_api_ts->driver->GetUniformLocation(yagl_gles_object_get(program), - name); + return cur_ts->gles_api_ts->driver->GetUniformLocation(yagl_gles_object_get(cur_ts, program), + name); } -void yagl_host_glGetVertexAttribfv(GLuint index, +void yagl_host_glGetVertexAttribfv(struct yagl_thread_state *cur_ts, + GLuint index, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count) { @@ -1972,10 +2101,11 @@ void yagl_host_glGetVertexAttribfv(GLuint index, return; } - gles_api_ts->driver->GetVertexAttribfv(index, pname, params); + cur_ts->gles_api_ts->driver->GetVertexAttribfv(index, pname, params); } -void yagl_host_glGetVertexAttribiv(GLuint index, +void yagl_host_glGetVertexAttribiv(struct yagl_thread_state *cur_ts, + GLuint index, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count) { @@ -1983,13 +2113,15 @@ void yagl_host_glGetVertexAttribiv(GLuint index, return; } - gles_api_ts->driver->GetVertexAttribiv(index, pname, params); + cur_ts->gles_api_ts->driver->GetVertexAttribiv(index, pname, params); } -void yagl_host_glLinkProgram(GLuint program, +void yagl_host_glLinkProgram(struct yagl_thread_state *cur_ts, + GLuint program, GLint *params, int32_t params_maxcount, int32_t *params_count) { - GLuint obj = yagl_gles_object_get(program); + GLuint obj = yagl_gles_object_get(cur_ts, program); + struct yagl_gles_api_ts *gles_api_ts = cur_ts->gles_api_ts; gles_api_ts->driver->LinkProgram(obj); @@ -2014,256 +2146,286 @@ void yagl_host_glLinkProgram(GLuint program, } } -void yagl_host_glUniform1f(GLboolean tl, +void yagl_host_glUniform1f(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLfloat x) { - gles_api_ts->driver->Uniform1f( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), x); + cur_ts->gles_api_ts->driver->Uniform1f( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), x); } -void yagl_host_glUniform1fv(GLboolean tl, +void yagl_host_glUniform1fv(struct yagl_thread_state *cur_ts, + 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), + cur_ts->gles_api_ts->driver->Uniform1fv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), v_count, v); } -void yagl_host_glUniform1i(GLboolean tl, +void yagl_host_glUniform1i(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLint x) { - gles_api_ts->driver->Uniform1i( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->Uniform1i( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), x); } -void yagl_host_glUniform1iv(GLboolean tl, +void yagl_host_glUniform1iv(struct yagl_thread_state *cur_ts, + 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), + cur_ts->gles_api_ts->driver->Uniform1iv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), v_count, v); } -void yagl_host_glUniform2f(GLboolean tl, +void yagl_host_glUniform2f(struct yagl_thread_state *cur_ts, + 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), + cur_ts->gles_api_ts->driver->Uniform2f( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), x, y); } -void yagl_host_glUniform2fv(GLboolean tl, +void yagl_host_glUniform2fv(struct yagl_thread_state *cur_ts, + 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), + cur_ts->gles_api_ts->driver->Uniform2fv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), (v_count / 2), v); } -void yagl_host_glUniform2i(GLboolean tl, +void yagl_host_glUniform2i(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLint x, GLint y) { - gles_api_ts->driver->Uniform2i( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->Uniform2i( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), x, y); } -void yagl_host_glUniform2iv(GLboolean tl, +void yagl_host_glUniform2iv(struct yagl_thread_state *cur_ts, + 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), + cur_ts->gles_api_ts->driver->Uniform2iv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), (v_count / 2), v); } -void yagl_host_glUniform3f(GLboolean tl, +void yagl_host_glUniform3f(struct yagl_thread_state *cur_ts, + 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), + cur_ts->gles_api_ts->driver->Uniform3f( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), x, y, z); } -void yagl_host_glUniform3fv(GLboolean tl, +void yagl_host_glUniform3fv(struct yagl_thread_state *cur_ts, + 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), + cur_ts->gles_api_ts->driver->Uniform3fv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), (v_count / 3), v); } -void yagl_host_glUniform3i(GLboolean tl, +void yagl_host_glUniform3i(struct yagl_thread_state *cur_ts, + 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), + cur_ts->gles_api_ts->driver->Uniform3i( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), x, y, z); } -void yagl_host_glUniform3iv(GLboolean tl, +void yagl_host_glUniform3iv(struct yagl_thread_state *cur_ts, + 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), + cur_ts->gles_api_ts->driver->Uniform3iv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), (v_count / 3), v); } -void yagl_host_glUniform4f(GLboolean tl, +void yagl_host_glUniform4f(struct yagl_thread_state *cur_ts, + 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), + cur_ts->gles_api_ts->driver->Uniform4f( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), x, y, z, w); } -void yagl_host_glUniform4fv(GLboolean tl, +void yagl_host_glUniform4fv(struct yagl_thread_state *cur_ts, + 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), + cur_ts->gles_api_ts->driver->Uniform4fv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), (v_count / 4), v); } -void yagl_host_glUniform4i(GLboolean tl, +void yagl_host_glUniform4i(struct yagl_thread_state *cur_ts, + 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), + cur_ts->gles_api_ts->driver->Uniform4i( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), x, y, z, w); } -void yagl_host_glUniform4iv(GLboolean tl, +void yagl_host_glUniform4iv(struct yagl_thread_state *cur_ts, + 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), + cur_ts->gles_api_ts->driver->Uniform4iv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), (v_count / 4), v); } -void yagl_host_glUniformMatrix2fv(GLboolean tl, +void yagl_host_glUniformMatrix2fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count) { - gles_api_ts->driver->UniformMatrix2fv( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->UniformMatrix2fv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), value_count / (2 * 2), transpose, value); } -void yagl_host_glUniformMatrix3fv(GLboolean tl, +void yagl_host_glUniformMatrix3fv(struct yagl_thread_state *cur_ts, + 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), + cur_ts->gles_api_ts->driver->UniformMatrix3fv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), value_count / (3 * 3), transpose, value); } -void yagl_host_glUniformMatrix4fv(GLboolean tl, +void yagl_host_glUniformMatrix4fv(struct yagl_thread_state *cur_ts, + 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), + cur_ts->gles_api_ts->driver->UniformMatrix4fv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), value_count / (4 * 4), transpose, value); } -void yagl_host_glUseProgram(GLuint program) +void yagl_host_glUseProgram(struct yagl_thread_state *cur_ts, + GLuint program) { - gles_api_ts->driver->UseProgram(yagl_gles_object_get(program)); + cur_ts->gles_api_ts->driver->UseProgram(yagl_gles_object_get(cur_ts, program)); } -void yagl_host_glValidateProgram(GLuint program) +void yagl_host_glValidateProgram(struct yagl_thread_state *cur_ts, + GLuint program) { - gles_api_ts->driver->ValidateProgram(yagl_gles_object_get(program)); + cur_ts->gles_api_ts->driver->ValidateProgram(yagl_gles_object_get(cur_ts, program)); } -void yagl_host_glVertexAttrib1f(GLuint indx, +void yagl_host_glVertexAttrib1f(struct yagl_thread_state *cur_ts, + GLuint indx, GLfloat x) { - gles_api_ts->driver->VertexAttrib1f(indx, x); + cur_ts->gles_api_ts->driver->VertexAttrib1f(indx, x); } -void yagl_host_glVertexAttrib1fv(GLuint indx, +void yagl_host_glVertexAttrib1fv(struct yagl_thread_state *cur_ts, + GLuint indx, const GLfloat *values, int32_t values_count) { - gles_api_ts->driver->VertexAttrib1fv(indx, values); + cur_ts->gles_api_ts->driver->VertexAttrib1fv(indx, values); } -void yagl_host_glVertexAttrib2f(GLuint indx, +void yagl_host_glVertexAttrib2f(struct yagl_thread_state *cur_ts, + GLuint indx, GLfloat x, GLfloat y) { - gles_api_ts->driver->VertexAttrib2f(indx, x, y); + cur_ts->gles_api_ts->driver->VertexAttrib2f(indx, x, y); } -void yagl_host_glVertexAttrib2fv(GLuint indx, +void yagl_host_glVertexAttrib2fv(struct yagl_thread_state *cur_ts, + GLuint indx, const GLfloat *values, int32_t values_count) { - gles_api_ts->driver->VertexAttrib2fv(indx, values); + cur_ts->gles_api_ts->driver->VertexAttrib2fv(indx, values); } -void yagl_host_glVertexAttrib3f(GLuint indx, +void yagl_host_glVertexAttrib3f(struct yagl_thread_state *cur_ts, + GLuint indx, GLfloat x, GLfloat y, GLfloat z) { - gles_api_ts->driver->VertexAttrib3f(indx, x, y, z); + cur_ts->gles_api_ts->driver->VertexAttrib3f(indx, x, y, z); } -void yagl_host_glVertexAttrib3fv(GLuint indx, +void yagl_host_glVertexAttrib3fv(struct yagl_thread_state *cur_ts, + GLuint indx, const GLfloat *values, int32_t values_count) { - gles_api_ts->driver->VertexAttrib3fv(indx, values); + cur_ts->gles_api_ts->driver->VertexAttrib3fv(indx, values); } -void yagl_host_glVertexAttrib4f(GLuint indx, +void yagl_host_glVertexAttrib4f(struct yagl_thread_state *cur_ts, + GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - gles_api_ts->driver->VertexAttrib4f(indx, x, y, z, w); + cur_ts->gles_api_ts->driver->VertexAttrib4f(indx, x, y, z, w); } -void yagl_host_glVertexAttrib4fv(GLuint indx, +void yagl_host_glVertexAttrib4fv(struct yagl_thread_state *cur_ts, + GLuint indx, const GLfloat *values, int32_t values_count) { - gles_api_ts->driver->VertexAttrib4fv(indx, values); + cur_ts->gles_api_ts->driver->VertexAttrib4fv(indx, values); } -void yagl_host_glGetActiveUniformsiv(GLuint program, +void yagl_host_glGetActiveUniformsiv(struct yagl_thread_state *cur_ts, + GLuint program, const GLuint *uniformIndices, int32_t uniformIndices_count, GLint *params, int32_t params_maxcount, int32_t *params_count) { @@ -2278,7 +2440,7 @@ void yagl_host_glGetActiveUniformsiv(GLuint program, GL_UNIFORM_MATRIX_STRIDE, GL_UNIFORM_IS_ROW_MAJOR }; - GLuint obj = yagl_gles_object_get(program); + GLuint obj = yagl_gles_object_get(cur_ts, program); int i, num_pnames = sizeof(pnames)/sizeof(pnames[0]); if (params_maxcount != (uniformIndices_count * num_pnames)) { @@ -2286,18 +2448,19 @@ void yagl_host_glGetActiveUniformsiv(GLuint program, } for (i = 0; i < num_pnames; ++i) { - gles_api_ts->driver->GetActiveUniformsiv(obj, - uniformIndices_count, - uniformIndices, - pnames[i], - params); + cur_ts->gles_api_ts->driver->GetActiveUniformsiv(obj, + uniformIndices_count, + uniformIndices, + pnames[i], + params); params += uniformIndices_count; } *params_count = uniformIndices_count * num_pnames; } -void yagl_host_glGetUniformIndices(GLuint program, +void yagl_host_glGetUniformIndices(struct yagl_thread_state *cur_ts, + GLuint program, const GLchar *uniformNames, int32_t uniformNames_count, GLuint *uniformIndices, int32_t uniformIndices_maxcount, int32_t *uniformIndices_count) { @@ -2306,10 +2469,11 @@ void yagl_host_glGetUniformIndices(GLuint program, const GLchar **name_pointers; int num_active_uniforms = 0; GLchar *uniform_name; + struct yagl_gles_api_ts *gles_api_ts = cur_ts->gles_api_ts; YAGL_LOG_FUNC_SET(glGetUniformIndices); - obj = yagl_gles_object_get(program); + obj = yagl_gles_object_get(cur_ts, program); gles_api_ts->driver->GetProgramiv(obj, GL_ACTIVE_UNIFORM_MAX_LENGTH, @@ -2424,40 +2588,44 @@ void yagl_host_glGetUniformIndices(GLuint program, g_free(uniform_name); } -GLuint yagl_host_glGetUniformBlockIndex(GLuint program, +GLuint yagl_host_glGetUniformBlockIndex(struct yagl_thread_state *cur_ts, + GLuint program, const GLchar *uniformBlockName, int32_t uniformBlockName_count) { - return gles_api_ts->driver->GetUniformBlockIndex(yagl_gles_object_get(program), - uniformBlockName); + return cur_ts->gles_api_ts->driver->GetUniformBlockIndex(yagl_gles_object_get(cur_ts, program), + uniformBlockName); } -void yagl_host_glUniformBlockBinding(GLuint program, +void yagl_host_glUniformBlockBinding(struct yagl_thread_state *cur_ts, + GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) { - gles_api_ts->driver->UniformBlockBinding(yagl_gles_object_get(program), - uniformBlockIndex, - uniformBlockBinding); + cur_ts->gles_api_ts->driver->UniformBlockBinding(yagl_gles_object_get(cur_ts, program), + uniformBlockIndex, + uniformBlockBinding); } -void yagl_host_glGetActiveUniformBlockName(GLuint program, +void yagl_host_glGetActiveUniformBlockName(struct yagl_thread_state *cur_ts, + GLuint program, GLuint uniformBlockIndex, GLchar *uniformBlockName, int32_t uniformBlockName_maxcount, int32_t *uniformBlockName_count) { GLsizei tmp = -1; - gles_api_ts->driver->GetActiveUniformBlockName(yagl_gles_object_get(program), - uniformBlockIndex, - uniformBlockName_maxcount, - &tmp, - uniformBlockName); + cur_ts->gles_api_ts->driver->GetActiveUniformBlockName(yagl_gles_object_get(cur_ts, program), + uniformBlockIndex, + uniformBlockName_maxcount, + &tmp, + uniformBlockName); if (tmp >= 0) { *uniformBlockName_count = MIN(tmp + 1, uniformBlockName_maxcount); } } -void yagl_host_glGetActiveUniformBlockiv(GLuint program, +void yagl_host_glGetActiveUniformBlockiv(struct yagl_thread_state *cur_ts, + GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count) @@ -2477,7 +2645,7 @@ void yagl_host_glGetActiveUniformBlockiv(GLuint program, return; } - obj = yagl_gles_object_get(program); + obj = yagl_gles_object_get(cur_ts, program); switch (pname) { case 0: @@ -2489,10 +2657,10 @@ void yagl_host_glGetActiveUniformBlockiv(GLuint program, } for (i = 0; i < num_pnames; ++i) { - gles_api_ts->driver->GetActiveUniformBlockiv(obj, - uniformBlockIndex, - pnames[i], - ¶ms[i]); + cur_ts->gles_api_ts->driver->GetActiveUniformBlockiv(obj, + uniformBlockIndex, + pnames[i], + ¶ms[i]); } *params_count = num_pnames; @@ -2503,10 +2671,10 @@ void yagl_host_glGetActiveUniformBlockiv(GLuint program, * Return active uniform indices only. */ - gles_api_ts->driver->GetActiveUniformBlockiv(obj, - uniformBlockIndex, - GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, - params); + cur_ts->gles_api_ts->driver->GetActiveUniformBlockiv(obj, + uniformBlockIndex, + GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES, + params); *params_count = params_maxcount; @@ -2516,7 +2684,8 @@ void yagl_host_glGetActiveUniformBlockiv(GLuint program, } } -void yagl_host_glGetVertexAttribIiv(GLuint index, +void yagl_host_glGetVertexAttribIiv(struct yagl_thread_state *cur_ts, + GLuint index, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count) { @@ -2524,10 +2693,11 @@ void yagl_host_glGetVertexAttribIiv(GLuint index, return; } - gles_api_ts->driver->GetVertexAttribIiv(index, pname, params); + cur_ts->gles_api_ts->driver->GetVertexAttribIiv(index, pname, params); } -void yagl_host_glGetVertexAttribIuiv(GLuint index, +void yagl_host_glGetVertexAttribIuiv(struct yagl_thread_state *cur_ts, + GLuint index, GLenum pname, GLuint *params, int32_t params_maxcount, int32_t *params_count) { @@ -2535,51 +2705,57 @@ void yagl_host_glGetVertexAttribIuiv(GLuint index, return; } - gles_api_ts->driver->GetVertexAttribIuiv(index, pname, params); + cur_ts->gles_api_ts->driver->GetVertexAttribIuiv(index, pname, params); } -void yagl_host_glVertexAttribI4i(GLuint index, +void yagl_host_glVertexAttribI4i(struct yagl_thread_state *cur_ts, + GLuint index, GLint x, GLint y, GLint z, GLint w) { - gles_api_ts->driver->VertexAttribI4i(index, x, y, z, w); + cur_ts->gles_api_ts->driver->VertexAttribI4i(index, x, y, z, w); } -void yagl_host_glVertexAttribI4ui(GLuint index, +void yagl_host_glVertexAttribI4ui(struct yagl_thread_state *cur_ts, + GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) { - gles_api_ts->driver->VertexAttribI4ui(index, x, y, z, w); + cur_ts->gles_api_ts->driver->VertexAttribI4ui(index, x, y, z, w); } -void yagl_host_glVertexAttribI4iv(GLuint index, +void yagl_host_glVertexAttribI4iv(struct yagl_thread_state *cur_ts, + GLuint index, const GLint *v, int32_t v_count) { - gles_api_ts->driver->VertexAttribI4iv(index, v); + cur_ts->gles_api_ts->driver->VertexAttribI4iv(index, v); } -void yagl_host_glVertexAttribI4uiv(GLuint index, +void yagl_host_glVertexAttribI4uiv(struct yagl_thread_state *cur_ts, + GLuint index, const GLuint *v, int32_t v_count) { - gles_api_ts->driver->VertexAttribI4uiv(index, v); + cur_ts->gles_api_ts->driver->VertexAttribI4uiv(index, v); } -void yagl_host_glGetUniformuiv(GLboolean tl, +void yagl_host_glGetUniformuiv(struct yagl_thread_state *cur_ts, + GLboolean tl, GLuint program, uint32_t location, GLuint *params, int32_t params_maxcount, int32_t *params_count) { GLenum type; - GLuint global_name = yagl_gles_object_get(program); - GLint actual_location = yagl_gles_api_ps_translate_location(gles_api_ts->ps, + GLuint global_name = yagl_gles_object_get(cur_ts, program); + GLint actual_location = yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location); - if (!yagl_gles_program_get_uniform_type(global_name, + if (!yagl_gles_program_get_uniform_type(cur_ts, + global_name, actual_location, &type)) { return; @@ -2589,176 +2765,195 @@ void yagl_host_glGetUniformuiv(GLboolean tl, return; } - gles_api_ts->driver->GetUniformuiv(global_name, - actual_location, - params); + cur_ts->gles_api_ts->driver->GetUniformuiv(global_name, + actual_location, + params); } -void yagl_host_glUniform1ui(GLboolean tl, +void yagl_host_glUniform1ui(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLuint v0) { - gles_api_ts->driver->Uniform1ui( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->Uniform1ui( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), v0); } -void yagl_host_glUniform2ui(GLboolean tl, +void yagl_host_glUniform2ui(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLuint v0, GLuint v1) { - gles_api_ts->driver->Uniform2ui( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->Uniform2ui( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), v0, v1); } -void yagl_host_glUniform3ui(GLboolean tl, +void yagl_host_glUniform3ui(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLuint v0, GLuint v1, GLuint v2) { - gles_api_ts->driver->Uniform3ui( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->Uniform3ui( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), v0, v1, v2); } -void yagl_host_glUniform4ui(GLboolean tl, +void yagl_host_glUniform4ui(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { - gles_api_ts->driver->Uniform4ui( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->Uniform4ui( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), v0, v1, v2, v3); } -void yagl_host_glUniform1uiv(GLboolean tl, +void yagl_host_glUniform1uiv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count) { - gles_api_ts->driver->Uniform1uiv( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->Uniform1uiv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), v_count, v); } -void yagl_host_glUniform2uiv(GLboolean tl, +void yagl_host_glUniform2uiv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count) { - gles_api_ts->driver->Uniform2uiv( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->Uniform2uiv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), (v_count / 2), v); } -void yagl_host_glUniform3uiv(GLboolean tl, +void yagl_host_glUniform3uiv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count) { - gles_api_ts->driver->Uniform3uiv( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->Uniform3uiv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), (v_count / 3), v); } -void yagl_host_glUniform4uiv(GLboolean tl, +void yagl_host_glUniform4uiv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count) { - gles_api_ts->driver->Uniform4uiv( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->Uniform4uiv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), (v_count / 4), v); } -void yagl_host_glUniformMatrix2x3fv(GLboolean tl, +void yagl_host_glUniformMatrix2x3fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count) { - gles_api_ts->driver->UniformMatrix2x3fv( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->UniformMatrix2x3fv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), value_count / (2 * 3), transpose, value); } -void yagl_host_glUniformMatrix2x4fv(GLboolean tl, +void yagl_host_glUniformMatrix2x4fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count) { - gles_api_ts->driver->UniformMatrix2x4fv( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->UniformMatrix2x4fv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), value_count / (2 * 4), transpose, value); } -void yagl_host_glUniformMatrix3x2fv(GLboolean tl, +void yagl_host_glUniformMatrix3x2fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count) { - gles_api_ts->driver->UniformMatrix3x2fv( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->UniformMatrix3x2fv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), value_count / (3 * 2), transpose, value); } -void yagl_host_glUniformMatrix3x4fv(GLboolean tl, +void yagl_host_glUniformMatrix3x4fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count) { - gles_api_ts->driver->UniformMatrix3x4fv( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->UniformMatrix3x4fv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), value_count / (3 * 4), transpose, value); } -void yagl_host_glUniformMatrix4x2fv(GLboolean tl, +void yagl_host_glUniformMatrix4x2fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count) { - gles_api_ts->driver->UniformMatrix4x2fv( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->UniformMatrix4x2fv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), value_count / (4 * 2), transpose, value); } -void yagl_host_glUniformMatrix4x3fv(GLboolean tl, +void yagl_host_glUniformMatrix4x3fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count) { - gles_api_ts->driver->UniformMatrix4x3fv( - yagl_gles_api_ps_translate_location(gles_api_ts->ps, tl, location), + cur_ts->gles_api_ts->driver->UniformMatrix4x3fv( + yagl_gles_api_ps_translate_location(cur_ts->gles_api_ts->ps, tl, location), value_count / (4 * 3), transpose, value); } -int yagl_host_glGetFragDataLocation(GLuint program, +int yagl_host_glGetFragDataLocation(struct yagl_thread_state *cur_ts, + GLuint program, const GLchar *name, int32_t name_count) { - return gles_api_ts->driver->GetFragDataLocation(yagl_gles_object_get(program), - name); + return cur_ts->gles_api_ts->driver->GetFragDataLocation(yagl_gles_object_get(cur_ts, program), + name); } -void yagl_host_glGetIntegerv(GLenum pname, +void yagl_host_glGetIntegerv(struct yagl_thread_state *cur_ts, + GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count) { - gles_api_ts->driver->GetIntegerv(pname, params); + cur_ts->gles_api_ts->driver->GetIntegerv(pname, params); *params_count = params_maxcount; } -void yagl_host_glGetFloatv(GLenum pname, +void yagl_host_glGetFloatv(struct yagl_thread_state *cur_ts, + GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count) { - gles_api_ts->driver->GetFloatv(pname, params); + cur_ts->gles_api_ts->driver->GetFloatv(pname, params); *params_count = params_maxcount; } -void yagl_host_glGetString(GLenum name, +void yagl_host_glGetString(struct yagl_thread_state *cur_ts, + GLenum name, GLchar *str, int32_t str_maxcount, int32_t *str_count) { const char *tmp; + struct yagl_gles_api_ts *gles_api_ts = cur_ts->gles_api_ts; if ((name == GL_EXTENSIONS) && (gles_api_ts->driver->gl_version > yagl_gl_2)) { @@ -2812,78 +3007,86 @@ void yagl_host_glGetString(GLenum name, } } -GLboolean yagl_host_glIsEnabled(GLenum cap) +GLboolean yagl_host_glIsEnabled(struct yagl_thread_state *cur_ts, + GLenum cap) { - return gles_api_ts->driver->IsEnabled(cap); + return cur_ts->gles_api_ts->driver->IsEnabled(cap); } -void yagl_host_glGenTransformFeedbacks(const GLuint *ids, int32_t ids_count) +void yagl_host_glGenTransformFeedbacks(struct yagl_thread_state *cur_ts, + const GLuint *ids, int32_t ids_count) { int i; for (i = 0; i < ids_count; ++i) { GLuint global_name; - gles_api_ts->driver->GenTransformFeedbacks(1, &global_name); + cur_ts->gles_api_ts->driver->GenTransformFeedbacks(1, &global_name); - yagl_gles_object_add(ids[i], + yagl_gles_object_add(cur_ts, + ids[i], global_name, - yagl_get_ctx_id(), + yagl_get_ctx_id(cur_ts), &yagl_gles_transform_feedback_destroy); } } -void yagl_host_glBindTransformFeedback(GLenum target, +void yagl_host_glBindTransformFeedback(struct yagl_thread_state *cur_ts, + GLenum target, GLuint id) { - gles_api_ts->driver->BindTransformFeedback(target, - yagl_gles_object_get(id)); + cur_ts->gles_api_ts->driver->BindTransformFeedback(target, + yagl_gles_object_get(cur_ts, id)); } -void yagl_host_glBeginTransformFeedback(GLenum primitiveMode) +void yagl_host_glBeginTransformFeedback(struct yagl_thread_state *cur_ts, + GLenum primitiveMode) { - gles_api_ts->driver->BeginTransformFeedback(primitiveMode); + cur_ts->gles_api_ts->driver->BeginTransformFeedback(primitiveMode); } -void yagl_host_glEndTransformFeedback(void) +void yagl_host_glEndTransformFeedback(struct yagl_thread_state *cur_ts) { - gles_api_ts->driver->EndTransformFeedback(); + cur_ts->gles_api_ts->driver->EndTransformFeedback(); } -void yagl_host_glPauseTransformFeedback(void) +void yagl_host_glPauseTransformFeedback(struct yagl_thread_state *cur_ts) { - gles_api_ts->driver->PauseTransformFeedback(); + cur_ts->gles_api_ts->driver->PauseTransformFeedback(); } -void yagl_host_glResumeTransformFeedback(void) +void yagl_host_glResumeTransformFeedback(struct yagl_thread_state *cur_ts) { - gles_api_ts->driver->ResumeTransformFeedback(); + cur_ts->gles_api_ts->driver->ResumeTransformFeedback(); } -void yagl_host_glTransformFeedbackVaryings(GLuint program, +void yagl_host_glTransformFeedbackVaryings(struct yagl_thread_state *cur_ts, + struct yagl_transport *t, + GLuint program, const GLchar *varyings, int32_t varyings_count, GLenum bufferMode) { const char **strings; int32_t num_strings = 0; - strings = yagl_transport_get_out_string_array(varyings, + strings = yagl_transport_get_out_string_array(t, varyings, varyings_count, &num_strings); - gles_api_ts->driver->TransformFeedbackVaryings(yagl_gles_object_get(program), - num_strings, - strings, - bufferMode); + cur_ts->gles_api_ts->driver->TransformFeedbackVaryings(yagl_gles_object_get(cur_ts, program), + num_strings, + strings, + bufferMode); g_free(strings); } -void yagl_host_glGetTransformFeedbackVaryings(GLuint program, +void yagl_host_glGetTransformFeedbackVaryings(struct yagl_thread_state *cur_ts, + GLuint program, GLsizei *sizes, int32_t sizes_maxcount, int32_t *sizes_count, GLenum *types, int32_t types_maxcount, int32_t *types_count) { - GLuint obj = yagl_gles_object_get(program); + GLuint obj = yagl_gles_object_get(cur_ts, program); int32_t i; if (sizes_maxcount != types_maxcount) { @@ -2894,10 +3097,10 @@ void yagl_host_glGetTransformFeedbackVaryings(GLuint program, GLsizei length = -1; GLchar c[2]; - gles_api_ts->driver->GetTransformFeedbackVarying(obj, - i, sizeof(c), &length, - &sizes[i], &types[i], - c); + cur_ts->gles_api_ts->driver->GetTransformFeedbackVarying(obj, + i, sizeof(c), &length, + &sizes[i], &types[i], + c); if (length <= 0) { sizes[i] = 0; @@ -2908,528 +3111,601 @@ void yagl_host_glGetTransformFeedbackVaryings(GLuint program, *sizes_count = *types_count = sizes_maxcount; } -void yagl_host_glGenQueries(const GLuint *ids, int32_t ids_count) +void yagl_host_glGenQueries(struct yagl_thread_state *cur_ts, + const GLuint *ids, int32_t ids_count) { int i; for (i = 0; i < ids_count; ++i) { GLuint global_name; - gles_api_ts->driver->GenQueries(1, &global_name); + cur_ts->gles_api_ts->driver->GenQueries(1, &global_name); - yagl_gles_object_add(ids[i], + yagl_gles_object_add(cur_ts, + ids[i], global_name, - yagl_get_ctx_id(), + yagl_get_ctx_id(cur_ts), &yagl_gles_query_destroy); } } -void yagl_host_glBeginQuery(GLenum target, +void yagl_host_glBeginQuery(struct yagl_thread_state *cur_ts, + GLenum target, GLuint id) { - gles_api_ts->driver->BeginQuery(target, yagl_gles_object_get(id)); + cur_ts->gles_api_ts->driver->BeginQuery(target, yagl_gles_object_get(cur_ts, id)); } -void yagl_host_glEndQuery(GLenum target) +void yagl_host_glEndQuery(struct yagl_thread_state *cur_ts, + GLenum target) { - gles_api_ts->driver->EndQuery(target); + cur_ts->gles_api_ts->driver->EndQuery(target); } -GLboolean yagl_host_glGetQueryObjectuiv(GLuint id, +GLboolean yagl_host_glGetQueryObjectuiv(struct yagl_thread_state *cur_ts, + GLuint id, GLenum pname, GLuint *result) { - GLuint obj = yagl_gles_object_get(id); + GLuint obj = yagl_gles_object_get(cur_ts, id); GLuint tmp = 0; if (pname == GL_QUERY_RESULT_AVAILABLE) { - gles_api_ts->driver->GetQueryObjectuiv(obj, GL_QUERY_RESULT_AVAILABLE, &tmp); + cur_ts->gles_api_ts->driver->GetQueryObjectuiv(obj, GL_QUERY_RESULT_AVAILABLE, &tmp); if (tmp) { - gles_api_ts->driver->GetQueryObjectuiv(obj, GL_QUERY_RESULT, result); + cur_ts->gles_api_ts->driver->GetQueryObjectuiv(obj, GL_QUERY_RESULT, result); } } else { - gles_api_ts->driver->GetQueryObjectuiv(obj, GL_QUERY_RESULT, result); + cur_ts->gles_api_ts->driver->GetQueryObjectuiv(obj, GL_QUERY_RESULT, result); tmp = GL_TRUE; } return tmp; } -void yagl_host_glGenSamplers(const GLuint *samplers, int32_t samplers_count) +void yagl_host_glGenSamplers(struct yagl_thread_state *cur_ts, + const GLuint *samplers, int32_t samplers_count) { int i; for (i = 0; i < samplers_count; ++i) { GLuint global_name; - gles_api_ts->driver->GenSamplers(1, &global_name); + cur_ts->gles_api_ts->driver->GenSamplers(1, &global_name); - yagl_gles_object_add(samplers[i], + yagl_gles_object_add(cur_ts, + samplers[i], global_name, 0, &yagl_gles_sampler_destroy); } } -void yagl_host_glBindSampler(GLuint unit, +void yagl_host_glBindSampler(struct yagl_thread_state *cur_ts, + GLuint unit, GLuint sampler) { - gles_api_ts->driver->BindSampler(unit, yagl_gles_object_get(sampler)); + cur_ts->gles_api_ts->driver->BindSampler(unit, yagl_gles_object_get(cur_ts, sampler)); } -void yagl_host_glSamplerParameteri(GLuint sampler, +void yagl_host_glSamplerParameteri(struct yagl_thread_state *cur_ts, + GLuint sampler, GLenum pname, GLint param) { - gles_api_ts->driver->SamplerParameteri(yagl_gles_object_get(sampler), pname, param); + cur_ts->gles_api_ts->driver->SamplerParameteri(yagl_gles_object_get(cur_ts, sampler), pname, param); } -void yagl_host_glSamplerParameteriv(GLuint sampler, +void yagl_host_glSamplerParameteriv(struct yagl_thread_state *cur_ts, + GLuint sampler, GLenum pname, const GLint *param, int32_t param_count) { - gles_api_ts->driver->SamplerParameteriv(yagl_gles_object_get(sampler), pname, param); + cur_ts->gles_api_ts->driver->SamplerParameteriv(yagl_gles_object_get(cur_ts, sampler), pname, param); } -void yagl_host_glSamplerParameterf(GLuint sampler, +void yagl_host_glSamplerParameterf(struct yagl_thread_state *cur_ts, + GLuint sampler, GLenum pname, GLfloat param) { - gles_api_ts->driver->SamplerParameterf(yagl_gles_object_get(sampler), pname, param); + cur_ts->gles_api_ts->driver->SamplerParameterf(yagl_gles_object_get(cur_ts, sampler), pname, param); } -void yagl_host_glSamplerParameterfv(GLuint sampler, +void yagl_host_glSamplerParameterfv(struct yagl_thread_state *cur_ts, + GLuint sampler, GLenum pname, const GLfloat *param, int32_t param_count) { - gles_api_ts->driver->SamplerParameterfv(yagl_gles_object_get(sampler), pname, param); + cur_ts->gles_api_ts->driver->SamplerParameterfv(yagl_gles_object_get(cur_ts, sampler), pname, param); } -void yagl_host_glDeleteObjects(const GLuint *objects, int32_t objects_count) +void yagl_host_glDeleteObjects(struct yagl_thread_state *cur_ts, + 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]); + yagl_object_map_remove(cur_ts, cur_ts->ps->object_map, objects[i]); } } -void yagl_host_glBlendEquation(GLenum mode) +void yagl_host_glBlendEquation(struct yagl_thread_state *cur_ts, + GLenum mode) { - gles_api_ts->driver->BlendEquation(mode); + cur_ts->gles_api_ts->driver->BlendEquation(mode); } -void yagl_host_glBlendEquationSeparate(GLenum modeRGB, +void yagl_host_glBlendEquationSeparate(struct yagl_thread_state *cur_ts, + GLenum modeRGB, GLenum modeAlpha) { - gles_api_ts->driver->BlendEquationSeparate(modeRGB, modeAlpha); + cur_ts->gles_api_ts->driver->BlendEquationSeparate(modeRGB, modeAlpha); } -void yagl_host_glBlendFunc(GLenum sfactor, +void yagl_host_glBlendFunc(struct yagl_thread_state *cur_ts, + GLenum sfactor, GLenum dfactor) { - gles_api_ts->driver->BlendFunc(sfactor, dfactor); + cur_ts->gles_api_ts->driver->BlendFunc(sfactor, dfactor); } -void yagl_host_glBlendFuncSeparate(GLenum srcRGB, +void yagl_host_glBlendFuncSeparate(struct yagl_thread_state *cur_ts, + GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { - gles_api_ts->driver->BlendFuncSeparate(srcRGB, + cur_ts->gles_api_ts->driver->BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); } -void yagl_host_glBlendColor(GLclampf red, +void yagl_host_glBlendColor(struct yagl_thread_state *cur_ts, + GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - gles_api_ts->driver->BlendColor(red, green, blue, alpha); + cur_ts->gles_api_ts->driver->BlendColor(red, green, blue, alpha); } -void yagl_host_glClear(GLbitfield mask) +void yagl_host_glClear(struct yagl_thread_state *cur_ts, + GLbitfield mask) { - gles_api_ts->driver->Clear(mask); + cur_ts->gles_api_ts->driver->Clear(mask); } -void yagl_host_glClearColor(GLclampf red, +void yagl_host_glClearColor(struct yagl_thread_state *cur_ts, + GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - gles_api_ts->driver->ClearColor(red, green, blue, alpha); + cur_ts->gles_api_ts->driver->ClearColor(red, green, blue, alpha); } -void yagl_host_glClearDepthf(GLclampf depth) +void yagl_host_glClearDepthf(struct yagl_thread_state *cur_ts, + GLclampf depth) { - gles_api_ts->driver->ClearDepth(depth); + cur_ts->gles_api_ts->driver->ClearDepth(depth); } -void yagl_host_glClearStencil(GLint s) +void yagl_host_glClearStencil(struct yagl_thread_state *cur_ts, + GLint s) { - gles_api_ts->driver->ClearStencil(s); + cur_ts->gles_api_ts->driver->ClearStencil(s); } -void yagl_host_glColorMask(GLboolean red, +void yagl_host_glColorMask(struct yagl_thread_state *cur_ts, + GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { - gles_api_ts->driver->ColorMask(red, green, blue, alpha); + cur_ts->gles_api_ts->driver->ColorMask(red, green, blue, alpha); } -void yagl_host_glCullFace(GLenum mode) +void yagl_host_glCullFace(struct yagl_thread_state *cur_ts, + GLenum mode) { - gles_api_ts->driver->CullFace(mode); + cur_ts->gles_api_ts->driver->CullFace(mode); } -void yagl_host_glDepthFunc(GLenum func) +void yagl_host_glDepthFunc(struct yagl_thread_state *cur_ts, + GLenum func) { - gles_api_ts->driver->DepthFunc(func); + cur_ts->gles_api_ts->driver->DepthFunc(func); } -void yagl_host_glDepthMask(GLboolean flag) +void yagl_host_glDepthMask(struct yagl_thread_state *cur_ts, + GLboolean flag) { - gles_api_ts->driver->DepthMask(flag); + cur_ts->gles_api_ts->driver->DepthMask(flag); } -void yagl_host_glDepthRangef(GLclampf zNear, +void yagl_host_glDepthRangef(struct yagl_thread_state *cur_ts, + GLclampf zNear, GLclampf zFar) { - gles_api_ts->driver->DepthRange(zNear, zFar); + cur_ts->gles_api_ts->driver->DepthRange(zNear, zFar); } -void yagl_host_glEnable(GLenum cap) +void yagl_host_glEnable(struct yagl_thread_state *cur_ts, + GLenum cap) { - gles_api_ts->driver->Enable(cap); + cur_ts->gles_api_ts->driver->Enable(cap); } -void yagl_host_glDisable(GLenum cap) +void yagl_host_glDisable(struct yagl_thread_state *cur_ts, + GLenum cap) { - gles_api_ts->driver->Disable(cap); + cur_ts->gles_api_ts->driver->Disable(cap); } -void yagl_host_glFlush(void) +void yagl_host_glFlush(struct yagl_thread_state *cur_ts) { - gles_api_ts->driver->Flush(); + cur_ts->gles_api_ts->driver->Flush(); } -void yagl_host_glFrontFace(GLenum mode) +void yagl_host_glFrontFace(struct yagl_thread_state *cur_ts, + GLenum mode) { - gles_api_ts->driver->FrontFace(mode); + cur_ts->gles_api_ts->driver->FrontFace(mode); } -void yagl_host_glGenerateMipmap(GLenum target) +void yagl_host_glGenerateMipmap(struct yagl_thread_state *cur_ts, + GLenum target) { - gles_api_ts->driver->GenerateMipmap(target); + cur_ts->gles_api_ts->driver->GenerateMipmap(target); } -void yagl_host_glHint(GLenum target, +void yagl_host_glHint(struct yagl_thread_state *cur_ts, + GLenum target, GLenum mode) { - gles_api_ts->driver->Hint(target, mode); + cur_ts->gles_api_ts->driver->Hint(target, mode); } -void yagl_host_glLineWidth(GLfloat width) +void yagl_host_glLineWidth(struct yagl_thread_state *cur_ts, + GLfloat width) { - gles_api_ts->driver->LineWidth(width); + cur_ts->gles_api_ts->driver->LineWidth(width); } -void yagl_host_glPixelStorei(GLenum pname, +void yagl_host_glPixelStorei(struct yagl_thread_state *cur_ts, + GLenum pname, GLint param) { - gles_api_ts->driver->PixelStorei(pname, param); + cur_ts->gles_api_ts->driver->PixelStorei(pname, param); } -void yagl_host_glPolygonOffset(GLfloat factor, +void yagl_host_glPolygonOffset(struct yagl_thread_state *cur_ts, + GLfloat factor, GLfloat units) { - gles_api_ts->driver->PolygonOffset(factor, units); + cur_ts->gles_api_ts->driver->PolygonOffset(factor, units); } -void yagl_host_glScissor(GLint x, +void yagl_host_glScissor(struct yagl_thread_state *cur_ts, + GLint x, GLint y, GLsizei width, GLsizei height) { - gles_api_ts->driver->Scissor(x, y, width, height); + cur_ts->gles_api_ts->driver->Scissor(x, y, width, height); } -void yagl_host_glStencilFunc(GLenum func, +void yagl_host_glStencilFunc(struct yagl_thread_state *cur_ts, + GLenum func, GLint ref, GLuint mask) { - gles_api_ts->driver->StencilFunc(func, ref, mask); + cur_ts->gles_api_ts->driver->StencilFunc(func, ref, mask); } -void yagl_host_glStencilMask(GLuint mask) +void yagl_host_glStencilMask(struct yagl_thread_state *cur_ts, + GLuint mask) { - gles_api_ts->driver->StencilMask(mask); + cur_ts->gles_api_ts->driver->StencilMask(mask); } -void yagl_host_glStencilOp(GLenum fail, +void yagl_host_glStencilOp(struct yagl_thread_state *cur_ts, + GLenum fail, GLenum zfail, GLenum zpass) { - gles_api_ts->driver->StencilOp(fail, zfail, zpass); + cur_ts->gles_api_ts->driver->StencilOp(fail, zfail, zpass); } -void yagl_host_glSampleCoverage(GLclampf value, +void yagl_host_glSampleCoverage(struct yagl_thread_state *cur_ts, + GLclampf value, GLboolean invert) { - gles_api_ts->driver->SampleCoverage(value, invert); + cur_ts->gles_api_ts->driver->SampleCoverage(value, invert); } -void yagl_host_glViewport(GLint x, +void yagl_host_glViewport(struct yagl_thread_state *cur_ts, + GLint x, GLint y, GLsizei width, GLsizei height) { - gles_api_ts->driver->Viewport(x, y, width, height); + cur_ts->gles_api_ts->driver->Viewport(x, y, width, height); } -void yagl_host_glStencilFuncSeparate(GLenum face, +void yagl_host_glStencilFuncSeparate(struct yagl_thread_state *cur_ts, + GLenum face, GLenum func, GLint ref, GLuint mask) { - gles_api_ts->driver->StencilFuncSeparate(face, func, ref, mask); + cur_ts->gles_api_ts->driver->StencilFuncSeparate(face, func, ref, mask); } -void yagl_host_glStencilMaskSeparate(GLenum face, +void yagl_host_glStencilMaskSeparate(struct yagl_thread_state *cur_ts, + GLenum face, GLuint mask) { - gles_api_ts->driver->StencilMaskSeparate(face, mask); + cur_ts->gles_api_ts->driver->StencilMaskSeparate(face, mask); } -void yagl_host_glStencilOpSeparate(GLenum face, +void yagl_host_glStencilOpSeparate(struct yagl_thread_state *cur_ts, + GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { - gles_api_ts->driver->StencilOpSeparate(face, fail, zfail, zpass); + cur_ts->gles_api_ts->driver->StencilOpSeparate(face, fail, zfail, zpass); } -void yagl_host_glPointSize(GLfloat size) +void yagl_host_glPointSize(struct yagl_thread_state *cur_ts, + GLfloat size) { - gles_api_ts->driver->PointSize(size); + cur_ts->gles_api_ts->driver->PointSize(size); } -void yagl_host_glAlphaFunc(GLenum func, +void yagl_host_glAlphaFunc(struct yagl_thread_state *cur_ts, + GLenum func, GLclampf ref) { - gles_api_ts->driver->AlphaFunc(func, ref); + cur_ts->gles_api_ts->driver->AlphaFunc(func, ref); } -void yagl_host_glMatrixMode(GLenum mode) +void yagl_host_glMatrixMode(struct yagl_thread_state *cur_ts, + GLenum mode) { - gles_api_ts->driver->MatrixMode(mode); + cur_ts->gles_api_ts->driver->MatrixMode(mode); } -void yagl_host_glLoadIdentity(void) +void yagl_host_glLoadIdentity(struct yagl_thread_state *cur_ts) { - gles_api_ts->driver->LoadIdentity(); + cur_ts->gles_api_ts->driver->LoadIdentity(); } -void yagl_host_glPopMatrix(void) +void yagl_host_glPopMatrix(struct yagl_thread_state *cur_ts) { - gles_api_ts->driver->PopMatrix(); + cur_ts->gles_api_ts->driver->PopMatrix(); } -void yagl_host_glPushMatrix(void) +void yagl_host_glPushMatrix(struct yagl_thread_state *cur_ts) { - gles_api_ts->driver->PushMatrix(); + cur_ts->gles_api_ts->driver->PushMatrix(); } -void yagl_host_glRotatef(GLfloat angle, +void yagl_host_glRotatef(struct yagl_thread_state *cur_ts, + GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { - gles_api_ts->driver->Rotatef(angle, x, y, z); + cur_ts->gles_api_ts->driver->Rotatef(angle, x, y, z); } -void yagl_host_glTranslatef(GLfloat x, +void yagl_host_glTranslatef(struct yagl_thread_state *cur_ts, + GLfloat x, GLfloat y, GLfloat z) { - gles_api_ts->driver->Translatef(x, y, z); + cur_ts->gles_api_ts->driver->Translatef(x, y, z); } -void yagl_host_glScalef(GLfloat x, +void yagl_host_glScalef(struct yagl_thread_state *cur_ts, + GLfloat x, GLfloat y, GLfloat z) { - gles_api_ts->driver->Scalef(x, y, z); + cur_ts->gles_api_ts->driver->Scalef(x, y, z); } -void yagl_host_glOrthof(GLfloat left, +void yagl_host_glOrthof(struct yagl_thread_state *cur_ts, + GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { - gles_api_ts->driver->Ortho(left, right, bottom, top, zNear, zFar); + cur_ts->gles_api_ts->driver->Ortho(left, right, bottom, top, zNear, zFar); } -void yagl_host_glColor4f(GLfloat red, +void yagl_host_glColor4f(struct yagl_thread_state *cur_ts, + GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { - gles_api_ts->driver->Color4f(red, green, blue, alpha); + cur_ts->gles_api_ts->driver->Color4f(red, green, blue, alpha); } -void yagl_host_glColor4ub(GLubyte red, +void yagl_host_glColor4ub(struct yagl_thread_state *cur_ts, + GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { - gles_api_ts->driver->Color4ub(red, green, blue, alpha); + cur_ts->gles_api_ts->driver->Color4ub(red, green, blue, alpha); } -void yagl_host_glNormal3f(GLfloat nx, +void yagl_host_glNormal3f(struct yagl_thread_state *cur_ts, + GLfloat nx, GLfloat ny, GLfloat nz) { - gles_api_ts->driver->Normal3f(nx, ny, nz); + cur_ts->gles_api_ts->driver->Normal3f(nx, ny, nz); } -void yagl_host_glPointParameterf(GLenum pname, +void yagl_host_glPointParameterf(struct yagl_thread_state *cur_ts, + GLenum pname, GLfloat param) { - gles_api_ts->driver->PointParameterf(pname, param); + cur_ts->gles_api_ts->driver->PointParameterf(pname, param); } -void yagl_host_glPointParameterfv(GLenum pname, +void yagl_host_glPointParameterfv(struct yagl_thread_state *cur_ts, + GLenum pname, const GLfloat *params, int32_t params_count) { - gles_api_ts->driver->PointParameterfv(pname, params); + cur_ts->gles_api_ts->driver->PointParameterfv(pname, params); } -void yagl_host_glFogf(GLenum pname, +void yagl_host_glFogf(struct yagl_thread_state *cur_ts, + GLenum pname, GLfloat param) { - gles_api_ts->driver->Fogf(pname, param); + cur_ts->gles_api_ts->driver->Fogf(pname, param); } -void yagl_host_glFogfv(GLenum pname, +void yagl_host_glFogfv(struct yagl_thread_state *cur_ts, + GLenum pname, const GLfloat *params, int32_t params_count) { - gles_api_ts->driver->Fogfv(pname, params); + cur_ts->gles_api_ts->driver->Fogfv(pname, params); } -void yagl_host_glFrustumf(GLfloat left, +void yagl_host_glFrustumf(struct yagl_thread_state *cur_ts, + GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { - gles_api_ts->driver->Frustum(left, right, bottom, top, zNear, zFar); + cur_ts->gles_api_ts->driver->Frustum(left, right, bottom, top, zNear, zFar); } -void yagl_host_glLightf(GLenum light, +void yagl_host_glLightf(struct yagl_thread_state *cur_ts, + GLenum light, GLenum pname, GLfloat param) { - gles_api_ts->driver->Lightf(light, pname, param); + cur_ts->gles_api_ts->driver->Lightf(light, pname, param); } -void yagl_host_glLightfv(GLenum light, +void yagl_host_glLightfv(struct yagl_thread_state *cur_ts, + GLenum light, GLenum pname, const GLfloat *params, int32_t params_count) { - gles_api_ts->driver->Lightfv(light, pname, params); + cur_ts->gles_api_ts->driver->Lightfv(light, pname, params); } -void yagl_host_glGetLightfv(GLenum light, +void yagl_host_glGetLightfv(struct yagl_thread_state *cur_ts, + GLenum light, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count) { - gles_api_ts->driver->GetLightfv(light, pname, params); + cur_ts->gles_api_ts->driver->GetLightfv(light, pname, params); *params_count = params_maxcount; } -void yagl_host_glLightModelf(GLenum pname, +void yagl_host_glLightModelf(struct yagl_thread_state *cur_ts, + GLenum pname, GLfloat param) { - gles_api_ts->driver->LightModelf(pname, param); + cur_ts->gles_api_ts->driver->LightModelf(pname, param); } -void yagl_host_glLightModelfv(GLenum pname, +void yagl_host_glLightModelfv(struct yagl_thread_state *cur_ts, + GLenum pname, const GLfloat *params, int32_t params_count) { - gles_api_ts->driver->LightModelfv(pname, params); + cur_ts->gles_api_ts->driver->LightModelfv(pname, params); } -void yagl_host_glMaterialf(GLenum face, +void yagl_host_glMaterialf(struct yagl_thread_state *cur_ts, + GLenum face, GLenum pname, GLfloat param) { - gles_api_ts->driver->Materialf(face, pname, param); + cur_ts->gles_api_ts->driver->Materialf(face, pname, param); } -void yagl_host_glMaterialfv(GLenum face, +void yagl_host_glMaterialfv(struct yagl_thread_state *cur_ts, + GLenum face, GLenum pname, const GLfloat *params, int32_t params_count) { - gles_api_ts->driver->Materialfv(face, pname, params); + cur_ts->gles_api_ts->driver->Materialfv(face, pname, params); } -void yagl_host_glGetMaterialfv(GLenum face, +void yagl_host_glGetMaterialfv(struct yagl_thread_state *cur_ts, + GLenum face, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count) { - gles_api_ts->driver->GetMaterialfv(face, pname, params); + cur_ts->gles_api_ts->driver->GetMaterialfv(face, pname, params); *params_count = params_maxcount; } -void yagl_host_glShadeModel(GLenum mode) +void yagl_host_glShadeModel(struct yagl_thread_state *cur_ts, + GLenum mode) { - gles_api_ts->driver->ShadeModel(mode); + cur_ts->gles_api_ts->driver->ShadeModel(mode); } -void yagl_host_glLogicOp(GLenum opcode) +void yagl_host_glLogicOp(struct yagl_thread_state *cur_ts, + GLenum opcode) { - gles_api_ts->driver->LogicOp(opcode); + cur_ts->gles_api_ts->driver->LogicOp(opcode); } -void yagl_host_glMultMatrixf(const GLfloat *m, int32_t m_count) +void yagl_host_glMultMatrixf(struct yagl_thread_state *cur_ts, + const GLfloat *m, int32_t m_count) { - gles_api_ts->driver->MultMatrixf(m); + cur_ts->gles_api_ts->driver->MultMatrixf(m); } -void yagl_host_glLoadMatrixf(const GLfloat *m, int32_t m_count) +void yagl_host_glLoadMatrixf(struct yagl_thread_state *cur_ts, + const GLfloat *m, int32_t m_count) { - gles_api_ts->driver->LoadMatrixf(m); + cur_ts->gles_api_ts->driver->LoadMatrixf(m); } -void yagl_host_glClipPlanef(GLenum plane, +void yagl_host_glClipPlanef(struct yagl_thread_state *cur_ts, + GLenum plane, const GLfloat *equation, int32_t equation_count) { - yagl_GLdouble equationd[4] = {0}; + 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[0]); + cur_ts->gles_api_ts->driver->ClipPlane(plane, equationd); } else { - gles_api_ts->driver->ClipPlane(plane, NULL); + cur_ts->gles_api_ts->driver->ClipPlane(plane, NULL); } } -void yagl_host_glGetClipPlanef(GLenum pname, +void yagl_host_glGetClipPlanef(struct yagl_thread_state *cur_ts, + GLenum pname, GLfloat *eqn, int32_t eqn_maxcount, int32_t *eqn_count) { - yagl_GLdouble eqnd[4] = {0}; + yagl_GLdouble eqnd[4]; - gles_api_ts->driver->GetClipPlane(pname, &eqnd[0]); + cur_ts->gles_api_ts->driver->GetClipPlane(pname, eqnd); if (eqn) { eqn[0] = eqnd[0]; @@ -3440,7 +3716,8 @@ void yagl_host_glGetClipPlanef(GLenum pname, } } -void yagl_host_glUpdateOffscreenImageYAGL(GLuint texture, +void yagl_host_glUpdateOffscreenImageYAGL(struct yagl_thread_state *cur_ts, + GLuint texture, uint32_t width, uint32_t height, uint32_t bpp, @@ -3449,6 +3726,7 @@ void yagl_host_glUpdateOffscreenImageYAGL(GLuint texture, GLenum format = 0; GLuint cur_tex = 0; GLsizei unpack[3]; + struct yagl_gles_api_ts *gles_api_ts = cur_ts->gles_api_ts; YAGL_LOG_FUNC_SET(glUpdateOffscreenImageYAGL); @@ -3476,7 +3754,7 @@ void yagl_host_glUpdateOffscreenImageYAGL(GLuint texture, gles_api_ts->driver->PixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0); gles_api_ts->driver->BindTexture(GL_TEXTURE_2D, - yagl_gles_object_get(texture)); + yagl_gles_object_get(cur_ts, 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); @@ -3498,20 +3776,22 @@ void yagl_host_glUpdateOffscreenImageYAGL(GLuint texture, gles_api_ts->driver->BindTexture(GL_TEXTURE_2D, cur_tex); } -void yagl_host_glGenUniformLocationYAGL(uint32_t location, +void yagl_host_glGenUniformLocationYAGL(struct yagl_thread_state *cur_ts, + uint32_t location, GLuint program, const GLchar *name, int32_t name_count) { - yagl_gles_api_ps_add_location(gles_api_ts->ps, + yagl_gles_api_ps_add_location(cur_ts->gles_api_ts->ps, location, - gles_api_ts->driver->GetUniformLocation(yagl_gles_object_get(program), name)); + cur_ts->gles_api_ts->driver->GetUniformLocation(yagl_gles_object_get(cur_ts, program), name)); } -void yagl_host_glDeleteUniformLocationsYAGL(const uint32_t *locations, int32_t locations_count) +void yagl_host_glDeleteUniformLocationsYAGL(struct yagl_thread_state *cur_ts, + const uint32_t *locations, int32_t locations_count) { int i; for (i = 0; i < locations_count; ++i) { - yagl_gles_api_ps_remove_location(gles_api_ts->ps, locations[i]); + yagl_gles_api_ps_remove_location(cur_ts->gles_api_ts->ps, locations[i]); } } diff --git a/hw/yagl/yagl_apis/gles/yagl_host_gles_calls.h b/hw/yagl/yagl_apis/gles/yagl_host_gles_calls.h index cc87ee57a4..ddb212a8f4 100644 --- a/hw/yagl/yagl_apis/gles/yagl_host_gles_calls.h +++ b/hw/yagl/yagl_apis/gles/yagl_host_gles_calls.h @@ -33,141 +33,179 @@ #include "yagl_api.h" #include -struct yagl_api_ps *yagl_host_gles_process_init(struct yagl_api *api); +struct yagl_api_ps *yagl_host_gles_process_init(struct yagl_process_state *ps, struct yagl_api *api); -void yagl_host_glDrawArrays(GLenum mode, +void yagl_host_glDrawArrays(struct yagl_thread_state *cur_ts, + GLenum mode, GLint first, GLsizei count); -void yagl_host_glDrawElements(GLenum mode, +void yagl_host_glDrawElements(struct yagl_thread_state *cur_ts, + GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, int32_t indices_count); -void yagl_host_glReadPixelsData(GLint x, +void yagl_host_glReadPixelsData(struct yagl_thread_state *cur_ts, + 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_glReadPixelsOffset(GLint x, +void yagl_host_glReadPixelsOffset(struct yagl_thread_state *cur_ts, + GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, uintptr_t pixels); -void yagl_host_glDrawArraysInstanced(GLenum mode, +void yagl_host_glDrawArraysInstanced(struct yagl_thread_state *cur_ts, + GLenum mode, GLint start, GLsizei count, GLsizei primcount); -void yagl_host_glDrawElementsInstanced(GLenum mode, +void yagl_host_glDrawElementsInstanced(struct yagl_thread_state *cur_ts, + GLenum mode, GLsizei count, GLenum type, const void *indices, int32_t indices_count, GLsizei primcount); -void yagl_host_glDrawRangeElements(GLenum mode, +void yagl_host_glDrawRangeElements(struct yagl_thread_state *cur_ts, + GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, int32_t indices_count); -void yagl_host_glGenVertexArrays(const GLuint *arrays, int32_t arrays_count); -void yagl_host_glBindVertexArray(GLuint array); -void yagl_host_glDisableVertexAttribArray(GLuint index); -void yagl_host_glEnableVertexAttribArray(GLuint index); -void yagl_host_glVertexAttribPointerData(GLuint indx, +void yagl_host_glGenVertexArrays(struct yagl_thread_state *cur_ts, + const GLuint *arrays, int32_t arrays_count); +void yagl_host_glBindVertexArray(struct yagl_thread_state *cur_ts, + GLuint array); +void yagl_host_glDisableVertexAttribArray(struct yagl_thread_state *cur_ts, + GLuint index); +void yagl_host_glEnableVertexAttribArray(struct yagl_thread_state *cur_ts, + GLuint index); +void yagl_host_glVertexAttribPointerData(struct yagl_thread_state *cur_ts, + 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, +void yagl_host_glVertexAttribPointerOffset(struct yagl_thread_state *cur_ts, + GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, uintptr_t offset); -void yagl_host_glVertexPointerData(GLint size, +void yagl_host_glVertexPointerData(struct yagl_thread_state *cur_ts, + GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count); -void yagl_host_glVertexPointerOffset(GLint size, +void yagl_host_glVertexPointerOffset(struct yagl_thread_state *cur_ts, + GLint size, GLenum type, GLsizei stride, uintptr_t offset); -void yagl_host_glNormalPointerData(GLenum type, +void yagl_host_glNormalPointerData(struct yagl_thread_state *cur_ts, + GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count); -void yagl_host_glNormalPointerOffset(GLenum type, +void yagl_host_glNormalPointerOffset(struct yagl_thread_state *cur_ts, + GLenum type, GLsizei stride, uintptr_t offset); -void yagl_host_glColorPointerData(GLint size, +void yagl_host_glColorPointerData(struct yagl_thread_state *cur_ts, + GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count); -void yagl_host_glColorPointerOffset(GLint size, +void yagl_host_glColorPointerOffset(struct yagl_thread_state *cur_ts, + GLint size, GLenum type, GLsizei stride, uintptr_t offset); -void yagl_host_glTexCoordPointerData(GLint tex_id, +void yagl_host_glTexCoordPointerData(struct yagl_thread_state *cur_ts, + GLint tex_id, GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count); -void yagl_host_glTexCoordPointerOffset(GLint size, +void yagl_host_glTexCoordPointerOffset(struct yagl_thread_state *cur_ts, + GLint size, GLenum type, GLsizei stride, uintptr_t offset); -void yagl_host_glDisableClientState(GLenum array); -void yagl_host_glEnableClientState(GLenum array); -void yagl_host_glVertexAttribDivisor(GLuint index, +void yagl_host_glDisableClientState(struct yagl_thread_state *cur_ts, + GLenum array); +void yagl_host_glEnableClientState(struct yagl_thread_state *cur_ts, + GLenum array); +void yagl_host_glVertexAttribDivisor(struct yagl_thread_state *cur_ts, + GLuint index, GLuint divisor); -void yagl_host_glVertexAttribIPointerData(GLuint index, +void yagl_host_glVertexAttribIPointerData(struct yagl_thread_state *cur_ts, + GLuint index, GLint size, GLenum type, GLsizei stride, GLint first, const GLvoid *data, int32_t data_count); -void yagl_host_glVertexAttribIPointerOffset(GLuint index, +void yagl_host_glVertexAttribIPointerOffset(struct yagl_thread_state *cur_ts, + GLuint index, GLint size, GLenum type, GLsizei stride, uintptr_t offset); -void yagl_host_glGenBuffers(const GLuint *buffers, int32_t buffers_count); -void yagl_host_glBindBuffer(GLenum target, +void yagl_host_glGenBuffers(struct yagl_thread_state *cur_ts, + const GLuint *buffers, int32_t buffers_count); +void yagl_host_glBindBuffer(struct yagl_thread_state *cur_ts, + GLenum target, GLuint buffer); -void yagl_host_glBufferData(GLenum target, +void yagl_host_glBufferData(struct yagl_thread_state *cur_ts, + GLenum target, const GLvoid *data, int32_t data_count, GLenum usage); -void yagl_host_glBufferSubData(GLenum target, +void yagl_host_glBufferSubData(struct yagl_thread_state *cur_ts, + GLenum target, GLsizei offset, const GLvoid *data, int32_t data_count); -void yagl_host_glBindBufferBase(GLenum target, +void yagl_host_glBindBufferBase(struct yagl_thread_state *cur_ts, + GLenum target, GLuint index, GLuint buffer); -void yagl_host_glBindBufferRange(GLenum target, +void yagl_host_glBindBufferRange(struct yagl_thread_state *cur_ts, + GLenum target, GLuint index, GLuint buffer, GLint offset, GLsizei size); -void yagl_host_glMapBuffer(GLuint buffer, +void yagl_host_glMapBuffer(struct yagl_thread_state *cur_ts, + GLuint buffer, const GLuint *ranges, int32_t ranges_count, GLvoid *data, int32_t data_maxcount, int32_t *data_count); -void yagl_host_glCopyBufferSubData(GLenum readTarget, +void yagl_host_glCopyBufferSubData(struct yagl_thread_state *cur_ts, + GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizei size); -void yagl_host_glGenTextures(const GLuint *textures, int32_t textures_count); -void yagl_host_glBindTexture(GLenum target, +void yagl_host_glGenTextures(struct yagl_thread_state *cur_ts, + const GLuint *textures, int32_t textures_count); +void yagl_host_glBindTexture(struct yagl_thread_state *cur_ts, + GLenum target, GLuint texture); -void yagl_host_glActiveTexture(GLenum texture); -void yagl_host_glCopyTexImage2D(GLenum target, +void yagl_host_glActiveTexture(struct yagl_thread_state *cur_ts, + GLenum texture); +void yagl_host_glCopyTexImage2D(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLenum internalformat, GLint x, @@ -175,7 +213,8 @@ void yagl_host_glCopyTexImage2D(GLenum target, GLsizei width, GLsizei height, GLint border); -void yagl_host_glCopyTexSubImage2D(GLenum target, +void yagl_host_glCopyTexSubImage2D(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -183,13 +222,16 @@ void yagl_host_glCopyTexSubImage2D(GLenum target, GLint y, GLsizei width, GLsizei height); -void yagl_host_glGetTexParameterfv(GLenum target, +void yagl_host_glGetTexParameterfv(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, GLfloat *param); -void yagl_host_glGetTexParameteriv(GLenum target, +void yagl_host_glGetTexParameteriv(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, GLint *param); -void yagl_host_glTexImage2DData(GLenum target, +void yagl_host_glTexImage2DData(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint internalformat, GLsizei width, @@ -198,7 +240,8 @@ void yagl_host_glTexImage2DData(GLenum target, GLenum format, GLenum type, const GLvoid *pixels, int32_t pixels_count); -void yagl_host_glTexImage2DOffset(GLenum target, +void yagl_host_glTexImage2DOffset(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint internalformat, GLsizei width, @@ -207,19 +250,24 @@ void yagl_host_glTexImage2DOffset(GLenum target, GLenum format, GLenum type, uintptr_t pixels); -void yagl_host_glTexParameterf(GLenum target, +void yagl_host_glTexParameterf(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, GLfloat param); -void yagl_host_glTexParameterfv(GLenum target, +void yagl_host_glTexParameterfv(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, const GLfloat *params, int32_t params_count); -void yagl_host_glTexParameteri(GLenum target, +void yagl_host_glTexParameteri(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, GLint param); -void yagl_host_glTexParameteriv(GLenum target, +void yagl_host_glTexParameteriv(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, const GLint *params, int32_t params_count); -void yagl_host_glTexSubImage2DData(GLenum target, +void yagl_host_glTexSubImage2DData(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -228,7 +276,8 @@ void yagl_host_glTexSubImage2DData(GLenum target, GLenum format, GLenum type, const GLvoid *pixels, int32_t pixels_count); -void yagl_host_glTexSubImage2DOffset(GLenum target, +void yagl_host_glTexSubImage2DOffset(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -237,31 +286,40 @@ void yagl_host_glTexSubImage2DOffset(GLenum target, GLenum format, GLenum type, uintptr_t pixels); -void yagl_host_glClientActiveTexture(GLenum texture); -void yagl_host_glTexEnvi(GLenum target, +void yagl_host_glClientActiveTexture(struct yagl_thread_state *cur_ts, + GLenum texture); +void yagl_host_glTexEnvi(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, GLint param); -void yagl_host_glTexEnvf(GLenum target, +void yagl_host_glTexEnvf(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, GLfloat param); -void yagl_host_glMultiTexCoord4f(GLenum target, +void yagl_host_glMultiTexCoord4f(struct yagl_thread_state *cur_ts, + GLenum target, GLfloat s, GLfloat tt, GLfloat r, GLfloat q); -void yagl_host_glTexEnviv(GLenum target, +void yagl_host_glTexEnviv(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, const GLint *params, int32_t params_count); -void yagl_host_glTexEnvfv(GLenum target, +void yagl_host_glTexEnvfv(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, const GLfloat *params, int32_t params_count); -void yagl_host_glGetTexEnviv(GLenum env, +void yagl_host_glGetTexEnviv(struct yagl_thread_state *cur_ts, + GLenum env, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetTexEnvfv(GLenum env, +void yagl_host_glGetTexEnvfv(struct yagl_thread_state *cur_ts, + GLenum env, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glTexImage3DData(GLenum target, +void yagl_host_glTexImage3DData(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint internalformat, GLsizei width, @@ -271,7 +329,8 @@ void yagl_host_glTexImage3DData(GLenum target, GLenum format, GLenum type, const void *pixels, int32_t pixels_count); -void yagl_host_glTexImage3DOffset(GLenum target, +void yagl_host_glTexImage3DOffset(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint internalformat, GLsizei width, @@ -281,7 +340,8 @@ void yagl_host_glTexImage3DOffset(GLenum target, GLenum format, GLenum type, uintptr_t pixels); -void yagl_host_glTexSubImage3DData(GLenum target, +void yagl_host_glTexSubImage3DData(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -292,7 +352,8 @@ void yagl_host_glTexSubImage3DData(GLenum target, GLenum format, GLenum type, const void *pixels, int32_t pixels_count); -void yagl_host_glTexSubImage3DOffset(GLenum target, +void yagl_host_glTexSubImage3DOffset(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -303,7 +364,8 @@ void yagl_host_glTexSubImage3DOffset(GLenum target, GLenum format, GLenum type, uintptr_t pixels); -void yagl_host_glCopyTexSubImage3D(GLenum target, +void yagl_host_glCopyTexSubImage3D(struct yagl_thread_state *cur_ts, + GLenum target, GLint level, GLint xoffset, GLint yoffset, @@ -312,19 +374,24 @@ void yagl_host_glCopyTexSubImage3D(GLenum target, GLint y, GLsizei width, GLsizei height); -void yagl_host_glGenFramebuffers(const GLuint *framebuffers, int32_t framebuffers_count); -void yagl_host_glBindFramebuffer(GLenum target, +void yagl_host_glGenFramebuffers(struct yagl_thread_state *cur_ts, + const GLuint *framebuffers, int32_t framebuffers_count); +void yagl_host_glBindFramebuffer(struct yagl_thread_state *cur_ts, + GLenum target, GLuint framebuffer); -void yagl_host_glFramebufferTexture2D(GLenum target, +void yagl_host_glFramebufferTexture2D(struct yagl_thread_state *cur_ts, + GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -void yagl_host_glFramebufferRenderbuffer(GLenum target, +void yagl_host_glFramebufferRenderbuffer(struct yagl_thread_state *cur_ts, + GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -void yagl_host_glBlitFramebuffer(GLint srcX0, +void yagl_host_glBlitFramebuffer(struct yagl_thread_state *cur_ts, + GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, @@ -334,490 +401,663 @@ void yagl_host_glBlitFramebuffer(GLint srcX0, GLint dstY1, GLbitfield mask, GLenum filter); -void yagl_host_glDrawBuffers(const GLenum *bufs, int32_t bufs_count); -void yagl_host_glReadBuffer(GLenum mode); -void yagl_host_glFramebufferTexture3D(GLenum target, +void yagl_host_glDrawBuffers(struct yagl_thread_state *cur_ts, + const GLenum *bufs, int32_t bufs_count); +void yagl_host_glReadBuffer(struct yagl_thread_state *cur_ts, + GLenum mode); +void yagl_host_glFramebufferTexture3D(struct yagl_thread_state *cur_ts, + GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -void yagl_host_glFramebufferTextureLayer(GLenum target, +void yagl_host_glFramebufferTextureLayer(struct yagl_thread_state *cur_ts, + GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -void yagl_host_glClearBufferiv(GLenum buffer, +void yagl_host_glClearBufferiv(struct yagl_thread_state *cur_ts, + GLenum buffer, GLint drawbuffer, const GLint *value, int32_t value_count); -void yagl_host_glClearBufferuiv(GLenum buffer, +void yagl_host_glClearBufferuiv(struct yagl_thread_state *cur_ts, + GLenum buffer, GLint drawbuffer, const GLuint *value, int32_t value_count); -void yagl_host_glClearBufferfi(GLenum buffer, +void yagl_host_glClearBufferfi(struct yagl_thread_state *cur_ts, + GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -void yagl_host_glClearBufferfv(GLenum buffer, +void yagl_host_glClearBufferfv(struct yagl_thread_state *cur_ts, + GLenum buffer, GLint drawbuffer, const GLfloat *value, int32_t value_count); -void yagl_host_glGenRenderbuffers(const GLuint *renderbuffers, int32_t renderbuffers_count); -void yagl_host_glBindRenderbuffer(GLenum target, +void yagl_host_glGenRenderbuffers(struct yagl_thread_state *cur_ts, + const GLuint *renderbuffers, int32_t renderbuffers_count); +void yagl_host_glBindRenderbuffer(struct yagl_thread_state *cur_ts, + GLenum target, GLuint renderbuffer); -void yagl_host_glRenderbufferStorage(GLenum target, +void yagl_host_glRenderbufferStorage(struct yagl_thread_state *cur_ts, + GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -void yagl_host_glGetRenderbufferParameteriv(GLenum target, +void yagl_host_glGetRenderbufferParameteriv(struct yagl_thread_state *cur_ts, + GLenum target, GLenum pname, GLint *param); -void yagl_host_glRenderbufferStorageMultisample(GLenum target, +void yagl_host_glRenderbufferStorageMultisample(struct yagl_thread_state *cur_ts, + GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -void yagl_host_glCreateProgram(GLuint program); -void yagl_host_glCreateShader(GLuint shader, +void yagl_host_glCreateProgram(struct yagl_thread_state *cur_ts, + GLuint program); +void yagl_host_glCreateShader(struct yagl_thread_state *cur_ts, + GLuint shader, GLenum type); -void yagl_host_glShaderSource(GLuint shader, +void yagl_host_glShaderSource(struct yagl_thread_state *cur_ts, + GLuint shader, const GLchar *string, int32_t string_count); -void yagl_host_glAttachShader(GLuint program, +void yagl_host_glAttachShader(struct yagl_thread_state *cur_ts, + GLuint program, + GLuint shader); +void yagl_host_glDetachShader(struct yagl_thread_state *cur_ts, + GLuint program, GLuint shader); -void yagl_host_glDetachShader(GLuint program, +void yagl_host_glCompileShader(struct yagl_thread_state *cur_ts, GLuint shader); -void yagl_host_glCompileShader(GLuint shader); -void yagl_host_glBindAttribLocation(GLuint program, +void yagl_host_glBindAttribLocation(struct yagl_thread_state *cur_ts, + GLuint program, GLuint index, const GLchar *name, int32_t name_count); -void yagl_host_glGetActiveAttrib(GLuint program, +void yagl_host_glGetActiveAttrib(struct yagl_thread_state *cur_ts, + GLuint program, GLuint index, GLint *size, GLenum *type, GLchar *name, int32_t name_maxcount, int32_t *name_count); -void yagl_host_glGetActiveUniform(GLuint program, +void yagl_host_glGetActiveUniform(struct yagl_thread_state *cur_ts, + GLuint program, GLuint index, GLint *size, GLenum *type, GLchar *name, int32_t name_maxcount, int32_t *name_count); -int yagl_host_glGetAttribLocation(GLuint program, +int yagl_host_glGetAttribLocation(struct yagl_thread_state *cur_ts, + GLuint program, const GLchar *name, int32_t name_count); -void yagl_host_glGetProgramiv(GLuint program, +void yagl_host_glGetProgramiv(struct yagl_thread_state *cur_ts, + GLuint program, GLenum pname, GLint *param); -GLboolean yagl_host_glGetProgramInfoLog(GLuint program, +GLboolean yagl_host_glGetProgramInfoLog(struct yagl_thread_state *cur_ts, + GLuint program, GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count); -void yagl_host_glGetShaderiv(GLuint shader, +void yagl_host_glGetShaderiv(struct yagl_thread_state *cur_ts, + GLuint shader, GLenum pname, GLint *param); -GLboolean yagl_host_glGetShaderInfoLog(GLuint shader, +GLboolean yagl_host_glGetShaderInfoLog(struct yagl_thread_state *cur_ts, + GLuint shader, GLchar *infolog, int32_t infolog_maxcount, int32_t *infolog_count); -void yagl_host_glGetUniformfv(GLboolean tl, +void yagl_host_glGetUniformfv(struct yagl_thread_state *cur_ts, + GLboolean tl, GLuint program, uint32_t location, GLfloat *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetUniformiv(GLboolean tl, +void yagl_host_glGetUniformiv(struct yagl_thread_state *cur_ts, + GLboolean tl, GLuint program, uint32_t location, GLint *params, int32_t params_maxcount, int32_t *params_count); -int yagl_host_glGetUniformLocation(GLuint program, +int yagl_host_glGetUniformLocation(struct yagl_thread_state *cur_ts, + GLuint program, const GLchar *name, int32_t name_count); -void yagl_host_glGetVertexAttribfv(GLuint index, +void yagl_host_glGetVertexAttribfv(struct yagl_thread_state *cur_ts, + GLuint index, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetVertexAttribiv(GLuint index, +void yagl_host_glGetVertexAttribiv(struct yagl_thread_state *cur_ts, + GLuint index, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glLinkProgram(GLuint program, +void yagl_host_glLinkProgram(struct yagl_thread_state *cur_ts, + GLuint program, GLint *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glUniform1f(GLboolean tl, +void yagl_host_glUniform1f(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLfloat x); -void yagl_host_glUniform1fv(GLboolean tl, +void yagl_host_glUniform1fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLfloat *v, int32_t v_count); -void yagl_host_glUniform1i(GLboolean tl, +void yagl_host_glUniform1i(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLint x); -void yagl_host_glUniform1iv(GLboolean tl, +void yagl_host_glUniform1iv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLint *v, int32_t v_count); -void yagl_host_glUniform2f(GLboolean tl, +void yagl_host_glUniform2f(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLfloat x, GLfloat y); -void yagl_host_glUniform2fv(GLboolean tl, +void yagl_host_glUniform2fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLfloat *v, int32_t v_count); -void yagl_host_glUniform2i(GLboolean tl, +void yagl_host_glUniform2i(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLint x, GLint y); -void yagl_host_glUniform2iv(GLboolean tl, +void yagl_host_glUniform2iv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLint *v, int32_t v_count); -void yagl_host_glUniform3f(GLboolean tl, +void yagl_host_glUniform3f(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLfloat x, GLfloat y, GLfloat z); -void yagl_host_glUniform3fv(GLboolean tl, +void yagl_host_glUniform3fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLfloat *v, int32_t v_count); -void yagl_host_glUniform3i(GLboolean tl, +void yagl_host_glUniform3i(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLint x, GLint y, GLint z); -void yagl_host_glUniform3iv(GLboolean tl, +void yagl_host_glUniform3iv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLint *v, int32_t v_count); -void yagl_host_glUniform4f(GLboolean tl, +void yagl_host_glUniform4f(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -void yagl_host_glUniform4fv(GLboolean tl, +void yagl_host_glUniform4fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLfloat *v, int32_t v_count); -void yagl_host_glUniform4i(GLboolean tl, +void yagl_host_glUniform4i(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLint x, GLint y, GLint z, GLint w); -void yagl_host_glUniform4iv(GLboolean tl, +void yagl_host_glUniform4iv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLint *v, int32_t v_count); -void yagl_host_glUniformMatrix2fv(GLboolean tl, +void yagl_host_glUniformMatrix2fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count); -void yagl_host_glUniformMatrix3fv(GLboolean tl, +void yagl_host_glUniformMatrix3fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count); -void yagl_host_glUniformMatrix4fv(GLboolean tl, +void yagl_host_glUniformMatrix4fv(struct yagl_thread_state *cur_ts, + 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, +void yagl_host_glUseProgram(struct yagl_thread_state *cur_ts, + GLuint program); +void yagl_host_glValidateProgram(struct yagl_thread_state *cur_ts, + GLuint program); +void yagl_host_glVertexAttrib1f(struct yagl_thread_state *cur_ts, + GLuint indx, GLfloat x); -void yagl_host_glVertexAttrib1fv(GLuint indx, +void yagl_host_glVertexAttrib1fv(struct yagl_thread_state *cur_ts, + GLuint indx, const GLfloat *values, int32_t values_count); -void yagl_host_glVertexAttrib2f(GLuint indx, +void yagl_host_glVertexAttrib2f(struct yagl_thread_state *cur_ts, + GLuint indx, GLfloat x, GLfloat y); -void yagl_host_glVertexAttrib2fv(GLuint indx, +void yagl_host_glVertexAttrib2fv(struct yagl_thread_state *cur_ts, + GLuint indx, const GLfloat *values, int32_t values_count); -void yagl_host_glVertexAttrib3f(GLuint indx, +void yagl_host_glVertexAttrib3f(struct yagl_thread_state *cur_ts, + GLuint indx, GLfloat x, GLfloat y, GLfloat z); -void yagl_host_glVertexAttrib3fv(GLuint indx, +void yagl_host_glVertexAttrib3fv(struct yagl_thread_state *cur_ts, + GLuint indx, const GLfloat *values, int32_t values_count); -void yagl_host_glVertexAttrib4f(GLuint indx, +void yagl_host_glVertexAttrib4f(struct yagl_thread_state *cur_ts, + GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -void yagl_host_glVertexAttrib4fv(GLuint indx, +void yagl_host_glVertexAttrib4fv(struct yagl_thread_state *cur_ts, + GLuint indx, const GLfloat *values, int32_t values_count); -void yagl_host_glGetActiveUniformsiv(GLuint program, +void yagl_host_glGetActiveUniformsiv(struct yagl_thread_state *cur_ts, + GLuint program, const GLuint *uniformIndices, int32_t uniformIndices_count, GLint *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetUniformIndices(GLuint program, +void yagl_host_glGetUniformIndices(struct yagl_thread_state *cur_ts, + GLuint program, const GLchar *uniformNames, int32_t uniformNames_count, GLuint *uniformIndices, int32_t uniformIndices_maxcount, int32_t *uniformIndices_count); -GLuint yagl_host_glGetUniformBlockIndex(GLuint program, +GLuint yagl_host_glGetUniformBlockIndex(struct yagl_thread_state *cur_ts, + GLuint program, const GLchar *uniformBlockName, int32_t uniformBlockName_count); -void yagl_host_glUniformBlockBinding(GLuint program, +void yagl_host_glUniformBlockBinding(struct yagl_thread_state *cur_ts, + GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -void yagl_host_glGetActiveUniformBlockName(GLuint program, +void yagl_host_glGetActiveUniformBlockName(struct yagl_thread_state *cur_ts, + GLuint program, GLuint uniformBlockIndex, GLchar *uniformBlockName, int32_t uniformBlockName_maxcount, int32_t *uniformBlockName_count); -void yagl_host_glGetActiveUniformBlockiv(GLuint program, +void yagl_host_glGetActiveUniformBlockiv(struct yagl_thread_state *cur_ts, + GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetVertexAttribIiv(GLuint index, +void yagl_host_glGetVertexAttribIiv(struct yagl_thread_state *cur_ts, + GLuint index, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetVertexAttribIuiv(GLuint index, +void yagl_host_glGetVertexAttribIuiv(struct yagl_thread_state *cur_ts, + GLuint index, GLenum pname, GLuint *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glVertexAttribI4i(GLuint index, +void yagl_host_glVertexAttribI4i(struct yagl_thread_state *cur_ts, + GLuint index, GLint x, GLint y, GLint z, GLint w); -void yagl_host_glVertexAttribI4ui(GLuint index, +void yagl_host_glVertexAttribI4ui(struct yagl_thread_state *cur_ts, + GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -void yagl_host_glVertexAttribI4iv(GLuint index, +void yagl_host_glVertexAttribI4iv(struct yagl_thread_state *cur_ts, + GLuint index, const GLint *v, int32_t v_count); -void yagl_host_glVertexAttribI4uiv(GLuint index, +void yagl_host_glVertexAttribI4uiv(struct yagl_thread_state *cur_ts, + GLuint index, const GLuint *v, int32_t v_count); -void yagl_host_glGetUniformuiv(GLboolean tl, +void yagl_host_glGetUniformuiv(struct yagl_thread_state *cur_ts, + GLboolean tl, GLuint program, uint32_t location, GLuint *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glUniform1ui(GLboolean tl, +void yagl_host_glUniform1ui(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLuint v0); -void yagl_host_glUniform2ui(GLboolean tl, +void yagl_host_glUniform2ui(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLuint v0, GLuint v1); -void yagl_host_glUniform3ui(GLboolean tl, +void yagl_host_glUniform3ui(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLuint v0, GLuint v1, GLuint v2); -void yagl_host_glUniform4ui(GLboolean tl, +void yagl_host_glUniform4ui(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void yagl_host_glUniform1uiv(GLboolean tl, +void yagl_host_glUniform1uiv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count); -void yagl_host_glUniform2uiv(GLboolean tl, +void yagl_host_glUniform2uiv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count); -void yagl_host_glUniform3uiv(GLboolean tl, +void yagl_host_glUniform3uiv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count); -void yagl_host_glUniform4uiv(GLboolean tl, +void yagl_host_glUniform4uiv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, const GLuint *v, int32_t v_count); -void yagl_host_glUniformMatrix2x3fv(GLboolean tl, +void yagl_host_glUniformMatrix2x3fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count); -void yagl_host_glUniformMatrix2x4fv(GLboolean tl, +void yagl_host_glUniformMatrix2x4fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count); -void yagl_host_glUniformMatrix3x2fv(GLboolean tl, +void yagl_host_glUniformMatrix3x2fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count); -void yagl_host_glUniformMatrix3x4fv(GLboolean tl, +void yagl_host_glUniformMatrix3x4fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count); -void yagl_host_glUniformMatrix4x2fv(GLboolean tl, +void yagl_host_glUniformMatrix4x2fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count); -void yagl_host_glUniformMatrix4x3fv(GLboolean tl, +void yagl_host_glUniformMatrix4x3fv(struct yagl_thread_state *cur_ts, + GLboolean tl, uint32_t location, GLboolean transpose, const GLfloat *value, int32_t value_count); -void yagl_host_glGetIntegerv(GLenum pname, +void yagl_host_glGetIntegerv(struct yagl_thread_state *cur_ts, + GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count); -int yagl_host_glGetFragDataLocation(GLuint program, +int yagl_host_glGetFragDataLocation(struct yagl_thread_state *cur_ts, + GLuint program, const GLchar *name, int32_t name_count); -void yagl_host_glGetFloatv(GLenum pname, +void yagl_host_glGetFloatv(struct yagl_thread_state *cur_ts, + GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glGetString(GLenum name, +void yagl_host_glGetString(struct yagl_thread_state *cur_ts, + GLenum name, GLchar *str, int32_t str_maxcount, int32_t *str_count); -GLboolean yagl_host_glIsEnabled(GLenum cap); -void yagl_host_glGenTransformFeedbacks(const GLuint *ids, int32_t ids_count); -void yagl_host_glBindTransformFeedback(GLenum target, +GLboolean yagl_host_glIsEnabled(struct yagl_thread_state *cur_ts, GLenum cap); +void yagl_host_glGenTransformFeedbacks(struct yagl_thread_state *cur_ts, + const GLuint *ids, int32_t ids_count); +void yagl_host_glBindTransformFeedback(struct yagl_thread_state *cur_ts, + GLenum target, GLuint id); -void yagl_host_glBeginTransformFeedback(GLenum primitiveMode); -void yagl_host_glEndTransformFeedback(void); -void yagl_host_glPauseTransformFeedback(void); -void yagl_host_glResumeTransformFeedback(void); -void yagl_host_glTransformFeedbackVaryings(GLuint program, +void yagl_host_glBeginTransformFeedback(struct yagl_thread_state *cur_ts, + GLenum primitiveMode); +void yagl_host_glEndTransformFeedback(struct yagl_thread_state *cur_ts); +void yagl_host_glPauseTransformFeedback(struct yagl_thread_state *cur_ts); +void yagl_host_glResumeTransformFeedback(struct yagl_thread_state *cur_ts); +void yagl_host_glTransformFeedbackVaryings(struct yagl_thread_state *cur_ts, + struct yagl_transport *t, + GLuint program, const GLchar *varyings, int32_t varyings_count, GLenum bufferMode); -void yagl_host_glGetTransformFeedbackVaryings(GLuint program, +void yagl_host_glGetTransformFeedbackVaryings(struct yagl_thread_state *cur_ts, + GLuint program, GLsizei *sizes, int32_t sizes_maxcount, int32_t *sizes_count, GLenum *types, int32_t types_maxcount, int32_t *types_count); -void yagl_host_glGenQueries(const GLuint *ids, int32_t ids_count); -void yagl_host_glBeginQuery(GLenum target, +void yagl_host_glGenQueries(struct yagl_thread_state *cur_ts, + const GLuint *ids, int32_t ids_count); +void yagl_host_glBeginQuery(struct yagl_thread_state *cur_ts, + GLenum target, GLuint id); -void yagl_host_glEndQuery(GLenum target); -GLboolean yagl_host_glGetQueryObjectuiv(GLuint id, +void yagl_host_glEndQuery(struct yagl_thread_state *cur_ts, + GLenum target); +GLboolean yagl_host_glGetQueryObjectuiv(struct yagl_thread_state *cur_ts, + GLuint id, GLenum pname, GLuint *result); -void yagl_host_glGenSamplers(const GLuint *samplers, int32_t samplers_count); -void yagl_host_glBindSampler(GLuint unit, +void yagl_host_glGenSamplers(struct yagl_thread_state *cur_ts, + const GLuint *samplers, int32_t samplers_count); +void yagl_host_glBindSampler(struct yagl_thread_state *cur_ts, + GLuint unit, GLuint sampler); -void yagl_host_glSamplerParameteri(GLuint sampler, +void yagl_host_glSamplerParameteri(struct yagl_thread_state *cur_ts, + GLuint sampler, GLenum pname, GLint param); -void yagl_host_glSamplerParameteriv(GLuint sampler, +void yagl_host_glSamplerParameteriv(struct yagl_thread_state *cur_ts, + GLuint sampler, GLenum pname, const GLint *param, int32_t param_count); -void yagl_host_glSamplerParameterf(GLuint sampler, +void yagl_host_glSamplerParameterf(struct yagl_thread_state *cur_ts, + GLuint sampler, GLenum pname, GLfloat param); -void yagl_host_glSamplerParameterfv(GLuint sampler, +void yagl_host_glSamplerParameterfv(struct yagl_thread_state *cur_ts, + GLuint sampler, GLenum pname, const GLfloat *param, int32_t param_count); -void yagl_host_glDeleteObjects(const GLuint *objects, int32_t objects_count); -void yagl_host_glBlendEquation(GLenum mode); -void yagl_host_glBlendEquationSeparate(GLenum modeRGB, +void yagl_host_glDeleteObjects(struct yagl_thread_state *cur_ts, + const GLuint *objects, int32_t objects_count); +void yagl_host_glBlendEquation(struct yagl_thread_state *cur_ts, + GLenum mode); +void yagl_host_glBlendEquationSeparate(struct yagl_thread_state *cur_ts, + GLenum modeRGB, GLenum modeAlpha); -void yagl_host_glBlendFunc(GLenum sfactor, +void yagl_host_glBlendFunc(struct yagl_thread_state *cur_ts, + GLenum sfactor, GLenum dfactor); -void yagl_host_glBlendFuncSeparate(GLenum srcRGB, +void yagl_host_glBlendFuncSeparate(struct yagl_thread_state *cur_ts, + GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -void yagl_host_glBlendColor(GLclampf red, +void yagl_host_glBlendColor(struct yagl_thread_state *cur_ts, + GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -void yagl_host_glClear(GLbitfield mask); -void yagl_host_glClearColor(GLclampf red, +void yagl_host_glClear(struct yagl_thread_state *cur_ts, + GLbitfield mask); +void yagl_host_glClearColor(struct yagl_thread_state *cur_ts, + 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, +void yagl_host_glClearDepthf(struct yagl_thread_state *cur_ts, + GLclampf depth); +void yagl_host_glClearStencil(struct yagl_thread_state *cur_ts, + GLint s); +void yagl_host_glColorMask(struct yagl_thread_state *cur_ts, + 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, +void yagl_host_glCullFace(struct yagl_thread_state *cur_ts, + GLenum mode); +void yagl_host_glDepthFunc(struct yagl_thread_state *cur_ts, + GLenum func); +void yagl_host_glDepthMask(struct yagl_thread_state *cur_ts, + GLboolean flag); +void yagl_host_glDepthRangef(struct yagl_thread_state *cur_ts, + 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, +void yagl_host_glEnable(struct yagl_thread_state *cur_ts, + GLenum cap); +void yagl_host_glDisable(struct yagl_thread_state *cur_ts, + GLenum cap); +void yagl_host_glFlush(struct yagl_thread_state *cur_ts); +void yagl_host_glFrontFace(struct yagl_thread_state *cur_ts, + GLenum mode); +void yagl_host_glGenerateMipmap(struct yagl_thread_state *cur_ts, + GLenum target); +void yagl_host_glHint(struct yagl_thread_state *cur_ts, + GLenum target, GLenum mode); -void yagl_host_glLineWidth(GLfloat width); -void yagl_host_glPixelStorei(GLenum pname, +void yagl_host_glLineWidth(struct yagl_thread_state *cur_ts, + GLfloat width); +void yagl_host_glPixelStorei(struct yagl_thread_state *cur_ts, + GLenum pname, GLint param); -void yagl_host_glPolygonOffset(GLfloat factor, +void yagl_host_glPolygonOffset(struct yagl_thread_state *cur_ts, + GLfloat factor, GLfloat units); -void yagl_host_glScissor(GLint x, +void yagl_host_glScissor(struct yagl_thread_state *cur_ts, + GLint x, GLint y, GLsizei width, GLsizei height); -void yagl_host_glStencilFunc(GLenum func, +void yagl_host_glStencilFunc(struct yagl_thread_state *cur_ts, + GLenum func, GLint ref, GLuint mask); -void yagl_host_glStencilMask(GLuint mask); -void yagl_host_glStencilOp(GLenum fail, +void yagl_host_glStencilMask(struct yagl_thread_state *cur_ts, + GLuint mask); +void yagl_host_glStencilOp(struct yagl_thread_state *cur_ts, + GLenum fail, GLenum zfail, GLenum zpass); -void yagl_host_glSampleCoverage(GLclampf value, +void yagl_host_glSampleCoverage(struct yagl_thread_state *cur_ts, + GLclampf value, GLboolean invert); -void yagl_host_glViewport(GLint x, +void yagl_host_glViewport(struct yagl_thread_state *cur_ts, + GLint x, GLint y, GLsizei width, GLsizei height); -void yagl_host_glStencilFuncSeparate(GLenum face, +void yagl_host_glStencilFuncSeparate(struct yagl_thread_state *cur_ts, + GLenum face, GLenum func, GLint ref, GLuint mask); -void yagl_host_glStencilMaskSeparate(GLenum face, +void yagl_host_glStencilMaskSeparate(struct yagl_thread_state *cur_ts, + GLenum face, GLuint mask); -void yagl_host_glStencilOpSeparate(GLenum face, +void yagl_host_glStencilOpSeparate(struct yagl_thread_state *cur_ts, + GLenum face, GLenum fail, GLenum zfail, GLenum zpass); -void yagl_host_glPointSize(GLfloat size); -void yagl_host_glAlphaFunc(GLenum func, +void yagl_host_glPointSize(struct yagl_thread_state *cur_ts, + GLfloat size); +void yagl_host_glAlphaFunc(struct yagl_thread_state *cur_ts, + 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, +void yagl_host_glMatrixMode(struct yagl_thread_state *cur_ts, + GLenum mode); +void yagl_host_glLoadIdentity(struct yagl_thread_state *cur_ts); +void yagl_host_glPopMatrix(struct yagl_thread_state *cur_ts); +void yagl_host_glPushMatrix(struct yagl_thread_state *cur_ts); +void yagl_host_glRotatef(struct yagl_thread_state *cur_ts, + GLfloat angle, GLfloat x, GLfloat y, GLfloat z); -void yagl_host_glTranslatef(GLfloat x, +void yagl_host_glTranslatef(struct yagl_thread_state *cur_ts, + GLfloat x, GLfloat y, GLfloat z); -void yagl_host_glScalef(GLfloat x, +void yagl_host_glScalef(struct yagl_thread_state *cur_ts, + GLfloat x, GLfloat y, GLfloat z); -void yagl_host_glOrthof(GLfloat left, +void yagl_host_glOrthof(struct yagl_thread_state *cur_ts, + GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); -void yagl_host_glColor4f(GLfloat red, +void yagl_host_glColor4f(struct yagl_thread_state *cur_ts, + GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -void yagl_host_glColor4ub(GLubyte red, +void yagl_host_glColor4ub(struct yagl_thread_state *cur_ts, + GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); -void yagl_host_glNormal3f(GLfloat nx, +void yagl_host_glNormal3f(struct yagl_thread_state *cur_ts, + GLfloat nx, GLfloat ny, GLfloat nz); -void yagl_host_glPointParameterf(GLenum pname, +void yagl_host_glPointParameterf(struct yagl_thread_state *cur_ts, + GLenum pname, GLfloat param); -void yagl_host_glPointParameterfv(GLenum pname, +void yagl_host_glPointParameterfv(struct yagl_thread_state *cur_ts, + GLenum pname, const GLfloat *params, int32_t params_count); -void yagl_host_glFogf(GLenum pname, +void yagl_host_glFogf(struct yagl_thread_state *cur_ts, + GLenum pname, GLfloat param); -void yagl_host_glFogfv(GLenum pname, +void yagl_host_glFogfv(struct yagl_thread_state *cur_ts, + GLenum pname, const GLfloat *params, int32_t params_count); -void yagl_host_glFrustumf(GLfloat left, +void yagl_host_glFrustumf(struct yagl_thread_state *cur_ts, + GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); -void yagl_host_glLightf(GLenum light, +void yagl_host_glLightf(struct yagl_thread_state *cur_ts, + GLenum light, GLenum pname, GLfloat param); -void yagl_host_glLightfv(GLenum light, +void yagl_host_glLightfv(struct yagl_thread_state *cur_ts, + GLenum light, GLenum pname, const GLfloat *params, int32_t params_count); -void yagl_host_glGetLightfv(GLenum light, +void yagl_host_glGetLightfv(struct yagl_thread_state *cur_ts, + GLenum light, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count); -void yagl_host_glLightModelf(GLenum pname, +void yagl_host_glLightModelf(struct yagl_thread_state *cur_ts, + GLenum pname, GLfloat param); -void yagl_host_glLightModelfv(GLenum pname, +void yagl_host_glLightModelfv(struct yagl_thread_state *cur_ts, + GLenum pname, const GLfloat *params, int32_t params_count); -void yagl_host_glMaterialf(GLenum face, +void yagl_host_glMaterialf(struct yagl_thread_state *cur_ts, + GLenum face, GLenum pname, GLfloat param); -void yagl_host_glMaterialfv(GLenum face, +void yagl_host_glMaterialfv(struct yagl_thread_state *cur_ts, + GLenum face, GLenum pname, const GLfloat *params, int32_t params_count); -void yagl_host_glGetMaterialfv(GLenum face, +void yagl_host_glGetMaterialfv(struct yagl_thread_state *cur_ts, + 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, +void yagl_host_glShadeModel(struct yagl_thread_state *cur_ts, + GLenum mode); +void yagl_host_glLogicOp(struct yagl_thread_state *cur_ts, + GLenum opcode); +void yagl_host_glMultMatrixf(struct yagl_thread_state *cur_ts, + const GLfloat *m, int32_t m_count); +void yagl_host_glLoadMatrixf(struct yagl_thread_state *cur_ts, + const GLfloat *m, int32_t m_count); +void yagl_host_glClipPlanef(struct yagl_thread_state *cur_ts, + GLenum plane, const GLfloat *equation, int32_t equation_count); -void yagl_host_glGetClipPlanef(GLenum pname, +void yagl_host_glGetClipPlanef(struct yagl_thread_state *cur_ts, + GLenum pname, GLfloat *eqn, int32_t eqn_maxcount, int32_t *eqn_count); -void yagl_host_glUpdateOffscreenImageYAGL(GLuint texture, +void yagl_host_glUpdateOffscreenImageYAGL(struct yagl_thread_state *cur_ts, + GLuint texture, uint32_t width, uint32_t height, uint32_t bpp, const void *pixels, int32_t pixels_count); -void yagl_host_glGenUniformLocationYAGL(uint32_t location, +void yagl_host_glGenUniformLocationYAGL(struct yagl_thread_state *cur_ts, + uint32_t location, GLuint program, const GLchar *name, int32_t name_count); -void yagl_host_glDeleteUniformLocationsYAGL(const uint32_t *locations, int32_t locations_count); +void yagl_host_glDeleteUniformLocationsYAGL(struct yagl_thread_state *cur_ts, + const uint32_t *locations, int32_t locations_count); #endif diff --git a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen.c b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen.c index 8645ba12a5..f554df0c12 100644 --- a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen.c +++ b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen.c @@ -38,24 +38,23 @@ #include "yagl_thread.h" #include "yagl_gles_driver.h" -YAGL_DEFINE_TLS(struct yagl_egl_offscreen_ts*, egl_offscreen_ts); - -static void yagl_egl_offscreen_thread_init(struct yagl_egl_backend *backend) +static void yagl_egl_offscreen_thread_init(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend) { - YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_thread_init, NULL); + struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend; - egl_offscreen_ts = yagl_egl_offscreen_ts_create(); + YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_thread_init, NULL); - cur_ts->egl_offscreen_ts = egl_offscreen_ts; + cur_ts->egl_offscreen_ts = yagl_egl_offscreen_ts_create(egl_offscreen->gles_driver); YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_egl_offscreen_batch_start(struct yagl_egl_backend *backend) +static void yagl_egl_offscreen_batch_start(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend) { struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend; - - egl_offscreen_ts = cur_ts->egl_offscreen_ts; + struct yagl_egl_offscreen_ts *egl_offscreen_ts = cur_ts->egl_offscreen_ts; if (!egl_offscreen_ts->dpy) { return; @@ -68,9 +67,11 @@ static void yagl_egl_offscreen_batch_start(struct yagl_egl_backend *backend) egl_offscreen_ts->ctx->native_ctx); } -static void yagl_egl_offscreen_batch_end(struct yagl_egl_backend *backend) +static void yagl_egl_offscreen_batch_end(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend) { struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend; + struct yagl_egl_offscreen_ts *egl_offscreen_ts = cur_ts->egl_offscreen_ts; if (!egl_offscreen_ts->dpy) { return; @@ -92,13 +93,15 @@ static struct yagl_eglb_display *yagl_egl_offscreen_create_display(struct yagl_e return dpy ? &dpy->base : NULL; } -static bool yagl_egl_offscreen_make_current(struct yagl_egl_backend *backend, +static bool yagl_egl_offscreen_make_current(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend, struct yagl_eglb_display *dpy, struct yagl_eglb_context *ctx, struct yagl_eglb_surface *draw, struct yagl_eglb_surface *read) { struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend; + struct yagl_egl_offscreen_ts *egl_offscreen_ts = cur_ts->egl_offscreen_ts; struct yagl_egl_offscreen_display *egl_offscreen_dpy = (struct yagl_egl_offscreen_display*)dpy; struct yagl_egl_offscreen_context *egl_offscreen_ctx = (struct yagl_egl_offscreen_context*)ctx; struct yagl_egl_offscreen_surface *egl_offscreen_draw = (struct yagl_egl_offscreen_surface*)draw; @@ -137,9 +140,12 @@ static bool yagl_egl_offscreen_make_current(struct yagl_egl_backend *backend, return res; } -static bool yagl_egl_offscreen_release_current(struct yagl_egl_backend *backend, bool force) +static bool yagl_egl_offscreen_release_current(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend, + bool force) { struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend; + struct yagl_egl_offscreen_ts *egl_offscreen_ts = cur_ts->egl_offscreen_ts; bool res; YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_release_current, NULL); @@ -170,17 +176,19 @@ static bool yagl_egl_offscreen_release_current(struct yagl_egl_backend *backend, return res || force; } -static void yagl_egl_offscreen_thread_fini(struct yagl_egl_backend *backend) +static void yagl_egl_offscreen_thread_fini(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend) { YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_thread_fini, NULL); - yagl_egl_offscreen_ts_destroy(egl_offscreen_ts); - egl_offscreen_ts = cur_ts->egl_offscreen_ts = NULL; + yagl_egl_offscreen_ts_destroy(cur_ts->egl_offscreen_ts); + cur_ts->egl_offscreen_ts = NULL; YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_egl_offscreen_ensure_current(struct yagl_egl_backend *backend) +static void yagl_egl_offscreen_ensure_current(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend) { struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend; @@ -191,9 +199,12 @@ static void yagl_egl_offscreen_ensure_current(struct yagl_egl_backend *backend) egl_offscreen->ensure_ctx); } -static void yagl_egl_offscreen_unensure_current(struct yagl_egl_backend *backend) +static void yagl_egl_offscreen_unensure_current(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend) { struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend; + // cur_ts may be NULL here if called from main thread + struct yagl_egl_offscreen_ts *egl_offscreen_ts = (cur_ts ? cur_ts->egl_offscreen_ts : NULL); if (egl_offscreen_ts && egl_offscreen_ts->dpy) { egl_offscreen->egl_driver->make_current(egl_offscreen->egl_driver, @@ -213,6 +224,7 @@ static void yagl_egl_offscreen_unensure_current(struct yagl_egl_backend *backend static void yagl_egl_offscreen_destroy(struct yagl_egl_backend *backend) { struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)backend; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_destroy, NULL); @@ -253,6 +265,7 @@ struct yagl_egl_backend *yagl_egl_offscreen_create(struct yagl_egl_driver *egl_d EGLSurface sfc = EGL_NO_SURFACE; EGLContext ctx = EGL_NO_CONTEXT; EGLContext global_ctx = EGL_NO_CONTEXT; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_create, NULL); diff --git a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.c b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.c index e60f832fcc..889ebc6412 100644 --- a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.c +++ b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.c @@ -34,11 +34,11 @@ #include "yagl_egl_native_config.h" #include "yagl_gles_driver.h" #include "yagl_log.h" -#include "yagl_tls.h" #include "yagl_process.h" #include "yagl_thread.h" -static void yagl_egl_offscreen_context_destroy(struct yagl_eglb_context *ctx) +static void yagl_egl_offscreen_context_destroy(struct yagl_thread_state *cur_ts, + struct yagl_eglb_context *ctx) { struct yagl_egl_offscreen_context *egl_offscreen_ctx = (struct yagl_egl_offscreen_context*)ctx; @@ -50,9 +50,9 @@ static void yagl_egl_offscreen_context_destroy(struct yagl_eglb_context *ctx) YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_context_destroy, NULL); if (egl_offscreen_ctx->rp_pbo) { - yagl_ensure_ctx(0); + yagl_ensure_ctx(cur_ts, 0); egl_offscreen->gles_driver->DeleteBuffers(1, &egl_offscreen_ctx->rp_pbo); - yagl_unensure_ctx(0); + yagl_unensure_ctx(cur_ts, 0); } egl_offscreen->egl_driver->context_destroy(egl_offscreen->egl_driver, @@ -67,7 +67,8 @@ 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, + *yagl_egl_offscreen_context_create(struct yagl_thread_state *cur_ts, + struct yagl_egl_offscreen_display *dpy, const struct yagl_egl_native_config *cfg, struct yagl_egl_offscreen_context *share_context, int version) @@ -100,6 +101,7 @@ struct yagl_egl_offscreen_context yagl_eglb_context_init(&ctx->base, &dpy->base); ctx->base.destroy = &yagl_egl_offscreen_context_destroy; + ctx->base.ps = cur_ts->ps; ctx->native_ctx = native_ctx; @@ -108,7 +110,8 @@ struct yagl_egl_offscreen_context return ctx; } -bool yagl_egl_offscreen_context_read_pixels(struct yagl_egl_offscreen_context *ctx, +bool yagl_egl_offscreen_context_read_pixels(struct yagl_thread_state *cur_ts, + struct yagl_egl_offscreen_context *ctx, uint32_t width, uint32_t height, uint32_t bpp, @@ -132,7 +135,7 @@ bool yagl_egl_offscreen_context_read_pixels(struct yagl_egl_offscreen_context *c gles_driver->GetIntegerv(GL_READ_FRAMEBUFFER_BINDING, (GLint*)¤t_fb); - gles_driver->BindFramebuffer(GL_READ_FRAMEBUFFER, 0); + gles_driver->BindFramebufferYAGL(cur_ts, GL_READ_FRAMEBUFFER, 0); gles_driver->GetIntegerv(GL_PACK_ALIGNMENT, ¤t_pack[0]); gles_driver->GetIntegerv(GL_PACK_ROW_LENGTH, ¤t_pack[1]); @@ -226,7 +229,7 @@ out: gles_driver->PixelStorei(GL_PACK_IMAGE_HEIGHT, current_pack[2]); gles_driver->BindBuffer(GL_PIXEL_PACK_BUFFER_ARB, current_pbo); - gles_driver->BindFramebuffer(GL_READ_FRAMEBUFFER, current_fb); + gles_driver->BindFramebufferYAGL(cur_ts, GL_READ_FRAMEBUFFER, current_fb); YAGL_LOG_FUNC_EXIT(NULL); diff --git a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.h b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.h index 647c271318..40d536d18a 100644 --- a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.h +++ b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_context.h @@ -49,12 +49,14 @@ struct yagl_egl_offscreen_context }; struct yagl_egl_offscreen_context - *yagl_egl_offscreen_context_create(struct yagl_egl_offscreen_display *dpy, + *yagl_egl_offscreen_context_create(struct yagl_thread_state *cur_ts, + struct yagl_egl_offscreen_display *dpy, const struct yagl_egl_native_config *cfg, struct yagl_egl_offscreen_context *share_context, int version); -bool yagl_egl_offscreen_context_read_pixels(struct yagl_egl_offscreen_context *ctx, +bool yagl_egl_offscreen_context_read_pixels(struct yagl_thread_state *cur_ts, + struct yagl_egl_offscreen_context *ctx, uint32_t width, uint32_t height, uint32_t bpp, diff --git a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_display.c b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_display.c index 0a1f62f01a..54908ea2d3 100644 --- a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_display.c +++ b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_display.c @@ -34,7 +34,6 @@ #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" @@ -47,15 +46,16 @@ struct yagl_egl_offscreen_image struct yagl_gles_driver *driver; }; -static void yagl_egl_offscreen_image_destroy(struct yagl_object *obj) +static void yagl_egl_offscreen_image_destroy(struct yagl_thread_state *cur_ts, + 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(0); + yagl_ensure_ctx(cur_ts, 0); image->driver->DeleteTextures(1, &obj->global_name); - yagl_unensure_ctx(0); + yagl_unensure_ctx(cur_ts, 0); g_free(image); @@ -71,6 +71,7 @@ static struct yagl_egl_native_config struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)dpy->backend; struct yagl_egl_native_config *native_configs; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_display_config_enum, "dpy = %p", dpy); @@ -92,6 +93,7 @@ static void yagl_egl_offscreen_display_config_cleanup(struct yagl_eglb_display * (struct yagl_egl_offscreen_display*)dpy; struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)dpy->backend; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_display_config_cleanup, "dpy = %p, cfg = %d", @@ -106,7 +108,8 @@ 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, + *yagl_egl_offscreen_display_create_context(struct yagl_thread_state *cur_ts, + struct yagl_eglb_display *dpy, const struct yagl_egl_native_config *cfg, struct yagl_eglb_context *share_context, int version) @@ -114,7 +117,8 @@ static struct yagl_eglb_context struct yagl_egl_offscreen_display *egl_offscreen_dpy = (struct yagl_egl_offscreen_display*)dpy; struct yagl_egl_offscreen_context *ctx = - yagl_egl_offscreen_context_create(egl_offscreen_dpy, + yagl_egl_offscreen_context_create(cur_ts, + egl_offscreen_dpy, cfg, (struct yagl_egl_offscreen_context*)share_context, version); @@ -123,7 +127,8 @@ static struct yagl_eglb_context } static struct yagl_eglb_surface - *yagl_egl_offscreen_display_create_surface(struct yagl_eglb_display *dpy, + *yagl_egl_offscreen_display_create_surface(struct yagl_thread_state *cur_ts, + struct yagl_eglb_display *dpy, const struct yagl_egl_native_config *cfg, EGLenum type, const void *attribs, @@ -135,7 +140,8 @@ static struct yagl_eglb_surface struct yagl_egl_offscreen_display *egl_offscreen_dpy = (struct yagl_egl_offscreen_display*)dpy; struct yagl_egl_offscreen_surface *sfc = - yagl_egl_offscreen_surface_create(egl_offscreen_dpy, + yagl_egl_offscreen_surface_create(cur_ts, + egl_offscreen_dpy, cfg, type, attribs, @@ -147,7 +153,8 @@ static struct yagl_eglb_surface return sfc ? &sfc->base : NULL; } -static struct yagl_object *yagl_egl_offscreen_display_create_image(struct yagl_eglb_display *dpy, +static struct yagl_object *yagl_egl_offscreen_display_create_image(struct yagl_thread_state *cur_ts, + struct yagl_eglb_display *dpy, yagl_winsys_id buffer) { struct yagl_egl_offscreen *egl_offscreen = @@ -156,9 +163,9 @@ static struct yagl_object *yagl_egl_offscreen_display_create_image(struct yagl_e image = g_malloc(sizeof(*image)); - yagl_ensure_ctx(0); + yagl_ensure_ctx(cur_ts, 0); egl_offscreen->gles_driver->GenTextures(1, &image->base.global_name); - yagl_unensure_ctx(0); + yagl_unensure_ctx(cur_ts, 0); image->base.destroy = &yagl_egl_offscreen_image_destroy; image->driver = egl_offscreen->gles_driver; @@ -171,6 +178,7 @@ static void yagl_egl_offscreen_display_destroy(struct yagl_eglb_display *dpy) (struct yagl_egl_offscreen_display*)dpy; struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)dpy->backend; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_display_destroy, "dpy = %p", dpy); @@ -190,6 +198,7 @@ struct yagl_egl_offscreen_display { struct yagl_egl_offscreen_display *dpy; EGLNativeDisplayType native_dpy; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_display_create, NULL); diff --git a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_surface.c b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_surface.c index 3351f22435..85c20830a8 100644 --- a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_surface.c +++ b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_surface.c @@ -34,20 +34,18 @@ #include "yagl_egl_offscreen_ts.h" #include "yagl_egl_offscreen.h" #include "yagl_egl_native_config.h" -#include "yagl_tls.h" #include "yagl_log.h" #include "yagl_process.h" #include "yagl_thread.h" #include "yagl_compiled_transfer.h" -YAGL_DECLARE_TLS(struct yagl_egl_offscreen_ts*, egl_offscreen_ts); - static void yagl_egl_offscreen_surface_cleanup(struct yagl_egl_offscreen_surface *sfc) { struct yagl_egl_offscreen_display *dpy = (struct yagl_egl_offscreen_display*)sfc->base.dpy; struct yagl_egl_offscreen *egl_offscreen = (struct yagl_egl_offscreen*)sfc->base.dpy->backend; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_offscreen_surface_cleanup, NULL); @@ -67,12 +65,14 @@ static void yagl_egl_offscreen_surface_cleanup(struct yagl_egl_offscreen_surface YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_egl_offscreen_surface_invalidate(struct yagl_eglb_surface *sfc, +static void yagl_egl_offscreen_surface_invalidate(struct yagl_thread_state *cur_ts, + struct yagl_eglb_surface *sfc, yagl_winsys_id id) { } -static void yagl_egl_offscreen_surface_replace(struct yagl_eglb_surface *sfc, +static void yagl_egl_offscreen_surface_replace(struct yagl_thread_state *cur_ts, + struct yagl_eglb_surface *sfc, struct yagl_eglb_surface *with) { struct yagl_egl_offscreen_surface *osfc = @@ -95,7 +95,8 @@ static void yagl_egl_offscreen_surface_replace(struct yagl_eglb_surface *sfc, g_free(owith); } -static bool yagl_egl_offscreen_surface_query(struct yagl_eglb_surface *sfc, +static bool yagl_egl_offscreen_surface_query(struct yagl_thread_state *cur_ts, + struct yagl_eglb_surface *sfc, EGLint attribute, EGLint *value) { @@ -116,17 +117,19 @@ static bool yagl_egl_offscreen_surface_query(struct yagl_eglb_surface *sfc, return true; } -static void yagl_egl_offscreen_surface_swap_buffers(struct yagl_eglb_surface *sfc) +static void yagl_egl_offscreen_surface_swap_buffers(struct yagl_thread_state *cur_ts, + struct yagl_eglb_surface *sfc) { struct yagl_egl_offscreen_surface *osfc = (struct yagl_egl_offscreen_surface*)sfc; - struct yagl_egl_offscreen_context *octx = egl_offscreen_ts->ctx; + struct yagl_egl_offscreen_context *octx = cur_ts->egl_offscreen_ts->ctx; // TODO get from cur_ts YAGL_LOG_FUNC_SET(yagl_egl_offscreen_surface_swap_buffers); assert(octx); - if (!yagl_egl_offscreen_context_read_pixels(octx, + if (!yagl_egl_offscreen_context_read_pixels(cur_ts, + octx, osfc->width, osfc->height, osfc->bpp, @@ -140,17 +143,19 @@ static void yagl_egl_offscreen_surface_swap_buffers(struct yagl_eglb_surface *sf yagl_compiled_transfer_exec(osfc->bimage_ct, osfc->host_pixels); } -static void yagl_egl_offscreen_surface_copy_buffers(struct yagl_eglb_surface *sfc) +static void yagl_egl_offscreen_surface_copy_buffers(struct yagl_thread_state *cur_ts, + struct yagl_eglb_surface *sfc) { struct yagl_egl_offscreen_surface *osfc = (struct yagl_egl_offscreen_surface*)sfc; - struct yagl_egl_offscreen_context *octx = egl_offscreen_ts->ctx; + struct yagl_egl_offscreen_context *octx = cur_ts->egl_offscreen_ts->ctx; // TODO get from cur_ts YAGL_LOG_FUNC_SET(yagl_egl_offscreen_surface_copy_buffers); assert(octx); - if (!yagl_egl_offscreen_context_read_pixels(octx, + if (!yagl_egl_offscreen_context_read_pixels(cur_ts, + octx, osfc->width, osfc->height, osfc->bpp, @@ -164,11 +169,13 @@ static void yagl_egl_offscreen_surface_copy_buffers(struct yagl_eglb_surface *sf yagl_compiled_transfer_exec(osfc->bimage_ct, osfc->host_pixels); } -static void yagl_egl_offscreen_surface_wait_gl(struct yagl_eglb_surface *sfc) +static void yagl_egl_offscreen_surface_wait_gl(struct yagl_thread_state *cur_ts, + struct yagl_eglb_surface *sfc) { } -static void yagl_egl_offscreen_surface_destroy(struct yagl_eglb_surface *sfc) +static void yagl_egl_offscreen_surface_destroy(struct yagl_thread_state *cur_ts, + struct yagl_eglb_surface *sfc) { struct yagl_egl_offscreen_surface *egl_offscreen_sfc = (struct yagl_egl_offscreen_surface*)sfc; @@ -185,7 +192,8 @@ static void yagl_egl_offscreen_surface_destroy(struct yagl_eglb_surface *sfc) } struct yagl_egl_offscreen_surface - *yagl_egl_offscreen_surface_create(struct yagl_egl_offscreen_display *dpy, + *yagl_egl_offscreen_surface_create(struct yagl_thread_state *cur_ts, + struct yagl_egl_offscreen_display *dpy, const struct yagl_egl_native_config *cfg, EGLenum type, const void *attribs, @@ -224,7 +232,8 @@ struct yagl_egl_offscreen_surface return NULL; } - bimage_ct = yagl_compiled_transfer_create(pixels, + bimage_ct = yagl_compiled_transfer_create(cur_ts, + pixels, (width * height * bpp), true); diff --git a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_surface.h b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_surface.h index 789b56c5b6..ef3115f6a3 100644 --- a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_surface.h +++ b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_surface.h @@ -69,7 +69,8 @@ struct yagl_egl_offscreen_surface }; struct yagl_egl_offscreen_surface - *yagl_egl_offscreen_surface_create(struct yagl_egl_offscreen_display *dpy, + *yagl_egl_offscreen_surface_create(struct yagl_thread_state *cur_ts, + struct yagl_egl_offscreen_display *dpy, const struct yagl_egl_native_config *cfg, EGLenum type, const void *attribs, diff --git a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_ts.c b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_ts.c index 4547e8e4fd..9c73f07a10 100644 --- a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_ts.c +++ b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_ts.c @@ -29,11 +29,13 @@ #include "yagl_egl_offscreen_ts.h" -struct yagl_egl_offscreen_ts *yagl_egl_offscreen_ts_create(void) +struct yagl_egl_offscreen_ts *yagl_egl_offscreen_ts_create(struct yagl_gles_driver *gles_driver) { struct yagl_egl_offscreen_ts *egl_offscreen_ts = g_malloc0(sizeof(struct yagl_egl_offscreen_ts)); + egl_offscreen_ts->gles_driver = gles_driver; + return egl_offscreen_ts; } diff --git a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_ts.h b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_ts.h index 7c3f34118b..28dc490675 100644 --- a/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_ts.h +++ b/hw/yagl/yagl_backends/egl_offscreen/yagl_egl_offscreen_ts.h @@ -33,19 +33,22 @@ #include "yagl_types.h" #include +struct yagl_gles_driver; struct yagl_egl_offscreen_display; struct yagl_egl_offscreen_context; struct yagl_egl_offscreen_surface; struct yagl_egl_offscreen_ts { + struct yagl_gles_driver *gles_driver; + 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); +struct yagl_egl_offscreen_ts *yagl_egl_offscreen_ts_create(struct yagl_gles_driver *gles_driver); void yagl_egl_offscreen_ts_destroy(struct yagl_egl_offscreen_ts *egl_offscreen_ts); diff --git a/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen.c b/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen.c index 958e807d4d..827603c6eb 100644 --- a/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen.c +++ b/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen.c @@ -33,22 +33,21 @@ #include "yagl_egl_onscreen_display.h" #include "yagl_egl_onscreen_context.h" #include "yagl_egl_onscreen_surface.h" -#include "yagl_tls.h" #include "yagl_log.h" #include "yagl_process.h" #include "yagl_thread.h" #include "yagl_gles_driver.h" #include "hw/vigs/winsys_gl.h" -YAGL_DEFINE_TLS(struct yagl_egl_onscreen_ts*, egl_onscreen_ts); - -static void yagl_egl_onscreen_setup_framebuffer_zero(struct yagl_egl_onscreen *egl_onscreen) +static void yagl_egl_onscreen_setup_framebuffer_zero(struct yagl_thread_state *cur_ts, + struct yagl_egl_onscreen *egl_onscreen) { GLuint cur_fb = 0; + struct yagl_egl_onscreen_ts *egl_onscreen_ts = cur_ts->egl_onscreen_ts; assert(egl_onscreen_ts->dpy); - yagl_egl_onscreen_context_setup(egl_onscreen_ts->ctx); + yagl_egl_onscreen_context_setup(cur_ts, egl_onscreen_ts->ctx); if (!egl_onscreen_ts->sfc_draw) { return; @@ -59,34 +58,50 @@ static void yagl_egl_onscreen_setup_framebuffer_zero(struct yagl_egl_onscreen *e egl_onscreen->gles_driver->GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, (GLint*)&cur_fb); - egl_onscreen->gles_driver->BindFramebuffer(GL_DRAW_FRAMEBUFFER, - egl_onscreen_ts->ctx->fb); + // this might be called when BindFramebufferYAGL was not yet setup + if (egl_onscreen->gles_driver->BindFramebufferYAGL) + { + egl_onscreen->gles_driver->BindFramebufferYAGL(cur_ts, + GL_DRAW_FRAMEBUFFER, + egl_onscreen_ts->ctx->fb); + + yagl_egl_onscreen_surface_attach_to_framebuffer(egl_onscreen_ts->sfc_draw, + GL_DRAW_FRAMEBUFFER); - yagl_egl_onscreen_surface_attach_to_framebuffer(egl_onscreen_ts->sfc_draw, - GL_DRAW_FRAMEBUFFER); + egl_onscreen->gles_driver->BindFramebufferYAGL(cur_ts, + GL_DRAW_FRAMEBUFFER, + cur_fb); + } + else + { + egl_onscreen->gles_driver->BindFramebuffer(GL_DRAW_FRAMEBUFFER, + egl_onscreen_ts->ctx->fb); - egl_onscreen->gles_driver->BindFramebuffer(GL_DRAW_FRAMEBUFFER, - cur_fb); + yagl_egl_onscreen_surface_attach_to_framebuffer(egl_onscreen_ts->sfc_draw, + GL_DRAW_FRAMEBUFFER); + + egl_onscreen->gles_driver->BindFramebuffer(GL_DRAW_FRAMEBUFFER, + cur_fb); + } } -static void yagl_egl_onscreen_thread_init(struct yagl_egl_backend *backend) +static void yagl_egl_onscreen_thread_init(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend) { struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend; YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_thread_init, NULL); - egl_onscreen_ts = yagl_egl_onscreen_ts_create(egl_onscreen->gles_driver); - - cur_ts->egl_onscreen_ts = egl_onscreen_ts; + cur_ts->egl_onscreen_ts = yagl_egl_onscreen_ts_create(egl_onscreen->gles_driver); YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_egl_onscreen_batch_start(struct yagl_egl_backend *backend) +static void yagl_egl_onscreen_batch_start(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend) { struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend; - - egl_onscreen_ts = cur_ts->egl_onscreen_ts; + struct yagl_egl_onscreen_ts *egl_onscreen_ts = cur_ts->egl_onscreen_ts; if (!egl_onscreen_ts->dpy) { return; @@ -107,9 +122,11 @@ static void yagl_egl_onscreen_batch_start(struct yagl_egl_backend *backend) } } -static void yagl_egl_onscreen_batch_end(struct yagl_egl_backend *backend) +static void yagl_egl_onscreen_batch_end(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend) { struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend; + struct yagl_egl_onscreen_ts *egl_onscreen_ts = cur_ts->egl_onscreen_ts; if (!egl_onscreen_ts->dpy) { return; @@ -131,13 +148,15 @@ static struct yagl_eglb_display *yagl_egl_onscreen_create_display(struct yagl_eg return dpy ? &dpy->base : NULL; } -static bool yagl_egl_onscreen_make_current(struct yagl_egl_backend *backend, +static bool yagl_egl_onscreen_make_current(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend, struct yagl_eglb_display *dpy, struct yagl_eglb_context *ctx, struct yagl_eglb_surface *draw, struct yagl_eglb_surface *read) { struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend; + struct yagl_egl_onscreen_ts *egl_onscreen_ts = cur_ts->egl_onscreen_ts; struct yagl_egl_onscreen_display *egl_onscreen_dpy = (struct yagl_egl_onscreen_display*)dpy; struct yagl_egl_onscreen_context *egl_onscreen_ctx = (struct yagl_egl_onscreen_context*)ctx; struct yagl_egl_onscreen_surface *egl_onscreen_draw = (struct yagl_egl_onscreen_surface*)draw; @@ -176,7 +195,7 @@ static bool yagl_egl_onscreen_make_current(struct yagl_egl_backend *backend, egl_onscreen_ts->sfc_draw = egl_onscreen_draw; egl_onscreen_ts->sfc_read = egl_onscreen_read; - yagl_egl_onscreen_setup_framebuffer_zero(egl_onscreen); + yagl_egl_onscreen_setup_framebuffer_zero(cur_ts, egl_onscreen); egl_onscreen->gles_driver->GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, (GLint*)&cur_fb); @@ -186,8 +205,14 @@ static bool yagl_egl_onscreen_make_current(struct yagl_egl_backend *backend, * No framebuffer, then bind our framebuffer zero. */ - egl_onscreen->gles_driver->BindFramebuffer(GL_FRAMEBUFFER, - egl_onscreen_ctx->fb); + if (egl_onscreen->gles_driver->BindFramebufferYAGL) { + egl_onscreen->gles_driver->BindFramebufferYAGL(cur_ts, + GL_FRAMEBUFFER, + egl_onscreen_ctx->fb); + } else { + egl_onscreen->gles_driver->BindFramebuffer(GL_FRAMEBUFFER, + egl_onscreen_ctx->fb); + } /* * Setup default viewport and scissor. @@ -219,9 +244,12 @@ static bool yagl_egl_onscreen_make_current(struct yagl_egl_backend *backend, return res; } -static bool yagl_egl_onscreen_release_current(struct yagl_egl_backend *backend, bool force) +static bool yagl_egl_onscreen_release_current(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend, + bool force) { struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend; + struct yagl_egl_onscreen_ts *egl_onscreen_ts = cur_ts->egl_onscreen_ts; bool res; YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_release_current, NULL); @@ -252,17 +280,19 @@ static bool yagl_egl_onscreen_release_current(struct yagl_egl_backend *backend, return res || force; } -static void yagl_egl_onscreen_thread_fini(struct yagl_egl_backend *backend) +static void yagl_egl_onscreen_thread_fini(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend) { YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_thread_fini, NULL); - yagl_egl_onscreen_ts_destroy(egl_onscreen_ts); - egl_onscreen_ts = cur_ts->egl_onscreen_ts = NULL; + yagl_egl_onscreen_ts_destroy(cur_ts->egl_onscreen_ts); + cur_ts->egl_onscreen_ts = NULL; YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_egl_onscreen_ensure_current(struct yagl_egl_backend *backend) +static void yagl_egl_onscreen_ensure_current(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend) { struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend; @@ -273,9 +303,11 @@ static void yagl_egl_onscreen_ensure_current(struct yagl_egl_backend *backend) egl_onscreen->ensure_ctx); } -static void yagl_egl_onscreen_unensure_current(struct yagl_egl_backend *backend) +static void yagl_egl_onscreen_unensure_current(struct yagl_thread_state *cur_ts, + struct yagl_egl_backend *backend) { struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend; + struct yagl_egl_onscreen_ts *egl_onscreen_ts = (cur_ts ? cur_ts->egl_onscreen_ts : NULL); if (egl_onscreen_ts && egl_onscreen_ts->dpy) { if (egl_onscreen_ts->sfc_draw && egl_onscreen_ts->sfc_read) { @@ -303,6 +335,7 @@ static void yagl_egl_onscreen_unensure_current(struct yagl_egl_backend *backend) static void yagl_egl_onscreen_destroy(struct yagl_egl_backend *backend) { struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)backend; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_destroy, NULL); @@ -345,6 +378,7 @@ struct yagl_egl_backend *yagl_egl_onscreen_create(struct winsys_interface *wsi, EGLContext ctx = EGL_NO_CONTEXT; EGLContext global_ctx = EGL_NO_CONTEXT; struct winsys_gl_info *ws_info = (struct winsys_gl_info*)wsi->ws_info; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_create, NULL); diff --git a/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.c b/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.c index 018ea61f6f..8dd9523bc9 100644 --- a/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.c +++ b/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.c @@ -34,11 +34,10 @@ #include "yagl_egl_surface_attribs.h" #include "yagl_gles_driver.h" #include "yagl_log.h" -#include "yagl_tls.h" #include "yagl_process.h" #include "yagl_thread.h" -static void yagl_egl_onscreen_context_destroy(struct yagl_eglb_context *ctx) +static void yagl_egl_onscreen_context_destroy(struct yagl_thread_state *cur_ts, struct yagl_eglb_context *ctx) { struct yagl_egl_onscreen_context *egl_onscreen_ctx = (struct yagl_egl_onscreen_context*)ctx; @@ -50,9 +49,9 @@ static void yagl_egl_onscreen_context_destroy(struct yagl_eglb_context *ctx) YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_context_destroy, NULL); if (egl_onscreen_ctx->fb) { - yagl_ensure_ctx(egl_onscreen_ctx->fb_ctx_id); + yagl_ensure_ctx(cur_ts, egl_onscreen_ctx->fb_ctx_id); egl_onscreen->gles_driver->DeleteFramebuffers(1, &egl_onscreen_ctx->fb); - yagl_unensure_ctx(egl_onscreen_ctx->fb_ctx_id); + yagl_unensure_ctx(cur_ts, egl_onscreen_ctx->fb_ctx_id); } if (egl_onscreen_ctx->null_sfc != EGL_NO_SURFACE) { @@ -75,7 +74,8 @@ 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, + *yagl_egl_onscreen_context_create(struct yagl_thread_state *cur_ts, + struct yagl_egl_onscreen_display *dpy, const struct yagl_egl_native_config *cfg, struct yagl_egl_onscreen_context *share_context, int version) @@ -108,6 +108,7 @@ struct yagl_egl_onscreen_context yagl_eglb_context_init(&ctx->base, &dpy->base); ctx->base.destroy = &yagl_egl_onscreen_context_destroy; + ctx->base.ps = cur_ts->ps; ctx->native_ctx = native_ctx; @@ -120,7 +121,8 @@ struct yagl_egl_onscreen_context return ctx; } -void yagl_egl_onscreen_context_setup(struct yagl_egl_onscreen_context *ctx) +void yagl_egl_onscreen_context_setup(struct yagl_thread_state *cur_ts, + struct yagl_egl_onscreen_context *ctx) { struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)ctx->base.dpy->backend; @@ -130,7 +132,7 @@ void yagl_egl_onscreen_context_setup(struct yagl_egl_onscreen_context *ctx) } egl_onscreen->gles_driver->GenFramebuffers(1, &ctx->fb); - ctx->fb_ctx_id = yagl_get_ctx_id(); + ctx->fb_ctx_id = yagl_get_ctx_id(cur_ts); } bool yagl_egl_onscreen_context_setup_surfaceless(struct yagl_egl_onscreen_context *ctx) diff --git a/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.h b/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.h index 1954735e75..a482f38446 100644 --- a/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.h +++ b/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_context.h @@ -72,12 +72,14 @@ struct yagl_egl_onscreen_context }; struct yagl_egl_onscreen_context - *yagl_egl_onscreen_context_create(struct yagl_egl_onscreen_display *dpy, + *yagl_egl_onscreen_context_create(struct yagl_thread_state *cur_ts, + struct yagl_egl_onscreen_display *dpy, const struct yagl_egl_native_config *cfg, struct yagl_egl_onscreen_context *share_context, int version); -void yagl_egl_onscreen_context_setup(struct yagl_egl_onscreen_context *ctx); +void yagl_egl_onscreen_context_setup(struct yagl_thread_state *cur_ts, + struct yagl_egl_onscreen_context *ctx); bool yagl_egl_onscreen_context_setup_surfaceless(struct yagl_egl_onscreen_context *ctx); diff --git a/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_display.c b/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_display.c index 1fc73a4bda..8d09635e1f 100644 --- a/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_display.c +++ b/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_display.c @@ -34,7 +34,6 @@ #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" @@ -47,7 +46,8 @@ struct yagl_egl_onscreen_image struct winsys_gl_surface *ws_sfc; }; -static void yagl_egl_onscreen_image_destroy(struct yagl_object *obj) +static void yagl_egl_onscreen_image_destroy(struct yagl_thread_state *cur_ts, + struct yagl_object *obj) { struct yagl_egl_onscreen_image *image = (struct yagl_egl_onscreen_image*)obj; @@ -69,6 +69,7 @@ static struct yagl_egl_native_config struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)dpy->backend; struct yagl_egl_native_config *native_configs; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_display_config_enum, "dpy = %p", dpy); @@ -90,6 +91,7 @@ static void yagl_egl_onscreen_display_config_cleanup(struct yagl_eglb_display *d (struct yagl_egl_onscreen_display*)dpy; struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)dpy->backend; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_display_config_cleanup, "dpy = %p, cfg = %d", @@ -104,7 +106,8 @@ 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, + *yagl_egl_onscreen_display_create_context(struct yagl_thread_state *cur_ts, + struct yagl_eglb_display *dpy, const struct yagl_egl_native_config *cfg, struct yagl_eglb_context *share_context, int version) @@ -112,7 +115,8 @@ static struct yagl_eglb_context struct yagl_egl_onscreen_display *egl_onscreen_dpy = (struct yagl_egl_onscreen_display*)dpy; struct yagl_egl_onscreen_context *ctx = - yagl_egl_onscreen_context_create(egl_onscreen_dpy, + yagl_egl_onscreen_context_create(cur_ts, + egl_onscreen_dpy, cfg, (struct yagl_egl_onscreen_context*)share_context, version); @@ -121,7 +125,8 @@ static struct yagl_eglb_context } static struct yagl_eglb_surface - *yagl_egl_onscreen_display_create_window_surface(struct yagl_eglb_display *dpy, + *yagl_egl_onscreen_display_create_window_surface(struct yagl_thread_state *cur_ts, + struct yagl_eglb_display *dpy, const struct yagl_egl_native_config *cfg, const struct yagl_egl_window_attribs *attribs, yagl_winsys_id id) @@ -129,7 +134,8 @@ static struct yagl_eglb_surface struct yagl_egl_onscreen_display *egl_onscreen_dpy = (struct yagl_egl_onscreen_display*)dpy; struct yagl_egl_onscreen_surface *sfc = - yagl_egl_onscreen_surface_create_window(egl_onscreen_dpy, + yagl_egl_onscreen_surface_create_window(cur_ts, + egl_onscreen_dpy, cfg, attribs, id); @@ -138,7 +144,8 @@ static struct yagl_eglb_surface } static struct yagl_eglb_surface - *yagl_egl_onscreen_display_create_pixmap_surface(struct yagl_eglb_display *dpy, + *yagl_egl_onscreen_display_create_pixmap_surface(struct yagl_thread_state *cur_ts, + struct yagl_eglb_display *dpy, const struct yagl_egl_native_config *cfg, const struct yagl_egl_pixmap_attribs *attribs, yagl_winsys_id id) @@ -146,7 +153,8 @@ static struct yagl_eglb_surface struct yagl_egl_onscreen_display *egl_onscreen_dpy = (struct yagl_egl_onscreen_display*)dpy; struct yagl_egl_onscreen_surface *sfc = - yagl_egl_onscreen_surface_create_pixmap(egl_onscreen_dpy, + yagl_egl_onscreen_surface_create_pixmap(cur_ts, + egl_onscreen_dpy, cfg, attribs, id); @@ -155,7 +163,8 @@ static struct yagl_eglb_surface } static struct yagl_eglb_surface - *yagl_egl_onscreen_display_create_pbuffer_surface(struct yagl_eglb_display *dpy, + *yagl_egl_onscreen_display_create_pbuffer_surface(struct yagl_thread_state *cur_ts, + struct yagl_eglb_display *dpy, const struct yagl_egl_native_config *cfg, const struct yagl_egl_pbuffer_attribs *attribs, yagl_winsys_id id) @@ -163,7 +172,8 @@ static struct yagl_eglb_surface struct yagl_egl_onscreen_display *egl_onscreen_dpy = (struct yagl_egl_onscreen_display*)dpy; struct yagl_egl_onscreen_surface *sfc = - yagl_egl_onscreen_surface_create_pbuffer(egl_onscreen_dpy, + yagl_egl_onscreen_surface_create_pbuffer(cur_ts, + egl_onscreen_dpy, cfg, attribs, id); @@ -171,7 +181,8 @@ static struct yagl_eglb_surface return sfc ? &sfc->base : NULL; } -static struct yagl_object *yagl_egl_onscreen_display_create_image(struct yagl_eglb_display *dpy, +static struct yagl_object *yagl_egl_onscreen_display_create_image(struct yagl_thread_state *cur_ts, + struct yagl_eglb_display *dpy, yagl_winsys_id buffer) { struct yagl_egl_onscreen *egl_onscreen = @@ -200,6 +211,7 @@ static void yagl_egl_onscreen_display_destroy(struct yagl_eglb_display *dpy) (struct yagl_egl_onscreen_display*)dpy; struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)dpy->backend; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_display_destroy, "dpy = %p", dpy); @@ -219,6 +231,7 @@ struct yagl_egl_onscreen_display { struct yagl_egl_onscreen_display *dpy; EGLNativeDisplayType native_dpy; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_onscreen_display_create, NULL); diff --git a/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.c b/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.c index 501dc667c3..63bfb2ec6d 100644 --- a/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.c +++ b/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.c @@ -39,9 +39,8 @@ #include "yagl_gles_driver.h" #include "hw/vigs/winsys_gl.h" -YAGL_DECLARE_TLS(struct yagl_egl_onscreen_ts*, egl_onscreen_ts); - -static void yagl_egl_onscreen_surface_invalidate(struct yagl_eglb_surface *sfc, +static void yagl_egl_onscreen_surface_invalidate(struct yagl_thread_state *cur_ts, + struct yagl_eglb_surface *sfc, yagl_winsys_id id) { struct yagl_egl_onscreen_surface *osfc = @@ -69,16 +68,16 @@ static void yagl_egl_onscreen_surface_invalidate(struct yagl_eglb_surface *sfc, if (((osfc->ws_sfc->base.width != ws_sfc->base.width) || (osfc->ws_sfc->base.height != ws_sfc->base.height)) && osfc->rb) { - yagl_ensure_ctx(0); + yagl_ensure_ctx(cur_ts, 0); egl_onscreen->gles_driver->DeleteRenderbuffers(1, &osfc->rb); - yagl_unensure_ctx(0); + yagl_unensure_ctx(cur_ts, 0); osfc->rb = 0; } osfc->ws_sfc->base.release(&osfc->ws_sfc->base); osfc->ws_sfc = ws_sfc; - if (egl_onscreen_ts->sfc_draw == osfc) { + if (cur_ts->egl_onscreen_ts->sfc_draw == osfc) { GLuint cur_fb = 0; yagl_egl_onscreen_surface_setup(osfc); @@ -86,22 +85,36 @@ static void yagl_egl_onscreen_surface_invalidate(struct yagl_eglb_surface *sfc, egl_onscreen->gles_driver->GetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, (GLint*)&cur_fb); - egl_onscreen->gles_driver->BindFramebuffer(GL_DRAW_FRAMEBUFFER, - egl_onscreen_ts->ctx->fb); + if (egl_onscreen->gles_driver->BindFramebufferYAGL) { + egl_onscreen->gles_driver->BindFramebufferYAGL(cur_ts, + GL_DRAW_FRAMEBUFFER, + cur_ts->egl_onscreen_ts->ctx->fb); + + yagl_egl_onscreen_surface_attach_to_framebuffer(osfc, + GL_DRAW_FRAMEBUFFER); + + egl_onscreen->gles_driver->BindFramebufferYAGL(cur_ts, + GL_DRAW_FRAMEBUFFER, + cur_fb); + } else { + egl_onscreen->gles_driver->BindFramebuffer(GL_DRAW_FRAMEBUFFER, + cur_ts->egl_onscreen_ts->ctx->fb); - yagl_egl_onscreen_surface_attach_to_framebuffer(osfc, - GL_DRAW_FRAMEBUFFER); + yagl_egl_onscreen_surface_attach_to_framebuffer(osfc, + GL_DRAW_FRAMEBUFFER); - egl_onscreen->gles_driver->BindFramebuffer(GL_DRAW_FRAMEBUFFER, - cur_fb); + egl_onscreen->gles_driver->BindFramebuffer(GL_DRAW_FRAMEBUFFER, + cur_fb); + } } YAGL_LOG_FUNC_EXIT(NULL); } -static bool yagl_egl_onscreen_surface_query(struct yagl_eglb_surface *sfc, - EGLint attribute, - EGLint *value) +static bool yagl_egl_onscreen_surface_query(struct yagl_thread_state *cur_ts, + struct yagl_eglb_surface *sfc, + EGLint attribute, + EGLint *value) { struct yagl_egl_onscreen_surface *osfc = (struct yagl_egl_onscreen_surface*)sfc; @@ -120,7 +133,8 @@ static bool yagl_egl_onscreen_surface_query(struct yagl_eglb_surface *sfc, return true; } -static void yagl_egl_onscreen_surface_swap_buffers(struct yagl_eglb_surface *sfc) +static void yagl_egl_onscreen_surface_swap_buffers(struct yagl_thread_state *cur_ts, + struct yagl_eglb_surface *sfc) { struct yagl_egl_onscreen_surface *osfc = (struct yagl_egl_onscreen_surface*)sfc; @@ -132,7 +146,8 @@ static void yagl_egl_onscreen_surface_swap_buffers(struct yagl_eglb_surface *sfc osfc->ws_sfc->base.set_dirty(&osfc->ws_sfc->base); } -static void yagl_egl_onscreen_surface_copy_buffers(struct yagl_eglb_surface *sfc) +static void yagl_egl_onscreen_surface_copy_buffers(struct yagl_thread_state *cur_ts, + struct yagl_eglb_surface *sfc) { struct yagl_egl_onscreen_surface *osfc = (struct yagl_egl_onscreen_surface*)sfc; @@ -144,7 +159,8 @@ static void yagl_egl_onscreen_surface_copy_buffers(struct yagl_eglb_surface *sfc osfc->ws_sfc->base.set_dirty(&osfc->ws_sfc->base); } -static void yagl_egl_onscreen_surface_wait_gl(struct yagl_eglb_surface *sfc) +static void yagl_egl_onscreen_surface_wait_gl(struct yagl_thread_state *cur_ts, + struct yagl_eglb_surface *sfc) { struct yagl_egl_onscreen_surface *osfc = (struct yagl_egl_onscreen_surface*)sfc; @@ -156,7 +172,8 @@ static void yagl_egl_onscreen_surface_wait_gl(struct yagl_eglb_surface *sfc) osfc->ws_sfc->base.set_dirty(&osfc->ws_sfc->base); } -static void yagl_egl_onscreen_surface_destroy(struct yagl_eglb_surface *sfc) +static void yagl_egl_onscreen_surface_destroy(struct yagl_thread_state *cur_ts, + struct yagl_eglb_surface *sfc) { struct yagl_egl_onscreen_surface *osfc = (struct yagl_egl_onscreen_surface*)sfc; @@ -177,9 +194,9 @@ static void yagl_egl_onscreen_surface_destroy(struct yagl_eglb_surface *sfc) } if (osfc->rb) { - yagl_ensure_ctx(0); + yagl_ensure_ctx(cur_ts, 0); egl_onscreen->gles_driver->DeleteRenderbuffers(1, &osfc->rb); - yagl_unensure_ctx(0); + yagl_unensure_ctx(cur_ts, 0); } yagl_eglb_surface_cleanup(sfc); @@ -190,7 +207,8 @@ static void yagl_egl_onscreen_surface_destroy(struct yagl_eglb_surface *sfc) } struct yagl_egl_onscreen_surface - *yagl_egl_onscreen_surface_create_window(struct yagl_egl_onscreen_display *dpy, + *yagl_egl_onscreen_surface_create_window(struct yagl_thread_state *cur_ts, + struct yagl_egl_onscreen_display *dpy, const struct yagl_egl_native_config *cfg, const struct yagl_egl_window_attribs *attribs, yagl_winsys_id id) @@ -256,7 +274,8 @@ fail: } struct yagl_egl_onscreen_surface - *yagl_egl_onscreen_surface_create_pixmap(struct yagl_egl_onscreen_display *dpy, + *yagl_egl_onscreen_surface_create_pixmap(struct yagl_thread_state *cur_ts, + struct yagl_egl_onscreen_display *dpy, const struct yagl_egl_native_config *cfg, const struct yagl_egl_pixmap_attribs *attribs, yagl_winsys_id id) @@ -322,10 +341,11 @@ fail: } struct yagl_egl_onscreen_surface - *yagl_egl_onscreen_surface_create_pbuffer(struct yagl_egl_onscreen_display *dpy, - const struct yagl_egl_native_config *cfg, - const struct yagl_egl_pbuffer_attribs *attribs, - yagl_winsys_id id) + *yagl_egl_onscreen_surface_create_pbuffer(struct yagl_thread_state *cur_ts, + struct yagl_egl_onscreen_display *dpy, + const struct yagl_egl_native_config *cfg, + const struct yagl_egl_pbuffer_attribs *attribs, + yagl_winsys_id id) { struct yagl_egl_onscreen *egl_onscreen = (struct yagl_egl_onscreen*)dpy->base.backend; diff --git a/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.h b/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.h index 179d7a45ca..20945aaadf 100644 --- a/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.h +++ b/hw/yagl/yagl_backends/egl_onscreen/yagl_egl_onscreen_surface.h @@ -61,22 +61,25 @@ struct yagl_egl_onscreen_surface }; struct yagl_egl_onscreen_surface - *yagl_egl_onscreen_surface_create_window(struct yagl_egl_onscreen_display *dpy, + *yagl_egl_onscreen_surface_create_window(struct yagl_thread_state *cur_ts, + struct yagl_egl_onscreen_display *dpy, const struct yagl_egl_native_config *cfg, const struct yagl_egl_window_attribs *attribs, yagl_winsys_id id); struct yagl_egl_onscreen_surface - *yagl_egl_onscreen_surface_create_pixmap(struct yagl_egl_onscreen_display *dpy, + *yagl_egl_onscreen_surface_create_pixmap(struct yagl_thread_state *cur_ts, + struct yagl_egl_onscreen_display *dpy, const struct yagl_egl_native_config *cfg, const struct yagl_egl_pixmap_attribs *attribs, yagl_winsys_id id); struct yagl_egl_onscreen_surface - *yagl_egl_onscreen_surface_create_pbuffer(struct yagl_egl_onscreen_display *dpy, - const struct yagl_egl_native_config *cfg, - const struct yagl_egl_pbuffer_attribs *attribs, - yagl_winsys_id id); + *yagl_egl_onscreen_surface_create_pbuffer(struct yagl_thread_state *cur_ts, + struct yagl_egl_onscreen_display *dpy, + const struct yagl_egl_native_config *cfg, + const struct yagl_egl_pbuffer_attribs *attribs, + yagl_winsys_id id); void yagl_egl_onscreen_surface_setup(struct yagl_egl_onscreen_surface *sfc); diff --git a/hw/yagl/yagl_compiled_transfer.c b/hw/yagl/yagl_compiled_transfer.c index bdf383e129..0159ea6bac 100644 --- a/hw/yagl/yagl_compiled_transfer.c +++ b/hw/yagl/yagl_compiled_transfer.c @@ -52,7 +52,8 @@ static hwaddr yagl_pa(target_ulong va) } struct yagl_compiled_transfer - *yagl_compiled_transfer_create(target_ulong va, + *yagl_compiled_transfer_create(struct yagl_thread_state *cur_ts, + target_ulong va, uint32_t len, bool is_write) { @@ -67,6 +68,7 @@ struct yagl_compiled_transfer QLIST_INSERT_HEAD(&cur_ts->t->compiled_transfers, ct, entry); ct->in_list = true; + ct->ts = cur_ts; return ct; } @@ -95,7 +97,8 @@ void yagl_compiled_transfer_destroy(struct yagl_compiled_transfer *ct) g_free(ct); } -void yagl_compiled_transfer_prepare(struct yagl_compiled_transfer *ct) +void yagl_compiled_transfer_prepare(struct yagl_thread_state *cur_ts, + struct yagl_compiled_transfer *ct) { struct yagl_vector v; target_ulong last_page_va = YAGL_TARGET_PAGE_VA(ct->va + ct->len - 1); diff --git a/hw/yagl/yagl_compiled_transfer.h b/hw/yagl/yagl_compiled_transfer.h index 50580d8698..43821ac5e1 100644 --- a/hw/yagl/yagl_compiled_transfer.h +++ b/hw/yagl/yagl_compiled_transfer.h @@ -51,6 +51,7 @@ struct yagl_compiled_transfer_section struct yagl_compiled_transfer { QLIST_ENTRY(yagl_compiled_transfer) entry; + struct yagl_thread_state *ts; target_ulong va; uint32_t len; @@ -63,13 +64,15 @@ struct yagl_compiled_transfer }; struct yagl_compiled_transfer - *yagl_compiled_transfer_create(target_ulong va, + *yagl_compiled_transfer_create(struct yagl_thread_state *cur_ts, + target_ulong va, uint32_t len, bool is_write); void yagl_compiled_transfer_destroy(struct yagl_compiled_transfer *ct); -void yagl_compiled_transfer_prepare(struct yagl_compiled_transfer *ct); +void yagl_compiled_transfer_prepare(struct yagl_thread_state *cur_ts, + struct yagl_compiled_transfer *ct); void yagl_compiled_transfer_exec(struct yagl_compiled_transfer *ct, void* data); diff --git a/hw/yagl/yagl_device.c b/hw/yagl/yagl_device.c index c6fe8c1e80..42af00f372 100644 --- a/hw/yagl/yagl_device.c +++ b/hw/yagl/yagl_device.c @@ -35,6 +35,7 @@ #include "yagl_thread.h" #include "yagl_egl_driver.h" #include "yagl_drivers/gles_ogl/yagl_gles_ogl.h" +#include "yagl_drivers/gles_offscreen/yagl_gles_offscreen.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" @@ -49,7 +50,6 @@ #include "yagl_gles_driver.h" #include "yagl_version.h" - #define PCI_VENDOR_ID_YAGL 0x19B1 #define PCI_DEVICE_ID_YAGL 0x1010 @@ -96,6 +96,7 @@ static void yagl_device_operate(YaGLState *s, int user_index, hwaddr buff_pa) yagl_tid target_tid; hwaddr buff_len = TARGET_PAGE_SIZE; uint8_t *buff = NULL; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_device_operate, "user_index = %d, buff_pa = %" PRIx64, @@ -173,6 +174,8 @@ out: static void yagl_device_trigger(YaGLState *s, int user_index, bool sync) { + YAGL_LOG_NO_TS; + YAGL_LOG_FUNC_ENTER(yagl_device_trigger, "%d, %d", user_index, sync); if (s->users[user_index].activated) { @@ -237,6 +240,7 @@ static void yagl_device_init(PCIDevice *dev, Error **err) struct yagl_egl_driver *egl_driver = NULL; struct yagl_egl_backend *egl_backend = NULL; struct yagl_gles_driver *gles_driver = NULL; + YAGL_LOG_NO_TS; if (s->protocol > 0) { yagl_protocol_version = s->protocol; @@ -328,6 +332,7 @@ static void yagl_device_init(PCIDevice *dev, Error **err) gles_driver = yagl_gles_onscreen_create(gles_driver); } else { egl_backend = yagl_egl_offscreen_create(egl_driver, gles_driver); + gles_driver = yagl_gles_offscreen_create(gles_driver); } if (!egl_backend) { @@ -381,6 +386,7 @@ static void yagl_device_reset(DeviceState *d) { YaGLState *s = YAGL_DEVICE_PCI(d); int i; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_device_reset, NULL); @@ -398,7 +404,7 @@ static void yagl_device_reset(DeviceState *d) static void yagl_device_exit(PCIDevice *dev) { YaGLState *s = YAGL_DEVICE_PCI(dev); - + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_device_exit, NULL); yagl_server_state_destroy(s->ss); diff --git a/hw/yagl/yagl_drivers/Makefile.objs b/hw/yagl/yagl_drivers/Makefile.objs index 773972b341..bdcd9ab175 100644 --- a/hw/yagl/yagl_drivers/Makefile.objs +++ b/hw/yagl/yagl_drivers/Makefile.objs @@ -3,4 +3,5 @@ obj-$(CONFIG_WIN32) += egl_wgl/ obj-$(CONFIG_DARWIN) += egl_cgl/ obj-y += gles_ogl/ obj-y += gles_onscreen/ +obj-y += gles_offscreen/ diff --git a/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c b/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c index 90cd0bc332..a42b5f7427 100644 --- a/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c +++ b/hw/yagl/yagl_drivers/egl_cgl/yagl_egl_cgl.c @@ -35,7 +35,6 @@ #include "yagl_egl_native_config.h" #include "yagl_egl_surface_attribs.h" #include "yagl_process.h" -#include "yagl_tls.h" #include "yagl_thread.h" #define LIBGL_IMAGE_NAME \ @@ -145,6 +144,7 @@ static bool yagl_egl_cgl_get_gl_version(struct yagl_egl_cgl *egl_cgl, CGLPixelFormatObj pixel_format; int n; unsigned int i; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_get_gl_version, NULL); @@ -213,6 +213,8 @@ out: static EGLNativeDisplayType yagl_egl_cgl_display_open(struct yagl_egl_driver *driver) { + YAGL_LOG_NO_TS; + YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_display_open, NULL); YAGL_LOG_FUNC_EXIT("%p", (void*)1); @@ -223,6 +225,8 @@ static EGLNativeDisplayType yagl_egl_cgl_display_open(struct yagl_egl_driver *dr static void yagl_egl_cgl_display_close(struct yagl_egl_driver *driver, EGLNativeDisplayType dpy) { + YAGL_LOG_NO_TS; + YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_display_close, "%p", dpy); YAGL_LOG_FUNC_EXIT(NULL); @@ -238,6 +242,7 @@ static bool yagl_egl_cgl_config_fill(CGLPixelFormatObj pixel_format, int stencil_size = 0; int samples_per_pixel = 0; CGLError error; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_config_fill, NULL); @@ -290,6 +295,7 @@ static struct yagl_egl_native_config int n = 0, n_ms = 0; int screen_idx, cfg_idx; CGLError error; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_config_enum, "%p", dpy); @@ -363,6 +369,8 @@ static void yagl_egl_cgl_config_cleanup(struct yagl_egl_driver *driver, EGLNativeDisplayType dpy, const struct yagl_egl_native_config *cfg) { + YAGL_LOG_NO_TS; + YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_config_cleanup, "dpy = %p, cfg = %d", dpy, @@ -380,6 +388,7 @@ static EGLSurface yagl_egl_cgl_pbuffer_surface_create(struct yagl_egl_driver *dr { CGLPBufferObj pbuffer = NULL; CGLError error; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_pbuffer_surface_create, "dpy = %p, width = %d, height = %d", @@ -415,6 +424,7 @@ static void yagl_egl_cgl_pbuffer_surface_destroy(struct yagl_egl_driver *driver, EGLSurface sfc) { CGLError error; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_pbuffer_surface_destroy, "dpy = %p, sfc = %p", @@ -441,6 +451,7 @@ static EGLContext yagl_egl_cgl_context_create(struct yagl_egl_driver *driver, struct yagl_egl_cgl_context *ctx = NULL; CGLContextObj share_ctx; CGLError error; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_context_create, "dpy = %p, share_context = %p, version = %d", @@ -481,6 +492,7 @@ static void yagl_egl_cgl_context_destroy(struct yagl_egl_driver *driver, EGLContext ctx) { CGLError error; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_context_destroy, "dpy = %p, ctx = %p", @@ -508,6 +520,7 @@ static bool yagl_egl_cgl_make_current(struct yagl_egl_driver *driver, CGLPBufferObj draw_pbuffer = (CGLPBufferObj)draw; CGLPBufferObj read_pbuffer = (CGLPBufferObj)read; CGLError error; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_make_current, "dpy = %p, draw = %p, read = %p, ctx = %p", @@ -556,6 +569,7 @@ fail: static void yagl_egl_cgl_destroy(struct yagl_egl_driver *driver) { struct yagl_egl_cgl *egl_cgl = (struct yagl_egl_cgl*)driver; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_cgl_destroy, NULL); @@ -583,6 +597,7 @@ struct yagl_egl_driver *yagl_egl_driver_create(void *display, CGLError error; struct yagl_egl_cgl *egl_cgl; int n; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_driver_create, NULL); diff --git a/hw/yagl/yagl_drivers/egl_glx/yagl_egl_glx.c b/hw/yagl/yagl_drivers/egl_glx/yagl_egl_glx.c index 51d333ef63..f287faa50f 100644 --- a/hw/yagl/yagl_drivers/egl_glx/yagl_egl_glx.c +++ b/hw/yagl/yagl_drivers/egl_glx/yagl_egl_glx.c @@ -30,7 +30,6 @@ #include "yagl_egl_driver.h" #include "yagl_dyn_lib.h" #include "yagl_log.h" -#include "yagl_tls.h" #include "yagl_thread.h" #include "yagl_process.h" #include "yagl_egl_native_config.h" @@ -38,6 +37,7 @@ #include #define YAGL_EGL_GLX_ENTER(func, format, ...) \ + YAGL_LOG_NO_TS; \ YAGL_LOG_FUNC_ENTER(func, format,##__VA_ARGS__) #define YAGL_EGL_GLX_GET_PROC(proc_type, proc_name) \ @@ -722,6 +722,7 @@ static bool yagl_egl_glx_make_current(struct yagl_egl_driver *driver, static void yagl_egl_glx_destroy(struct yagl_egl_driver *driver) { struct yagl_egl_glx *egl_glx = (struct yagl_egl_glx*)driver; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_glx_destroy, NULL); @@ -738,6 +739,7 @@ struct yagl_egl_driver *yagl_egl_driver_create(void *display, struct yagl_egl_driver *egl_driver; struct yagl_egl_glx *egl_glx; Display *x_display = display; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_glx_create, NULL); diff --git a/hw/yagl/yagl_drivers/egl_wgl/yagl_egl_wgl.c b/hw/yagl/yagl_drivers/egl_wgl/yagl_egl_wgl.c index 51ce2a1257..4bbb29f0e3 100644 --- a/hw/yagl/yagl_drivers/egl_wgl/yagl_egl_wgl.c +++ b/hw/yagl/yagl_drivers/egl_wgl/yagl_egl_wgl.c @@ -27,17 +27,15 @@ * */ -#include "yagl_types.h" +#include "yagl_log.h" #include #include #include #include "yagl_egl_driver.h" #include "yagl_dyn_lib.h" -#include "yagl_log.h" #include "yagl_egl_native_config.h" #include "yagl_egl_surface_attribs.h" #include "yagl_process.h" -#include "yagl_tls.h" #include "yagl_thread.h" #define YAGL_EGL_WGL_WIN_CLASS "YaGLwinClass" @@ -189,6 +187,7 @@ static bool yagl_egl_wgl_get_gl_version(YaglEglWglDriver *egl_wgl, GLint i, num_extensions = 0; unsigned int j; bool skip_compatibility_check = 1; + YAGL_LOG_NO_TS; YAGL_EGL_WGL_ENTER(yagl_egl_wgl_get_gl_version, NULL); @@ -418,6 +417,7 @@ static EGLNativeDisplayType yagl_egl_wgl_display_open(struct yagl_egl_driver *driver) { YaglEglWglDpy *dpy; + YAGL_LOG_NO_TS; YAGL_EGL_WGL_ENTER(yagl_egl_wgl_display_open, NULL); @@ -445,6 +445,7 @@ static void yagl_egl_wgl_display_close(struct yagl_egl_driver *driver, EGLNativeDisplayType egl_dpy) { YaglEglWglDpy *dpy = (YaglEglWglDpy *)egl_dpy; + YAGL_LOG_NO_TS; YAGL_EGL_WGL_ENTER(yagl_egl_wgl_display_close, "%p", dpy); @@ -607,6 +608,7 @@ static struct yagl_egl_native_config WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB, 0, }; + YAGL_LOG_NO_TS; YAGL_EGL_WGL_ENTER(yagl_egl_wgl_config_enum, "display %p", dpy); @@ -695,6 +697,8 @@ static void yagl_egl_wgl_config_cleanup(struct yagl_egl_driver *driver, EGLNativeDisplayType dpy, const struct yagl_egl_native_config *cfg) { + YAGL_LOG_NO_TS; + YAGL_EGL_WGL_ENTER(yagl_egl_wgl_config_cleanup, "dpy = %p, cfg = %d", dpy, cfg->config_id); @@ -777,6 +781,7 @@ static EGLContext yagl_egl_wgl_context_create(struct yagl_egl_driver *driver, }; HGLRC egl_wgl_ctx; HDC dc; + YAGL_LOG_NO_TS; YAGL_EGL_WGL_ENTER(yagl_egl_wgl_context_create, "dpy = %p, share_context = %p, cfgid=%d", @@ -833,6 +838,7 @@ static bool yagl_egl_wgl_make_current(struct yagl_egl_driver *driver, YaglEglWglSurface *egl_read_sfc = egl_read_surf; HGLRC glc = NULL; BOOL res; + YAGL_LOG_NO_TS; YAGL_EGL_WGL_ENTER(yagl_egl_wgl_make_current, "dpy = %p, draw = %p, read = %p, ctx = %p", @@ -874,6 +880,7 @@ static void yagl_egl_wgl_context_destroy(struct yagl_egl_driver *driver, EGLContext egl_glc) { YaglEglWglDriver *egl_wgl = (YaglEglWglDriver *)(driver); + YAGL_LOG_NO_TS; YAGL_EGL_WGL_ENTER(yagl_egl_wgl_context_destroy, "dpy = %p, ctx = %p", @@ -903,6 +910,7 @@ static EGLSurface yagl_egl_wgl_pbuffer_surface_create(struct yagl_egl_driver *dr WGL_TEXTURE_FORMAT_ARB, WGL_NO_TEXTURE_ARB, 0 }; + YAGL_LOG_NO_TS; YAGL_EGL_WGL_ENTER(yagl_egl_wgl_pbuffer_surface_create, "dpy = %p, width = %d, height = %d, cfgid=%d", @@ -972,6 +980,7 @@ static void yagl_egl_wgl_pbuffer_surface_destroy(struct yagl_egl_driver *driver, { YaglEglWglDriver *egl_wgl = (YaglEglWglDriver *)(driver); YaglEglWglSurface *egl_sfc = surf; + YAGL_LOG_NO_TS; YAGL_EGL_WGL_ENTER(yagl_egl_wgl_pbuffer_surface_destroy, "dpy = %p, sfc = %p", @@ -990,6 +999,7 @@ static void yagl_egl_wgl_pbuffer_surface_destroy(struct yagl_egl_driver *driver, static void yagl_egl_wgl_destroy(struct yagl_egl_driver *driver) { YaglEglWglDriver *egl_wgl = (YaglEglWglDriver *)driver; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_wgl_destroy, NULL); @@ -1053,6 +1063,7 @@ static bool yagl_egl_wgl_init_ext(YaglEglWglDriver *egl_wgl) HGLRC glc = NULL; const char *ext_str = NULL; bool ext_initialized = false; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_wgl_init_ext, NULL); @@ -1140,6 +1151,7 @@ struct yagl_egl_driver *yagl_egl_driver_create(void *display, YaglEglWglDriver *egl_wgl; struct yagl_egl_driver *egl_driver; WNDCLASSEXA yagl_win_class; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_wgl_create, NULL); @@ -1233,6 +1245,7 @@ static void *yagl_egl_wgl_extaddr_get(struct yagl_dyn_lib *dyn_lib, HWND win = NULL; HDC dc = NULL; HGLRC glc; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_wgl_extaddr_get, "%s", sym); @@ -1326,6 +1339,7 @@ void *yagl_dyn_lib_get_ogl_procaddr(struct yagl_dyn_lib *dyn_lib, const char *sym) { void *proc = NULL; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_egl_wgl_get_procaddr, "Retrieving %s address", sym); diff --git a/hw/yagl/yagl_drivers/gles_offscreen/Makefile.objs b/hw/yagl/yagl_drivers/gles_offscreen/Makefile.objs new file mode 100644 index 0000000000..3d3f290aa4 --- /dev/null +++ b/hw/yagl/yagl_drivers/gles_offscreen/Makefile.objs @@ -0,0 +1,3 @@ +# GLES offscreen driver +obj-y += yagl_gles_offscreen.o + diff --git a/hw/yagl/yagl_drivers/gles_offscreen/yagl_gles_offscreen.c b/hw/yagl/yagl_drivers/gles_offscreen/yagl_gles_offscreen.c new file mode 100644 index 0000000000..7f9f299461 --- /dev/null +++ b/hw/yagl/yagl_drivers/gles_offscreen/yagl_gles_offscreen.c @@ -0,0 +1,94 @@ +/* + * yagl + * + * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Stanislav Vorobiov + * Jinhyung Jo + * YeongKyoon Lee + * Lukasz Kostyra + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +#include +#include "yagl_gles_offscreen.h" +#include "yagl_gles_driver.h" +#include "yagl_log.h" +#include "yagl_process.h" +#include "yagl_thread.h" +#include "yagl_backends/egl_offscreen/yagl_egl_offscreen_ts.h" + +struct yagl_gles_offscreen +{ + struct yagl_gles_driver base; + + struct yagl_gles_driver *orig_driver; +}; + +static void YAGL_GLES_APIENTRY yagl_gles_offscreen_BindFramebufferYAGL(struct yagl_thread_state *cur_ts, + GLenum target, + GLuint framebuffer) +{ + cur_ts->egl_offscreen_ts->gles_driver->BindFramebuffer(target, framebuffer); +} + +static void yagl_gles_offscreen_destroy(struct yagl_gles_driver *driver) +{ + struct yagl_gles_offscreen *gles_offscreen = (struct yagl_gles_offscreen*)driver; + YAGL_LOG_NO_TS; + + YAGL_LOG_FUNC_ENTER(yagl_gles_offscreen_destroy, NULL); + + gles_offscreen->orig_driver->destroy(gles_offscreen->orig_driver); + gles_offscreen->orig_driver = NULL; + + yagl_gles_driver_cleanup(driver); + g_free(gles_offscreen); + + YAGL_LOG_FUNC_EXIT(NULL); +} + +struct yagl_gles_driver + *yagl_gles_offscreen_create(struct yagl_gles_driver *orig_driver) +{ + struct yagl_gles_offscreen *driver = NULL; + YAGL_LOG_NO_TS; + + YAGL_LOG_FUNC_ENTER(yagl_gles_offscreen_create, NULL); + + driver = g_malloc0(sizeof(*driver)); + + /* + * Just copy over everything, then init our fields. + */ + memcpy(&driver->base, orig_driver, sizeof(*orig_driver)); + driver->orig_driver = orig_driver; + + yagl_gles_driver_init(&driver->base, orig_driver->gl_version); + + driver->base.BindFramebufferYAGL = &yagl_gles_offscreen_BindFramebufferYAGL; + + driver->base.destroy = &yagl_gles_offscreen_destroy; + + YAGL_LOG_FUNC_EXIT(NULL); + + return &driver->base; +} diff --git a/hw/yagl/yagl_drivers/gles_offscreen/yagl_gles_offscreen.h b/hw/yagl/yagl_drivers/gles_offscreen/yagl_gles_offscreen.h new file mode 100644 index 0000000000..cea05baf70 --- /dev/null +++ b/hw/yagl/yagl_drivers/gles_offscreen/yagl_gles_offscreen.h @@ -0,0 +1,44 @@ +/* + * yagl + * + * Copyright (c) 2000 - 2020 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Stanislav Vorobiov + * Jinhyung Jo + * YeongKyoon Lee + * Lukasz Kostyra + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +#ifndef _QEMU_YAGL_GLES_OFFSCREEN_H +#define _QEMU_YAGL_GLES_OFFSCREEN_H + +#include "yagl_types.h" + +struct yagl_gles_driver; + +/* + * Takes ownership of 'orig_driver'. + */ +struct yagl_gles_driver + *yagl_gles_offscreen_create(struct yagl_gles_driver *orig_driver); + +#endif diff --git a/hw/yagl/yagl_drivers/gles_ogl/yagl_gles_ogl.c b/hw/yagl/yagl_drivers/gles_ogl/yagl_gles_ogl.c index 70e255834a..3b089b70e2 100644 --- a/hw/yagl/yagl_drivers/gles_ogl/yagl_gles_ogl.c +++ b/hw/yagl/yagl_drivers/gles_ogl/yagl_gles_ogl.c @@ -35,9 +35,12 @@ #include "yagl_dyn_lib.h" #include "yagl_process.h" #include "yagl_thread.h" +#include "yagl_server.h" static void yagl_gles_ogl_destroy(struct yagl_gles_driver *driver) { + YAGL_LOG_NO_TS; + YAGL_LOG_FUNC_ENTER(yagl_gles_ogl_destroy, NULL); yagl_gles_driver_cleanup(driver); @@ -50,6 +53,7 @@ struct yagl_gles_driver *yagl_gles_ogl_create(struct yagl_dyn_lib *dyn_lib, yagl_gl_version gl_version) { struct yagl_gles_driver *driver = NULL; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_gles_ogl_create, NULL); diff --git a/hw/yagl/yagl_drivers/gles_onscreen/yagl_gles_onscreen.c b/hw/yagl/yagl_drivers/gles_onscreen/yagl_gles_onscreen.c index a406baee1a..790f3e6ca1 100644 --- a/hw/yagl/yagl_drivers/gles_onscreen/yagl_gles_onscreen.c +++ b/hw/yagl/yagl_drivers/gles_onscreen/yagl_gles_onscreen.c @@ -31,7 +31,6 @@ #include "yagl_gles_onscreen.h" #include "yagl_gles_driver.h" #include "yagl_log.h" -#include "yagl_tls.h" #include "yagl_process.h" #include "yagl_thread.h" #include "yagl_backends/egl_onscreen/yagl_egl_onscreen_ts.h" @@ -44,27 +43,27 @@ struct yagl_gles_onscreen struct yagl_gles_driver *orig_driver; }; -YAGL_DECLARE_TLS(struct yagl_egl_onscreen_ts*, egl_onscreen_ts); - -static void YAGL_GLES_APIENTRY yagl_gles_onscreen_BindFramebuffer(GLenum target, +static void YAGL_GLES_APIENTRY yagl_gles_onscreen_BindFramebufferYAGL(struct yagl_thread_state *cur_ts, + GLenum target, GLuint framebuffer) { - if (!egl_onscreen_ts || !egl_onscreen_ts->dpy) { + if (!cur_ts || !cur_ts->egl_onscreen_ts || !cur_ts->egl_onscreen_ts->dpy) { return; } - assert(framebuffer != egl_onscreen_ts->ctx->fb); + assert(framebuffer != cur_ts->egl_onscreen_ts->ctx->fb); if (framebuffer == 0) { - framebuffer = egl_onscreen_ts->ctx->fb; + framebuffer = cur_ts->egl_onscreen_ts->ctx->fb; } - egl_onscreen_ts->gles_driver->BindFramebuffer(target, framebuffer); + cur_ts->egl_onscreen_ts->gles_driver->BindFramebuffer(target, framebuffer); } static void yagl_gles_onscreen_destroy(struct yagl_gles_driver *driver) { struct yagl_gles_onscreen *gles_onscreen = (struct yagl_gles_onscreen*)driver; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_gles_onscreen_destroy, NULL); @@ -81,6 +80,7 @@ struct yagl_gles_driver *yagl_gles_onscreen_create(struct yagl_gles_driver *orig_driver) { struct yagl_gles_onscreen *driver = NULL; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_gles_onscreen_create, NULL); @@ -94,7 +94,7 @@ struct yagl_gles_driver yagl_gles_driver_init(&driver->base, orig_driver->gl_version); - driver->base.BindFramebuffer = &yagl_gles_onscreen_BindFramebuffer; + driver->base.BindFramebufferYAGL = &yagl_gles_onscreen_BindFramebufferYAGL; driver->base.destroy = &yagl_gles_onscreen_destroy; diff --git a/hw/yagl/yagl_egl_backend.h b/hw/yagl/yagl_egl_backend.h index ce66e57c7e..1010f079d9 100644 --- a/hw/yagl/yagl_egl_backend.h +++ b/hw/yagl/yagl_egl_backend.h @@ -47,24 +47,26 @@ struct yagl_egl_backend yagl_gl_version gl_version; - void (*thread_init)(struct yagl_egl_backend */*backend*/); + void (*thread_init)(struct yagl_thread_state */*cur_ts*/, struct yagl_egl_backend */*backend*/); - void (*batch_start)(struct yagl_egl_backend */*backend*/); + void (*batch_start)(struct yagl_thread_state */*cur_ts*/, struct yagl_egl_backend */*backend*/); struct yagl_eglb_display *(*create_display)(struct yagl_egl_backend */*backend*/); - bool (*make_current)(struct yagl_egl_backend */*backend*/, + bool (*make_current)(struct yagl_thread_state */*cur_ts*/, + struct yagl_egl_backend */*backend*/, struct yagl_eglb_display */*dpy*/, struct yagl_eglb_context */*ctx*/, struct yagl_eglb_surface */*draw*/, struct yagl_eglb_surface */*read*/); - bool (*release_current)(struct yagl_egl_backend */*backend*/, + bool (*release_current)(struct yagl_thread_state */*cur_ts*/, + struct yagl_egl_backend */*backend*/, bool /*force*/); - void (*batch_end)(struct yagl_egl_backend */*backend*/); + void (*batch_end)(struct yagl_thread_state */*cur_ts*/, struct yagl_egl_backend */*backend*/); - void (*thread_fini)(struct yagl_egl_backend */*backend*/); + void (*thread_fini)(struct yagl_thread_state */*cur_ts*/, struct yagl_egl_backend */*backend*/); /* * Make sure that some GL context is currently active. Can @@ -72,9 +74,11 @@ struct yagl_egl_backend * @{ */ - void (*ensure_current)(struct yagl_egl_backend */*backend*/); + void (*ensure_current)(struct yagl_thread_state */*cur_ts*/, + struct yagl_egl_backend */*backend*/); - void (*unensure_current)(struct yagl_egl_backend */*backend*/); + void (*unensure_current)(struct yagl_thread_state */*cur_ts*/, + struct yagl_egl_backend */*backend*/); /* * @} diff --git a/hw/yagl/yagl_egl_interface.h b/hw/yagl/yagl_egl_interface.h index 85a811571f..1c9b72180e 100644 --- a/hw/yagl/yagl_egl_interface.h +++ b/hw/yagl/yagl_egl_interface.h @@ -34,11 +34,16 @@ struct yagl_egl_interface { - uint32_t (*get_ctx_id)(struct yagl_egl_interface */*iface*/); + uint32_t (*get_ctx_id)(struct yagl_thread_state */*cur_ts*/, + struct yagl_egl_interface */*iface*/); - void (*ensure_ctx)(struct yagl_egl_interface */*iface*/, uint32_t /*ctx_id*/); + void (*ensure_ctx)(struct yagl_thread_state */*cur_ts*/, + struct yagl_egl_interface */*iface*/, + uint32_t /*ctx_id*/); - void (*unensure_ctx)(struct yagl_egl_interface */*iface*/, uint32_t /*ctx_id*/); + void (*unensure_ctx)(struct yagl_thread_state */*cur_ts*/, + struct yagl_egl_interface */*iface*/, + uint32_t /*ctx_id*/); }; #endif diff --git a/hw/yagl/yagl_eglb_context.h b/hw/yagl/yagl_eglb_context.h index 75131c0a28..90c46f0430 100644 --- a/hw/yagl/yagl_eglb_context.h +++ b/hw/yagl/yagl_eglb_context.h @@ -37,8 +37,9 @@ struct yagl_eglb_display; struct yagl_eglb_context { struct yagl_eglb_display *dpy; + struct yagl_process_state *ps; - void (*destroy)(struct yagl_eglb_context */*ctx*/); + void (*destroy)(struct yagl_thread_state */*cur_ts*/, struct yagl_eglb_context */*ctx*/); }; void yagl_eglb_context_init(struct yagl_eglb_context *ctx, diff --git a/hw/yagl/yagl_eglb_display.h b/hw/yagl/yagl_eglb_display.h index 85866e1fa9..85270219a8 100644 --- a/hw/yagl/yagl_eglb_display.h +++ b/hw/yagl/yagl_eglb_display.h @@ -52,7 +52,8 @@ struct yagl_eglb_display void (*config_cleanup)(struct yagl_eglb_display */*dpy*/, const struct yagl_egl_native_config */*cfg*/); - struct yagl_eglb_context *(*create_context)(struct yagl_eglb_display */*dpy*/, + struct yagl_eglb_context *(*create_context)(struct yagl_thread_state */*cur_ts*/, + struct yagl_eglb_display */*dpy*/, const struct yagl_egl_native_config */*cfg*/, struct yagl_eglb_context */*share_context*/, int /*version*/); @@ -60,7 +61,8 @@ struct yagl_eglb_display /* * 'pixels' are locked in target's memory, no page fault possible. */ - struct yagl_eglb_surface *(*create_offscreen_surface)(struct yagl_eglb_display */*dpy*/, + struct yagl_eglb_surface *(*create_offscreen_surface)(struct yagl_thread_state */*cur_ts*/, + struct yagl_eglb_display */*dpy*/, const struct yagl_egl_native_config */*cfg*/, EGLenum /*type*/, const void */*attribs*/, @@ -69,22 +71,26 @@ struct yagl_eglb_display uint32_t /*bpp*/, target_ulong /*pixels*/); - struct yagl_eglb_surface *(*create_onscreen_window_surface)(struct yagl_eglb_display */*dpy*/, + struct yagl_eglb_surface *(*create_onscreen_window_surface)(struct yagl_thread_state */*cur_ts*/, + struct yagl_eglb_display */*dpy*/, const struct yagl_egl_native_config */*cfg*/, const struct yagl_egl_window_attribs */*attribs*/, yagl_winsys_id /*id*/); - struct yagl_eglb_surface *(*create_onscreen_pixmap_surface)(struct yagl_eglb_display */*dpy*/, + struct yagl_eglb_surface *(*create_onscreen_pixmap_surface)(struct yagl_thread_state */*cur_ts*/, + struct yagl_eglb_display */*dpy*/, const struct yagl_egl_native_config */*cfg*/, const struct yagl_egl_pixmap_attribs */*attribs*/, yagl_winsys_id /*id*/); - struct yagl_eglb_surface *(*create_onscreen_pbuffer_surface)(struct yagl_eglb_display */*dpy*/, + struct yagl_eglb_surface *(*create_onscreen_pbuffer_surface)(struct yagl_thread_state */*cur_ts*/, + struct yagl_eglb_display */*dpy*/, const struct yagl_egl_native_config */*cfg*/, const struct yagl_egl_pbuffer_attribs */*attribs*/, yagl_winsys_id /*id*/); - struct yagl_object *(*create_image)(struct yagl_eglb_display */*dpy*/, + struct yagl_object *(*create_image)(struct yagl_thread_state */*cur_ts*/, + struct yagl_eglb_display */*dpy*/, yagl_winsys_id /*buffer*/); void (*destroy)(struct yagl_eglb_display */*dpy*/); diff --git a/hw/yagl/yagl_eglb_surface.h b/hw/yagl/yagl_eglb_surface.h index 67ecdd8591..0f393edd08 100644 --- a/hw/yagl/yagl_eglb_surface.h +++ b/hw/yagl/yagl_eglb_surface.h @@ -53,7 +53,8 @@ struct yagl_eglb_surface * Surface has been invalidated on target, update it * from 'id'. */ - void (*invalidate)(struct yagl_eglb_surface */*sfc*/, + void (*invalidate)(struct yagl_thread_state */*cur_ts*/, + struct yagl_eglb_surface */*sfc*/, yagl_winsys_id /*id*/); /* @@ -61,23 +62,29 @@ struct yagl_eglb_surface * 'sfc' and 'with' must be of same type, but can have * different formats. */ - void (*replace)(struct yagl_eglb_surface */*sfc*/, + void (*replace)(struct yagl_thread_state */*cur_ts*/, + struct yagl_eglb_surface */*sfc*/, struct yagl_eglb_surface */*with*/); /* * Can be called for surfaces that were reset. */ - bool (*query)(struct yagl_eglb_surface */*sfc*/, + bool (*query)(struct yagl_thread_state */*cur_ts*/, + struct yagl_eglb_surface */*sfc*/, EGLint /*attribute*/, EGLint */*value*/); - void (*swap_buffers)(struct yagl_eglb_surface */*sfc*/); + void (*swap_buffers)(struct yagl_thread_state */*cur_ts*/, + struct yagl_eglb_surface */*sfc*/); - void (*copy_buffers)(struct yagl_eglb_surface */*sfc*/); + void (*copy_buffers)(struct yagl_thread_state */*cur_ts*/, + struct yagl_eglb_surface */*sfc*/); - void (*wait_gl)(struct yagl_eglb_surface */*sfc*/); + void (*wait_gl)(struct yagl_thread_state */*cur_ts*/, + struct yagl_eglb_surface */*sfc*/); - void (*destroy)(struct yagl_eglb_surface */*sfc*/); + void (*destroy)(struct yagl_thread_state */*cur_ts*/, + struct yagl_eglb_surface */*sfc*/); }; void yagl_eglb_surface_init(struct yagl_eglb_surface *sfc, diff --git a/hw/yagl/yagl_gles_driver.c b/hw/yagl/yagl_gles_driver.c index a8cf89b6ff..59ceef7e65 100644 --- a/hw/yagl/yagl_gles_driver.c +++ b/hw/yagl/yagl_gles_driver.c @@ -43,20 +43,18 @@ void yagl_gles_driver_cleanup(struct yagl_gles_driver *driver) { } -uint32_t yagl_get_ctx_id(void) +uint32_t yagl_get_ctx_id(struct yagl_thread_state *cur_ts) { assert(cur_ts); - return cur_ts->ps->egl_iface->get_ctx_id(cur_ts->ps->egl_iface); + return cur_ts->ps->egl_iface->get_ctx_id(cur_ts, cur_ts->ps->egl_iface); } -void yagl_ensure_ctx(uint32_t ctx_id) +void yagl_ensure_ctx(struct yagl_thread_state *cur_ts, uint32_t ctx_id) { - assert(cur_ts); - cur_ts->ps->egl_iface->ensure_ctx(cur_ts->ps->egl_iface, ctx_id); + cur_ts->ps->egl_iface->ensure_ctx(cur_ts, cur_ts->ps->egl_iface, ctx_id); } -void yagl_unensure_ctx(uint32_t ctx_id) +void yagl_unensure_ctx(struct yagl_thread_state *cur_ts, uint32_t ctx_id) { - assert(cur_ts); - cur_ts->ps->egl_iface->unensure_ctx(cur_ts->ps->egl_iface, ctx_id); + cur_ts->ps->egl_iface->unensure_ctx(cur_ts, cur_ts->ps->egl_iface, ctx_id); } diff --git a/hw/yagl/yagl_gles_driver.h b/hw/yagl/yagl_gles_driver.h index 6e64f7a441..57b7e8b6ec 100644 --- a/hw/yagl/yagl_gles_driver.h +++ b/hw/yagl/yagl_gles_driver.h @@ -155,6 +155,7 @@ struct yagl_gles_driver YAGL_GLES_DRIVER_FUNC9(CopyTexSubImage3D, GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, target, level, xoffset, yoffset, zoffset, x, y, width, height); YAGL_GLES_DRIVER_FUNC2(GenFramebuffers, GLsizei, GLuint*, n, framebuffers) YAGL_GLES_DRIVER_FUNC2(BindFramebuffer, GLenum, GLuint, target, framebuffer) + YAGL_GLES_DRIVER_FUNC3(BindFramebufferYAGL, struct yagl_thread_state *, GLenum, GLuint, cur_ts, 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) @@ -409,9 +410,9 @@ void yagl_gles_driver_cleanup(struct yagl_gles_driver *driver); * @{ */ -uint32_t yagl_get_ctx_id(void); -void yagl_ensure_ctx(uint32_t ctx_id); -void yagl_unensure_ctx(uint32_t ctx_id); +uint32_t yagl_get_ctx_id(struct yagl_thread_state *cur_ts); +void yagl_ensure_ctx(struct yagl_thread_state *cur_ts, uint32_t ctx_id); +void yagl_unensure_ctx(struct yagl_thread_state *cur_ts, uint32_t ctx_id); /* * @} diff --git a/hw/yagl/yagl_log.h b/hw/yagl/yagl_log.h index b05e92f562..f7698347f7 100644 --- a/hw/yagl/yagl_log.h +++ b/hw/yagl/yagl_log.h @@ -31,6 +31,7 @@ #define _QEMU_YAGL_LOG_H #include "yagl_types.h" +#include "yagl_util.h" //#define YAGL_LOG_DISABLE @@ -108,6 +109,11 @@ bool yagl_log_is_enabled_for_facility(const char* facility); bool yagl_log_is_enabled_for_func_tracing(void); +// a helper to allow logging where acquiring PID/TID is not possible +// ie. on a main server thread. This could be replaced with getting +// PID/TID via getpid()/gettid()/Windows equivalents. +#define YAGL_LOG_NO_TS struct yagl_thread_state *cur_ts = NULL + #ifndef YAGL_LOG_DISABLE #define YAGL_LOG_EVENT(log_level, pid, tid, facility, format, ...) \ do \ @@ -119,12 +125,23 @@ bool yagl_log_is_enabled_for_func_tracing(void); } \ } while(0) -// TODO _yagl_log_current_pid/tid must be restored to proper form -// PID/TID must be read in a different way than via global cur_ts -#define YAGL_LOG_FUNC_SET(func) \ - const char* _yagl_log_current_func = #func; \ - yagl_pid _yagl_log_current_pid = 0; \ - yagl_tid _yagl_log_current_tid = 0 +#define YAGL_LOG_FUNC_SET_TS(__func, __ts) \ + const char* _yagl_log_current_func = #__func; \ + yagl_pid _yagl_log_current_pid = (__ts ? __ts->ps->id : yagl_get_pid()); \ + yagl_tid _yagl_log_current_tid = (__ts ? __ts->id : yagl_get_tid()) + +#define YAGL_LOG_FUNC_SET(__func) YAGL_LOG_FUNC_SET_TS(__func, cur_ts) + +#define YAGL_LOG_FUNC_ENTER_TS(func, __ts, format, ...) \ + YAGL_LOG_FUNC_SET_TS(func, __ts); \ + do \ + { \ + if ( yagl_log_is_enabled_for_func_tracing() && \ + yagl_log_is_enabled_for_facility(_yagl_log_current_func) ) \ + { \ + yagl_log_func_enter(_yagl_log_current_pid, _yagl_log_current_tid, _yagl_log_current_func, __LINE__, format,##__VA_ARGS__); \ + } \ + } while(0) #define YAGL_LOG_FUNC_ENTER(func, format, ...) \ YAGL_LOG_FUNC_SET(func); \ diff --git a/hw/yagl/yagl_mem.c b/hw/yagl/yagl_mem.c index 6ca7966305..6650cee676 100644 --- a/hw/yagl/yagl_mem.c +++ b/hw/yagl/yagl_mem.c @@ -33,7 +33,7 @@ #include "yagl_log.h" #include "exec/cpu-all.h" -bool yagl_mem_put(target_ulong va, const void* data, uint32_t len) +bool yagl_mem_put(struct yagl_thread_state* cur_ts, target_ulong va, const void* data, uint32_t len) { int ret; @@ -50,7 +50,7 @@ bool yagl_mem_put(target_ulong va, const void* data, uint32_t len) return ret != -1; } -bool yagl_mem_get(target_ulong va, uint32_t len, void* data) +bool yagl_mem_get(struct yagl_thread_state* cur_ts, target_ulong va, uint32_t len, void* data) { int ret; diff --git a/hw/yagl/yagl_mem.h b/hw/yagl/yagl_mem.h index 80dae0c150..2b3fff9a3e 100644 --- a/hw/yagl/yagl_mem.h +++ b/hw/yagl/yagl_mem.h @@ -32,8 +32,8 @@ #include "yagl_types.h" -bool yagl_mem_put(target_ulong va, const void *data, uint32_t len); +bool yagl_mem_put(struct yagl_thread_state* cur_ts, target_ulong va, const void *data, uint32_t len); -bool yagl_mem_get(target_ulong va, uint32_t len, void *data); +bool yagl_mem_get(struct yagl_thread_state* cur_ts, target_ulong va, uint32_t len, void *data); #endif diff --git a/hw/yagl/yagl_object_map.c b/hw/yagl/yagl_object_map.c index d8262dca0a..40f5791306 100644 --- a/hw/yagl/yagl_object_map.c +++ b/hw/yagl/yagl_object_map.c @@ -29,29 +29,34 @@ #include "yagl_object_map.h" -static void yagl_object_map_entry_destroy_func(gpointer data) +static gboolean yagl_object_map_entry_remove_all_func(gpointer key, + gpointer value, + gpointer user_data) { - struct yagl_object *item = data; + struct yagl_object *item = value; + struct yagl_thread_state *cur_ts = user_data; - item->destroy(item); + item->destroy(cur_ts, item); + return TRUE; } 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 = g_hash_table_new_full(g_direct_hash, - g_direct_equal, - NULL, - &yagl_object_map_entry_destroy_func); + object_map->entries = g_hash_table_new(g_direct_hash, + g_direct_equal); assert(object_map->entries); return object_map; } -void yagl_object_map_destroy(struct yagl_object_map *object_map) +void yagl_object_map_destroy(struct yagl_thread_state *cur_ts, + struct yagl_object_map *object_map) { + yagl_object_map_remove_all(cur_ts, object_map); + g_hash_table_destroy(object_map->entries); object_map->entries = NULL; @@ -72,19 +77,31 @@ void yagl_object_map_add(struct yagl_object_map *object_map, assert(g_hash_table_size(object_map->entries) > size); } -void yagl_object_map_remove(struct yagl_object_map *object_map, +void yagl_object_map_remove(struct yagl_thread_state *cur_ts, + struct yagl_object_map *object_map, yagl_object_name local_name) { guint size = g_hash_table_size(object_map->entries); + // TODO g_hash_table_steal_extended is introduced in fairly new glib 2.58 + // and would be better suitable here. For now - lookup the value, + // call the destructor and remove it from the hash table. + struct yagl_object *item = g_hash_table_lookup(object_map->entries, + GUINT_TO_POINTER(local_name)); + + item->destroy(cur_ts, item); + g_hash_table_remove(object_map->entries, GUINT_TO_POINTER(local_name)); assert(g_hash_table_size(object_map->entries) < size); } -void yagl_object_map_remove_all(struct yagl_object_map *object_map) +void yagl_object_map_remove_all(struct yagl_thread_state *cur_ts, + struct yagl_object_map *object_map) { - g_hash_table_remove_all(object_map->entries); + g_hash_table_foreach_remove(object_map->entries, + &yagl_object_map_entry_remove_all_func, + (gpointer)cur_ts); } yagl_object_name yagl_object_map_get(struct yagl_object_map *object_map, diff --git a/hw/yagl/yagl_object_map.h b/hw/yagl/yagl_object_map.h index c4d8c3c79d..e97dc17534 100644 --- a/hw/yagl/yagl_object_map.h +++ b/hw/yagl/yagl_object_map.h @@ -33,30 +33,38 @@ #include "yagl_types.h" #include +struct yagl_object; + +typedef void (*yagl_object_destroy_func)(struct yagl_thread_state */*cur_ts*/, struct yagl_object */*obj*/); + struct yagl_object { yagl_object_name global_name; - void (*destroy)(struct yagl_object */*obj*/); + yagl_object_destroy_func destroy; }; struct yagl_object_map { GHashTable *entries; + // TODO object map is per process, might be touched by multiple threads - add mutex }; struct yagl_object_map *yagl_object_map_create(void); -void yagl_object_map_destroy(struct yagl_object_map *object_map); +void yagl_object_map_destroy(struct yagl_thread_state *cur_ts, + 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, +void yagl_object_map_remove(struct yagl_thread_state *cur_ts, + struct yagl_object_map *object_map, yagl_object_name local_name); -void yagl_object_map_remove_all(struct yagl_object_map *object_map); +void yagl_object_map_remove_all(struct yagl_thread_state *cur_ts, + struct yagl_object_map *object_map); yagl_object_name yagl_object_map_get(struct yagl_object_map *object_map, yagl_object_name local_name); diff --git a/hw/yagl/yagl_process.c b/hw/yagl/yagl_process.c index 477448509e..d5f145d21a 100644 --- a/hw/yagl/yagl_process.c +++ b/hw/yagl/yagl_process.c @@ -33,7 +33,9 @@ #include "yagl_log.h" #include "yagl_stats.h" #include "yagl_object_map.h" -#include "sysemu/hw_accel.h" +#include "sysemu/kvm.h" +#include "sysemu/hax.h" +#include "sysemu/whpx.h" struct yagl_process_state *yagl_process_state_create(struct yagl_server_state *ss, @@ -47,23 +49,34 @@ struct yagl_process_state ps->object_map = yagl_object_map_create(); QLIST_INIT(&ps->threads); - cpu_synchronize_state(current_cpu); - CPUX86State *env = current_cpu->env_ptr; - memcpy(&ps->cr[0], - &((CPUX86State *)current_cpu->env_ptr)->cr[0], - sizeof(ps->cr)); - ps->hflags = env->hflags; - +#if defined (CONFIG_KVM) || defined (CONFIG_HAX) || defined (CONFIG_WHPX) + if (kvm_enabled() || hax_enabled() || whpx_enabled()) { + if (kvm_enabled()) { + kvm_cpu_synchronize_state(current_cpu); + } else if (hax_enabled()) { +#ifdef CONFIG_HAX + hax_cpu_synchronize_state(current_cpu); +#endif + } else { +#ifdef CONFIG_WHPX + whpx_cpu_synchronize_state(current_cpu); +#endif + } + CPUX86State *env = current_cpu->env_ptr; + memcpy(&ps->cr[0], + &((CPUX86State *)current_cpu->env_ptr)->cr[0], + sizeof(ps->cr)); + ps->hflags = env->hflags; + } +#endif + return ps; } void yagl_process_state_destroy(struct yagl_process_state *ps) { - struct yagl_thread_state *ts, *next; - - if (ps == NULL) { - return; - } + struct yagl_thread_state *ts = NULL, *next = NULL; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_process_state_destroy, NULL); @@ -76,8 +89,7 @@ void yagl_process_state_destroy(struct yagl_process_state *ps) assert(QLIST_EMPTY(&ps->threads)); - yagl_object_map_destroy(ps->object_map); - ps->object_map = NULL; + yagl_object_map_destroy(NULL, ps->object_map); g_free(ps); @@ -89,6 +101,8 @@ void yagl_process_state_destroy(struct yagl_process_state *ps) void yagl_process_register_egl_interface(struct yagl_process_state *ps, struct yagl_egl_interface *egl_iface) { + YAGL_LOG_NO_TS; + YAGL_LOG_FUNC_ENTER(yagl_process_register_egl_interface, NULL); assert(egl_iface); @@ -109,6 +123,8 @@ void yagl_process_register_egl_interface(struct yagl_process_state *ps, void yagl_process_unregister_egl_interface(struct yagl_process_state *ps) { + YAGL_LOG_NO_TS; + YAGL_LOG_FUNC_ENTER(yagl_process_unregister_egl_interface, NULL); assert(ps->egl_iface); diff --git a/hw/yagl/yagl_ref.c b/hw/yagl/yagl_ref.c index e01ea4fce8..bd7ada534f 100644 --- a/hw/yagl/yagl_ref.c +++ b/hw/yagl/yagl_ref.c @@ -59,7 +59,7 @@ void yagl_ref_acquire(struct yagl_ref *ref) ++ref->count; } -void yagl_ref_release(struct yagl_ref *ref) +void yagl_ref_release(struct yagl_thread_state *cur_ts, struct yagl_ref *ref) { assert(ref); assert(ref->count > 0); @@ -67,6 +67,6 @@ void yagl_ref_release(struct yagl_ref *ref) if (--ref->count == 0) { assert(ref->destroy); - ref->destroy(ref); + ref->destroy(cur_ts, ref); } } diff --git a/hw/yagl/yagl_ref.h b/hw/yagl/yagl_ref.h index 902296ec66..9d2d20570a 100644 --- a/hw/yagl/yagl_ref.h +++ b/hw/yagl/yagl_ref.h @@ -34,7 +34,7 @@ struct yagl_ref; -typedef void (*yagl_ref_destroy_func)(struct yagl_ref */*ref*/); +typedef void (*yagl_ref_destroy_func)(struct yagl_thread_state */*cur_ts*/, struct yagl_ref */*ref*/); struct yagl_ref { @@ -58,6 +58,6 @@ void yagl_ref_acquire(struct yagl_ref *ref); /* * Decrements ref count and releases when 0. */ -void yagl_ref_release(struct yagl_ref *ref); +void yagl_ref_release(struct yagl_thread_state *cur_ts, struct yagl_ref *ref); #endif diff --git a/hw/yagl/yagl_resource.c b/hw/yagl/yagl_resource.c index d70dca9926..d0fc960f51 100644 --- a/hw/yagl/yagl_resource.c +++ b/hw/yagl/yagl_resource.c @@ -50,9 +50,9 @@ void yagl_resource_acquire(struct yagl_resource *res) } } -void yagl_resource_release(struct yagl_resource *res) +void yagl_resource_release(struct yagl_thread_state *cur_ts, struct yagl_resource *res) { if (res) { - yagl_ref_release(&res->ref); + yagl_ref_release(cur_ts, &res->ref); } } diff --git a/hw/yagl/yagl_resource.h b/hw/yagl/yagl_resource.h index 68e91e6013..f05c2ef28d 100644 --- a/hw/yagl/yagl_resource.h +++ b/hw/yagl/yagl_resource.h @@ -62,8 +62,8 @@ void yagl_resource_cleanup(struct yagl_resource *res); void yagl_resource_acquire(struct yagl_resource *res); /* - * Passing NULL won't hurt, this is for convenience. + * Passing NULL res won't hurt, this is for convenience. */ -void yagl_resource_release(struct yagl_resource *res); +void yagl_resource_release(struct yagl_thread_state *cur_ts, struct yagl_resource *res); #endif diff --git a/hw/yagl/yagl_resource_list.c b/hw/yagl/yagl_resource_list.c index ad7cee6d44..54ca4f90f9 100644 --- a/hw/yagl/yagl_resource_list.c +++ b/hw/yagl/yagl_resource_list.c @@ -36,13 +36,13 @@ void yagl_resource_list_init(struct yagl_resource_list *list) list->count = 0; } -void yagl_resource_list_cleanup(struct yagl_resource_list *list) +void yagl_resource_list_cleanup(struct yagl_thread_state *cur_ts, struct yagl_resource_list *list) { struct yagl_resource *res, *next; QTAILQ_FOREACH_SAFE(res, &list->resources, entry, next) { QTAILQ_REMOVE(&list->resources, res, entry); - yagl_resource_release(res); + yagl_resource_release(cur_ts, res); } assert(QTAILQ_EMPTY(&list->resources)); @@ -93,7 +93,8 @@ struct yagl_resource return NULL; } -bool yagl_resource_list_remove(struct yagl_resource_list *list, +bool yagl_resource_list_remove(struct yagl_thread_state *cur_ts, + struct yagl_resource_list *list, yagl_host_handle handle) { struct yagl_resource *res; @@ -101,7 +102,7 @@ bool yagl_resource_list_remove(struct yagl_resource_list *list, QTAILQ_FOREACH(res, &list->resources, entry) { if (res->handle == handle) { QTAILQ_REMOVE(&list->resources, res, entry); - yagl_resource_release(res); + yagl_resource_release(cur_ts, res); return true; } } diff --git a/hw/yagl/yagl_resource_list.h b/hw/yagl/yagl_resource_list.h index 5ef3ae8324..e3df25724d 100644 --- a/hw/yagl/yagl_resource_list.h +++ b/hw/yagl/yagl_resource_list.h @@ -55,7 +55,7 @@ void yagl_resource_list_init(struct yagl_resource_list *list); * Release all resources in the list and empty the list. The * list should be initialized again in order to be used after this. */ -void yagl_resource_list_cleanup(struct yagl_resource_list *list); +void yagl_resource_list_cleanup(struct yagl_thread_state *cur_ts, struct yagl_resource_list *list); int yagl_resource_list_get_count(struct yagl_resource_list *list); @@ -88,7 +88,8 @@ struct yagl_resource * Removes a resource from the end of the list, this also releases * the resource. */ -bool yagl_resource_list_remove(struct yagl_resource_list *list, +bool yagl_resource_list_remove(struct yagl_thread_state *cur_ts, + struct yagl_resource_list *list, yagl_host_handle handle); #endif diff --git a/hw/yagl/yagl_server.c b/hw/yagl/yagl_server.c index b74846809d..b2f09a1a3a 100644 --- a/hw/yagl/yagl_server.c +++ b/hw/yagl/yagl_server.c @@ -139,10 +139,6 @@ void yagl_server_reset(struct yagl_server_state *ss) { struct yagl_process_state *ps, *next; - if (ss == NULL) { - return; - } - work_queue_wait(ss->render_queue); QLIST_FOREACH_SAFE(ps, &ss->processes, entry, next) { @@ -172,6 +168,7 @@ bool yagl_server_dispatch_init(struct yagl_server_state *ss, struct yagl_process_state *ps = NULL; struct yagl_thread_state *ts = NULL; uint8_t **pages; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_server_dispatch_init, NULL); @@ -300,9 +297,10 @@ void yagl_server_dispatch_update(struct yagl_server_state *ss, yagl_tid target_tid, uint8_t *buff) { - struct yagl_thread_state *ts; + struct yagl_thread_state *ts = NULL; uint32_t i, count = 0; uint8_t **pages = NULL; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_server_dispatch_update, NULL); @@ -367,6 +365,7 @@ void yagl_server_dispatch_batch(struct yagl_server_state *ss, bool sync) { struct yagl_thread_state *ts; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_server_dispatch_batch, NULL); @@ -389,6 +388,7 @@ void yagl_server_dispatch_exit(struct yagl_server_state *ss, struct yagl_thread_state *ts = yagl_server_find_thread(ss, target_pid, target_tid); struct yagl_process_state *ps = NULL; + YAGL_LOG_NO_TS; YAGL_LOG_FUNC_ENTER(yagl_server_dispatch_exit, NULL); diff --git a/hw/yagl/yagl_thread.c b/hw/yagl/yagl_thread.c index b965e32371..332628216e 100644 --- a/hw/yagl/yagl_thread.c +++ b/hw/yagl/yagl_thread.c @@ -39,8 +39,6 @@ #include "sysemu/kvm.h" #include "sysemu/hax.h" -YAGL_DEFINE_TLS(struct yagl_thread_state*, cur_ts); - struct yagl_thread_work_item { struct work_queue_item base; @@ -73,20 +71,19 @@ static __inline void yagl_cpu_synchronize_state(struct yagl_process_state *ps) static void yagl_thread_work(struct work_queue_item *wq_item) { struct yagl_thread_work_item *item = (struct yagl_thread_work_item*)wq_item; + struct yagl_thread_state *ts = item->ts; int i; uint32_t num_calls = 0; - struct yagl_transport *t = item->ts->t; - struct winsys_interface *wsi = item->ts->ps->ss->wsi; - - cur_ts = item->ts; + struct yagl_transport *t = ts->t; + struct winsys_interface *wsi = ts->ps->ss->wsi; - YAGL_LOG_FUNC_SET(yagl_thread_work); + YAGL_LOG_FUNC_SET_TS(yagl_thread_work, ts); YAGL_LOG_TRACE("batch started"); for (i = 0; i < YAGL_NUM_APIS; ++i) { - if (cur_ts->ps->api_states[i]) { - cur_ts->ps->api_states[i]->batch_start(cur_ts->ps->api_states[i]); + if (ts->ps->api_states[i]) { + ts->ps->api_states[i]->batch_start(ts, ts->ps->api_states[i]); } } @@ -111,7 +108,7 @@ static void yagl_thread_work(struct work_queue_item *wq_item) break; } - api_ps = cur_ts->ps->api_states[api_id - 1]; + api_ps = ts->ps->api_states[api_id - 1]; if (!api_ps) { YAGL_LOG_CRITICAL("uninitialized api - %u. host logic error", api_id); @@ -136,14 +133,12 @@ static void yagl_thread_work(struct work_queue_item *wq_item) YAGL_LOG_TRACE("batch ended: %u calls", num_calls); for (i = 0; i < YAGL_NUM_APIS; ++i) { - if (cur_ts->ps->api_states[i]) { - cur_ts->ps->api_states[i]->batch_end(cur_ts->ps->api_states[i]); + if (ts->ps->api_states[i]) { + ts->ps->api_states[i]->batch_end(ts, ts->ps->api_states[i]); } } - cur_ts = NULL; - - --item->ts->num_in_progress; + --ts->num_in_progress; if (wsi && item->fence_seq) { wsi->fence_ack(wsi, item->fence_seq); @@ -165,8 +160,7 @@ struct yagl_thread_state ts->ps = ps; ts->id = id; ts->t = yagl_transport_create(); - - cur_ts = ts; + ts->t->ts = ts; if (is_first) { /* @@ -174,9 +168,9 @@ struct yagl_thread_state */ for (i = 0; i < YAGL_NUM_APIS; ++i) { - if (ts->ps->ss->apis[i]) { - ts->ps->api_states[i] = ts->ps->ss->apis[i]->process_init(ts->ps->ss->apis[i]); - assert(ts->ps->api_states[i]); + if (ps->ss->apis[i]) { + ps->api_states[i] = ps->ss->apis[i]->process_init(ps, ps->ss->apis[i]); + assert(ps->api_states[i]); } } } @@ -186,8 +180,8 @@ struct yagl_thread_state */ for (i = 0; i < YAGL_NUM_APIS; ++i) { - if (ts->ps->api_states[i]) { - ts->ps->api_states[i]->thread_init(ts->ps->api_states[i]); + if (ps->api_states[i]) { + ps->api_states[i]->thread_init(ts, ps->api_states[i]); } } @@ -199,15 +193,13 @@ void yagl_thread_state_destroy(struct yagl_thread_state *ts, { int i; - cur_ts = ts; - /* * Fini APIs (thread). */ for (i = 0; i < YAGL_NUM_APIS; ++i) { if (ts->ps->api_states[i]) { - ts->ps->api_states[i]->thread_fini(ts->ps->api_states[i]); + ts->ps->api_states[i]->thread_fini(ts, ts->ps->api_states[i]); } } @@ -216,7 +208,7 @@ void yagl_thread_state_destroy(struct yagl_thread_state *ts, * First, remove all objects. */ - yagl_object_map_remove_all(ts->ps->object_map); + yagl_object_map_remove_all(ts, ts->ps->object_map); /* * Destroy APIs (process). @@ -224,14 +216,12 @@ void yagl_thread_state_destroy(struct yagl_thread_state *ts, for (i = 0; i < YAGL_NUM_APIS; ++i) { if (ts->ps->api_states[i]) { - ts->ps->api_states[i]->destroy(ts->ps->api_states[i]); + ts->ps->api_states[i]->destroy(ts, ts->ps->api_states[i]); ts->ps->api_states[i] = NULL; } } } - cur_ts = NULL; - yagl_thread_set_buffer(ts, NULL); yagl_transport_destroy(ts->t); diff --git a/hw/yagl/yagl_thread.h b/hw/yagl/yagl_thread.h index 0dfa297921..f1f5737bf8 100644 --- a/hw/yagl/yagl_thread.h +++ b/hw/yagl/yagl_thread.h @@ -32,7 +32,6 @@ #include "yagl_types.h" #include "yagl_event.h" -#include "yagl_tls.h" #include "hw/vigs/work_queue.h" #include "qemu/queue.h" #include "qemu/thread.h" @@ -56,17 +55,15 @@ struct yagl_thread_state * Fake TLS. * @{ */ - void *egl_api_ts; - void *gles_api_ts; - void *egl_offscreen_ts; - void *egl_onscreen_ts; + struct yagl_egl_api_ts *egl_api_ts; + struct yagl_gles_api_ts *gles_api_ts; + struct yagl_egl_offscreen_ts *egl_offscreen_ts; + struct yagl_egl_onscreen_ts *egl_onscreen_ts; /* * @} */ }; -YAGL_DECLARE_TLS(struct yagl_thread_state*, cur_ts); - struct yagl_thread_state *yagl_thread_state_create(struct yagl_process_state *ps, yagl_tid id, diff --git a/hw/yagl/yagl_transport.c b/hw/yagl/yagl_transport.c index ce1a84109d..0ae51d2736 100644 --- a/hw/yagl/yagl_transport.c +++ b/hw/yagl/yagl_transport.c @@ -172,7 +172,7 @@ uint8_t *yagl_transport_begin(struct yagl_transport *t, uint32_t size = yagl_transport_uint32_t_at(t, YAGL_TRANSPORT_BATCH_HEADER_SIZE + *batch_size + ((2 * i + 1) * 8)); - if (!yagl_mem_get(va, size, tmp)) { + if (!yagl_mem_get(t->ts, va, size, tmp)) { yagl_transport_uint32_t_to(t, 0, yagl_call_result_retry); g_free(batch_data); return NULL; @@ -200,7 +200,8 @@ void yagl_transport_end(struct yagl_transport *t) struct yagl_transport_in_array *in_array = &t->in_arrays[i]; if ((*in_array->count > 0) && t->direct) { - if (!yagl_mem_put(in_array->va, + if (!yagl_mem_put(t->ts, + in_array->va, yagl_vector_data(&in_array->v), *in_array->count * in_array->el_size)) { yagl_transport_uint32_t_to(t, 0, yagl_call_result_retry); @@ -210,7 +211,7 @@ void yagl_transport_end(struct yagl_transport *t) } QLIST_FOREACH_SAFE(ct, &t->compiled_transfers, entry, tmp) { - yagl_compiled_transfer_prepare(ct); + yagl_compiled_transfer_prepare(t->ts, ct); } t->direct = false; @@ -339,14 +340,15 @@ void yagl_transport_get_in_array(struct yagl_transport *t, } } -const char **yagl_transport_get_out_string_array(const char *data, +const char **yagl_transport_get_out_string_array(struct yagl_transport *t, + const char *data, int32_t data_count, int32_t *array_count) { struct yagl_vector v; char *tmp; - YAGL_LOG_FUNC_SET(yagl_transport_get_out_string_array); + YAGL_LOG_FUNC_SET_TS(yagl_transport_get_out_string_array, t->ts); if (!data) { *array_count = 0; diff --git a/hw/yagl/yagl_transport.h b/hw/yagl/yagl_transport.h index 8fe9ec6e3f..2aeea53d9c 100644 --- a/hw/yagl/yagl_transport.h +++ b/hw/yagl/yagl_transport.h @@ -61,6 +61,7 @@ struct yagl_transport */ uint8_t **pages; + struct yagl_thread_state *ts; /* * @} @@ -136,7 +137,8 @@ void yagl_transport_get_in_array(struct yagl_transport *t, int32_t *maxcount, int32_t **count); -const char **yagl_transport_get_out_string_array(const char *data, +const char **yagl_transport_get_out_string_array(struct yagl_transport *t, + const char *data, int32_t data_count, int32_t *array_count); diff --git a/hw/yagl/yagl_types.h b/hw/yagl/yagl_types.h index abebe2f090..bddd6a41b6 100644 --- a/hw/yagl/yagl_types.h +++ b/hw/yagl/yagl_types.h @@ -30,10 +30,6 @@ #ifndef _QEMU_YAGL_TYPES_H #define _QEMU_YAGL_TYPES_H -#ifdef __USE_MINGW_ANSI_STDIO -#undef __USE_MINGW_ANSI_STDIO -#endif - #include "qemu/osdep.h" #include "qemu-common.h" #include "cpu.h" @@ -46,6 +42,8 @@ typedef uint32_t yagl_object_name; typedef uint32_t yagl_winsys_id; struct yagl_transport; +struct yagl_thread_state; +struct yagl_process_state; /* * YaGL supported render types. diff --git a/hw/yagl/yagl_util.c b/hw/yagl/yagl_util.c new file mode 100644 index 0000000000..c4e60b42d4 --- /dev/null +++ b/hw/yagl/yagl_util.c @@ -0,0 +1,63 @@ +/* + * yagl + * + * Copyright (c) 2000 - 2020 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Stanislav Vorobiov + * Jinhyung Jo + * YeongKyoon Lee + * Lukasz Kostyra + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +#include "yagl_util.h" + +#ifdef CONFIG_WIN32 +#include +#else +#include +#include + +#ifdef CONFIG_DARWIN +#define SYSCALL_GET_TID SYS_thread_selfid +#else +#define SYSCALL_GET_TID SYS_gettid +#endif + +#endif + +yagl_pid yagl_get_pid(void) +{ +#ifdef CONFIG_WIN32 + return (yagl_pid)GetCurrentProcessId(); +#else + return (yagl_pid)getpid(); +#endif +} + +yagl_tid yagl_get_tid(void) +{ +#ifdef CONFIG_WIN32 + return (yagl_tid)GetCurrentThreadId(); +#else + return (yagl_tid)syscall(SYSCALL_GET_TID); +#endif +} \ No newline at end of file diff --git a/hw/yagl/yagl_util.h b/hw/yagl/yagl_util.h new file mode 100644 index 0000000000..228b4799b8 --- /dev/null +++ b/hw/yagl/yagl_util.h @@ -0,0 +1,40 @@ +/* + * yagl + * + * Copyright (c) 2000 - 2020 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Stanislav Vorobiov + * Jinhyung Jo + * YeongKyoon Lee + * Lukasz Kostyra + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +#ifndef _QEMU_YAGL_UTIL_H +#define _QEMU_YAGL_UTIL_H + +#include "yagl_types.h" + +yagl_pid yagl_get_pid(void); + +yagl_tid yagl_get_tid(void); + +#endif // _QEMU_YAGL_UTIL_H diff --git a/rules.mak b/rules.mak index ea1a86b59b..694865b63e 100644 --- a/rules.mak +++ b/rules.mak @@ -103,11 +103,7 @@ LINK = $(call quiet-command, $(LINKPROG) $(CFLAGS) $(QEMU_LDFLAGS) -o $@ \ %.o: %.dtrace $(call quiet-command,dtrace -o $@ -G -s $<,"GEN","$(TARGET_DIR)$@") -ifdef CONFIG_WIN32 -DSO_OBJ_CFLAGS := -DBUILD_DSO -else DSO_OBJ_CFLAGS := -fPIC -DBUILD_DSO -endif module-common.o: CFLAGS += $(DSO_OBJ_CFLAGS) %$(DSOSUF): QEMU_LDFLAGS += $(LDFLAGS_SHARED) %$(DSOSUF): %.mo diff --git a/test_tizen_emulator.sh b/test_tizen_emulator.sh index 8a6de7b83c..fbb579bd6a 100755 --- a/test_tizen_emulator.sh +++ b/test_tizen_emulator.sh @@ -4,8 +4,8 @@ # test test() { - TIZEN_PLATFORM_VER="6.5" - QEMU_VERSION="5.0.1.2" + TIZEN_PLATFORM_VER="7.0" + QEMU_VERSION="5.0.1.3" BUILD_TARGET="ubuntu-64" # emulator EMULATOR_COMMON_DIR=./package/$TIZEN_PLATFORM_VER-emulator-qemu-common.package.${TARGET_OS}/data/platforms/tizen-$TIZEN_PLATFORM_VER/common diff --git a/tizen/emulator_configure.sh b/tizen/emulator_configure.sh index 8ec91b6420..aa71d86a1a 100755 --- a/tizen/emulator_configure.sh +++ b/tizen/emulator_configure.sh @@ -159,9 +159,13 @@ CONFIGURE_APPEND=" $CONFIGURE_APPEND" CONFIGURE_APPEND_WIN=" + --extra-ldflags=-static-libgcc + --extra-ldflags=-static-libstdc++ --audio-drv-list=dsound + --enable-sdl --enable-hax --enable-whpx + --extra-cflags="-D__USE_MINGW_ANSI_STDIO=1" --extra-cflags=-Wno-error=undef --extra-cflags=-Wno-error=unknown-pragmas --extra-cflags=-Wno-error=redundant-decls" @@ -173,7 +177,6 @@ CONFIGURE_APPEND=" --extra-ldflags=-rdynamic --extra-ldflags=-Wl,-rpath,'\$\$ORIGIN' --audio-drv-list=alsa - --enable-sdl --enable-kvm $CONFIGURE_APPEND " diff --git a/tizen/src/emulator.c b/tizen/src/emulator.c index 27b8d9f4f4..9a5d89610d 100644 --- a/tizen/src/emulator.c +++ b/tizen/src/emulator.c @@ -360,6 +360,7 @@ int main(int argc, char *argv[], char **envp) int main(int argc, char *argv[]) { if (!check_integrity_level_and_respawn()) { + LOG_INFO("check_integrity_level_and_respawn Success!\n"); init_error_handler(); return emulator_main(argc, argv, NULL); } diff --git a/tizen/src/eventcast/encode_fb.c b/tizen/src/eventcast/encode_fb.c index 709e9ddd57..39cde9de4a 100644 --- a/tizen/src/eventcast/encode_fb.c +++ b/tizen/src/eventcast/encode_fb.c @@ -29,9 +29,6 @@ */ #include -#ifdef __USE_MINGW_ANSI_STDIO -#undef __USE_MINGW_ANSI_STDIO -#endif #include "emulator_common.h" #include "emul_state.h" diff --git a/tizen/src/hw/maru_board.c b/tizen/src/hw/maru_board.c index 16e5802fc3..dc27b9bda4 100644 --- a/tizen/src/hw/maru_board.c +++ b/tizen/src/hw/maru_board.c @@ -59,7 +59,9 @@ static void maru_x86_machine_options(MachineClass *m) m->no_cdrom = 1; m->no_sdcard = 1; m->default_boot_order = "c"; +#ifdef CONFIG_HAX compat_props_add(m->compat_props, hw_compat_2_6, hw_compat_2_6_len); +#endif } DEFINE_PC_MACHINE(maru, "maru-x86-machine", maru_x86_board_init, diff --git a/tizen/src/hw/virtio/maru_virtio_evdi.c b/tizen/src/hw/virtio/maru_virtio_evdi.c index dd6afa9423..066dae95ec 100644 --- a/tizen/src/hw/virtio/maru_virtio_evdi.c +++ b/tizen/src/hw/virtio/maru_virtio_evdi.c @@ -27,9 +27,6 @@ */ #include -#ifdef __USE_MINGW_ANSI_STDIO -#undef __USE_MINGW_ANSI_STDIO -#endif #include "qemu/osdep.h" #include "qemu/iov.h" #include "hw/maru_device_ids.h" diff --git a/tizen/src/hw/virtio/maru_virtio_jack.c b/tizen/src/hw/virtio/maru_virtio_jack.c index 8a1c48217a..5ee672bb29 100644 --- a/tizen/src/hw/virtio/maru_virtio_jack.c +++ b/tizen/src/hw/virtio/maru_virtio_jack.c @@ -28,9 +28,6 @@ */ #include -#ifdef __USE_MINGW_ANSI_STDIO -#undef __USE_MINGW_ANSI_STDIO -#endif #include "qemu/osdep.h" #include "hw/pci/pci.h" #include "hw/qdev-properties.h" diff --git a/tizen/src/hw/virtio/maru_virtio_power.c b/tizen/src/hw/virtio/maru_virtio_power.c index b2b2685c23..48f0d9206e 100644 --- a/tizen/src/hw/virtio/maru_virtio_power.c +++ b/tizen/src/hw/virtio/maru_virtio_power.c @@ -28,9 +28,6 @@ */ #include -#ifdef __USE_MINGW_ANSI_STDIO -#undef __USE_MINGW_ANSI_STDIO -#endif #include "qemu/osdep.h" #include "hw/pci/pci.h" diff --git a/tizen/src/util/extra_pkgs_install.c b/tizen/src/util/extra_pkgs_install.c index 8057f62a62..fe08de6ce8 100644 --- a/tizen/src/util/extra_pkgs_install.c +++ b/tizen/src/util/extra_pkgs_install.c @@ -31,9 +31,6 @@ #include #include #include -#ifdef __USE_MINGW_ANSI_STDIO -#undef __USE_MINGW_ANSI_STDIO -#endif #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/queue.h" diff --git a/tizen/src/util/osutil-win32.c b/tizen/src/util/osutil-win32.c index e94899a72b..4cf61e3ec6 100644 --- a/tizen/src/util/osutil-win32.c +++ b/tizen/src/util/osutil-win32.c @@ -425,6 +425,7 @@ bool check_integrity_level_and_respawn(void) LOG_INFO("Respawning success. Waiting for child process.\n"); bResult = true; WaitForSingleObject(ProcInfo.hProcess, INFINITE); + LOG_INFO("Respawn successfull. Elevated Process.\n"); CleanExit: if (ProcInfo.hProcess != NULL) {