YaGL: 'mlockall' removed, we only fault in target memory when needed
authorStanislav Vorobiov <s.vorobiov@samsung.com>
Wed, 3 Oct 2012 09:38:08 +0000 (13:38 +0400)
committerEvgeny Voevodin <e.voevodin@samsung.com>
Mon, 8 Oct 2012 08:21:48 +0000 (12:21 +0400)
24 files changed:
Makefile.target
hw/yagl_apis/egl/yagl_egl_calls.c
hw/yagl_apis/egl/yagl_host_egl_calls.c
hw/yagl_apis/egl/yagl_host_egl_calls.h
hw/yagl_apis/gles/yagl_host_gles_calls.c
hw/yagl_apis/gles/yagl_host_gles_calls.h
hw/yagl_apis/gles1/yagl_gles1_calls.c
hw/yagl_apis/gles1/yagl_host_gles1_calls.c
hw/yagl_apis/gles1/yagl_host_gles1_calls.h
hw/yagl_apis/gles2/yagl_gles2_calls.c
hw/yagl_apis/gles2/yagl_host_gles2_calls.c
hw/yagl_apis/gles2/yagl_host_gles2_calls.h
hw/yagl_marshal.h
hw/yagl_mem.c
hw/yagl_mem.h
hw/yagl_mem_egl.h
hw/yagl_mem_gl.h
hw/yagl_mem_transfer.c [new file with mode: 0644]
hw/yagl_mem_transfer.h [new file with mode: 0644]
hw/yagl_server.c
hw/yagl_thread.c
hw/yagl_thread.h
hw/yagl_types.h
hw/yagl_version.h

index de02d13..8f52874 100755 (executable)
@@ -436,6 +436,7 @@ obj-$(TARGET_BASE_ARCH)-y += yagl_ref.o
 obj-$(TARGET_BASE_ARCH)-y += yagl_mem.o
 obj-$(TARGET_BASE_ARCH)-y += yagl_mem_egl.o
 obj-$(TARGET_BASE_ARCH)-y += yagl_mem_gl.o
+obj-$(TARGET_BASE_ARCH)-y += yagl_mem_transfer.o
 obj-$(TARGET_BASE_ARCH)-y += yagl_event.o
 obj-$(TARGET_BASE_ARCH)-y += yagl_handle_gen.o
 obj-$(TARGET_BASE_ARCH)-y += yagl_dyn_lib.o
index b51688a..5477ae1 100644 (file)
 /*
  * eglGetError dispatcher. id = 1
  */
-static uint8_t* yagl_func_eglGetError(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglGetError(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
     YAGL_LOG_FUNC_ENTER_SPLIT0(ts->ps->id, ts->id, eglGetError);
-    EGLint ret = yagl_host_eglGetError();
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLint, ret);
-    yagl_marshal_put_EGLint(&in_buff, ret);
-    return out_buff;
+    EGLint retval;
+    bool res = yagl_host_eglGetError(&retval);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLint, retval);
+    yagl_marshal_put_EGLint(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglGetDisplay dispatcher. id = 2
  */
-static uint8_t* yagl_func_eglGetDisplay(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglGetDisplay(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    target_ulong display_id = yagl_marshal_get_ptr(&out_buff);
+    target_ulong display_id = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, eglGetDisplay, target_ulong, display_id);
-    yagl_host_handle ret = yagl_host_eglGetDisplay(display_id);
-    YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, ret);
-    yagl_marshal_put_host_handle(&in_buff, ret);
-    return out_buff;
+    yagl_host_handle retval;
+    bool res = yagl_host_eglGetDisplay(&retval, display_id);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, retval);
+    yagl_marshal_put_host_handle(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglInitialize dispatcher. id = 3
  */
-static uint8_t* yagl_func_eglInitialize(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglInitialize(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    target_ulong major = yagl_marshal_get_ptr(&out_buff);
-    target_ulong minor = yagl_marshal_get_ptr(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    target_ulong major = yagl_marshal_get_ptr(out_buff);
+    target_ulong minor = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, eglInitialize, yagl_host_handle, target_ulong, target_ulong, dpy, major, minor);
-    EGLBoolean ret = yagl_host_eglInitialize(dpy, major, minor);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglInitialize(&retval, dpy, major, minor);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglTerminate dispatcher. id = 4
  */
-static uint8_t* yagl_func_eglTerminate(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglTerminate(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, eglTerminate, yagl_host_handle, dpy);
-    EGLBoolean ret = yagl_host_eglTerminate(dpy);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglTerminate(&retval, dpy);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglGetConfigs dispatcher. id = 5
  */
-static uint8_t* yagl_func_eglGetConfigs(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglGetConfigs(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    target_ulong configs = yagl_marshal_get_ptr(&out_buff);
-    EGLint config_size = yagl_marshal_get_EGLint(&out_buff);
-    target_ulong num_config = yagl_marshal_get_ptr(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    target_ulong configs = yagl_marshal_get_ptr(out_buff);
+    EGLint config_size = yagl_marshal_get_EGLint(out_buff);
+    target_ulong num_config = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, eglGetConfigs, yagl_host_handle, target_ulong, EGLint, target_ulong, dpy, configs, config_size, num_config);
-    EGLBoolean ret = yagl_host_eglGetConfigs(dpy, configs, config_size, num_config);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglGetConfigs(&retval, dpy, configs, config_size, num_config);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglChooseConfig dispatcher. id = 6
  */
-static uint8_t* yagl_func_eglChooseConfig(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglChooseConfig(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    target_ulong attrib_list = yagl_marshal_get_ptr(&out_buff);
-    target_ulong configs = yagl_marshal_get_ptr(&out_buff);
-    EGLint config_size = yagl_marshal_get_EGLint(&out_buff);
-    target_ulong num_config = yagl_marshal_get_ptr(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    target_ulong attrib_list = yagl_marshal_get_ptr(out_buff);
+    target_ulong configs = yagl_marshal_get_ptr(out_buff);
+    EGLint config_size = yagl_marshal_get_EGLint(out_buff);
+    target_ulong num_config = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT5(ts->ps->id, ts->id, eglChooseConfig, yagl_host_handle, target_ulong, target_ulong, EGLint, target_ulong, dpy, attrib_list, configs, config_size, num_config);
-    EGLBoolean ret = yagl_host_eglChooseConfig(dpy, attrib_list, configs, config_size, num_config);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglChooseConfig(&retval, dpy, attrib_list, configs, config_size, num_config);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglGetConfigAttrib dispatcher. id = 7
  */
-static uint8_t* yagl_func_eglGetConfigAttrib(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglGetConfigAttrib(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle config = yagl_marshal_get_host_handle(&out_buff);
-    EGLint attribute = yagl_marshal_get_EGLint(&out_buff);
-    target_ulong value = yagl_marshal_get_ptr(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle config = yagl_marshal_get_host_handle(out_buff);
+    EGLint attribute = yagl_marshal_get_EGLint(out_buff);
+    target_ulong value = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, eglGetConfigAttrib, yagl_host_handle, yagl_host_handle, EGLint, target_ulong, dpy, config, attribute, value);
-    EGLBoolean ret = yagl_host_eglGetConfigAttrib(dpy, config, attribute, value);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglGetConfigAttrib(&retval, dpy, config, attribute, value);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglDestroySurface dispatcher. id = 8
  */
-static uint8_t* yagl_func_eglDestroySurface(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglDestroySurface(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle surface = yagl_marshal_get_host_handle(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle surface = yagl_marshal_get_host_handle(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, eglDestroySurface, yagl_host_handle, yagl_host_handle, dpy, surface);
-    EGLBoolean ret = yagl_host_eglDestroySurface(dpy, surface);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglDestroySurface(&retval, dpy, surface);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglQuerySurface dispatcher. id = 9
  */
-static uint8_t* yagl_func_eglQuerySurface(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglQuerySurface(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle surface = yagl_marshal_get_host_handle(&out_buff);
-    EGLint attribute = yagl_marshal_get_EGLint(&out_buff);
-    target_ulong value = yagl_marshal_get_ptr(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle surface = yagl_marshal_get_host_handle(out_buff);
+    EGLint attribute = yagl_marshal_get_EGLint(out_buff);
+    target_ulong value = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, eglQuerySurface, yagl_host_handle, yagl_host_handle, EGLint, target_ulong, dpy, surface, attribute, value);
-    EGLBoolean ret = yagl_host_eglQuerySurface(dpy, surface, attribute, value);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglQuerySurface(&retval, dpy, surface, attribute, value);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglBindAPI dispatcher. id = 10
  */
-static uint8_t* yagl_func_eglBindAPI(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglBindAPI(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    EGLenum api = yagl_marshal_get_EGLenum(&out_buff);
+    EGLenum api = yagl_marshal_get_EGLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, eglBindAPI, EGLenum, api);
-    EGLBoolean ret = yagl_host_eglBindAPI(api);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglBindAPI(&retval, api);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglWaitClient dispatcher. id = 11
  */
-static uint8_t* yagl_func_eglWaitClient(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglWaitClient(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
     YAGL_LOG_FUNC_ENTER_SPLIT0(ts->ps->id, ts->id, eglWaitClient);
-    EGLBoolean ret = yagl_host_eglWaitClient();
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglWaitClient(&retval);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglReleaseThread dispatcher. id = 12
  */
-static uint8_t* yagl_func_eglReleaseThread(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglReleaseThread(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
     YAGL_LOG_FUNC_ENTER_SPLIT0(ts->ps->id, ts->id, eglReleaseThread);
-    EGLBoolean ret = yagl_host_eglReleaseThread();
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglReleaseThread(&retval);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglCreatePbufferFromClientBuffer dispatcher. id = 13
  */
-static uint8_t* yagl_func_eglCreatePbufferFromClientBuffer(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglCreatePbufferFromClientBuffer(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    EGLenum buftype = yagl_marshal_get_EGLenum(&out_buff);
-    yagl_host_handle buffer = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle config = yagl_marshal_get_host_handle(&out_buff);
-    target_ulong attrib_list = yagl_marshal_get_ptr(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    EGLenum buftype = yagl_marshal_get_EGLenum(out_buff);
+    yagl_host_handle buffer = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle config = yagl_marshal_get_host_handle(out_buff);
+    target_ulong attrib_list = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT5(ts->ps->id, ts->id, eglCreatePbufferFromClientBuffer, yagl_host_handle, EGLenum, yagl_host_handle, yagl_host_handle, target_ulong, dpy, buftype, buffer, config, attrib_list);
-    yagl_host_handle ret = yagl_host_eglCreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
-    YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, ret);
-    yagl_marshal_put_host_handle(&in_buff, ret);
-    return out_buff;
+    yagl_host_handle retval;
+    bool res = yagl_host_eglCreatePbufferFromClientBuffer(&retval, dpy, buftype, buffer, config, attrib_list);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, retval);
+    yagl_marshal_put_host_handle(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglSurfaceAttrib dispatcher. id = 14
  */
-static uint8_t* yagl_func_eglSurfaceAttrib(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglSurfaceAttrib(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle surface = yagl_marshal_get_host_handle(&out_buff);
-    EGLint attribute = yagl_marshal_get_EGLint(&out_buff);
-    EGLint value = yagl_marshal_get_EGLint(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle surface = yagl_marshal_get_host_handle(out_buff);
+    EGLint attribute = yagl_marshal_get_EGLint(out_buff);
+    EGLint value = yagl_marshal_get_EGLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, eglSurfaceAttrib, yagl_host_handle, yagl_host_handle, EGLint, EGLint, dpy, surface, attribute, value);
-    EGLBoolean ret = yagl_host_eglSurfaceAttrib(dpy, surface, attribute, value);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglSurfaceAttrib(&retval, dpy, surface, attribute, value);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglBindTexImage dispatcher. id = 15
  */
-static uint8_t* yagl_func_eglBindTexImage(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglBindTexImage(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle surface = yagl_marshal_get_host_handle(&out_buff);
-    EGLint buffer = yagl_marshal_get_EGLint(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle surface = yagl_marshal_get_host_handle(out_buff);
+    EGLint buffer = yagl_marshal_get_EGLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, eglBindTexImage, yagl_host_handle, yagl_host_handle, EGLint, dpy, surface, buffer);
-    EGLBoolean ret = yagl_host_eglBindTexImage(dpy, surface, buffer);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglBindTexImage(&retval, dpy, surface, buffer);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglReleaseTexImage dispatcher. id = 16
  */
-static uint8_t* yagl_func_eglReleaseTexImage(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglReleaseTexImage(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle surface = yagl_marshal_get_host_handle(&out_buff);
-    EGLint buffer = yagl_marshal_get_EGLint(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle surface = yagl_marshal_get_host_handle(out_buff);
+    EGLint buffer = yagl_marshal_get_EGLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, eglReleaseTexImage, yagl_host_handle, yagl_host_handle, EGLint, dpy, surface, buffer);
-    EGLBoolean ret = yagl_host_eglReleaseTexImage(dpy, surface, buffer);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglReleaseTexImage(&retval, dpy, surface, buffer);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglCreateContext dispatcher. id = 17
  */
-static uint8_t* yagl_func_eglCreateContext(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglCreateContext(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle config = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle share_context = yagl_marshal_get_host_handle(&out_buff);
-    target_ulong attrib_list = yagl_marshal_get_ptr(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle config = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle share_context = yagl_marshal_get_host_handle(out_buff);
+    target_ulong attrib_list = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, eglCreateContext, yagl_host_handle, yagl_host_handle, yagl_host_handle, target_ulong, dpy, config, share_context, attrib_list);
-    yagl_host_handle ret = yagl_host_eglCreateContext(dpy, config, share_context, attrib_list);
-    YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, ret);
-    yagl_marshal_put_host_handle(&in_buff, ret);
-    return out_buff;
+    yagl_host_handle retval;
+    bool res = yagl_host_eglCreateContext(&retval, dpy, config, share_context, attrib_list);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, retval);
+    yagl_marshal_put_host_handle(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglDestroyContext dispatcher. id = 18
  */
-static uint8_t* yagl_func_eglDestroyContext(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglDestroyContext(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle ctx = yagl_marshal_get_host_handle(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle ctx = yagl_marshal_get_host_handle(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, eglDestroyContext, yagl_host_handle, yagl_host_handle, dpy, ctx);
-    EGLBoolean ret = yagl_host_eglDestroyContext(dpy, ctx);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglDestroyContext(&retval, dpy, ctx);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglMakeCurrent dispatcher. id = 19
  */
-static uint8_t* yagl_func_eglMakeCurrent(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglMakeCurrent(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle draw = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle read = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle ctx = yagl_marshal_get_host_handle(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle draw = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle read = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle ctx = yagl_marshal_get_host_handle(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, eglMakeCurrent, yagl_host_handle, yagl_host_handle, yagl_host_handle, yagl_host_handle, dpy, draw, read, ctx);
-    EGLBoolean ret = yagl_host_eglMakeCurrent(dpy, draw, read, ctx);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglMakeCurrent(&retval, dpy, draw, read, ctx);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglQueryContext dispatcher. id = 20
  */
-static uint8_t* yagl_func_eglQueryContext(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglQueryContext(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle ctx = yagl_marshal_get_host_handle(&out_buff);
-    EGLint attribute = yagl_marshal_get_EGLint(&out_buff);
-    target_ulong value = yagl_marshal_get_ptr(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle ctx = yagl_marshal_get_host_handle(out_buff);
+    EGLint attribute = yagl_marshal_get_EGLint(out_buff);
+    target_ulong value = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, eglQueryContext, yagl_host_handle, yagl_host_handle, EGLint, target_ulong, dpy, ctx, attribute, value);
-    EGLBoolean ret = yagl_host_eglQueryContext(dpy, ctx, attribute, value);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglQueryContext(&retval, dpy, ctx, attribute, value);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglWaitGL dispatcher. id = 21
  */
-static uint8_t* yagl_func_eglWaitGL(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglWaitGL(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
     YAGL_LOG_FUNC_ENTER_SPLIT0(ts->ps->id, ts->id, eglWaitGL);
-    EGLBoolean ret = yagl_host_eglWaitGL();
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglWaitGL(&retval);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglWaitNative dispatcher. id = 22
  */
-static uint8_t* yagl_func_eglWaitNative(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglWaitNative(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    EGLint engine = yagl_marshal_get_EGLint(&out_buff);
+    EGLint engine = yagl_marshal_get_EGLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, eglWaitNative, EGLint, engine);
-    EGLBoolean ret = yagl_host_eglWaitNative(engine);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglWaitNative(&retval, engine);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglSwapBuffers dispatcher. id = 23
  */
-static uint8_t* yagl_func_eglSwapBuffers(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglSwapBuffers(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle surface = yagl_marshal_get_host_handle(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle surface = yagl_marshal_get_host_handle(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, eglSwapBuffers, yagl_host_handle, yagl_host_handle, dpy, surface);
-    EGLBoolean ret = yagl_host_eglSwapBuffers(dpy, surface);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglSwapBuffers(&retval, dpy, surface);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglCopyBuffers dispatcher. id = 24
  */
-static uint8_t* yagl_func_eglCopyBuffers(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglCopyBuffers(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle surface = yagl_marshal_get_host_handle(&out_buff);
-    EGLNativePixmapType target = yagl_marshal_get_EGLNativePixmapType(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle surface = yagl_marshal_get_host_handle(out_buff);
+    EGLNativePixmapType target = yagl_marshal_get_EGLNativePixmapType(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, eglCopyBuffers, yagl_host_handle, yagl_host_handle, EGLNativePixmapType, dpy, surface, target);
-    EGLBoolean ret = yagl_host_eglCopyBuffers(dpy, surface, target);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglCopyBuffers(&retval, dpy, surface, target);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglCreateWindowSurfaceOffscreenYAGL dispatcher. id = 25
  */
-static uint8_t* yagl_func_eglCreateWindowSurfaceOffscreenYAGL(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglCreateWindowSurfaceOffscreenYAGL(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle config = yagl_marshal_get_host_handle(&out_buff);
-    uint32_t width = yagl_marshal_get_uint32_t(&out_buff);
-    uint32_t height = yagl_marshal_get_uint32_t(&out_buff);
-    uint32_t bpp = yagl_marshal_get_uint32_t(&out_buff);
-    target_ulong pixels = yagl_marshal_get_ptr(&out_buff);
-    target_ulong attrib_list = yagl_marshal_get_ptr(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle config = yagl_marshal_get_host_handle(out_buff);
+    uint32_t width = yagl_marshal_get_uint32_t(out_buff);
+    uint32_t height = yagl_marshal_get_uint32_t(out_buff);
+    uint32_t bpp = yagl_marshal_get_uint32_t(out_buff);
+    target_ulong pixels = yagl_marshal_get_ptr(out_buff);
+    target_ulong attrib_list = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT7(ts->ps->id, ts->id, eglCreateWindowSurfaceOffscreenYAGL, yagl_host_handle, yagl_host_handle, uint32_t, uint32_t, uint32_t, target_ulong, target_ulong, dpy, config, width, height, bpp, pixels, attrib_list);
-    yagl_host_handle ret = yagl_host_eglCreateWindowSurfaceOffscreenYAGL(dpy, config, width, height, bpp, pixels, attrib_list);
-    YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, ret);
-    yagl_marshal_put_host_handle(&in_buff, ret);
-    return out_buff;
+    yagl_host_handle retval;
+    bool res = yagl_host_eglCreateWindowSurfaceOffscreenYAGL(&retval, dpy, config, width, height, bpp, pixels, attrib_list);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, retval);
+    yagl_marshal_put_host_handle(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglCreatePbufferSurfaceOffscreenYAGL dispatcher. id = 26
  */
-static uint8_t* yagl_func_eglCreatePbufferSurfaceOffscreenYAGL(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglCreatePbufferSurfaceOffscreenYAGL(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle config = yagl_marshal_get_host_handle(&out_buff);
-    uint32_t width = yagl_marshal_get_uint32_t(&out_buff);
-    uint32_t height = yagl_marshal_get_uint32_t(&out_buff);
-    uint32_t bpp = yagl_marshal_get_uint32_t(&out_buff);
-    target_ulong pixels = yagl_marshal_get_ptr(&out_buff);
-    target_ulong attrib_list = yagl_marshal_get_ptr(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle config = yagl_marshal_get_host_handle(out_buff);
+    uint32_t width = yagl_marshal_get_uint32_t(out_buff);
+    uint32_t height = yagl_marshal_get_uint32_t(out_buff);
+    uint32_t bpp = yagl_marshal_get_uint32_t(out_buff);
+    target_ulong pixels = yagl_marshal_get_ptr(out_buff);
+    target_ulong attrib_list = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT7(ts->ps->id, ts->id, eglCreatePbufferSurfaceOffscreenYAGL, yagl_host_handle, yagl_host_handle, uint32_t, uint32_t, uint32_t, target_ulong, target_ulong, dpy, config, width, height, bpp, pixels, attrib_list);
-    yagl_host_handle ret = yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(dpy, config, width, height, bpp, pixels, attrib_list);
-    YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, ret);
-    yagl_marshal_put_host_handle(&in_buff, ret);
-    return out_buff;
+    yagl_host_handle retval;
+    bool res = yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(&retval, dpy, config, width, height, bpp, pixels, attrib_list);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, retval);
+    yagl_marshal_put_host_handle(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglCreatePixmapSurfaceOffscreenYAGL dispatcher. id = 27
  */
-static uint8_t* yagl_func_eglCreatePixmapSurfaceOffscreenYAGL(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglCreatePixmapSurfaceOffscreenYAGL(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle config = yagl_marshal_get_host_handle(&out_buff);
-    uint32_t width = yagl_marshal_get_uint32_t(&out_buff);
-    uint32_t height = yagl_marshal_get_uint32_t(&out_buff);
-    uint32_t bpp = yagl_marshal_get_uint32_t(&out_buff);
-    target_ulong pixels = yagl_marshal_get_ptr(&out_buff);
-    target_ulong attrib_list = yagl_marshal_get_ptr(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle config = yagl_marshal_get_host_handle(out_buff);
+    uint32_t width = yagl_marshal_get_uint32_t(out_buff);
+    uint32_t height = yagl_marshal_get_uint32_t(out_buff);
+    uint32_t bpp = yagl_marshal_get_uint32_t(out_buff);
+    target_ulong pixels = yagl_marshal_get_ptr(out_buff);
+    target_ulong attrib_list = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT7(ts->ps->id, ts->id, eglCreatePixmapSurfaceOffscreenYAGL, yagl_host_handle, yagl_host_handle, uint32_t, uint32_t, uint32_t, target_ulong, target_ulong, dpy, config, width, height, bpp, pixels, attrib_list);
-    yagl_host_handle ret = yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(dpy, config, width, height, bpp, pixels, attrib_list);
-    YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, ret);
-    yagl_marshal_put_host_handle(&in_buff, ret);
-    return out_buff;
+    yagl_host_handle retval;
+    bool res = yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(&retval, dpy, config, width, height, bpp, pixels, attrib_list);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(yagl_host_handle, retval);
+    yagl_marshal_put_host_handle(&in_buff, retval);
+    return true;
 }
 
 /*
  * eglResizeOffscreenSurfaceYAGL dispatcher. id = 28
  */
-static uint8_t* yagl_func_eglResizeOffscreenSurfaceYAGL(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_eglResizeOffscreenSurfaceYAGL(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    yagl_host_handle dpy = yagl_marshal_get_host_handle(&out_buff);
-    yagl_host_handle surface = yagl_marshal_get_host_handle(&out_buff);
-    uint32_t width = yagl_marshal_get_uint32_t(&out_buff);
-    uint32_t height = yagl_marshal_get_uint32_t(&out_buff);
-    uint32_t bpp = yagl_marshal_get_uint32_t(&out_buff);
-    target_ulong pixels = yagl_marshal_get_ptr(&out_buff);
+    yagl_host_handle dpy = yagl_marshal_get_host_handle(out_buff);
+    yagl_host_handle surface = yagl_marshal_get_host_handle(out_buff);
+    uint32_t width = yagl_marshal_get_uint32_t(out_buff);
+    uint32_t height = yagl_marshal_get_uint32_t(out_buff);
+    uint32_t bpp = yagl_marshal_get_uint32_t(out_buff);
+    target_ulong pixels = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT6(ts->ps->id, ts->id, eglResizeOffscreenSurfaceYAGL, yagl_host_handle, yagl_host_handle, uint32_t, uint32_t, uint32_t, target_ulong, dpy, surface, width, height, bpp, pixels);
-    EGLBoolean ret = yagl_host_eglResizeOffscreenSurfaceYAGL(dpy, surface, width, height, bpp, pixels);
-    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, ret);
-    yagl_marshal_put_EGLBoolean(&in_buff, ret);
-    return out_buff;
+    EGLBoolean retval;
+    bool res = yagl_host_eglResizeOffscreenSurfaceYAGL(&retval, dpy, surface, width, height, bpp, pixels);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(EGLBoolean, retval);
+    yagl_marshal_put_EGLBoolean(&in_buff, retval);
+    return true;
 }
 
 const uint32_t yagl_egl_api_num_funcs = 28;
index 16cd1dd..6d47d23 100644 (file)
@@ -32,7 +32,8 @@
 #define YAGL_UNIMPLEMENTED(func, ret) \
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, func); \
     YAGL_LOG_WARN("NOT IMPLEMENTED!!!"); \
-    return ret;
+    *retval = ret; \
+    return true;
 
 static YAGL_DEFINE_TLS(struct yagl_egl_api_ts*, egl_api_ts);
 
@@ -292,26 +293,29 @@ struct yagl_api_ps
     return &egl_api_ps->base;
 }
 
-EGLint yagl_host_eglGetError(void)
+bool yagl_host_eglGetError(EGLint* retval)
 {
-    EGLint error;
+    *retval = egl_api_ts->error;
 
-    error = egl_api_ts->error;
     egl_api_ts->error = EGL_SUCCESS;
 
-    return error;
+    return true;
 }
 
-yagl_host_handle yagl_host_eglGetDisplay(target_ulong /* Display* */ display_id)
+bool yagl_host_eglGetDisplay(yagl_host_handle* retval,
+    target_ulong /* Display* */ display_id)
 {
     struct yagl_egl_display *dpy;
 
     dpy = yagl_egl_api_ps_display_add(egl_api_ts->api_ps, display_id);
 
-    return dpy ? dpy->handle : 0;
+    *retval = (dpy ? dpy->handle : 0);
+
+    return true;
 }
 
-EGLBoolean yagl_host_eglInitialize(yagl_host_handle dpy_,
+bool yagl_host_eglInitialize(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     target_ulong /* EGLint* */ major,
     target_ulong /* EGLint* */ minor)
 {
@@ -319,56 +323,67 @@ EGLBoolean yagl_host_eglInitialize(yagl_host_handle dpy_,
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglInitialize);
 
+    if (!yagl_mem_prepare_EGLint(egl_api_ts->ts->mt1, major) ||
+        !yagl_mem_prepare_EGLint(egl_api_ts->ts->mt2, minor)) {
+        return false;
+    }
+
     dpy = yagl_egl_api_ps_display_get(egl_api_ts->api_ps, dpy_);
 
     if (!dpy) {
         YAGL_SET_ERR(EGL_BAD_DISPLAY);
-        return EGL_FALSE;
+        *retval = EGL_FALSE;
+        return true;
     }
 
     yagl_egl_display_initialize(dpy);
 
     if (major) {
-        yagl_mem_put_EGLint(egl_api_ts->ts, major, YAGL_EGL_VERSION_MAJOR);
+        yagl_mem_put_EGLint(egl_api_ts->ts->mt1, YAGL_EGL_VERSION_MAJOR);
     }
 
     if (minor) {
-        yagl_mem_put_EGLint(egl_api_ts->ts, minor, YAGL_EGL_VERSION_MINOR);
+        yagl_mem_put_EGLint(egl_api_ts->ts->mt2, YAGL_EGL_VERSION_MINOR);
     }
 
-    return EGL_TRUE;
+    *retval = EGL_TRUE;
+    return true;
 }
 
-EGLBoolean yagl_host_eglTerminate(yagl_host_handle dpy_)
+bool yagl_host_eglTerminate(EGLBoolean* retval,
+    yagl_host_handle dpy_)
 {
-    EGLBoolean ret = EGL_FALSE;
     struct yagl_egl_display *dpy = NULL;
 
+    *retval = EGL_FALSE;
+
     if (!yagl_validate_display(dpy_, &dpy)) {
         goto out;
     }
 
     yagl_egl_display_terminate(dpy);
 
-    ret = EGL_TRUE;
+    *retval = EGL_TRUE;
 
 out:
-    return ret;
+    return true;
 }
 
-EGLBoolean yagl_host_eglGetConfigs(yagl_host_handle dpy_,
+bool yagl_host_eglGetConfigs(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     target_ulong /* EGLConfig^* */ configs_,
     EGLint config_size,
     target_ulong /* EGLint* */ num_config_)
 {
-    EGLBoolean ret = EGL_FALSE;
+    bool res = true;
     struct yagl_egl_display *dpy = NULL;
     yagl_host_handle *configs = NULL;
     EGLint num_config = config_size;
-    EGLint i;
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglGetConfigs);
 
+    *retval = EGL_FALSE;
+
     if (!yagl_validate_display(dpy_, &dpy)) {
         goto out;
     }
@@ -384,31 +399,34 @@ EGLBoolean yagl_host_eglGetConfigs(yagl_host_handle dpy_,
         num_config = yagl_egl_display_get_config_count(dpy);
     }
 
+    if (!yagl_mem_prepare(egl_api_ts->ts->mt1, configs_, num_config * sizeof(*configs)) ||
+        !yagl_mem_prepare_EGLint(egl_api_ts->ts->mt2, num_config_)) {
+        res = false;
+        goto out;
+    }
+
     if (configs_) {
-        for (i = 0; i < num_config; ++i) {
-            yagl_mem_put_host_handle(egl_api_ts->ts,
-                                     configs_ + (i * sizeof(yagl_host_handle)),
-                                     configs[i]);
-        }
+        yagl_mem_put(egl_api_ts->ts->mt1, configs);
     }
 
-    yagl_mem_put_EGLint(egl_api_ts->ts, num_config_, num_config);
+    yagl_mem_put_EGLint(egl_api_ts->ts->mt2, num_config);
 
-    ret = EGL_TRUE;
+    *retval = EGL_TRUE;
 
 out:
     g_free(configs);
 
-    return ret;
+    return res;
 }
 
-EGLBoolean yagl_host_eglChooseConfig(yagl_host_handle dpy_,
+bool yagl_host_eglChooseConfig(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     target_ulong /* const EGLint* */ attrib_list_,
     target_ulong /* EGLConfig^* */ configs_,
     EGLint config_size,
     target_ulong /* EGLint* */ num_config_)
 {
-    EGLBoolean ret = EGL_FALSE;
+    bool res = true;
     struct yagl_egl_display *dpy = NULL;
     EGLint *attrib_list = NULL;
     struct yagl_egl_native_config dummy;
@@ -418,6 +436,8 @@ EGLBoolean yagl_host_eglChooseConfig(yagl_host_handle dpy_,
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglChooseConfig);
 
+    *retval = EGL_FALSE;
+
     yagl_egl_native_config_init(&dummy);
 
     if (!yagl_validate_display(dpy_, &dpy)) {
@@ -434,7 +454,7 @@ EGLBoolean yagl_host_eglChooseConfig(yagl_host_handle dpy_,
                                                attrib_list_);
 
         if (!attrib_list) {
-            YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+            res = false;
             goto out;
         }
     }
@@ -635,15 +655,19 @@ EGLBoolean yagl_host_eglChooseConfig(yagl_host_handle dpy_,
             YAGL_LOG_DEBUG("requesting config with id = %d", config_id);
 
             if (handle) {
+                if (!yagl_mem_prepare_host_handle(egl_api_ts->ts->mt1, configs_) ||
+                    !yagl_mem_prepare_EGLint(egl_api_ts->ts->mt2, num_config_)) {
+                    res = false;
+                    goto out;
+                }
+
                 if (configs_) {
-                    yagl_mem_put_host_handle(egl_api_ts->ts,
-                                             configs_,
-                                             handle);
+                    yagl_mem_put_host_handle(egl_api_ts->ts->mt1, handle);
                 }
 
-                yagl_mem_put_EGLint(egl_api_ts->ts, num_config_, 1);
+                yagl_mem_put_EGLint(egl_api_ts->ts->mt2, 1);
 
-                ret = EGL_TRUE;
+                *retval = EGL_TRUE;
                 goto out;
             } else {
                 YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
@@ -659,37 +683,42 @@ EGLBoolean yagl_host_eglChooseConfig(yagl_host_handle dpy_,
 
     YAGL_LOG_DEBUG("chosen %d configs", num_config);
 
+    if (!yagl_mem_prepare(egl_api_ts->ts->mt1, configs_, num_config * sizeof(configs)) ||
+        !yagl_mem_prepare_EGLint(egl_api_ts->ts->mt2, num_config_)) {
+        res = false;
+        goto out;
+    }
+
     if (configs_) {
-        for (i = 0; i < num_config; ++i) {
-            yagl_mem_put_host_handle(egl_api_ts->ts,
-                                     configs_ + (i * sizeof(yagl_host_handle)),
-                                     configs[i]);
-        }
+        yagl_mem_put(egl_api_ts->ts->mt1, configs);
     }
 
-    yagl_mem_put_EGLint(egl_api_ts->ts, num_config_, num_config);
+    yagl_mem_put_EGLint(egl_api_ts->ts->mt2, num_config);
 
-    ret = EGL_TRUE;
+    *retval = EGL_TRUE;
 
 out:
     g_free(configs);
     g_free(attrib_list);
 
-    return ret;
+    return res;
 }
 
-EGLBoolean yagl_host_eglGetConfigAttrib(yagl_host_handle dpy_,
+bool yagl_host_eglGetConfigAttrib(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle config_,
     EGLint attribute,
     target_ulong /* EGLint* */ value_)
 {
-    EGLBoolean ret = EGL_FALSE;
+    bool res = true;
     struct yagl_egl_display *dpy = NULL;
     struct yagl_egl_config *config = NULL;
     EGLint value = 0;
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglGetConfigAttrib);
 
+    *retval = EGL_FALSE;
+
     if (!yagl_validate_display(dpy_, &dpy)) {
         goto out;
     }
@@ -703,27 +732,34 @@ EGLBoolean yagl_host_eglGetConfigAttrib(yagl_host_handle dpy_,
         goto out;
     }
 
+    if (!yagl_mem_prepare_EGLint(egl_api_ts->ts->mt1, value_)) {
+        res = false;
+        goto out;
+    }
+
     if (value_) {
-        yagl_mem_put_EGLint(egl_api_ts->ts, value_, value);
+        yagl_mem_put_EGLint(egl_api_ts->ts->mt1, value);
     }
 
-    ret = EGL_TRUE;
+    *retval = EGL_TRUE;
 
 out:
     yagl_egl_config_release(config);
 
-    return ret;
+    return res;
 }
 
-EGLBoolean yagl_host_eglDestroySurface(yagl_host_handle dpy_,
+bool yagl_host_eglDestroySurface(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle surface_)
 {
-    EGLBoolean ret = EGL_FALSE;
     struct yagl_egl_display *dpy = NULL;
     struct yagl_egl_surface *surface = NULL;
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglDestroySurface);
 
+    *retval = EGL_FALSE;
+
     if (!yagl_validate_display(dpy_, &dpy)) {
         goto out;
     }
@@ -750,28 +786,31 @@ EGLBoolean yagl_host_eglDestroySurface(yagl_host_handle dpy_,
 
     yagl_egl_surface_invalidate(surface);
 
-    ret = EGL_TRUE;
+    *retval = EGL_TRUE;
 
     yagl_egl_surface_unlock(surface);
 
 out:
     yagl_egl_surface_release(surface);
 
-    return ret;
+    return true;
 }
 
-EGLBoolean yagl_host_eglQuerySurface(yagl_host_handle dpy_,
+bool yagl_host_eglQuerySurface(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle surface_,
     EGLint attribute,
     target_ulong /* EGLint* */ value_)
 {
-    EGLBoolean ret = EGL_FALSE;
+    bool res = true;
     struct yagl_egl_display *dpy = NULL;
     struct yagl_egl_surface *surface = NULL;
     EGLint value = 0;
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglQuerySurface);
 
+    *retval = EGL_FALSE;
+
     if (!yagl_validate_display(dpy_, &dpy)) {
         goto out;
     }
@@ -859,41 +898,50 @@ EGLBoolean yagl_host_eglQuerySurface(yagl_host_handle dpy_,
         goto out;
     }
 
+    if (!yagl_mem_prepare_EGLint(egl_api_ts->ts->mt1, value_)) {
+        res = false;
+        goto out;
+    }
+
     if (value_) {
-        yagl_mem_put_EGLint(egl_api_ts->ts, value_, value);
+        yagl_mem_put_EGLint(egl_api_ts->ts->mt1, value);
     }
 
-    ret = EGL_TRUE;
+    *retval = EGL_TRUE;
 
 out:
     yagl_egl_surface_release(surface);
 
-    return ret;
+    return res;
 }
 
-EGLBoolean yagl_host_eglBindAPI(EGLenum api)
+bool yagl_host_eglBindAPI(EGLBoolean* retval,
+    EGLenum api)
 {
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglBindAPI);
 
     if (!yagl_egl_is_api_valid(api)) {
         YAGL_SET_ERR(EGL_BAD_PARAMETER);
-        return EGL_FALSE;
+        *retval = EGL_FALSE;
+        return true;
     }
 
     egl_api_ts->api = api;
 
-    return EGL_TRUE;
+    *retval = EGL_TRUE;
+    return true;
 }
 
-EGLBoolean yagl_host_eglWaitClient(void)
+bool yagl_host_eglWaitClient(EGLBoolean* retval)
 {
-    EGLBoolean ret = EGL_FALSE;
     struct yagl_egl_surface *sfc = NULL;
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglWaitClient);
 
+    *retval = EGL_FALSE;
+
     if (!egl_api_ts->context) {
-        ret = EGL_TRUE;
+        *retval = EGL_TRUE;
         goto out;
     }
 
@@ -912,19 +960,20 @@ EGLBoolean yagl_host_eglWaitClient(void)
 
     egl_api_ts->context->client_ctx->finish(egl_api_ts->context->client_ctx);
 
-    ret = EGL_TRUE;
+    *retval = EGL_TRUE;
 
 out:
     yagl_egl_surface_release(sfc);
-    return ret;
+
+    return true;
 }
 
-EGLBoolean yagl_host_eglReleaseThread(void)
+bool yagl_host_eglReleaseThread(EGLBoolean* retval)
 {
-    EGLBoolean ret = EGL_FALSE;
-
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglReleaseThread);
 
+    *retval = EGL_FALSE;
+
     if (egl_api_ts->context) {
         if (!yagl_egl_release_current_context(egl_api_ts->context->dpy)) {
             YAGL_SET_ERR(EGL_BAD_ACCESS);
@@ -934,13 +983,14 @@ EGLBoolean yagl_host_eglReleaseThread(void)
 
     yagl_egl_api_ts_reset(egl_api_ts);
 
-    ret = EGL_TRUE;
+    *retval = EGL_TRUE;
 
 out:
-    return ret;
+    return true;
 }
 
-yagl_host_handle yagl_host_eglCreatePbufferFromClientBuffer(yagl_host_handle dpy,
+bool yagl_host_eglCreatePbufferFromClientBuffer(yagl_host_handle* retval,
+    yagl_host_handle dpy,
     EGLenum buftype,
     yagl_host_handle buffer,
     yagl_host_handle config,
@@ -949,15 +999,17 @@ yagl_host_handle yagl_host_eglCreatePbufferFromClientBuffer(yagl_host_handle dpy
     YAGL_UNIMPLEMENTED(eglCreatePbufferFromClientBuffer, 0);
 }
 
-EGLBoolean yagl_host_eglSurfaceAttrib(yagl_host_handle dpy_,
+bool yagl_host_eglSurfaceAttrib(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle surface_,
     EGLint attribute,
     EGLint value)
 {
-    EGLBoolean ret = EGL_FALSE;
     struct yagl_egl_display *dpy = NULL;
     struct yagl_egl_surface *surface = NULL;
 
+    *retval = EGL_FALSE;
+
     if (!yagl_validate_display(dpy_, &dpy)) {
         goto out;
     }
@@ -970,34 +1022,37 @@ EGLBoolean yagl_host_eglSurfaceAttrib(yagl_host_handle dpy_,
      * TODO: implement.
      */
 
-    ret = EGL_TRUE;
+    *retval = EGL_TRUE;
 
 out:
     yagl_egl_surface_release(surface);
 
-    return ret;
+    return true;
 }
 
-EGLBoolean yagl_host_eglBindTexImage(yagl_host_handle dpy,
+bool yagl_host_eglBindTexImage(EGLBoolean* retval,
+    yagl_host_handle dpy,
     yagl_host_handle surface,
     EGLint buffer)
 {
     YAGL_UNIMPLEMENTED(eglBindTexImage, EGL_FALSE);
 }
 
-EGLBoolean yagl_host_eglReleaseTexImage(yagl_host_handle dpy,
+bool yagl_host_eglReleaseTexImage(EGLBoolean* retval,
+    yagl_host_handle dpy,
     yagl_host_handle surface,
     EGLint buffer)
 {
     YAGL_UNIMPLEMENTED(eglReleaseTexImage, EGL_FALSE);
 }
 
-yagl_host_handle yagl_host_eglCreateContext(yagl_host_handle dpy_,
+bool yagl_host_eglCreateContext(yagl_host_handle* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle config_,
     yagl_host_handle share_context_,
     target_ulong /* const EGLint* */ attrib_list_)
 {
-    yagl_host_handle ret = 0;
+    bool res = true;
     EGLint *attrib_list = NULL;
     struct yagl_egl_display *dpy = NULL;
     struct yagl_egl_config *config = NULL;
@@ -1010,12 +1065,14 @@ yagl_host_handle yagl_host_eglCreateContext(yagl_host_handle dpy_,
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglCreateContext);
 
+    *retval = 0;
+
     if (attrib_list_) {
         attrib_list = yagl_mem_get_attrib_list(egl_api_ts->ts,
                                                attrib_list_);
 
         if (!attrib_list) {
-            YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+            res = false;
             goto out;
         }
     }
@@ -1077,7 +1134,7 @@ yagl_host_handle yagl_host_eglCreateContext(yagl_host_handle dpy_,
     yagl_egl_display_add_context(dpy, ctx);
     yagl_egl_context_release(ctx);
 
-    ret = ctx->res.handle;
+    *retval = ctx->res.handle;
 
 out:
     if (client_ctx) {
@@ -1088,18 +1145,20 @@ out:
     yagl_egl_config_release(config);
     g_free(attrib_list);
 
-    return ret;
+    return res;
 }
 
-EGLBoolean yagl_host_eglDestroyContext(yagl_host_handle dpy_,
+bool yagl_host_eglDestroyContext(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle ctx_)
 {
-    EGLBoolean ret = EGL_FALSE;
     struct yagl_egl_display *dpy = NULL;
     struct yagl_egl_context *ctx = NULL;
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglDestroyContext);
 
+    *retval = EGL_FALSE;
+
     if (!yagl_validate_display(dpy_, &dpy)) {
         goto out;
     }
@@ -1109,7 +1168,7 @@ EGLBoolean yagl_host_eglDestroyContext(yagl_host_handle dpy_,
     }
 
     if (yagl_egl_display_remove_context(dpy, ctx->res.handle)) {
-        ret = EGL_TRUE;
+        *retval = EGL_TRUE;
     } else {
         YAGL_SET_ERR(EGL_BAD_CONTEXT);
     }
@@ -1117,15 +1176,15 @@ EGLBoolean yagl_host_eglDestroyContext(yagl_host_handle dpy_,
 out:
     yagl_egl_context_release(ctx);
 
-    return ret;
+    return true;
 }
 
-EGLBoolean yagl_host_eglMakeCurrent(yagl_host_handle dpy_,
+bool yagl_host_eglMakeCurrent(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle draw_,
     yagl_host_handle read_,
     yagl_host_handle ctx_)
 {
-    EGLBoolean ret = EGL_FALSE;
     bool bad_match = ctx_ ? (!draw_ || !read_) : (draw_ || read_);
     bool release_context = !draw_ && !read_ && !ctx_;
     struct yagl_egl_display *dpy = NULL;
@@ -1136,6 +1195,8 @@ EGLBoolean yagl_host_eglMakeCurrent(yagl_host_handle dpy_,
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglMakeCurrent);
 
+    *retval = EGL_FALSE;
+
     if (bad_match) {
         YAGL_SET_ERR(EGL_BAD_MATCH);
         goto out;
@@ -1236,7 +1297,7 @@ EGLBoolean yagl_host_eglMakeCurrent(yagl_host_handle dpy_,
                    read_,
                    ctx_);
 
-    ret = EGL_TRUE;
+    *retval = EGL_TRUE;
 
 out:
     yagl_egl_surface_release(read);
@@ -1244,21 +1305,24 @@ out:
     yagl_egl_context_release(ctx);
     yagl_egl_context_release(prev_ctx);
 
-    return ret;
+    return true;
 }
 
-EGLBoolean yagl_host_eglQueryContext(yagl_host_handle dpy_,
+bool yagl_host_eglQueryContext(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle ctx_,
     EGLint attribute,
     target_ulong /* EGLint* */ value_)
 {
-    EGLBoolean ret = EGL_FALSE;
+    bool res = true;
     struct yagl_egl_display *dpy = NULL;
     struct yagl_egl_context *ctx = NULL;
     EGLint value = 0;
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglQueryContext);
 
+    *retval = EGL_FALSE;
+
     if (!yagl_validate_display(dpy_, &dpy)) {
         goto out;
     }
@@ -1327,37 +1391,50 @@ EGLBoolean yagl_host_eglQueryContext(yagl_host_handle dpy_,
         goto out;
     }
 
+    if (!yagl_mem_prepare_EGLint(egl_api_ts->ts->mt1, value_)) {
+        res = false;
+        goto out;
+    }
+
     if (value_) {
-        yagl_mem_put_EGLint(egl_api_ts->ts, value_, value);
+        yagl_mem_put_EGLint(egl_api_ts->ts->mt1, value);
     }
 
-    ret = EGL_TRUE;
+    *retval = EGL_TRUE;
 
 out:
     yagl_egl_context_release(ctx);
 
-    return ret;
+    return res;
 }
 
-EGLBoolean yagl_host_eglWaitGL(void)
+bool yagl_host_eglWaitGL(EGLBoolean* retval)
 {
-    EGLBoolean ret;
+    EGLBoolean tmp;
     EGLenum api = egl_api_ts->api;
-    yagl_host_eglBindAPI(EGL_OPENGL_ES_API);
-    ret = yagl_host_eglWaitClient();
-    yagl_host_eglBindAPI(api);
-    return ret;
+
+    if (!yagl_host_eglBindAPI(&tmp, EGL_OPENGL_ES_API)) {
+        return false;
+    }
+
+    if (!yagl_host_eglWaitClient(retval)) {
+        return false;
+    }
+
+    return yagl_host_eglBindAPI(&tmp, api);
 }
 
-EGLBoolean yagl_host_eglWaitNative(EGLint engine)
+bool yagl_host_eglWaitNative(EGLBoolean* retval,
+    EGLint engine)
 {
-    EGLBoolean ret = EGL_FALSE;
     struct yagl_egl_surface *sfc = NULL;
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglWaitNative);
 
+    *retval = EGL_FALSE;
+
     if (!egl_api_ts->context) {
-        ret = EGL_TRUE;
+        *retval = EGL_TRUE;
         goto out;
     }
 
@@ -1376,22 +1453,25 @@ EGLBoolean yagl_host_eglWaitNative(EGLint engine)
 
     egl_api_ts->driver_ps->wait_native(egl_api_ts->driver_ps);
 
-    ret = EGL_TRUE;
+    *retval = EGL_TRUE;
 
 out:
     yagl_egl_surface_release(sfc);
-    return ret;
+
+    return true;
 }
 
-EGLBoolean yagl_host_eglSwapBuffers(yagl_host_handle dpy_,
+bool yagl_host_eglSwapBuffers(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle surface_)
 {
-    EGLBoolean ret = EGL_FALSE;
     struct yagl_egl_display *dpy = NULL;
     struct yagl_egl_surface *surface = NULL;
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglSwapBuffers);
 
+    *retval = EGL_FALSE;
+
     if (!yagl_validate_display(dpy_, &dpy)) {
         goto out;
     }
@@ -1427,7 +1507,7 @@ EGLBoolean yagl_host_eglSwapBuffers(yagl_host_handle dpy_,
     if (surface->bimage_ct) {
         yagl_compiled_transfer_exec(surface->bimage_ct, surface->host_pixels);
 
-        ret = EGL_TRUE;
+        *retval = EGL_TRUE;
     } else {
         YAGL_LOG_ERROR("surface was destroyed, weird scenario!");
         YAGL_SET_ERR(EGL_BAD_SURFACE);
@@ -1438,19 +1518,21 @@ EGLBoolean yagl_host_eglSwapBuffers(yagl_host_handle dpy_,
 out:
     yagl_egl_surface_release(surface);
 
-    return ret;
+    return true;
 }
 
-EGLBoolean yagl_host_eglCopyBuffers(yagl_host_handle dpy_,
+bool yagl_host_eglCopyBuffers(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle surface_,
     EGLNativePixmapType target)
 {
-    EGLBoolean ret = EGL_FALSE;
     struct yagl_egl_display *dpy = NULL;
     struct yagl_egl_surface *surface = NULL;
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglCopyBuffers);
 
+    *retval = EGL_FALSE;
+
     if (!yagl_validate_display(dpy_, &dpy)) {
         goto out;
     }
@@ -1486,7 +1568,7 @@ EGLBoolean yagl_host_eglCopyBuffers(yagl_host_handle dpy_,
     if (surface->bimage_ct) {
         yagl_compiled_transfer_exec(surface->bimage_ct, surface->host_pixels);
 
-        ret = EGL_TRUE;
+        *retval = EGL_TRUE;
     } else {
         YAGL_LOG_ERROR("surface was destroyed, weird scenario!");
         YAGL_SET_ERR(EGL_BAD_SURFACE);
@@ -1497,10 +1579,11 @@ EGLBoolean yagl_host_eglCopyBuffers(yagl_host_handle dpy_,
 out:
     yagl_egl_surface_release(surface);
 
-    return ret;
+    return true;
 }
 
-yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle dpy_,
+bool yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle config_,
     uint32_t width,
     uint32_t height,
@@ -1508,7 +1591,7 @@ yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle
     target_ulong /* void* */ pixels_,
     target_ulong /* const EGLint* */ attrib_list_)
 {
-    yagl_host_handle ret = 0;
+    bool res = true;
     EGLint *attrib_list = NULL;
     struct yagl_compiled_transfer *bimage_ct = NULL;
     struct yagl_egl_window_attribs attribs;
@@ -1519,16 +1602,22 @@ yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglCreateWindowSurfaceOffscreenYAGL);
 
+    *retval = 0;
+
     if (attrib_list_) {
         attrib_list = yagl_mem_get_attrib_list(egl_api_ts->ts,
                                                attrib_list_);
 
         if (!attrib_list) {
-            YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+            res = false;
             goto out;
         }
     }
 
+    /*
+     * 'pixels_' are locked in target's memory, no page fault possible.
+     */
+
     bimage_ct = yagl_compiled_transfer_create(egl_api_ts->ts,
                                               pixels_,
                                               (width * height * bpp),
@@ -1584,7 +1673,7 @@ yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle
     yagl_egl_display_add_surface(dpy, surface);
     yagl_egl_surface_release(surface);
 
-    ret = surface->res.handle;
+    *retval = surface->res.handle;
 
 out:
     yagl_egl_config_release(config);
@@ -1593,10 +1682,11 @@ out:
     }
     g_free(attrib_list);
 
-    return ret;
+    return res;
 }
 
-yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle dpy_,
+bool yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle config_,
     uint32_t width,
     uint32_t height,
@@ -1604,7 +1694,7 @@ yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle
     target_ulong /* void* */ pixels_,
     target_ulong /* const EGLint* */ attrib_list_)
 {
-    yagl_host_handle ret = 0;
+    bool res = true;
     EGLint *attrib_list = NULL;
     struct yagl_compiled_transfer *bimage_ct = NULL;
     struct yagl_egl_pbuffer_attribs attribs;
@@ -1615,12 +1705,14 @@ yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglCreatePbufferSurfaceOffscreenYAGL);
 
+    *retval = 0;
+
     if (attrib_list_) {
         attrib_list = yagl_mem_get_attrib_list(egl_api_ts->ts,
                                                attrib_list_);
 
         if (!attrib_list) {
-            YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+            res = false;
             goto out;
         }
     }
@@ -1710,7 +1802,7 @@ yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle
     yagl_egl_display_add_surface(dpy, surface);
     yagl_egl_surface_release(surface);
 
-    ret = surface->res.handle;
+    *retval = surface->res.handle;
 
 out:
     yagl_egl_config_release(config);
@@ -1719,10 +1811,11 @@ out:
     }
     g_free(attrib_list);
 
-    return ret;
+    return res;
 }
 
-yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle dpy_,
+bool yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle config_,
     uint32_t width,
     uint32_t height,
@@ -1730,7 +1823,7 @@ yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle
     target_ulong /* void* */ pixels_,
     target_ulong /* const EGLint* */ attrib_list_)
 {
-    yagl_host_handle ret = 0;
+    bool res = true;
     EGLint *attrib_list = NULL;
     struct yagl_compiled_transfer *bimage_ct = NULL;
     struct yagl_egl_pixmap_attribs attribs;
@@ -1740,12 +1833,14 @@ yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglCreatePixmapSurfaceOffscreenYAGL);
 
+    *retval = 0;
+
     if (attrib_list_) {
         attrib_list = yagl_mem_get_attrib_list(egl_api_ts->ts,
                                                attrib_list_);
 
         if (!attrib_list) {
-            YAGL_SET_ERR(EGL_BAD_ATTRIBUTE);
+            res = false;
             goto out;
         }
     }
@@ -1796,7 +1891,7 @@ yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle
     yagl_egl_display_add_surface(dpy, surface);
     yagl_egl_surface_release(surface);
 
-    ret = surface->res.handle;
+    *retval = surface->res.handle;
 
 out:
     yagl_egl_config_release(config);
@@ -1805,17 +1900,17 @@ out:
     }
     g_free(attrib_list);
 
-    return ret;
+    return res;
 }
 
-EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy_,
+bool yagl_host_eglResizeOffscreenSurfaceYAGL(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle surface_,
     uint32_t width,
     uint32_t height,
     uint32_t bpp,
     target_ulong /* void* */ pixels_)
 {
-    EGLBoolean ret = EGL_FALSE;
     struct yagl_egl_display *dpy = NULL;
     struct yagl_egl_surface *surface = NULL;
     struct yagl_compiled_transfer *bimage_ct = NULL;
@@ -1825,6 +1920,8 @@ EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy_,
 
     YAGL_LOG_FUNC_SET_TS(egl_api_ts->ts, eglResizeOffscreenSurfaceYAGL);
 
+    *retval = EGL_FALSE;
+
     if (!yagl_validate_display(dpy_, &dpy)) {
         goto out;
     }
@@ -1916,7 +2013,7 @@ EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy_,
     native_sfc = EGL_NO_SURFACE;
     bimage_ct = NULL;
 
-    ret = EGL_TRUE;
+    *retval = EGL_TRUE;
 
     yagl_egl_surface_unlock(surface);
 
@@ -1931,5 +2028,5 @@ out:
     }
     yagl_egl_surface_release(surface);
 
-    return ret;
+    return true;
 }
index 8f2e488..8170619 100644 (file)
@@ -8,98 +8,116 @@ struct yagl_api_ps
     *yagl_host_egl_process_init(struct yagl_api *api,
                                 struct yagl_process_state *ps);
 
-EGLint yagl_host_eglGetError(void);
-yagl_host_handle yagl_host_eglGetDisplay(target_ulong /* Display* */ display_id);
-EGLBoolean yagl_host_eglInitialize(yagl_host_handle dpy_,
+bool yagl_host_eglGetError(EGLint* retval);
+bool yagl_host_eglGetDisplay(yagl_host_handle* retval,
+    target_ulong /* Display* */ display_id);
+bool yagl_host_eglInitialize(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     target_ulong /* EGLint* */ major,
     target_ulong /* EGLint* */ minor);
-EGLBoolean yagl_host_eglTerminate(yagl_host_handle dpy_);
-EGLBoolean yagl_host_eglGetConfigs(yagl_host_handle dpy_,
+bool yagl_host_eglTerminate(EGLBoolean* retval,
+    yagl_host_handle dpy_);
+bool yagl_host_eglGetConfigs(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     target_ulong /* EGLConfig^* */ configs_,
     EGLint config_size,
     target_ulong /* EGLint* */ num_config_);
-EGLBoolean yagl_host_eglChooseConfig(yagl_host_handle dpy_,
+bool yagl_host_eglChooseConfig(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     target_ulong /* const EGLint* */ attrib_list_,
     target_ulong /* EGLConfig^* */ configs_,
     EGLint config_size,
     target_ulong /* EGLint* */ num_config_);
-EGLBoolean yagl_host_eglGetConfigAttrib(yagl_host_handle dpy_,
+bool yagl_host_eglGetConfigAttrib(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle config_,
     EGLint attribute,
     target_ulong /* EGLint* */ value_);
-EGLBoolean yagl_host_eglDestroySurface(yagl_host_handle dpy_,
+bool yagl_host_eglDestroySurface(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle surface_);
-EGLBoolean yagl_host_eglQuerySurface(yagl_host_handle dpy_,
+bool yagl_host_eglQuerySurface(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle surface_,
     EGLint attribute,
     target_ulong /* EGLint* */ value_);
-EGLBoolean yagl_host_eglBindAPI(EGLenum api);
-EGLenum yagl_host_eglQueryAPI(void);
-EGLBoolean yagl_host_eglWaitClient(void);
-EGLBoolean yagl_host_eglReleaseThread(void);
-yagl_host_handle yagl_host_eglCreatePbufferFromClientBuffer(yagl_host_handle dpy,
+bool yagl_host_eglBindAPI(EGLBoolean* retval,
+    EGLenum api);
+bool yagl_host_eglWaitClient(EGLBoolean* retval);
+bool yagl_host_eglReleaseThread(EGLBoolean* retval);
+bool yagl_host_eglCreatePbufferFromClientBuffer(yagl_host_handle* retval,
+    yagl_host_handle dpy,
     EGLenum buftype,
     yagl_host_handle buffer,
     yagl_host_handle config,
     target_ulong /* const EGLint* */ attrib_list);
-EGLBoolean yagl_host_eglSurfaceAttrib(yagl_host_handle dpy_,
+bool yagl_host_eglSurfaceAttrib(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle surface_,
     EGLint attribute,
     EGLint value);
-EGLBoolean yagl_host_eglBindTexImage(yagl_host_handle dpy,
+bool yagl_host_eglBindTexImage(EGLBoolean* retval,
+    yagl_host_handle dpy,
     yagl_host_handle surface,
     EGLint buffer);
-EGLBoolean yagl_host_eglReleaseTexImage(yagl_host_handle dpy,
+bool yagl_host_eglReleaseTexImage(EGLBoolean* retval,
+    yagl_host_handle dpy,
     yagl_host_handle surface,
     EGLint buffer);
-EGLBoolean yagl_host_eglSwapInterval(yagl_host_handle dpy,
-    EGLint interval);
-yagl_host_handle yagl_host_eglCreateContext(yagl_host_handle dpy_,
+bool yagl_host_eglCreateContext(yagl_host_handle* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle config_,
     yagl_host_handle share_context_,
     target_ulong /* const EGLint* */ attrib_list_);
-EGLBoolean yagl_host_eglDestroyContext(yagl_host_handle dpy_,
+bool yagl_host_eglDestroyContext(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle ctx_);
-EGLBoolean yagl_host_eglMakeCurrent(yagl_host_handle dpy_,
+bool yagl_host_eglMakeCurrent(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle draw_,
     yagl_host_handle read_,
     yagl_host_handle ctx_);
-yagl_host_handle yagl_host_eglGetCurrentContext(void);
-yagl_host_handle yagl_host_eglGetCurrentSurface(EGLint readdraw);
-yagl_host_handle yagl_host_eglGetCurrentDisplay(void);
-EGLBoolean yagl_host_eglQueryContext(yagl_host_handle dpy_,
+bool yagl_host_eglQueryContext(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle ctx_,
     EGLint attribute,
     target_ulong /* EGLint* */ value_);
-EGLBoolean yagl_host_eglWaitGL(void);
-EGLBoolean yagl_host_eglWaitNative(EGLint engine);
-EGLBoolean yagl_host_eglSwapBuffers(yagl_host_handle dpy_,
+bool yagl_host_eglWaitGL(EGLBoolean* retval);
+bool yagl_host_eglWaitNative(EGLBoolean* retval,
+    EGLint engine);
+bool yagl_host_eglSwapBuffers(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle surface_);
-EGLBoolean yagl_host_eglCopyBuffers(yagl_host_handle dpy_,
+bool yagl_host_eglCopyBuffers(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle surface_,
     EGLNativePixmapType target);
-yagl_host_handle yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle dpy_,
+bool yagl_host_eglCreateWindowSurfaceOffscreenYAGL(yagl_host_handle* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle config_,
     uint32_t width,
     uint32_t height,
     uint32_t bpp,
     target_ulong /* void* */ pixels_,
     target_ulong /* const EGLint* */ attrib_list_);
-yagl_host_handle yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle dpy_,
+bool yagl_host_eglCreatePbufferSurfaceOffscreenYAGL(yagl_host_handle* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle config_,
     uint32_t width,
     uint32_t height,
     uint32_t bpp,
     target_ulong /* void* */ pixels_,
     target_ulong /* const EGLint* */ attrib_list_);
-yagl_host_handle yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle dpy_,
+bool yagl_host_eglCreatePixmapSurfaceOffscreenYAGL(yagl_host_handle* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle config_,
     uint32_t width,
     uint32_t height,
     uint32_t bpp,
     target_ulong /* void* */ pixels_,
     target_ulong /* const EGLint* */ attrib_list_);
-EGLBoolean yagl_host_eglResizeOffscreenSurfaceYAGL(yagl_host_handle dpy_,
+bool yagl_host_eglResizeOffscreenSurfaceYAGL(EGLBoolean* retval,
+    yagl_host_handle dpy_,
     yagl_host_handle surface_,
     uint32_t width,
     uint32_t height,
index f5941e1..22e73fc 100644 (file)
@@ -22,7 +22,7 @@
 YAGL_DECLARE_TLS(struct yagl_gles1_api_ts*, gles1_api_ts);
 YAGL_DECLARE_TLS(struct yagl_gles2_api_ts*, gles2_api_ts);
 
-#define YAGL_GET_CTX_RET(func, ret) \
+#define YAGL_GET_CTX_IMPL(func, ret_expr) \
     struct yagl_thread_state *ts = NULL; \
     struct yagl_gles_context *ctx = NULL; \
     if (gles2_api_ts) { \
@@ -40,20 +40,25 @@ YAGL_DECLARE_TLS(struct yagl_gles2_api_ts*, gles2_api_ts);
         ((ctx->base.client_api != yagl_client_api_gles1) && \
          (ctx->base.client_api != yagl_client_api_gles2))) { \
         YAGL_LOG_WARN("no current context"); \
-        return ret; \
+        ret_expr; \
+        return true; \
     } \
     (void)ts
 
-#define YAGL_GET_CTX(func) YAGL_GET_CTX_RET(func,)
+#define YAGL_GET_CTX_RET(func, ret) YAGL_GET_CTX_IMPL(func, *retval = ret)
+
+#define YAGL_GET_CTX(func) YAGL_GET_CTX_IMPL(func,)
 
 #define YAGL_UNIMPLEMENTED_RET(func, ret) \
     YAGL_GET_CTX_RET(func, ret); \
     YAGL_LOG_WARN("NOT IMPLEMENTED!!!"); \
-    return ret
+    *retval = ret; \
+    return true
 
 #define YAGL_UNIMPLEMENTED(func) \
     YAGL_GET_CTX(func); \
-    YAGL_LOG_WARN("NOT IMPLEMENTED!!!")
+    YAGL_LOG_WARN("NOT IMPLEMENTED!!!"); \
+    return true
 
 static __inline bool yagl_get_stride(struct yagl_gles_driver_ps *driver_ps,
                                      GLuint alignment_type,
@@ -139,17 +144,20 @@ static bool yagl_get_integer(struct yagl_gles_context *ctx,
     return true;
 }
 
-void yagl_host_glActiveTexture(GLenum texture)
+bool yagl_host_glActiveTexture(GLenum texture)
 {
     YAGL_GET_CTX(glActiveTexture);
 
-    if (!yagl_gles_context_set_active_texture(ctx, texture)) {
+    if (yagl_gles_context_set_active_texture(ctx, texture)) {
+        ctx->driver_ps->ActiveTexture(ctx->driver_ps, texture);
+    } else {
         YAGL_SET_ERR(GL_INVALID_ENUM);
     }
-    ctx->driver_ps->ActiveTexture(ctx->driver_ps, texture);
+
+    return true;
 }
 
-void yagl_host_glBindBuffer(GLenum target,
+bool yagl_host_glBindBuffer(GLenum target,
     GLuint buffer)
 {
     struct yagl_gles_buffer *buffer_obj = NULL;
@@ -183,9 +191,11 @@ void yagl_host_glBindBuffer(GLenum target,
 
 out:
     yagl_gles_buffer_release(buffer_obj);
+
+    return true;
 }
 
-void yagl_host_glBindTexture(GLenum target,
+bool yagl_host_glBindTexture(GLenum target,
     GLuint texture)
 {
     struct yagl_gles_texture *texture_obj = NULL;
@@ -225,21 +235,26 @@ void yagl_host_glBindTexture(GLenum target,
 
 out:
     yagl_gles_texture_release(texture_obj);
+
+    return true;
 }
 
-void yagl_host_glBlendFunc(GLenum sfactor,
+bool yagl_host_glBlendFunc(GLenum sfactor,
     GLenum dfactor)
 {
     YAGL_GET_CTX(glBlendFunc);
 
     ctx->driver_ps->BlendFunc(ctx->driver_ps, sfactor, dfactor);
+
+    return true;
 }
 
-void yagl_host_glBufferData(GLenum target,
+bool yagl_host_glBufferData(GLenum target,
     GLsizeiptr size,
     target_ulong /* const GLvoid* */ data_,
     GLenum usage)
 {
+    bool res = true;
     struct yagl_gles_buffer *buffer_obj = NULL;
     GLvoid *data = NULL;
 
@@ -273,7 +288,7 @@ void yagl_host_glBufferData(GLenum target,
                           data_,
                           size,
                           data)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -282,13 +297,16 @@ void yagl_host_glBufferData(GLenum target,
 
 out:
     yagl_gles_buffer_release(buffer_obj);
+
+    return res;
 }
 
-void yagl_host_glBufferSubData(GLenum target,
+bool yagl_host_glBufferSubData(GLenum target,
     GLintptr offset,
     GLsizeiptr size,
     target_ulong /* const GLvoid* */ data_)
 {
+    bool res = true;
     struct yagl_gles_buffer *buffer_obj = NULL;
     GLvoid *data = NULL;
 
@@ -320,7 +338,7 @@ void yagl_host_glBufferSubData(GLenum target,
                       data_,
                       size,
                       data)) {
-        YAGL_SET_ERR(GL_INVALID_VALUE);
+        res = false;
         goto out;
     }
 
@@ -331,16 +349,20 @@ void yagl_host_glBufferSubData(GLenum target,
 
 out:
     yagl_gles_buffer_release(buffer_obj);
+
+    return res;
 }
 
-void yagl_host_glClear(GLbitfield mask)
+bool yagl_host_glClear(GLbitfield mask)
 {
     YAGL_GET_CTX(glClear);
 
     ctx->driver_ps->Clear(ctx->driver_ps, mask);
+
+    return true;
 }
 
-void yagl_host_glClearColor(GLclampf red,
+bool yagl_host_glClearColor(GLclampf red,
     GLclampf green,
     GLclampf blue,
     GLclampf alpha)
@@ -348,23 +370,29 @@ void yagl_host_glClearColor(GLclampf red,
     YAGL_GET_CTX(glClearColor);
 
     ctx->driver_ps->ClearColor(ctx->driver_ps, red, green, blue, alpha);
+
+    return true;
 }
 
-void yagl_host_glClearDepthf(GLclampf depth)
+bool yagl_host_glClearDepthf(GLclampf depth)
 {
     YAGL_GET_CTX(glClearDepthf);
 
     ctx->driver_ps->ClearDepthf(ctx->driver_ps, depth);
+
+    return true;
 }
 
-void yagl_host_glClearStencil(GLint s)
+bool yagl_host_glClearStencil(GLint s)
 {
     YAGL_GET_CTX(glClearStencil);
 
     ctx->driver_ps->ClearStencil(ctx->driver_ps, s);
+
+    return true;
 }
 
-void yagl_host_glColorMask(GLboolean red,
+bool yagl_host_glColorMask(GLboolean red,
     GLboolean green,
     GLboolean blue,
     GLboolean alpha)
@@ -372,9 +400,11 @@ void yagl_host_glColorMask(GLboolean red,
     YAGL_GET_CTX(glColorMask);
 
     ctx->driver_ps->ColorMask(ctx->driver_ps, red, green, blue, alpha);
+
+    return true;
 }
 
-void yagl_host_glCompressedTexImage2D(GLenum target,
+bool yagl_host_glCompressedTexImage2D(GLenum target,
     GLint level,
     GLenum internalformat,
     GLsizei width,
@@ -383,6 +413,7 @@ void yagl_host_glCompressedTexImage2D(GLenum target,
     GLsizei imageSize,
     target_ulong /* const GLvoid* */ data_)
 {
+    bool res = true;
     GLvoid *data = NULL;
 
     YAGL_GET_CTX(glCompressedTexImage2D);
@@ -393,7 +424,7 @@ void yagl_host_glCompressedTexImage2D(GLenum target,
                           data_,
                           imageSize,
                           data)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -409,10 +440,10 @@ void yagl_host_glCompressedTexImage2D(GLenum target,
                                          data);
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glCompressedTexSubImage2D(GLenum target,
+bool yagl_host_glCompressedTexSubImage2D(GLenum target,
     GLint level,
     GLint xoffset,
     GLint yoffset,
@@ -422,6 +453,7 @@ void yagl_host_glCompressedTexSubImage2D(GLenum target,
     GLsizei imageSize,
     target_ulong /* const GLvoid* */ data_)
 {
+    bool res = true;
     GLvoid *data = NULL;
 
     YAGL_GET_CTX(glCompressedTexSubImage2D);
@@ -432,7 +464,7 @@ void yagl_host_glCompressedTexSubImage2D(GLenum target,
                           data_,
                           imageSize,
                           data)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -449,10 +481,10 @@ void yagl_host_glCompressedTexSubImage2D(GLenum target,
                                             data);
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glCopyTexImage2D(GLenum target,
+bool yagl_host_glCopyTexImage2D(GLenum target,
     GLint level,
     GLenum internalformat,
     GLint x,
@@ -472,9 +504,11 @@ void yagl_host_glCopyTexImage2D(GLenum target,
                                    width,
                                    height,
                                    border);
+
+    return true;
 }
 
-void yagl_host_glCopyTexSubImage2D(GLenum target,
+bool yagl_host_glCopyTexSubImage2D(GLenum target,
     GLint level,
     GLint xoffset,
     GLint yoffset,
@@ -494,18 +528,23 @@ void yagl_host_glCopyTexSubImage2D(GLenum target,
                                       y,
                                       width,
                                       height);
+
+    return true;
 }
 
-void yagl_host_glCullFace(GLenum mode)
+bool yagl_host_glCullFace(GLenum mode)
 {
     YAGL_GET_CTX(glCullFace);
 
     ctx->driver_ps->CullFace(ctx->driver_ps, mode);
+
+    return true;
 }
 
-void yagl_host_glDeleteBuffers(GLsizei n,
+bool yagl_host_glDeleteBuffers(GLsizei n,
     target_ulong /* const GLuint* */ buffers_)
 {
+    bool res = true;
     GLuint *buffer_names = NULL;
     GLsizei i;
     struct yagl_gles_buffer *buffer_obj = NULL;
@@ -524,7 +563,7 @@ void yagl_host_glDeleteBuffers(GLsizei n,
                           buffers_,
                           n * sizeof(*buffer_names),
                           buffer_names)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -547,12 +586,13 @@ void yagl_host_glDeleteBuffers(GLsizei n,
     }
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glDeleteTextures(GLsizei n,
+bool yagl_host_glDeleteTextures(GLsizei n,
     target_ulong /* const GLuint* */ textures_)
 {
+    bool res = true;
     GLuint *texture_names = NULL;
     GLsizei i;
 
@@ -570,7 +610,7 @@ void yagl_host_glDeleteTextures(GLsizei n,
                           textures_,
                           n * sizeof(*texture_names),
                           texture_names)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -587,39 +627,47 @@ void yagl_host_glDeleteTextures(GLsizei n,
     }
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glDepthFunc(GLenum func)
+bool yagl_host_glDepthFunc(GLenum func)
 {
     YAGL_GET_CTX(glDepthFunc);
 
     ctx->driver_ps->DepthFunc(ctx->driver_ps, func);
+
+    return true;
 }
 
-void yagl_host_glDepthMask(GLboolean flag)
+bool yagl_host_glDepthMask(GLboolean flag)
 {
     YAGL_GET_CTX(glDepthMask);
 
     ctx->driver_ps->DepthMask(ctx->driver_ps, flag);
+
+    return true;
 }
 
-void yagl_host_glDepthRangef(GLclampf zNear,
+bool yagl_host_glDepthRangef(GLclampf zNear,
     GLclampf zFar)
 {
     YAGL_GET_CTX(glDepthRangef);
 
     ctx->driver_ps->DepthRangef(ctx->driver_ps, zNear, zFar);
+
+    return true;
 }
 
-void yagl_host_glDisable(GLenum cap)
+bool yagl_host_glDisable(GLenum cap)
 {
     YAGL_GET_CTX(glEnable);
 
     ctx->driver_ps->Disable(ctx->driver_ps, cap);
+
+    return true;
 }
 
-void yagl_host_glDrawArrays(GLenum mode,
+bool yagl_host_glDrawArrays(GLenum mode,
     GLint first,
     GLsizei count)
 {
@@ -627,16 +675,15 @@ void yagl_host_glDrawArrays(GLenum mode,
 
     if ((first < 0) || (count < 0)) {
         YAGL_SET_ERR(GL_INVALID_VALUE);
-        return;
+        return true;
     }
 
     if (count == 0) {
-        return;
+        return true;
     }
 
     if (!yagl_gles_context_transfer_arrays(ctx, first, count)) {
-        YAGL_SET_ERR(GL_INVALID_VALUE);
-        return;
+        return false;
     }
 
     ctx->pre_draw(ctx, mode);
@@ -644,13 +691,20 @@ void yagl_host_glDrawArrays(GLenum mode,
     ctx->driver_ps->DrawArrays(ctx->driver_ps, mode, first, count);
 
     ctx->post_draw(ctx, mode);
+
+    return true;
 }
 
-void yagl_host_glDrawElements(GLenum mode,
+/*
+ * Be sure to support 'glGetVertexAttribRangeYAGL' together with
+ * this function.
+ */
+bool yagl_host_glDrawElements(GLenum mode,
     GLsizei count,
     GLenum type,
     target_ulong /* const GLvoid* */ indices_)
 {
+    bool res = true;
     GLvoid *indices = NULL;
     int index_size = 0;
     uint32_t first_idx = UINT32_MAX, last_idx = 0;
@@ -697,7 +751,7 @@ void yagl_host_glDrawElements(GLenum mode,
                               indices_,
                               index_size * count,
                               indices)) {
-                YAGL_SET_ERR(GL_INVALID_VALUE);
+                res = false;
                 goto out;
             }
         } else {
@@ -728,7 +782,7 @@ void yagl_host_glDrawElements(GLenum mode,
     }
 
     if (!yagl_gles_context_transfer_arrays(ctx, first_idx, (last_idx + 1 - first_idx))) {
-        YAGL_SET_ERR(GL_INVALID_VALUE);
+        res = false;
         goto out;
     }
 
@@ -748,45 +802,61 @@ out:
                                    GL_ELEMENT_ARRAY_BUFFER,
                                    old_buffer_name);
     }
+
+    return res;
 }
 
-void yagl_host_glEnable(GLenum cap)
+bool yagl_host_glEnable(GLenum cap)
 {
     YAGL_GET_CTX(glEnable);
 
     ctx->driver_ps->Enable(ctx->driver_ps, cap);
+
+    return true;
 }
 
-void yagl_host_glFinish(void)
+bool yagl_host_glFinish(void)
 {
     YAGL_GET_CTX(glFinish);
 
     ctx->driver_ps->Finish(ctx->driver_ps);
+
+    return true;
 }
 
-void yagl_host_glFlush(void)
+bool yagl_host_glFlush(void)
 {
     YAGL_GET_CTX(glFlush);
 
     ctx->driver_ps->Flush(ctx->driver_ps);
+
+    return true;
 }
 
-void yagl_host_glFrontFace(GLenum mode)
+bool yagl_host_glFrontFace(GLenum mode)
 {
     YAGL_GET_CTX(glFrontFace);
 
     ctx->driver_ps->FrontFace(ctx->driver_ps, mode);
+
+    return true;
 }
 
-void yagl_host_glGenBuffers(GLsizei n,
+bool yagl_host_glGenBuffers(GLsizei n,
     target_ulong /* GLuint* */ buffers_)
 {
+    bool res = true;
     struct yagl_gles_buffer **buffers = NULL;
     GLsizei i;
     GLuint *buffer_names = NULL;
 
     YAGL_GET_CTX(glGenBuffers);
 
+    if (!yagl_mem_prepare(ts->mt1, buffers_, n * sizeof(*buffer_names))) {
+        res = false;
+        goto out;
+    }
+
     buffers = g_malloc0(n * sizeof(*buffers));
 
     for (i = 0; i < n; ++i) {
@@ -806,11 +876,7 @@ void yagl_host_glGenBuffers(GLsizei n,
     }
 
     if (buffers_) {
-        for (i = 0; i < n; ++i) {
-            yagl_mem_put_GLuint(ts,
-                                buffers_ + (i * sizeof(GLuint)),
-                                buffer_names[i]);
-        }
+        yagl_mem_put(ts->mt1, buffer_names);
     }
 
 out:
@@ -819,17 +885,25 @@ out:
         yagl_gles_buffer_release(buffers[i]);
     }
     g_free(buffers);
+
+    return res;
 }
 
-void yagl_host_glGenTextures(GLsizei n,
+bool yagl_host_glGenTextures(GLsizei n,
     target_ulong /* GLuint* */ textures_)
 {
+    bool res = true;
     struct yagl_gles_texture **textures = NULL;
     GLsizei i;
     GLuint *texture_names = NULL;
 
     YAGL_GET_CTX(glGenTextures);
 
+    if (!yagl_mem_prepare(ts->mt1, textures_, n * sizeof(*texture_names))) {
+        res = false;
+        goto out;
+    }
+
     textures = g_malloc0(n * sizeof(*textures));
 
     for (i = 0; i < n; ++i) {
@@ -849,11 +923,7 @@ void yagl_host_glGenTextures(GLsizei n,
     }
 
     if (textures_) {
-        for (i = 0; i < n; ++i) {
-            yagl_mem_put_GLuint(ts,
-                                textures_ + (i * sizeof(GLuint)),
-                                texture_names[i]);
-        }
+        yagl_mem_put(ts->mt1, texture_names);
     }
 
 out:
@@ -862,12 +932,15 @@ out:
         yagl_gles_texture_release(textures[i]);
     }
     g_free(textures);
+
+    return res;
 }
 
-void yagl_host_glGetBooleanv(GLenum pname,
+bool yagl_host_glGetBooleanv(GLenum pname,
     target_ulong /* GLboolean* */ params_)
 {
-    int i, count = 0;
+    bool res = true;
+    int count = 0;
     GLboolean *params = NULL;
 
     YAGL_GET_CTX(glGetBooleanv);
@@ -878,6 +951,11 @@ void yagl_host_glGetBooleanv(GLenum pname,
         goto out;
     }
 
+    if (!yagl_mem_prepare(ts->mt1, params_, count * sizeof(*params))) {
+        res = false;
+        goto out;
+    }
+
     params = yagl_gles_context_malloc0(ctx, count * sizeof(*params));
 
     if (!ctx->get_booleanv(ctx, pname, params)) {
@@ -891,26 +969,28 @@ void yagl_host_glGetBooleanv(GLenum pname,
     }
 
     if (params_) {
-        for (i = 0; i < count; ++i) {
-            yagl_mem_put_GLboolean(ts,
-                                   params_ + (i * sizeof(*params)),
-                                   params[i]);
-        }
+        yagl_mem_put(ts->mt1, params);
     }
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glGetBufferParameteriv(GLenum target,
+bool yagl_host_glGetBufferParameteriv(GLenum target,
     GLenum pname,
     target_ulong /* GLint* */ params_)
 {
+    bool res = true;
     struct yagl_gles_buffer *buffer_obj = NULL;
     GLint param = 0;
 
     YAGL_GET_CTX(glGetBufferParameteriv);
 
+    if (!yagl_mem_prepare_GLint(ts->mt1, params_)) {
+        res = false;
+        goto out;
+    }
+
     if (!yagl_gles_is_buffer_target_valid(target)) {
         YAGL_SET_ERR(GL_INVALID_ENUM);
         goto out;
@@ -931,32 +1011,33 @@ void yagl_host_glGetBufferParameteriv(GLenum target,
     }
 
     if (params_) {
-        yagl_mem_put_GLint(ts, params_, param);
+        yagl_mem_put_GLint(ts->mt1, param);
     }
 
 out:
     yagl_gles_buffer_release(buffer_obj);
+
+    return res;
 }
 
-GLenum yagl_host_glGetError(void)
+bool yagl_host_glGetError(GLenum* retval)
 {
-    GLenum ret;
-
     YAGL_GET_CTX_RET(glGetError, GL_NO_ERROR);
 
-    ret = yagl_gles_context_get_error(ctx);
+    *retval = yagl_gles_context_get_error(ctx);
 
-    if (ret != GL_NO_ERROR) {
-        return ret;
+    if (*retval == GL_NO_ERROR) {
+        *retval = ctx->driver_ps->GetError(ctx->driver_ps);
     }
 
-    return ctx->driver_ps->GetError(ctx->driver_ps);
+    return true;
 }
 
-void yagl_host_glGetFloatv(GLenum pname,
+bool yagl_host_glGetFloatv(GLenum pname,
     target_ulong /* GLfloat* */ params_)
 {
-    int i, count = 0;
+    bool res = true;
+    int count = 0;
     GLfloat *params = NULL;
 
     YAGL_GET_CTX(glGetFloatv);
@@ -967,6 +1048,11 @@ void yagl_host_glGetFloatv(GLenum pname,
         goto out;
     }
 
+    if (!yagl_mem_prepare(ts->mt1, params_, count * sizeof(*params))) {
+        res = false;
+        goto out;
+    }
+
     params = yagl_gles_context_malloc0(ctx, count * sizeof(*params));
 
     if (!ctx->get_floatv(ctx, pname, params)) {
@@ -980,21 +1066,18 @@ void yagl_host_glGetFloatv(GLenum pname,
     }
 
     if (params_) {
-        for (i = 0; i < count; ++i) {
-            yagl_mem_put_GLfloat(ts,
-                                 params_ + (i * sizeof(*params)),
-                                 params[i]);
-        }
+        yagl_mem_put(ts->mt1, params);
     }
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glGetIntegerv(GLenum pname,
+bool yagl_host_glGetIntegerv(GLenum pname,
     target_ulong /* GLint* */ params_)
 {
-    int i, count = 0;
+    bool res = true;
+    int count = 0;
     GLint *params = NULL;
 
     YAGL_GET_CTX(glGetIntegerv);
@@ -1005,6 +1088,11 @@ void yagl_host_glGetIntegerv(GLenum pname,
         goto out;
     }
 
+    if (!yagl_mem_prepare(ts->mt1, params_, count * sizeof(*params))) {
+        res = false;
+        goto out;
+    }
+
     params = yagl_gles_context_malloc0(ctx, count * sizeof(*params));
 
     if (!ctx->get_integerv(ctx, pname, params)) {
@@ -1014,18 +1102,14 @@ void yagl_host_glGetIntegerv(GLenum pname,
     }
 
     if (params_) {
-        for (i = 0; i < count; ++i) {
-            yagl_mem_put_GLuint(ts,
-                                params_ + (i * sizeof(*params)),
-                                params[i]);
-        }
+        yagl_mem_put(ts->mt1, params);
     }
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glGetTexParameterfv(GLenum target,
+bool yagl_host_glGetTexParameterfv(GLenum target,
     GLenum pname,
     target_ulong /* GLfloat* */ params_)
 {
@@ -1033,17 +1117,23 @@ void yagl_host_glGetTexParameterfv(GLenum target,
 
     YAGL_GET_CTX(glGetTexParameterfv);
 
+    if (!yagl_mem_prepare_GLfloat(ts->mt1, params_)) {
+        return false;
+    }
+
     ctx->driver_ps->GetTexParameterfv(ctx->driver_ps,
                                       target,
                                       pname,
                                       params);
 
     if (params_) {
-        yagl_mem_put_GLfloat(ts, params_, params[0]);
+        yagl_mem_put_GLfloat(ts->mt1, params[0]);
     }
+
+    return true;
 }
 
-void yagl_host_glGetTexParameteriv(GLenum target,
+bool yagl_host_glGetTexParameteriv(GLenum target,
     GLenum pname,
     target_ulong /* GLint* */ params_)
 {
@@ -1051,92 +1141,111 @@ void yagl_host_glGetTexParameteriv(GLenum target,
 
     YAGL_GET_CTX(glGetTexParameteriv);
 
+    if (!yagl_mem_prepare_GLint(ts->mt1, params_)) {
+        return false;
+    }
+
     ctx->driver_ps->GetTexParameteriv(ctx->driver_ps,
                                       target,
                                       pname,
                                       params);
 
     if (params_) {
-        yagl_mem_put_GLint(ts, params_, params[0]);
+        yagl_mem_put_GLint(ts->mt1, params[0]);
     }
+
+    return true;
 }
 
-void yagl_host_glHint(GLenum target,
+bool yagl_host_glHint(GLenum target,
     GLenum mode)
 {
     YAGL_GET_CTX(glHint);
 
     ctx->driver_ps->Hint(ctx->driver_ps, target, mode);
+
+    return true;
 }
 
-GLboolean yagl_host_glIsBuffer(GLuint buffer)
+bool yagl_host_glIsBuffer(GLboolean* retval, GLuint buffer)
 {
     struct yagl_gles_buffer *buffer_obj = NULL;
-    GLboolean ret = GL_FALSE;
 
     YAGL_GET_CTX_RET(glIsBuffer, GL_FALSE);
 
+    *retval = GL_FALSE;
+
     buffer_obj = (struct yagl_gles_buffer*)yagl_sharegroup_acquire_object(ctx->base.sg,
         YAGL_NS_BUFFER, buffer);
 
     if (buffer_obj && yagl_gles_buffer_was_bound(buffer_obj)) {
-        ret = GL_TRUE;
+        *retval = GL_TRUE;
     }
 
     yagl_gles_buffer_release(buffer_obj);
 
-    return ret;
+    return true;
 }
 
-GLboolean yagl_host_glIsEnabled(GLenum cap)
+bool yagl_host_glIsEnabled(GLboolean* retval, GLenum cap)
 {
     YAGL_GET_CTX_RET(glIsEnabled, GL_FALSE);
-    return ctx->driver_ps->IsEnabled(ctx->driver_ps, cap);
+
+    *retval = ctx->driver_ps->IsEnabled(ctx->driver_ps, cap);
+
+    return true;
 }
 
-GLboolean yagl_host_glIsTexture(GLuint texture)
+bool yagl_host_glIsTexture(GLboolean* retval, GLuint texture)
 {
     struct yagl_gles_texture *texture_obj = NULL;
-    GLboolean ret = GL_FALSE;
 
     YAGL_GET_CTX_RET(glIsTexture, GL_FALSE);
 
+    *retval = GL_FALSE;
+
     texture_obj = (struct yagl_gles_texture*)yagl_sharegroup_acquire_object(ctx->base.sg,
         YAGL_NS_TEXTURE, texture);
 
     if (texture_obj && (yagl_gles_texture_get_target(texture_obj) != 0)) {
-        ret = GL_TRUE;
+        *retval = GL_TRUE;
     }
 
     yagl_gles_texture_release(texture_obj);
 
-    return ret;
+    return true;
 }
 
-void yagl_host_glLineWidth(GLfloat width)
+bool yagl_host_glLineWidth(GLfloat width)
 {
     YAGL_GET_CTX(glLineWidth);
 
     ctx->driver_ps->LineWidth(ctx->driver_ps, width);
+
+    return true;
 }
 
-void yagl_host_glPixelStorei(GLenum pname,
+bool yagl_host_glPixelStorei(GLenum pname,
     GLint param)
 {
     YAGL_GET_CTX(glPixelStorei);
 
     ctx->driver_ps->PixelStorei(ctx->driver_ps, pname, param);
+
+    return true;
 }
 
-void yagl_host_glPolygonOffset(GLfloat factor,
+bool yagl_host_glPolygonOffset(GLfloat factor,
     GLfloat units)
 {
     YAGL_GET_CTX(glPolygonOffset);
 
     ctx->driver_ps->PolygonOffset(ctx->driver_ps, factor, units);
+
+    return true;
 }
 
-void yagl_host_glReadPixels(GLint x,
+bool yagl_host_glReadPixels(GLint x,
     GLint y,
     GLsizei width,
     GLsizei height,
@@ -1144,6 +1253,7 @@ void yagl_host_glReadPixels(GLint x,
     GLenum type,
     target_ulong /* GLvoid* */ pixels_)
 {
+    bool res = true;
     yagl_object_name current_pbo = 0;
     GLvoid *pixels = NULL;
     GLsizei stride = 0;
@@ -1160,6 +1270,10 @@ void yagl_host_glReadPixels(GLint x,
             YAGL_SET_ERR(GL_INVALID_VALUE);
             goto out;
         }
+        if (!yagl_mem_prepare(ts->mt1, pixels_, stride * height)) {
+            res = false;
+            goto out;
+        }
         pixels = yagl_gles_context_malloc(ctx, stride * height);
         ctx->driver_ps->GetIntegerv(ctx->driver_ps,
                                     GL_PIXEL_PACK_BUFFER_BINDING_ARB,
@@ -1185,22 +1299,24 @@ void yagl_host_glReadPixels(GLint x,
                                        current_pbo);
         }
 
-        yagl_mem_put(ts, pixels_, stride * height, pixels);
+        yagl_mem_put(ts->mt1, pixels);
     }
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glSampleCoverage(GLclampf value,
+bool yagl_host_glSampleCoverage(GLclampf value,
     GLboolean invert)
 {
     YAGL_GET_CTX(glSampleCoverage);
 
     ctx->driver_ps->SampleCoverage(ctx->driver_ps, value, invert);
+
+    return true;
 }
 
-void yagl_host_glScissor(GLint x,
+bool yagl_host_glScissor(GLint x,
     GLint y,
     GLsizei width,
     GLsizei height)
@@ -1208,34 +1324,42 @@ void yagl_host_glScissor(GLint x,
     YAGL_GET_CTX(glScissor);
 
     ctx->driver_ps->Scissor(ctx->driver_ps, x, y, width, height);
+
+    return true;
 }
 
-void yagl_host_glStencilFunc(GLenum func,
+bool yagl_host_glStencilFunc(GLenum func,
     GLint ref,
     GLuint mask)
 {
     YAGL_GET_CTX(glStencilFunc);
 
     ctx->driver_ps->StencilFunc(ctx->driver_ps, func, ref, mask);
+
+    return true;
 }
 
-void yagl_host_glStencilMask(GLuint mask)
+bool yagl_host_glStencilMask(GLuint mask)
 {
     YAGL_GET_CTX(glStencilMask);
 
     ctx->driver_ps->StencilMask(ctx->driver_ps, mask);
+
+    return true;
 }
 
-void yagl_host_glStencilOp(GLenum fail,
+bool yagl_host_glStencilOp(GLenum fail,
     GLenum zfail,
     GLenum zpass)
 {
     YAGL_GET_CTX(glStencilOp);
 
     ctx->driver_ps->StencilOp(ctx->driver_ps, fail, zfail, zpass);
+
+    return true;
 }
 
-void yagl_host_glTexImage2D(GLenum target,
+bool yagl_host_glTexImage2D(GLenum target,
     GLint level,
     GLint internalformat,
     GLsizei width,
@@ -1245,6 +1369,7 @@ void yagl_host_glTexImage2D(GLenum target,
     GLenum type,
     target_ulong /* const GLvoid* */ pixels_)
 {
+    bool res = true;
     GLvoid *pixels = NULL;
     GLsizei stride = 0;
 
@@ -1265,7 +1390,7 @@ void yagl_host_glTexImage2D(GLenum target,
                           pixels_,
                           stride * height,
                           pixels)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1282,22 +1407,25 @@ void yagl_host_glTexImage2D(GLenum target,
                                pixels);
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glTexParameterf(GLenum target,
+bool yagl_host_glTexParameterf(GLenum target,
     GLenum pname,
     GLfloat param)
 {
     YAGL_GET_CTX(glTexParameterf);
 
     ctx->driver_ps->TexParameterf(ctx->driver_ps, target, pname, param);
+
+    return true;
 }
 
-void yagl_host_glTexParameterfv(GLenum target,
+bool yagl_host_glTexParameterfv(GLenum target,
     GLenum pname,
     target_ulong /* const GLfloat* */ params_)
 {
+    bool res = true;
     GLfloat params[10];
 
     YAGL_GET_CTX(glTexParameterfv);
@@ -1306,7 +1434,7 @@ void yagl_host_glTexParameterfv(GLenum target,
 
     if (params_) {
         if (!yagl_mem_get_GLfloat(ts, params_, params)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1317,22 +1445,25 @@ void yagl_host_glTexParameterfv(GLenum target,
                                    (params_ ? params : NULL));
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glTexParameteri(GLenum target,
+bool yagl_host_glTexParameteri(GLenum target,
     GLenum pname,
     GLint param)
 {
     YAGL_GET_CTX(glTexParameteri);
 
     ctx->driver_ps->TexParameteri(ctx->driver_ps, target, pname, param);
+
+    return true;
 }
 
-void yagl_host_glTexParameteriv(GLenum target,
+bool yagl_host_glTexParameteriv(GLenum target,
     GLenum pname,
     target_ulong /* const GLint* */ params_)
 {
+    bool res = true;
     GLint params[10];
 
     YAGL_GET_CTX(glTexParameteriv);
@@ -1341,7 +1472,7 @@ void yagl_host_glTexParameteriv(GLenum target,
 
     if (params_) {
         if (!yagl_mem_get_GLint(ts, params_, params)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1352,10 +1483,10 @@ void yagl_host_glTexParameteriv(GLenum target,
                                    (params_ ? params : NULL));
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glTexSubImage2D(GLenum target,
+bool yagl_host_glTexSubImage2D(GLenum target,
     GLint level,
     GLint xoffset,
     GLint yoffset,
@@ -1365,6 +1496,7 @@ void yagl_host_glTexSubImage2D(GLenum target,
     GLenum type,
     target_ulong /* const GLvoid* */ pixels_)
 {
+    bool res = true;
     GLvoid *pixels = NULL;
     GLsizei stride = 0;
 
@@ -1385,7 +1517,7 @@ void yagl_host_glTexSubImage2D(GLenum target,
                           pixels_,
                           stride * height,
                           pixels)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1402,10 +1534,10 @@ void yagl_host_glTexSubImage2D(GLenum target,
                                   pixels);
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glViewport(GLint x,
+bool yagl_host_glViewport(GLint x,
     GLint y,
     GLsizei width,
     GLsizei height)
@@ -1413,11 +1545,14 @@ void yagl_host_glViewport(GLint x,
     YAGL_GET_CTX(glViewport);
 
     ctx->driver_ps->Viewport(ctx->driver_ps, x, y, width, height);
+
+    return true;
 }
 
-GLuint yagl_host_glGetExtensionStringYAGL(target_ulong /* GLchar* */ str_)
+bool yagl_host_glGetExtensionStringYAGL(GLuint* retval, target_ulong /* GLchar* */ str_)
 {
-    GLchar *str;
+    bool res = true;
+    GLchar *str = NULL;
     GLuint str_len;
 
     YAGL_GET_CTX_RET(glGetExtensionStringYAGL, 1);
@@ -1426,21 +1561,30 @@ GLuint yagl_host_glGetExtensionStringYAGL(target_ulong /* GLchar* */ str_)
 
     str_len = strlen(str);
 
+    if (!yagl_mem_prepare(ts->mt1, str_, str_len + 1)) {
+        res = false;
+        goto out;
+    }
+
     if (str_) {
-        yagl_mem_put(ts, str_, str_len + 1, str);
+        yagl_mem_put(ts->mt1, str);
     }
 
+    *retval = str_len + 1;
+
+out:
     g_free(str);
 
-    return str_len + 1;
+    return res;
 }
 
-void yagl_host_glEGLImageTargetTexture2DYAGL(GLenum target,
+bool yagl_host_glEGLImageTargetTexture2DYAGL(GLenum target,
     uint32_t width,
     uint32_t height,
     uint32_t bpp,
     target_ulong /* const void* */ pixels_)
 {
+    bool res = true;
     void *pixels = NULL;
     GLenum format = 0;
     GLsizei unpack_alignment = 0;
@@ -1453,7 +1597,7 @@ void yagl_host_glEGLImageTargetTexture2DYAGL(GLenum target,
                           pixels_,
                           width * height * bpp,
                           pixels)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1494,5 +1638,86 @@ void yagl_host_glEGLImageTargetTexture2DYAGL(GLenum target,
                                 unpack_alignment);
 
 out:
-    (void)0;
+    return res;
+}
+
+bool yagl_host_glGetVertexAttribRangeYAGL(GLsizei count,
+    GLenum type,
+    target_ulong /* const GLvoid* */ indices_,
+    target_ulong /* GLint* */ range_first_,
+    target_ulong /* GLsizei* */ range_count_)
+{
+    bool res = true;
+    GLvoid *indices = NULL;
+    int index_size = 0;
+    uint32_t first_idx = UINT32_MAX, last_idx = 0;
+    int i;
+
+    YAGL_GET_CTX(glGetVertexAttribRangesYAGL);
+
+    if (!yagl_mem_prepare_GLint(ts->mt1, range_first_) ||
+        !yagl_mem_prepare_GLsizei(ts->mt2, range_count_)) {
+        res = false;
+        goto out;
+    }
+
+    if (ctx->ebo) {
+        if (!yagl_gles_buffer_get_minmax_index(ctx->ebo,
+                                               type,
+                                               indices_,
+                                               count,
+                                               &first_idx,
+                                               &last_idx)) {
+            goto out;
+        }
+    } else {
+        if (!yagl_gles_get_index_size(type, &index_size)) {
+            goto out;
+        }
+
+        if (indices_) {
+            indices = yagl_gles_context_malloc0(ctx, index_size * count);
+            if (!yagl_mem_get(ts,
+                              indices_,
+                              index_size * count,
+                              indices)) {
+                res = false;
+                goto out;
+            }
+        } else {
+            goto out;
+        }
+
+        for (i = 0; i < count; ++i) {
+            uint32_t idx = 0;
+            switch (type) {
+            case GL_UNSIGNED_BYTE:
+                idx = ((uint8_t*)indices)[i];
+                break;
+            case GL_UNSIGNED_SHORT:
+                idx = ((uint16_t*)indices)[i];
+                break;
+            default:
+                assert(0);
+                break;
+            }
+            if (idx < first_idx) {
+                first_idx = idx;
+            }
+            if (idx > last_idx) {
+                last_idx = idx;
+            }
+        }
+    }
+
+    if (range_first_) {
+        yagl_mem_put_GLint(ts->mt1, (GLint)first_idx);
+    }
+
+    if (range_count_) {
+        yagl_mem_put_GLsizei(ts->mt2, (GLsizei)(last_idx + 1 - first_idx));
+    }
+
+out:
+    return res;
 }
index fc33259..e39a65e 100644 (file)
@@ -3,33 +3,33 @@
 
 #include "yagl_api.h"
 
-void yagl_host_glActiveTexture(GLenum texture);
-void yagl_host_glBindBuffer(GLenum target,
+bool yagl_host_glActiveTexture(GLenum texture);
+bool yagl_host_glBindBuffer(GLenum target,
     GLuint buffer);
-void yagl_host_glBindTexture(GLenum target,
+bool yagl_host_glBindTexture(GLenum target,
     GLuint texture);
-void yagl_host_glBlendFunc(GLenum sfactor,
+bool yagl_host_glBlendFunc(GLenum sfactor,
     GLenum dfactor);
-void yagl_host_glBufferData(GLenum target,
+bool yagl_host_glBufferData(GLenum target,
     GLsizeiptr size,
     target_ulong /* const GLvoid* */ data_,
     GLenum usage);
-void yagl_host_glBufferSubData(GLenum target,
+bool yagl_host_glBufferSubData(GLenum target,
     GLintptr offset,
     GLsizeiptr size,
     target_ulong /* const GLvoid* */ data_);
-void yagl_host_glClear(GLbitfield mask);
-void yagl_host_glClearColor(GLclampf red,
+bool yagl_host_glClear(GLbitfield mask);
+bool yagl_host_glClearColor(GLclampf red,
     GLclampf green,
     GLclampf blue,
     GLclampf alpha);
-void yagl_host_glClearDepthf(GLclampf depth);
-void yagl_host_glClearStencil(GLint s);
-void yagl_host_glColorMask(GLboolean red,
+bool yagl_host_glClearDepthf(GLclampf depth);
+bool yagl_host_glClearStencil(GLint s);
+bool yagl_host_glColorMask(GLboolean red,
     GLboolean green,
     GLboolean blue,
     GLboolean alpha);
-void yagl_host_glCompressedTexImage2D(GLenum target,
+bool yagl_host_glCompressedTexImage2D(GLenum target,
     GLint level,
     GLenum internalformat,
     GLsizei width,
@@ -37,7 +37,7 @@ void yagl_host_glCompressedTexImage2D(GLenum target,
     GLint border,
     GLsizei imageSize,
     target_ulong /* const GLvoid* */ data_);
-void yagl_host_glCompressedTexSubImage2D(GLenum target,
+bool yagl_host_glCompressedTexSubImage2D(GLenum target,
     GLint level,
     GLint xoffset,
     GLint yoffset,
@@ -46,7 +46,7 @@ void yagl_host_glCompressedTexSubImage2D(GLenum target,
     GLenum format,
     GLsizei imageSize,
     target_ulong /* const GLvoid* */ data_);
-void yagl_host_glCopyTexImage2D(GLenum target,
+bool yagl_host_glCopyTexImage2D(GLenum target,
     GLint level,
     GLenum internalformat,
     GLint x,
@@ -54,7 +54,7 @@ void yagl_host_glCopyTexImage2D(GLenum target,
     GLsizei width,
     GLsizei height,
     GLint border);
-void yagl_host_glCopyTexSubImage2D(GLenum target,
+bool yagl_host_glCopyTexSubImage2D(GLenum target,
     GLint level,
     GLint xoffset,
     GLint yoffset,
@@ -62,78 +62,78 @@ void yagl_host_glCopyTexSubImage2D(GLenum target,
     GLint y,
     GLsizei width,
     GLsizei height);
-void yagl_host_glCullFace(GLenum mode);
-void yagl_host_glDeleteBuffers(GLsizei n,
+bool yagl_host_glCullFace(GLenum mode);
+bool yagl_host_glDeleteBuffers(GLsizei n,
     target_ulong /* const GLuint* */ buffers_);
-void yagl_host_glDeleteTextures(GLsizei n,
+bool yagl_host_glDeleteTextures(GLsizei n,
     target_ulong /* const GLuint* */ textures_);
-void yagl_host_glDepthFunc(GLenum func);
-void yagl_host_glDepthMask(GLboolean flag);
-void yagl_host_glDepthRangef(GLclampf zNear,
+bool yagl_host_glDepthFunc(GLenum func);
+bool yagl_host_glDepthMask(GLboolean flag);
+bool yagl_host_glDepthRangef(GLclampf zNear,
     GLclampf zFar);
-void yagl_host_glDisable(GLenum cap);
-void yagl_host_glDrawArrays(GLenum mode,
+bool yagl_host_glDisable(GLenum cap);
+bool yagl_host_glDrawArrays(GLenum mode,
     GLint first,
     GLsizei count);
-void yagl_host_glDrawElements(GLenum mode,
+bool yagl_host_glDrawElements(GLenum mode,
     GLsizei count,
     GLenum type,
     target_ulong /* const GLvoid* */ indices_);
-void yagl_host_glEnable(GLenum cap);
-void yagl_host_glFinish(void);
-void yagl_host_glFlush(void);
-void yagl_host_glFrontFace(GLenum mode);
-void yagl_host_glGenBuffers(GLsizei n,
+bool yagl_host_glEnable(GLenum cap);
+bool yagl_host_glFinish(void);
+bool yagl_host_glFlush(void);
+bool yagl_host_glFrontFace(GLenum mode);
+bool yagl_host_glGenBuffers(GLsizei n,
     target_ulong /* GLuint* */ buffers_);
-void yagl_host_glGenTextures(GLsizei n,
+bool yagl_host_glGenTextures(GLsizei n,
     target_ulong /* GLuint* */ textures_);
-void yagl_host_glGetBooleanv(GLenum pname,
+bool yagl_host_glGetBooleanv(GLenum pname,
     target_ulong /* GLboolean* */ params_);
-void yagl_host_glGetBufferParameteriv(GLenum target,
+bool yagl_host_glGetBufferParameteriv(GLenum target,
     GLenum pname,
     target_ulong /* GLint* */ params_);
-GLenum yagl_host_glGetError(void);
-void yagl_host_glGetFloatv(GLenum pname,
+bool yagl_host_glGetError(GLenum* retval);
+bool yagl_host_glGetFloatv(GLenum pname,
     target_ulong /* GLfloat* */ params_);
-void yagl_host_glGetIntegerv(GLenum pname,
+bool yagl_host_glGetIntegerv(GLenum pname,
     target_ulong /* GLint* */ params_);
-void yagl_host_glGetTexParameterfv(GLenum target,
+bool yagl_host_glGetTexParameterfv(GLenum target,
     GLenum pname,
     target_ulong /* GLfloat* */ params_);
-void yagl_host_glGetTexParameteriv(GLenum target,
+bool yagl_host_glGetTexParameteriv(GLenum target,
     GLenum pname,
     target_ulong /* GLint* */ params_);
-void yagl_host_glHint(GLenum target,
+bool yagl_host_glHint(GLenum target,
     GLenum mode);
-GLboolean yagl_host_glIsBuffer(GLuint buffer);
-GLboolean yagl_host_glIsEnabled(GLenum cap);
-GLboolean yagl_host_glIsTexture(GLuint texture);
-void yagl_host_glLineWidth(GLfloat width);
-void yagl_host_glPixelStorei(GLenum pname,
+bool yagl_host_glIsBuffer(GLboolean* retval, GLuint buffer);
+bool yagl_host_glIsEnabled(GLboolean* retval, GLenum cap);
+bool yagl_host_glIsTexture(GLboolean* retval, GLuint texture);
+bool yagl_host_glLineWidth(GLfloat width);
+bool yagl_host_glPixelStorei(GLenum pname,
     GLint param);
-void yagl_host_glPolygonOffset(GLfloat factor,
+bool yagl_host_glPolygonOffset(GLfloat factor,
     GLfloat units);
-void yagl_host_glReadPixels(GLint x,
+bool yagl_host_glReadPixels(GLint x,
     GLint y,
     GLsizei width,
     GLsizei height,
     GLenum format,
     GLenum type,
     target_ulong /* GLvoid* */ pixels_);
-void yagl_host_glSampleCoverage(GLclampf value,
+bool yagl_host_glSampleCoverage(GLclampf value,
     GLboolean invert);
-void yagl_host_glScissor(GLint x,
+bool yagl_host_glScissor(GLint x,
     GLint y,
     GLsizei width,
     GLsizei height);
-void yagl_host_glStencilFunc(GLenum func,
+bool yagl_host_glStencilFunc(GLenum func,
     GLint ref,
     GLuint mask);
-void yagl_host_glStencilMask(GLuint mask);
-void yagl_host_glStencilOp(GLenum fail,
+bool yagl_host_glStencilMask(GLuint mask);
+bool yagl_host_glStencilOp(GLenum fail,
     GLenum zfail,
     GLenum zpass);
-void yagl_host_glTexImage2D(GLenum target,
+bool yagl_host_glTexImage2D(GLenum target,
     GLint level,
     GLint internalformat,
     GLsizei width,
@@ -142,19 +142,19 @@ void yagl_host_glTexImage2D(GLenum target,
     GLenum format,
     GLenum type,
     target_ulong /* const GLvoid* */ pixels_);
-void yagl_host_glTexParameterf(GLenum target,
+bool yagl_host_glTexParameterf(GLenum target,
     GLenum pname,
     GLfloat param);
-void yagl_host_glTexParameterfv(GLenum target,
+bool yagl_host_glTexParameterfv(GLenum target,
     GLenum pname,
     target_ulong /* const GLfloat* */ params_);
-void yagl_host_glTexParameteri(GLenum target,
+bool yagl_host_glTexParameteri(GLenum target,
     GLenum pname,
     GLint param);
-void yagl_host_glTexParameteriv(GLenum target,
+bool yagl_host_glTexParameteriv(GLenum target,
     GLenum pname,
     target_ulong /* const GLint* */ params_);
-void yagl_host_glTexSubImage2D(GLenum target,
+bool yagl_host_glTexSubImage2D(GLenum target,
     GLint level,
     GLint xoffset,
     GLint yoffset,
@@ -163,15 +163,20 @@ void yagl_host_glTexSubImage2D(GLenum target,
     GLenum format,
     GLenum type,
     target_ulong /* const GLvoid* */ pixels_);
-void yagl_host_glViewport(GLint x,
+bool yagl_host_glViewport(GLint x,
     GLint y,
     GLsizei width,
     GLsizei height);
-GLuint yagl_host_glGetExtensionStringYAGL(target_ulong /* GLchar* */ str_);
-void yagl_host_glEGLImageTargetTexture2DYAGL(GLenum target,
+bool yagl_host_glGetExtensionStringYAGL(GLuint* retval, target_ulong /* GLchar* */ str_);
+bool yagl_host_glEGLImageTargetTexture2DYAGL(GLenum target,
     uint32_t width,
     uint32_t height,
     uint32_t bpp,
     target_ulong /* const void* */ pixels_);
+bool yagl_host_glGetVertexAttribRangeYAGL(GLsizei count,
+    GLenum type,
+    target_ulong /* const GLvoid* */ indices_,
+    target_ulong /* GLint* */ range_first_,
+    target_ulong /* GLsizei* */ range_count_);
 
 #endif
index 08d3054..fa6e65f 100644 (file)
 /*
  * glAlphaFunc dispatcher. id = 1
  */
-static uint8_t* yagl_func_glAlphaFunc(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glAlphaFunc(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum func = yagl_marshal_get_GLenum(&out_buff);
-    GLclampf ref = yagl_marshal_get_GLclampf(&out_buff);
+    GLenum func = yagl_marshal_get_GLenum(out_buff);
+    GLclampf ref = yagl_marshal_get_GLclampf(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glAlphaFunc, GLenum, GLclampf, func, ref);
-    yagl_host_glAlphaFunc(func, ref);
+    bool res = yagl_host_glAlphaFunc(func, ref);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glClearColor dispatcher. id = 2
  */
-static uint8_t* yagl_func_glClearColor(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glClearColor(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLclampf red = yagl_marshal_get_GLclampf(&out_buff);
-    GLclampf green = yagl_marshal_get_GLclampf(&out_buff);
-    GLclampf blue = yagl_marshal_get_GLclampf(&out_buff);
-    GLclampf alpha = yagl_marshal_get_GLclampf(&out_buff);
+    GLclampf red = yagl_marshal_get_GLclampf(out_buff);
+    GLclampf green = yagl_marshal_get_GLclampf(out_buff);
+    GLclampf blue = yagl_marshal_get_GLclampf(out_buff);
+    GLclampf alpha = yagl_marshal_get_GLclampf(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glClearColor, GLclampf, GLclampf, GLclampf, GLclampf, red, green, blue, alpha);
-    yagl_host_glClearColor(red, green, blue, alpha);
+    bool res = yagl_host_glClearColor(red, green, blue, alpha);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glClearDepthf dispatcher. id = 3
  */
-static uint8_t* yagl_func_glClearDepthf(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glClearDepthf(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLclampf depth = yagl_marshal_get_GLclampf(&out_buff);
+    GLclampf depth = yagl_marshal_get_GLclampf(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glClearDepthf, GLclampf, depth);
-    yagl_host_glClearDepthf(depth);
+    bool res = yagl_host_glClearDepthf(depth);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glClipPlanef dispatcher. id = 4
  */
-static uint8_t* yagl_func_glClipPlanef(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glClipPlanef(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum plane = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong equation = yagl_marshal_get_ptr(&out_buff);
+    GLenum plane = yagl_marshal_get_GLenum(out_buff);
+    target_ulong equation = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glClipPlanef, GLenum, target_ulong, plane, equation);
-    yagl_host_glClipPlanef(plane, equation);
+    bool res = yagl_host_glClipPlanef(plane, equation);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glColor4f dispatcher. id = 5
  */
-static uint8_t* yagl_func_glColor4f(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glColor4f(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfloat red = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat green = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat blue = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat alpha = yagl_marshal_get_GLfloat(&out_buff);
+    GLfloat red = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat green = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat blue = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat alpha = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glColor4f, GLfloat, GLfloat, GLfloat, GLfloat, red, green, blue, alpha);
-    yagl_host_glColor4f(red, green, blue, alpha);
+    bool res = yagl_host_glColor4f(red, green, blue, alpha);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDepthRangef dispatcher. id = 6
  */
-static uint8_t* yagl_func_glDepthRangef(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDepthRangef(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLclampf zNear = yagl_marshal_get_GLclampf(&out_buff);
-    GLclampf zFar = yagl_marshal_get_GLclampf(&out_buff);
+    GLclampf zNear = yagl_marshal_get_GLclampf(out_buff);
+    GLclampf zFar = yagl_marshal_get_GLclampf(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glDepthRangef, GLclampf, GLclampf, zNear, zFar);
-    yagl_host_glDepthRangef(zNear, zFar);
+    bool res = yagl_host_glDepthRangef(zNear, zFar);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glFogf dispatcher. id = 7
  */
-static uint8_t* yagl_func_glFogf(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glFogf(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLfloat param = yagl_marshal_get_GLfloat(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLfloat param = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glFogf, GLenum, GLfloat, pname, param);
-    yagl_host_glFogf(pname, param);
+    bool res = yagl_host_glFogf(pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glFogfv dispatcher. id = 8
  */
-static uint8_t* yagl_func_glFogfv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glFogfv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glFogfv, GLenum, target_ulong, pname, params);
-    yagl_host_glFogfv(pname, params);
+    bool res = yagl_host_glFogfv(pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glFrustumf dispatcher. id = 9
  */
-static uint8_t* yagl_func_glFrustumf(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glFrustumf(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfloat left = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat right = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat bottom = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat top = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat zNear = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat zFar = yagl_marshal_get_GLfloat(&out_buff);
+    GLfloat left = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat right = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat bottom = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat top = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat zNear = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat zFar = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT6(ts->ps->id, ts->id, glFrustumf, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, left, right, bottom, top, zNear, zFar);
-    yagl_host_glFrustumf(left, right, bottom, top, zNear, zFar);
+    bool res = yagl_host_glFrustumf(left, right, bottom, top, zNear, zFar);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetClipPlanef dispatcher. id = 10
  */
-static uint8_t* yagl_func_glGetClipPlanef(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetClipPlanef(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong eqn = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong eqn = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGetClipPlanef, GLenum, target_ulong, pname, eqn);
-    yagl_host_glGetClipPlanef(pname, eqn);
+    bool res = yagl_host_glGetClipPlanef(pname, eqn);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetFloatv dispatcher. id = 11
  */
-static uint8_t* yagl_func_glGetFloatv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetFloatv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGetFloatv, GLenum, target_ulong, pname, params);
-    yagl_host_glGetFloatv(pname, params);
+    bool res = yagl_host_glGetFloatv(pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetLightfv dispatcher. id = 12
  */
-static uint8_t* yagl_func_glGetLightfv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetLightfv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum light = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum light = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetLightfv, GLenum, GLenum, target_ulong, light, pname, params);
-    yagl_host_glGetLightfv(light, pname, params);
+    bool res = yagl_host_glGetLightfv(light, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetMaterialfv dispatcher. id = 13
  */
-static uint8_t* yagl_func_glGetMaterialfv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetMaterialfv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum face = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum face = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetMaterialfv, GLenum, GLenum, target_ulong, face, pname, params);
-    yagl_host_glGetMaterialfv(face, pname, params);
+    bool res = yagl_host_glGetMaterialfv(face, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetTexEnvfv dispatcher. id = 14
  */
-static uint8_t* yagl_func_glGetTexEnvfv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetTexEnvfv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum env = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum env = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetTexEnvfv, GLenum, GLenum, target_ulong, env, pname, params);
-    yagl_host_glGetTexEnvfv(env, pname, params);
+    bool res = yagl_host_glGetTexEnvfv(env, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetTexParameterfv dispatcher. id = 15
  */
-static uint8_t* yagl_func_glGetTexParameterfv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetTexParameterfv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetTexParameterfv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glGetTexParameterfv(target, pname, params);
+    bool res = yagl_host_glGetTexParameterfv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glLightModelf dispatcher. id = 16
  */
-static uint8_t* yagl_func_glLightModelf(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLightModelf(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLfloat param = yagl_marshal_get_GLfloat(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLfloat param = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glLightModelf, GLenum, GLfloat, pname, param);
-    yagl_host_glLightModelf(pname, param);
+    bool res = yagl_host_glLightModelf(pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glLightModelfv dispatcher. id = 17
  */
-static uint8_t* yagl_func_glLightModelfv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLightModelfv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glLightModelfv, GLenum, target_ulong, pname, params);
-    yagl_host_glLightModelfv(pname, params);
+    bool res = yagl_host_glLightModelfv(pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glLightf dispatcher. id = 18
  */
-static uint8_t* yagl_func_glLightf(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLightf(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum light = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLfloat param = yagl_marshal_get_GLfloat(&out_buff);
+    GLenum light = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLfloat param = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glLightf, GLenum, GLenum, GLfloat, light, pname, param);
-    yagl_host_glLightf(light, pname, param);
+    bool res = yagl_host_glLightf(light, pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glLightfv dispatcher. id = 19
  */
-static uint8_t* yagl_func_glLightfv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLightfv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum light = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum light = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glLightfv, GLenum, GLenum, target_ulong, light, pname, params);
-    yagl_host_glLightfv(light, pname, params);
+    bool res = yagl_host_glLightfv(light, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glLineWidth dispatcher. id = 20
  */
-static uint8_t* yagl_func_glLineWidth(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLineWidth(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfloat width = yagl_marshal_get_GLfloat(&out_buff);
+    GLfloat width = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glLineWidth, GLfloat, width);
-    yagl_host_glLineWidth(width);
+    bool res = yagl_host_glLineWidth(width);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glLoadMatrixf dispatcher. id = 21
  */
-static uint8_t* yagl_func_glLoadMatrixf(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLoadMatrixf(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    target_ulong m = yagl_marshal_get_ptr(&out_buff);
+    target_ulong m = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glLoadMatrixf, target_ulong, m);
-    yagl_host_glLoadMatrixf(m);
+    bool res = yagl_host_glLoadMatrixf(m);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glMaterialf dispatcher. id = 22
  */
-static uint8_t* yagl_func_glMaterialf(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glMaterialf(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum face = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLfloat param = yagl_marshal_get_GLfloat(&out_buff);
+    GLenum face = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLfloat param = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glMaterialf, GLenum, GLenum, GLfloat, face, pname, param);
-    yagl_host_glMaterialf(face, pname, param);
+    bool res = yagl_host_glMaterialf(face, pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glMaterialfv dispatcher. id = 23
  */
-static uint8_t* yagl_func_glMaterialfv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glMaterialfv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum face = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum face = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glMaterialfv, GLenum, GLenum, target_ulong, face, pname, params);
-    yagl_host_glMaterialfv(face, pname, params);
+    bool res = yagl_host_glMaterialfv(face, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glMultMatrixf dispatcher. id = 24
  */
-static uint8_t* yagl_func_glMultMatrixf(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glMultMatrixf(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    target_ulong m = yagl_marshal_get_ptr(&out_buff);
+    target_ulong m = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glMultMatrixf, target_ulong, m);
-    yagl_host_glMultMatrixf(m);
+    bool res = yagl_host_glMultMatrixf(m);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glMultiTexCoord4f dispatcher. id = 25
  */
-static uint8_t* yagl_func_glMultiTexCoord4f(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glMultiTexCoord4f(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLfloat s = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat t = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat r = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat q = yagl_marshal_get_GLfloat(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLfloat s = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat t = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat r = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat q = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT5(ts->ps->id, ts->id, glMultiTexCoord4f, GLenum, GLfloat, GLfloat, GLfloat, GLfloat, target, s, t, r, q);
-    yagl_host_glMultiTexCoord4f(target, s, t, r, q);
+    bool res = yagl_host_glMultiTexCoord4f(target, s, t, r, q);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glNormal3f dispatcher. id = 26
  */
-static uint8_t* yagl_func_glNormal3f(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glNormal3f(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfloat nx = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat ny = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat nz = yagl_marshal_get_GLfloat(&out_buff);
+    GLfloat nx = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat ny = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat nz = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glNormal3f, GLfloat, GLfloat, GLfloat, nx, ny, nz);
-    yagl_host_glNormal3f(nx, ny, nz);
+    bool res = yagl_host_glNormal3f(nx, ny, nz);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glOrthof dispatcher. id = 27
  */
-static uint8_t* yagl_func_glOrthof(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glOrthof(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfloat left = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat right = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat bottom = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat top = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat zNear = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat zFar = yagl_marshal_get_GLfloat(&out_buff);
+    GLfloat left = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat right = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat bottom = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat top = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat zNear = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat zFar = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT6(ts->ps->id, ts->id, glOrthof, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, left, right, bottom, top, zNear, zFar);
-    yagl_host_glOrthof(left, right, bottom, top, zNear, zFar);
+    bool res = yagl_host_glOrthof(left, right, bottom, top, zNear, zFar);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glPointParameterf dispatcher. id = 28
  */
-static uint8_t* yagl_func_glPointParameterf(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glPointParameterf(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLfloat param = yagl_marshal_get_GLfloat(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLfloat param = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glPointParameterf, GLenum, GLfloat, pname, param);
-    yagl_host_glPointParameterf(pname, param);
+    bool res = yagl_host_glPointParameterf(pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glPointParameterfv dispatcher. id = 29
  */
-static uint8_t* yagl_func_glPointParameterfv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glPointParameterfv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glPointParameterfv, GLenum, target_ulong, pname, params);
-    yagl_host_glPointParameterfv(pname, params);
+    bool res = yagl_host_glPointParameterfv(pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glPointSize dispatcher. id = 30
  */
-static uint8_t* yagl_func_glPointSize(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glPointSize(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfloat size = yagl_marshal_get_GLfloat(&out_buff);
+    GLfloat size = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glPointSize, GLfloat, size);
-    yagl_host_glPointSize(size);
+    bool res = yagl_host_glPointSize(size);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glPolygonOffset dispatcher. id = 31
  */
-static uint8_t* yagl_func_glPolygonOffset(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glPolygonOffset(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfloat factor = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat units = yagl_marshal_get_GLfloat(&out_buff);
+    GLfloat factor = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat units = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glPolygonOffset, GLfloat, GLfloat, factor, units);
-    yagl_host_glPolygonOffset(factor, units);
+    bool res = yagl_host_glPolygonOffset(factor, units);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glRotatef dispatcher. id = 32
  */
-static uint8_t* yagl_func_glRotatef(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glRotatef(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfloat angle = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat x = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat y = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat z = yagl_marshal_get_GLfloat(&out_buff);
+    GLfloat angle = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat x = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat y = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat z = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glRotatef, GLfloat, GLfloat, GLfloat, GLfloat, angle, x, y, z);
-    yagl_host_glRotatef(angle, x, y, z);
+    bool res = yagl_host_glRotatef(angle, x, y, z);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glScalef dispatcher. id = 33
  */
-static uint8_t* yagl_func_glScalef(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glScalef(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfloat x = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat y = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat z = yagl_marshal_get_GLfloat(&out_buff);
+    GLfloat x = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat y = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat z = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glScalef, GLfloat, GLfloat, GLfloat, x, y, z);
-    yagl_host_glScalef(x, y, z);
+    bool res = yagl_host_glScalef(x, y, z);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexEnvf dispatcher. id = 34
  */
-static uint8_t* yagl_func_glTexEnvf(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexEnvf(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLfloat param = yagl_marshal_get_GLfloat(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLfloat param = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexEnvf, GLenum, GLenum, GLfloat, target, pname, param);
-    yagl_host_glTexEnvf(target, pname, param);
+    bool res = yagl_host_glTexEnvf(target, pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexEnvfv dispatcher. id = 35
  */
-static uint8_t* yagl_func_glTexEnvfv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexEnvfv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexEnvfv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glTexEnvfv(target, pname, params);
+    bool res = yagl_host_glTexEnvfv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexParameterf dispatcher. id = 36
  */
-static uint8_t* yagl_func_glTexParameterf(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexParameterf(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLfloat param = yagl_marshal_get_GLfloat(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLfloat param = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexParameterf, GLenum, GLenum, GLfloat, target, pname, param);
-    yagl_host_glTexParameterf(target, pname, param);
+    bool res = yagl_host_glTexParameterf(target, pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexParameterfv dispatcher. id = 37
  */
-static uint8_t* yagl_func_glTexParameterfv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexParameterfv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexParameterfv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glTexParameterfv(target, pname, params);
+    bool res = yagl_host_glTexParameterfv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTranslatef dispatcher. id = 38
  */
-static uint8_t* yagl_func_glTranslatef(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTranslatef(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfloat x = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat y = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat z = yagl_marshal_get_GLfloat(&out_buff);
+    GLfloat x = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat y = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat z = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTranslatef, GLfloat, GLfloat, GLfloat, x, y, z);
-    yagl_host_glTranslatef(x, y, z);
+    bool res = yagl_host_glTranslatef(x, y, z);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glActiveTexture dispatcher. id = 39
  */
-static uint8_t* yagl_func_glActiveTexture(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glActiveTexture(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum texture = yagl_marshal_get_GLenum(&out_buff);
+    GLenum texture = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glActiveTexture, GLenum, texture);
-    yagl_host_glActiveTexture(texture);
+    bool res = yagl_host_glActiveTexture(texture);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glAlphaFuncx dispatcher. id = 40
  */
-static uint8_t* yagl_func_glAlphaFuncx(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glAlphaFuncx(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum func = yagl_marshal_get_GLenum(&out_buff);
-    GLclampx ref = yagl_marshal_get_GLclampx(&out_buff);
+    GLenum func = yagl_marshal_get_GLenum(out_buff);
+    GLclampx ref = yagl_marshal_get_GLclampx(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glAlphaFuncx, GLenum, GLclampx, func, ref);
-    yagl_host_glAlphaFuncx(func, ref);
+    bool res = yagl_host_glAlphaFuncx(func, ref);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBindBuffer dispatcher. id = 41
  */
-static uint8_t* yagl_func_glBindBuffer(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBindBuffer(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLuint buffer = yagl_marshal_get_GLuint(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLuint buffer = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glBindBuffer, GLenum, GLuint, target, buffer);
-    yagl_host_glBindBuffer(target, buffer);
+    bool res = yagl_host_glBindBuffer(target, buffer);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBindTexture dispatcher. id = 42
  */
-static uint8_t* yagl_func_glBindTexture(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBindTexture(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLuint texture = yagl_marshal_get_GLuint(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLuint texture = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glBindTexture, GLenum, GLuint, target, texture);
-    yagl_host_glBindTexture(target, texture);
+    bool res = yagl_host_glBindTexture(target, texture);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBlendFunc dispatcher. id = 43
  */
-static uint8_t* yagl_func_glBlendFunc(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBlendFunc(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum sfactor = yagl_marshal_get_GLenum(&out_buff);
-    GLenum dfactor = yagl_marshal_get_GLenum(&out_buff);
+    GLenum sfactor = yagl_marshal_get_GLenum(out_buff);
+    GLenum dfactor = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glBlendFunc, GLenum, GLenum, sfactor, dfactor);
-    yagl_host_glBlendFunc(sfactor, dfactor);
+    bool res = yagl_host_glBlendFunc(sfactor, dfactor);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBufferData dispatcher. id = 44
  */
-static uint8_t* yagl_func_glBufferData(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBufferData(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLsizeiptr size = yagl_marshal_get_GLsizeiptr(&out_buff);
-    target_ulong data = yagl_marshal_get_ptr(&out_buff);
-    GLenum usage = yagl_marshal_get_GLenum(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLsizeiptr size = yagl_marshal_get_GLsizeiptr(out_buff);
+    target_ulong data = yagl_marshal_get_ptr(out_buff);
+    GLenum usage = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glBufferData, GLenum, GLsizeiptr, target_ulong, GLenum, target, size, data, usage);
-    yagl_host_glBufferData(target, size, data, usage);
+    bool res = yagl_host_glBufferData(target, size, data, usage);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBufferSubData dispatcher. id = 45
  */
-static uint8_t* yagl_func_glBufferSubData(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBufferSubData(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLintptr offset = yagl_marshal_get_GLintptr(&out_buff);
-    GLsizeiptr size = yagl_marshal_get_GLsizeiptr(&out_buff);
-    target_ulong data = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLintptr offset = yagl_marshal_get_GLintptr(out_buff);
+    GLsizeiptr size = yagl_marshal_get_GLsizeiptr(out_buff);
+    target_ulong data = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glBufferSubData, GLenum, GLintptr, GLsizeiptr, target_ulong, target, offset, size, data);
-    yagl_host_glBufferSubData(target, offset, size, data);
+    bool res = yagl_host_glBufferSubData(target, offset, size, data);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glClear dispatcher. id = 46
  */
-static uint8_t* yagl_func_glClear(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glClear(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLbitfield mask = yagl_marshal_get_GLbitfield(&out_buff);
+    GLbitfield mask = yagl_marshal_get_GLbitfield(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glClear, GLbitfield, mask);
-    yagl_host_glClear(mask);
+    bool res = yagl_host_glClear(mask);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glClearColorx dispatcher. id = 47
  */
-static uint8_t* yagl_func_glClearColorx(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glClearColorx(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLclampx red = yagl_marshal_get_GLclampx(&out_buff);
-    GLclampx green = yagl_marshal_get_GLclampx(&out_buff);
-    GLclampx blue = yagl_marshal_get_GLclampx(&out_buff);
-    GLclampx alpha = yagl_marshal_get_GLclampx(&out_buff);
+    GLclampx red = yagl_marshal_get_GLclampx(out_buff);
+    GLclampx green = yagl_marshal_get_GLclampx(out_buff);
+    GLclampx blue = yagl_marshal_get_GLclampx(out_buff);
+    GLclampx alpha = yagl_marshal_get_GLclampx(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glClearColorx, GLclampx, GLclampx, GLclampx, GLclampx, red, green, blue, alpha);
-    yagl_host_glClearColorx(red, green, blue, alpha);
+    bool res = yagl_host_glClearColorx(red, green, blue, alpha);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glClearDepthx dispatcher. id = 48
  */
-static uint8_t* yagl_func_glClearDepthx(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glClearDepthx(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLclampx depth = yagl_marshal_get_GLclampx(&out_buff);
+    GLclampx depth = yagl_marshal_get_GLclampx(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glClearDepthx, GLclampx, depth);
-    yagl_host_glClearDepthx(depth);
+    bool res = yagl_host_glClearDepthx(depth);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glClearStencil dispatcher. id = 49
  */
-static uint8_t* yagl_func_glClearStencil(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glClearStencil(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint s = yagl_marshal_get_GLint(&out_buff);
+    GLint s = yagl_marshal_get_GLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glClearStencil, GLint, s);
-    yagl_host_glClearStencil(s);
+    bool res = yagl_host_glClearStencil(s);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glClientActiveTexture dispatcher. id = 50
  */
-static uint8_t* yagl_func_glClientActiveTexture(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glClientActiveTexture(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum texture = yagl_marshal_get_GLenum(&out_buff);
+    GLenum texture = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glClientActiveTexture, GLenum, texture);
-    yagl_host_glClientActiveTexture(texture);
+    bool res = yagl_host_glClientActiveTexture(texture);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glClipPlanex dispatcher. id = 51
  */
-static uint8_t* yagl_func_glClipPlanex(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glClipPlanex(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum plane = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong equation = yagl_marshal_get_ptr(&out_buff);
+    GLenum plane = yagl_marshal_get_GLenum(out_buff);
+    target_ulong equation = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glClipPlanex, GLenum, target_ulong, plane, equation);
-    yagl_host_glClipPlanex(plane, equation);
+    bool res = yagl_host_glClipPlanex(plane, equation);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glColor4ub dispatcher. id = 52
  */
-static uint8_t* yagl_func_glColor4ub(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glColor4ub(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLubyte red = yagl_marshal_get_GLubyte(&out_buff);
-    GLubyte green = yagl_marshal_get_GLubyte(&out_buff);
-    GLubyte blue = yagl_marshal_get_GLubyte(&out_buff);
-    GLubyte alpha = yagl_marshal_get_GLubyte(&out_buff);
+    GLubyte red = yagl_marshal_get_GLubyte(out_buff);
+    GLubyte green = yagl_marshal_get_GLubyte(out_buff);
+    GLubyte blue = yagl_marshal_get_GLubyte(out_buff);
+    GLubyte alpha = yagl_marshal_get_GLubyte(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glColor4ub, GLubyte, GLubyte, GLubyte, GLubyte, red, green, blue, alpha);
-    yagl_host_glColor4ub(red, green, blue, alpha);
+    bool res = yagl_host_glColor4ub(red, green, blue, alpha);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glColor4x dispatcher. id = 53
  */
-static uint8_t* yagl_func_glColor4x(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glColor4x(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfixed red = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed green = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed blue = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed alpha = yagl_marshal_get_GLfixed(&out_buff);
+    GLfixed red = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed green = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed blue = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed alpha = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glColor4x, GLfixed, GLfixed, GLfixed, GLfixed, red, green, blue, alpha);
-    yagl_host_glColor4x(red, green, blue, alpha);
+    bool res = yagl_host_glColor4x(red, green, blue, alpha);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glColorMask dispatcher. id = 54
  */
-static uint8_t* yagl_func_glColorMask(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glColorMask(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLboolean red = yagl_marshal_get_GLboolean(&out_buff);
-    GLboolean green = yagl_marshal_get_GLboolean(&out_buff);
-    GLboolean blue = yagl_marshal_get_GLboolean(&out_buff);
-    GLboolean alpha = yagl_marshal_get_GLboolean(&out_buff);
+    GLboolean red = yagl_marshal_get_GLboolean(out_buff);
+    GLboolean green = yagl_marshal_get_GLboolean(out_buff);
+    GLboolean blue = yagl_marshal_get_GLboolean(out_buff);
+    GLboolean alpha = yagl_marshal_get_GLboolean(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glColorMask, GLboolean, GLboolean, GLboolean, GLboolean, red, green, blue, alpha);
-    yagl_host_glColorMask(red, green, blue, alpha);
+    bool res = yagl_host_glColorMask(red, green, blue, alpha);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glColorPointer dispatcher. id = 55
  */
-static uint8_t* yagl_func_glColorPointer(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glColorPointer(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint size = yagl_marshal_get_GLint(&out_buff);
-    GLenum type = yagl_marshal_get_GLenum(&out_buff);
-    GLsizei stride = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong pointer = yagl_marshal_get_ptr(&out_buff);
+    GLint size = yagl_marshal_get_GLint(out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
+    GLsizei stride = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong pointer = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glColorPointer, GLint, GLenum, GLsizei, target_ulong, size, type, stride, pointer);
-    yagl_host_glColorPointer(size, type, stride, pointer);
+    bool res = yagl_host_glColorPointer(size, type, stride, pointer);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glCompressedTexImage2D dispatcher. id = 56
  */
-static uint8_t* yagl_func_glCompressedTexImage2D(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glCompressedTexImage2D(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLint level = yagl_marshal_get_GLint(&out_buff);
-    GLenum internalformat = yagl_marshal_get_GLenum(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
-    GLint border = yagl_marshal_get_GLint(&out_buff);
-    GLsizei imageSize = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong data = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLint level = yagl_marshal_get_GLint(out_buff);
+    GLenum internalformat = yagl_marshal_get_GLenum(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
+    GLint border = yagl_marshal_get_GLint(out_buff);
+    GLsizei imageSize = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong data = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT8(ts->ps->id, ts->id, glCompressedTexImage2D, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, target_ulong, target, level, internalformat, width, height, border, imageSize, data);
-    yagl_host_glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
+    bool res = yagl_host_glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glCompressedTexSubImage2D dispatcher. id = 57
  */
-static uint8_t* yagl_func_glCompressedTexSubImage2D(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glCompressedTexSubImage2D(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLint level = yagl_marshal_get_GLint(&out_buff);
-    GLint xoffset = yagl_marshal_get_GLint(&out_buff);
-    GLint yoffset = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
-    GLenum format = yagl_marshal_get_GLenum(&out_buff);
-    GLsizei imageSize = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong data = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLint level = yagl_marshal_get_GLint(out_buff);
+    GLint xoffset = yagl_marshal_get_GLint(out_buff);
+    GLint yoffset = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
+    GLenum format = yagl_marshal_get_GLenum(out_buff);
+    GLsizei imageSize = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong data = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT9(ts->ps->id, ts->id, glCompressedTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, target_ulong, target, level, xoffset, yoffset, width, height, format, imageSize, data);
-    yagl_host_glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
+    bool res = yagl_host_glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glCopyTexImage2D dispatcher. id = 58
  */
-static uint8_t* yagl_func_glCopyTexImage2D(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glCopyTexImage2D(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLint level = yagl_marshal_get_GLint(&out_buff);
-    GLenum internalformat = yagl_marshal_get_GLenum(&out_buff);
-    GLint x = yagl_marshal_get_GLint(&out_buff);
-    GLint y = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
-    GLint border = yagl_marshal_get_GLint(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLint level = yagl_marshal_get_GLint(out_buff);
+    GLenum internalformat = yagl_marshal_get_GLenum(out_buff);
+    GLint x = yagl_marshal_get_GLint(out_buff);
+    GLint y = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
+    GLint border = yagl_marshal_get_GLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT8(ts->ps->id, ts->id, glCopyTexImage2D, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, target, level, internalformat, x, y, width, height, border);
-    yagl_host_glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
+    bool res = yagl_host_glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glCopyTexSubImage2D dispatcher. id = 59
  */
-static uint8_t* yagl_func_glCopyTexSubImage2D(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glCopyTexSubImage2D(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLint level = yagl_marshal_get_GLint(&out_buff);
-    GLint xoffset = yagl_marshal_get_GLint(&out_buff);
-    GLint yoffset = yagl_marshal_get_GLint(&out_buff);
-    GLint x = yagl_marshal_get_GLint(&out_buff);
-    GLint y = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLint level = yagl_marshal_get_GLint(out_buff);
+    GLint xoffset = yagl_marshal_get_GLint(out_buff);
+    GLint yoffset = yagl_marshal_get_GLint(out_buff);
+    GLint x = yagl_marshal_get_GLint(out_buff);
+    GLint y = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT8(ts->ps->id, ts->id, glCopyTexSubImage2D, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, target, level, xoffset, yoffset, x, y, width, height);
-    yagl_host_glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
+    bool res = yagl_host_glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glCullFace dispatcher. id = 60
  */
-static uint8_t* yagl_func_glCullFace(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glCullFace(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum mode = yagl_marshal_get_GLenum(&out_buff);
+    GLenum mode = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glCullFace, GLenum, mode);
-    yagl_host_glCullFace(mode);
+    bool res = yagl_host_glCullFace(mode);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDeleteBuffers dispatcher. id = 61
  */
-static uint8_t* yagl_func_glDeleteBuffers(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDeleteBuffers(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLsizei n = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong buffers = yagl_marshal_get_ptr(&out_buff);
+    GLsizei n = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong buffers = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glDeleteBuffers, GLsizei, target_ulong, n, buffers);
-    yagl_host_glDeleteBuffers(n, buffers);
+    bool res = yagl_host_glDeleteBuffers(n, buffers);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDeleteTextures dispatcher. id = 62
  */
-static uint8_t* yagl_func_glDeleteTextures(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDeleteTextures(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLsizei n = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong textures = yagl_marshal_get_ptr(&out_buff);
+    GLsizei n = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong textures = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glDeleteTextures, GLsizei, target_ulong, n, textures);
-    yagl_host_glDeleteTextures(n, textures);
+    bool res = yagl_host_glDeleteTextures(n, textures);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDepthFunc dispatcher. id = 63
  */
-static uint8_t* yagl_func_glDepthFunc(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDepthFunc(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum func = yagl_marshal_get_GLenum(&out_buff);
+    GLenum func = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glDepthFunc, GLenum, func);
-    yagl_host_glDepthFunc(func);
+    bool res = yagl_host_glDepthFunc(func);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDepthMask dispatcher. id = 64
  */
-static uint8_t* yagl_func_glDepthMask(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDepthMask(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLboolean flag = yagl_marshal_get_GLboolean(&out_buff);
+    GLboolean flag = yagl_marshal_get_GLboolean(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glDepthMask, GLboolean, flag);
-    yagl_host_glDepthMask(flag);
+    bool res = yagl_host_glDepthMask(flag);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDepthRangex dispatcher. id = 65
  */
-static uint8_t* yagl_func_glDepthRangex(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDepthRangex(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLclampx zNear = yagl_marshal_get_GLclampx(&out_buff);
-    GLclampx zFar = yagl_marshal_get_GLclampx(&out_buff);
+    GLclampx zNear = yagl_marshal_get_GLclampx(out_buff);
+    GLclampx zFar = yagl_marshal_get_GLclampx(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glDepthRangex, GLclampx, GLclampx, zNear, zFar);
-    yagl_host_glDepthRangex(zNear, zFar);
+    bool res = yagl_host_glDepthRangex(zNear, zFar);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDisable dispatcher. id = 66
  */
-static uint8_t* yagl_func_glDisable(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDisable(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum cap = yagl_marshal_get_GLenum(&out_buff);
+    GLenum cap = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glDisable, GLenum, cap);
-    yagl_host_glDisable(cap);
+    bool res = yagl_host_glDisable(cap);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDisableClientState dispatcher. id = 67
  */
-static uint8_t* yagl_func_glDisableClientState(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDisableClientState(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum array = yagl_marshal_get_GLenum(&out_buff);
+    GLenum array = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glDisableClientState, GLenum, array);
-    yagl_host_glDisableClientState(array);
+    bool res = yagl_host_glDisableClientState(array);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDrawArrays dispatcher. id = 68
  */
-static uint8_t* yagl_func_glDrawArrays(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDrawArrays(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum mode = yagl_marshal_get_GLenum(&out_buff);
-    GLint first = yagl_marshal_get_GLint(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
+    GLenum mode = yagl_marshal_get_GLenum(out_buff);
+    GLint first = yagl_marshal_get_GLint(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glDrawArrays, GLenum, GLint, GLsizei, mode, first, count);
-    yagl_host_glDrawArrays(mode, first, count);
+    bool res = yagl_host_glDrawArrays(mode, first, count);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDrawElements dispatcher. id = 69
  */
-static uint8_t* yagl_func_glDrawElements(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDrawElements(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum mode = yagl_marshal_get_GLenum(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
-    GLenum type = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong indices = yagl_marshal_get_ptr(&out_buff);
+    GLenum mode = yagl_marshal_get_GLenum(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
+    target_ulong indices = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glDrawElements, GLenum, GLsizei, GLenum, target_ulong, mode, count, type, indices);
-    yagl_host_glDrawElements(mode, count, type, indices);
+    bool res = yagl_host_glDrawElements(mode, count, type, indices);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glEnable dispatcher. id = 70
  */
-static uint8_t* yagl_func_glEnable(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glEnable(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum cap = yagl_marshal_get_GLenum(&out_buff);
+    GLenum cap = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glEnable, GLenum, cap);
-    yagl_host_glEnable(cap);
+    bool res = yagl_host_glEnable(cap);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glEnableClientState dispatcher. id = 71
  */
-static uint8_t* yagl_func_glEnableClientState(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glEnableClientState(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum array = yagl_marshal_get_GLenum(&out_buff);
+    GLenum array = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glEnableClientState, GLenum, array);
-    yagl_host_glEnableClientState(array);
+    bool res = yagl_host_glEnableClientState(array);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glFinish dispatcher. id = 72
  */
-static uint8_t* yagl_func_glFinish(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glFinish(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
     YAGL_LOG_FUNC_ENTER_SPLIT0(ts->ps->id, ts->id, glFinish);
-    yagl_host_glFinish();
+    bool res = yagl_host_glFinish();
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glFlush dispatcher. id = 73
  */
-static uint8_t* yagl_func_glFlush(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glFlush(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
     YAGL_LOG_FUNC_ENTER_SPLIT0(ts->ps->id, ts->id, glFlush);
-    yagl_host_glFlush();
+    bool res = yagl_host_glFlush();
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glFogx dispatcher. id = 74
  */
-static uint8_t* yagl_func_glFogx(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glFogx(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLfixed param = yagl_marshal_get_GLfixed(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLfixed param = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glFogx, GLenum, GLfixed, pname, param);
-    yagl_host_glFogx(pname, param);
+    bool res = yagl_host_glFogx(pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glFogxv dispatcher. id = 75
  */
-static uint8_t* yagl_func_glFogxv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glFogxv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glFogxv, GLenum, target_ulong, pname, params);
-    yagl_host_glFogxv(pname, params);
+    bool res = yagl_host_glFogxv(pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glFrontFace dispatcher. id = 76
  */
-static uint8_t* yagl_func_glFrontFace(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glFrontFace(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum mode = yagl_marshal_get_GLenum(&out_buff);
+    GLenum mode = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glFrontFace, GLenum, mode);
-    yagl_host_glFrontFace(mode);
+    bool res = yagl_host_glFrontFace(mode);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glFrustumx dispatcher. id = 77
  */
-static uint8_t* yagl_func_glFrustumx(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glFrustumx(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfixed left = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed right = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed bottom = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed top = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed zNear = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed zFar = yagl_marshal_get_GLfixed(&out_buff);
+    GLfixed left = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed right = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed bottom = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed top = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed zNear = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed zFar = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT6(ts->ps->id, ts->id, glFrustumx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, left, right, bottom, top, zNear, zFar);
-    yagl_host_glFrustumx(left, right, bottom, top, zNear, zFar);
+    bool res = yagl_host_glFrustumx(left, right, bottom, top, zNear, zFar);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetBooleanv dispatcher. id = 78
  */
-static uint8_t* yagl_func_glGetBooleanv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetBooleanv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGetBooleanv, GLenum, target_ulong, pname, params);
-    yagl_host_glGetBooleanv(pname, params);
+    bool res = yagl_host_glGetBooleanv(pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetBufferParameteriv dispatcher. id = 79
  */
-static uint8_t* yagl_func_glGetBufferParameteriv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetBufferParameteriv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetBufferParameteriv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glGetBufferParameteriv(target, pname, params);
+    bool res = yagl_host_glGetBufferParameteriv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetClipPlanex dispatcher. id = 80
  */
-static uint8_t* yagl_func_glGetClipPlanex(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetClipPlanex(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong eqn = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong eqn = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGetClipPlanex, GLenum, target_ulong, pname, eqn);
-    yagl_host_glGetClipPlanex(pname, eqn);
+    bool res = yagl_host_glGetClipPlanex(pname, eqn);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGenBuffers dispatcher. id = 81
  */
-static uint8_t* yagl_func_glGenBuffers(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGenBuffers(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLsizei n = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong buffers = yagl_marshal_get_ptr(&out_buff);
+    GLsizei n = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong buffers = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGenBuffers, GLsizei, target_ulong, n, buffers);
-    yagl_host_glGenBuffers(n, buffers);
+    bool res = yagl_host_glGenBuffers(n, buffers);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGenTextures dispatcher. id = 82
  */
-static uint8_t* yagl_func_glGenTextures(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGenTextures(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLsizei n = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong textures = yagl_marshal_get_ptr(&out_buff);
+    GLsizei n = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong textures = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGenTextures, GLsizei, target_ulong, n, textures);
-    yagl_host_glGenTextures(n, textures);
+    bool res = yagl_host_glGenTextures(n, textures);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetError dispatcher. id = 83
  */
-static uint8_t* yagl_func_glGetError(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetError(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
     YAGL_LOG_FUNC_ENTER_SPLIT0(ts->ps->id, ts->id, glGetError);
-    GLenum ret = yagl_host_glGetError();
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLenum, ret);
-    yagl_marshal_put_GLenum(&in_buff, ret);
-    return out_buff;
+    GLenum retval;
+    bool res = yagl_host_glGetError(&retval);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLenum, retval);
+    yagl_marshal_put_GLenum(&in_buff, retval);
+    return true;
 }
 
 /*
  * glGetFixedv dispatcher. id = 84
  */
-static uint8_t* yagl_func_glGetFixedv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetFixedv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGetFixedv, GLenum, target_ulong, pname, params);
-    yagl_host_glGetFixedv(pname, params);
+    bool res = yagl_host_glGetFixedv(pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetIntegerv dispatcher. id = 85
  */
-static uint8_t* yagl_func_glGetIntegerv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetIntegerv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGetIntegerv, GLenum, target_ulong, pname, params);
-    yagl_host_glGetIntegerv(pname, params);
+    bool res = yagl_host_glGetIntegerv(pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetLightxv dispatcher. id = 86
  */
-static uint8_t* yagl_func_glGetLightxv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetLightxv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum light = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum light = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetLightxv, GLenum, GLenum, target_ulong, light, pname, params);
-    yagl_host_glGetLightxv(light, pname, params);
+    bool res = yagl_host_glGetLightxv(light, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetMaterialxv dispatcher. id = 87
  */
-static uint8_t* yagl_func_glGetMaterialxv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetMaterialxv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum face = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum face = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetMaterialxv, GLenum, GLenum, target_ulong, face, pname, params);
-    yagl_host_glGetMaterialxv(face, pname, params);
+    bool res = yagl_host_glGetMaterialxv(face, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetPointerv dispatcher. id = 88
  */
-static uint8_t* yagl_func_glGetPointerv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetPointerv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGetPointerv, GLenum, target_ulong, pname, params);
-    yagl_host_glGetPointerv(pname, params);
+    bool res = yagl_host_glGetPointerv(pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetTexEnviv dispatcher. id = 89
  */
-static uint8_t* yagl_func_glGetTexEnviv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetTexEnviv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum env = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum env = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetTexEnviv, GLenum, GLenum, target_ulong, env, pname, params);
-    yagl_host_glGetTexEnviv(env, pname, params);
+    bool res = yagl_host_glGetTexEnviv(env, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetTexEnvxv dispatcher. id = 90
  */
-static uint8_t* yagl_func_glGetTexEnvxv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetTexEnvxv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum env = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum env = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetTexEnvxv, GLenum, GLenum, target_ulong, env, pname, params);
-    yagl_host_glGetTexEnvxv(env, pname, params);
+    bool res = yagl_host_glGetTexEnvxv(env, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetTexParameteriv dispatcher. id = 91
  */
-static uint8_t* yagl_func_glGetTexParameteriv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetTexParameteriv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetTexParameteriv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glGetTexParameteriv(target, pname, params);
+    bool res = yagl_host_glGetTexParameteriv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetTexParameterxv dispatcher. id = 92
  */
-static uint8_t* yagl_func_glGetTexParameterxv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetTexParameterxv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetTexParameterxv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glGetTexParameterxv(target, pname, params);
+    bool res = yagl_host_glGetTexParameterxv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glHint dispatcher. id = 93
  */
-static uint8_t* yagl_func_glHint(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glHint(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum mode = yagl_marshal_get_GLenum(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum mode = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glHint, GLenum, GLenum, target, mode);
-    yagl_host_glHint(target, mode);
+    bool res = yagl_host_glHint(target, mode);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glIsBuffer dispatcher. id = 94
  */
-static uint8_t* yagl_func_glIsBuffer(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glIsBuffer(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint buffer = yagl_marshal_get_GLuint(&out_buff);
+    GLuint buffer = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glIsBuffer, GLuint, buffer);
-    GLboolean ret = yagl_host_glIsBuffer(buffer);
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, ret);
-    yagl_marshal_put_GLboolean(&in_buff, ret);
-    return out_buff;
+    GLboolean retval;
+    bool res = yagl_host_glIsBuffer(&retval, buffer);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, retval);
+    yagl_marshal_put_GLboolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * glIsEnabled dispatcher. id = 95
  */
-static uint8_t* yagl_func_glIsEnabled(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glIsEnabled(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum cap = yagl_marshal_get_GLenum(&out_buff);
+    GLenum cap = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glIsEnabled, GLenum, cap);
-    GLboolean ret = yagl_host_glIsEnabled(cap);
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, ret);
-    yagl_marshal_put_GLboolean(&in_buff, ret);
-    return out_buff;
+    GLboolean retval;
+    bool res = yagl_host_glIsEnabled(&retval, cap);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, retval);
+    yagl_marshal_put_GLboolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * glIsTexture dispatcher. id = 96
  */
-static uint8_t* yagl_func_glIsTexture(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glIsTexture(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint texture = yagl_marshal_get_GLuint(&out_buff);
+    GLuint texture = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glIsTexture, GLuint, texture);
-    GLboolean ret = yagl_host_glIsTexture(texture);
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, ret);
-    yagl_marshal_put_GLboolean(&in_buff, ret);
-    return out_buff;
+    GLboolean retval;
+    bool res = yagl_host_glIsTexture(&retval, texture);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, retval);
+    yagl_marshal_put_GLboolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * glLightModelx dispatcher. id = 97
  */
-static uint8_t* yagl_func_glLightModelx(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLightModelx(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLfixed param = yagl_marshal_get_GLfixed(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLfixed param = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glLightModelx, GLenum, GLfixed, pname, param);
-    yagl_host_glLightModelx(pname, param);
+    bool res = yagl_host_glLightModelx(pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glLightModelxv dispatcher. id = 98
  */
-static uint8_t* yagl_func_glLightModelxv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLightModelxv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glLightModelxv, GLenum, target_ulong, pname, params);
-    yagl_host_glLightModelxv(pname, params);
+    bool res = yagl_host_glLightModelxv(pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glLightx dispatcher. id = 99
  */
-static uint8_t* yagl_func_glLightx(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLightx(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum light = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLfixed param = yagl_marshal_get_GLfixed(&out_buff);
+    GLenum light = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLfixed param = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glLightx, GLenum, GLenum, GLfixed, light, pname, param);
-    yagl_host_glLightx(light, pname, param);
+    bool res = yagl_host_glLightx(light, pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glLightxv dispatcher. id = 100
  */
-static uint8_t* yagl_func_glLightxv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLightxv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum light = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum light = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glLightxv, GLenum, GLenum, target_ulong, light, pname, params);
-    yagl_host_glLightxv(light, pname, params);
+    bool res = yagl_host_glLightxv(light, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glLineWidthx dispatcher. id = 101
  */
-static uint8_t* yagl_func_glLineWidthx(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLineWidthx(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfixed width = yagl_marshal_get_GLfixed(&out_buff);
+    GLfixed width = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glLineWidthx, GLfixed, width);
-    yagl_host_glLineWidthx(width);
+    bool res = yagl_host_glLineWidthx(width);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glLoadIdentity dispatcher. id = 102
  */
-static uint8_t* yagl_func_glLoadIdentity(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLoadIdentity(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
     YAGL_LOG_FUNC_ENTER_SPLIT0(ts->ps->id, ts->id, glLoadIdentity);
-    yagl_host_glLoadIdentity();
+    bool res = yagl_host_glLoadIdentity();
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glLoadMatrixx dispatcher. id = 103
  */
-static uint8_t* yagl_func_glLoadMatrixx(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLoadMatrixx(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    target_ulong m = yagl_marshal_get_ptr(&out_buff);
+    target_ulong m = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glLoadMatrixx, target_ulong, m);
-    yagl_host_glLoadMatrixx(m);
+    bool res = yagl_host_glLoadMatrixx(m);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glLogicOp dispatcher. id = 104
  */
-static uint8_t* yagl_func_glLogicOp(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLogicOp(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum opcode = yagl_marshal_get_GLenum(&out_buff);
+    GLenum opcode = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glLogicOp, GLenum, opcode);
-    yagl_host_glLogicOp(opcode);
+    bool res = yagl_host_glLogicOp(opcode);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glMaterialx dispatcher. id = 105
  */
-static uint8_t* yagl_func_glMaterialx(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glMaterialx(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum face = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLfixed param = yagl_marshal_get_GLfixed(&out_buff);
+    GLenum face = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLfixed param = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glMaterialx, GLenum, GLenum, GLfixed, face, pname, param);
-    yagl_host_glMaterialx(face, pname, param);
+    bool res = yagl_host_glMaterialx(face, pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glMaterialxv dispatcher. id = 106
  */
-static uint8_t* yagl_func_glMaterialxv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glMaterialxv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum face = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum face = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glMaterialxv, GLenum, GLenum, target_ulong, face, pname, params);
-    yagl_host_glMaterialxv(face, pname, params);
+    bool res = yagl_host_glMaterialxv(face, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glMatrixMode dispatcher. id = 107
  */
-static uint8_t* yagl_func_glMatrixMode(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glMatrixMode(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum mode = yagl_marshal_get_GLenum(&out_buff);
+    GLenum mode = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glMatrixMode, GLenum, mode);
-    yagl_host_glMatrixMode(mode);
+    bool res = yagl_host_glMatrixMode(mode);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glMultMatrixx dispatcher. id = 108
  */
-static uint8_t* yagl_func_glMultMatrixx(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glMultMatrixx(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    target_ulong m = yagl_marshal_get_ptr(&out_buff);
+    target_ulong m = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glMultMatrixx, target_ulong, m);
-    yagl_host_glMultMatrixx(m);
+    bool res = yagl_host_glMultMatrixx(m);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glMultiTexCoord4x dispatcher. id = 109
  */
-static uint8_t* yagl_func_glMultiTexCoord4x(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glMultiTexCoord4x(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLfixed s = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed t = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed r = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed q = yagl_marshal_get_GLfixed(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLfixed s = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed t = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed r = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed q = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT5(ts->ps->id, ts->id, glMultiTexCoord4x, GLenum, GLfixed, GLfixed, GLfixed, GLfixed, target, s, t, r, q);
-    yagl_host_glMultiTexCoord4x(target, s, t, r, q);
+    bool res = yagl_host_glMultiTexCoord4x(target, s, t, r, q);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glNormal3x dispatcher. id = 110
  */
-static uint8_t* yagl_func_glNormal3x(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glNormal3x(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfixed nx = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed ny = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed nz = yagl_marshal_get_GLfixed(&out_buff);
+    GLfixed nx = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed ny = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed nz = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glNormal3x, GLfixed, GLfixed, GLfixed, nx, ny, nz);
-    yagl_host_glNormal3x(nx, ny, nz);
+    bool res = yagl_host_glNormal3x(nx, ny, nz);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glNormalPointer dispatcher. id = 111
  */
-static uint8_t* yagl_func_glNormalPointer(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glNormalPointer(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum type = yagl_marshal_get_GLenum(&out_buff);
-    GLsizei stride = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong pointer = yagl_marshal_get_ptr(&out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
+    GLsizei stride = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong pointer = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glNormalPointer, GLenum, GLsizei, target_ulong, type, stride, pointer);
-    yagl_host_glNormalPointer(type, stride, pointer);
+    bool res = yagl_host_glNormalPointer(type, stride, pointer);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glOrthox dispatcher. id = 112
  */
-static uint8_t* yagl_func_glOrthox(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glOrthox(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfixed left = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed right = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed bottom = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed top = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed zNear = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed zFar = yagl_marshal_get_GLfixed(&out_buff);
+    GLfixed left = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed right = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed bottom = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed top = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed zNear = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed zFar = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT6(ts->ps->id, ts->id, glOrthox, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, left, right, bottom, top, zNear, zFar);
-    yagl_host_glOrthox(left, right, bottom, top, zNear, zFar);
+    bool res = yagl_host_glOrthox(left, right, bottom, top, zNear, zFar);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glPixelStorei dispatcher. id = 113
  */
-static uint8_t* yagl_func_glPixelStorei(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glPixelStorei(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLint param = yagl_marshal_get_GLint(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLint param = yagl_marshal_get_GLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glPixelStorei, GLenum, GLint, pname, param);
-    yagl_host_glPixelStorei(pname, param);
+    bool res = yagl_host_glPixelStorei(pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glPointParameterx dispatcher. id = 114
  */
-static uint8_t* yagl_func_glPointParameterx(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glPointParameterx(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLfixed param = yagl_marshal_get_GLfixed(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLfixed param = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glPointParameterx, GLenum, GLfixed, pname, param);
-    yagl_host_glPointParameterx(pname, param);
+    bool res = yagl_host_glPointParameterx(pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glPointParameterxv dispatcher. id = 115
  */
-static uint8_t* yagl_func_glPointParameterxv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glPointParameterxv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glPointParameterxv, GLenum, target_ulong, pname, params);
-    yagl_host_glPointParameterxv(pname, params);
+    bool res = yagl_host_glPointParameterxv(pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glPointSizex dispatcher. id = 116
  */
-static uint8_t* yagl_func_glPointSizex(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glPointSizex(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfixed size = yagl_marshal_get_GLfixed(&out_buff);
+    GLfixed size = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glPointSizex, GLfixed, size);
-    yagl_host_glPointSizex(size);
+    bool res = yagl_host_glPointSizex(size);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glPolygonOffsetx dispatcher. id = 117
  */
-static uint8_t* yagl_func_glPolygonOffsetx(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glPolygonOffsetx(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfixed factor = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed units = yagl_marshal_get_GLfixed(&out_buff);
+    GLfixed factor = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed units = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glPolygonOffsetx, GLfixed, GLfixed, factor, units);
-    yagl_host_glPolygonOffsetx(factor, units);
+    bool res = yagl_host_glPolygonOffsetx(factor, units);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glPopMatrix dispatcher. id = 118
  */
-static uint8_t* yagl_func_glPopMatrix(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glPopMatrix(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
     YAGL_LOG_FUNC_ENTER_SPLIT0(ts->ps->id, ts->id, glPopMatrix);
-    yagl_host_glPopMatrix();
+    bool res = yagl_host_glPopMatrix();
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glPushMatrix dispatcher. id = 119
  */
-static uint8_t* yagl_func_glPushMatrix(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glPushMatrix(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
     YAGL_LOG_FUNC_ENTER_SPLIT0(ts->ps->id, ts->id, glPushMatrix);
-    yagl_host_glPushMatrix();
+    bool res = yagl_host_glPushMatrix();
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glReadPixels dispatcher. id = 120
  */
-static uint8_t* yagl_func_glReadPixels(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glReadPixels(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint x = yagl_marshal_get_GLint(&out_buff);
-    GLint y = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
-    GLenum format = yagl_marshal_get_GLenum(&out_buff);
-    GLenum type = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong pixels = yagl_marshal_get_ptr(&out_buff);
+    GLint x = yagl_marshal_get_GLint(out_buff);
+    GLint y = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
+    GLenum format = yagl_marshal_get_GLenum(out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
+    target_ulong pixels = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT7(ts->ps->id, ts->id, glReadPixels, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, target_ulong, x, y, width, height, format, type, pixels);
-    yagl_host_glReadPixels(x, y, width, height, format, type, pixels);
+    bool res = yagl_host_glReadPixels(x, y, width, height, format, type, pixels);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glRotatex dispatcher. id = 121
  */
-static uint8_t* yagl_func_glRotatex(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glRotatex(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfixed angle = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed x = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed y = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed z = yagl_marshal_get_GLfixed(&out_buff);
+    GLfixed angle = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed x = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed y = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed z = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glRotatex, GLfixed, GLfixed, GLfixed, GLfixed, angle, x, y, z);
-    yagl_host_glRotatex(angle, x, y, z);
+    bool res = yagl_host_glRotatex(angle, x, y, z);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glSampleCoverage dispatcher. id = 122
  */
-static uint8_t* yagl_func_glSampleCoverage(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glSampleCoverage(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLclampf value = yagl_marshal_get_GLclampf(&out_buff);
-    GLboolean invert = yagl_marshal_get_GLboolean(&out_buff);
+    GLclampf value = yagl_marshal_get_GLclampf(out_buff);
+    GLboolean invert = yagl_marshal_get_GLboolean(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glSampleCoverage, GLclampf, GLboolean, value, invert);
-    yagl_host_glSampleCoverage(value, invert);
+    bool res = yagl_host_glSampleCoverage(value, invert);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glSampleCoveragex dispatcher. id = 123
  */
-static uint8_t* yagl_func_glSampleCoveragex(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glSampleCoveragex(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLclampx value = yagl_marshal_get_GLclampx(&out_buff);
-    GLboolean invert = yagl_marshal_get_GLboolean(&out_buff);
+    GLclampx value = yagl_marshal_get_GLclampx(out_buff);
+    GLboolean invert = yagl_marshal_get_GLboolean(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glSampleCoveragex, GLclampx, GLboolean, value, invert);
-    yagl_host_glSampleCoveragex(value, invert);
+    bool res = yagl_host_glSampleCoveragex(value, invert);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glScalex dispatcher. id = 124
  */
-static uint8_t* yagl_func_glScalex(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glScalex(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfixed x = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed y = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed z = yagl_marshal_get_GLfixed(&out_buff);
+    GLfixed x = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed y = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed z = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glScalex, GLfixed, GLfixed, GLfixed, x, y, z);
-    yagl_host_glScalex(x, y, z);
+    bool res = yagl_host_glScalex(x, y, z);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glScissor dispatcher. id = 125
  */
-static uint8_t* yagl_func_glScissor(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glScissor(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint x = yagl_marshal_get_GLint(&out_buff);
-    GLint y = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
+    GLint x = yagl_marshal_get_GLint(out_buff);
+    GLint y = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glScissor, GLint, GLint, GLsizei, GLsizei, x, y, width, height);
-    yagl_host_glScissor(x, y, width, height);
+    bool res = yagl_host_glScissor(x, y, width, height);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glShadeModel dispatcher. id = 126
  */
-static uint8_t* yagl_func_glShadeModel(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glShadeModel(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum mode = yagl_marshal_get_GLenum(&out_buff);
+    GLenum mode = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glShadeModel, GLenum, mode);
-    yagl_host_glShadeModel(mode);
+    bool res = yagl_host_glShadeModel(mode);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glStencilFunc dispatcher. id = 127
  */
-static uint8_t* yagl_func_glStencilFunc(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glStencilFunc(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum func = yagl_marshal_get_GLenum(&out_buff);
-    GLint ref = yagl_marshal_get_GLint(&out_buff);
-    GLuint mask = yagl_marshal_get_GLuint(&out_buff);
+    GLenum func = yagl_marshal_get_GLenum(out_buff);
+    GLint ref = yagl_marshal_get_GLint(out_buff);
+    GLuint mask = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glStencilFunc, GLenum, GLint, GLuint, func, ref, mask);
-    yagl_host_glStencilFunc(func, ref, mask);
+    bool res = yagl_host_glStencilFunc(func, ref, mask);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glStencilMask dispatcher. id = 128
  */
-static uint8_t* yagl_func_glStencilMask(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glStencilMask(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint mask = yagl_marshal_get_GLuint(&out_buff);
+    GLuint mask = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glStencilMask, GLuint, mask);
-    yagl_host_glStencilMask(mask);
+    bool res = yagl_host_glStencilMask(mask);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glStencilOp dispatcher. id = 129
  */
-static uint8_t* yagl_func_glStencilOp(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glStencilOp(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum fail = yagl_marshal_get_GLenum(&out_buff);
-    GLenum zfail = yagl_marshal_get_GLenum(&out_buff);
-    GLenum zpass = yagl_marshal_get_GLenum(&out_buff);
+    GLenum fail = yagl_marshal_get_GLenum(out_buff);
+    GLenum zfail = yagl_marshal_get_GLenum(out_buff);
+    GLenum zpass = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glStencilOp, GLenum, GLenum, GLenum, fail, zfail, zpass);
-    yagl_host_glStencilOp(fail, zfail, zpass);
+    bool res = yagl_host_glStencilOp(fail, zfail, zpass);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexCoordPointer dispatcher. id = 130
  */
-static uint8_t* yagl_func_glTexCoordPointer(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexCoordPointer(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint size = yagl_marshal_get_GLint(&out_buff);
-    GLenum type = yagl_marshal_get_GLenum(&out_buff);
-    GLsizei stride = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong pointer = yagl_marshal_get_ptr(&out_buff);
+    GLint size = yagl_marshal_get_GLint(out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
+    GLsizei stride = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong pointer = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glTexCoordPointer, GLint, GLenum, GLsizei, target_ulong, size, type, stride, pointer);
-    yagl_host_glTexCoordPointer(size, type, stride, pointer);
+    bool res = yagl_host_glTexCoordPointer(size, type, stride, pointer);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexEnvi dispatcher. id = 131
  */
-static uint8_t* yagl_func_glTexEnvi(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexEnvi(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLint param = yagl_marshal_get_GLint(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLint param = yagl_marshal_get_GLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexEnvi, GLenum, GLenum, GLint, target, pname, param);
-    yagl_host_glTexEnvi(target, pname, param);
+    bool res = yagl_host_glTexEnvi(target, pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexEnvx dispatcher. id = 132
  */
-static uint8_t* yagl_func_glTexEnvx(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexEnvx(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLfixed param = yagl_marshal_get_GLfixed(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLfixed param = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexEnvx, GLenum, GLenum, GLfixed, target, pname, param);
-    yagl_host_glTexEnvx(target, pname, param);
+    bool res = yagl_host_glTexEnvx(target, pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexEnviv dispatcher. id = 133
  */
-static uint8_t* yagl_func_glTexEnviv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexEnviv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexEnviv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glTexEnviv(target, pname, params);
+    bool res = yagl_host_glTexEnviv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexEnvxv dispatcher. id = 134
  */
-static uint8_t* yagl_func_glTexEnvxv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexEnvxv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexEnvxv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glTexEnvxv(target, pname, params);
+    bool res = yagl_host_glTexEnvxv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexImage2D dispatcher. id = 135
  */
-static uint8_t* yagl_func_glTexImage2D(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexImage2D(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLint level = yagl_marshal_get_GLint(&out_buff);
-    GLint internalformat = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
-    GLint border = yagl_marshal_get_GLint(&out_buff);
-    GLenum format = yagl_marshal_get_GLenum(&out_buff);
-    GLenum type = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong pixels = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLint level = yagl_marshal_get_GLint(out_buff);
+    GLint internalformat = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
+    GLint border = yagl_marshal_get_GLint(out_buff);
+    GLenum format = yagl_marshal_get_GLenum(out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
+    target_ulong pixels = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT9(ts->ps->id, ts->id, glTexImage2D, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, target_ulong, target, level, internalformat, width, height, border, format, type, pixels);
-    yagl_host_glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
+    bool res = yagl_host_glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexParameteri dispatcher. id = 136
  */
-static uint8_t* yagl_func_glTexParameteri(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexParameteri(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLint param = yagl_marshal_get_GLint(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLint param = yagl_marshal_get_GLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexParameteri, GLenum, GLenum, GLint, target, pname, param);
-    yagl_host_glTexParameteri(target, pname, param);
+    bool res = yagl_host_glTexParameteri(target, pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexParameterx dispatcher. id = 137
  */
-static uint8_t* yagl_func_glTexParameterx(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexParameterx(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLfixed param = yagl_marshal_get_GLfixed(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLfixed param = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexParameterx, GLenum, GLenum, GLfixed, target, pname, param);
-    yagl_host_glTexParameterx(target, pname, param);
+    bool res = yagl_host_glTexParameterx(target, pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexParameteriv dispatcher. id = 138
  */
-static uint8_t* yagl_func_glTexParameteriv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexParameteriv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexParameteriv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glTexParameteriv(target, pname, params);
+    bool res = yagl_host_glTexParameteriv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexParameterxv dispatcher. id = 139
  */
-static uint8_t* yagl_func_glTexParameterxv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexParameterxv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexParameterxv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glTexParameterxv(target, pname, params);
+    bool res = yagl_host_glTexParameterxv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexSubImage2D dispatcher. id = 140
  */
-static uint8_t* yagl_func_glTexSubImage2D(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexSubImage2D(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLint level = yagl_marshal_get_GLint(&out_buff);
-    GLint xoffset = yagl_marshal_get_GLint(&out_buff);
-    GLint yoffset = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
-    GLenum format = yagl_marshal_get_GLenum(&out_buff);
-    GLenum type = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong pixels = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLint level = yagl_marshal_get_GLint(out_buff);
+    GLint xoffset = yagl_marshal_get_GLint(out_buff);
+    GLint yoffset = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
+    GLenum format = yagl_marshal_get_GLenum(out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
+    target_ulong pixels = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT9(ts->ps->id, ts->id, glTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, target_ulong, target, level, xoffset, yoffset, width, height, format, type, pixels);
-    yagl_host_glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
+    bool res = yagl_host_glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTranslatex dispatcher. id = 141
  */
-static uint8_t* yagl_func_glTranslatex(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTranslatex(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfixed x = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed y = yagl_marshal_get_GLfixed(&out_buff);
-    GLfixed z = yagl_marshal_get_GLfixed(&out_buff);
+    GLfixed x = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed y = yagl_marshal_get_GLfixed(out_buff);
+    GLfixed z = yagl_marshal_get_GLfixed(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTranslatex, GLfixed, GLfixed, GLfixed, x, y, z);
-    yagl_host_glTranslatex(x, y, z);
+    bool res = yagl_host_glTranslatex(x, y, z);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glVertexPointer dispatcher. id = 142
  */
-static uint8_t* yagl_func_glVertexPointer(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glVertexPointer(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint size = yagl_marshal_get_GLint(&out_buff);
-    GLenum type = yagl_marshal_get_GLenum(&out_buff);
-    GLsizei stride = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong pointer = yagl_marshal_get_ptr(&out_buff);
+    GLint size = yagl_marshal_get_GLint(out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
+    GLsizei stride = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong pointer = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glVertexPointer, GLint, GLenum, GLsizei, target_ulong, size, type, stride, pointer);
-    yagl_host_glVertexPointer(size, type, stride, pointer);
+    bool res = yagl_host_glVertexPointer(size, type, stride, pointer);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glViewport dispatcher. id = 143
  */
-static uint8_t* yagl_func_glViewport(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glViewport(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint x = yagl_marshal_get_GLint(&out_buff);
-    GLint y = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
+    GLint x = yagl_marshal_get_GLint(out_buff);
+    GLint y = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glViewport, GLint, GLint, GLsizei, GLsizei, x, y, width, height);
-    yagl_host_glViewport(x, y, width, height);
+    bool res = yagl_host_glViewport(x, y, width, height);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetExtensionStringYAGL dispatcher. id = 144
  */
-static uint8_t* yagl_func_glGetExtensionStringYAGL(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetExtensionStringYAGL(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    target_ulong str = yagl_marshal_get_ptr(&out_buff);
+    target_ulong str = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glGetExtensionStringYAGL, target_ulong, str);
-    GLuint ret = yagl_host_glGetExtensionStringYAGL(str);
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLuint, ret);
-    yagl_marshal_put_GLuint(&in_buff, ret);
-    return out_buff;
+    GLuint retval;
+    bool res = yagl_host_glGetExtensionStringYAGL(&retval, str);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLuint, retval);
+    yagl_marshal_put_GLuint(&in_buff, retval);
+    return true;
 }
 
 /*
  * glEGLImageTargetTexture2DYAGL dispatcher. id = 145
  */
-static uint8_t* yagl_func_glEGLImageTargetTexture2DYAGL(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glEGLImageTargetTexture2DYAGL(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    uint32_t width = yagl_marshal_get_uint32_t(&out_buff);
-    uint32_t height = yagl_marshal_get_uint32_t(&out_buff);
-    uint32_t bpp = yagl_marshal_get_uint32_t(&out_buff);
-    target_ulong pixels = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    uint32_t width = yagl_marshal_get_uint32_t(out_buff);
+    uint32_t height = yagl_marshal_get_uint32_t(out_buff);
+    uint32_t bpp = yagl_marshal_get_uint32_t(out_buff);
+    target_ulong pixels = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT5(ts->ps->id, ts->id, glEGLImageTargetTexture2DYAGL, GLenum, uint32_t, uint32_t, uint32_t, target_ulong, target, width, height, bpp, pixels);
-    yagl_host_glEGLImageTargetTexture2DYAGL(target, width, height, bpp, pixels);
+    bool res = yagl_host_glEGLImageTargetTexture2DYAGL(target, width, height, bpp, pixels);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
-const uint32_t yagl_gles1_api_num_funcs = 145;
+/*
+ * glGetVertexAttribRangeYAGL dispatcher. id = 146
+ */
+static bool yagl_func_glGetVertexAttribRangeYAGL(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
+    uint8_t *in_buff)
+{
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
+    target_ulong indices = yagl_marshal_get_ptr(out_buff);
+    target_ulong range_first = yagl_marshal_get_ptr(out_buff);
+    target_ulong range_count = yagl_marshal_get_ptr(out_buff);
+    YAGL_LOG_FUNC_ENTER_SPLIT5(ts->ps->id, ts->id, glGetVertexAttribRangeYAGL, GLsizei, GLenum, target_ulong, target_ulong, target_ulong, count, type, indices, range_first, range_count);
+    bool res = yagl_host_glGetVertexAttribRangeYAGL(count, type, indices, range_first, range_count);
+    YAGL_LOG_FUNC_EXIT(NULL);
+    return res;
+}
+
+const uint32_t yagl_gles1_api_num_funcs = 146;
 
 yagl_api_func yagl_gles1_api_funcs[] = {
     &yagl_func_glAlphaFunc,
@@ -2435,5 +2478,6 @@ yagl_api_func yagl_gles1_api_funcs[] = {
     &yagl_func_glVertexPointer,
     &yagl_func_glViewport,
     &yagl_func_glGetExtensionStringYAGL,
-    &yagl_func_glEGLImageTargetTexture2DYAGL
+    &yagl_func_glEGLImageTargetTexture2DYAGL,
+    &yagl_func_glGetVertexAttribRangeYAGL
 };
index 204fb53..dbe3fba 100644 (file)
 
 YAGL_DEFINE_TLS(struct yagl_gles1_api_ts*, gles1_api_ts);
 
-void yagl_host_glAlphaFunc(GLenum func,
+bool yagl_host_glAlphaFunc(GLenum func,
     GLclampf ref)
 {
+    return true;
 }
 
-void yagl_host_glClipPlanef(GLenum plane,
+bool yagl_host_glClipPlanef(GLenum plane,
     target_ulong /* const GLfloat* */ equation)
 {
+    return true;
 }
 
-void yagl_host_glColor4f(GLfloat red,
+bool yagl_host_glColor4f(GLfloat red,
     GLfloat green,
     GLfloat blue,
     GLfloat alpha)
 {
+    return true;
 }
 
-void yagl_host_glFogf(GLenum pname,
+bool yagl_host_glFogf(GLenum pname,
     GLfloat param)
 {
+    return true;
 }
 
-void yagl_host_glFogfv(GLenum pname,
+bool yagl_host_glFogfv(GLenum pname,
     target_ulong /* const GLfloat* */ params)
 {
+    return true;
 }
 
-void yagl_host_glFrustumf(GLfloat left,
+bool yagl_host_glFrustumf(GLfloat left,
     GLfloat right,
     GLfloat bottom,
     GLfloat top,
     GLfloat zNear,
     GLfloat zFar)
 {
+    return true;
 }
 
-void yagl_host_glGetClipPlanef(GLenum pname,
+bool yagl_host_glGetClipPlanef(GLenum pname,
     target_ulong /* GLfloat* */ eqn)
 {
+    return true;
 }
 
-void yagl_host_glGetLightfv(GLenum light,
+bool yagl_host_glGetLightfv(GLenum light,
     GLenum pname,
     target_ulong /* GLfloat* */ params)
 {
+    return true;
 }
 
-void yagl_host_glGetMaterialfv(GLenum face,
+bool yagl_host_glGetMaterialfv(GLenum face,
     GLenum pname,
     target_ulong /* GLfloat* */ params)
 {
+    return true;
 }
 
-void yagl_host_glGetTexEnvfv(GLenum env,
+bool yagl_host_glGetTexEnvfv(GLenum env,
     GLenum pname,
     target_ulong /* GLfloat* */ params)
 {
+    return true;
 }
 
-void yagl_host_glLightModelf(GLenum pname,
+bool yagl_host_glLightModelf(GLenum pname,
     GLfloat param)
 {
+    return true;
 }
 
-void yagl_host_glLightModelfv(GLenum pname,
+bool yagl_host_glLightModelfv(GLenum pname,
     target_ulong /* const GLfloat* */ params)
 {
+    return true;
 }
 
-void yagl_host_glLightf(GLenum light,
+bool yagl_host_glLightf(GLenum light,
     GLenum pname,
     GLfloat param)
 {
+    return true;
 }
 
-void yagl_host_glLightfv(GLenum light,
+bool yagl_host_glLightfv(GLenum light,
     GLenum pname,
     target_ulong /* const GLfloat* */ params)
 {
+    return true;
 }
 
-void yagl_host_glLoadMatrixf(target_ulong /* const GLfloat* */ m)
+bool yagl_host_glLoadMatrixf(target_ulong /* const GLfloat* */ m)
 {
+    return true;
 }
 
-void yagl_host_glMaterialf(GLenum face,
+bool yagl_host_glMaterialf(GLenum face,
     GLenum pname,
     GLfloat param)
 {
+    return true;
 }
 
-void yagl_host_glMaterialfv(GLenum face,
+bool yagl_host_glMaterialfv(GLenum face,
     GLenum pname,
     target_ulong /* const GLfloat* */ params)
 {
+    return true;
 }
 
-void yagl_host_glMultMatrixf(target_ulong /* const GLfloat* */ m)
+bool yagl_host_glMultMatrixf(target_ulong /* const GLfloat* */ m)
 {
+    return true;
 }
 
-void yagl_host_glMultiTexCoord4f(GLenum target,
+bool yagl_host_glMultiTexCoord4f(GLenum target,
     GLfloat s,
     GLfloat t,
     GLfloat r,
     GLfloat q)
 {
+    return true;
 }
 
-void yagl_host_glNormal3f(GLfloat nx,
+bool yagl_host_glNormal3f(GLfloat nx,
     GLfloat ny,
     GLfloat nz)
 {
+    return true;
 }
 
-void yagl_host_glOrthof(GLfloat left,
+bool yagl_host_glOrthof(GLfloat left,
     GLfloat right,
     GLfloat bottom,
     GLfloat top,
     GLfloat zNear,
     GLfloat zFar)
 {
+    return true;
 }
 
-void yagl_host_glPointParameterf(GLenum pname,
+bool yagl_host_glPointParameterf(GLenum pname,
     GLfloat param)
 {
+    return true;
 }
 
-void yagl_host_glPointParameterfv(GLenum pname,
+bool yagl_host_glPointParameterfv(GLenum pname,
     target_ulong /* const GLfloat* */ params)
 {
+    return true;
 }
 
-void yagl_host_glPointSize(GLfloat size)
+bool yagl_host_glPointSize(GLfloat size)
 {
+    return true;
 }
 
-void yagl_host_glRotatef(GLfloat angle,
+bool yagl_host_glRotatef(GLfloat angle,
     GLfloat x,
     GLfloat y,
     GLfloat z)
 {
+    return true;
 }
 
-void yagl_host_glScalef(GLfloat x,
+bool yagl_host_glScalef(GLfloat x,
     GLfloat y,
     GLfloat z)
 {
+    return true;
 }
 
-void yagl_host_glTexEnvf(GLenum target,
+bool yagl_host_glTexEnvf(GLenum target,
     GLenum pname,
     GLfloat param)
 {
+    return true;
 }
 
-void yagl_host_glTexEnvfv(GLenum target,
+bool yagl_host_glTexEnvfv(GLenum target,
     GLenum pname,
     target_ulong /* const GLfloat* */ params)
 {
+    return true;
 }
 
-void yagl_host_glTranslatef(GLfloat x,
+bool yagl_host_glTranslatef(GLfloat x,
     GLfloat y,
     GLfloat z)
 {
+    return true;
 }
 
-void yagl_host_glAlphaFuncx(GLenum func,
+bool yagl_host_glAlphaFuncx(GLenum func,
     GLclampx ref)
 {
+    return true;
 }
 
-void yagl_host_glClearColorx(GLclampx red,
+bool yagl_host_glClearColorx(GLclampx red,
     GLclampx green,
     GLclampx blue,
     GLclampx alpha)
 {
+    return true;
 }
 
-void yagl_host_glClearDepthx(GLclampx depth)
+bool yagl_host_glClearDepthx(GLclampx depth)
 {
+    return true;
 }
 
-void yagl_host_glClientActiveTexture(GLenum texture)
+bool yagl_host_glClientActiveTexture(GLenum texture)
 {
+    return true;
 }
 
-void yagl_host_glClipPlanex(GLenum plane,
+bool yagl_host_glClipPlanex(GLenum plane,
     target_ulong /* const GLfixed* */ equation)
 {
+    return true;
 }
 
-void yagl_host_glColor4ub(GLubyte red,
+bool yagl_host_glColor4ub(GLubyte red,
     GLubyte green,
     GLubyte blue,
     GLubyte alpha)
 {
+    return true;
 }
 
-void yagl_host_glColor4x(GLfixed red,
+bool yagl_host_glColor4x(GLfixed red,
     GLfixed green,
     GLfixed blue,
     GLfixed alpha)
 {
+    return true;
 }
 
-void yagl_host_glColorPointer(GLint size,
+bool yagl_host_glColorPointer(GLint size,
     GLenum type,
     GLsizei stride,
     target_ulong /* const GLvoid* */ pointer)
 {
+    return true;
 }
 
-void yagl_host_glDepthRangex(GLclampx zNear,
+bool yagl_host_glDepthRangex(GLclampx zNear,
     GLclampx zFar)
 {
+    return true;
 }
 
-void yagl_host_glDisableClientState(GLenum array)
+bool yagl_host_glDisableClientState(GLenum array)
 {
+    return true;
 }
 
-void yagl_host_glEnableClientState(GLenum array)
+bool yagl_host_glEnableClientState(GLenum array)
 {
+    return true;
 }
 
-void yagl_host_glFogx(GLenum pname,
+bool yagl_host_glFogx(GLenum pname,
     GLfixed param)
 {
+    return true;
 }
 
-void yagl_host_glFogxv(GLenum pname,
+bool yagl_host_glFogxv(GLenum pname,
     target_ulong /* const GLfixed* */ params)
 {
+    return true;
 }
 
-void yagl_host_glFrustumx(GLfixed left,
+bool yagl_host_glFrustumx(GLfixed left,
     GLfixed right,
     GLfixed bottom,
     GLfixed top,
     GLfixed zNear,
     GLfixed zFar)
 {
+    return true;
 }
 
-void yagl_host_glGetClipPlanex(GLenum pname,
+bool yagl_host_glGetClipPlanex(GLenum pname,
     target_ulong /* GLfixed* */ eqn)
 {
+    return true;
 }
 
-void yagl_host_glGetFixedv(GLenum pname,
+bool yagl_host_glGetFixedv(GLenum pname,
     target_ulong /* GLfixed* */ params)
 {
+    return true;
 }
 
-void yagl_host_glGetLightxv(GLenum light,
+bool yagl_host_glGetLightxv(GLenum light,
     GLenum pname,
     target_ulong /* GLfixed* */ params)
 {
+    return true;
 }
 
-void yagl_host_glGetMaterialxv(GLenum face,
+bool yagl_host_glGetMaterialxv(GLenum face,
     GLenum pname,
     target_ulong /* GLfixed* */ params)
 {
+    return true;
 }
 
-void yagl_host_glGetPointerv(GLenum pname,
+bool yagl_host_glGetPointerv(GLenum pname,
     target_ulong /* GLvoid** */ params)
 {
+    return true;
 }
 
-void yagl_host_glGetTexEnviv(GLenum env,
+bool yagl_host_glGetTexEnviv(GLenum env,
     GLenum pname,
     target_ulong /* GLint* */ params)
 {
+    return true;
 }
 
-void yagl_host_glGetTexEnvxv(GLenum env,
+bool yagl_host_glGetTexEnvxv(GLenum env,
     GLenum pname,
     target_ulong /* GLfixed* */ params)
 {
+    return true;
 }
 
-void yagl_host_glGetTexParameterxv(GLenum target,
+bool yagl_host_glGetTexParameterxv(GLenum target,
     GLenum pname,
     target_ulong /* GLfixed* */ params)
 {
+    return true;
 }
 
-void yagl_host_glLightModelx(GLenum pname,
+bool yagl_host_glLightModelx(GLenum pname,
     GLfixed param)
 {
+    return true;
 }
 
-void yagl_host_glLightModelxv(GLenum pname,
+bool yagl_host_glLightModelxv(GLenum pname,
     target_ulong /* const GLfixed* */ params)
 {
+    return true;
 }
 
-void yagl_host_glLightx(GLenum light,
+bool yagl_host_glLightx(GLenum light,
     GLenum pname,
     GLfixed param)
 {
+    return true;
 }
 
-void yagl_host_glLightxv(GLenum light,
+bool yagl_host_glLightxv(GLenum light,
     GLenum pname,
     target_ulong /* const GLfixed* */ params)
 {
+    return true;
 }
 
-void yagl_host_glLineWidthx(GLfixed width)
+bool yagl_host_glLineWidthx(GLfixed width)
 {
+    return true;
 }
 
-void yagl_host_glLoadIdentity(void)
+bool yagl_host_glLoadIdentity(void)
 {
+    return true;
 }
 
-void yagl_host_glLoadMatrixx(target_ulong /* const GLfixed* */ m)
+bool yagl_host_glLoadMatrixx(target_ulong /* const GLfixed* */ m)
 {
+    return true;
 }
 
-void yagl_host_glLogicOp(GLenum opcode)
+bool yagl_host_glLogicOp(GLenum opcode)
 {
+    return true;
 }
 
-void yagl_host_glMaterialx(GLenum face,
+bool yagl_host_glMaterialx(GLenum face,
     GLenum pname,
     GLfixed param)
 {
+    return true;
 }
 
-void yagl_host_glMaterialxv(GLenum face,
+bool yagl_host_glMaterialxv(GLenum face,
     GLenum pname,
     target_ulong /* const GLfixed* */ params)
 {
+    return true;
 }
 
-void yagl_host_glMatrixMode(GLenum mode)
+bool yagl_host_glMatrixMode(GLenum mode)
 {
+    return true;
 }
 
-void yagl_host_glMultMatrixx(target_ulong /* const GLfixed* */ m)
+bool yagl_host_glMultMatrixx(target_ulong /* const GLfixed* */ m)
 {
+    return true;
 }
 
-void yagl_host_glMultiTexCoord4x(GLenum target,
+bool yagl_host_glMultiTexCoord4x(GLenum target,
     GLfixed s,
     GLfixed t,
     GLfixed r,
     GLfixed q)
 {
+    return true;
 }
 
-void yagl_host_glNormal3x(GLfixed nx,
+bool yagl_host_glNormal3x(GLfixed nx,
     GLfixed ny,
     GLfixed nz)
 {
+    return true;
 }
 
-void yagl_host_glNormalPointer(GLenum type,
+bool yagl_host_glNormalPointer(GLenum type,
     GLsizei stride,
     target_ulong /* const GLvoid* */ pointer)
 {
+    return true;
 }
 
-void yagl_host_glOrthox(GLfixed left,
+bool yagl_host_glOrthox(GLfixed left,
     GLfixed right,
     GLfixed bottom,
     GLfixed top,
     GLfixed zNear,
     GLfixed zFar)
 {
+    return true;
 }
 
-void yagl_host_glPointParameterx(GLenum pname,
+bool yagl_host_glPointParameterx(GLenum pname,
     GLfixed param)
 {
+    return true;
 }
 
-void yagl_host_glPointParameterxv(GLenum pname,
+bool yagl_host_glPointParameterxv(GLenum pname,
     target_ulong /* const GLfixed* */ params)
 {
+    return true;
 }
 
-void yagl_host_glPointSizex(GLfixed size)
+bool yagl_host_glPointSizex(GLfixed size)
 {
+    return true;
 }
 
-void yagl_host_glPolygonOffsetx(GLfixed factor,
+bool yagl_host_glPolygonOffsetx(GLfixed factor,
     GLfixed units)
 {
+    return true;
 }
 
-void yagl_host_glPopMatrix(void)
+bool yagl_host_glPopMatrix(void)
 {
+    return true;
 }
 
-void yagl_host_glPushMatrix(void)
+bool yagl_host_glPushMatrix(void)
 {
+    return true;
 }
 
-void yagl_host_glRotatex(GLfixed angle,
+bool yagl_host_glRotatex(GLfixed angle,
     GLfixed x,
     GLfixed y,
     GLfixed z)
 {
+    return true;
 }
 
-void yagl_host_glSampleCoveragex(GLclampx value,
+bool yagl_host_glSampleCoveragex(GLclampx value,
     GLboolean invert)
 {
+    return true;
 }
 
-void yagl_host_glScalex(GLfixed x,
+bool yagl_host_glScalex(GLfixed x,
     GLfixed y,
     GLfixed z)
 {
+    return true;
 }
 
-void yagl_host_glShadeModel(GLenum mode)
+bool yagl_host_glShadeModel(GLenum mode)
 {
+    return true;
 }
 
-void yagl_host_glTexCoordPointer(GLint size,
+bool yagl_host_glTexCoordPointer(GLint size,
     GLenum type,
     GLsizei stride,
     target_ulong /* const GLvoid* */ pointer)
 {
+    return true;
 }
 
-void yagl_host_glTexEnvi(GLenum target,
+bool yagl_host_glTexEnvi(GLenum target,
     GLenum pname,
     GLint param)
 {
+    return true;
 }
 
-void yagl_host_glTexEnvx(GLenum target,
+bool yagl_host_glTexEnvx(GLenum target,
     GLenum pname,
     GLfixed param)
 {
+    return true;
 }
 
-void yagl_host_glTexEnviv(GLenum target,
+bool yagl_host_glTexEnviv(GLenum target,
     GLenum pname,
     target_ulong /* const GLint* */ params)
 {
+    return true;
 }
 
-void yagl_host_glTexEnvxv(GLenum target,
+bool yagl_host_glTexEnvxv(GLenum target,
     GLenum pname,
     target_ulong /* const GLfixed* */ params)
 {
+    return true;
 }
 
-void yagl_host_glTexParameterx(GLenum target,
+bool yagl_host_glTexParameterx(GLenum target,
     GLenum pname,
     GLfixed param)
 {
+    return true;
 }
 
-void yagl_host_glTexParameterxv(GLenum target,
+bool yagl_host_glTexParameterxv(GLenum target,
     GLenum pname,
     target_ulong /* const GLfixed* */ params)
 {
+    return true;
 }
 
-void yagl_host_glTranslatex(GLfixed x,
+bool yagl_host_glTranslatex(GLfixed x,
     GLfixed y,
     GLfixed z)
 {
+    return true;
 }
 
-void yagl_host_glVertexPointer(GLint size,
+bool yagl_host_glVertexPointer(GLint size,
     GLenum type,
     GLsizei stride,
     target_ulong /* const GLvoid* */ pointer)
 {
+    return true;
 }
index 0985a37..db852e0 100644 (file)
 #include <GLES/gl.h>
 #include "yagl_apis/gles/yagl_host_gles_calls.h"
 
-void yagl_host_glAlphaFunc(GLenum func,
+bool yagl_host_glAlphaFunc(GLenum func,
     GLclampf ref);
-void yagl_host_glClipPlanef(GLenum plane,
+bool yagl_host_glClipPlanef(GLenum plane,
     target_ulong /* const GLfloat* */ equation);
-void yagl_host_glColor4f(GLfloat red,
+bool yagl_host_glColor4f(GLfloat red,
     GLfloat green,
     GLfloat blue,
     GLfloat alpha);
-void yagl_host_glFogf(GLenum pname,
+bool yagl_host_glFogf(GLenum pname,
     GLfloat param);
-void yagl_host_glFogfv(GLenum pname,
+bool yagl_host_glFogfv(GLenum pname,
     target_ulong /* const GLfloat* */ params);
-void yagl_host_glFrustumf(GLfloat left,
+bool yagl_host_glFrustumf(GLfloat left,
     GLfloat right,
     GLfloat bottom,
     GLfloat top,
     GLfloat zNear,
     GLfloat zFar);
-void yagl_host_glGetClipPlanef(GLenum pname,
+bool yagl_host_glGetClipPlanef(GLenum pname,
     target_ulong /* GLfloat* */ eqn);
-void yagl_host_glGetLightfv(GLenum light,
+bool yagl_host_glGetLightfv(GLenum light,
     GLenum pname,
     target_ulong /* GLfloat* */ params);
-void yagl_host_glGetMaterialfv(GLenum face,
+bool yagl_host_glGetMaterialfv(GLenum face,
     GLenum pname,
     target_ulong /* GLfloat* */ params);
-void yagl_host_glGetTexEnvfv(GLenum env,
+bool yagl_host_glGetTexEnvfv(GLenum env,
     GLenum pname,
     target_ulong /* GLfloat* */ params);
-void yagl_host_glLightModelf(GLenum pname,
+bool yagl_host_glLightModelf(GLenum pname,
     GLfloat param);
-void yagl_host_glLightModelfv(GLenum pname,
+bool yagl_host_glLightModelfv(GLenum pname,
     target_ulong /* const GLfloat* */ params);
-void yagl_host_glLightf(GLenum light,
+bool yagl_host_glLightf(GLenum light,
     GLenum pname,
     GLfloat param);
-void yagl_host_glLightfv(GLenum light,
+bool yagl_host_glLightfv(GLenum light,
     GLenum pname,
     target_ulong /* const GLfloat* */ params);
-void yagl_host_glLoadMatrixf(target_ulong /* const GLfloat* */ m);
-void yagl_host_glMaterialf(GLenum face,
+bool yagl_host_glLoadMatrixf(target_ulong /* const GLfloat* */ m);
+bool yagl_host_glMaterialf(GLenum face,
     GLenum pname,
     GLfloat param);
-void yagl_host_glMaterialfv(GLenum face,
+bool yagl_host_glMaterialfv(GLenum face,
     GLenum pname,
     target_ulong /* const GLfloat* */ params);
-void yagl_host_glMultMatrixf(target_ulong /* const GLfloat* */ m);
-void yagl_host_glMultiTexCoord4f(GLenum target,
+bool yagl_host_glMultMatrixf(target_ulong /* const GLfloat* */ m);
+bool yagl_host_glMultiTexCoord4f(GLenum target,
     GLfloat s,
     GLfloat t,
     GLfloat r,
     GLfloat q);
-void yagl_host_glNormal3f(GLfloat nx,
+bool yagl_host_glNormal3f(GLfloat nx,
     GLfloat ny,
     GLfloat nz);
-void yagl_host_glOrthof(GLfloat left,
+bool yagl_host_glOrthof(GLfloat left,
     GLfloat right,
     GLfloat bottom,
     GLfloat top,
     GLfloat zNear,
     GLfloat zFar);
-void yagl_host_glPointParameterf(GLenum pname,
+bool yagl_host_glPointParameterf(GLenum pname,
     GLfloat param);
-void yagl_host_glPointParameterfv(GLenum pname,
+bool yagl_host_glPointParameterfv(GLenum pname,
     target_ulong /* const GLfloat* */ params);
-void yagl_host_glPointSize(GLfloat size);
-void yagl_host_glRotatef(GLfloat angle,
+bool yagl_host_glPointSize(GLfloat size);
+bool yagl_host_glRotatef(GLfloat angle,
     GLfloat x,
     GLfloat y,
     GLfloat z);
-void yagl_host_glScalef(GLfloat x,
+bool yagl_host_glScalef(GLfloat x,
     GLfloat y,
     GLfloat z);
-void yagl_host_glTexEnvf(GLenum target,
+bool yagl_host_glTexEnvf(GLenum target,
     GLenum pname,
     GLfloat param);
-void yagl_host_glTexEnvfv(GLenum target,
+bool yagl_host_glTexEnvfv(GLenum target,
     GLenum pname,
     target_ulong /* const GLfloat* */ params);
-void yagl_host_glTranslatef(GLfloat x,
+bool yagl_host_glTranslatef(GLfloat x,
     GLfloat y,
     GLfloat z);
-void yagl_host_glAlphaFuncx(GLenum func,
+bool yagl_host_glAlphaFuncx(GLenum func,
     GLclampx ref);
-void yagl_host_glClearColorx(GLclampx red,
+bool yagl_host_glClearColorx(GLclampx red,
     GLclampx green,
     GLclampx blue,
     GLclampx alpha);
-void yagl_host_glClearDepthx(GLclampx depth);
-void yagl_host_glClientActiveTexture(GLenum texture);
-void yagl_host_glClipPlanex(GLenum plane,
+bool yagl_host_glClearDepthx(GLclampx depth);
+bool yagl_host_glClientActiveTexture(GLenum texture);
+bool yagl_host_glClipPlanex(GLenum plane,
     target_ulong /* const GLfixed* */ equation);
-void yagl_host_glColor4ub(GLubyte red,
+bool yagl_host_glColor4ub(GLubyte red,
     GLubyte green,
     GLubyte blue,
     GLubyte alpha);
-void yagl_host_glColor4x(GLfixed red,
+bool yagl_host_glColor4x(GLfixed red,
     GLfixed green,
     GLfixed blue,
     GLfixed alpha);
-void yagl_host_glColorPointer(GLint size,
+bool yagl_host_glColorPointer(GLint size,
     GLenum type,
     GLsizei stride,
     target_ulong /* const GLvoid* */ pointer);
-void yagl_host_glDepthRangex(GLclampx zNear,
+bool yagl_host_glDepthRangex(GLclampx zNear,
     GLclampx zFar);
-void yagl_host_glDisableClientState(GLenum array);
-void yagl_host_glEnableClientState(GLenum array);
-void yagl_host_glFogx(GLenum pname,
+bool yagl_host_glDisableClientState(GLenum array);
+bool yagl_host_glEnableClientState(GLenum array);
+bool yagl_host_glFogx(GLenum pname,
     GLfixed param);
-void yagl_host_glFogxv(GLenum pname,
+bool yagl_host_glFogxv(GLenum pname,
     target_ulong /* const GLfixed* */ params);
-void yagl_host_glFrustumx(GLfixed left,
+bool yagl_host_glFrustumx(GLfixed left,
     GLfixed right,
     GLfixed bottom,
     GLfixed top,
     GLfixed zNear,
     GLfixed zFar);
-void yagl_host_glGetClipPlanex(GLenum pname,
+bool yagl_host_glGetClipPlanex(GLenum pname,
     target_ulong /* GLfixed* */ eqn);
-void yagl_host_glGetFixedv(GLenum pname,
+bool yagl_host_glGetFixedv(GLenum pname,
     target_ulong /* GLfixed* */ params);
-void yagl_host_glGetLightxv(GLenum light,
+bool yagl_host_glGetLightxv(GLenum light,
     GLenum pname,
     target_ulong /* GLfixed* */ params);
-void yagl_host_glGetMaterialxv(GLenum face,
+bool yagl_host_glGetMaterialxv(GLenum face,
     GLenum pname,
     target_ulong /* GLfixed* */ params);
-void yagl_host_glGetPointerv(GLenum pname,
+bool yagl_host_glGetPointerv(GLenum pname,
     target_ulong /* GLvoid** */ params);
-void yagl_host_glGetTexEnviv(GLenum env,
+bool yagl_host_glGetTexEnviv(GLenum env,
     GLenum pname,
     target_ulong /* GLint* */ params);
-void yagl_host_glGetTexEnvxv(GLenum env,
+bool yagl_host_glGetTexEnvxv(GLenum env,
     GLenum pname,
     target_ulong /* GLfixed* */ params);
-void yagl_host_glGetTexParameterxv(GLenum target,
+bool yagl_host_glGetTexParameterxv(GLenum target,
     GLenum pname,
     target_ulong /* GLfixed* */ params);
-void yagl_host_glLightModelx(GLenum pname,
+bool yagl_host_glLightModelx(GLenum pname,
     GLfixed param);
-void yagl_host_glLightModelxv(GLenum pname,
+bool yagl_host_glLightModelxv(GLenum pname,
     target_ulong /* const GLfixed* */ params);
-void yagl_host_glLightx(GLenum light,
+bool yagl_host_glLightx(GLenum light,
     GLenum pname,
     GLfixed param);
-void yagl_host_glLightxv(GLenum light,
+bool yagl_host_glLightxv(GLenum light,
     GLenum pname,
     target_ulong /* const GLfixed* */ params);
-void yagl_host_glLineWidthx(GLfixed width);
-void yagl_host_glLoadIdentity(void);
-void yagl_host_glLoadMatrixx(target_ulong /* const GLfixed* */ m);
-void yagl_host_glLogicOp(GLenum opcode);
-void yagl_host_glMaterialx(GLenum face,
+bool yagl_host_glLineWidthx(GLfixed width);
+bool yagl_host_glLoadIdentity(void);
+bool yagl_host_glLoadMatrixx(target_ulong /* const GLfixed* */ m);
+bool yagl_host_glLogicOp(GLenum opcode);
+bool yagl_host_glMaterialx(GLenum face,
     GLenum pname,
     GLfixed param);
-void yagl_host_glMaterialxv(GLenum face,
+bool yagl_host_glMaterialxv(GLenum face,
     GLenum pname,
     target_ulong /* const GLfixed* */ params);
-void yagl_host_glMatrixMode(GLenum mode);
-void yagl_host_glMultMatrixx(target_ulong /* const GLfixed* */ m);
-void yagl_host_glMultiTexCoord4x(GLenum target,
+bool yagl_host_glMatrixMode(GLenum mode);
+bool yagl_host_glMultMatrixx(target_ulong /* const GLfixed* */ m);
+bool yagl_host_glMultiTexCoord4x(GLenum target,
     GLfixed s,
     GLfixed t,
     GLfixed r,
     GLfixed q);
-void yagl_host_glNormal3x(GLfixed nx,
+bool yagl_host_glNormal3x(GLfixed nx,
     GLfixed ny,
     GLfixed nz);
-void yagl_host_glNormalPointer(GLenum type,
+bool yagl_host_glNormalPointer(GLenum type,
     GLsizei stride,
     target_ulong /* const GLvoid* */ pointer);
-void yagl_host_glOrthox(GLfixed left,
+bool yagl_host_glOrthox(GLfixed left,
     GLfixed right,
     GLfixed bottom,
     GLfixed top,
     GLfixed zNear,
     GLfixed zFar);
-void yagl_host_glPointParameterx(GLenum pname,
+bool yagl_host_glPointParameterx(GLenum pname,
     GLfixed param);
-void yagl_host_glPointParameterxv(GLenum pname,
+bool yagl_host_glPointParameterxv(GLenum pname,
     target_ulong /* const GLfixed* */ params);
-void yagl_host_glPointSizex(GLfixed size);
-void yagl_host_glPolygonOffsetx(GLfixed factor,
+bool yagl_host_glPointSizex(GLfixed size);
+bool yagl_host_glPolygonOffsetx(GLfixed factor,
     GLfixed units);
-void yagl_host_glPopMatrix(void);
-void yagl_host_glPushMatrix(void);
-void yagl_host_glRotatex(GLfixed angle,
+bool yagl_host_glPopMatrix(void);
+bool yagl_host_glPushMatrix(void);
+bool yagl_host_glRotatex(GLfixed angle,
     GLfixed x,
     GLfixed y,
     GLfixed z);
-void yagl_host_glSampleCoveragex(GLclampx value,
+bool yagl_host_glSampleCoveragex(GLclampx value,
     GLboolean invert);
-void yagl_host_glScalex(GLfixed x,
+bool yagl_host_glScalex(GLfixed x,
     GLfixed y,
     GLfixed z);
-void yagl_host_glShadeModel(GLenum mode);
-void yagl_host_glTexCoordPointer(GLint size,
+bool yagl_host_glShadeModel(GLenum mode);
+bool yagl_host_glTexCoordPointer(GLint size,
     GLenum type,
     GLsizei stride,
     target_ulong /* const GLvoid* */ pointer);
-void yagl_host_glTexEnvi(GLenum target,
+bool yagl_host_glTexEnvi(GLenum target,
     GLenum pname,
     GLint param);
-void yagl_host_glTexEnvx(GLenum target,
+bool yagl_host_glTexEnvx(GLenum target,
     GLenum pname,
     GLfixed param);
-void yagl_host_glTexEnviv(GLenum target,
+bool yagl_host_glTexEnviv(GLenum target,
     GLenum pname,
     target_ulong /* const GLint* */ params);
-void yagl_host_glTexEnvxv(GLenum target,
+bool yagl_host_glTexEnvxv(GLenum target,
     GLenum pname,
     target_ulong /* const GLfixed* */ params);
-void yagl_host_glTexParameterx(GLenum target,
+bool yagl_host_glTexParameterx(GLenum target,
     GLenum pname,
     GLfixed param);
-void yagl_host_glTexParameterxv(GLenum target,
+bool yagl_host_glTexParameterxv(GLenum target,
     GLenum pname,
     target_ulong /* const GLfixed* */ params);
-void yagl_host_glTranslatex(GLfixed x,
+bool yagl_host_glTranslatex(GLfixed x,
     GLfixed y,
     GLfixed z);
-void yagl_host_glVertexPointer(GLint size,
+bool yagl_host_glVertexPointer(GLint size,
     GLenum type,
     GLsizei stride,
     target_ulong /* const GLvoid* */ pointer);
index baf01de..8310bd7 100644 (file)
 /*
  * glActiveTexture dispatcher. id = 1
  */
-static uint8_t* yagl_func_glActiveTexture(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glActiveTexture(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum texture = yagl_marshal_get_GLenum(&out_buff);
+    GLenum texture = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glActiveTexture, GLenum, texture);
-    yagl_host_glActiveTexture(texture);
+    bool res = yagl_host_glActiveTexture(texture);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glAttachShader dispatcher. id = 2
  */
-static uint8_t* yagl_func_glAttachShader(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glAttachShader(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
-    GLuint shader = yagl_marshal_get_GLuint(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
+    GLuint shader = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glAttachShader, GLuint, GLuint, program, shader);
-    yagl_host_glAttachShader(program, shader);
+    bool res = yagl_host_glAttachShader(program, shader);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBindAttribLocation dispatcher. id = 3
  */
-static uint8_t* yagl_func_glBindAttribLocation(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBindAttribLocation(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
-    GLuint index = yagl_marshal_get_GLuint(&out_buff);
-    target_ulong name = yagl_marshal_get_ptr(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
+    GLuint index = yagl_marshal_get_GLuint(out_buff);
+    target_ulong name = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glBindAttribLocation, GLuint, GLuint, target_ulong, program, index, name);
-    yagl_host_glBindAttribLocation(program, index, name);
+    bool res = yagl_host_glBindAttribLocation(program, index, name);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBindBuffer dispatcher. id = 4
  */
-static uint8_t* yagl_func_glBindBuffer(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBindBuffer(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLuint buffer = yagl_marshal_get_GLuint(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLuint buffer = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glBindBuffer, GLenum, GLuint, target, buffer);
-    yagl_host_glBindBuffer(target, buffer);
+    bool res = yagl_host_glBindBuffer(target, buffer);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBindFramebuffer dispatcher. id = 5
  */
-static uint8_t* yagl_func_glBindFramebuffer(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBindFramebuffer(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLuint framebuffer = yagl_marshal_get_GLuint(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLuint framebuffer = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glBindFramebuffer, GLenum, GLuint, target, framebuffer);
-    yagl_host_glBindFramebuffer(target, framebuffer);
+    bool res = yagl_host_glBindFramebuffer(target, framebuffer);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBindRenderbuffer dispatcher. id = 6
  */
-static uint8_t* yagl_func_glBindRenderbuffer(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBindRenderbuffer(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLuint renderbuffer = yagl_marshal_get_GLuint(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLuint renderbuffer = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glBindRenderbuffer, GLenum, GLuint, target, renderbuffer);
-    yagl_host_glBindRenderbuffer(target, renderbuffer);
+    bool res = yagl_host_glBindRenderbuffer(target, renderbuffer);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBindTexture dispatcher. id = 7
  */
-static uint8_t* yagl_func_glBindTexture(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBindTexture(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLuint texture = yagl_marshal_get_GLuint(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLuint texture = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glBindTexture, GLenum, GLuint, target, texture);
-    yagl_host_glBindTexture(target, texture);
+    bool res = yagl_host_glBindTexture(target, texture);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBlendColor dispatcher. id = 8
  */
-static uint8_t* yagl_func_glBlendColor(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBlendColor(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLclampf red = yagl_marshal_get_GLclampf(&out_buff);
-    GLclampf green = yagl_marshal_get_GLclampf(&out_buff);
-    GLclampf blue = yagl_marshal_get_GLclampf(&out_buff);
-    GLclampf alpha = yagl_marshal_get_GLclampf(&out_buff);
+    GLclampf red = yagl_marshal_get_GLclampf(out_buff);
+    GLclampf green = yagl_marshal_get_GLclampf(out_buff);
+    GLclampf blue = yagl_marshal_get_GLclampf(out_buff);
+    GLclampf alpha = yagl_marshal_get_GLclampf(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glBlendColor, GLclampf, GLclampf, GLclampf, GLclampf, red, green, blue, alpha);
-    yagl_host_glBlendColor(red, green, blue, alpha);
+    bool res = yagl_host_glBlendColor(red, green, blue, alpha);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBlendEquation dispatcher. id = 9
  */
-static uint8_t* yagl_func_glBlendEquation(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBlendEquation(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum mode = yagl_marshal_get_GLenum(&out_buff);
+    GLenum mode = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glBlendEquation, GLenum, mode);
-    yagl_host_glBlendEquation(mode);
+    bool res = yagl_host_glBlendEquation(mode);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBlendEquationSeparate dispatcher. id = 10
  */
-static uint8_t* yagl_func_glBlendEquationSeparate(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBlendEquationSeparate(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum modeRGB = yagl_marshal_get_GLenum(&out_buff);
-    GLenum modeAlpha = yagl_marshal_get_GLenum(&out_buff);
+    GLenum modeRGB = yagl_marshal_get_GLenum(out_buff);
+    GLenum modeAlpha = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glBlendEquationSeparate, GLenum, GLenum, modeRGB, modeAlpha);
-    yagl_host_glBlendEquationSeparate(modeRGB, modeAlpha);
+    bool res = yagl_host_glBlendEquationSeparate(modeRGB, modeAlpha);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBlendFunc dispatcher. id = 11
  */
-static uint8_t* yagl_func_glBlendFunc(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBlendFunc(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum sfactor = yagl_marshal_get_GLenum(&out_buff);
-    GLenum dfactor = yagl_marshal_get_GLenum(&out_buff);
+    GLenum sfactor = yagl_marshal_get_GLenum(out_buff);
+    GLenum dfactor = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glBlendFunc, GLenum, GLenum, sfactor, dfactor);
-    yagl_host_glBlendFunc(sfactor, dfactor);
+    bool res = yagl_host_glBlendFunc(sfactor, dfactor);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBlendFuncSeparate dispatcher. id = 12
  */
-static uint8_t* yagl_func_glBlendFuncSeparate(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBlendFuncSeparate(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum srcRGB = yagl_marshal_get_GLenum(&out_buff);
-    GLenum dstRGB = yagl_marshal_get_GLenum(&out_buff);
-    GLenum srcAlpha = yagl_marshal_get_GLenum(&out_buff);
-    GLenum dstAlpha = yagl_marshal_get_GLenum(&out_buff);
+    GLenum srcRGB = yagl_marshal_get_GLenum(out_buff);
+    GLenum dstRGB = yagl_marshal_get_GLenum(out_buff);
+    GLenum srcAlpha = yagl_marshal_get_GLenum(out_buff);
+    GLenum dstAlpha = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glBlendFuncSeparate, GLenum, GLenum, GLenum, GLenum, srcRGB, dstRGB, srcAlpha, dstAlpha);
-    yagl_host_glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
+    bool res = yagl_host_glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBufferData dispatcher. id = 13
  */
-static uint8_t* yagl_func_glBufferData(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBufferData(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLsizeiptr size = yagl_marshal_get_GLsizeiptr(&out_buff);
-    target_ulong data = yagl_marshal_get_ptr(&out_buff);
-    GLenum usage = yagl_marshal_get_GLenum(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLsizeiptr size = yagl_marshal_get_GLsizeiptr(out_buff);
+    target_ulong data = yagl_marshal_get_ptr(out_buff);
+    GLenum usage = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glBufferData, GLenum, GLsizeiptr, target_ulong, GLenum, target, size, data, usage);
-    yagl_host_glBufferData(target, size, data, usage);
+    bool res = yagl_host_glBufferData(target, size, data, usage);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glBufferSubData dispatcher. id = 14
  */
-static uint8_t* yagl_func_glBufferSubData(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glBufferSubData(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLintptr offset = yagl_marshal_get_GLintptr(&out_buff);
-    GLsizeiptr size = yagl_marshal_get_GLsizeiptr(&out_buff);
-    target_ulong data = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLintptr offset = yagl_marshal_get_GLintptr(out_buff);
+    GLsizeiptr size = yagl_marshal_get_GLsizeiptr(out_buff);
+    target_ulong data = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glBufferSubData, GLenum, GLintptr, GLsizeiptr, target_ulong, target, offset, size, data);
-    yagl_host_glBufferSubData(target, offset, size, data);
+    bool res = yagl_host_glBufferSubData(target, offset, size, data);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glCheckFramebufferStatus dispatcher. id = 15
  */
-static uint8_t* yagl_func_glCheckFramebufferStatus(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glCheckFramebufferStatus(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glCheckFramebufferStatus, GLenum, target);
-    GLenum ret = yagl_host_glCheckFramebufferStatus(target);
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLenum, ret);
-    yagl_marshal_put_GLenum(&in_buff, ret);
-    return out_buff;
+    GLenum retval;
+    bool res = yagl_host_glCheckFramebufferStatus(&retval, target);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLenum, retval);
+    yagl_marshal_put_GLenum(&in_buff, retval);
+    return true;
 }
 
 /*
  * glClear dispatcher. id = 16
  */
-static uint8_t* yagl_func_glClear(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glClear(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLbitfield mask = yagl_marshal_get_GLbitfield(&out_buff);
+    GLbitfield mask = yagl_marshal_get_GLbitfield(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glClear, GLbitfield, mask);
-    yagl_host_glClear(mask);
+    bool res = yagl_host_glClear(mask);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glClearColor dispatcher. id = 17
  */
-static uint8_t* yagl_func_glClearColor(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glClearColor(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLclampf red = yagl_marshal_get_GLclampf(&out_buff);
-    GLclampf green = yagl_marshal_get_GLclampf(&out_buff);
-    GLclampf blue = yagl_marshal_get_GLclampf(&out_buff);
-    GLclampf alpha = yagl_marshal_get_GLclampf(&out_buff);
+    GLclampf red = yagl_marshal_get_GLclampf(out_buff);
+    GLclampf green = yagl_marshal_get_GLclampf(out_buff);
+    GLclampf blue = yagl_marshal_get_GLclampf(out_buff);
+    GLclampf alpha = yagl_marshal_get_GLclampf(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glClearColor, GLclampf, GLclampf, GLclampf, GLclampf, red, green, blue, alpha);
-    yagl_host_glClearColor(red, green, blue, alpha);
+    bool res = yagl_host_glClearColor(red, green, blue, alpha);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glClearDepthf dispatcher. id = 18
  */
-static uint8_t* yagl_func_glClearDepthf(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glClearDepthf(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLclampf depth = yagl_marshal_get_GLclampf(&out_buff);
+    GLclampf depth = yagl_marshal_get_GLclampf(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glClearDepthf, GLclampf, depth);
-    yagl_host_glClearDepthf(depth);
+    bool res = yagl_host_glClearDepthf(depth);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glClearStencil dispatcher. id = 19
  */
-static uint8_t* yagl_func_glClearStencil(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glClearStencil(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint s = yagl_marshal_get_GLint(&out_buff);
+    GLint s = yagl_marshal_get_GLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glClearStencil, GLint, s);
-    yagl_host_glClearStencil(s);
+    bool res = yagl_host_glClearStencil(s);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glColorMask dispatcher. id = 20
  */
-static uint8_t* yagl_func_glColorMask(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glColorMask(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLboolean red = yagl_marshal_get_GLboolean(&out_buff);
-    GLboolean green = yagl_marshal_get_GLboolean(&out_buff);
-    GLboolean blue = yagl_marshal_get_GLboolean(&out_buff);
-    GLboolean alpha = yagl_marshal_get_GLboolean(&out_buff);
+    GLboolean red = yagl_marshal_get_GLboolean(out_buff);
+    GLboolean green = yagl_marshal_get_GLboolean(out_buff);
+    GLboolean blue = yagl_marshal_get_GLboolean(out_buff);
+    GLboolean alpha = yagl_marshal_get_GLboolean(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glColorMask, GLboolean, GLboolean, GLboolean, GLboolean, red, green, blue, alpha);
-    yagl_host_glColorMask(red, green, blue, alpha);
+    bool res = yagl_host_glColorMask(red, green, blue, alpha);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glCompileShader dispatcher. id = 21
  */
-static uint8_t* yagl_func_glCompileShader(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glCompileShader(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint shader = yagl_marshal_get_GLuint(&out_buff);
+    GLuint shader = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glCompileShader, GLuint, shader);
-    yagl_host_glCompileShader(shader);
+    bool res = yagl_host_glCompileShader(shader);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glCompressedTexImage2D dispatcher. id = 22
  */
-static uint8_t* yagl_func_glCompressedTexImage2D(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glCompressedTexImage2D(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLint level = yagl_marshal_get_GLint(&out_buff);
-    GLenum internalformat = yagl_marshal_get_GLenum(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
-    GLint border = yagl_marshal_get_GLint(&out_buff);
-    GLsizei imageSize = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong data = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLint level = yagl_marshal_get_GLint(out_buff);
+    GLenum internalformat = yagl_marshal_get_GLenum(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
+    GLint border = yagl_marshal_get_GLint(out_buff);
+    GLsizei imageSize = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong data = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT8(ts->ps->id, ts->id, glCompressedTexImage2D, GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, target_ulong, target, level, internalformat, width, height, border, imageSize, data);
-    yagl_host_glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
+    bool res = yagl_host_glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glCompressedTexSubImage2D dispatcher. id = 23
  */
-static uint8_t* yagl_func_glCompressedTexSubImage2D(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glCompressedTexSubImage2D(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLint level = yagl_marshal_get_GLint(&out_buff);
-    GLint xoffset = yagl_marshal_get_GLint(&out_buff);
-    GLint yoffset = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
-    GLenum format = yagl_marshal_get_GLenum(&out_buff);
-    GLsizei imageSize = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong data = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLint level = yagl_marshal_get_GLint(out_buff);
+    GLint xoffset = yagl_marshal_get_GLint(out_buff);
+    GLint yoffset = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
+    GLenum format = yagl_marshal_get_GLenum(out_buff);
+    GLsizei imageSize = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong data = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT9(ts->ps->id, ts->id, glCompressedTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, target_ulong, target, level, xoffset, yoffset, width, height, format, imageSize, data);
-    yagl_host_glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
+    bool res = yagl_host_glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glCopyTexImage2D dispatcher. id = 24
  */
-static uint8_t* yagl_func_glCopyTexImage2D(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glCopyTexImage2D(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLint level = yagl_marshal_get_GLint(&out_buff);
-    GLenum internalformat = yagl_marshal_get_GLenum(&out_buff);
-    GLint x = yagl_marshal_get_GLint(&out_buff);
-    GLint y = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
-    GLint border = yagl_marshal_get_GLint(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLint level = yagl_marshal_get_GLint(out_buff);
+    GLenum internalformat = yagl_marshal_get_GLenum(out_buff);
+    GLint x = yagl_marshal_get_GLint(out_buff);
+    GLint y = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
+    GLint border = yagl_marshal_get_GLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT8(ts->ps->id, ts->id, glCopyTexImage2D, GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, target, level, internalformat, x, y, width, height, border);
-    yagl_host_glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
+    bool res = yagl_host_glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glCopyTexSubImage2D dispatcher. id = 25
  */
-static uint8_t* yagl_func_glCopyTexSubImage2D(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glCopyTexSubImage2D(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLint level = yagl_marshal_get_GLint(&out_buff);
-    GLint xoffset = yagl_marshal_get_GLint(&out_buff);
-    GLint yoffset = yagl_marshal_get_GLint(&out_buff);
-    GLint x = yagl_marshal_get_GLint(&out_buff);
-    GLint y = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLint level = yagl_marshal_get_GLint(out_buff);
+    GLint xoffset = yagl_marshal_get_GLint(out_buff);
+    GLint yoffset = yagl_marshal_get_GLint(out_buff);
+    GLint x = yagl_marshal_get_GLint(out_buff);
+    GLint y = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT8(ts->ps->id, ts->id, glCopyTexSubImage2D, GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, target, level, xoffset, yoffset, x, y, width, height);
-    yagl_host_glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
+    bool res = yagl_host_glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glCreateProgram dispatcher. id = 26
  */
-static uint8_t* yagl_func_glCreateProgram(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glCreateProgram(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
     YAGL_LOG_FUNC_ENTER_SPLIT0(ts->ps->id, ts->id, glCreateProgram);
-    GLuint ret = yagl_host_glCreateProgram();
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLuint, ret);
-    yagl_marshal_put_GLuint(&in_buff, ret);
-    return out_buff;
+    GLuint retval;
+    bool res = yagl_host_glCreateProgram(&retval);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLuint, retval);
+    yagl_marshal_put_GLuint(&in_buff, retval);
+    return true;
 }
 
 /*
  * glCreateShader dispatcher. id = 27
  */
-static uint8_t* yagl_func_glCreateShader(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glCreateShader(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum type = yagl_marshal_get_GLenum(&out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glCreateShader, GLenum, type);
-    GLuint ret = yagl_host_glCreateShader(type);
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLuint, ret);
-    yagl_marshal_put_GLuint(&in_buff, ret);
-    return out_buff;
+    GLuint retval;
+    bool res = yagl_host_glCreateShader(&retval, type);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLuint, retval);
+    yagl_marshal_put_GLuint(&in_buff, retval);
+    return true;
 }
 
 /*
  * glCullFace dispatcher. id = 28
  */
-static uint8_t* yagl_func_glCullFace(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glCullFace(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum mode = yagl_marshal_get_GLenum(&out_buff);
+    GLenum mode = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glCullFace, GLenum, mode);
-    yagl_host_glCullFace(mode);
+    bool res = yagl_host_glCullFace(mode);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDeleteBuffers dispatcher. id = 29
  */
-static uint8_t* yagl_func_glDeleteBuffers(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDeleteBuffers(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLsizei n = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong buffers = yagl_marshal_get_ptr(&out_buff);
+    GLsizei n = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong buffers = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glDeleteBuffers, GLsizei, target_ulong, n, buffers);
-    yagl_host_glDeleteBuffers(n, buffers);
+    bool res = yagl_host_glDeleteBuffers(n, buffers);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDeleteFramebuffers dispatcher. id = 30
  */
-static uint8_t* yagl_func_glDeleteFramebuffers(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDeleteFramebuffers(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLsizei n = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong framebuffers = yagl_marshal_get_ptr(&out_buff);
+    GLsizei n = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong framebuffers = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glDeleteFramebuffers, GLsizei, target_ulong, n, framebuffers);
-    yagl_host_glDeleteFramebuffers(n, framebuffers);
+    bool res = yagl_host_glDeleteFramebuffers(n, framebuffers);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDeleteProgram dispatcher. id = 31
  */
-static uint8_t* yagl_func_glDeleteProgram(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDeleteProgram(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glDeleteProgram, GLuint, program);
-    yagl_host_glDeleteProgram(program);
+    bool res = yagl_host_glDeleteProgram(program);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDeleteRenderbuffers dispatcher. id = 32
  */
-static uint8_t* yagl_func_glDeleteRenderbuffers(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDeleteRenderbuffers(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLsizei n = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong renderbuffers = yagl_marshal_get_ptr(&out_buff);
+    GLsizei n = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong renderbuffers = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glDeleteRenderbuffers, GLsizei, target_ulong, n, renderbuffers);
-    yagl_host_glDeleteRenderbuffers(n, renderbuffers);
+    bool res = yagl_host_glDeleteRenderbuffers(n, renderbuffers);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDeleteShader dispatcher. id = 33
  */
-static uint8_t* yagl_func_glDeleteShader(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDeleteShader(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint shader = yagl_marshal_get_GLuint(&out_buff);
+    GLuint shader = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glDeleteShader, GLuint, shader);
-    yagl_host_glDeleteShader(shader);
+    bool res = yagl_host_glDeleteShader(shader);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDeleteTextures dispatcher. id = 34
  */
-static uint8_t* yagl_func_glDeleteTextures(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDeleteTextures(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLsizei n = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong textures = yagl_marshal_get_ptr(&out_buff);
+    GLsizei n = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong textures = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glDeleteTextures, GLsizei, target_ulong, n, textures);
-    yagl_host_glDeleteTextures(n, textures);
+    bool res = yagl_host_glDeleteTextures(n, textures);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDepthFunc dispatcher. id = 35
  */
-static uint8_t* yagl_func_glDepthFunc(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDepthFunc(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum func = yagl_marshal_get_GLenum(&out_buff);
+    GLenum func = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glDepthFunc, GLenum, func);
-    yagl_host_glDepthFunc(func);
+    bool res = yagl_host_glDepthFunc(func);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDepthMask dispatcher. id = 36
  */
-static uint8_t* yagl_func_glDepthMask(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDepthMask(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLboolean flag = yagl_marshal_get_GLboolean(&out_buff);
+    GLboolean flag = yagl_marshal_get_GLboolean(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glDepthMask, GLboolean, flag);
-    yagl_host_glDepthMask(flag);
+    bool res = yagl_host_glDepthMask(flag);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDepthRangef dispatcher. id = 37
  */
-static uint8_t* yagl_func_glDepthRangef(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDepthRangef(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLclampf zNear = yagl_marshal_get_GLclampf(&out_buff);
-    GLclampf zFar = yagl_marshal_get_GLclampf(&out_buff);
+    GLclampf zNear = yagl_marshal_get_GLclampf(out_buff);
+    GLclampf zFar = yagl_marshal_get_GLclampf(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glDepthRangef, GLclampf, GLclampf, zNear, zFar);
-    yagl_host_glDepthRangef(zNear, zFar);
+    bool res = yagl_host_glDepthRangef(zNear, zFar);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDetachShader dispatcher. id = 38
  */
-static uint8_t* yagl_func_glDetachShader(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDetachShader(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
-    GLuint shader = yagl_marshal_get_GLuint(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
+    GLuint shader = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glDetachShader, GLuint, GLuint, program, shader);
-    yagl_host_glDetachShader(program, shader);
+    bool res = yagl_host_glDetachShader(program, shader);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDisable dispatcher. id = 39
  */
-static uint8_t* yagl_func_glDisable(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDisable(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum cap = yagl_marshal_get_GLenum(&out_buff);
+    GLenum cap = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glDisable, GLenum, cap);
-    yagl_host_glDisable(cap);
+    bool res = yagl_host_glDisable(cap);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDisableVertexAttribArray dispatcher. id = 40
  */
-static uint8_t* yagl_func_glDisableVertexAttribArray(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDisableVertexAttribArray(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint index = yagl_marshal_get_GLuint(&out_buff);
+    GLuint index = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glDisableVertexAttribArray, GLuint, index);
-    yagl_host_glDisableVertexAttribArray(index);
+    bool res = yagl_host_glDisableVertexAttribArray(index);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDrawArrays dispatcher. id = 41
  */
-static uint8_t* yagl_func_glDrawArrays(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDrawArrays(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum mode = yagl_marshal_get_GLenum(&out_buff);
-    GLint first = yagl_marshal_get_GLint(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
+    GLenum mode = yagl_marshal_get_GLenum(out_buff);
+    GLint first = yagl_marshal_get_GLint(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glDrawArrays, GLenum, GLint, GLsizei, mode, first, count);
-    yagl_host_glDrawArrays(mode, first, count);
+    bool res = yagl_host_glDrawArrays(mode, first, count);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glDrawElements dispatcher. id = 42
  */
-static uint8_t* yagl_func_glDrawElements(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glDrawElements(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum mode = yagl_marshal_get_GLenum(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
-    GLenum type = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong indices = yagl_marshal_get_ptr(&out_buff);
+    GLenum mode = yagl_marshal_get_GLenum(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
+    target_ulong indices = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glDrawElements, GLenum, GLsizei, GLenum, target_ulong, mode, count, type, indices);
-    yagl_host_glDrawElements(mode, count, type, indices);
+    bool res = yagl_host_glDrawElements(mode, count, type, indices);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glEnable dispatcher. id = 43
  */
-static uint8_t* yagl_func_glEnable(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glEnable(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum cap = yagl_marshal_get_GLenum(&out_buff);
+    GLenum cap = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glEnable, GLenum, cap);
-    yagl_host_glEnable(cap);
+    bool res = yagl_host_glEnable(cap);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glEnableVertexAttribArray dispatcher. id = 44
  */
-static uint8_t* yagl_func_glEnableVertexAttribArray(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glEnableVertexAttribArray(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint index = yagl_marshal_get_GLuint(&out_buff);
+    GLuint index = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glEnableVertexAttribArray, GLuint, index);
-    yagl_host_glEnableVertexAttribArray(index);
+    bool res = yagl_host_glEnableVertexAttribArray(index);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glFinish dispatcher. id = 45
  */
-static uint8_t* yagl_func_glFinish(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glFinish(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
     YAGL_LOG_FUNC_ENTER_SPLIT0(ts->ps->id, ts->id, glFinish);
-    yagl_host_glFinish();
+    bool res = yagl_host_glFinish();
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glFlush dispatcher. id = 46
  */
-static uint8_t* yagl_func_glFlush(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glFlush(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
     YAGL_LOG_FUNC_ENTER_SPLIT0(ts->ps->id, ts->id, glFlush);
-    yagl_host_glFlush();
+    bool res = yagl_host_glFlush();
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glFramebufferRenderbuffer dispatcher. id = 47
  */
-static uint8_t* yagl_func_glFramebufferRenderbuffer(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glFramebufferRenderbuffer(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum attachment = yagl_marshal_get_GLenum(&out_buff);
-    GLenum renderbuffertarget = yagl_marshal_get_GLenum(&out_buff);
-    GLuint renderbuffer = yagl_marshal_get_GLuint(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum attachment = yagl_marshal_get_GLenum(out_buff);
+    GLenum renderbuffertarget = yagl_marshal_get_GLenum(out_buff);
+    GLuint renderbuffer = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glFramebufferRenderbuffer, GLenum, GLenum, GLenum, GLuint, target, attachment, renderbuffertarget, renderbuffer);
-    yagl_host_glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
+    bool res = yagl_host_glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glFramebufferTexture2D dispatcher. id = 48
  */
-static uint8_t* yagl_func_glFramebufferTexture2D(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glFramebufferTexture2D(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum attachment = yagl_marshal_get_GLenum(&out_buff);
-    GLenum textarget = yagl_marshal_get_GLenum(&out_buff);
-    GLuint texture = yagl_marshal_get_GLuint(&out_buff);
-    GLint level = yagl_marshal_get_GLint(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum attachment = yagl_marshal_get_GLenum(out_buff);
+    GLenum textarget = yagl_marshal_get_GLenum(out_buff);
+    GLuint texture = yagl_marshal_get_GLuint(out_buff);
+    GLint level = yagl_marshal_get_GLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT5(ts->ps->id, ts->id, glFramebufferTexture2D, GLenum, GLenum, GLenum, GLuint, GLint, target, attachment, textarget, texture, level);
-    yagl_host_glFramebufferTexture2D(target, attachment, textarget, texture, level);
+    bool res = yagl_host_glFramebufferTexture2D(target, attachment, textarget, texture, level);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glFrontFace dispatcher. id = 49
  */
-static uint8_t* yagl_func_glFrontFace(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glFrontFace(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum mode = yagl_marshal_get_GLenum(&out_buff);
+    GLenum mode = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glFrontFace, GLenum, mode);
-    yagl_host_glFrontFace(mode);
+    bool res = yagl_host_glFrontFace(mode);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGenBuffers dispatcher. id = 50
  */
-static uint8_t* yagl_func_glGenBuffers(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGenBuffers(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLsizei n = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong buffers = yagl_marshal_get_ptr(&out_buff);
+    GLsizei n = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong buffers = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGenBuffers, GLsizei, target_ulong, n, buffers);
-    yagl_host_glGenBuffers(n, buffers);
+    bool res = yagl_host_glGenBuffers(n, buffers);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGenerateMipmap dispatcher. id = 51
  */
-static uint8_t* yagl_func_glGenerateMipmap(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGenerateMipmap(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glGenerateMipmap, GLenum, target);
-    yagl_host_glGenerateMipmap(target);
+    bool res = yagl_host_glGenerateMipmap(target);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGenFramebuffers dispatcher. id = 52
  */
-static uint8_t* yagl_func_glGenFramebuffers(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGenFramebuffers(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLsizei n = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong framebuffers = yagl_marshal_get_ptr(&out_buff);
+    GLsizei n = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong framebuffers = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGenFramebuffers, GLsizei, target_ulong, n, framebuffers);
-    yagl_host_glGenFramebuffers(n, framebuffers);
+    bool res = yagl_host_glGenFramebuffers(n, framebuffers);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGenRenderbuffers dispatcher. id = 53
  */
-static uint8_t* yagl_func_glGenRenderbuffers(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGenRenderbuffers(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLsizei n = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong renderbuffers = yagl_marshal_get_ptr(&out_buff);
+    GLsizei n = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong renderbuffers = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGenRenderbuffers, GLsizei, target_ulong, n, renderbuffers);
-    yagl_host_glGenRenderbuffers(n, renderbuffers);
+    bool res = yagl_host_glGenRenderbuffers(n, renderbuffers);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGenTextures dispatcher. id = 54
  */
-static uint8_t* yagl_func_glGenTextures(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGenTextures(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLsizei n = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong textures = yagl_marshal_get_ptr(&out_buff);
+    GLsizei n = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong textures = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGenTextures, GLsizei, target_ulong, n, textures);
-    yagl_host_glGenTextures(n, textures);
+    bool res = yagl_host_glGenTextures(n, textures);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetActiveAttrib dispatcher. id = 55
  */
-static uint8_t* yagl_func_glGetActiveAttrib(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetActiveAttrib(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
-    GLuint index = yagl_marshal_get_GLuint(&out_buff);
-    GLsizei bufsize = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong length = yagl_marshal_get_ptr(&out_buff);
-    target_ulong size = yagl_marshal_get_ptr(&out_buff);
-    target_ulong type = yagl_marshal_get_ptr(&out_buff);
-    target_ulong name = yagl_marshal_get_ptr(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
+    GLuint index = yagl_marshal_get_GLuint(out_buff);
+    GLsizei bufsize = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong length = yagl_marshal_get_ptr(out_buff);
+    target_ulong size = yagl_marshal_get_ptr(out_buff);
+    target_ulong type = yagl_marshal_get_ptr(out_buff);
+    target_ulong name = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT7(ts->ps->id, ts->id, glGetActiveAttrib, GLuint, GLuint, GLsizei, target_ulong, target_ulong, target_ulong, target_ulong, program, index, bufsize, length, size, type, name);
-    yagl_host_glGetActiveAttrib(program, index, bufsize, length, size, type, name);
+    bool res = yagl_host_glGetActiveAttrib(program, index, bufsize, length, size, type, name);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetActiveUniform dispatcher. id = 56
  */
-static uint8_t* yagl_func_glGetActiveUniform(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetActiveUniform(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
-    GLuint index = yagl_marshal_get_GLuint(&out_buff);
-    GLsizei bufsize = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong length = yagl_marshal_get_ptr(&out_buff);
-    target_ulong size = yagl_marshal_get_ptr(&out_buff);
-    target_ulong type = yagl_marshal_get_ptr(&out_buff);
-    target_ulong name = yagl_marshal_get_ptr(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
+    GLuint index = yagl_marshal_get_GLuint(out_buff);
+    GLsizei bufsize = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong length = yagl_marshal_get_ptr(out_buff);
+    target_ulong size = yagl_marshal_get_ptr(out_buff);
+    target_ulong type = yagl_marshal_get_ptr(out_buff);
+    target_ulong name = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT7(ts->ps->id, ts->id, glGetActiveUniform, GLuint, GLuint, GLsizei, target_ulong, target_ulong, target_ulong, target_ulong, program, index, bufsize, length, size, type, name);
-    yagl_host_glGetActiveUniform(program, index, bufsize, length, size, type, name);
+    bool res = yagl_host_glGetActiveUniform(program, index, bufsize, length, size, type, name);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetAttachedShaders dispatcher. id = 57
  */
-static uint8_t* yagl_func_glGetAttachedShaders(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetAttachedShaders(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
-    GLsizei maxcount = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong count = yagl_marshal_get_ptr(&out_buff);
-    target_ulong shaders = yagl_marshal_get_ptr(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
+    GLsizei maxcount = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong count = yagl_marshal_get_ptr(out_buff);
+    target_ulong shaders = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glGetAttachedShaders, GLuint, GLsizei, target_ulong, target_ulong, program, maxcount, count, shaders);
-    yagl_host_glGetAttachedShaders(program, maxcount, count, shaders);
+    bool res = yagl_host_glGetAttachedShaders(program, maxcount, count, shaders);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetAttribLocation dispatcher. id = 58
  */
-static uint8_t* yagl_func_glGetAttribLocation(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetAttribLocation(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
-    target_ulong name = yagl_marshal_get_ptr(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
+    target_ulong name = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGetAttribLocation, GLuint, target_ulong, program, name);
-    int ret = yagl_host_glGetAttribLocation(program, name);
-    YAGL_LOG_FUNC_EXIT_SPLIT(int, ret);
-    yagl_marshal_put_int(&in_buff, ret);
-    return out_buff;
+    int retval;
+    bool res = yagl_host_glGetAttribLocation(&retval, program, name);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(int, retval);
+    yagl_marshal_put_int(&in_buff, retval);
+    return true;
 }
 
 /*
  * glGetBooleanv dispatcher. id = 59
  */
-static uint8_t* yagl_func_glGetBooleanv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetBooleanv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGetBooleanv, GLenum, target_ulong, pname, params);
-    yagl_host_glGetBooleanv(pname, params);
+    bool res = yagl_host_glGetBooleanv(pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetBufferParameteriv dispatcher. id = 60
  */
-static uint8_t* yagl_func_glGetBufferParameteriv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetBufferParameteriv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetBufferParameteriv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glGetBufferParameteriv(target, pname, params);
+    bool res = yagl_host_glGetBufferParameteriv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetError dispatcher. id = 61
  */
-static uint8_t* yagl_func_glGetError(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetError(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
     YAGL_LOG_FUNC_ENTER_SPLIT0(ts->ps->id, ts->id, glGetError);
-    GLenum ret = yagl_host_glGetError();
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLenum, ret);
-    yagl_marshal_put_GLenum(&in_buff, ret);
-    return out_buff;
+    GLenum retval;
+    bool res = yagl_host_glGetError(&retval);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLenum, retval);
+    yagl_marshal_put_GLenum(&in_buff, retval);
+    return true;
 }
 
 /*
  * glGetFloatv dispatcher. id = 62
  */
-static uint8_t* yagl_func_glGetFloatv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetFloatv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGetFloatv, GLenum, target_ulong, pname, params);
-    yagl_host_glGetFloatv(pname, params);
+    bool res = yagl_host_glGetFloatv(pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetFramebufferAttachmentParameteriv dispatcher. id = 63
  */
-static uint8_t* yagl_func_glGetFramebufferAttachmentParameteriv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetFramebufferAttachmentParameteriv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum attachment = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum attachment = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glGetFramebufferAttachmentParameteriv, GLenum, GLenum, GLenum, target_ulong, target, attachment, pname, params);
-    yagl_host_glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
+    bool res = yagl_host_glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetIntegerv dispatcher. id = 64
  */
-static uint8_t* yagl_func_glGetIntegerv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetIntegerv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGetIntegerv, GLenum, target_ulong, pname, params);
-    yagl_host_glGetIntegerv(pname, params);
+    bool res = yagl_host_glGetIntegerv(pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetProgramiv dispatcher. id = 65
  */
-static uint8_t* yagl_func_glGetProgramiv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetProgramiv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetProgramiv, GLuint, GLenum, target_ulong, program, pname, params);
-    yagl_host_glGetProgramiv(program, pname, params);
+    bool res = yagl_host_glGetProgramiv(program, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetProgramInfoLog dispatcher. id = 66
  */
-static uint8_t* yagl_func_glGetProgramInfoLog(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetProgramInfoLog(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
-    GLsizei bufsize = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong length = yagl_marshal_get_ptr(&out_buff);
-    target_ulong infolog = yagl_marshal_get_ptr(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
+    GLsizei bufsize = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong length = yagl_marshal_get_ptr(out_buff);
+    target_ulong infolog = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glGetProgramInfoLog, GLuint, GLsizei, target_ulong, target_ulong, program, bufsize, length, infolog);
-    yagl_host_glGetProgramInfoLog(program, bufsize, length, infolog);
+    bool res = yagl_host_glGetProgramInfoLog(program, bufsize, length, infolog);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetRenderbufferParameteriv dispatcher. id = 67
  */
-static uint8_t* yagl_func_glGetRenderbufferParameteriv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetRenderbufferParameteriv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetRenderbufferParameteriv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glGetRenderbufferParameteriv(target, pname, params);
+    bool res = yagl_host_glGetRenderbufferParameteriv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetShaderiv dispatcher. id = 68
  */
-static uint8_t* yagl_func_glGetShaderiv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetShaderiv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint shader = yagl_marshal_get_GLuint(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLuint shader = yagl_marshal_get_GLuint(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetShaderiv, GLuint, GLenum, target_ulong, shader, pname, params);
-    yagl_host_glGetShaderiv(shader, pname, params);
+    bool res = yagl_host_glGetShaderiv(shader, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetShaderInfoLog dispatcher. id = 69
  */
-static uint8_t* yagl_func_glGetShaderInfoLog(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetShaderInfoLog(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint shader = yagl_marshal_get_GLuint(&out_buff);
-    GLsizei bufsize = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong length = yagl_marshal_get_ptr(&out_buff);
-    target_ulong infolog = yagl_marshal_get_ptr(&out_buff);
+    GLuint shader = yagl_marshal_get_GLuint(out_buff);
+    GLsizei bufsize = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong length = yagl_marshal_get_ptr(out_buff);
+    target_ulong infolog = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glGetShaderInfoLog, GLuint, GLsizei, target_ulong, target_ulong, shader, bufsize, length, infolog);
-    yagl_host_glGetShaderInfoLog(shader, bufsize, length, infolog);
+    bool res = yagl_host_glGetShaderInfoLog(shader, bufsize, length, infolog);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetShaderPrecisionFormat dispatcher. id = 70
  */
-static uint8_t* yagl_func_glGetShaderPrecisionFormat(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetShaderPrecisionFormat(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum shadertype = yagl_marshal_get_GLenum(&out_buff);
-    GLenum precisiontype = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong range = yagl_marshal_get_ptr(&out_buff);
-    target_ulong precision = yagl_marshal_get_ptr(&out_buff);
+    GLenum shadertype = yagl_marshal_get_GLenum(out_buff);
+    GLenum precisiontype = yagl_marshal_get_GLenum(out_buff);
+    target_ulong range = yagl_marshal_get_ptr(out_buff);
+    target_ulong precision = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glGetShaderPrecisionFormat, GLenum, GLenum, target_ulong, target_ulong, shadertype, precisiontype, range, precision);
-    yagl_host_glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
+    bool res = yagl_host_glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetShaderSource dispatcher. id = 71
  */
-static uint8_t* yagl_func_glGetShaderSource(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetShaderSource(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint shader = yagl_marshal_get_GLuint(&out_buff);
-    GLsizei bufsize = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong length = yagl_marshal_get_ptr(&out_buff);
-    target_ulong source = yagl_marshal_get_ptr(&out_buff);
+    GLuint shader = yagl_marshal_get_GLuint(out_buff);
+    GLsizei bufsize = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong length = yagl_marshal_get_ptr(out_buff);
+    target_ulong source = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glGetShaderSource, GLuint, GLsizei, target_ulong, target_ulong, shader, bufsize, length, source);
-    yagl_host_glGetShaderSource(shader, bufsize, length, source);
+    bool res = yagl_host_glGetShaderSource(shader, bufsize, length, source);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetTexParameterfv dispatcher. id = 72
  */
-static uint8_t* yagl_func_glGetTexParameterfv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetTexParameterfv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetTexParameterfv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glGetTexParameterfv(target, pname, params);
+    bool res = yagl_host_glGetTexParameterfv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetTexParameteriv dispatcher. id = 73
  */
-static uint8_t* yagl_func_glGetTexParameteriv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetTexParameteriv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetTexParameteriv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glGetTexParameteriv(target, pname, params);
+    bool res = yagl_host_glGetTexParameteriv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetUniformfv dispatcher. id = 74
  */
-static uint8_t* yagl_func_glGetUniformfv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetUniformfv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetUniformfv, GLuint, GLint, target_ulong, program, location, params);
-    yagl_host_glGetUniformfv(program, location, params);
+    bool res = yagl_host_glGetUniformfv(program, location, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetUniformiv dispatcher. id = 75
  */
-static uint8_t* yagl_func_glGetUniformiv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetUniformiv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetUniformiv, GLuint, GLint, target_ulong, program, location, params);
-    yagl_host_glGetUniformiv(program, location, params);
+    bool res = yagl_host_glGetUniformiv(program, location, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetUniformLocation dispatcher. id = 76
  */
-static uint8_t* yagl_func_glGetUniformLocation(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetUniformLocation(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
-    target_ulong name = yagl_marshal_get_ptr(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
+    target_ulong name = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glGetUniformLocation, GLuint, target_ulong, program, name);
-    int ret = yagl_host_glGetUniformLocation(program, name);
-    YAGL_LOG_FUNC_EXIT_SPLIT(int, ret);
-    yagl_marshal_put_int(&in_buff, ret);
-    return out_buff;
+    int retval;
+    bool res = yagl_host_glGetUniformLocation(&retval, program, name);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(int, retval);
+    yagl_marshal_put_int(&in_buff, retval);
+    return true;
 }
 
 /*
  * glGetVertexAttribfv dispatcher. id = 77
  */
-static uint8_t* yagl_func_glGetVertexAttribfv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetVertexAttribfv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint index = yagl_marshal_get_GLuint(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLuint index = yagl_marshal_get_GLuint(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetVertexAttribfv, GLuint, GLenum, target_ulong, index, pname, params);
-    yagl_host_glGetVertexAttribfv(index, pname, params);
+    bool res = yagl_host_glGetVertexAttribfv(index, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetVertexAttribiv dispatcher. id = 78
  */
-static uint8_t* yagl_func_glGetVertexAttribiv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetVertexAttribiv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint index = yagl_marshal_get_GLuint(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLuint index = yagl_marshal_get_GLuint(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetVertexAttribiv, GLuint, GLenum, target_ulong, index, pname, params);
-    yagl_host_glGetVertexAttribiv(index, pname, params);
+    bool res = yagl_host_glGetVertexAttribiv(index, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetVertexAttribPointerv dispatcher. id = 79
  */
-static uint8_t* yagl_func_glGetVertexAttribPointerv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetVertexAttribPointerv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint index = yagl_marshal_get_GLuint(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong pointer = yagl_marshal_get_ptr(&out_buff);
+    GLuint index = yagl_marshal_get_GLuint(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong pointer = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glGetVertexAttribPointerv, GLuint, GLenum, target_ulong, index, pname, pointer);
-    yagl_host_glGetVertexAttribPointerv(index, pname, pointer);
+    bool res = yagl_host_glGetVertexAttribPointerv(index, pname, pointer);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glHint dispatcher. id = 80
  */
-static uint8_t* yagl_func_glHint(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glHint(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum mode = yagl_marshal_get_GLenum(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum mode = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glHint, GLenum, GLenum, target, mode);
-    yagl_host_glHint(target, mode);
+    bool res = yagl_host_glHint(target, mode);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glIsBuffer dispatcher. id = 81
  */
-static uint8_t* yagl_func_glIsBuffer(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glIsBuffer(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint buffer = yagl_marshal_get_GLuint(&out_buff);
+    GLuint buffer = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glIsBuffer, GLuint, buffer);
-    GLboolean ret = yagl_host_glIsBuffer(buffer);
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, ret);
-    yagl_marshal_put_GLboolean(&in_buff, ret);
-    return out_buff;
+    GLboolean retval;
+    bool res = yagl_host_glIsBuffer(&retval, buffer);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, retval);
+    yagl_marshal_put_GLboolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * glIsEnabled dispatcher. id = 82
  */
-static uint8_t* yagl_func_glIsEnabled(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glIsEnabled(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum cap = yagl_marshal_get_GLenum(&out_buff);
+    GLenum cap = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glIsEnabled, GLenum, cap);
-    GLboolean ret = yagl_host_glIsEnabled(cap);
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, ret);
-    yagl_marshal_put_GLboolean(&in_buff, ret);
-    return out_buff;
+    GLboolean retval;
+    bool res = yagl_host_glIsEnabled(&retval, cap);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, retval);
+    yagl_marshal_put_GLboolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * glIsFramebuffer dispatcher. id = 83
  */
-static uint8_t* yagl_func_glIsFramebuffer(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glIsFramebuffer(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint framebuffer = yagl_marshal_get_GLuint(&out_buff);
+    GLuint framebuffer = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glIsFramebuffer, GLuint, framebuffer);
-    GLboolean ret = yagl_host_glIsFramebuffer(framebuffer);
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, ret);
-    yagl_marshal_put_GLboolean(&in_buff, ret);
-    return out_buff;
+    GLboolean retval;
+    bool res = yagl_host_glIsFramebuffer(&retval, framebuffer);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, retval);
+    yagl_marshal_put_GLboolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * glIsProgram dispatcher. id = 84
  */
-static uint8_t* yagl_func_glIsProgram(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glIsProgram(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glIsProgram, GLuint, program);
-    GLboolean ret = yagl_host_glIsProgram(program);
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, ret);
-    yagl_marshal_put_GLboolean(&in_buff, ret);
-    return out_buff;
+    GLboolean retval;
+    bool res = yagl_host_glIsProgram(&retval, program);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, retval);
+    yagl_marshal_put_GLboolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * glIsRenderbuffer dispatcher. id = 85
  */
-static uint8_t* yagl_func_glIsRenderbuffer(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glIsRenderbuffer(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint renderbuffer = yagl_marshal_get_GLuint(&out_buff);
+    GLuint renderbuffer = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glIsRenderbuffer, GLuint, renderbuffer);
-    GLboolean ret = yagl_host_glIsRenderbuffer(renderbuffer);
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, ret);
-    yagl_marshal_put_GLboolean(&in_buff, ret);
-    return out_buff;
+    GLboolean retval;
+    bool res = yagl_host_glIsRenderbuffer(&retval, renderbuffer);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, retval);
+    yagl_marshal_put_GLboolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * glIsShader dispatcher. id = 86
  */
-static uint8_t* yagl_func_glIsShader(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glIsShader(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint shader = yagl_marshal_get_GLuint(&out_buff);
+    GLuint shader = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glIsShader, GLuint, shader);
-    GLboolean ret = yagl_host_glIsShader(shader);
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, ret);
-    yagl_marshal_put_GLboolean(&in_buff, ret);
-    return out_buff;
+    GLboolean retval;
+    bool res = yagl_host_glIsShader(&retval, shader);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, retval);
+    yagl_marshal_put_GLboolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * glIsTexture dispatcher. id = 87
  */
-static uint8_t* yagl_func_glIsTexture(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glIsTexture(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint texture = yagl_marshal_get_GLuint(&out_buff);
+    GLuint texture = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glIsTexture, GLuint, texture);
-    GLboolean ret = yagl_host_glIsTexture(texture);
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, ret);
-    yagl_marshal_put_GLboolean(&in_buff, ret);
-    return out_buff;
+    GLboolean retval;
+    bool res = yagl_host_glIsTexture(&retval, texture);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, retval);
+    yagl_marshal_put_GLboolean(&in_buff, retval);
+    return true;
 }
 
 /*
  * glLineWidth dispatcher. id = 88
  */
-static uint8_t* yagl_func_glLineWidth(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLineWidth(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfloat width = yagl_marshal_get_GLfloat(&out_buff);
+    GLfloat width = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glLineWidth, GLfloat, width);
-    yagl_host_glLineWidth(width);
+    bool res = yagl_host_glLineWidth(width);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glLinkProgram dispatcher. id = 89
  */
-static uint8_t* yagl_func_glLinkProgram(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glLinkProgram(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glLinkProgram, GLuint, program);
-    yagl_host_glLinkProgram(program);
+    bool res = yagl_host_glLinkProgram(program);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glPixelStorei dispatcher. id = 90
  */
-static uint8_t* yagl_func_glPixelStorei(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glPixelStorei(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLint param = yagl_marshal_get_GLint(&out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLint param = yagl_marshal_get_GLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glPixelStorei, GLenum, GLint, pname, param);
-    yagl_host_glPixelStorei(pname, param);
+    bool res = yagl_host_glPixelStorei(pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glPolygonOffset dispatcher. id = 91
  */
-static uint8_t* yagl_func_glPolygonOffset(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glPolygonOffset(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLfloat factor = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat units = yagl_marshal_get_GLfloat(&out_buff);
+    GLfloat factor = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat units = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glPolygonOffset, GLfloat, GLfloat, factor, units);
-    yagl_host_glPolygonOffset(factor, units);
+    bool res = yagl_host_glPolygonOffset(factor, units);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glReadPixels dispatcher. id = 92
  */
-static uint8_t* yagl_func_glReadPixels(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glReadPixels(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint x = yagl_marshal_get_GLint(&out_buff);
-    GLint y = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
-    GLenum format = yagl_marshal_get_GLenum(&out_buff);
-    GLenum type = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong pixels = yagl_marshal_get_ptr(&out_buff);
+    GLint x = yagl_marshal_get_GLint(out_buff);
+    GLint y = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
+    GLenum format = yagl_marshal_get_GLenum(out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
+    target_ulong pixels = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT7(ts->ps->id, ts->id, glReadPixels, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, target_ulong, x, y, width, height, format, type, pixels);
-    yagl_host_glReadPixels(x, y, width, height, format, type, pixels);
+    bool res = yagl_host_glReadPixels(x, y, width, height, format, type, pixels);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glReleaseShaderCompiler dispatcher. id = 93
  */
-static uint8_t* yagl_func_glReleaseShaderCompiler(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glReleaseShaderCompiler(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
     YAGL_LOG_FUNC_ENTER_SPLIT0(ts->ps->id, ts->id, glReleaseShaderCompiler);
-    yagl_host_glReleaseShaderCompiler();
+    bool res = yagl_host_glReleaseShaderCompiler();
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glRenderbufferStorage dispatcher. id = 94
  */
-static uint8_t* yagl_func_glRenderbufferStorage(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glRenderbufferStorage(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum internalformat = yagl_marshal_get_GLenum(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum internalformat = yagl_marshal_get_GLenum(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glRenderbufferStorage, GLenum, GLenum, GLsizei, GLsizei, target, internalformat, width, height);
-    yagl_host_glRenderbufferStorage(target, internalformat, width, height);
+    bool res = yagl_host_glRenderbufferStorage(target, internalformat, width, height);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glSampleCoverage dispatcher. id = 95
  */
-static uint8_t* yagl_func_glSampleCoverage(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glSampleCoverage(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLclampf value = yagl_marshal_get_GLclampf(&out_buff);
-    GLboolean invert = yagl_marshal_get_GLboolean(&out_buff);
+    GLclampf value = yagl_marshal_get_GLclampf(out_buff);
+    GLboolean invert = yagl_marshal_get_GLboolean(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glSampleCoverage, GLclampf, GLboolean, value, invert);
-    yagl_host_glSampleCoverage(value, invert);
+    bool res = yagl_host_glSampleCoverage(value, invert);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glScissor dispatcher. id = 96
  */
-static uint8_t* yagl_func_glScissor(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glScissor(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint x = yagl_marshal_get_GLint(&out_buff);
-    GLint y = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
+    GLint x = yagl_marshal_get_GLint(out_buff);
+    GLint y = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glScissor, GLint, GLint, GLsizei, GLsizei, x, y, width, height);
-    yagl_host_glScissor(x, y, width, height);
+    bool res = yagl_host_glScissor(x, y, width, height);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glShaderBinary dispatcher. id = 97
  */
-static uint8_t* yagl_func_glShaderBinary(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glShaderBinary(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLsizei n = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong shaders = yagl_marshal_get_ptr(&out_buff);
-    GLenum binaryformat = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong binary = yagl_marshal_get_ptr(&out_buff);
-    GLsizei length = yagl_marshal_get_GLsizei(&out_buff);
+    GLsizei n = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong shaders = yagl_marshal_get_ptr(out_buff);
+    GLenum binaryformat = yagl_marshal_get_GLenum(out_buff);
+    target_ulong binary = yagl_marshal_get_ptr(out_buff);
+    GLsizei length = yagl_marshal_get_GLsizei(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT5(ts->ps->id, ts->id, glShaderBinary, GLsizei, target_ulong, GLenum, target_ulong, GLsizei, n, shaders, binaryformat, binary, length);
-    yagl_host_glShaderBinary(n, shaders, binaryformat, binary, length);
+    bool res = yagl_host_glShaderBinary(n, shaders, binaryformat, binary, length);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glShaderSource dispatcher. id = 98
  */
-static uint8_t* yagl_func_glShaderSource(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glShaderSource(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint shader = yagl_marshal_get_GLuint(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong string = yagl_marshal_get_ptr(&out_buff);
-    target_ulong length = yagl_marshal_get_ptr(&out_buff);
+    GLuint shader = yagl_marshal_get_GLuint(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong string = yagl_marshal_get_ptr(out_buff);
+    target_ulong length = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glShaderSource, GLuint, GLsizei, target_ulong, target_ulong, shader, count, string, length);
-    yagl_host_glShaderSource(shader, count, string, length);
+    bool res = yagl_host_glShaderSource(shader, count, string, length);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glStencilFunc dispatcher. id = 99
  */
-static uint8_t* yagl_func_glStencilFunc(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glStencilFunc(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum func = yagl_marshal_get_GLenum(&out_buff);
-    GLint ref = yagl_marshal_get_GLint(&out_buff);
-    GLuint mask = yagl_marshal_get_GLuint(&out_buff);
+    GLenum func = yagl_marshal_get_GLenum(out_buff);
+    GLint ref = yagl_marshal_get_GLint(out_buff);
+    GLuint mask = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glStencilFunc, GLenum, GLint, GLuint, func, ref, mask);
-    yagl_host_glStencilFunc(func, ref, mask);
+    bool res = yagl_host_glStencilFunc(func, ref, mask);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glStencilFuncSeparate dispatcher. id = 100
  */
-static uint8_t* yagl_func_glStencilFuncSeparate(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glStencilFuncSeparate(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum face = yagl_marshal_get_GLenum(&out_buff);
-    GLenum func = yagl_marshal_get_GLenum(&out_buff);
-    GLint ref = yagl_marshal_get_GLint(&out_buff);
-    GLuint mask = yagl_marshal_get_GLuint(&out_buff);
+    GLenum face = yagl_marshal_get_GLenum(out_buff);
+    GLenum func = yagl_marshal_get_GLenum(out_buff);
+    GLint ref = yagl_marshal_get_GLint(out_buff);
+    GLuint mask = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glStencilFuncSeparate, GLenum, GLenum, GLint, GLuint, face, func, ref, mask);
-    yagl_host_glStencilFuncSeparate(face, func, ref, mask);
+    bool res = yagl_host_glStencilFuncSeparate(face, func, ref, mask);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glStencilMask dispatcher. id = 101
  */
-static uint8_t* yagl_func_glStencilMask(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glStencilMask(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint mask = yagl_marshal_get_GLuint(&out_buff);
+    GLuint mask = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glStencilMask, GLuint, mask);
-    yagl_host_glStencilMask(mask);
+    bool res = yagl_host_glStencilMask(mask);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glStencilMaskSeparate dispatcher. id = 102
  */
-static uint8_t* yagl_func_glStencilMaskSeparate(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glStencilMaskSeparate(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum face = yagl_marshal_get_GLenum(&out_buff);
-    GLuint mask = yagl_marshal_get_GLuint(&out_buff);
+    GLenum face = yagl_marshal_get_GLenum(out_buff);
+    GLuint mask = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glStencilMaskSeparate, GLenum, GLuint, face, mask);
-    yagl_host_glStencilMaskSeparate(face, mask);
+    bool res = yagl_host_glStencilMaskSeparate(face, mask);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glStencilOp dispatcher. id = 103
  */
-static uint8_t* yagl_func_glStencilOp(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glStencilOp(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum fail = yagl_marshal_get_GLenum(&out_buff);
-    GLenum zfail = yagl_marshal_get_GLenum(&out_buff);
-    GLenum zpass = yagl_marshal_get_GLenum(&out_buff);
+    GLenum fail = yagl_marshal_get_GLenum(out_buff);
+    GLenum zfail = yagl_marshal_get_GLenum(out_buff);
+    GLenum zpass = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glStencilOp, GLenum, GLenum, GLenum, fail, zfail, zpass);
-    yagl_host_glStencilOp(fail, zfail, zpass);
+    bool res = yagl_host_glStencilOp(fail, zfail, zpass);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glStencilOpSeparate dispatcher. id = 104
  */
-static uint8_t* yagl_func_glStencilOpSeparate(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glStencilOpSeparate(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum face = yagl_marshal_get_GLenum(&out_buff);
-    GLenum fail = yagl_marshal_get_GLenum(&out_buff);
-    GLenum zfail = yagl_marshal_get_GLenum(&out_buff);
-    GLenum zpass = yagl_marshal_get_GLenum(&out_buff);
+    GLenum face = yagl_marshal_get_GLenum(out_buff);
+    GLenum fail = yagl_marshal_get_GLenum(out_buff);
+    GLenum zfail = yagl_marshal_get_GLenum(out_buff);
+    GLenum zpass = yagl_marshal_get_GLenum(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glStencilOpSeparate, GLenum, GLenum, GLenum, GLenum, face, fail, zfail, zpass);
-    yagl_host_glStencilOpSeparate(face, fail, zfail, zpass);
+    bool res = yagl_host_glStencilOpSeparate(face, fail, zfail, zpass);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexImage2D dispatcher. id = 105
  */
-static uint8_t* yagl_func_glTexImage2D(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexImage2D(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLint level = yagl_marshal_get_GLint(&out_buff);
-    GLint internalformat = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
-    GLint border = yagl_marshal_get_GLint(&out_buff);
-    GLenum format = yagl_marshal_get_GLenum(&out_buff);
-    GLenum type = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong pixels = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLint level = yagl_marshal_get_GLint(out_buff);
+    GLint internalformat = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
+    GLint border = yagl_marshal_get_GLint(out_buff);
+    GLenum format = yagl_marshal_get_GLenum(out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
+    target_ulong pixels = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT9(ts->ps->id, ts->id, glTexImage2D, GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, target_ulong, target, level, internalformat, width, height, border, format, type, pixels);
-    yagl_host_glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
+    bool res = yagl_host_glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexParameterf dispatcher. id = 106
  */
-static uint8_t* yagl_func_glTexParameterf(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexParameterf(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLfloat param = yagl_marshal_get_GLfloat(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLfloat param = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexParameterf, GLenum, GLenum, GLfloat, target, pname, param);
-    yagl_host_glTexParameterf(target, pname, param);
+    bool res = yagl_host_glTexParameterf(target, pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexParameterfv dispatcher. id = 107
  */
-static uint8_t* yagl_func_glTexParameterfv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexParameterfv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexParameterfv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glTexParameterfv(target, pname, params);
+    bool res = yagl_host_glTexParameterfv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexParameteri dispatcher. id = 108
  */
-static uint8_t* yagl_func_glTexParameteri(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexParameteri(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    GLint param = yagl_marshal_get_GLint(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    GLint param = yagl_marshal_get_GLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexParameteri, GLenum, GLenum, GLint, target, pname, param);
-    yagl_host_glTexParameteri(target, pname, param);
+    bool res = yagl_host_glTexParameteri(target, pname, param);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexParameteriv dispatcher. id = 109
  */
-static uint8_t* yagl_func_glTexParameteriv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexParameteriv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLenum pname = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong params = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLenum pname = yagl_marshal_get_GLenum(out_buff);
+    target_ulong params = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glTexParameteriv, GLenum, GLenum, target_ulong, target, pname, params);
-    yagl_host_glTexParameteriv(target, pname, params);
+    bool res = yagl_host_glTexParameteriv(target, pname, params);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glTexSubImage2D dispatcher. id = 110
  */
-static uint8_t* yagl_func_glTexSubImage2D(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glTexSubImage2D(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    GLint level = yagl_marshal_get_GLint(&out_buff);
-    GLint xoffset = yagl_marshal_get_GLint(&out_buff);
-    GLint yoffset = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
-    GLenum format = yagl_marshal_get_GLenum(&out_buff);
-    GLenum type = yagl_marshal_get_GLenum(&out_buff);
-    target_ulong pixels = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    GLint level = yagl_marshal_get_GLint(out_buff);
+    GLint xoffset = yagl_marshal_get_GLint(out_buff);
+    GLint yoffset = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
+    GLenum format = yagl_marshal_get_GLenum(out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
+    target_ulong pixels = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT9(ts->ps->id, ts->id, glTexSubImage2D, GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, target_ulong, target, level, xoffset, yoffset, width, height, format, type, pixels);
-    yagl_host_glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
+    bool res = yagl_host_glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform1f dispatcher. id = 111
  */
-static uint8_t* yagl_func_glUniform1f(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform1f(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLfloat x = yagl_marshal_get_GLfloat(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLfloat x = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glUniform1f, GLint, GLfloat, location, x);
-    yagl_host_glUniform1f(location, x);
+    bool res = yagl_host_glUniform1f(location, x);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform1fv dispatcher. id = 112
  */
-static uint8_t* yagl_func_glUniform1fv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform1fv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong v = yagl_marshal_get_ptr(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong v = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glUniform1fv, GLint, GLsizei, target_ulong, location, count, v);
-    yagl_host_glUniform1fv(location, count, v);
+    bool res = yagl_host_glUniform1fv(location, count, v);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform1i dispatcher. id = 113
  */
-static uint8_t* yagl_func_glUniform1i(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform1i(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLint x = yagl_marshal_get_GLint(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLint x = yagl_marshal_get_GLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glUniform1i, GLint, GLint, location, x);
-    yagl_host_glUniform1i(location, x);
+    bool res = yagl_host_glUniform1i(location, x);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform1iv dispatcher. id = 114
  */
-static uint8_t* yagl_func_glUniform1iv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform1iv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong v = yagl_marshal_get_ptr(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong v = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glUniform1iv, GLint, GLsizei, target_ulong, location, count, v);
-    yagl_host_glUniform1iv(location, count, v);
+    bool res = yagl_host_glUniform1iv(location, count, v);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform2f dispatcher. id = 115
  */
-static uint8_t* yagl_func_glUniform2f(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform2f(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLfloat x = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat y = yagl_marshal_get_GLfloat(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLfloat x = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat y = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glUniform2f, GLint, GLfloat, GLfloat, location, x, y);
-    yagl_host_glUniform2f(location, x, y);
+    bool res = yagl_host_glUniform2f(location, x, y);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform2fv dispatcher. id = 116
  */
-static uint8_t* yagl_func_glUniform2fv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform2fv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong v = yagl_marshal_get_ptr(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong v = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glUniform2fv, GLint, GLsizei, target_ulong, location, count, v);
-    yagl_host_glUniform2fv(location, count, v);
+    bool res = yagl_host_glUniform2fv(location, count, v);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform2i dispatcher. id = 117
  */
-static uint8_t* yagl_func_glUniform2i(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform2i(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLint x = yagl_marshal_get_GLint(&out_buff);
-    GLint y = yagl_marshal_get_GLint(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLint x = yagl_marshal_get_GLint(out_buff);
+    GLint y = yagl_marshal_get_GLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glUniform2i, GLint, GLint, GLint, location, x, y);
-    yagl_host_glUniform2i(location, x, y);
+    bool res = yagl_host_glUniform2i(location, x, y);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform2iv dispatcher. id = 118
  */
-static uint8_t* yagl_func_glUniform2iv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform2iv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong v = yagl_marshal_get_ptr(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong v = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glUniform2iv, GLint, GLsizei, target_ulong, location, count, v);
-    yagl_host_glUniform2iv(location, count, v);
+    bool res = yagl_host_glUniform2iv(location, count, v);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform3f dispatcher. id = 119
  */
-static uint8_t* yagl_func_glUniform3f(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform3f(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLfloat x = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat y = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat z = yagl_marshal_get_GLfloat(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLfloat x = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat y = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat z = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glUniform3f, GLint, GLfloat, GLfloat, GLfloat, location, x, y, z);
-    yagl_host_glUniform3f(location, x, y, z);
+    bool res = yagl_host_glUniform3f(location, x, y, z);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform3fv dispatcher. id = 120
  */
-static uint8_t* yagl_func_glUniform3fv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform3fv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong v = yagl_marshal_get_ptr(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong v = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glUniform3fv, GLint, GLsizei, target_ulong, location, count, v);
-    yagl_host_glUniform3fv(location, count, v);
+    bool res = yagl_host_glUniform3fv(location, count, v);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform3i dispatcher. id = 121
  */
-static uint8_t* yagl_func_glUniform3i(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform3i(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLint x = yagl_marshal_get_GLint(&out_buff);
-    GLint y = yagl_marshal_get_GLint(&out_buff);
-    GLint z = yagl_marshal_get_GLint(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLint x = yagl_marshal_get_GLint(out_buff);
+    GLint y = yagl_marshal_get_GLint(out_buff);
+    GLint z = yagl_marshal_get_GLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glUniform3i, GLint, GLint, GLint, GLint, location, x, y, z);
-    yagl_host_glUniform3i(location, x, y, z);
+    bool res = yagl_host_glUniform3i(location, x, y, z);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform3iv dispatcher. id = 122
  */
-static uint8_t* yagl_func_glUniform3iv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform3iv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong v = yagl_marshal_get_ptr(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong v = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glUniform3iv, GLint, GLsizei, target_ulong, location, count, v);
-    yagl_host_glUniform3iv(location, count, v);
+    bool res = yagl_host_glUniform3iv(location, count, v);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform4f dispatcher. id = 123
  */
-static uint8_t* yagl_func_glUniform4f(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform4f(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLfloat x = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat y = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat z = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat w = yagl_marshal_get_GLfloat(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLfloat x = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat y = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat z = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat w = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT5(ts->ps->id, ts->id, glUniform4f, GLint, GLfloat, GLfloat, GLfloat, GLfloat, location, x, y, z, w);
-    yagl_host_glUniform4f(location, x, y, z, w);
+    bool res = yagl_host_glUniform4f(location, x, y, z, w);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform4fv dispatcher. id = 124
  */
-static uint8_t* yagl_func_glUniform4fv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform4fv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong v = yagl_marshal_get_ptr(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong v = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glUniform4fv, GLint, GLsizei, target_ulong, location, count, v);
-    yagl_host_glUniform4fv(location, count, v);
+    bool res = yagl_host_glUniform4fv(location, count, v);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform4i dispatcher. id = 125
  */
-static uint8_t* yagl_func_glUniform4i(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform4i(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLint x = yagl_marshal_get_GLint(&out_buff);
-    GLint y = yagl_marshal_get_GLint(&out_buff);
-    GLint z = yagl_marshal_get_GLint(&out_buff);
-    GLint w = yagl_marshal_get_GLint(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLint x = yagl_marshal_get_GLint(out_buff);
+    GLint y = yagl_marshal_get_GLint(out_buff);
+    GLint z = yagl_marshal_get_GLint(out_buff);
+    GLint w = yagl_marshal_get_GLint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT5(ts->ps->id, ts->id, glUniform4i, GLint, GLint, GLint, GLint, GLint, location, x, y, z, w);
-    yagl_host_glUniform4i(location, x, y, z, w);
+    bool res = yagl_host_glUniform4i(location, x, y, z, w);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniform4iv dispatcher. id = 126
  */
-static uint8_t* yagl_func_glUniform4iv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniform4iv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong v = yagl_marshal_get_ptr(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong v = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glUniform4iv, GLint, GLsizei, target_ulong, location, count, v);
-    yagl_host_glUniform4iv(location, count, v);
+    bool res = yagl_host_glUniform4iv(location, count, v);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniformMatrix2fv dispatcher. id = 127
  */
-static uint8_t* yagl_func_glUniformMatrix2fv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniformMatrix2fv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
-    GLboolean transpose = yagl_marshal_get_GLboolean(&out_buff);
-    target_ulong value = yagl_marshal_get_ptr(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    GLboolean transpose = yagl_marshal_get_GLboolean(out_buff);
+    target_ulong value = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glUniformMatrix2fv, GLint, GLsizei, GLboolean, target_ulong, location, count, transpose, value);
-    yagl_host_glUniformMatrix2fv(location, count, transpose, value);
+    bool res = yagl_host_glUniformMatrix2fv(location, count, transpose, value);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniformMatrix3fv dispatcher. id = 128
  */
-static uint8_t* yagl_func_glUniformMatrix3fv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniformMatrix3fv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
-    GLboolean transpose = yagl_marshal_get_GLboolean(&out_buff);
-    target_ulong value = yagl_marshal_get_ptr(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    GLboolean transpose = yagl_marshal_get_GLboolean(out_buff);
+    target_ulong value = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glUniformMatrix3fv, GLint, GLsizei, GLboolean, target_ulong, location, count, transpose, value);
-    yagl_host_glUniformMatrix3fv(location, count, transpose, value);
+    bool res = yagl_host_glUniformMatrix3fv(location, count, transpose, value);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUniformMatrix4fv dispatcher. id = 129
  */
-static uint8_t* yagl_func_glUniformMatrix4fv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUniformMatrix4fv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint location = yagl_marshal_get_GLint(&out_buff);
-    GLsizei count = yagl_marshal_get_GLsizei(&out_buff);
-    GLboolean transpose = yagl_marshal_get_GLboolean(&out_buff);
-    target_ulong value = yagl_marshal_get_ptr(&out_buff);
+    GLint location = yagl_marshal_get_GLint(out_buff);
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    GLboolean transpose = yagl_marshal_get_GLboolean(out_buff);
+    target_ulong value = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glUniformMatrix4fv, GLint, GLsizei, GLboolean, target_ulong, location, count, transpose, value);
-    yagl_host_glUniformMatrix4fv(location, count, transpose, value);
+    bool res = yagl_host_glUniformMatrix4fv(location, count, transpose, value);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glUseProgram dispatcher. id = 130
  */
-static uint8_t* yagl_func_glUseProgram(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glUseProgram(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glUseProgram, GLuint, program);
-    yagl_host_glUseProgram(program);
+    bool res = yagl_host_glUseProgram(program);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glValidateProgram dispatcher. id = 131
  */
-static uint8_t* yagl_func_glValidateProgram(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glValidateProgram(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint program = yagl_marshal_get_GLuint(&out_buff);
+    GLuint program = yagl_marshal_get_GLuint(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glValidateProgram, GLuint, program);
-    yagl_host_glValidateProgram(program);
+    bool res = yagl_host_glValidateProgram(program);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glVertexAttrib1f dispatcher. id = 132
  */
-static uint8_t* yagl_func_glVertexAttrib1f(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glVertexAttrib1f(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint indx = yagl_marshal_get_GLuint(&out_buff);
-    GLfloat x = yagl_marshal_get_GLfloat(&out_buff);
+    GLuint indx = yagl_marshal_get_GLuint(out_buff);
+    GLfloat x = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glVertexAttrib1f, GLuint, GLfloat, indx, x);
-    yagl_host_glVertexAttrib1f(indx, x);
+    bool res = yagl_host_glVertexAttrib1f(indx, x);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glVertexAttrib1fv dispatcher. id = 133
  */
-static uint8_t* yagl_func_glVertexAttrib1fv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glVertexAttrib1fv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint indx = yagl_marshal_get_GLuint(&out_buff);
-    target_ulong values = yagl_marshal_get_ptr(&out_buff);
+    GLuint indx = yagl_marshal_get_GLuint(out_buff);
+    target_ulong values = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glVertexAttrib1fv, GLuint, target_ulong, indx, values);
-    yagl_host_glVertexAttrib1fv(indx, values);
+    bool res = yagl_host_glVertexAttrib1fv(indx, values);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glVertexAttrib2f dispatcher. id = 134
  */
-static uint8_t* yagl_func_glVertexAttrib2f(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glVertexAttrib2f(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint indx = yagl_marshal_get_GLuint(&out_buff);
-    GLfloat x = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat y = yagl_marshal_get_GLfloat(&out_buff);
+    GLuint indx = yagl_marshal_get_GLuint(out_buff);
+    GLfloat x = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat y = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT3(ts->ps->id, ts->id, glVertexAttrib2f, GLuint, GLfloat, GLfloat, indx, x, y);
-    yagl_host_glVertexAttrib2f(indx, x, y);
+    bool res = yagl_host_glVertexAttrib2f(indx, x, y);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glVertexAttrib2fv dispatcher. id = 135
  */
-static uint8_t* yagl_func_glVertexAttrib2fv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glVertexAttrib2fv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint indx = yagl_marshal_get_GLuint(&out_buff);
-    target_ulong values = yagl_marshal_get_ptr(&out_buff);
+    GLuint indx = yagl_marshal_get_GLuint(out_buff);
+    target_ulong values = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glVertexAttrib2fv, GLuint, target_ulong, indx, values);
-    yagl_host_glVertexAttrib2fv(indx, values);
+    bool res = yagl_host_glVertexAttrib2fv(indx, values);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glVertexAttrib3f dispatcher. id = 136
  */
-static uint8_t* yagl_func_glVertexAttrib3f(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glVertexAttrib3f(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint indx = yagl_marshal_get_GLuint(&out_buff);
-    GLfloat x = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat y = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat z = yagl_marshal_get_GLfloat(&out_buff);
+    GLuint indx = yagl_marshal_get_GLuint(out_buff);
+    GLfloat x = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat y = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat z = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glVertexAttrib3f, GLuint, GLfloat, GLfloat, GLfloat, indx, x, y, z);
-    yagl_host_glVertexAttrib3f(indx, x, y, z);
+    bool res = yagl_host_glVertexAttrib3f(indx, x, y, z);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glVertexAttrib3fv dispatcher. id = 137
  */
-static uint8_t* yagl_func_glVertexAttrib3fv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glVertexAttrib3fv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint indx = yagl_marshal_get_GLuint(&out_buff);
-    target_ulong values = yagl_marshal_get_ptr(&out_buff);
+    GLuint indx = yagl_marshal_get_GLuint(out_buff);
+    target_ulong values = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glVertexAttrib3fv, GLuint, target_ulong, indx, values);
-    yagl_host_glVertexAttrib3fv(indx, values);
+    bool res = yagl_host_glVertexAttrib3fv(indx, values);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glVertexAttrib4f dispatcher. id = 138
  */
-static uint8_t* yagl_func_glVertexAttrib4f(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glVertexAttrib4f(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint indx = yagl_marshal_get_GLuint(&out_buff);
-    GLfloat x = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat y = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat z = yagl_marshal_get_GLfloat(&out_buff);
-    GLfloat w = yagl_marshal_get_GLfloat(&out_buff);
+    GLuint indx = yagl_marshal_get_GLuint(out_buff);
+    GLfloat x = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat y = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat z = yagl_marshal_get_GLfloat(out_buff);
+    GLfloat w = yagl_marshal_get_GLfloat(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT5(ts->ps->id, ts->id, glVertexAttrib4f, GLuint, GLfloat, GLfloat, GLfloat, GLfloat, indx, x, y, z, w);
-    yagl_host_glVertexAttrib4f(indx, x, y, z, w);
+    bool res = yagl_host_glVertexAttrib4f(indx, x, y, z, w);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glVertexAttrib4fv dispatcher. id = 139
  */
-static uint8_t* yagl_func_glVertexAttrib4fv(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glVertexAttrib4fv(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint indx = yagl_marshal_get_GLuint(&out_buff);
-    target_ulong values = yagl_marshal_get_ptr(&out_buff);
+    GLuint indx = yagl_marshal_get_GLuint(out_buff);
+    target_ulong values = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT2(ts->ps->id, ts->id, glVertexAttrib4fv, GLuint, target_ulong, indx, values);
-    yagl_host_glVertexAttrib4fv(indx, values);
+    bool res = yagl_host_glVertexAttrib4fv(indx, values);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glVertexAttribPointer dispatcher. id = 140
  */
-static uint8_t* yagl_func_glVertexAttribPointer(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glVertexAttribPointer(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLuint indx = yagl_marshal_get_GLuint(&out_buff);
-    GLint size = yagl_marshal_get_GLint(&out_buff);
-    GLenum type = yagl_marshal_get_GLenum(&out_buff);
-    GLboolean normalized = yagl_marshal_get_GLboolean(&out_buff);
-    GLsizei stride = yagl_marshal_get_GLsizei(&out_buff);
-    target_ulong ptr = yagl_marshal_get_ptr(&out_buff);
+    GLuint indx = yagl_marshal_get_GLuint(out_buff);
+    GLint size = yagl_marshal_get_GLint(out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
+    GLboolean normalized = yagl_marshal_get_GLboolean(out_buff);
+    GLsizei stride = yagl_marshal_get_GLsizei(out_buff);
+    target_ulong ptr = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT6(ts->ps->id, ts->id, glVertexAttribPointer, GLuint, GLint, GLenum, GLboolean, GLsizei, target_ulong, indx, size, type, normalized, stride, ptr);
-    yagl_host_glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
+    bool res = yagl_host_glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glViewport dispatcher. id = 141
  */
-static uint8_t* yagl_func_glViewport(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glViewport(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLint x = yagl_marshal_get_GLint(&out_buff);
-    GLint y = yagl_marshal_get_GLint(&out_buff);
-    GLsizei width = yagl_marshal_get_GLsizei(&out_buff);
-    GLsizei height = yagl_marshal_get_GLsizei(&out_buff);
+    GLint x = yagl_marshal_get_GLint(out_buff);
+    GLint y = yagl_marshal_get_GLint(out_buff);
+    GLsizei width = yagl_marshal_get_GLsizei(out_buff);
+    GLsizei height = yagl_marshal_get_GLsizei(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT4(ts->ps->id, ts->id, glViewport, GLint, GLint, GLsizei, GLsizei, x, y, width, height);
-    yagl_host_glViewport(x, y, width, height);
+    bool res = yagl_host_glViewport(x, y, width, height);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
 /*
  * glGetExtensionStringYAGL dispatcher. id = 142
  */
-static uint8_t* yagl_func_glGetExtensionStringYAGL(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glGetExtensionStringYAGL(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    target_ulong str = yagl_marshal_get_ptr(&out_buff);
+    target_ulong str = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT1(ts->ps->id, ts->id, glGetExtensionStringYAGL, target_ulong, str);
-    GLuint ret = yagl_host_glGetExtensionStringYAGL(str);
-    YAGL_LOG_FUNC_EXIT_SPLIT(GLuint, ret);
-    yagl_marshal_put_GLuint(&in_buff, ret);
-    return out_buff;
+    GLuint retval;
+    bool res = yagl_host_glGetExtensionStringYAGL(&retval, str);
+    if (!res) {
+        YAGL_LOG_FUNC_EXIT(NULL);
+        return false;
+    }
+    YAGL_LOG_FUNC_EXIT_SPLIT(GLuint, retval);
+    yagl_marshal_put_GLuint(&in_buff, retval);
+    return true;
 }
 
 /*
  * glEGLImageTargetTexture2DYAGL dispatcher. id = 143
  */
-static uint8_t* yagl_func_glEGLImageTargetTexture2DYAGL(struct yagl_thread_state *ts,
-    uint8_t *out_buff,
+static bool yagl_func_glEGLImageTargetTexture2DYAGL(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
     uint8_t *in_buff)
 {
-    GLenum target = yagl_marshal_get_GLenum(&out_buff);
-    uint32_t width = yagl_marshal_get_uint32_t(&out_buff);
-    uint32_t height = yagl_marshal_get_uint32_t(&out_buff);
-    uint32_t bpp = yagl_marshal_get_uint32_t(&out_buff);
-    target_ulong pixels = yagl_marshal_get_ptr(&out_buff);
+    GLenum target = yagl_marshal_get_GLenum(out_buff);
+    uint32_t width = yagl_marshal_get_uint32_t(out_buff);
+    uint32_t height = yagl_marshal_get_uint32_t(out_buff);
+    uint32_t bpp = yagl_marshal_get_uint32_t(out_buff);
+    target_ulong pixels = yagl_marshal_get_ptr(out_buff);
     YAGL_LOG_FUNC_ENTER_SPLIT5(ts->ps->id, ts->id, glEGLImageTargetTexture2DYAGL, GLenum, uint32_t, uint32_t, uint32_t, target_ulong, target, width, height, bpp, pixels);
-    yagl_host_glEGLImageTargetTexture2DYAGL(target, width, height, bpp, pixels);
+    bool res = yagl_host_glEGLImageTargetTexture2DYAGL(target, width, height, bpp, pixels);
     YAGL_LOG_FUNC_EXIT(NULL);
-    return out_buff;
+    return res;
 }
 
-const uint32_t yagl_gles2_api_num_funcs = 143;
+/*
+ * glGetVertexAttribRangeYAGL dispatcher. id = 144
+ */
+static bool yagl_func_glGetVertexAttribRangeYAGL(struct yagl_thread_state *ts,
+    uint8_t **out_buff,
+    uint8_t *in_buff)
+{
+    GLsizei count = yagl_marshal_get_GLsizei(out_buff);
+    GLenum type = yagl_marshal_get_GLenum(out_buff);
+    target_ulong indices = yagl_marshal_get_ptr(out_buff);
+    target_ulong range_first = yagl_marshal_get_ptr(out_buff);
+    target_ulong range_count = yagl_marshal_get_ptr(out_buff);
+    YAGL_LOG_FUNC_ENTER_SPLIT5(ts->ps->id, ts->id, glGetVertexAttribRangeYAGL, GLsizei, GLenum, target_ulong, target_ulong, target_ulong, count, type, indices, range_first, range_count);
+    bool res = yagl_host_glGetVertexAttribRangeYAGL(count, type, indices, range_first, range_count);
+    YAGL_LOG_FUNC_EXIT(NULL);
+    return res;
+}
+
+const uint32_t yagl_gles2_api_num_funcs = 144;
 
 yagl_api_func yagl_gles2_api_funcs[] = {
     &yagl_func_glActiveTexture,
@@ -2428,5 +2516,6 @@ yagl_api_func yagl_gles2_api_funcs[] = {
     &yagl_func_glVertexAttribPointer,
     &yagl_func_glViewport,
     &yagl_func_glGetExtensionStringYAGL,
-    &yagl_func_glEGLImageTargetTexture2DYAGL
+    &yagl_func_glEGLImageTargetTexture2DYAGL,
+    &yagl_func_glGetVertexAttribRangeYAGL
 };
index 6db2eb6..0115cc1 100644 (file)
 
 YAGL_DEFINE_TLS(struct yagl_gles2_api_ts*, gles2_api_ts);
 
-#define YAGL_GET_CTX_RET(func, ret) \
+#define YAGL_GET_CTX_IMPL(func, ret_expr) \
     struct yagl_gles2_context *ctx = \
         (struct yagl_gles2_context*)gles2_api_ts->egl_iface->get_ctx(gles2_api_ts->egl_iface); \
     YAGL_LOG_FUNC_SET_TS(gles2_api_ts->ts, func); \
     if (!ctx || \
         (ctx->base.base.client_api != yagl_client_api_gles2)) { \
         YAGL_LOG_WARN("no current context"); \
-        return ret; \
+        ret_expr; \
+        return true; \
     }
 
-#define YAGL_GET_CTX(func) YAGL_GET_CTX_RET(func,)
+#define YAGL_GET_CTX_RET(func, ret) YAGL_GET_CTX_IMPL(func, *retval = ret)
+
+#define YAGL_GET_CTX(func) YAGL_GET_CTX_IMPL(func,)
 
 #define YAGL_UNIMPLEMENTED_RET(func, ret) \
     YAGL_GET_CTX_RET(func, ret); \
     YAGL_LOG_WARN("NOT IMPLEMENTED!!!"); \
-    return ret;
+    *retval = ret; \
+    return true
 
 #define YAGL_UNIMPLEMENTED(func) \
     YAGL_GET_CTX(func); \
-    YAGL_LOG_WARN("NOT IMPLEMENTED!!!");
+    YAGL_LOG_WARN("NOT IMPLEMENTED!!!"); \
+    return true
 
 static bool yagl_get_array_param(struct yagl_gles_array *array,
                                  GLenum pname,
@@ -205,7 +210,7 @@ struct yagl_api_ps
     return &gles2_api_ps->base;
 }
 
-void yagl_host_glAttachShader(GLuint program,
+bool yagl_host_glAttachShader(GLuint program,
     GLuint shader)
 {
     struct yagl_gles2_program *program_obj = NULL;
@@ -237,12 +242,15 @@ void yagl_host_glAttachShader(GLuint program,
 out:
     yagl_gles2_shader_release(shader_obj);
     yagl_gles2_program_release(program_obj);
+
+    return true;
 }
 
-void yagl_host_glBindAttribLocation(GLuint program,
+bool yagl_host_glBindAttribLocation(GLuint program,
     GLuint index,
     target_ulong /* const GLchar* */ name_)
 {
+    bool res = true;
     struct yagl_gles2_program *program_obj = NULL;
     GLchar *name = NULL;
 
@@ -259,7 +267,7 @@ void yagl_host_glBindAttribLocation(GLuint program,
     if (name_) {
         name = yagl_mem_get_string(gles2_api_ts->ts, name_);
         if (!name) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
         YAGL_LOG_TRACE("binding attrib %s location to %d", name, index);
@@ -270,9 +278,11 @@ void yagl_host_glBindAttribLocation(GLuint program,
 out:
     g_free(name);
     yagl_gles2_program_release(program_obj);
+
+    return res;
 }
 
-void yagl_host_glBindFramebuffer(GLenum target,
+bool yagl_host_glBindFramebuffer(GLenum target,
     GLuint framebuffer)
 {
     struct yagl_gles_framebuffer *framebuffer_obj = NULL;
@@ -310,9 +320,11 @@ void yagl_host_glBindFramebuffer(GLenum target,
 
 out:
     yagl_gles_framebuffer_release(framebuffer_obj);
+
+    return true;
 }
 
-void yagl_host_glBindRenderbuffer(GLenum target,
+bool yagl_host_glBindRenderbuffer(GLenum target,
     GLuint renderbuffer)
 {
     struct yagl_gles_renderbuffer *renderbuffer_obj = NULL;
@@ -350,9 +362,11 @@ void yagl_host_glBindRenderbuffer(GLenum target,
 
 out:
     yagl_gles_renderbuffer_release(renderbuffer_obj);
+
+    return true;
 }
 
-void yagl_host_glBlendColor(GLclampf red,
+bool yagl_host_glBlendColor(GLclampf red,
     GLclampf green,
     GLclampf blue,
     GLclampf alpha)
@@ -360,24 +374,30 @@ void yagl_host_glBlendColor(GLclampf red,
     YAGL_GET_CTX(glBlendColor);
 
     ctx->driver_ps->BlendColor(ctx->driver_ps, red, green, blue, alpha);
+
+    return true;
 }
 
-void yagl_host_glBlendEquation(GLenum mode)
+bool yagl_host_glBlendEquation(GLenum mode)
 {
     YAGL_GET_CTX(glBlendEquation);
 
     ctx->driver_ps->BlendEquation(ctx->driver_ps, mode);
+
+    return true;
 }
 
-void yagl_host_glBlendEquationSeparate(GLenum modeRGB,
+bool yagl_host_glBlendEquationSeparate(GLenum modeRGB,
     GLenum modeAlpha)
 {
     YAGL_GET_CTX(glBlendEquationSeparate);
 
     ctx->driver_ps->BlendEquationSeparate(ctx->driver_ps, modeRGB, modeAlpha);
+
+    return true;
 }
 
-void yagl_host_glBlendFuncSeparate(GLenum srcRGB,
+bool yagl_host_glBlendFuncSeparate(GLenum srcRGB,
     GLenum dstRGB,
     GLenum srcAlpha,
     GLenum dstAlpha)
@@ -389,16 +409,22 @@ void yagl_host_glBlendFuncSeparate(GLenum srcRGB,
                                       dstRGB,
                                       srcAlpha,
                                       dstAlpha);
+
+    return true;
 }
 
-GLenum yagl_host_glCheckFramebufferStatus(GLenum target)
+bool yagl_host_glCheckFramebufferStatus(GLenum* retval,
+    GLenum target)
 {
     YAGL_GET_CTX_RET(glCheckFramebufferStatus, 0);
-    return ctx->driver_ps->common->CheckFramebufferStatus(ctx->driver_ps->common,
-                                                          target);
+
+    *retval = ctx->driver_ps->common->CheckFramebufferStatus(ctx->driver_ps->common,
+                                                             target);
+
+    return true;
 }
 
-void yagl_host_glCompileShader(GLuint shader)
+bool yagl_host_glCompileShader(GLuint shader)
 {
     struct yagl_gles2_shader *shader_obj = NULL;
 
@@ -416,36 +442,41 @@ void yagl_host_glCompileShader(GLuint shader)
 
 out:
     yagl_gles2_shader_release(shader_obj);
+
+    return true;
 }
 
-GLuint yagl_host_glCreateProgram(void)
+bool yagl_host_glCreateProgram(GLuint* retval)
 {
-    GLuint ret = 0;
     struct yagl_gles2_program *program = NULL;
 
     YAGL_GET_CTX_RET(glCreateProgram, 0);
 
+    *retval = 0;
+
     program = yagl_gles2_program_create(ctx->driver_ps);
 
     if (!program) {
         goto out;
     }
 
-    ret = yagl_sharegroup_add(ctx->sg, YAGL_NS_PROGRAM, &program->base);
+    *retval = yagl_sharegroup_add(ctx->sg, YAGL_NS_PROGRAM, &program->base);
 
 out:
     yagl_gles2_program_release(program);
 
-    return ret;
+    return true;
 }
 
-GLuint yagl_host_glCreateShader(GLenum type)
+bool yagl_host_glCreateShader(GLuint* retval,
+    GLenum type)
 {
-    GLuint ret = 0;
     struct yagl_gles2_shader *shader = NULL;
 
     YAGL_GET_CTX_RET(glCreateShader, 0);
 
+    *retval = 0;
+
     shader = yagl_gles2_shader_create(ctx->driver_ps, type);
 
     if (!shader) {
@@ -453,17 +484,18 @@ GLuint yagl_host_glCreateShader(GLenum type)
         goto out;
     }
 
-    ret = yagl_sharegroup_add(ctx->sg, YAGL_NS_SHADER, &shader->base);
+    *retval = yagl_sharegroup_add(ctx->sg, YAGL_NS_SHADER, &shader->base);
 
 out:
     yagl_gles2_shader_release(shader);
 
-    return ret;
+    return true;
 }
 
-void yagl_host_glDeleteFramebuffers(GLsizei n,
+bool yagl_host_glDeleteFramebuffers(GLsizei n,
     target_ulong /* const GLuint* */ framebuffers_)
 {
+    bool res = true;
     GLuint *framebuffer_names = NULL;
     GLsizei i;
 
@@ -481,7 +513,7 @@ void yagl_host_glDeleteFramebuffers(GLsizei n,
                           framebuffers_,
                           n * sizeof(*framebuffer_names),
                           framebuffer_names)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -497,10 +529,10 @@ void yagl_host_glDeleteFramebuffers(GLsizei n,
     }
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glDeleteProgram(GLuint program)
+bool yagl_host_glDeleteProgram(GLuint program)
 {
     YAGL_GET_CTX(glDeleteProgram);
 
@@ -509,11 +541,14 @@ void yagl_host_glDeleteProgram(GLuint program)
     yagl_sharegroup_remove(ctx->sg,
                            YAGL_NS_PROGRAM,
                            program);
+
+    return true;
 }
 
-void yagl_host_glDeleteRenderbuffers(GLsizei n,
+bool yagl_host_glDeleteRenderbuffers(GLsizei n,
     target_ulong /* const GLuint* */ renderbuffers_)
 {
+    bool res = true;
     GLuint *renderbuffer_names = NULL;
     GLsizei i;
 
@@ -531,7 +566,7 @@ void yagl_host_glDeleteRenderbuffers(GLsizei n,
                           renderbuffers_,
                           n * sizeof(*renderbuffer_names),
                           renderbuffer_names)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -547,19 +582,21 @@ void yagl_host_glDeleteRenderbuffers(GLsizei n,
     }
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glDeleteShader(GLuint shader)
+bool yagl_host_glDeleteShader(GLuint shader)
 {
     YAGL_GET_CTX(glDeleteShader);
 
     yagl_sharegroup_remove(ctx->sg,
                            YAGL_NS_SHADER,
                            shader);
+
+    return true;
 }
 
-void yagl_host_glDetachShader(GLuint program,
+bool yagl_host_glDetachShader(GLuint program,
     GLuint shader)
 {
     struct yagl_gles2_program *program_obj = NULL;
@@ -591,9 +628,11 @@ void yagl_host_glDetachShader(GLuint program,
 out:
     yagl_gles2_shader_release(shader_obj);
     yagl_gles2_program_release(program_obj);
+
+    return true;
 }
 
-void yagl_host_glDisableVertexAttribArray(GLuint index)
+bool yagl_host_glDisableVertexAttribArray(GLuint index)
 {
     struct yagl_gles_array *array = NULL;
 
@@ -603,15 +642,17 @@ void yagl_host_glDisableVertexAttribArray(GLuint index)
 
     if (!array) {
         YAGL_SET_ERR(GL_INVALID_VALUE);
-        return;
+        return true;
     }
 
     yagl_gles_array_enable(array, false);
 
     ctx->driver_ps->DisableVertexAttribArray(ctx->driver_ps, index);
+
+    return true;
 }
 
-void yagl_host_glEnableVertexAttribArray(GLuint index)
+bool yagl_host_glEnableVertexAttribArray(GLuint index)
 {
     struct yagl_gles_array *array = NULL;
 
@@ -621,15 +662,17 @@ void yagl_host_glEnableVertexAttribArray(GLuint index)
 
     if (!array) {
         YAGL_SET_ERR(GL_INVALID_VALUE);
-        return;
+        return true;
     }
 
     yagl_gles_array_enable(array, true);
 
     ctx->driver_ps->EnableVertexAttribArray(ctx->driver_ps, index);
+
+    return true;
 }
 
-void yagl_host_glFramebufferRenderbuffer(GLenum target,
+bool yagl_host_glFramebufferRenderbuffer(GLenum target,
     GLenum attachment,
     GLenum renderbuffertarget,
     GLuint renderbuffer)
@@ -669,9 +712,11 @@ void yagl_host_glFramebufferRenderbuffer(GLenum target,
 out:
     yagl_gles_renderbuffer_release(renderbuffer_obj);
     yagl_gles_framebuffer_release(framebuffer_obj);
+
+    return true;
 }
 
-void yagl_host_glFramebufferTexture2D(GLenum target,
+bool yagl_host_glFramebufferTexture2D(GLenum target,
     GLenum attachment,
     GLenum textarget,
     GLuint texture,
@@ -713,24 +758,34 @@ void yagl_host_glFramebufferTexture2D(GLenum target,
 out:
     yagl_gles_texture_release(texture_obj);
     yagl_gles_framebuffer_release(framebuffer_obj);
+
+    return true;
 }
 
-void yagl_host_glGenerateMipmap(GLenum target)
+bool yagl_host_glGenerateMipmap(GLenum target)
 {
     YAGL_GET_CTX(glGenerateMipmap);
 
     ctx->driver_ps->common->GenerateMipmap(ctx->driver_ps->common, target);
+
+    return true;
 }
 
-void yagl_host_glGenFramebuffers(GLsizei n,
+bool yagl_host_glGenFramebuffers(GLsizei n,
     target_ulong /* GLuint* */ framebuffers_)
 {
+    bool res = true;
     struct yagl_gles_framebuffer **framebuffers = NULL;
     GLsizei i;
     GLuint *framebuffer_names = NULL;
 
     YAGL_GET_CTX(glGenFramebuffers);
 
+    if (!yagl_mem_prepare(gles2_api_ts->ts->mt1, framebuffers_, n * sizeof(*framebuffer_names))) {
+        res = false;
+        goto out;
+    }
+
     framebuffers = g_malloc0(n * sizeof(*framebuffers));
 
     for (i = 0; i < n; ++i) {
@@ -750,11 +805,7 @@ void yagl_host_glGenFramebuffers(GLsizei n,
     }
 
     if (framebuffers_) {
-        for (i = 0; i < n; ++i) {
-            yagl_mem_put_GLuint(gles2_api_ts->ts,
-                                framebuffers_ + (i * sizeof(GLuint)),
-                                framebuffer_names[i]);
-        }
+        yagl_mem_put(gles2_api_ts->ts->mt1, framebuffer_names);
     }
 
 out:
@@ -763,17 +814,25 @@ out:
         yagl_gles_framebuffer_release(framebuffers[i]);
     }
     g_free(framebuffers);
+
+    return res;
 }
 
-void yagl_host_glGenRenderbuffers(GLsizei n,
+bool yagl_host_glGenRenderbuffers(GLsizei n,
     target_ulong /* GLuint* */ renderbuffers_)
 {
+    bool res = true;
     struct yagl_gles_renderbuffer **renderbuffers = NULL;
     GLsizei i;
     GLuint *renderbuffer_names = NULL;
 
     YAGL_GET_CTX(glGenRenderbuffers);
 
+    if (!yagl_mem_prepare(gles2_api_ts->ts->mt1, renderbuffers_, n * sizeof(*renderbuffer_names))) {
+        res = false;
+        goto out;
+    }
+
     renderbuffers = g_malloc0(n * sizeof(*renderbuffers));
 
     for (i = 0; i < n; ++i) {
@@ -793,11 +852,7 @@ void yagl_host_glGenRenderbuffers(GLsizei n,
     }
 
     if (renderbuffers_) {
-        for (i = 0; i < n; ++i) {
-            yagl_mem_put_GLuint(gles2_api_ts->ts,
-                                renderbuffers_ + (i * sizeof(GLuint)),
-                                renderbuffer_names[i]);
-        }
+        yagl_mem_put(gles2_api_ts->ts->mt1, renderbuffer_names);
     }
 
 out:
@@ -806,9 +861,11 @@ out:
         yagl_gles_renderbuffer_release(renderbuffers[i]);
     }
     g_free(renderbuffers);
+
+    return res;
 }
 
-void yagl_host_glGetActiveAttrib(GLuint program,
+bool yagl_host_glGetActiveAttrib(GLuint program,
     GLuint index,
     GLsizei bufsize,
     target_ulong /* GLsizei* */ length_,
@@ -816,6 +873,7 @@ void yagl_host_glGetActiveAttrib(GLuint program,
     target_ulong /* GLenum* */ type_,
     target_ulong /* GLchar* */ name_)
 {
+    bool res = true;
     struct yagl_gles2_program *program_obj = NULL;
     GLchar *name = NULL;
     GLsizei length = 0;
@@ -847,27 +905,37 @@ void yagl_host_glGetActiveAttrib(GLuint program,
     YAGL_LOG_TRACE("got active attrib: size = %d, type = %u, name = %s",
                    size, type, name);
 
+    if (!yagl_mem_prepare_GLsizei(gles2_api_ts->ts->mt1, length_) ||
+        !yagl_mem_prepare_GLint(gles2_api_ts->ts->mt2, size_) ||
+        !yagl_mem_prepare_GLenum(gles2_api_ts->ts->mt3, type_) ||
+        !yagl_mem_prepare(gles2_api_ts->ts->mt4, name_, length + 1)) {
+        res = false;
+        goto out;
+    }
+
     if (length_) {
-        yagl_mem_put_GLsizei(gles2_api_ts->ts, length_, length);
+        yagl_mem_put_GLsizei(gles2_api_ts->ts->mt1, length);
     }
 
     if (size_) {
-        yagl_mem_put_GLint(gles2_api_ts->ts, size_, size);
+        yagl_mem_put_GLint(gles2_api_ts->ts->mt2, size);
     }
 
     if (type_) {
-        yagl_mem_put_GLenum(gles2_api_ts->ts, type_, type);
+        yagl_mem_put_GLenum(gles2_api_ts->ts->mt3, type);
     }
 
     if (name_ && name) {
-        yagl_mem_put(gles2_api_ts->ts, name_, length + 1, name);
+        yagl_mem_put(gles2_api_ts->ts->mt4, name);
     }
 
 out:
     yagl_gles2_program_release(program_obj);
+
+    return res;
 }
 
-void yagl_host_glGetActiveUniform(GLuint program,
+bool yagl_host_glGetActiveUniform(GLuint program,
     GLuint index,
     GLsizei bufsize,
     target_ulong /* GLsizei* */ length_,
@@ -875,6 +943,7 @@ void yagl_host_glGetActiveUniform(GLuint program,
     target_ulong /* GLenum* */ type_,
     target_ulong /* GLchar* */ name_)
 {
+    bool res = true;
     struct yagl_gles2_program *program_obj = NULL;
     GLchar *name = NULL;
     GLsizei length = 0;
@@ -906,31 +975,42 @@ void yagl_host_glGetActiveUniform(GLuint program,
     YAGL_LOG_TRACE("got active uniform: size = %d, type = %u, name = %s",
                    size, type, name);
 
+    if (!yagl_mem_prepare_GLsizei(gles2_api_ts->ts->mt1, length_) ||
+        !yagl_mem_prepare_GLint(gles2_api_ts->ts->mt2, size_) ||
+        !yagl_mem_prepare_GLenum(gles2_api_ts->ts->mt3, type_) ||
+        !yagl_mem_prepare(gles2_api_ts->ts->mt4, name_, length + 1)) {
+        res = false;
+        goto out;
+    }
+
     if (length_) {
-        yagl_mem_put_GLsizei(gles2_api_ts->ts, length_, length);
+        yagl_mem_put_GLsizei(gles2_api_ts->ts->mt1, length);
     }
 
     if (size_) {
-        yagl_mem_put_GLint(gles2_api_ts->ts, size_, size);
+        yagl_mem_put_GLint(gles2_api_ts->ts->mt2, size);
     }
 
     if (type_) {
-        yagl_mem_put_GLenum(gles2_api_ts->ts, type_, type);
+        yagl_mem_put_GLenum(gles2_api_ts->ts->mt3, type);
     }
 
     if (name_ && name) {
-        yagl_mem_put(gles2_api_ts->ts, name_, length + 1, name);
+        yagl_mem_put(gles2_api_ts->ts->mt4, name);
     }
 
 out:
     yagl_gles2_program_release(program_obj);
+
+    return res;
 }
 
-void yagl_host_glGetAttachedShaders(GLuint program,
+bool yagl_host_glGetAttachedShaders(GLuint program,
     GLsizei maxcount,
     target_ulong /* GLsizei* */ count_,
     target_ulong /* GLuint* */ shaders_)
 {
+    bool res = true;
     struct yagl_gles2_program *program_obj = NULL;
     GLsizei count = 0;
     GLuint *shaders = 0;
@@ -950,6 +1030,11 @@ void yagl_host_glGetAttachedShaders(GLuint program,
         goto out;
     }
 
+    if (!yagl_mem_prepare_GLsizei(gles2_api_ts->ts->mt1, count_)) {
+        res = false;
+        goto out;
+    }
+
     if (maxcount > 0) {
         shaders = yagl_gles_context_malloc0(&ctx->base,
             maxcount * sizeof(*shaders));
@@ -966,29 +1051,36 @@ void yagl_host_glGetAttachedShaders(GLuint program,
             }
         }
 
-        yagl_mem_put(gles2_api_ts->ts,
-                     shaders_,
-                     count * sizeof(*shaders),
-                     shaders);
+        if (!yagl_mem_prepare(gles2_api_ts->ts->mt2, shaders_, count * sizeof(*shaders))) {
+            res = false;
+            goto out;
+        }
+
+        yagl_mem_put(gles2_api_ts->ts->mt2, shaders);
     }
 
     if (count_) {
-        yagl_mem_put_GLsizei(gles2_api_ts->ts, count_, count);
+        yagl_mem_put_GLsizei(gles2_api_ts->ts->mt1, count);
     }
 
 out:
     yagl_gles2_program_release(program_obj);
+
+    return res;
 }
 
-int yagl_host_glGetAttribLocation(GLuint program,
+bool yagl_host_glGetAttribLocation(int* retval,
+    GLuint program,
     target_ulong /* const GLchar* */ name_)
 {
+    bool res = true;
     struct yagl_gles2_program *program_obj = NULL;
     GLchar *name = NULL;
-    int ret = 0;
 
     YAGL_GET_CTX_RET(glGetAttribLocation, 0);
 
+    *retval = 0;
+
     program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
         YAGL_NS_PROGRAM, program);
 
@@ -1000,31 +1092,37 @@ int yagl_host_glGetAttribLocation(GLuint program,
     if (name_) {
         name = yagl_mem_get_string(gles2_api_ts->ts, name_);
         if (!name) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
         YAGL_LOG_TRACE("getting attrib %s location", name);
     }
 
-    ret = yagl_gles2_program_get_attrib_location(program_obj, name);
+    *retval = yagl_gles2_program_get_attrib_location(program_obj, name);
 
 out:
     g_free(name);
     yagl_gles2_program_release(program_obj);
 
-    return ret;
+    return res;
 }
 
-void yagl_host_glGetFramebufferAttachmentParameteriv(GLenum target,
+bool yagl_host_glGetFramebufferAttachmentParameteriv(GLenum target,
     GLenum attachment,
     GLenum pname,
     target_ulong /* GLint* */ params_)
 {
+    bool res = true;
     struct yagl_gles_framebuffer *framebuffer_obj = NULL;
     GLint param = 0;
 
     YAGL_GET_CTX(glGetFramebufferAttachmentParameteriv);
 
+    if (!yagl_mem_prepare_GLint(gles2_api_ts->ts->mt1, params_)) {
+        res = false;
+        goto out;
+    }
+
     framebuffer_obj = yagl_gles_context_acquire_binded_framebuffer(&ctx->base, target);
 
     if (!framebuffer_obj) {
@@ -1041,22 +1139,30 @@ void yagl_host_glGetFramebufferAttachmentParameteriv(GLenum target,
     }
 
     if (params_) {
-        yagl_mem_put_GLint(gles2_api_ts->ts, params_, param);
+        yagl_mem_put_GLint(gles2_api_ts->ts->mt1, param);
     }
 
 out:
     yagl_gles_framebuffer_release(framebuffer_obj);
+
+    return res;
 }
 
-void yagl_host_glGetProgramiv(GLuint program,
+bool yagl_host_glGetProgramiv(GLuint program,
     GLenum pname,
     target_ulong /* GLint* */ params_)
 {
+    bool res = true;
     struct yagl_gles2_program *program_obj = NULL;
     GLint params = 0;
 
     YAGL_GET_CTX(glGetProgramiv);
 
+    if (!yagl_mem_prepare_GLint(gles2_api_ts->ts->mt1, params_)) {
+        res = false;
+        goto out;
+    }
+
     program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
         YAGL_NS_PROGRAM, program);
 
@@ -1067,7 +1173,7 @@ void yagl_host_glGetProgramiv(GLuint program,
 
     if (params_) {
         if (!yagl_mem_get_GLint(gles2_api_ts->ts, params_, &params)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1075,18 +1181,21 @@ void yagl_host_glGetProgramiv(GLuint program,
     yagl_gles2_program_get_param(program_obj, pname, &params);
 
     if (params_) {
-        yagl_mem_put_GLint(gles2_api_ts->ts, params_, params);
+        yagl_mem_put_GLint(gles2_api_ts->ts->mt1, params);
     }
 
 out:
     yagl_gles2_program_release(program_obj);
+
+    return res;
 }
 
-void yagl_host_glGetProgramInfoLog(GLuint program,
+bool yagl_host_glGetProgramInfoLog(GLuint program,
     GLsizei bufsize,
     target_ulong /* GLsizei* */ length_,
     target_ulong /* GLchar* */ infolog_)
 {
+    bool res = true;
     struct yagl_gles2_program *program_obj = NULL;
     GLsizei length = 0;
     GLchar *infolog = NULL;
@@ -1112,19 +1221,27 @@ void yagl_host_glGetProgramInfoLog(GLuint program,
 
     yagl_gles2_program_get_info_log(program_obj, bufsize, &length, infolog);
 
+    if (!yagl_mem_prepare_GLsizei(gles2_api_ts->ts->mt1, length_) ||
+        !yagl_mem_prepare(gles2_api_ts->ts->mt2, infolog_, length + 1)) {
+        res = false;
+        goto out;
+    }
+
     if (length_) {
-        yagl_mem_put_GLsizei(gles2_api_ts->ts, length_, length);
+        yagl_mem_put_GLsizei(gles2_api_ts->ts->mt1, length);
     }
 
     if (infolog_ && infolog) {
-        yagl_mem_put(gles2_api_ts->ts, infolog_, length + 1, infolog);
+        yagl_mem_put(gles2_api_ts->ts->mt2, infolog);
     }
 
 out:
     yagl_gles2_program_release(program_obj);
+
+    return res;
 }
 
-void yagl_host_glGetRenderbufferParameteriv(GLenum target,
+bool yagl_host_glGetRenderbufferParameteriv(GLenum target,
     GLenum pname,
     target_ulong /* GLint* */ params_)
 {
@@ -1132,25 +1249,37 @@ void yagl_host_glGetRenderbufferParameteriv(GLenum target,
 
     YAGL_GET_CTX(glGetRenderbufferParameteriv);
 
+    if (!yagl_mem_prepare_GLint(gles2_api_ts->ts->mt1, params_)) {
+        return false;
+    }
+
     ctx->driver_ps->common->GetRenderbufferParameteriv(ctx->driver_ps->common,
                                                        target,
                                                        pname,
                                                        params);
 
     if (params_) {
-        yagl_mem_put_GLint(gles2_api_ts->ts, params_, params[0]);
+        yagl_mem_put_GLint(gles2_api_ts->ts->mt1, params[0]);
     }
+
+    return true;
 }
 
-void yagl_host_glGetShaderiv(GLuint shader,
+bool yagl_host_glGetShaderiv(GLuint shader,
     GLenum pname,
     target_ulong /* GLint* */ params_)
 {
+    bool res = true;
     struct yagl_gles2_shader *shader_obj = NULL;
     GLint params = 0;
 
     YAGL_GET_CTX(glGetShaderiv);
 
+    if (!yagl_mem_prepare_GLint(gles2_api_ts->ts->mt1, params_)) {
+        res = false;
+        goto out;
+    }
+
     shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg,
         YAGL_NS_SHADER, shader);
 
@@ -1161,7 +1290,7 @@ void yagl_host_glGetShaderiv(GLuint shader,
 
     if (params_) {
         if (!yagl_mem_get_GLint(gles2_api_ts->ts, params_, &params)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1169,18 +1298,21 @@ void yagl_host_glGetShaderiv(GLuint shader,
     yagl_gles2_shader_get_param(shader_obj, pname, &params);
 
     if (params_) {
-        yagl_mem_put_GLint(gles2_api_ts->ts, params_, params);
+        yagl_mem_put_GLint(gles2_api_ts->ts->mt1, params);
     }
 
 out:
     yagl_gles2_shader_release(shader_obj);
+
+    return res;
 }
 
-void yagl_host_glGetShaderInfoLog(GLuint shader,
+bool yagl_host_glGetShaderInfoLog(GLuint shader,
     GLsizei bufsize,
     target_ulong /* GLsizei* */ length_,
     target_ulong /* GLchar* */ infolog_)
 {
+    bool res = true;
     struct yagl_gles2_shader *shader_obj = NULL;
     GLsizei length = 0;
     GLchar *infolog = NULL;
@@ -1206,28 +1338,43 @@ void yagl_host_glGetShaderInfoLog(GLuint shader,
 
     yagl_gles2_shader_get_info_log(shader_obj, bufsize, &length, infolog);
 
+    if (!yagl_mem_prepare_GLsizei(gles2_api_ts->ts->mt1, length_) ||
+        !yagl_mem_prepare(gles2_api_ts->ts->mt2, infolog_, length + 1)) {
+        res = false;
+        goto out;
+    }
+
     if (length_) {
-        yagl_mem_put_GLsizei(gles2_api_ts->ts, length_, length);
+        yagl_mem_put_GLsizei(gles2_api_ts->ts->mt1, length);
     }
 
     if (infolog_ && infolog) {
-        yagl_mem_put(gles2_api_ts->ts, infolog_, length + 1, infolog);
+        yagl_mem_put(gles2_api_ts->ts->mt2, infolog);
     }
 
 out:
     yagl_gles2_shader_release(shader_obj);
+
+    return res;
 }
 
-void yagl_host_glGetShaderPrecisionFormat(GLenum shadertype,
+bool yagl_host_glGetShaderPrecisionFormat(GLenum shadertype,
     GLenum precisiontype,
     target_ulong /* GLint* */ range_,
     target_ulong /* GLint* */ precision_)
 {
+    bool res = true;
     GLint range[2] = { 0, 0 };
     GLint precision = 0;
 
     YAGL_GET_CTX(glGetShaderPrecisionFormat);
 
+    if (!yagl_mem_prepare(gles2_api_ts->ts->mt1, range_, sizeof(range)) ||
+        !yagl_mem_prepare_GLint(gles2_api_ts->ts->mt2, precision_)) {
+        res = false;
+        goto out;
+    }
+
     switch (precisiontype) {
     case GL_LOW_INT:
     case GL_MEDIUM_INT:
@@ -1247,27 +1394,23 @@ void yagl_host_glGetShaderPrecisionFormat(GLenum shadertype,
     }
 
     if (range_) {
-        yagl_mem_put_GLint(gles2_api_ts->ts,
-                           range_,
-                           range[0]);
-        yagl_mem_put_GLint(gles2_api_ts->ts,
-                           range_ + sizeof(range[0]),
-                           range[1]);
+        yagl_mem_put(gles2_api_ts->ts->mt1, &range[0]);
     }
 
     if (precision_) {
-        yagl_mem_put_GLint(gles2_api_ts->ts, precision_, precision);
+        yagl_mem_put_GLint(gles2_api_ts->ts->mt2, precision);
     }
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glGetShaderSource(GLuint shader,
+bool yagl_host_glGetShaderSource(GLuint shader,
     GLsizei bufsize,
     target_ulong /* GLsizei* */ length_,
     target_ulong /* GLchar* */ source_)
 {
+    bool res = true;
     struct yagl_gles2_shader *shader_obj = NULL;
     GLsizei length = 0;
     GLchar *source = NULL;
@@ -1293,19 +1436,27 @@ void yagl_host_glGetShaderSource(GLuint shader,
 
     yagl_gles2_shader_get_source(shader_obj, bufsize, &length, source);
 
+    if (!yagl_mem_prepare_GLsizei(gles2_api_ts->ts->mt1, length_) ||
+        !yagl_mem_prepare(gles2_api_ts->ts->mt2, source_, length + 1)) {
+        res = false;
+        goto out;
+    }
+
     if (length_) {
-        yagl_mem_put_GLsizei(gles2_api_ts->ts, length_, length);
+        yagl_mem_put_GLsizei(gles2_api_ts->ts->mt1, length);
     }
 
     if (source_ && source) {
-        yagl_mem_put(gles2_api_ts->ts, source_, length + 1, source);
+        yagl_mem_put(gles2_api_ts->ts->mt2, source);
     }
 
 out:
     yagl_gles2_shader_release(shader_obj);
+
+    return res;
 }
 
-void yagl_host_glGetUniformfv(GLuint program,
+bool yagl_host_glGetUniformfv(GLuint program,
     GLint location,
     target_ulong /* GLfloat* */ params)
 {
@@ -1314,10 +1465,9 @@ void yagl_host_glGetUniformfv(GLuint program,
      */
 
     YAGL_UNIMPLEMENTED(glGetUniformfv);
-    YAGL_SET_ERR(GL_INVALID_OPERATION);
 }
 
-void yagl_host_glGetUniformiv(GLuint program,
+bool yagl_host_glGetUniformiv(GLuint program,
     GLint location,
     target_ulong /* GLint* */ params)
 {
@@ -1326,18 +1476,20 @@ void yagl_host_glGetUniformiv(GLuint program,
      */
 
     YAGL_UNIMPLEMENTED(glGetUniformiv);
-    YAGL_SET_ERR(GL_INVALID_OPERATION);
 }
 
-int yagl_host_glGetUniformLocation(GLuint program,
+bool yagl_host_glGetUniformLocation(int* retval,
+    GLuint program,
     target_ulong /* const GLchar* */ name_)
 {
+    bool res = true;
     struct yagl_gles2_program *program_obj = NULL;
     GLchar *name = NULL;
-    int ret = 0;
 
     YAGL_GET_CTX_RET(glGetUniformLocation, 0);
 
+    *retval = 0;
+
     program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
         YAGL_NS_PROGRAM, program);
 
@@ -1349,27 +1501,28 @@ int yagl_host_glGetUniformLocation(GLuint program,
     if (name_) {
         name = yagl_mem_get_string(gles2_api_ts->ts, name_);
         if (!name) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
         YAGL_LOG_TRACE("getting uniform %s location", name);
     }
 
-    ret = yagl_gles2_program_get_uniform_location(program_obj, name);
+    *retval = yagl_gles2_program_get_uniform_location(program_obj, name);
 
 out:
     g_free(name);
     yagl_gles2_program_release(program_obj);
 
-    return ret;
+    return res;
 }
 
-void yagl_host_glGetVertexAttribfv(GLuint index,
+bool yagl_host_glGetVertexAttribfv(GLuint index,
     GLenum pname,
     target_ulong /* GLfloat* */ params_)
 {
+    bool res = true;
     struct yagl_gles_array *array = NULL;
-    int i, count = 0;
+    int count = 0;
     GLfloat *params = NULL;
     GLint param = 0;
 
@@ -1387,6 +1540,11 @@ void yagl_host_glGetVertexAttribfv(GLuint index,
         goto out;
     }
 
+    if (!yagl_mem_prepare(gles2_api_ts->ts->mt1, params_, count * sizeof(*params))) {
+        res = false;
+        goto out;
+    }
+
     params = yagl_gles_context_malloc0(&ctx->base, count * sizeof(*params));
 
     if (yagl_get_array_param(array, pname, &param)) {
@@ -1396,23 +1554,20 @@ void yagl_host_glGetVertexAttribfv(GLuint index,
     }
 
     if (params_) {
-        for (i = 0; i < count; ++i) {
-            yagl_mem_put_GLfloat(gles2_api_ts->ts,
-                                 params_ + (i * sizeof(*params)),
-                                 params[i]);
-        }
+        yagl_mem_put(gles2_api_ts->ts->mt1, params);
     }
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glGetVertexAttribiv(GLuint index,
+bool yagl_host_glGetVertexAttribiv(GLuint index,
     GLenum pname,
     target_ulong /* GLint* */ params_)
 {
+    bool res = true;
     struct yagl_gles_array *array = NULL;
-    int i, count = 0;
+    int count = 0;
     GLint *params = NULL;
 
     YAGL_GET_CTX(glGetVertexAttribiv);
@@ -1429,6 +1584,11 @@ void yagl_host_glGetVertexAttribiv(GLuint index,
         goto out;
     }
 
+    if (!yagl_mem_prepare(gles2_api_ts->ts->mt1, params_, count * sizeof(*params))) {
+        res = false;
+        goto out;
+    }
+
     params = yagl_gles_context_malloc0(&ctx->base, count * sizeof(*params));
 
     if (!yagl_get_array_param(array, pname, params)) {
@@ -1436,26 +1596,28 @@ void yagl_host_glGetVertexAttribiv(GLuint index,
     }
 
     if (params_) {
-        for (i = 0; i < count; ++i) {
-            yagl_mem_put_GLint(gles2_api_ts->ts,
-                               params_ + (i * sizeof(*params)),
-                               params[i]);
-        }
+        yagl_mem_put(gles2_api_ts->ts->mt1, params);
     }
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glGetVertexAttribPointerv(GLuint index,
+bool yagl_host_glGetVertexAttribPointerv(GLuint index,
     GLenum pname,
     target_ulong /* GLvoid** */ pointer_)
 {
+    bool res = true;
     struct yagl_gles_array *array = NULL;
     target_ulong pointer = 0;
 
     YAGL_GET_CTX(glGetVertexAttribPointerv);
 
+    if (!yagl_mem_prepare_ptr(gles2_api_ts->ts->mt1, pointer_)) {
+        res = false;
+        goto out;
+    }
+
     array = yagl_gles_context_get_array(&ctx->base, index);
 
     if (!array) {
@@ -1470,90 +1632,98 @@ void yagl_host_glGetVertexAttribPointerv(GLuint index,
     }
 
     if (pointer_) {
-        yagl_mem_put_ptr(gles2_api_ts->ts, pointer_, pointer);
+        yagl_mem_put_ptr(gles2_api_ts->ts->mt1, pointer);
     }
 
 out:
-    (void)0;
+    return res;
 }
 
-GLboolean yagl_host_glIsFramebuffer(GLuint framebuffer)
+bool yagl_host_glIsFramebuffer(GLboolean* retval,
+    GLuint framebuffer)
 {
     struct yagl_gles_framebuffer *framebuffer_obj = NULL;
-    GLboolean ret = GL_FALSE;
 
     YAGL_GET_CTX_RET(glIsFramebuffer, GL_FALSE);
 
+    *retval = GL_FALSE;
+
     framebuffer_obj = (struct yagl_gles_framebuffer*)yagl_sharegroup_acquire_object(ctx->sg,
         YAGL_NS_FRAMEBUFFER, framebuffer);
 
     if (framebuffer_obj && yagl_gles_framebuffer_was_bound(framebuffer_obj)) {
-        ret = GL_TRUE;
+        *retval = GL_TRUE;
     }
 
     yagl_gles_framebuffer_release(framebuffer_obj);
 
-    return ret;
+    return true;
 }
 
-GLboolean yagl_host_glIsProgram(GLuint program)
+bool yagl_host_glIsProgram(GLboolean* retval,
+    GLuint program)
 {
     struct yagl_gles2_program *program_obj = NULL;
-    GLboolean ret = GL_FALSE;
 
     YAGL_GET_CTX_RET(glIsProgram, GL_FALSE);
 
+    *retval = GL_FALSE;
+
     program_obj = (struct yagl_gles2_program*)yagl_sharegroup_acquire_object(ctx->sg,
         YAGL_NS_PROGRAM, program);
 
     if (program_obj) {
-        ret = GL_TRUE;
+        *retval = GL_TRUE;
     }
 
     yagl_gles2_program_release(program_obj);
 
-    return ret;
+    return true;
 }
 
-GLboolean yagl_host_glIsRenderbuffer(GLuint renderbuffer)
+bool yagl_host_glIsRenderbuffer(GLboolean* retval,
+    GLuint renderbuffer)
 {
     struct yagl_gles_renderbuffer *renderbuffer_obj = NULL;
-    GLboolean ret = GL_FALSE;
 
     YAGL_GET_CTX_RET(glIsRenderbuffer, GL_FALSE);
 
+    *retval = GL_FALSE;
+
     renderbuffer_obj = (struct yagl_gles_renderbuffer*)yagl_sharegroup_acquire_object(ctx->sg,
         YAGL_NS_RENDERBUFFER, renderbuffer);
 
     if (renderbuffer_obj && yagl_gles_renderbuffer_was_bound(renderbuffer_obj)) {
-        ret = GL_TRUE;
+        *retval = GL_TRUE;
     }
 
     yagl_gles_renderbuffer_release(renderbuffer_obj);
 
-    return ret;
+    return true;
 }
 
-GLboolean yagl_host_glIsShader(GLuint shader)
+bool yagl_host_glIsShader(GLboolean* retval,
+    GLuint shader)
 {
     struct yagl_gles2_shader *shader_obj = NULL;
-    GLboolean ret = GL_FALSE;
 
     YAGL_GET_CTX_RET(glIsShader, GL_FALSE);
 
+    *retval = GL_FALSE;
+
     shader_obj = (struct yagl_gles2_shader*)yagl_sharegroup_acquire_object(ctx->sg,
         YAGL_NS_SHADER, shader);
 
     if (shader_obj) {
-        ret = GL_TRUE;
+        *retval = GL_TRUE;
     }
 
     yagl_gles2_shader_release(shader_obj);
 
-    return ret;
+    return true;
 }
 
-void yagl_host_glLinkProgram(GLuint program)
+bool yagl_host_glLinkProgram(GLuint program)
 {
     struct yagl_gles2_program *program_obj = NULL;
 
@@ -1571,16 +1741,20 @@ void yagl_host_glLinkProgram(GLuint program)
 
 out:
     yagl_gles2_program_release(program_obj);
+
+    return true;
 }
 
-void yagl_host_glReleaseShaderCompiler(void)
+bool yagl_host_glReleaseShaderCompiler(void)
 {
     YAGL_GET_CTX(glReleaseShaderCompiler);
 
     ctx->driver_ps->ReleaseShaderCompiler(ctx->driver_ps);
+
+    return true;
 }
 
-void yagl_host_glRenderbufferStorage(GLenum target,
+bool yagl_host_glRenderbufferStorage(GLenum target,
     GLenum internalformat,
     GLsizei width,
     GLsizei height)
@@ -1592,9 +1766,11 @@ void yagl_host_glRenderbufferStorage(GLenum target,
                                                 internalformat,
                                                 width,
                                                 height);
+
+    return true;
 }
 
-void yagl_host_glShaderBinary(GLsizei n,
+bool yagl_host_glShaderBinary(GLsizei n,
     target_ulong /* const GLuint* */ shaders,
     GLenum binaryformat,
     target_ulong /* const GLvoid* */ binary,
@@ -1605,14 +1781,14 @@ void yagl_host_glShaderBinary(GLsizei n,
      */
 
     YAGL_UNIMPLEMENTED(glShaderBinary);
-    YAGL_SET_ERR(GL_INVALID_OPERATION);
 }
 
-void yagl_host_glShaderSource(GLuint shader,
+bool yagl_host_glShaderSource(GLuint shader,
     GLsizei count,
     target_ulong /* const GLchar** */ string_,
     target_ulong /* const GLint* */ length_)
 {
+    bool res = true;
     struct yagl_gles2_shader *shader_obj = NULL;
     target_ulong *string_ptrs = NULL;
     GLint *lengths = NULL;
@@ -1636,14 +1812,14 @@ void yagl_host_glShaderSource(GLuint shader,
 
     string_ptrs = g_malloc(count * sizeof(*string_ptrs));
     if (!yagl_mem_get(gles2_api_ts->ts, string_, count * sizeof(*string_ptrs), string_ptrs)) {
-        YAGL_SET_ERR(GL_INVALID_VALUE);
+        res = false;
         goto out;
     }
 
     if (length_) {
         lengths = g_malloc(count * sizeof(*lengths));
         if (!yagl_mem_get(gles2_api_ts->ts, length_, count * sizeof(*lengths), lengths)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1666,7 +1842,7 @@ void yagl_host_glShaderSource(GLuint shader,
         }
 
         if (!tmp) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
 
@@ -1690,9 +1866,11 @@ out:
     g_free(string_ptrs);
     g_free(lengths);
     yagl_gles2_shader_release(shader_obj);
+
+    return res;
 }
 
-void yagl_host_glStencilFuncSeparate(GLenum face,
+bool yagl_host_glStencilFuncSeparate(GLenum face,
     GLenum func,
     GLint ref,
     GLuint mask)
@@ -1700,17 +1878,21 @@ void yagl_host_glStencilFuncSeparate(GLenum face,
     YAGL_GET_CTX(glStencilFuncSeparate);
 
     ctx->driver_ps->StencilFuncSeparate(ctx->driver_ps, face, func, ref, mask);
+
+    return true;
 }
 
-void yagl_host_glStencilMaskSeparate(GLenum face,
+bool yagl_host_glStencilMaskSeparate(GLenum face,
     GLuint mask)
 {
     YAGL_GET_CTX(glStencilMaskSeparate);
 
     ctx->driver_ps->StencilMaskSeparate(ctx->driver_ps, face, mask);
+
+    return true;
 }
 
-void yagl_host_glStencilOpSeparate(GLenum face,
+bool yagl_host_glStencilOpSeparate(GLenum face,
     GLenum fail,
     GLenum zfail,
     GLenum zpass)
@@ -1718,20 +1900,25 @@ void yagl_host_glStencilOpSeparate(GLenum face,
     YAGL_GET_CTX(glStencilOpSeparate);
 
     ctx->driver_ps->StencilOpSeparate(ctx->driver_ps, face, fail, zfail, zpass);
+
+    return true;
 }
 
-void yagl_host_glUniform1f(GLint location,
+bool yagl_host_glUniform1f(GLint location,
     GLfloat x)
 {
     YAGL_GET_CTX(glUniform1f);
 
     ctx->driver_ps->Uniform1f(ctx->driver_ps, location, x);
+
+    return true;
 }
 
-void yagl_host_glUniform1fv(GLint location,
+bool yagl_host_glUniform1fv(GLint location,
     GLsizei count,
     target_ulong /* const GLfloat* */ v_)
 {
+    bool res = true;
     GLfloat *v = NULL;
 
     YAGL_GET_CTX(glUniform1fv);
@@ -1742,7 +1929,7 @@ void yagl_host_glUniform1fv(GLint location,
                           v_,
                           count * sizeof(*v),
                           v)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1750,21 +1937,24 @@ void yagl_host_glUniform1fv(GLint location,
     ctx->driver_ps->Uniform1fv(ctx->driver_ps, location, count, v);
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glUniform1i(GLint location,
+bool yagl_host_glUniform1i(GLint location,
     GLint x)
 {
     YAGL_GET_CTX(glUniform1i);
 
     ctx->driver_ps->Uniform1i(ctx->driver_ps, location, x);
+
+    return true;
 }
 
-void yagl_host_glUniform1iv(GLint location,
+bool yagl_host_glUniform1iv(GLint location,
     GLsizei count,
     target_ulong /* const GLint* */ v_)
 {
+    bool res = true;
     GLint *v = NULL;
 
     YAGL_GET_CTX(glUniform1iv);
@@ -1775,7 +1965,7 @@ void yagl_host_glUniform1iv(GLint location,
                           v_,
                           count * sizeof(*v),
                           v)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1783,22 +1973,25 @@ void yagl_host_glUniform1iv(GLint location,
     ctx->driver_ps->Uniform1iv(ctx->driver_ps, location, count, v);
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glUniform2f(GLint location,
+bool yagl_host_glUniform2f(GLint location,
     GLfloat x,
     GLfloat y)
 {
     YAGL_GET_CTX(glUniform2f);
 
     ctx->driver_ps->Uniform2f(ctx->driver_ps, location, x, y);
+
+    return true;
 }
 
-void yagl_host_glUniform2fv(GLint location,
+bool yagl_host_glUniform2fv(GLint location,
     GLsizei count,
     target_ulong /* const GLfloat* */ v_)
 {
+    bool res = true;
     GLfloat *v = NULL;
 
     YAGL_GET_CTX(glUniform2fv);
@@ -1809,7 +2002,7 @@ void yagl_host_glUniform2fv(GLint location,
                           v_,
                           2 * count * sizeof(*v),
                           v)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1817,22 +2010,25 @@ void yagl_host_glUniform2fv(GLint location,
     ctx->driver_ps->Uniform2fv(ctx->driver_ps, location, count, v);
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glUniform2i(GLint location,
+bool yagl_host_glUniform2i(GLint location,
     GLint x,
     GLint y)
 {
     YAGL_GET_CTX(glUniform2i);
 
     ctx->driver_ps->Uniform2i(ctx->driver_ps, location, x, y);
+
+    return true;
 }
 
-void yagl_host_glUniform2iv(GLint location,
+bool yagl_host_glUniform2iv(GLint location,
     GLsizei count,
     target_ulong /* const GLint* */ v_)
 {
+    bool res = true;
     GLint *v = NULL;
 
     YAGL_GET_CTX(glUniform2iv);
@@ -1843,7 +2039,7 @@ void yagl_host_glUniform2iv(GLint location,
                           v_,
                           2 * count * sizeof(*v),
                           v)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1851,10 +2047,10 @@ void yagl_host_glUniform2iv(GLint location,
     ctx->driver_ps->Uniform2iv(ctx->driver_ps, location, count, v);
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glUniform3f(GLint location,
+bool yagl_host_glUniform3f(GLint location,
     GLfloat x,
     GLfloat y,
     GLfloat z)
@@ -1862,12 +2058,15 @@ void yagl_host_glUniform3f(GLint location,
     YAGL_GET_CTX(glUniform3f);
 
     ctx->driver_ps->Uniform3f(ctx->driver_ps, location, x, y, z);
+
+    return true;
 }
 
-void yagl_host_glUniform3fv(GLint location,
+bool yagl_host_glUniform3fv(GLint location,
     GLsizei count,
     target_ulong /* const GLfloat* */ v_)
 {
+    bool res = true;
     GLfloat *v = NULL;
 
     YAGL_GET_CTX(glUniform3fv);
@@ -1878,7 +2077,7 @@ void yagl_host_glUniform3fv(GLint location,
                           v_,
                           3 * count * sizeof(*v),
                           v)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1886,10 +2085,10 @@ void yagl_host_glUniform3fv(GLint location,
     ctx->driver_ps->Uniform3fv(ctx->driver_ps, location, count, v);
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glUniform3i(GLint location,
+bool yagl_host_glUniform3i(GLint location,
     GLint x,
     GLint y,
     GLint z)
@@ -1897,12 +2096,15 @@ void yagl_host_glUniform3i(GLint location,
     YAGL_GET_CTX(glUniform3i);
 
     ctx->driver_ps->Uniform3i(ctx->driver_ps, location, x, y, z);
+
+    return true;
 }
 
-void yagl_host_glUniform3iv(GLint location,
+bool yagl_host_glUniform3iv(GLint location,
     GLsizei count,
     target_ulong /* const GLint* */ v_)
 {
+    bool res = true;
     GLint *v = NULL;
 
     YAGL_GET_CTX(glUniform3iv);
@@ -1913,7 +2115,7 @@ void yagl_host_glUniform3iv(GLint location,
                           v_,
                           3 * count * sizeof(*v),
                           v)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1921,10 +2123,10 @@ void yagl_host_glUniform3iv(GLint location,
     ctx->driver_ps->Uniform3iv(ctx->driver_ps, location, count, v);
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glUniform4f(GLint location,
+bool yagl_host_glUniform4f(GLint location,
     GLfloat x,
     GLfloat y,
     GLfloat z,
@@ -1933,12 +2135,15 @@ void yagl_host_glUniform4f(GLint location,
     YAGL_GET_CTX(glUniform4f);
 
     ctx->driver_ps->Uniform4f(ctx->driver_ps, location, x, y, z, w);
+
+    return true;
 }
 
-void yagl_host_glUniform4fv(GLint location,
+bool yagl_host_glUniform4fv(GLint location,
     GLsizei count,
     target_ulong /* const GLfloat* */ v_)
 {
+    bool res = true;
     GLfloat *v = NULL;
 
     YAGL_GET_CTX(glUniform4fv);
@@ -1949,7 +2154,7 @@ void yagl_host_glUniform4fv(GLint location,
                           v_,
                           4 * count * sizeof(*v),
                           v)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1957,10 +2162,10 @@ void yagl_host_glUniform4fv(GLint location,
     ctx->driver_ps->Uniform4fv(ctx->driver_ps, location, count, v);
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glUniform4i(GLint location,
+bool yagl_host_glUniform4i(GLint location,
     GLint x,
     GLint y,
     GLint z,
@@ -1969,12 +2174,15 @@ void yagl_host_glUniform4i(GLint location,
     YAGL_GET_CTX(glUniform4i);
 
     ctx->driver_ps->Uniform4i(ctx->driver_ps, location, x, y, z, w);
+
+    return true;
 }
 
-void yagl_host_glUniform4iv(GLint location,
+bool yagl_host_glUniform4iv(GLint location,
     GLsizei count,
     target_ulong /* const GLint* */ v_)
 {
+    bool res = true;
     GLint *v = NULL;
 
     YAGL_GET_CTX(glUniform4iv);
@@ -1985,7 +2193,7 @@ void yagl_host_glUniform4iv(GLint location,
                           v_,
                           4 * count * sizeof(*v),
                           v)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -1993,14 +2201,15 @@ void yagl_host_glUniform4iv(GLint location,
     ctx->driver_ps->Uniform4iv(ctx->driver_ps, location, count, v);
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glUniformMatrix2fv(GLint location,
+bool yagl_host_glUniformMatrix2fv(GLint location,
     GLsizei count,
     GLboolean transpose,
     target_ulong /* const GLfloat* */ value_)
 {
+    bool res = true;
     GLfloat *value = NULL;
 
     YAGL_GET_CTX(glUniformMatrix2fv);
@@ -2011,7 +2220,7 @@ void yagl_host_glUniformMatrix2fv(GLint location,
                           value_,
                           2 * 2 * count * sizeof(*value),
                           value)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -2019,14 +2228,15 @@ void yagl_host_glUniformMatrix2fv(GLint location,
     ctx->driver_ps->UniformMatrix2fv(ctx->driver_ps, location, count, transpose, value);
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glUniformMatrix3fv(GLint location,
+bool yagl_host_glUniformMatrix3fv(GLint location,
     GLsizei count,
     GLboolean transpose,
     target_ulong /* const GLfloat* */ value_)
 {
+    bool res = true;
     GLfloat *value = NULL;
 
     YAGL_GET_CTX(glUniformMatrix3fv);
@@ -2037,7 +2247,7 @@ void yagl_host_glUniformMatrix3fv(GLint location,
                           value_,
                           3 * 3 * count * sizeof(*value),
                           value)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -2045,14 +2255,15 @@ void yagl_host_glUniformMatrix3fv(GLint location,
     ctx->driver_ps->UniformMatrix3fv(ctx->driver_ps, location, count, transpose, value);
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glUniformMatrix4fv(GLint location,
+bool yagl_host_glUniformMatrix4fv(GLint location,
     GLsizei count,
     GLboolean transpose,
     target_ulong /* const GLfloat* */ value_)
 {
+    bool res = true;
     GLfloat *value = NULL;
 
     YAGL_GET_CTX(glUniformMatrix4fv);
@@ -2063,7 +2274,7 @@ void yagl_host_glUniformMatrix4fv(GLint location,
                           value_,
                           4 * 4 * count * sizeof(*value),
                           value)) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
+            res = false;
             goto out;
         }
     }
@@ -2071,10 +2282,10 @@ void yagl_host_glUniformMatrix4fv(GLint location,
     ctx->driver_ps->UniformMatrix4fv(ctx->driver_ps, location, count, transpose, value);
 
 out:
-    (void)0;
+    return res;
 }
 
-void yagl_host_glUseProgram(GLuint program)
+bool yagl_host_glUseProgram(GLuint program)
 {
     struct yagl_gles2_program *program_obj = NULL;
 
@@ -2097,9 +2308,11 @@ void yagl_host_glUseProgram(GLuint program)
 
 out:
     yagl_gles2_program_release(program_obj);
+
+    return true;
 }
 
-void yagl_host_glValidateProgram(GLuint program)
+bool yagl_host_glValidateProgram(GLuint program)
 {
     struct yagl_gles2_program *program_obj = NULL;
 
@@ -2117,17 +2330,21 @@ void yagl_host_glValidateProgram(GLuint program)
 
 out:
     yagl_gles2_program_release(program_obj);
+
+    return true;
 }
 
-void yagl_host_glVertexAttrib1f(GLuint indx,
+bool yagl_host_glVertexAttrib1f(GLuint indx,
     GLfloat x)
 {
     YAGL_GET_CTX(glVertexAttrib1f);
 
     ctx->driver_ps->VertexAttrib1f(ctx->driver_ps, indx, x);
+
+    return true;
 }
 
-void yagl_host_glVertexAttrib1fv(GLuint indx,
+bool yagl_host_glVertexAttrib1fv(GLuint indx,
     target_ulong /* const GLfloat* */ values_)
 {
     GLfloat values[1];
@@ -2139,26 +2356,29 @@ void yagl_host_glVertexAttrib1fv(GLuint indx,
                           values_,
                           sizeof(values),
                           &values[0])) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
-            return;
+            return false;
         }
     }
 
     ctx->driver_ps->VertexAttrib1fv(ctx->driver_ps,
                                     indx,
                                     (values_ ? &values[0] : NULL));
+
+    return true;
 }
 
-void yagl_host_glVertexAttrib2f(GLuint indx,
+bool yagl_host_glVertexAttrib2f(GLuint indx,
     GLfloat x,
     GLfloat y)
 {
     YAGL_GET_CTX(glVertexAttrib2f);
 
     ctx->driver_ps->VertexAttrib2f(ctx->driver_ps, indx, x, y);
+
+    return true;
 }
 
-void yagl_host_glVertexAttrib2fv(GLuint indx,
+bool yagl_host_glVertexAttrib2fv(GLuint indx,
     target_ulong /* const GLfloat* */ values_)
 {
     GLfloat values[2];
@@ -2170,17 +2390,18 @@ void yagl_host_glVertexAttrib2fv(GLuint indx,
                           values_,
                           sizeof(values),
                           &values[0])) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
-            return;
+            return false;
         }
     }
 
     ctx->driver_ps->VertexAttrib2fv(ctx->driver_ps,
                                     indx,
                                     (values_ ? &values[0] : NULL));
+
+    return true;
 }
 
-void yagl_host_glVertexAttrib3f(GLuint indx,
+bool yagl_host_glVertexAttrib3f(GLuint indx,
     GLfloat x,
     GLfloat y,
     GLfloat z)
@@ -2188,9 +2409,11 @@ void yagl_host_glVertexAttrib3f(GLuint indx,
     YAGL_GET_CTX(glVertexAttrib3f);
 
     ctx->driver_ps->VertexAttrib3f(ctx->driver_ps, indx, x, y, z);
+
+    return true;
 }
 
-void yagl_host_glVertexAttrib3fv(GLuint indx,
+bool yagl_host_glVertexAttrib3fv(GLuint indx,
     target_ulong /* const GLfloat* */ values_)
 {
     GLfloat values[3];
@@ -2202,17 +2425,18 @@ void yagl_host_glVertexAttrib3fv(GLuint indx,
                           values_,
                           sizeof(values),
                           &values[0])) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
-            return;
+            return false;
         }
     }
 
     ctx->driver_ps->VertexAttrib3fv(ctx->driver_ps,
                                     indx,
                                     (values_ ? &values[0] : NULL));
+
+    return true;
 }
 
-void yagl_host_glVertexAttrib4f(GLuint indx,
+bool yagl_host_glVertexAttrib4f(GLuint indx,
     GLfloat x,
     GLfloat y,
     GLfloat z,
@@ -2221,9 +2445,11 @@ void yagl_host_glVertexAttrib4f(GLuint indx,
     YAGL_GET_CTX(glVertexAttrib4f);
 
     ctx->driver_ps->VertexAttrib4f(ctx->driver_ps, indx, x, y, z, w);
+
+    return true;
 }
 
-void yagl_host_glVertexAttrib4fv(GLuint indx,
+bool yagl_host_glVertexAttrib4fv(GLuint indx,
     target_ulong /* const GLfloat* */ values_)
 {
     GLfloat values[4];
@@ -2235,17 +2461,18 @@ void yagl_host_glVertexAttrib4fv(GLuint indx,
                           values_,
                           sizeof(values),
                           &values[0])) {
-            YAGL_SET_ERR(GL_INVALID_VALUE);
-            return;
+            return false;
         }
     }
 
     ctx->driver_ps->VertexAttrib4fv(ctx->driver_ps,
                                     indx,
                                     (values_ ? &values[0] : NULL));
+
+    return true;
 }
 
-void yagl_host_glVertexAttribPointer(GLuint indx,
+bool yagl_host_glVertexAttribPointer(GLuint indx,
     GLint size,
     GLenum type,
     GLboolean normalized,
@@ -2260,7 +2487,7 @@ void yagl_host_glVertexAttribPointer(GLuint indx,
 
     if (!array) {
         YAGL_SET_ERR(GL_INVALID_VALUE);
-        return;
+        return true;
     }
 
     if (ctx->base.vbo) {
@@ -2284,4 +2511,6 @@ void yagl_host_glVertexAttribPointer(GLuint indx,
             YAGL_SET_ERR(GL_INVALID_VALUE);
         }
     }
+
+    return true;
 }
index 0da0068..404f730 100644 (file)
@@ -9,238 +9,246 @@ struct yagl_api_ps
     *yagl_host_gles2_process_init(struct yagl_api *api,
                                   struct yagl_process_state *ps);
 
-void yagl_host_glAttachShader(GLuint program,
+bool yagl_host_glAttachShader(GLuint program,
     GLuint shader);
-void yagl_host_glBindAttribLocation(GLuint program,
+bool yagl_host_glBindAttribLocation(GLuint program,
     GLuint index,
     target_ulong /* const GLchar* */ name_);
-void yagl_host_glBindFramebuffer(GLenum target,
+bool yagl_host_glBindFramebuffer(GLenum target,
     GLuint framebuffer);
-void yagl_host_glBindRenderbuffer(GLenum target,
+bool yagl_host_glBindRenderbuffer(GLenum target,
     GLuint renderbuffer);
-void yagl_host_glBlendColor(GLclampf red,
+bool yagl_host_glBlendColor(GLclampf red,
     GLclampf green,
     GLclampf blue,
     GLclampf alpha);
-void yagl_host_glBlendEquation(GLenum mode);
-void yagl_host_glBlendEquationSeparate(GLenum modeRGB,
+bool yagl_host_glBlendEquation(GLenum mode);
+bool yagl_host_glBlendEquationSeparate(GLenum modeRGB,
     GLenum modeAlpha);
-void yagl_host_glBlendFuncSeparate(GLenum srcRGB,
+bool yagl_host_glBlendFuncSeparate(GLenum srcRGB,
     GLenum dstRGB,
     GLenum srcAlpha,
     GLenum dstAlpha);
-GLenum yagl_host_glCheckFramebufferStatus(GLenum target);
-void yagl_host_glCompileShader(GLuint shader);
-GLuint yagl_host_glCreateProgram(void);
-GLuint yagl_host_glCreateShader(GLenum type);
-void yagl_host_glDeleteFramebuffers(GLsizei n,
+bool yagl_host_glCheckFramebufferStatus(GLenum* retval,
+    GLenum target);
+bool yagl_host_glCompileShader(GLuint shader);
+bool yagl_host_glCreateProgram(GLuint* retval);
+bool yagl_host_glCreateShader(GLuint* retval,
+    GLenum type);
+bool yagl_host_glDeleteFramebuffers(GLsizei n,
     target_ulong /* const GLuint* */ framebuffers_);
-void yagl_host_glDeleteProgram(GLuint program);
-void yagl_host_glDeleteRenderbuffers(GLsizei n,
+bool yagl_host_glDeleteProgram(GLuint program);
+bool yagl_host_glDeleteRenderbuffers(GLsizei n,
     target_ulong /* const GLuint* */ renderbuffers_);
-void yagl_host_glDeleteShader(GLuint shader);
-void yagl_host_glDetachShader(GLuint program,
+bool yagl_host_glDeleteShader(GLuint shader);
+bool yagl_host_glDetachShader(GLuint program,
     GLuint shader);
-void yagl_host_glDisableVertexAttribArray(GLuint index);
-void yagl_host_glEnableVertexAttribArray(GLuint index);
-void yagl_host_glFramebufferRenderbuffer(GLenum target,
+bool yagl_host_glDisableVertexAttribArray(GLuint index);
+bool yagl_host_glEnableVertexAttribArray(GLuint index);
+bool yagl_host_glFramebufferRenderbuffer(GLenum target,
     GLenum attachment,
     GLenum renderbuffertarget,
     GLuint renderbuffer);
-void yagl_host_glFramebufferTexture2D(GLenum target,
+bool yagl_host_glFramebufferTexture2D(GLenum target,
     GLenum attachment,
     GLenum textarget,
     GLuint texture,
     GLint level);
-void yagl_host_glGenerateMipmap(GLenum target);
-void yagl_host_glGenFramebuffers(GLsizei n,
+bool yagl_host_glGenerateMipmap(GLenum target);
+bool yagl_host_glGenFramebuffers(GLsizei n,
     target_ulong /* GLuint* */ framebuffers_);
-void yagl_host_glGenRenderbuffers(GLsizei n,
+bool yagl_host_glGenRenderbuffers(GLsizei n,
     target_ulong /* GLuint* */ renderbuffers_);
-void yagl_host_glGetActiveAttrib(GLuint program,
+bool yagl_host_glGetActiveAttrib(GLuint program,
     GLuint index,
     GLsizei bufsize,
     target_ulong /* GLsizei* */ length_,
     target_ulong /* GLint* */ size_,
     target_ulong /* GLenum* */ type_,
     target_ulong /* GLchar* */ name_);
-void yagl_host_glGetActiveUniform(GLuint program,
+bool yagl_host_glGetActiveUniform(GLuint program,
     GLuint index,
     GLsizei bufsize,
     target_ulong /* GLsizei* */ length_,
     target_ulong /* GLint* */ size_,
     target_ulong /* GLenum* */ type_,
     target_ulong /* GLchar* */ name_);
-void yagl_host_glGetAttachedShaders(GLuint program,
+bool yagl_host_glGetAttachedShaders(GLuint program,
     GLsizei maxcount,
     target_ulong /* GLsizei* */ count_,
     target_ulong /* GLuint* */ shaders_);
-int yagl_host_glGetAttribLocation(GLuint program,
+bool yagl_host_glGetAttribLocation(int* retval,
+    GLuint program,
     target_ulong /* const GLchar* */ name_);
-void yagl_host_glGetFramebufferAttachmentParameteriv(GLenum target,
+bool yagl_host_glGetFramebufferAttachmentParameteriv(GLenum target,
     GLenum attachment,
     GLenum pname,
     target_ulong /* GLint* */ params_);
-void yagl_host_glGetProgramiv(GLuint program,
+bool yagl_host_glGetProgramiv(GLuint program,
     GLenum pname,
     target_ulong /* GLint* */ params_);
-void yagl_host_glGetProgramInfoLog(GLuint program,
+bool yagl_host_glGetProgramInfoLog(GLuint program,
     GLsizei bufsize,
     target_ulong /* GLsizei* */ length_,
     target_ulong /* GLchar* */ infolog_);
-void yagl_host_glGetRenderbufferParameteriv(GLenum target,
+bool yagl_host_glGetRenderbufferParameteriv(GLenum target,
     GLenum pname,
     target_ulong /* GLint* */ params_);
-void yagl_host_glGetShaderiv(GLuint shader,
+bool yagl_host_glGetShaderiv(GLuint shader,
     GLenum pname,
     target_ulong /* GLint* */ params_);
-void yagl_host_glGetShaderInfoLog(GLuint shader,
+bool yagl_host_glGetShaderInfoLog(GLuint shader,
     GLsizei bufsize,
     target_ulong /* GLsizei* */ length_,
     target_ulong /* GLchar* */ infolog_);
-void yagl_host_glGetShaderPrecisionFormat(GLenum shadertype,
+bool yagl_host_glGetShaderPrecisionFormat(GLenum shadertype,
     GLenum precisiontype,
     target_ulong /* GLint* */ range_,
     target_ulong /* GLint* */ precision_);
-void yagl_host_glGetShaderSource(GLuint shader,
+bool yagl_host_glGetShaderSource(GLuint shader,
     GLsizei bufsize,
     target_ulong /* GLsizei* */ length_,
     target_ulong /* GLchar* */ source_);
-void yagl_host_glGetUniformfv(GLuint program,
+bool yagl_host_glGetUniformfv(GLuint program,
     GLint location,
     target_ulong /* GLfloat* */ params);
-void yagl_host_glGetUniformiv(GLuint program,
+bool yagl_host_glGetUniformiv(GLuint program,
     GLint location,
     target_ulong /* GLint* */ params);
-int yagl_host_glGetUniformLocation(GLuint program,
+bool yagl_host_glGetUniformLocation(int* retval,
+    GLuint program,
     target_ulong /* const GLchar* */ name_);
-void yagl_host_glGetVertexAttribfv(GLuint index,
+bool yagl_host_glGetVertexAttribfv(GLuint index,
     GLenum pname,
     target_ulong /* GLfloat* */ params_);
-void yagl_host_glGetVertexAttribiv(GLuint index,
+bool yagl_host_glGetVertexAttribiv(GLuint index,
     GLenum pname,
     target_ulong /* GLint* */ params_);
-void yagl_host_glGetVertexAttribPointerv(GLuint index,
+bool yagl_host_glGetVertexAttribPointerv(GLuint index,
     GLenum pname,
     target_ulong /* GLvoid** */ pointer_);
-GLboolean yagl_host_glIsFramebuffer(GLuint framebuffer);
-GLboolean yagl_host_glIsProgram(GLuint program);
-GLboolean yagl_host_glIsRenderbuffer(GLuint renderbuffer);
-GLboolean yagl_host_glIsShader(GLuint shader);
-void yagl_host_glLinkProgram(GLuint program);
-void yagl_host_glReleaseShaderCompiler(void);
-void yagl_host_glRenderbufferStorage(GLenum target,
+bool yagl_host_glIsFramebuffer(GLboolean* retval,
+    GLuint framebuffer);
+bool yagl_host_glIsProgram(GLboolean* retval,
+    GLuint program);
+bool yagl_host_glIsRenderbuffer(GLboolean* retval,
+    GLuint renderbuffer);
+bool yagl_host_glIsShader(GLboolean* retval,
+    GLuint shader);
+bool yagl_host_glLinkProgram(GLuint program);
+bool yagl_host_glReleaseShaderCompiler(void);
+bool yagl_host_glRenderbufferStorage(GLenum target,
     GLenum internalformat,
     GLsizei width,
     GLsizei height);
-void yagl_host_glShaderBinary(GLsizei n,
+bool yagl_host_glShaderBinary(GLsizei n,
     target_ulong /* const GLuint* */ shaders,
     GLenum binaryformat,
     target_ulong /* const GLvoid* */ binary,
     GLsizei length);
-void yagl_host_glShaderSource(GLuint shader,
+bool yagl_host_glShaderSource(GLuint shader,
     GLsizei count,
     target_ulong /* const GLchar** */ string_,
     target_ulong /* const GLint* */ length_);
-void yagl_host_glStencilFuncSeparate(GLenum face,
+bool yagl_host_glStencilFuncSeparate(GLenum face,
     GLenum func,
     GLint ref,
     GLuint mask);
-void yagl_host_glStencilMaskSeparate(GLenum face,
+bool yagl_host_glStencilMaskSeparate(GLenum face,
     GLuint mask);
-void yagl_host_glStencilOpSeparate(GLenum face,
+bool yagl_host_glStencilOpSeparate(GLenum face,
     GLenum fail,
     GLenum zfail,
     GLenum zpass);
-void yagl_host_glUniform1f(GLint location,
+bool yagl_host_glUniform1f(GLint location,
     GLfloat x);
-void yagl_host_glUniform1fv(GLint location,
+bool yagl_host_glUniform1fv(GLint location,
     GLsizei count,
     target_ulong /* const GLfloat* */ v_);
-void yagl_host_glUniform1i(GLint location,
+bool yagl_host_glUniform1i(GLint location,
     GLint x);
-void yagl_host_glUniform1iv(GLint location,
+bool yagl_host_glUniform1iv(GLint location,
     GLsizei count,
     target_ulong /* const GLint* */ v_);
-void yagl_host_glUniform2f(GLint location,
+bool yagl_host_glUniform2f(GLint location,
     GLfloat x,
     GLfloat y);
-void yagl_host_glUniform2fv(GLint location,
+bool yagl_host_glUniform2fv(GLint location,
     GLsizei count,
     target_ulong /* const GLfloat* */ v_);
-void yagl_host_glUniform2i(GLint location,
+bool yagl_host_glUniform2i(GLint location,
     GLint x,
     GLint y);
-void yagl_host_glUniform2iv(GLint location,
+bool yagl_host_glUniform2iv(GLint location,
     GLsizei count,
     target_ulong /* const GLint* */ v_);
-void yagl_host_glUniform3f(GLint location,
+bool yagl_host_glUniform3f(GLint location,
     GLfloat x,
     GLfloat y,
     GLfloat z);
-void yagl_host_glUniform3fv(GLint location,
+bool yagl_host_glUniform3fv(GLint location,
     GLsizei count,
     target_ulong /* const GLfloat* */ v_);
-void yagl_host_glUniform3i(GLint location,
+bool yagl_host_glUniform3i(GLint location,
     GLint x,
     GLint y,
     GLint z);
-void yagl_host_glUniform3iv(GLint location,
+bool yagl_host_glUniform3iv(GLint location,
     GLsizei count,
     target_ulong /* const GLint* */ v_);
-void yagl_host_glUniform4f(GLint location,
+bool yagl_host_glUniform4f(GLint location,
     GLfloat x,
     GLfloat y,
     GLfloat z,
     GLfloat w);
-void yagl_host_glUniform4fv(GLint location,
+bool yagl_host_glUniform4fv(GLint location,
     GLsizei count,
     target_ulong /* const GLfloat* */ v_);
-void yagl_host_glUniform4i(GLint location,
+bool yagl_host_glUniform4i(GLint location,
     GLint x,
     GLint y,
     GLint z,
     GLint w);
-void yagl_host_glUniform4iv(GLint location,
+bool yagl_host_glUniform4iv(GLint location,
     GLsizei count,
     target_ulong /* const GLint* */ v_);
-void yagl_host_glUniformMatrix2fv(GLint location,
+bool yagl_host_glUniformMatrix2fv(GLint location,
     GLsizei count,
     GLboolean transpose,
     target_ulong /* const GLfloat* */ value_);
-void yagl_host_glUniformMatrix3fv(GLint location,
+bool yagl_host_glUniformMatrix3fv(GLint location,
     GLsizei count,
     GLboolean transpose,
     target_ulong /* const GLfloat* */ value_);
-void yagl_host_glUniformMatrix4fv(GLint location,
+bool yagl_host_glUniformMatrix4fv(GLint location,
     GLsizei count,
     GLboolean transpose,
     target_ulong /* const GLfloat* */ value_);
-void yagl_host_glUseProgram(GLuint program);
-void yagl_host_glValidateProgram(GLuint program);
-void yagl_host_glVertexAttrib1f(GLuint indx,
+bool yagl_host_glUseProgram(GLuint program);
+bool yagl_host_glValidateProgram(GLuint program);
+bool yagl_host_glVertexAttrib1f(GLuint indx,
     GLfloat x);
-void yagl_host_glVertexAttrib1fv(GLuint indx,
+bool yagl_host_glVertexAttrib1fv(GLuint indx,
     target_ulong /* const GLfloat* */ values_);
-void yagl_host_glVertexAttrib2f(GLuint indx,
+bool yagl_host_glVertexAttrib2f(GLuint indx,
     GLfloat x,
     GLfloat y);
-void yagl_host_glVertexAttrib2fv(GLuint indx,
+bool yagl_host_glVertexAttrib2fv(GLuint indx,
     target_ulong /* const GLfloat* */ values_);
-void yagl_host_glVertexAttrib3f(GLuint indx,
+bool yagl_host_glVertexAttrib3f(GLuint indx,
     GLfloat x,
     GLfloat y,
     GLfloat z);
-void yagl_host_glVertexAttrib3fv(GLuint indx,
+bool yagl_host_glVertexAttrib3fv(GLuint indx,
     target_ulong /* const GLfloat* */ values_);
-void yagl_host_glVertexAttrib4f(GLuint indx,
+bool yagl_host_glVertexAttrib4f(GLuint indx,
     GLfloat x,
     GLfloat y,
     GLfloat z,
     GLfloat w);
-void yagl_host_glVertexAttrib4fv(GLuint indx,
+bool yagl_host_glVertexAttrib4fv(GLuint indx,
     target_ulong /* const GLfloat* */ values_);
-void yagl_host_glVertexAttribPointer(GLuint indx,
+bool yagl_host_glVertexAttribPointer(GLuint indx,
     GLint size,
     GLenum type,
     GLboolean normalized,
index e229cae..44eafb8 100644 (file)
  */
 #define YAGL_MARSHAL_SIZE 0x8000
 
+typedef enum
+{
+    yagl_call_result_fail = 0,  /* Call failed, fatal error. */
+    yagl_call_result_retry = 1, /* Page fault on host, retry is required. */
+    yagl_call_result_ok = 2     /* Call is ok. */
+} yagl_call_result;
+
 static __inline int yagl_marshal_skip(uint8_t** buff)
 {
     *buff += 8;
@@ -93,6 +100,12 @@ static __inline yagl_host_handle yagl_marshal_get_host_handle(uint8_t** buff)
     return tmp;
 }
 
+static __inline void yagl_marshal_put_call_result(uint8_t** buff, yagl_call_result value)
+{
+    *(uint32_t*)(*buff) = cpu_to_le32(value);
+    *buff += 8;
+}
+
 #define yagl_marshal_put_int8(buff, value) yagl_marshal_put_uint8(buff, (uint8_t)(value))
 #define yagl_marshal_get_int8(buff) ((int8_t)yagl_marshal_get_uint8(buff))
 #define yagl_marshal_put_int32(buff, value) yagl_marshal_put_uint32(buff, (uint32_t)(value))
index ee4676c..b7d182d 100644 (file)
@@ -4,25 +4,6 @@
 #include "yagl_process.h"
 #include "yagl_vector.h"
 
-bool yagl_mem_put_uint8(struct yagl_thread_state *ts, target_ulong va, uint8_t value)
-{
-    int ret;
-
-    assert(ts->current_env);
-
-    YAGL_LOG_FUNC_ENTER_TS(ts, yagl_mem_put_uint8, "va = 0x%X, value = 0x%X", (uint32_t)va, (uint32_t)value);
-
-    ret = cpu_memory_rw_debug(ts->current_env, va, &value, sizeof(value), 1);
-
-    if (ret == -1) {
-        YAGL_LOG_ERROR("write 0x%X failed", (uint32_t)va);
-    }
-
-    YAGL_LOG_FUNC_EXIT(NULL);
-
-    return ret != -1;
-}
-
 bool yagl_mem_get_uint8(struct yagl_thread_state *ts, target_ulong va, uint8_t* value)
 {
     int ret;
@@ -34,7 +15,7 @@ bool yagl_mem_get_uint8(struct yagl_thread_state *ts, target_ulong va, uint8_t*
     ret = cpu_memory_rw_debug(ts->current_env, va, value, sizeof(*value), 0);
 
     if (ret == -1) {
-        YAGL_LOG_ERROR("read 0x%X failed", (uint32_t)va);
+        YAGL_LOG_WARN("page fault at 0x%X", (uint32_t)va);
 
         YAGL_LOG_FUNC_EXIT(NULL);
     } else {
@@ -44,25 +25,6 @@ bool yagl_mem_get_uint8(struct yagl_thread_state *ts, target_ulong va, uint8_t*
     return ret != -1;
 }
 
-bool yagl_mem_put_uint16(struct yagl_thread_state *ts, target_ulong va, uint16_t value)
-{
-    int ret;
-
-    assert(ts->current_env);
-
-    YAGL_LOG_FUNC_ENTER_TS(ts, yagl_mem_put_uint16, "va = 0x%X, value = 0x%X", (uint32_t)va, (uint32_t)value);
-
-    ret = cpu_memory_rw_debug(ts->current_env, va, (uint8_t*)&value, sizeof(value), 1);
-
-    if (ret == -1) {
-        YAGL_LOG_ERROR("write 0x%X failed", (uint32_t)va);
-    }
-
-    YAGL_LOG_FUNC_EXIT(NULL);
-
-    return ret != -1;
-}
-
 bool yagl_mem_get_uint16(struct yagl_thread_state *ts, target_ulong va, uint16_t* value)
 {
     int ret;
@@ -74,7 +36,7 @@ bool yagl_mem_get_uint16(struct yagl_thread_state *ts, target_ulong va, uint16_t
     ret = cpu_memory_rw_debug(ts->current_env, va, (uint8_t*)value, sizeof(*value), 0);
 
     if (ret == -1) {
-        YAGL_LOG_ERROR("read 0x%X failed", (uint32_t)va);
+        YAGL_LOG_WARN("page fault at 0x%X", (uint32_t)va);
 
         YAGL_LOG_FUNC_EXIT(NULL);
     } else {
@@ -84,25 +46,6 @@ bool yagl_mem_get_uint16(struct yagl_thread_state *ts, target_ulong va, uint16_t
     return ret != -1;
 }
 
-bool yagl_mem_put_uint32(struct yagl_thread_state *ts, target_ulong va, uint32_t value)
-{
-    int ret;
-
-    assert(ts->current_env);
-
-    YAGL_LOG_FUNC_ENTER_TS(ts, yagl_mem_put_uint32, "va = 0x%X, value = 0x%X", (uint32_t)va, value);
-
-    ret = cpu_memory_rw_debug(ts->current_env, va, (uint8_t*)&value, sizeof(value), 1);
-
-    if (ret == -1) {
-        YAGL_LOG_ERROR("write 0x%X failed", (uint32_t)va);
-    }
-
-    YAGL_LOG_FUNC_EXIT(NULL);
-
-    return ret != -1;
-}
-
 bool yagl_mem_get_uint32(struct yagl_thread_state *ts, target_ulong va, uint32_t* value)
 {
     int ret;
@@ -114,7 +57,7 @@ bool yagl_mem_get_uint32(struct yagl_thread_state *ts, target_ulong va, uint32_t
     ret = cpu_memory_rw_debug(ts->current_env, va, (uint8_t*)value, sizeof(*value), 0);
 
     if (ret == -1) {
-        YAGL_LOG_ERROR("read 0x%X failed", (uint32_t)va);
+        YAGL_LOG_WARN("page fault at 0x%X", (uint32_t)va);
 
         YAGL_LOG_FUNC_EXIT(NULL);
     } else {
@@ -124,25 +67,6 @@ bool yagl_mem_get_uint32(struct yagl_thread_state *ts, target_ulong va, uint32_t
     return ret != -1;
 }
 
-bool yagl_mem_put_float(struct yagl_thread_state *ts, target_ulong va, float value)
-{
-    int ret;
-
-    assert(ts->current_env);
-
-    YAGL_LOG_FUNC_ENTER_TS(ts, yagl_mem_put_float, "va = 0x%X, value = %f", (uint32_t)va, value);
-
-    ret = cpu_memory_rw_debug(ts->current_env, va, (uint8_t*)&value, sizeof(value), 1);
-
-    if (ret == -1) {
-        YAGL_LOG_ERROR("write 0x%X failed", (uint32_t)va);
-    }
-
-    YAGL_LOG_FUNC_EXIT(NULL);
-
-    return ret != -1;
-}
-
 bool yagl_mem_get_float(struct yagl_thread_state *ts, target_ulong va, float* value)
 {
     int ret;
@@ -154,7 +78,7 @@ bool yagl_mem_get_float(struct yagl_thread_state *ts, target_ulong va, float* va
     ret = cpu_memory_rw_debug(ts->current_env, va, (uint8_t*)value, sizeof(*value), 0);
 
     if (ret == -1) {
-        YAGL_LOG_ERROR("read 0x%X failed", (uint32_t)va);
+        YAGL_LOG_WARN("page fault at 0x%X", (uint32_t)va);
 
         YAGL_LOG_FUNC_EXIT(NULL);
     } else {
@@ -175,26 +99,7 @@ bool yagl_mem_get(struct yagl_thread_state *ts, target_ulong va, uint32_t len, v
     ret = cpu_memory_rw_debug(ts->current_env, va, data, len, 0);
 
     if (ret == -1) {
-        YAGL_LOG_ERROR("read 0x%X:%u failed", (uint32_t)va, len);
-    }
-
-    YAGL_LOG_FUNC_EXIT(NULL);
-
-    return ret != -1;
-}
-
-bool yagl_mem_put(struct yagl_thread_state *ts, target_ulong va, uint32_t len, const void* data)
-{
-    int ret;
-
-    assert(ts->current_env);
-
-    YAGL_LOG_FUNC_ENTER_TS(ts, yagl_mem_put, "va = 0x%X, len = %u", (uint32_t)va, len);
-
-    ret = cpu_memory_rw_debug(ts->current_env, va, (void*)data, len, 1);
-
-    if (ret == -1) {
-        YAGL_LOG_ERROR("write 0x%X:%u failed", (uint32_t)va, len);
+        YAGL_LOG_WARN("page fault at 0x%X", (uint32_t)va, len);
     }
 
     YAGL_LOG_FUNC_EXIT(NULL);
@@ -228,7 +133,7 @@ bool yagl_mem_get_array(struct yagl_thread_state *ts,
                                 &buff[rem],
                                 len,
                                 0) == -1) {
-            YAGL_LOG_ERROR("read 0x%X:%u failed", (uint32_t)va, (uint32_t)len);
+            YAGL_LOG_WARN("page fault at 0x%X:%u", (uint32_t)va, (uint32_t)len);
             res = false;
             break;
         }
index 91b7622..5dad699 100644 (file)
@@ -2,29 +2,18 @@
 #define _QEMU_YAGL_MEM_H
 
 #include "yagl_types.h"
-
-struct yagl_thread_state;
-
-bool yagl_mem_put_uint8(struct yagl_thread_state *ts, target_ulong va, uint8_t value);
+#include "yagl_mem_transfer.h"
 
 bool yagl_mem_get_uint8(struct yagl_thread_state *ts, target_ulong va, uint8_t* value);
 
-bool yagl_mem_put_uint16(struct yagl_thread_state *ts, target_ulong va, uint16_t value);
-
 bool yagl_mem_get_uint16(struct yagl_thread_state *ts, target_ulong va, uint16_t* value);
 
-bool yagl_mem_put_uint32(struct yagl_thread_state *ts, target_ulong va, uint32_t value);
-
 bool yagl_mem_get_uint32(struct yagl_thread_state *ts, target_ulong va, uint32_t* value);
 
-bool yagl_mem_put_float(struct yagl_thread_state *ts, target_ulong va, float value);
-
 bool yagl_mem_get_float(struct yagl_thread_state *ts, target_ulong va, float* value);
 
 bool yagl_mem_get(struct yagl_thread_state *ts, target_ulong va, uint32_t len, void* data);
 
-bool yagl_mem_put(struct yagl_thread_state *ts, target_ulong va, uint32_t len, const void* data);
-
 typedef bool (*yagl_mem_array_cb)(const void */*el*/, void */*user_data*/);
 
 /*
@@ -40,19 +29,25 @@ bool yagl_mem_get_array(struct yagl_thread_state *ts,
 
 char *yagl_mem_get_string(struct yagl_thread_state *ts, target_ulong va);
 
-#define yagl_mem_put_char(ts, va, value) yagl_mem_put_uint8((ts), (va), (uint8_t)(value))
+#define yagl_mem_prepare_char(mt, va) yagl_mem_prepare_uint8((mt), (va))
+#define yagl_mem_put_char(mt, value) yagl_mem_put_uint8((mt), (uint8_t)(value))
 #define yagl_mem_get_char(ts, va, value) yagl_mem_get_uint8((ts), (va), (uint8_t*)(value))
-#define yagl_mem_put_int8(ts, va, value) yagl_mem_put_uint8((ts), (va), (uint8_t)(value))
+#define yagl_mem_prepare_int8(mt, va) yagl_mem_prepare_uint8((mt), (va))
+#define yagl_mem_put_int8(mt, value) yagl_mem_put_uint8((mt), (uint8_t)(value))
 #define yagl_mem_get_int8(ts, va, value) yagl_mem_get_uint8((ts), (va), (uint8_t*)(value))
-#define yagl_mem_put_int16(ts, va, value) yagl_mem_put_uint16((ts), (va), (uint16_t)(value))
+#define yagl_mem_prepare_int16(mt, va) yagl_mem_prepare_uint16((mt), (va))
+#define yagl_mem_put_int16(mt, value) yagl_mem_put_uint16((mt), (uint16_t)(value))
 #define yagl_mem_get_int16(ts, va, value) yagl_mem_get_uint16((ts), (va), (uint16_t*)(value))
-#define yagl_mem_put_int32(ts, va, value) yagl_mem_put_uint32((ts), (va), (uint32_t)(value))
+#define yagl_mem_prepare_int32(mt, va) yagl_mem_prepare_uint32((mt), (va))
+#define yagl_mem_put_int32(mt, value) yagl_mem_put_uint32((mt), (uint32_t)(value))
 #define yagl_mem_get_int32(ts, va, value) yagl_mem_get_uint32((ts), (va), (uint32_t*)(value))
-#define yagl_mem_put_host_handle(ts, va, value) yagl_mem_put_uint32((ts), (va), (value))
+#define yagl_mem_prepare_host_handle(mt, va) yagl_mem_prepare_uint32((mt), (va))
+#define yagl_mem_put_host_handle(mt, value) yagl_mem_put_uint32((mt), (value))
 #define yagl_mem_get_host_handle(ts, va, value) yagl_mem_get_uint32((ts), (va), (value))
 
 #if TARGET_LONG_SIZE == 4
-#define yagl_mem_put_ptr(ts, va, value) yagl_mem_put_uint32((ts), (va), (value))
+#define yagl_mem_prepare_ptr(mt, va) yagl_mem_prepare_uint32((mt), (va))
+#define yagl_mem_put_ptr(mt, value) yagl_mem_put_uint32((mt), (value))
 #else
 #error 64-bit ptr not supported
 #endif
index 85c2188..f0287ce 100644 (file)
@@ -4,7 +4,8 @@
 #include "yagl_mem.h"
 #include <EGL/egl.h>
 
-#define yagl_mem_put_EGLint(ts, va, value) yagl_mem_put_int32((ts), (va), (value))
+#define yagl_mem_prepare_EGLint(mt, va) yagl_mem_prepare_int32((mt), (va))
+#define yagl_mem_put_EGLint(mt, value) yagl_mem_put_int32((mt), (value))
 #define yagl_mem_get_EGLint(ts, va, value) yagl_mem_get_int32((ts), (va), (value))
 
 EGLint *yagl_mem_get_attrib_list(struct yagl_thread_state *ts,
index 1ffc97c..faf8c5b 100644 (file)
@@ -3,17 +3,23 @@
 
 #include "yagl_mem.h"
 
-#define yagl_mem_put_GLint(ts, va, value) yagl_mem_put_int32((ts), (va), (value))
+#define yagl_mem_prepare_GLint(mt, va) yagl_mem_prepare_int32((mt), (va))
+#define yagl_mem_put_GLint(mt, value) yagl_mem_put_int32((mt), (value))
 #define yagl_mem_get_GLint(ts, va, value) yagl_mem_get_int32((ts), (va), (value))
-#define yagl_mem_put_GLuint(ts, va, value) yagl_mem_put_uint32((ts), (va), (value))
+#define yagl_mem_prepare_GLuint(mt, va) yagl_mem_prepare_uint32((mt), (va))
+#define yagl_mem_put_GLuint(mt, value) yagl_mem_put_uint32((mt), (value))
 #define yagl_mem_get_GLuint(ts, va, value) yagl_mem_get_uint32((ts), (va), (value))
-#define yagl_mem_put_GLsizei(ts, va, value) yagl_mem_put_int32((ts), (va), (value))
+#define yagl_mem_prepare_GLsizei(mt, va) yagl_mem_prepare_int32((mt), (va))
+#define yagl_mem_put_GLsizei(mt, value) yagl_mem_put_int32((mt), (value))
 #define yagl_mem_get_GLsizei(ts, va, value) yagl_mem_get_int32((ts), (va), (value))
-#define yagl_mem_put_GLenum(ts, va, value) yagl_mem_put_uint32((ts), (va), (value))
+#define yagl_mem_prepare_GLenum(mt, va) yagl_mem_prepare_uint32((mt), (va))
+#define yagl_mem_put_GLenum(mt, value) yagl_mem_put_uint32((mt), (value))
 #define yagl_mem_get_GLenum(ts, va, value) yagl_mem_get_uint32((ts), (va), (value))
-#define yagl_mem_put_GLfloat(ts, va, value) yagl_mem_put_float((ts), (va), (value))
+#define yagl_mem_prepare_GLfloat(mt, va) yagl_mem_prepare_float((mt), (va))
+#define yagl_mem_put_GLfloat(mt, value) yagl_mem_put_float((mt), (value))
 #define yagl_mem_get_GLfloat(ts, va, value) yagl_mem_get_float((ts), (va), (value))
-#define yagl_mem_put_GLboolean(ts, va, value) yagl_mem_put_uint8((ts), (va), (value))
+#define yagl_mem_prepare_GLboolean(mt, va) yagl_mem_prepare_uint8((mt), (va))
+#define yagl_mem_put_GLboolean(mt, value) yagl_mem_put_uint8((mt), (value))
 #define yagl_mem_get_GLboolean(ts, va, value) yagl_mem_get_uint8((ts), (va), (value))
 
 #endif
diff --git a/hw/yagl_mem_transfer.c b/hw/yagl_mem_transfer.c
new file mode 100644 (file)
index 0000000..48d5548
--- /dev/null
@@ -0,0 +1,151 @@
+#include "yagl_mem_transfer.h"
+#include "yagl_process.h"
+#include "yagl_thread.h"
+#include "yagl_log.h"
+#include "cpu-all.h"
+
+struct yagl_mem_transfer
+    *yagl_mem_transfer_create(struct yagl_thread_state *ts)
+{
+    struct yagl_mem_transfer *mt;
+
+    mt = g_malloc0(sizeof(*mt));
+
+    mt->ts = ts;
+
+    return mt;
+}
+
+void yagl_mem_transfer_destroy(struct yagl_mem_transfer *mt)
+{
+    g_free(mt->pages);
+    g_free(mt);
+}
+
+bool yagl_mem_prepare(struct yagl_mem_transfer *mt,
+                      target_ulong va,
+                      int len)
+{
+    bool res = true;
+    int l;
+    target_phys_addr_t page_pa;
+    target_ulong page_va;
+
+    YAGL_LOG_FUNC_ENTER_TS(mt->ts, yagl_mem_prepare, "va = 0x%X, len = %d", (uint32_t)va, len);
+
+    assert(mt->ts->current_env);
+
+    if (len >= 0) {
+        int max_pages = ((len + TARGET_PAGE_SIZE - 1) / TARGET_PAGE_SIZE) + 1;
+
+        if (max_pages > mt->max_pages) {
+            g_free(mt->pages);
+            mt->pages = g_malloc(sizeof(*mt->pages) * max_pages);
+        }
+
+        mt->max_pages = max_pages;
+    }
+
+    mt->va = va;
+    mt->offset = (va & ~TARGET_PAGE_MASK);
+    mt->len = len;
+    mt->num_pages = 0;
+
+    if (va) {
+        while (len > 0) {
+            page_va = va & TARGET_PAGE_MASK;
+            page_pa = cpu_get_phys_page_debug(mt->ts->current_env, page_va);
+
+            if (page_pa == -1) {
+                YAGL_LOG_WARN("page fault at 0x%X", (uint32_t)page_va);
+                res = false;
+                break;
+            }
+
+            l = (page_va + TARGET_PAGE_SIZE) - va;
+            if (l > len) {
+                l = len;
+            }
+
+            len -= l;
+            va += l;
+
+            assert(mt->num_pages < mt->max_pages);
+
+            mt->pages[mt->num_pages++] = page_pa;
+        }
+    }
+
+    YAGL_LOG_FUNC_EXIT(NULL);
+
+    return res;
+}
+
+static void yagl_mem_put_internal(struct yagl_mem_transfer *mt, const void *data)
+{
+    int len = mt->len, offset = mt->offset, i = 0;
+
+    if (!mt->va) {
+        assert(false);
+        YAGL_LOG_CRITICAL("mt->va is 0");
+        return;
+    }
+
+    while (len > 0) {
+        int l = MIN(len, (TARGET_PAGE_SIZE - offset));
+
+        assert(i < mt->num_pages);
+
+        cpu_physical_memory_write_rom(mt->pages[i++] + offset, data, l);
+
+        offset = 0;
+
+        data += l;
+        len -= l;
+    }
+}
+
+void yagl_mem_put(struct yagl_mem_transfer *mt, const void *data)
+{
+    YAGL_LOG_FUNC_ENTER_TS(mt->ts, yagl_mem_put, "va = 0X%X, data = %p", (uint32_t)mt->va, data);
+
+    yagl_mem_put_internal(mt, data);
+
+    YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void yagl_mem_put_uint8(struct yagl_mem_transfer *mt, uint8_t value)
+{
+    YAGL_LOG_FUNC_ENTER_TS(mt->ts, yagl_mem_put_uint8, "va = 0x%X, value = 0x%X", (uint32_t)mt->va, (uint32_t)value);
+
+    yagl_mem_put_internal(mt, &value);
+
+    YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void yagl_mem_put_uint16(struct yagl_mem_transfer *mt, uint16_t value)
+{
+    YAGL_LOG_FUNC_ENTER_TS(mt->ts, yagl_mem_put_uint16, "va = 0x%X, value = 0x%X", (uint32_t)mt->va, (uint32_t)value);
+
+    yagl_mem_put_internal(mt, &value);
+
+    YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void yagl_mem_put_uint32(struct yagl_mem_transfer *mt, uint32_t value)
+{
+    YAGL_LOG_FUNC_ENTER_TS(mt->ts, yagl_mem_put_uint32, "va = 0x%X, value = 0x%X", (uint32_t)mt->va, value);
+
+    yagl_mem_put_internal(mt, &value);
+
+    YAGL_LOG_FUNC_EXIT(NULL);
+}
+
+void yagl_mem_put_float(struct yagl_mem_transfer *mt, float value)
+{
+    YAGL_LOG_FUNC_ENTER_TS(mt->ts, yagl_mem_put_float, "va = 0x%X, value = %f", (uint32_t)mt->va, value);
+
+    yagl_mem_put_internal(mt, &value);
+
+    YAGL_LOG_FUNC_EXIT(NULL);
+}
diff --git a/hw/yagl_mem_transfer.h b/hw/yagl_mem_transfer.h
new file mode 100644 (file)
index 0000000..2b2c7ab
--- /dev/null
@@ -0,0 +1,65 @@
+#ifndef _QEMU_YAGL_MEM_TRANSFER_H
+#define _QEMU_YAGL_MEM_TRANSFER_H
+
+#include "yagl_types.h"
+
+struct yagl_mem_transfer
+{
+    struct yagl_thread_state *ts;
+
+    target_phys_addr_t *pages;
+    int max_pages;
+
+    target_ulong va;
+    int offset;
+    int len;
+    int num_pages;
+};
+
+/*
+ * Guaranteed to succeed.
+ */
+struct yagl_mem_transfer
+    *yagl_mem_transfer_create(struct yagl_thread_state *ts);
+
+void yagl_mem_transfer_destroy(struct yagl_mem_transfer *mt);
+
+bool yagl_mem_prepare(struct yagl_mem_transfer *mt,
+                      target_ulong va,
+                      int len);
+
+static __inline bool yagl_mem_prepare_uint8(struct yagl_mem_transfer *mt,
+                                            target_ulong va)
+{
+    return yagl_mem_prepare(mt, va, sizeof(uint8_t));
+}
+
+static __inline bool yagl_mem_prepare_uint16(struct yagl_mem_transfer *mt,
+                                             target_ulong va)
+{
+    return yagl_mem_prepare(mt, va, sizeof(uint16_t));
+}
+
+static __inline bool yagl_mem_prepare_uint32(struct yagl_mem_transfer *mt,
+                                             target_ulong va)
+{
+    return yagl_mem_prepare(mt, va, sizeof(uint32_t));
+}
+
+static __inline bool yagl_mem_prepare_float(struct yagl_mem_transfer *mt,
+                                            target_ulong va)
+{
+    return yagl_mem_prepare(mt, va, sizeof(float));
+}
+
+void yagl_mem_put(struct yagl_mem_transfer *mt, const void *data);
+
+void yagl_mem_put_uint8(struct yagl_mem_transfer *mt, uint8_t value);
+
+void yagl_mem_put_uint16(struct yagl_mem_transfer *mt, uint16_t value);
+
+void yagl_mem_put_uint32(struct yagl_mem_transfer *mt, uint32_t value);
+
+void yagl_mem_put_float(struct yagl_mem_transfer *mt, float value);
+
+#endif
index 0b9ab5f..966a678 100644 (file)
@@ -248,7 +248,7 @@ void yagl_server_dispatch(struct yagl_server_state *ss,
             "process/thread %u/%u not found",
             target_pid, target_tid);
 
-        yagl_marshal_put_uint32(&in_buff, 0);
+        yagl_marshal_put_call_result(&in_buff, yagl_call_result_fail);
     }
 
     YAGL_LOG_FUNC_EXIT(NULL);
index 080ef15..f5e6cd9 100644 (file)
@@ -5,6 +5,7 @@
 #include "yagl_log.h"
 #include "yagl_marshal.h"
 #include "yagl_stats.h"
+#include "yagl_mem_transfer.h"
 #include "kvm.h"
 #include "hax.h"
 
@@ -39,7 +40,7 @@ static void *yagl_thread_func(void* arg)
     }
 
     while (true) {
-        bool ret = true;
+        yagl_call_result res = yagl_call_result_ok;
         uint8_t *current_buff;
         uint8_t *tmp;
 #ifdef CONFIG_YAGL_STATS
@@ -73,7 +74,7 @@ static void *yagl_thread_func(void* arg)
             if (current_buff >= (ts->current_out_buff + YAGL_MARSHAL_SIZE)) {
                 YAGL_LOG_CRITICAL("batch passes the end of buffer, protocol error");
 
-                ret = false;
+                res = yagl_call_result_fail;
 
                 break;
             }
@@ -97,7 +98,7 @@ static void *yagl_thread_func(void* arg)
             if ((api_id <= 0) || (api_id > YAGL_NUM_APIS)) {
                 YAGL_LOG_CRITICAL("target-host protocol error, bad api_id - %u", api_id);
 
-                ret = false;
+                res = yagl_call_result_fail;
 
                 break;
             }
@@ -107,7 +108,7 @@ static void *yagl_thread_func(void* arg)
             if (!api_ps) {
                 YAGL_LOG_CRITICAL("uninitialized api - %u. host logic error", api_id);
 
-                ret = false;
+                res = yagl_call_result_fail;
 
                 break;
             }
@@ -119,15 +120,30 @@ static void *yagl_thread_func(void* arg)
 
                 yagl_marshal_skip(&tmp);
 
-                current_buff = func(ts,
-                                    current_buff,
-                                    tmp);
+                if (!func(ts, &current_buff, tmp)) {
+                    /*
+                     * Retry is requested. Check if this is the last function
+                     * in the batch, if it's not, then there's a logic error
+                     * in target <-> host interaction.
+                     */
+
+                    if (((current_buff + 8) > (ts->current_out_buff + YAGL_MARSHAL_SIZE)) ||
+                        (yagl_marshal_get_api_id(&current_buff) != 0)) {
+                        YAGL_LOG_CRITICAL("retry request not at the end of the batch");
+
+                        res = yagl_call_result_fail;
+                    } else {
+                        res = yagl_call_result_retry;
+                    }
+
+                    break;
+                }
             } else {
                 YAGL_LOG_CRITICAL("bad function call (api = %u, func = %u)",
                                   api_id,
                                   func_id);
 
-                ret = false;
+                res = yagl_call_result_fail;
 
                 break;
             }
@@ -142,7 +158,7 @@ static void *yagl_thread_func(void* arg)
         yagl_stats_batch(num_calls,
             (ts->current_out_buff + YAGL_MARSHAL_SIZE - current_buff));
 
-        yagl_marshal_put_uint32(&tmp, (ret ? 1 : 0));
+        yagl_marshal_put_call_result(&tmp, res);
 
         yagl_event_set(&ts->call_processed_event);
     }
@@ -172,6 +188,11 @@ struct yagl_thread_state
     ts->ps = ps;
     ts->id = id;
 
+    ts->mt1 = yagl_mem_transfer_create(ts);
+    ts->mt2 = yagl_mem_transfer_create(ts);
+    ts->mt3 = yagl_mem_transfer_create(ts);
+    ts->mt4 = yagl_mem_transfer_create(ts);
+
     yagl_event_init(&ts->call_event, 0, 0);
     yagl_event_init(&ts->call_processed_event, 0, 0);
 
@@ -192,6 +213,11 @@ void yagl_thread_state_destroy(struct yagl_thread_state *ts)
     yagl_event_cleanup(&ts->call_processed_event);
     yagl_event_cleanup(&ts->call_event);
 
+    yagl_mem_transfer_destroy(ts->mt1);
+    yagl_mem_transfer_destroy(ts->mt2);
+    yagl_mem_transfer_destroy(ts->mt3);
+    yagl_mem_transfer_destroy(ts->mt4);
+
     g_free(ts);
 }
 
index 102530c..db59552 100644 (file)
@@ -7,6 +7,7 @@
 #include "qemu-thread.h"
 
 struct yagl_process_state;
+struct yagl_mem_transfer;
 
 struct yagl_thread_state
 {
@@ -16,6 +17,21 @@ struct yagl_thread_state
 
     yagl_tid id;
 
+    /*
+     * Memory transfers cached for speed. To be used
+     * in EGL/GL implementations.
+     * @{
+     */
+
+    struct yagl_mem_transfer *mt1;
+    struct yagl_mem_transfer *mt2;
+    struct yagl_mem_transfer *mt3;
+    struct yagl_mem_transfer *mt4;
+
+    /*
+     * @}
+     */
+
     QemuThread host_thread;
 
     volatile bool destroying; /* true when thread is being destroyed */
index 379a2b5..f9e7214 100644 (file)
@@ -36,8 +36,8 @@ typedef enum
 
 struct yagl_thread_state;
 
-typedef uint8_t *(*yagl_api_func)(struct yagl_thread_state */*ts*/,
-                                  uint8_t */*out_buff*/,
-                                  uint8_t */*in_buff*/);
+typedef bool (*yagl_api_func)(struct yagl_thread_state */*ts*/,
+                              uint8_t **/*out_buff*/,
+                              uint8_t */*in_buff*/);
 
 #endif
index 0edf7f7..b1cba85 100644 (file)
@@ -6,6 +6,6 @@
 /*
  * Whenever protocol changes be sure to bump this.
  */
-#define YAGL_VERSION 9
+#define YAGL_VERSION 10
 
 #endif