diff options
author | Stanislav Vorobiov <s.vorobiov@samsung.com> | 2013-10-01 08:51:51 +0400 |
---|---|---|
committer | Stanislav Vorobiov <s.vorobiov@samsung.com> | 2013-10-17 14:31:45 +0400 |
commit | c4af993955f4c29e1cc2fdf6827713e5244ad5a2 (patch) | |
tree | 4bb0837815bf03e54bd4668a58490affded2201a /GLESv1_CM | |
parent | f9e94509786f616121138af0b460c95587faf10d (diff) | |
download | emulator-yagl-c4af993955f4c29e1cc2fdf6827713e5244ad5a2.tar.gz emulator-yagl-c4af993955f4c29e1cc2fdf6827713e5244ad5a2.tar.bz2 emulator-yagl-c4af993955f4c29e1cc2fdf6827713e5244ad5a2.zip |
YaGL: Batching improved
The improvements are:
* State tracking is moved completely from host to target,
this allows executing many OpenGL functions such as state queries
without doing vmexits
* The results of some functions that do require a vmexit are now cached on
target, so that subsequent calls are performed faster
* Lazy object (such as textures, shaders, etc.) creation implemented, this
allows batching calls such as glGenXXX, which significatly improves
performance in some cases
* Shader variable location generation on target allows one to batch
glGetXXXLocation calls, this significantly improves performance, but
causes a khronos conformance test fail for glGetXXXLocation, since it's not
possible to know if a particular name really exists inside a shader or
not without doing a vmexit. Just for this we introduce YAGL_CONFORMANT
environment variable that turns off location generation, thus, trades
performance for conformance
* eglMakeCurrent is now batched, this also improves performance in case if
an app makes a lot of context switches
The results of these improvements are:
* Up to 95% (was ~60%) GPU usage with pure X.Org server, up
to 85-90% (was ~50%) GPU usage on current Tizen filesystem
with onscreen backend
* Up to 50% performance improvement with onscreen backend
* Turning on pageflip in X.Org VIGS video driver now makes sense, it now
gives a visible performance improvement
Change-Id: Ic99a6bb1a501f15ce0dc9b90aeb10beaa5934e38
Diffstat (limited to 'GLESv1_CM')
-rw-r--r-- | GLESv1_CM/CMakeLists.txt | 15 | ||||
-rw-r--r-- | GLESv1_CM/yagl_gles1_calls.c | 1684 | ||||
-rw-r--r-- | GLESv1_CM/yagl_gles1_calls.in | 93 | ||||
-rw-r--r-- | GLESv1_CM/yagl_gles1_context.c | 1209 | ||||
-rw-r--r-- | GLESv1_CM/yagl_gles1_context.h | 42 | ||||
-rw-r--r-- | GLESv1_CM/yagl_gles1_interface.c | 34 | ||||
-rw-r--r-- | GLESv1_CM/yagl_gles1_validate.c | 128 | ||||
-rw-r--r-- | GLESv1_CM/yagl_gles1_validate.h | 18 | ||||
-rw-r--r-- | GLESv1_CM/yagl_host_gles1_calls.c | 2612 | ||||
-rw-r--r-- | GLESv1_CM/yagl_host_gles1_calls.h | 841 |
10 files changed, 2756 insertions, 3920 deletions
diff --git a/GLESv1_CM/CMakeLists.txt b/GLESv1_CM/CMakeLists.txt index 199a1a5..4c3bc70 100644 --- a/GLESv1_CM/CMakeLists.txt +++ b/GLESv1_CM/CMakeLists.txt @@ -1,21 +1,18 @@ set(SOURCES + yagl_gles1_context.c + yagl_gles1_interface.c + yagl_gles1_validate.c yagl_gles1_calls.c - yagl_host_gles1_calls.c - ${YAGL_SOURCE_DIR}/GLES_common/yagl_gles_calls.c - ${YAGL_SOURCE_DIR}/GLES_common/yagl_gles_utils.c ) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${YAGL_SOURCE_DIR}/GLES_common) include_directories(.) - -set(HOST_GLES_CALLS_HEADER yagl_host_gles1_calls.h) -set(GLEXT_HEADER GLES/glext.h) -configure_file(${YAGL_SOURCE_DIR}/GLES_common/yagl_host_gles_calls.h.in ${CMAKE_CURRENT_BINARY_DIR}/yagl_host_gles_calls.h @ONLY) +link_directories(${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}) add_library(GLESv1_CM SHARED ${SOURCES}) set_target_properties(GLESv1_CM PROPERTIES VERSION 1.0 SOVERSION 1) -target_link_libraries(GLESv1_CM EGL) +target_link_libraries(GLESv1_CM "-Wl,-whole-archive" GLES_common "-Wl,-no-whole-archive" EGL) install( TARGETS GLESv1_CM diff --git a/GLESv1_CM/yagl_gles1_calls.c b/GLESv1_CM/yagl_gles1_calls.c index e2eee55..f044939 100644 --- a/GLESv1_CM/yagl_gles1_calls.c +++ b/GLESv1_CM/yagl_gles1_calls.c @@ -1,343 +1,751 @@ -#include "yagl_state.h" -#include "yagl_host_gles1_calls.h" +#include "GLES/gl.h" +#include "GLES/glext.h" +#include "yagl_gles_calls.h" +#include "yagl_host_gles_calls.h" +#include "yagl_gles1_validate.h" +#include "yagl_gles1_context.h" +#include "yagl_gles_array.h" +#include "yagl_gles_buffer.h" #include "yagl_impl.h" -#include "yagl_gles_context.h" #include "yagl_malloc.h" -#include "GLES/glext.h" +#include "yagl_transport.h" +#include "yagl_utils.h" #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include "yagl_gles_utils.h" +#include <assert.h> + +#define YAGL_SET_ERR(err) \ + yagl_gles_context_set_error(&ctx->base, err); \ + YAGL_LOG_ERROR("error = 0x%X", err) + +#define YAGL_GET_CTX_IMPL(ret_expr) \ + struct yagl_gles1_context *ctx = \ + (struct yagl_gles1_context*)yagl_get_client_context(); \ + if (!ctx || (ctx->base.base.client_api != yagl_client_api_gles1)) { \ + YAGL_LOG_WARN("no current context"); \ + YAGL_LOG_FUNC_EXIT(NULL); \ + ret_expr; \ + } -/* - * GLES1 has arrays of vertices, normals, colors, texture coordinates and - * point sizes. Every texture unit has its own texture coordinates array - */ -typedef enum { - YAGL_GLES1_ARRAY_VERTEX = 0, - YAGL_GLES1_ARRAY_COLOR, - YAGL_GLES1_ARRAY_NORMAL, - YAGL_GLES1_ARRAY_POINTSIZE, - YAGL_GLES1_ARRAY_TEX_COORD, -} YaglGles1ArrayType; +#define YAGL_GET_CTX_RET(ret) YAGL_GET_CTX_IMPL(return ret) -static inline int yagl_get_active_tex_index(void) -{ - return YAGL_GLES1_ARRAY_TEX_COORD + - yagl_get_integer(GL_CLIENT_ACTIVE_TEXTURE) - GL_TEXTURE0; -} +#define YAGL_GET_CTX() YAGL_GET_CTX_IMPL(return) -static unsigned yagl_gles1_array_idx_get(struct yagl_gles_context *ctx, - GLenum array) +static __inline int yagl_gles1_array_idx_get(struct yagl_gles1_context *ctx, + GLenum array, + unsigned *arr_idx_p) { - unsigned ret; - switch (array) { case GL_VERTEX_ARRAY: - ret = YAGL_GLES1_ARRAY_VERTEX; + *arr_idx_p = yagl_gles1_array_vertex; break; case GL_COLOR_ARRAY: - ret = YAGL_GLES1_ARRAY_COLOR; + *arr_idx_p = yagl_gles1_array_color; break; case GL_NORMAL_ARRAY: - ret = YAGL_GLES1_ARRAY_NORMAL; + *arr_idx_p = yagl_gles1_array_normal; break; case GL_TEXTURE_COORD_ARRAY: - ret = yagl_get_active_tex_index(); + *arr_idx_p = yagl_gles1_array_texcoord + ctx->client_active_texture; break; case GL_POINT_SIZE_ARRAY_OES: - ret = YAGL_GLES1_ARRAY_POINTSIZE; + *arr_idx_p = yagl_gles1_array_pointsize; break; default: - ret = -1; - break; + return 0; } - if (ret >= ctx->num_arrays) { - fprintf(stderr, "Error! Array with index %d doesn't exist at %s:%d\n", - ret, __func__, __LINE__); + return 1; +} + +/* + * TODO: Passthrough for now. + * @{ + */ + +YAGL_IMPLEMENT_API_NORET2(glAlphaFunc, GLenum, GLclampf, func, ref) +YAGL_IMPLEMENT_API_NORET3(glTexEnvf, GLenum, GLenum, GLfloat, target, pname, param) +YAGL_IMPLEMENT_API_NORET1(glMatrixMode, GLenum, mode) +YAGL_IMPLEMENT_API_NORET0(glLoadIdentity) +YAGL_IMPLEMENT_API_NORET0(glPopMatrix) +YAGL_IMPLEMENT_API_NORET0(glPushMatrix) +YAGL_IMPLEMENT_API_NORET4(glRotatef, GLfloat, GLfloat, GLfloat, GLfloat, angle, x, y, z) +YAGL_IMPLEMENT_API_NORET3(glTranslatef, GLfloat, GLfloat, GLfloat, x, y, z) +YAGL_IMPLEMENT_API_NORET3(glScalef, GLfloat, GLfloat, GLfloat, x, y, z) +YAGL_IMPLEMENT_API_NORET4(glColor4f, GLfloat, GLfloat, GLfloat, GLfloat, red, green, blue, alpha) +YAGL_IMPLEMENT_API_NORET4(glColor4ub, GLubyte, GLubyte, GLubyte, GLubyte, red, green, blue, alpha) +YAGL_IMPLEMENT_API_NORET3(glNormal3f, GLfloat, GLfloat, GLfloat, nx, ny, nz) +YAGL_IMPLEMENT_API_NORET1(glShadeModel, GLenum, mode) +YAGL_IMPLEMENT_API_NORET1(glLogicOp, GLenum, opcode) + +/* + * @} + */ + +YAGL_API void glAlphaFuncx(GLenum func, GLclampx ref) +{ + YAGL_LOG_FUNC_ENTER_SPLIT2(glAlphaFuncx, GLenum, GLclampx, func, ref); + + YAGL_GET_CTX(); + + yagl_host_glAlphaFunc(func, yagl_fixed_to_float(ref)); + + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glTexEnvi(GLenum target, GLenum pname, GLint param) +{ + YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnvi, GLenum, GLenum, GLint, target, pname, param); + + YAGL_GET_CTX(); + + if ((target != GL_TEXTURE_ENV) && (target != GL_POINT_SPRITE_OES)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; } - return ret; + yagl_host_glTexEnvi(target, pname, param); + +out: + YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_query_gles1_array(struct yagl_gles_array *arr, - YaglGles1ArrayType arr_type) +YAGL_API void glTexEnvx(GLenum target, GLenum pname, GLfixed param) { - GLenum name, buff_bind, stride, pointer; + GLfloat paramf; - switch (arr_type) { - case YAGL_GLES1_ARRAY_VERTEX: - name = GL_VERTEX_ARRAY; - buff_bind = GL_VERTEX_ARRAY_BUFFER_BINDING; - stride = GL_VERTEX_ARRAY_STRIDE; - pointer = GL_VERTEX_ARRAY_POINTER; - break; - case YAGL_GLES1_ARRAY_COLOR: - name = GL_COLOR_ARRAY; - buff_bind = GL_COLOR_ARRAY_BUFFER_BINDING; - stride = GL_COLOR_ARRAY_STRIDE; - pointer = GL_COLOR_ARRAY_POINTER; - break; - case YAGL_GLES1_ARRAY_NORMAL: - name = GL_NORMAL_ARRAY; - buff_bind = GL_NORMAL_ARRAY_BUFFER_BINDING; - stride = GL_NORMAL_ARRAY_STRIDE; - pointer = GL_NORMAL_ARRAY_POINTER; - break; - case YAGL_GLES1_ARRAY_POINTSIZE: - name = GL_POINT_SIZE_ARRAY_OES; - buff_bind = GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES; - stride = GL_POINT_SIZE_ARRAY_STRIDE_OES; - pointer = GL_POINT_SIZE_ARRAY_POINTER_OES; - break; - case YAGL_GLES1_ARRAY_TEX_COORD: - name = GL_TEXTURE_COORD_ARRAY; - buff_bind = GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING; - stride = GL_TEXTURE_COORD_ARRAY_STRIDE; - pointer = GL_TEXTURE_COORD_ARRAY_POINTER; - break; - default: - fprintf(stderr, "Programming error! Unknown array %d type at %s:%d\n", - arr_type, __func__, __LINE__); - exit(1); + YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnvx, GLenum, GLenum, GLfixed, target, pname, param); + + YAGL_GET_CTX(); + + if ((target != GL_TEXTURE_ENV) && (target != GL_POINT_SPRITE_OES)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; } - arr->enabled = yagl_get_integer(name); - arr->vbo = yagl_get_integer(buff_bind); - arr->stride = yagl_get_integer(stride); + if ((pname == GL_RGB_SCALE) || (pname == GL_ALPHA_SCALE)) { + paramf = yagl_fixed_to_float(param); + } else { + paramf = (GLfloat)param; + } + + yagl_host_glTexEnvf(target, pname, paramf); + +out: + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glRotatex(GLfixed angle, + GLfixed x, + GLfixed y, + GLfixed z) +{ + YAGL_LOG_FUNC_ENTER_SPLIT4(glRotatex, GLfixed, GLfixed, GLfixed, GLfixed, angle, x, y, z); + + YAGL_GET_CTX(); + + yagl_host_glRotatef(yagl_fixed_to_float(angle), + yagl_fixed_to_float(x), + yagl_fixed_to_float(y), + yagl_fixed_to_float(z)); + + YAGL_LOG_FUNC_EXIT(NULL); +} - if (!arr->vbo) { - yagl_host_glGetPointerv(pointer, &arr->ptr); +YAGL_API void glTranslatex(GLfixed x, + GLfixed y, + GLfixed z) +{ + YAGL_LOG_FUNC_ENTER_SPLIT3(glTranslatex, GLfixed, GLfixed, GLfixed, x, y, z); + + YAGL_GET_CTX(); + + yagl_host_glTranslatef(yagl_fixed_to_float(x), + yagl_fixed_to_float(y), + yagl_fixed_to_float(z)); + + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glScalex(GLfixed x, + GLfixed y, + GLfixed z) +{ + YAGL_LOG_FUNC_ENTER_SPLIT3(glScalex, GLfixed, GLfixed, GLfixed, x, y, z); + + YAGL_GET_CTX(); + + yagl_host_glScalef(yagl_fixed_to_float(x), + yagl_fixed_to_float(y), + yagl_fixed_to_float(z)); + + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glOrthof(GLfloat left, + GLfloat right, + GLfloat bottom, + GLfloat top, + GLfloat zNear, + GLfloat zFar) +{ + YAGL_LOG_FUNC_ENTER_SPLIT6(glOrthof, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, left, right, bottom, top, zNear, zFar); + + YAGL_GET_CTX(); + + if ((left == right) || (bottom == top) || (zNear == zFar)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } else { + yagl_host_glOrthof(left, right, bottom, top, zNear, zFar); } + + YAGL_LOG_FUNC_EXIT(NULL); } -static inline void yagl_set_client_active_texture(GLenum tex) +YAGL_API void glOrthox(GLfixed left, + GLfixed right, + GLfixed bottom, + GLfixed top, + GLfixed zNear, + GLfixed zFar) { - yagl_host_glClientActiveTexture(tex); + YAGL_LOG_FUNC_ENTER_SPLIT6(glOrthox, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, left, right, bottom, top, zNear, zFar); + + YAGL_GET_CTX(); + + if ((left == right) || (bottom == top) || (zNear == zFar)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } else { + yagl_host_glOrthof(yagl_fixed_to_float(left), + yagl_fixed_to_float(right), + yagl_fixed_to_float(bottom), + yagl_fixed_to_float(top), + yagl_fixed_to_float(zNear), + yagl_fixed_to_float(zFar)); + } + + YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_query_texture_arrays(struct yagl_gles_array *arrays, - int num_texture_units) +YAGL_API void glPointSize(GLfloat size) { - GLint cur_text; - int i; + YAGL_LOG_FUNC_ENTER_SPLIT1(glPointSize, GLfloat, size); - cur_text = yagl_get_integer(GL_CLIENT_ACTIVE_TEXTURE); + YAGL_GET_CTX(); - for (i = 0; i < num_texture_units; ++i) { - yagl_set_client_active_texture(GL_TEXTURE0 + i); - yagl_query_gles1_array(&arrays[i], YAGL_GLES1_ARRAY_TEX_COORD); + if (size <= 0) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } else { + yagl_host_glPointSize(size); } - yagl_set_client_active_texture(cur_text); + YAGL_LOG_FUNC_EXIT(NULL); } -void yagl_update_arrays(void) +YAGL_API void glPointSizex(GLfixed size) { - struct yagl_gles_context *ctx = yagl_gles_context_get(); - int i; - int num_texture_units; + GLfloat sizef; + + YAGL_LOG_FUNC_ENTER_SPLIT1(glPointSizex, GLfixed, size); + + YAGL_GET_CTX(); - if (!ctx || ctx->arrays) { - return; + sizef = yagl_fixed_to_float(size); + + if (sizef <= 0) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } else { + yagl_host_glPointSize(sizef); } - num_texture_units = yagl_get_integer(GL_MAX_TEXTURE_UNITS); + YAGL_LOG_FUNC_EXIT(NULL); +} - ctx->num_arrays = YAGL_GLES1_ARRAY_TEX_COORD + num_texture_units; +YAGL_API void glLineWidthx(GLfixed width) +{ + GLfloat widthf; - ctx->arrays = yagl_malloc0(sizeof(*ctx->arrays) * ctx->num_arrays); + YAGL_LOG_FUNC_ENTER_SPLIT1(glLineWidthx, GLfixed, width); - for (i = YAGL_GLES1_ARRAY_VERTEX; i < YAGL_GLES1_ARRAY_TEX_COORD; ++i) { - yagl_query_gles1_array(&ctx->arrays[i], i); + YAGL_GET_CTX(); + + widthf = yagl_fixed_to_float(width); + + if (widthf <= 0) { + YAGL_SET_ERR(GL_INVALID_VALUE); + goto out; } - yagl_query_texture_arrays(&ctx->arrays[YAGL_GLES1_ARRAY_TEX_COORD], - num_texture_units); + yagl_gles_context_line_width(&ctx->base, widthf); + +out: + YAGL_LOG_FUNC_EXIT(NULL); } -static void yagl_set_array_pointer(GLenum array_type, - GLint size, - GLenum type, - GLsizei stride, - const GLvoid* pointer) +YAGL_API void glTexParameterx(GLenum target, + GLenum pname, + GLfixed param) { - struct yagl_gles_context *ctx = yagl_gles_context_get(); - int el_size = 0; - unsigned arr_idx; + YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameterx, GLenum, GLenum, GLfixed, target, pname, param); + + YAGL_GET_CTX(); + + if (target != GL_TEXTURE_2D) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + yagl_gles_context_tex_parameterf(&ctx->base, target, pname, (GLfloat)param); + +out: + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glColor4x(GLfixed red, + GLfixed green, + GLfixed blue, + GLfixed alpha) +{ + YAGL_LOG_FUNC_ENTER_SPLIT4(glColor4x, GLfixed, GLfixed, GLfixed, GLfixed, red, green, blue, alpha); + + YAGL_GET_CTX(); + + yagl_host_glColor4f(yagl_fixed_to_float(red), + yagl_fixed_to_float(green), + yagl_fixed_to_float(blue), + yagl_fixed_to_float(alpha)); - if (ctx && ctx->arrays && yagl_get_el_size(type, &el_size)) { - arr_idx = yagl_gles1_array_idx_get(ctx, array_type); - yagl_update_vbo(); - ctx->arrays[arr_idx].vbo = 0; - ctx->arrays[arr_idx].stride = 0; - ctx->arrays[arr_idx].ptr = NULL; - if (ctx->vbo) { - ctx->arrays[arr_idx].vbo = ctx->vbo; + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glNormal3x(GLfixed nx, + GLfixed ny, + GLfixed nz) +{ + YAGL_LOG_FUNC_ENTER_SPLIT3(glNormal3x, GLfixed, GLfixed, GLfixed, nx, ny, nz); + + YAGL_GET_CTX(); + + yagl_host_glNormal3f(yagl_fixed_to_float(nx), + yagl_fixed_to_float(ny), + yagl_fixed_to_float(nz)); + + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glClearColorx(GLclampx red, + GLclampx green, + GLclampx blue, + GLclampx alpha) +{ + YAGL_LOG_FUNC_ENTER_SPLIT4(glClearColorx, GLclampx, GLclampx, GLclampx, GLclampx, red, green, blue, alpha); + + YAGL_GET_CTX(); + + yagl_gles_context_clear_color(&ctx->base, + yagl_fixed_to_float(red), + yagl_fixed_to_float(green), + yagl_fixed_to_float(blue), + yagl_fixed_to_float(alpha)); + + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glClearDepthx(GLclampx depth) +{ + YAGL_LOG_FUNC_ENTER_SPLIT1(glClearDepthx, GLclampx, depth); + + YAGL_GET_CTX(); + + yagl_gles_context_clear_depthf(&ctx->base, yagl_fixed_to_float(depth)); + + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glMultiTexCoord4f(GLenum target, + GLfloat s, + GLfloat t, + GLfloat r, + GLfloat q) +{ + YAGL_LOG_FUNC_ENTER_SPLIT5(glMultiTexCoord4f, GLenum, GLfloat, GLfloat, GLfloat, GLfloat, target, s, t, r, q); + + YAGL_GET_CTX(); + + if (target >= GL_TEXTURE0 && + target < (GL_TEXTURE0 + ctx->base.num_texture_units)) { + yagl_host_glMultiTexCoord4f(target, s, t, r, q); + } + + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glMultiTexCoord4x(GLenum target, + GLfixed s, + GLfixed t, + GLfixed r, + GLfixed q) +{ + YAGL_LOG_FUNC_ENTER_SPLIT5(glMultiTexCoord4x, GLenum, GLfixed, GLfixed, GLfixed, GLfixed, target, s, t, r, q); + + YAGL_GET_CTX(); + + if (target >= GL_TEXTURE0 && + target < (GL_TEXTURE0 + ctx->base.num_texture_units)) { + yagl_host_glMultiTexCoord4f(target, + yagl_fixed_to_float(s), + yagl_fixed_to_float(t), + yagl_fixed_to_float(r), + yagl_fixed_to_float(q)); + } + + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glPointParameterf(GLenum pname, + GLfloat param) +{ + YAGL_LOG_FUNC_ENTER_SPLIT2(glPointParameterf, GLenum, GLfloat, pname, param); + + YAGL_GET_CTX(); + + if (pname != GL_POINT_SIZE_MIN && pname != GL_POINT_SIZE_MIN && + pname != GL_POINT_SIZE_MAX && pname != GL_POINT_FADE_THRESHOLD_SIZE) { + YAGL_SET_ERR(GL_INVALID_ENUM); + } else { + yagl_host_glPointParameterf(pname, param); + } + + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glPointParameterx(GLenum pname, + GLfixed param) +{ + YAGL_LOG_FUNC_ENTER_SPLIT2(glPointParameterx, GLenum, GLfixed, pname, param); + + YAGL_GET_CTX(); + + if (pname != GL_POINT_SIZE_MIN && pname != GL_POINT_SIZE_MIN && + pname != GL_POINT_SIZE_MAX && pname != GL_POINT_FADE_THRESHOLD_SIZE) { + YAGL_SET_ERR(GL_INVALID_ENUM); + } else { + yagl_host_glPointParameterf(pname, yagl_fixed_to_float(param)); + } + + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glFogf(GLenum pname, GLfloat param) +{ + YAGL_LOG_FUNC_ENTER_SPLIT2(glFogf, GLenum, GLfloat, pname, param); + + YAGL_GET_CTX(); + + if (pname != GL_FOG_MODE && pname != GL_FOG_DENSITY && + pname != GL_FOG_START && pname != GL_FOG_END) { + YAGL_SET_ERR(GL_INVALID_ENUM); + } else { + yagl_host_glFogf(pname, param); + } + + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glFogx(GLenum pname, GLfixed param) +{ + YAGL_LOG_FUNC_ENTER_SPLIT2(glFogx, GLenum, GLfixed, pname, param); + + YAGL_GET_CTX(); + + if (pname != GL_FOG_MODE && pname != GL_FOG_DENSITY && + pname != GL_FOG_START && pname != GL_FOG_END) { + YAGL_SET_ERR(GL_INVALID_ENUM); + } else { + if (pname == GL_FOG_MODE) { + yagl_host_glFogf(pname, (GLfloat)param); } else { - if (stride) { - ctx->arrays[arr_idx].stride = stride; - } else { - ctx->arrays[arr_idx].stride = size * el_size; - } - ctx->arrays[arr_idx].ptr = (GLvoid *)pointer; + yagl_host_glFogf(pname, yagl_fixed_to_float(param)); } } + + YAGL_LOG_FUNC_EXIT(NULL); } -static inline unsigned yagl_get_light_param_len(GLenum pname) +YAGL_API void glFrustumf(GLfloat left, + GLfloat right, + GLfloat bottom, + GLfloat top, + GLfloat zNear, + GLfloat zFar) { - switch (pname) { - case GL_AMBIENT: - case GL_DIFFUSE: - case GL_SPECULAR: - case GL_POSITION: - return 4; - case GL_SPOT_DIRECTION: - return 3; - case GL_SPOT_EXPONENT: - case GL_SPOT_CUTOFF: - case GL_CONSTANT_ATTENUATION: - case GL_LINEAR_ATTENUATION: - case GL_QUADRATIC_ATTENUATION: - return 1; - default: - return 0; + YAGL_LOG_FUNC_ENTER_SPLIT6(glFrustumf, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, left, right, bottom, top, zNear, zFar); + + YAGL_GET_CTX(); + + if (zNear <= 0 || zFar <= 0 || left == right || + bottom == top || zNear == zFar) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } else { + yagl_host_glFrustumf(left, right, bottom, top, zNear, zFar); } + + YAGL_LOG_FUNC_EXIT(NULL); } -static inline unsigned yagl_get_material_param_len(GLenum pname) +YAGL_API void glFrustumx(GLfixed left, + GLfixed right, + GLfixed bottom, + GLfixed top, + GLfixed zNear, + GLfixed zFar) { - switch (pname) { - case GL_AMBIENT: - case GL_DIFFUSE: - case GL_SPECULAR: - case GL_EMISSION: - case GL_AMBIENT_AND_DIFFUSE: - return 4; - case GL_SHININESS: - return 1; - default: - return 0; + YAGL_LOG_FUNC_ENTER_SPLIT6(glFrustumx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, left, right, bottom, top, zNear, zFar); + + YAGL_GET_CTX(); + + if (zNear <= 0 || zFar <= 0 ||left == right || + bottom == top || zNear == zFar) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } else { + yagl_host_glFrustumf(yagl_fixed_to_float(left), + yagl_fixed_to_float(right), + yagl_fixed_to_float(bottom), + yagl_fixed_to_float(top), + yagl_fixed_to_float(zNear), + yagl_fixed_to_float(zFar)); } + + YAGL_LOG_FUNC_EXIT(NULL); } -static inline unsigned yagl_get_texenv_param_len(GLenum pname) +YAGL_API void glLightf(GLenum light, + GLenum pname, + GLfloat param) { - if (pname == GL_TEXTURE_ENV_COLOR) { - return 4; + YAGL_LOG_FUNC_ENTER_SPLIT3(glLightf, GLenum, GLenum, GLfloat, light, pname, param); + + YAGL_GET_CTX(); + + if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + } else { + yagl_host_glLightf(light, pname, param); } - return 1; + YAGL_LOG_FUNC_EXIT(NULL); } -static inline unsigned yagl_get_point_param_len(GLenum pname) +YAGL_API void glLightx(GLenum light, + GLenum pname, + GLfixed param) { - if (pname == GL_POINT_DISTANCE_ATTENUATION) { - return 3; + YAGL_LOG_FUNC_ENTER_SPLIT3(glLightx, GLenum, GLenum, GLfixed, light, pname, param); + + YAGL_GET_CTX(); + + if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + } else { + yagl_host_glLightf(light, pname, yagl_fixed_to_float(param)); } - return 1; + YAGL_LOG_FUNC_EXIT(NULL); } -static inline unsigned yagl_get_fog_param_len(GLenum pname) +YAGL_API void glLightModelf(GLenum pname, GLfloat param) { - if (pname == GL_FOG_COLOR) { - return 4; + YAGL_LOG_FUNC_ENTER_SPLIT2(glLightModelf, GLenum, GLfloat, pname, param); + + YAGL_GET_CTX(); + + if (pname != GL_LIGHT_MODEL_TWO_SIDE) { + YAGL_SET_ERR(GL_INVALID_ENUM); + } else { + yagl_host_glLightModelf(pname, param); } - return 1; + YAGL_LOG_FUNC_EXIT(NULL); } -static inline unsigned yagl_get_light_model_param_len(GLenum pname) +YAGL_API void glLightModelx(GLenum pname, + GLfixed param) { - if (pname == GL_LIGHT_MODEL_AMBIENT) { - return 4; + YAGL_LOG_FUNC_ENTER_SPLIT2(glLightModelx, GLenum, GLfixed, pname, param); + + YAGL_GET_CTX(); + + if (pname != GL_LIGHT_MODEL_TWO_SIDE) { + YAGL_SET_ERR(GL_INVALID_ENUM); + } else { + yagl_host_glLightModelf(pname, (GLfloat)param); } - return 1; + YAGL_LOG_FUNC_EXIT(NULL); } -YAGL_IMPLEMENT_API_NORET2(glAlphaFunc, GLenum, GLclampf, func, ref) -YAGL_IMPLEMENT_API_NORET2(glAlphaFuncx, GLenum, GLclampx, func, ref) -YAGL_IMPLEMENT_API_NORET3(glTexEnvi, GLenum, GLenum, GLint, target, pname, param) -YAGL_IMPLEMENT_API_NORET3(glTexEnvf, GLenum, GLenum, GLfloat, target, pname, param) -YAGL_IMPLEMENT_API_NORET3(glTexEnvx, GLenum, GLenum, GLfixed, target, pname, param) -YAGL_IMPLEMENT_API_NORET1(glMatrixMode, GLenum, mode) -YAGL_IMPLEMENT_API_NORET0(glLoadIdentity) -YAGL_IMPLEMENT_API_NORET0(glPopMatrix) -YAGL_IMPLEMENT_API_NORET0(glPushMatrix) -YAGL_IMPLEMENT_API_NORET4(glRotatef, GLfloat, GLfloat, GLfloat, GLfloat, angle, x, y, z) -YAGL_IMPLEMENT_API_NORET4(glRotatex, GLfixed, GLfixed, GLfixed, GLfixed, angle, x, y, z) -YAGL_IMPLEMENT_API_NORET3(glTranslatef, GLfloat, GLfloat, GLfloat, x, y, z) -YAGL_IMPLEMENT_API_NORET3(glTranslatex, GLfixed, GLfixed, GLfixed, x, y, z) -YAGL_IMPLEMENT_API_NORET3(glScalef, GLfloat, GLfloat, GLfloat, x, y, z) -YAGL_IMPLEMENT_API_NORET3(glScalex, GLfixed, GLfixed, GLfixed, x, y, z) -YAGL_IMPLEMENT_API_NORET6(glOrthof, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, left, right, bottom, top, zNear, zFar) -YAGL_IMPLEMENT_API_NORET6(glOrthox, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, left, right, bottom, top, zNear, zFar) -YAGL_IMPLEMENT_API_NORET1(glPointSize, GLfloat, size) -YAGL_IMPLEMENT_API_NORET1(glPointSizex, GLfixed, size) -YAGL_IMPLEMENT_API_NORET1(glLineWidthx, GLfixed, width) -YAGL_IMPLEMENT_API_NORET3(glTexParameterx, GLenum, GLenum, GLfixed, target, pname, param) -YAGL_IMPLEMENT_API_NORET4(glColor4f, GLfloat, GLfloat, GLfloat, GLfloat, red, green, blue, alpha) -YAGL_IMPLEMENT_API_NORET4(glColor4ub, GLubyte, GLubyte, GLubyte, GLubyte, red, green, blue, alpha) -YAGL_IMPLEMENT_API_NORET4(glColor4x, GLfixed, GLfixed, GLfixed, GLfixed, red, green, blue, alpha) -YAGL_IMPLEMENT_API_NORET3(glNormal3f, GLfloat, GLfloat, GLfloat, nx, ny, nz) -YAGL_IMPLEMENT_API_NORET3(glNormal3x, GLfixed, GLfixed, GLfixed, nx, ny, nz) -YAGL_IMPLEMENT_API_NORET4(glClearColorx, GLclampx, GLclampx, GLclampx, GLclampx, red, green, blue, alpha) -YAGL_IMPLEMENT_API_NORET1(glClearDepthx, GLclampx, depth) -YAGL_IMPLEMENT_API_NORET5(glMultiTexCoord4f, GLenum, GLfloat, GLfloat, GLfloat, GLfloat, target, s, t, r, q) -YAGL_IMPLEMENT_API_NORET5(glMultiTexCoord4x, GLenum, GLfixed, GLfixed, GLfixed, GLfixed, target, s, t, r, q) -YAGL_IMPLEMENT_API_NORET2(glPointParameterf, GLenum, GLfloat, pname, param) -YAGL_IMPLEMENT_API_NORET2(glPointParameterx, GLenum, GLfixed, pname, param) -YAGL_IMPLEMENT_API_NORET2(glFogf, GLenum, GLfloat, pname, param) -YAGL_IMPLEMENT_API_NORET2(glFogx, GLenum, GLfixed, pname, param) -YAGL_IMPLEMENT_API_NORET6(glFrustumf, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, left, right, bottom, top, zNear, zFar) -YAGL_IMPLEMENT_API_NORET6(glFrustumx, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, left, right, bottom, top, zNear, zFar) -YAGL_IMPLEMENT_API_NORET3(glLightf, GLenum, GLenum, GLfloat, light, pname, param) -YAGL_IMPLEMENT_API_NORET3(glLightx, GLenum, GLenum, GLfixed, light, pname, param) -YAGL_IMPLEMENT_API_NORET2(glLightModelf, GLenum, GLfloat, pname, param) -YAGL_IMPLEMENT_API_NORET2(glLightModelx, GLenum, GLfixed, pname, param) -YAGL_IMPLEMENT_API_NORET3(glMaterialf, GLenum, GLenum, GLfloat, face, pname, param) -YAGL_IMPLEMENT_API_NORET3(glMaterialx, GLenum, GLenum, GLfixed, face, pname, param) -YAGL_IMPLEMENT_API_NORET1(glShadeModel, GLenum, mode) -YAGL_IMPLEMENT_API_NORET2(glSampleCoveragex, GLclampx, GLboolean, value, invert) -YAGL_IMPLEMENT_API_NORET2(glDepthRangex, GLclampx, GLclampx, zNear, zFar) -YAGL_IMPLEMENT_API_NORET1(glLogicOp, GLenum, opcode) -YAGL_IMPLEMENT_API_NORET2(glPolygonOffsetx, GLfixed, GLfixed, factor, units) +YAGL_API void glMaterialf(GLenum face, + GLenum pname, + GLfloat param) +{ + YAGL_LOG_FUNC_ENTER_SPLIT3(glMaterialf, GLenum, GLenum, GLfloat, face, pname, param); + + YAGL_GET_CTX(); + + if (face != GL_FRONT_AND_BACK) { + YAGL_SET_ERR(GL_INVALID_ENUM); + } else { + yagl_host_glMaterialf(face, pname, param); + } + + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glMaterialx(GLenum face, + GLenum pname, + GLfixed param) +{ + YAGL_LOG_FUNC_ENTER_SPLIT3(glMaterialx, GLenum, GLenum, GLfixed, face, pname, param); + + YAGL_GET_CTX(); + + if (face != GL_FRONT_AND_BACK) { + YAGL_SET_ERR(GL_INVALID_ENUM); + } else { + yagl_host_glMaterialf(face, pname, yagl_fixed_to_float(param)); + } + + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glSampleCoveragex(GLclampx value, + GLboolean invert) +{ + YAGL_LOG_FUNC_ENTER_SPLIT2(glSampleCoveragex, GLclampx, GLboolean, value, invert); + + YAGL_GET_CTX(); + + yagl_gles_context_sample_coverage(&ctx->base, + yagl_fixed_to_float(value), + invert); + + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glDepthRangex(GLclampx zNear, GLclampx zFar) +{ + YAGL_LOG_FUNC_ENTER_SPLIT2(glDepthRangex, GLclampx, GLclampx, zNear, zFar); + + YAGL_GET_CTX(); + + yagl_gles_context_depth_rangef(&ctx->base, + yagl_fixed_to_float(zNear), + yagl_fixed_to_float(zFar)); + + YAGL_LOG_FUNC_EXIT(NULL); +} + +YAGL_API void glPolygonOffsetx(GLfixed factor, GLfixed units) +{ + YAGL_LOG_FUNC_ENTER_SPLIT2(glPolygonOffsetx, GLfixed, GLfixed, factor, units); + + YAGL_GET_CTX(); + + yagl_gles_context_polygon_offset(&ctx->base, + yagl_fixed_to_float(factor), + yagl_fixed_to_float(units)); + + YAGL_LOG_FUNC_EXIT(NULL); +} YAGL_API void glTexEnviv(GLenum target, GLenum pname, const GLint *params) { - unsigned count = yagl_get_texenv_param_len(pname); + int count = 0; YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnviv, GLenum, GLenum, const GLint*, target, pname, params); + YAGL_GET_CTX(); + + if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + if (!yagl_gles1_get_texenv_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + yagl_host_glTexEnviv(target, pname, params, count); +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params) { - unsigned count = yagl_get_texenv_param_len(pname); + int count = 0; YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnvfv, GLenum, GLenum, const GLfloat *, target, pname, params); + YAGL_GET_CTX(); + + if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + if (!yagl_gles1_get_texenv_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + yagl_host_glTexEnvfv(target, pname, params, count); +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params) { - unsigned count = yagl_get_texenv_param_len(pname); + GLfloat paramsf[100]; // This fits all cases. + int i, count = 0; YAGL_LOG_FUNC_ENTER_SPLIT3(glTexEnvxv, GLenum, GLenum, const GLfixed *, target, pname, params); - yagl_host_glTexEnvxv(target, pname, params, count); + YAGL_GET_CTX(); + + if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + if (!yagl_gles1_get_texenv_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + if (params) { + if ((pname == GL_TEXTURE_ENV_COLOR) || + (pname == GL_RGB_SCALE) || + (pname == GL_ALPHA_SCALE)) { + for (i = 0; i < count; ++i) { + paramsf[i] = yagl_fixed_to_float(params[i]); + } + } else { + for (i = 0; i < count; ++i) { + paramsf[i] = (GLfloat)params[i]; + } + } + + yagl_host_glTexEnvfv(target, pname, paramsf, count); + } else { + yagl_host_glTexEnvfv(target, pname, NULL, 0); + } + +out: YAGL_LOG_FUNC_EXIT(NULL); } @@ -345,53 +753,86 @@ YAGL_API void glClientActiveTexture(GLenum texture) { YAGL_LOG_FUNC_ENTER_SPLIT1(glClientActiveTexture, GLenum, texture); + YAGL_GET_CTX(); + + if ((texture < GL_TEXTURE0) || + (texture >= (GL_TEXTURE0 + ctx->base.num_texture_units))) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + ctx->client_active_texture = texture - GL_TEXTURE0; + yagl_host_glClientActiveTexture(texture); +out: YAGL_LOG_FUNC_EXIT(NULL); } -YAGL_API void glDisableClientState(GLenum array) +YAGL_API void glDisableClientState(GLenum array_name) { - struct yagl_gles_context *ctx; + unsigned arr_idx; + struct yagl_gles_array *array; - YAGL_LOG_FUNC_ENTER_SPLIT1(glDisableClientState, GLenum, array); + YAGL_LOG_FUNC_ENTER_SPLIT1(glDisableClientState, GLenum, array_name); - ctx = yagl_gles_context_get(); + YAGL_GET_CTX(); - if (ctx && ctx->arrays) { - ctx->arrays[yagl_gles1_array_idx_get(ctx, array)].enabled = 0; + if (!yagl_gles1_array_idx_get(ctx, array_name, &arr_idx)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; } - yagl_host_glDisableClientState(array); + array = &ctx->base.arrays[arr_idx]; + + yagl_gles_array_enable(array, 0); + + if (array_name != GL_POINT_SIZE_ARRAY_OES) { + yagl_host_glDisableClientState(array_name); + } +out: YAGL_LOG_FUNC_EXIT(NULL); } -YAGL_API void glEnableClientState(GLenum array) +YAGL_API void glEnableClientState(GLenum array_name) { - struct yagl_gles_context *ctx; + unsigned arr_idx; + struct yagl_gles_array *array; - YAGL_LOG_FUNC_ENTER_SPLIT1(glEnableClientState, GLenum, array); + YAGL_LOG_FUNC_ENTER_SPLIT1(glEnableClientState, GLenum, array_name); - ctx = yagl_gles_context_get(); + YAGL_GET_CTX(); - if (ctx && ctx->arrays) { - ctx->arrays[yagl_gles1_array_idx_get(ctx, array)].enabled = 1; + if (!yagl_gles1_array_idx_get(ctx, array_name, &arr_idx)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; } - yagl_host_glEnableClientState(array); + array = &ctx->base.arrays[arr_idx]; + + yagl_gles_array_enable(array, 1); + + if (array_name != GL_POINT_SIZE_ARRAY_OES) { + yagl_host_glEnableClientState(array_name); + } +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API const GLubyte* glGetString(GLenum name) { - struct yagl_gles_context *ctx; + struct yagl_gles1_context *ctx; const char *str = NULL; - YAGL_LOG_FUNC_ENTER(glGetString, "name = %d", name); + YAGL_LOG_FUNC_ENTER(glGetString, "name = 0x%X", name); - ctx = yagl_gles_context_get(); + ctx = (struct yagl_gles1_context*)yagl_get_client_context(); + + if (!ctx || (ctx->base.base.client_api != yagl_client_api_gles1)) { + ctx = NULL; + } switch (name) { case GL_VENDOR: @@ -405,139 +846,430 @@ YAGL_API const GLubyte* glGetString(GLenum name) break; case GL_EXTENSIONS: if (ctx) { - if (!ctx->extensions) { - int32_t size = 0; - yagl_host_glGetExtensionStringYAGL(NULL, 0, &size); - ctx->extensions = yagl_malloc0(size); - yagl_host_glGetExtensionStringYAGL(ctx->extensions, size, NULL); - } - str = ctx->extensions; + str = yagl_gles_context_get_extensions(&ctx->base); } else { str = ""; } break; default: str = ""; - break; } - YAGL_LOG_FUNC_EXIT(NULL); + YAGL_LOG_FUNC_EXIT("%s", str); return (const GLubyte*)str; } YAGL_API void glGetTexEnviv(GLenum target, GLenum pname, GLint *params) { - unsigned count = yagl_get_texenv_param_len(pname); + int count = 0; YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexEnviv, GLenum, GLenum, GLint *, target, pname, params); + YAGL_GET_CTX(); + + if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + if (!yagl_gles1_get_texenv_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + yagl_host_glGetTexEnviv(target, pname, params, count, NULL); +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glGetTexEnvfv(GLenum target, GLenum pname, GLfloat *params) { - unsigned count = yagl_get_texenv_param_len(pname); + int count = 0; YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexEnvfv, GLenum, GLenum, GLfloat *, target, pname, params); + YAGL_GET_CTX(); + + if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + if (!yagl_gles1_get_texenv_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + yagl_host_glGetTexEnvfv(target, pname, params, count, NULL); +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glGetTexEnvxv(GLenum target, GLenum pname, GLfixed *params) { - unsigned count = yagl_get_texenv_param_len(pname); + int i, count = 0; + GLfloat paramsf[100]; // This fits all cases. YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexEnvxv, GLenum, GLenum, GLint *, target, pname, params); - yagl_host_glGetTexEnvxv(target, pname, params, count, NULL); + YAGL_GET_CTX(); + + if (target != GL_TEXTURE_ENV && target != GL_POINT_SPRITE_OES) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + if (!yagl_gles1_get_texenv_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + yagl_host_glGetTexEnvfv(target, pname, paramsf, count, NULL); + if (params) { + if ((pname == GL_TEXTURE_ENV_COLOR) || + (pname == GL_RGB_SCALE) || + (pname == GL_ALPHA_SCALE)) { + for (i = 0; i < count; ++i) { + params[i] = yagl_float_to_fixed(paramsf[i]); + } + } else { + for (i = 0; i < count; ++i) { + params[i] = (GLfixed)paramsf[i]; + } + } + } + +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glGetPointerv(GLenum pname, GLvoid** pointer) { + struct yagl_gles_array *array = NULL; + YAGL_LOG_FUNC_ENTER_SPLIT2(glGetPointerv, GLenum, GLvoid**, pname, pointer); - yagl_host_glGetPointerv(pname, pointer); + YAGL_GET_CTX(); + switch (pname) { + case GL_VERTEX_ARRAY_POINTER: + array = &ctx->base.arrays[yagl_gles1_array_vertex]; + break; + case GL_COLOR_ARRAY_POINTER: + array = &ctx->base.arrays[yagl_gles1_array_color]; + break; + case GL_NORMAL_ARRAY_POINTER: + array = &ctx->base.arrays[yagl_gles1_array_normal]; + break; + case GL_TEXTURE_COORD_ARRAY_POINTER: + array = &ctx->base.arrays[yagl_gles1_array_texcoord + ctx->client_active_texture]; + break; + case GL_POINT_SIZE_ARRAY_POINTER_OES: + array = &ctx->base.arrays[yagl_gles1_array_pointsize]; + break; + default: + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + if (pointer) { + if (array->vbo) { + *pointer = (GLvoid*)array->offset; + } else { + *pointer = (GLvoid*)array->ptr; + } + } + +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glNormalPointer(GLenum type, GLsizei stride, const GLvoid* pointer) { + struct yagl_gles_array *array; + YAGL_LOG_FUNC_ENTER_SPLIT3(glNormalPointer, GLenum, GLsizei, const GLvoid*, type, stride, pointer); - yagl_set_array_pointer(GL_NORMAL_ARRAY, 3, type, stride, pointer); + YAGL_GET_CTX(); + + if (stride < 0) { + YAGL_SET_ERR(GL_INVALID_VALUE); + goto out; + } - yagl_host_glNormalPointer(type, stride, pointer); + if (type != GL_FLOAT && type != GL_FIXED && + type != GL_SHORT && type != GL_BYTE) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + array = &ctx->base.arrays[yagl_gles1_array_normal]; + + if (ctx->base.vbo) { + if (!yagl_gles_array_update_vbo(array, + 3, + type, + type == GL_FIXED, + GL_FALSE, + stride, + ctx->base.vbo, + (GLint)pointer)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } + } else { + if (!yagl_gles_array_update(array, + 3, + type, + type == GL_FIXED, + GL_FALSE, + stride, + pointer)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } + } + +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) { + struct yagl_gles_array *array; + YAGL_LOG_FUNC_ENTER_SPLIT4(glVertexPointer, GLint, GLenum, GLsizei, const GLvoid*, size, type, stride, pointer); - yagl_set_array_pointer(GL_VERTEX_ARRAY, size, type, stride, pointer); + YAGL_GET_CTX(); + + if ((size < 2) || (size > 4) || (stride < 0)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + goto out; + } + + if (type != GL_FLOAT && type != GL_FIXED && + type != GL_SHORT && type != GL_BYTE) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } - yagl_host_glVertexPointer(size, type, stride, pointer); + array = &ctx->base.arrays[yagl_gles1_array_vertex]; + + if (ctx->base.vbo) { + if (!yagl_gles_array_update_vbo(array, + size, + type, + type == GL_FIXED || type == GL_BYTE, + GL_FALSE, + stride, + ctx->base.vbo, + (GLint)pointer)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } + } else { + if (!yagl_gles_array_update(array, + size, + type, + type == GL_FIXED || type == GL_BYTE, + GL_FALSE, + stride, + pointer)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } + } +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) { + struct yagl_gles_array *array; + YAGL_LOG_FUNC_ENTER_SPLIT4(glColorPointer, GLint, GLenum, GLsizei, const GLvoid*, size, type, stride, pointer); - yagl_set_array_pointer(GL_COLOR_ARRAY, size, type, stride, pointer); + YAGL_GET_CTX(); + + if (size != 4 || stride < 0) { + YAGL_SET_ERR(GL_INVALID_VALUE); + goto out; + } - yagl_host_glColorPointer(size, type, stride, pointer); + if (type != GL_FLOAT && type != GL_FIXED && type != GL_UNSIGNED_BYTE) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + array = &ctx->base.arrays[yagl_gles1_array_color]; + + if (ctx->base.vbo) { + if (!yagl_gles_array_update_vbo(array, + size, + type, + type == GL_FIXED, + GL_FALSE, + stride, + ctx->base.vbo, + (GLint)pointer)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } + } else { + if (!yagl_gles_array_update(array, + size, + type, + type == GL_FIXED, + GL_FALSE, + stride, + pointer)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } + } + +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) { + struct yagl_gles_array *array; + YAGL_LOG_FUNC_ENTER_SPLIT4(glTexCoordPointer, GLint, GLenum, GLsizei, const GLvoid*, size, type, stride, pointer); - yagl_set_array_pointer(GL_TEXTURE_COORD_ARRAY, size, type, stride, pointer); + YAGL_GET_CTX(); + + if ((size < 2) || (size > 4) || (stride < 0)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + goto out; + } + + if (type != GL_FLOAT && type != GL_FIXED && + type != GL_SHORT && type != GL_BYTE) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } - yagl_host_glTexCoordPointer(size, type, stride, pointer); + array = &ctx->base.arrays[yagl_gles1_array_texcoord + ctx->client_active_texture]; + + if (ctx->base.vbo) { + if (!yagl_gles_array_update_vbo(array, + size, + type, + type == GL_FIXED || type == GL_BYTE, + GL_FALSE, + stride, + ctx->base.vbo, + (GLint)pointer)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } + } else { + if (!yagl_gles_array_update(array, + size, + type, + type == GL_FIXED || type == GL_BYTE, + GL_FALSE, + stride, + pointer)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } + } +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid* pointer) { + struct yagl_gles_array *array; + YAGL_LOG_FUNC_ENTER_SPLIT3(glPointSizePointerOES, GLenum, GLsizei, const GLvoid*, type, stride, pointer); - yagl_set_array_pointer(GL_POINT_SIZE_ARRAY_OES, 1, type, stride, pointer); + YAGL_GET_CTX(); + + if (stride < 0) { + YAGL_SET_ERR(GL_INVALID_VALUE); + goto out; + } + + if (type != GL_FLOAT && type != GL_FIXED) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } - yagl_host_glPointSizePointerOES(type, stride, pointer); + array = &ctx->base.arrays[yagl_gles1_array_pointsize]; + + if (ctx->base.vbo) { + if (!yagl_gles_array_update_vbo(array, + 1, + type, + type == GL_FIXED, + GL_FALSE, + stride, + ctx->base.vbo, + (GLint)pointer)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } + } else { + if (!yagl_gles_array_update(array, + 1, + type, + type == GL_FIXED, + GL_FALSE, + stride, + pointer)) { + YAGL_SET_ERR(GL_INVALID_VALUE); + } + } +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params) { + GLfloat paramf; + YAGL_LOG_FUNC_ENTER_SPLIT3(glTexParameterxv, GLenum, GLenum, const GLfixed*, target, pname, params); - yagl_host_glTexParameterxv(target, pname, params, 1); + YAGL_GET_CTX(); + + if (target != GL_TEXTURE_2D) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + if (params) { + paramf = (GLfloat)params[0]; + yagl_gles_context_tex_parameterfv(&ctx->base, target, pname, ¶mf); + } else { + yagl_gles_context_tex_parameterfv(&ctx->base, target, pname, NULL); + } +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params) { + GLfloat paramf; + YAGL_LOG_FUNC_ENTER_SPLIT3(glGetTexParameterxv, GLenum, GLenum, GLfixed*, target, pname, params); - yagl_host_glGetTexParameterxv(target, pname, params); + YAGL_GET_CTX(); + + if (target != GL_TEXTURE_2D) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + yagl_gles_context_get_tex_parameterfv(&ctx->base, target, pname, ¶mf); + if (params) { + *params = (GLfixed)paramf; + } + +out: YAGL_LOG_FUNC_EXIT(NULL); } @@ -550,8 +1282,22 @@ YAGL_API void glMultMatrixf(const GLfloat* m) YAGL_API void glMultMatrixx(const GLfixed* m) { + GLfloat tmp[16]; + int i; + YAGL_LOG_FUNC_ENTER_SPLIT1(glMultMatrixx, const GLfixed*, m); - yagl_host_glMultMatrixx(m, 16); + + YAGL_GET_CTX(); + + if (m) { + for (i = 0; i < 16; ++i) { + tmp[i] = yagl_fixed_to_float(m[i]); + } + yagl_host_glMultMatrixf(tmp, 16); + } else { + yagl_host_glMultMatrixf(NULL, 16); + } + YAGL_LOG_FUNC_EXIT(NULL); } @@ -564,52 +1310,120 @@ YAGL_API void glLoadMatrixf(const GLfloat* m) YAGL_API void glLoadMatrixx(const GLfixed* m) { + GLfloat tmp[16]; + int i; + YAGL_LOG_FUNC_ENTER_SPLIT1(glLoadMatrixx, const GLfixed*, m); - yagl_host_glLoadMatrixx(m, 16); + + YAGL_GET_CTX(); + + if (m) { + for (i = 0; i < 16; ++i) { + tmp[i] = yagl_fixed_to_float(m[i]); + } + yagl_host_glLoadMatrixf(tmp, 16); + } else { + yagl_host_glLoadMatrixf(NULL, 16); + } + YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glPointParameterfv(GLenum pname, const GLfloat *params) { - unsigned count = yagl_get_point_param_len(pname); + int count = 0; YAGL_LOG_FUNC_ENTER_SPLIT2(glPointParameterfv, GLenum, const GLfloat *, pname, params); + YAGL_GET_CTX(); + + if (!yagl_gles1_get_point_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + yagl_host_glPointParameterfv(pname, params, count); +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glPointParameterxv(GLenum pname, const GLfixed *params) { - unsigned count = yagl_get_point_param_len(pname); + GLfloat paramsf[100]; // This fits all cases. + int i, count = 0; YAGL_LOG_FUNC_ENTER_SPLIT2(glPointParameterxv, GLenum, const GLfixed *, pname, params); - yagl_host_glPointParameterxv(pname, params, count); + YAGL_GET_CTX(); + + if (!yagl_gles1_get_point_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + if (params) { + for (i = 0; i < count; ++i) { + paramsf[i] = yagl_fixed_to_float(params[i]); + } + yagl_host_glPointParameterfv(pname, paramsf, count); + } else { + yagl_host_glPointParameterfv(pname, NULL, count); + } +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glFogfv(GLenum pname, const GLfloat *params) { - unsigned count = yagl_get_fog_param_len(pname); + int count = 0; YAGL_LOG_FUNC_ENTER_SPLIT2(glFogfv, GLenum, const GLfloat *, pname, params); + YAGL_GET_CTX(); + + if (!yagl_gles1_get_fog_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + yagl_host_glFogfv(pname, params, count); +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glFogxv(GLenum pname, const GLfixed *params) { - unsigned count = yagl_get_fog_param_len(pname); + GLfloat paramsf[100]; // This fits all cases. + int i, count = 0; YAGL_LOG_FUNC_ENTER_SPLIT2(glFogxv, GLenum, const GLfixed *, pname, params); - yagl_host_glFogxv(pname, params, count); + YAGL_GET_CTX(); + + if (!yagl_gles1_get_fog_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + if (params) { + if (pname == GL_FOG_MODE) { + for (i = 0; i < count; ++i) { + paramsf[i] = (GLfloat)params[i]; + } + } else { + for (i = 0; i < count; ++i) { + paramsf[i] = yagl_fixed_to_float(params[i]); + } + } + yagl_host_glFogfv(pname, paramsf, count); + } else { + yagl_host_glFogfv(pname, NULL, count); + } + +out: YAGL_LOG_FUNC_EXIT(NULL); } @@ -617,17 +1431,43 @@ YAGL_API void glClipPlanef(GLenum plane, const GLfloat *equation) { YAGL_LOG_FUNC_ENTER_SPLIT2(glClipPlanef, GLenum, const GLfloat *, plane, equation); + YAGL_GET_CTX(); + + if (plane < GL_CLIP_PLANE0 || plane >= (GL_CLIP_PLANE0 + ctx->max_clip_planes)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + yagl_host_glClipPlanef(plane, equation, 4); +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glClipPlanex(GLenum plane, const GLfixed *equation) { + GLfloat equationf[4]; + int i; + YAGL_LOG_FUNC_ENTER_SPLIT2(glClipPlanex, GLenum, const GLfixed *, plane, equation); - yagl_host_glClipPlanex(plane, equation, 4); + YAGL_GET_CTX(); + if (plane < GL_CLIP_PLANE0 || plane >= (GL_CLIP_PLANE0 + ctx->max_clip_planes)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + if (equation) { + for (i = 0; i < 4; ++i) { + equationf[i] = yagl_fixed_to_float(equation[i]); + } + yagl_host_glClipPlanef(plane, equationf, 4); + } else { + yagl_host_glClipPlanef(plane, NULL, 4); + } + +out: YAGL_LOG_FUNC_EXIT(NULL); } @@ -635,156 +1475,313 @@ YAGL_API void glGetClipPlanef(GLenum pname, GLfloat *eqn) { YAGL_LOG_FUNC_ENTER_SPLIT2(glGetClipPlanef, GLenum, GLfloat*, pname, eqn); + YAGL_GET_CTX(); + + if (pname < GL_CLIP_PLANE0 || pname >= (GL_CLIP_PLANE0 + ctx->max_clip_planes)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + yagl_host_glGetClipPlanef(pname, eqn, 4, NULL); +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glGetClipPlanex(GLenum pname, GLfixed *eqn) { + GLfloat equationf[4]; + int i; + YAGL_LOG_FUNC_ENTER_SPLIT2(glGetClipPlanex, GLenum, GLfixed*, pname, eqn); - yagl_host_glGetClipPlanex(pname, eqn, 4, NULL); + YAGL_GET_CTX(); + + if (pname < GL_CLIP_PLANE0 || + pname >= (GL_CLIP_PLANE0 + ctx->max_clip_planes)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + yagl_host_glGetClipPlanef(pname, equationf, 4, NULL); + + if (eqn) { + for (i = 0; i < 4; ++i) { + eqn[i] = yagl_float_to_fixed(equationf[i]); + } + } +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glLightfv(GLenum light, GLenum pname, const GLfloat *params) { - unsigned count; + int count = 0; YAGL_LOG_FUNC_ENTER_SPLIT3(glLightfv, GLenum, GLenum, const GLfloat *, light, pname, params); - count = yagl_get_light_param_len(pname); + YAGL_GET_CTX(); + + if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights) || + !yagl_gles1_get_light_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } yagl_host_glLightfv(light, pname, params, count); +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glLightxv(GLenum light, GLenum pname, const GLfixed *params) { - unsigned count; + GLfloat paramsf[100]; // This fits all cases. + int i, count = 0; YAGL_LOG_FUNC_ENTER_SPLIT3(glLightxv, GLenum, GLenum, const GLfixed *, light, pname, params); - count = yagl_get_light_param_len(pname); + YAGL_GET_CTX(); + + if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights) || + !yagl_gles1_get_light_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } - yagl_host_glLightxv(light, pname, params, count); + if (params) { + for (i = 0; i < count; ++i) { + paramsf[i] = yagl_fixed_to_float(params[i]); + } + yagl_host_glLightfv(light, pname, paramsf, count); + } else { + yagl_host_glLightfv(light, pname, NULL, count); + } +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glLightModelfv(GLenum pname, const GLfloat *params) { - unsigned count = yagl_get_light_model_param_len(pname); + int count = 0; YAGL_LOG_FUNC_ENTER_SPLIT2(glLightModelfv, GLenum, const GLfloat *, pname, params); + YAGL_GET_CTX(); + + if (!yagl_gles1_get_light_model_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + yagl_host_glLightModelfv(pname, params, count); +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glLightModelxv(GLenum pname, const GLfixed *params) { - unsigned count = yagl_get_light_model_param_len(pname); + GLfloat paramsf[100]; // This fits all cases. + int i, count = 0; YAGL_LOG_FUNC_ENTER_SPLIT2(glLightModelxv, GLenum, const GLfixed *, pname, params); - yagl_host_glLightModelxv(pname, params, count); + YAGL_GET_CTX(); + if (!yagl_gles1_get_light_model_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + if (params) { + if (pname == GL_LIGHT_MODEL_TWO_SIDE) { + for (i = 0; i < count; ++i) { + paramsf[i] = (GLfloat)(params[i]); + } + } else { + for (i = 0; i < count; ++i) { + paramsf[i] = yagl_fixed_to_float(params[i]); + } + } + yagl_host_glLightModelfv(pname, paramsf, count); + } else { + yagl_host_glLightModelfv(pname, NULL, count); + } + +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glGetLightfv(GLenum light, GLenum pname, GLfloat *params) { - unsigned count; + int count = 0; YAGL_LOG_FUNC_ENTER_SPLIT3(glGetLightfv, GLenum, GLenum, GLfloat*, light, pname, params); - count = yagl_get_light_param_len(pname); + YAGL_GET_CTX(); + + if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights) || + !yagl_gles1_get_light_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } yagl_host_glGetLightfv(light, pname, params, count, NULL); +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glGetLightxv(GLenum light, GLenum pname, GLfixed *params) { - unsigned count; + GLfloat paramsf[100]; // This fits all cases. + int i, count = 0; YAGL_LOG_FUNC_ENTER_SPLIT3(glGetLightxv, GLenum, GLenum, GLfixed*, light, pname, params); - count = yagl_get_light_param_len(pname); + YAGL_GET_CTX(); - yagl_host_glGetLightxv(light, pname, params, count, NULL); + if (light < GL_LIGHT0 || light >= (GL_LIGHT0 + ctx->max_lights) || + !yagl_gles1_get_light_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + yagl_host_glGetLightfv(light, pname, paramsf, count, NULL); + if (params) { + for (i = 0; i < count; ++i) { + params[i] = yagl_float_to_fixed(paramsf[i]); + } + } + +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params) { - unsigned count; + int count = 0; YAGL_LOG_FUNC_ENTER_SPLIT3(glMaterialfv, GLenum, GLenum, const GLfloat *, face, pname, params); - count = yagl_get_material_param_len(pname); + YAGL_GET_CTX(); + + if (face != GL_FRONT_AND_BACK || + !yagl_gles1_get_material_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } yagl_host_glMaterialfv(face, pname, params, count); +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glMaterialxv(GLenum face, GLenum pname, const GLfixed *params) { - unsigned count; + GLfloat paramsf[100]; // This fits all cases. + int i, count = 0; YAGL_LOG_FUNC_ENTER_SPLIT3(glMaterialxv, GLenum, GLenum, const GLfixed *, face, pname, params); - count = yagl_get_material_param_len(pname); + YAGL_GET_CTX(); - yagl_host_glMaterialxv(face, pname, params, count); + if (face != GL_FRONT_AND_BACK || + !yagl_gles1_get_material_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } + + if (params) { + for (i = 0; i < count; ++i) { + paramsf[i] = yagl_fixed_to_float(params[i]); + } + yagl_host_glMaterialfv(face, pname, paramsf, count); + } else { + yagl_host_glMaterialfv(face, pname, NULL, count); + } +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params) { - unsigned count; + int count = 0; YAGL_LOG_FUNC_ENTER_SPLIT3(glGetMaterialfv, GLenum, GLenum, GLfloat*, face, pname, params); - count = yagl_get_material_param_len(pname); + YAGL_GET_CTX(); + + if (!yagl_gles1_get_material_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } yagl_host_glGetMaterialfv(face, pname, params, count, NULL); +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glGetMaterialxv(GLenum light, GLenum pname, GLfixed *params) { - unsigned count; + GLfloat paramsf[100]; // This fits all cases. + int i, count = 0; YAGL_LOG_FUNC_ENTER_SPLIT3(glGetMaterialxv, GLenum, GLenum, GLfixed*, light, pname, params); - count = yagl_get_material_param_len(pname); + YAGL_GET_CTX(); + + if (!yagl_gles1_get_material_param_count(pname, &count)) { + YAGL_SET_ERR(GL_INVALID_ENUM); + goto out; + } - yagl_host_glGetMaterialxv(light, pname, params, count, NULL); + yagl_host_glGetMaterialfv(light, pname, paramsf, count, NULL); + if (params) { + for (i = 0; i < count; ++i) { + params[i] = yagl_float_to_fixed(paramsf[i]); + } + } + +out: YAGL_LOG_FUNC_EXIT(NULL); } YAGL_API void glGetFixedv(GLenum pname, GLfixed* params) { - GLfixed tmp[100]; // This fits all cases. - int32_t num = 0; + GLfloat floats[100]; // This fits all cases. + uint32_t i, num = 0; + int needs_map; YAGL_LOG_FUNC_ENTER_SPLIT2(glGetFixedv, GLenum, GLfixed*, pname, params); - yagl_host_glGetFixedv(pname, tmp, sizeof(tmp)/sizeof(tmp[0]), &num); + + YAGL_GET_CTX(); + + if (!yagl_gles_context_get_floatv(&ctx->base, pname, floats, &num, &needs_map)) { + GLint ints[100]; // This fits all cases. + if (yagl_gles_context_get_integerv(&ctx->base, pname, ints, &num)) { + for (i = 0; i < num; ++i) { + floats[i] = ints[i]; + } + } else { + YAGL_SET_ERR(GL_INVALID_ENUM); + } + } + if (params) { - memcpy(params, tmp, num * sizeof(tmp[0])); + for (i = 0; i < num; ++i) { + params[i] = yagl_float_to_fixed(floats[i]); + } } + YAGL_LOG_FUNC_EXIT(NULL); } @@ -792,139 +1789,96 @@ YAGL_API void glGetFixedv(GLenum pname, GLfixed* params) YAGL_API GLboolean glIsRenderbufferOES(GLuint renderbuffer) { - GLboolean tmp; - - YAGL_LOG_FUNC_ENTER_SPLIT1(glIsRenderbufferOES, GLuint, renderbuffer); - tmp = yagl_host_glIsRenderbuffer(renderbuffer); - YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, tmp); - - return tmp; + return glIsRenderbuffer(renderbuffer); } YAGL_API void glBindRenderbufferOES(GLenum target, GLuint renderbuffer) { - YAGL_LOG_FUNC_ENTER_SPLIT2(glBindRenderbufferOES, GLenum, GLuint, target, renderbuffer); - yagl_host_glBindRenderbuffer(target, renderbuffer); - YAGL_LOG_FUNC_EXIT(NULL); + glBindRenderbuffer(target, renderbuffer); } YAGL_API void glDeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers) { - YAGL_LOG_FUNC_ENTER_SPLIT2(glDeleteRenderbuffersOES, GLsizei, const GLuint*, n, renderbuffers); - yagl_host_glDeleteRenderbuffers(renderbuffers, n); - YAGL_LOG_FUNC_EXIT(NULL); + glDeleteRenderbuffers(n, renderbuffers); } YAGL_API void glGenRenderbuffersOES(GLsizei n, GLuint* renderbuffers) { - YAGL_LOG_FUNC_ENTER_SPLIT2(glGenRenderbuffersOES, GLsizei, GLuint*, n, renderbuffers); - yagl_host_glGenRenderbuffers(renderbuffers, n, NULL); - YAGL_LOG_FUNC_EXIT(NULL); + glGenRenderbuffers(n, renderbuffers); } YAGL_API void glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { - YAGL_LOG_FUNC_ENTER_SPLIT4(glRenderbufferStorageOES, GLenum, GLenum, GLsizei, GLsizei, target, internalformat, width, height); - yagl_host_glRenderbufferStorage(target, internalformat, width, height); - YAGL_LOG_FUNC_EXIT(NULL); + glRenderbufferStorage(target, internalformat, width, height); } YAGL_API void glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params) { - YAGL_LOG_FUNC_ENTER_SPLIT3(glGetRenderbufferParameterivOES, GLenum, GLenum, GLint*, target, pname, params); - yagl_host_glGetRenderbufferParameteriv(target, pname, params); - YAGL_LOG_FUNC_EXIT(NULL); + glGetRenderbufferParameteriv(target, pname, params); } YAGL_API GLboolean glIsFramebufferOES(GLuint framebuffer) { - GLboolean tmp; - - YAGL_LOG_FUNC_ENTER_SPLIT1(glIsFramebufferOES, GLuint, framebuffer); - tmp = yagl_host_glIsFramebuffer(framebuffer); - YAGL_LOG_FUNC_EXIT_SPLIT(GLboolean, tmp); - - return tmp; + return glIsFramebuffer(framebuffer); } YAGL_API void glBindFramebufferOES(GLenum target, GLuint framebuffer) { - YAGL_LOG_FUNC_ENTER_SPLIT2(glBindFramebufferOES, GLenum, GLuint, target, framebuffer); - yagl_host_glBindFramebuffer(target, framebuffer); - YAGL_LOG_FUNC_EXIT(NULL); + glBindFramebuffer(target, framebuffer); } YAGL_API void glDeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers) { - YAGL_LOG_FUNC_ENTER_SPLIT2(glDeleteFramebuffersOES, GLsizei, const GLuint*, n, framebuffers); - yagl_host_glDeleteFramebuffers(framebuffers, n); - YAGL_LOG_FUNC_EXIT(NULL); + glDeleteFramebuffers(n, framebuffers); } YAGL_API void glGenFramebuffersOES(GLsizei n, GLuint* framebuffers) { - YAGL_LOG_FUNC_ENTER_SPLIT2(glGenFramebuffersOES, GLsizei, GLuint*, n, framebuffers); - yagl_host_glGenFramebuffers(framebuffers, n, NULL); - YAGL_LOG_FUNC_EXIT(NULL); + glGenFramebuffers(n, framebuffers); } YAGL_API GLenum glCheckFramebufferStatusOES(GLenum target) { - GLenum tmp; - YAGL_LOG_FUNC_ENTER_SPLIT1(glCheckFramebufferStatusOES, GLenum, target); - tmp = yagl_host_glCheckFramebufferStatus(target); - YAGL_LOG_FUNC_EXIT_SPLIT(GLenum, tmp); - return tmp; + return glCheckFramebufferStatus(target); } YAGL_API void glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { - YAGL_LOG_FUNC_ENTER_SPLIT5(glFramebufferTexture2DOES, GLenum, GLenum, GLenum, GLuint, GLint, target, attachment, textarget, texture, level); - yagl_host_glFramebufferTexture2D(target, attachment, textarget, texture, level); - YAGL_LOG_FUNC_EXIT(NULL); + glFramebufferTexture2D(target, attachment, textarget, texture, level); } YAGL_API void glFramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) { - YAGL_LOG_FUNC_ENTER_SPLIT4(glFramebufferRenderbufferOES, GLenum, GLenum, GLenum, GLuint, target, attachment, renderbuffertarget, renderbuffer); - yagl_host_glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); - YAGL_LOG_FUNC_EXIT(NULL); + glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); } YAGL_API void glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint* params) { - YAGL_LOG_FUNC_ENTER_SPLIT4(glGetFramebufferAttachmentParameterivOES, GLenum, GLenum, GLenum, GLint*, target, attachment, pname, params); - yagl_host_glGetFramebufferAttachmentParameteriv(target, attachment, pname, params); - YAGL_LOG_FUNC_EXIT(NULL); + glGetFramebufferAttachmentParameteriv(target, attachment, pname, params); } YAGL_API void glGenerateMipmapOES(GLenum target) { - YAGL_LOG_FUNC_ENTER_SPLIT1(glGenerateMipmapOES, GLenum, target); - yagl_host_glGenerateMipmap(target); - YAGL_LOG_FUNC_EXIT(NULL); + glGenerateMipmap(target); } /* GL_OES_blend_subtract */ + YAGL_API void glBlendEquationOES(GLenum mode) { - YAGL_LOG_FUNC_ENTER_SPLIT1(glBlendEquationOES, GLenum, mode); - yagl_host_glBlendEquation(mode); - YAGL_LOG_FUNC_EXIT(NULL); + glBlendEquation(mode); } /* GL_OES_blend_equation_separate */ + YAGL_API void glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha) { - YAGL_LOG_FUNC_ENTER_SPLIT2(glBlendEquationSeparateOES, GLenum, GLenum, modeRGB, modeAlpha); - yagl_host_glBlendEquationSeparate(modeRGB, modeAlpha); - YAGL_LOG_FUNC_EXIT(NULL); + glBlendEquationSeparate(modeRGB, modeAlpha); } /* GL_OES_blend_func_separate */ + YAGL_API void glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { - YAGL_LOG_FUNC_ENTER_SPLIT4(glBlendFuncSeparateOES, GLenum, GLenum, GLenum, GLenum, srcRGB, dstRGB, srcAlpha, dstAlpha); - yagl_host_glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); - YAGL_LOG_FUNC_EXIT(NULL); + glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); } diff --git a/GLESv1_CM/yagl_gles1_calls.in b/GLESv1_CM/yagl_gles1_calls.in deleted file mode 100644 index a461177..0000000 --- a/GLESv1_CM/yagl_gles1_calls.in +++ /dev/null @@ -1,93 +0,0 @@ -# -# Available only in Common profile -# -void glAlphaFunc(GLenum func, GLclampf ref) -void glClipPlanef(GLenum plane, const GLfloat *equation) -void glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) -void glFogf(GLenum pname, GLfloat param) -void glFogfv(GLenum pname, const GLfloat *params) -void glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) -void glGetClipPlanef(GLenum pname, GLfloat *eqn) -void glGetLightfv(GLenum light, GLenum pname, GLfloat *params) -void glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params) -void glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params) -void glLightModelf(GLenum pname, GLfloat param) -void glLightModelfv(GLenum pname, const GLfloat *params) -void glLightf(GLenum light, GLenum pname, GLfloat param) -void glLightfv(GLenum light, GLenum pname, const GLfloat *params) -void glLoadMatrixf(const GLfloat *m) -void glMaterialf(GLenum face, GLenum pname, GLfloat param) -void glMaterialfv(GLenum face, GLenum pname, const GLfloat *params) -void glMultMatrixf(const GLfloat *m) -void glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat tt, GLfloat r, GLfloat q) -void glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) -void glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) -void glPointParameterf(GLenum pname, GLfloat param) -void glPointParameterfv(GLenum pname, const GLfloat *params) -void glPointSize(GLfloat size) -void glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid ^pointer) -void glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) -void glScalef(GLfloat x, GLfloat y, GLfloat z) -void glTexEnvf(GLenum target, GLenum pname, GLfloat param) -void glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params) -void glTranslatef(GLfloat x, GLfloat y, GLfloat z) -# -# Available in both Common and Common-Lite profiles -# -void glAlphaFuncx(GLenum func, GLclampx ref) -void glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) -void glClearDepthx(GLclampx depth) -void glClientActiveTexture(GLenum texture) -void glClipPlanex(GLenum plane, const GLfixed *equation) -void glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) -void glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) -void glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid ^pointer) -void glDepthRangex(GLclampx zNear, GLclampx zFar) -void glDisableClientState(GLenum array) -void glEnableClientState(GLenum array) -void glFogx(GLenum pname, GLfixed param) -void glFogxv(GLenum pname, const GLfixed *params) -void glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) -void glGetClipPlanex(GLenum pname, GLfixed *eqn) -void glGetFixedv(GLenum pname, GLfixed *params) -void glGetLightxv(GLenum light, GLenum pname, GLfixed *params) -void glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params) -void glGetPointerv(GLenum pname, GLvoid ^¶ms) -void glGetTexEnviv(GLenum env, GLenum pname, GLint *params) -void glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params) -void glGetTexParameterxv(GLenum target, GLenum pname, GLfixed ¶m) -void glLightModelx(GLenum pname, GLfixed param) -void glLightModelxv(GLenum pname, const GLfixed *params) -void glLightx(GLenum light, GLenum pname, GLfixed param) -void glLightxv(GLenum light, GLenum pname, const GLfixed *params) -void glLineWidthx(GLfixed width) -void glLoadIdentity() -void glLoadMatrixx(const GLfixed *m) -void glLogicOp(GLenum opcode) -void glMaterialx(GLenum face, GLenum pname, GLfixed param) -void glMaterialxv(GLenum face, GLenum pname, const GLfixed *params) -void glMatrixMode(GLenum mode) -void glMultMatrixx(const GLfixed *m) -void glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed tt, GLfixed r, GLfixed q) -void glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz) -void glNormalPointer(GLenum type, GLsizei stride, const GLvoid ^pointer) -void glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) -void glPointParameterx(GLenum pname, GLfixed param) -void glPointParameterxv(GLenum pname, const GLfixed *params) -void glPointSizex(GLfixed size) -void glPolygonOffsetx(GLfixed factor, GLfixed units) -void glPopMatrix() -void glPushMatrix() -void glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) -void glSampleCoveragex(GLclampx value, GLboolean invert) -void glScalex(GLfixed x, GLfixed y, GLfixed z) -void glShadeModel(GLenum mode) -void glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid ^pointer) -void glTexEnvi(GLenum target, GLenum pname, GLint param) -void glTexEnvx(GLenum target, GLenum pname, GLfixed param) -void glTexEnviv(GLenum target, GLenum pname, const GLint *params) -void glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params) -void glTexParameterx(GLenum target, GLenum pname, GLfixed param) -void glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params) -void glTranslatex(GLfixed x, GLfixed y, GLfixed z) -void glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid ^pointer) diff --git a/GLESv1_CM/yagl_gles1_context.c b/GLESv1_CM/yagl_gles1_context.c new file mode 100644 index 0000000..d6dc98b --- /dev/null +++ b/GLESv1_CM/yagl_gles1_context.c @@ -0,0 +1,1209 @@ +#include "GLES/gl.h" +#include "GLES/glext.h" +#include "yagl_gles1_context.h" +#include "yagl_gles_array.h" +#include "yagl_gles_buffer.h" +#include "yagl_gles_texture.h" +#include "yagl_gles_texture_unit.h" +#include "yagl_log.h" +#include "yagl_malloc.h" +#include "yagl_utils.h" +#include "yagl_host_gles_calls.h" +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <assert.h> + +#define YAGL_GLES1_NUM_COMP_TEX_FORMATS 10 + +static void yagl_gles1_compressed_texture_formats_fill(GLint *params) +{ + params[0] = GL_PALETTE4_RGB8_OES; + params[1] = GL_PALETTE4_RGBA8_OES; + params[2] = GL_PALETTE4_R5_G6_B5_OES; + params[3] = GL_PALETTE4_RGBA4_OES; + params[4] = GL_PALETTE4_RGB5_A1_OES; + params[5] = GL_PALETTE8_RGB8_OES; + params[6] = GL_PALETTE8_RGBA8_OES; + params[7] = GL_PALETTE8_R5_G6_B5_OES; + params[8] = GL_PALETTE8_RGBA4_OES; + params[9] = GL_PALETTE8_RGB5_A1_OES; +} + +static void yagl_gles1_vertex_array_apply(struct yagl_gles_array *array, + uint32_t first, + uint32_t count, + const GLvoid *ptr, + void *user_data) +{ + if (array->vbo) { + yagl_host_glVertexPointerOffset(array->size, + array->actual_type, + array->actual_stride, + array->actual_offset); + } else { + yagl_host_glVertexPointerData(array->size, + array->actual_type, + array->actual_stride, + first, + ptr + (first * array->actual_stride), + count * array->actual_stride); + } +} + +static void yagl_gles1_normal_array_apply(struct yagl_gles_array *array, + uint32_t first, + uint32_t count, + const GLvoid *ptr, + void *user_data) +{ + if (array->vbo) { + yagl_host_glNormalPointerOffset(array->actual_type, + array->actual_stride, + array->actual_offset); + } else { + yagl_host_glNormalPointerData(array->actual_type, + array->actual_stride, + first, + ptr + (first * array->actual_stride), + count * array->actual_stride); + } +} + +static void yagl_gles1_color_array_apply(struct yagl_gles_array *array, + uint32_t first, + uint32_t count, + const GLvoid *ptr, + void *user_data) +{ + if (array->vbo) { + yagl_host_glColorPointerOffset(array->size, + array->actual_type, + array->actual_stride, + array->actual_offset); + } else { + yagl_host_glColorPointerData(array->size, + array->actual_type, + array->actual_stride, + first, + ptr + (first * array->actual_stride), + count * array->actual_stride); + } +} + +static void yagl_gles1_texcoord_array_apply(struct yagl_gles_array *array, + uint32_t first, + uint32_t count, + const GLvoid *ptr, + void *user_data) +{ + struct yagl_gles1_context *gles1_ctx = user_data; + int tex_id = array->index - yagl_gles1_array_texcoord; + + if (tex_id != gles1_ctx->client_active_texture) { + yagl_host_glClientActiveTexture(tex_id + GL_TEXTURE0); + } + + if (array->vbo) { + yagl_host_glTexCoordPointerOffset(array->size, + array->actual_type, + array->actual_stride, + array->actual_offset); + } else { + yagl_host_glTexCoordPointerData(tex_id, + array->size, + array->actual_type, + array->actual_stride, + first, + ptr + (first * array->actual_stride), + count * array->actual_stride); + } + + if (tex_id != gles1_ctx->client_active_texture) { + yagl_host_glClientActiveTexture(gles1_ctx->client_active_texture + + GL_TEXTURE0); + } +} + +static void yagl_gles1_pointsize_array_apply(struct yagl_gles_array *array, + uint32_t first, + uint32_t count, + const GLvoid *ptr, + void *user_data) +{ +} + +static unsigned yagl_gles1_array_idx_from_pname(struct yagl_gles1_context *ctx, + GLenum pname) +{ + switch (pname) { + case GL_VERTEX_ARRAY: + case GL_VERTEX_ARRAY_BUFFER_BINDING: + case GL_VERTEX_ARRAY_SIZE: + case GL_VERTEX_ARRAY_STRIDE: + case GL_VERTEX_ARRAY_TYPE: + return yagl_gles1_array_vertex; + case GL_COLOR_ARRAY: + case GL_COLOR_ARRAY_BUFFER_BINDING: + case GL_COLOR_ARRAY_SIZE: + case GL_COLOR_ARRAY_STRIDE: + case GL_COLOR_ARRAY_TYPE: + return yagl_gles1_array_color; + case GL_NORMAL_ARRAY: + case GL_NORMAL_ARRAY_BUFFER_BINDING: + case GL_NORMAL_ARRAY_STRIDE: + case GL_NORMAL_ARRAY_TYPE: + return yagl_gles1_array_normal; + case GL_TEXTURE_COORD_ARRAY: + case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING: + case GL_TEXTURE_COORD_ARRAY_SIZE: + case GL_TEXTURE_COORD_ARRAY_STRIDE: + case GL_TEXTURE_COORD_ARRAY_TYPE: + return yagl_gles1_array_texcoord + ctx->client_active_texture; + case GL_POINT_SIZE_ARRAY_TYPE_OES: + case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: + case GL_POINT_SIZE_ARRAY_OES: + case GL_POINT_SIZE_ARRAY_STRIDE_OES: + return yagl_gles1_array_pointsize; + default: + fprintf(stderr, "Critical error! Bad array name!\n"); + exit(1); + } +} + +static void yagl_gles1_context_prepare(struct yagl_client_context *ctx) +{ + struct yagl_gles1_context *gles1_ctx = (struct yagl_gles1_context*)ctx; + GLint i, num_texture_units = 0; + struct yagl_gles_array *arrays; + int32_t size = 0; + char *extensions; + int num_arrays; + + YAGL_LOG_FUNC_ENTER(yagl_gles1_context_prepare, "%p", ctx); + + yagl_host_glGetIntegerv(GL_MAX_TEXTURE_UNITS, + &num_texture_units, 1, NULL); + + /* + * We limit this by 32 for conformance. + */ + if (num_texture_units > 32) { + num_texture_units = 32; + } + + /* Each texture unit has its own client-side array state */ + num_arrays = yagl_gles1_array_texcoord + num_texture_units; + + arrays = yagl_malloc(num_arrays * sizeof(*arrays)); + + yagl_gles_array_init(&arrays[yagl_gles1_array_vertex], + yagl_gles1_array_vertex, + &yagl_gles1_vertex_array_apply, + gles1_ctx); + + yagl_gles_array_init(&arrays[yagl_gles1_array_color], + yagl_gles1_array_color, + &yagl_gles1_color_array_apply, + gles1_ctx); + + yagl_gles_array_init(&arrays[yagl_gles1_array_normal], + yagl_gles1_array_normal, + &yagl_gles1_normal_array_apply, + gles1_ctx); + + yagl_gles_array_init(&arrays[yagl_gles1_array_pointsize], + yagl_gles1_array_pointsize, + &yagl_gles1_pointsize_array_apply, + gles1_ctx); + + for (i = yagl_gles1_array_texcoord; i < num_arrays; ++i) { + yagl_gles_array_init(&arrays[i], + i, + &yagl_gles1_texcoord_array_apply, + gles1_ctx); + } + + yagl_gles_context_prepare(&gles1_ctx->base, arrays, num_arrays, + num_texture_units); + + yagl_host_glGetIntegerv(GL_MAX_CLIP_PLANES, + &gles1_ctx->max_clip_planes, + 1, NULL); + + if (gles1_ctx->max_clip_planes < 6) { + YAGL_LOG_WARN("host GL_MAX_CLIP_PLANES=%d is less then required 6", + gles1_ctx->max_clip_planes); + } else { + /* According to OpenGLES 1.1 docs on khronos website we only need + * to support 6 planes. This will protect us from bogus + * GL_MAX_CLIP_PLANES value reported by some drivers */ + gles1_ctx->max_clip_planes = 6; + } + + yagl_host_glGetIntegerv(GL_MAX_LIGHTS, &gles1_ctx->max_lights, 1, NULL); + + yagl_host_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gles1_ctx->max_tex_size, 1, NULL); + + yagl_host_glGetString(GL_EXTENSIONS, NULL, 0, &size); + extensions = yagl_malloc0(size); + yagl_host_glGetString(GL_EXTENSIONS, extensions, size, NULL); + + gles1_ctx->matrix_palette = + (strstr(extensions, "GL_ARB_vertex_blend ") != NULL) && + (strstr(extensions, "GL_ARB_matrix_palette ") != NULL); + + yagl_free(extensions); + + YAGL_LOG_FUNC_EXIT(NULL); +} + +static void yagl_gles1_context_destroy(struct yagl_client_context *ctx) +{ + struct yagl_gles1_context *gles1_ctx = (struct yagl_gles1_context*)ctx; + + YAGL_LOG_FUNC_ENTER(yagl_gles1_context_destroy, "%p", ctx); + + yagl_gles_context_cleanup(&gles1_ctx->base); + + yagl_free(gles1_ctx); + + YAGL_LOG_FUNC_EXIT(NULL); +} + +static GLchar *yagl_gles1_context_get_extensions(struct yagl_gles_context *ctx) +{ + struct yagl_gles1_context *gles1_ctx = (struct yagl_gles1_context*)ctx; + + const GLchar *default_ext = + "GL_OES_blend_subtract GL_OES_blend_equation_separate " + "GL_OES_blend_func_separate GL_OES_element_index_uint " + "GL_OES_texture_mirrored_repeat " + "GL_EXT_texture_format_BGRA8888 GL_OES_point_sprite " + "GL_OES_point_size_array GL_OES_stencil_wrap " + "GL_OES_compressed_paletted_texture " + "GL_OES_depth_texture " + "GL_OES_framebuffer_object GL_OES_depth24 GL_OES_depth32 " + "GL_OES_rgb8_rgba8 GL_OES_stencil1 GL_OES_stencil4 " + "GL_OES_stencil8 GL_OES_EGL_image "; + const GLchar *packed_depth_stencil = "GL_OES_packed_depth_stencil "; + const GLchar *texture_npot = "GL_OES_texture_npot "; + const GLchar *texture_filter_anisotropic = "GL_EXT_texture_filter_anisotropic "; + const GLchar *matrix_palette = "GL_OES_matrix_palette "; + + size_t len = strlen(default_ext); + GLchar *str; + + if (gles1_ctx->base.texture_npot) { + len += strlen(texture_npot); + } + + if (gles1_ctx->base.texture_filter_anisotropic) { + len += strlen(texture_filter_anisotropic); + } + + if (gles1_ctx->base.packed_depth_stencil) { + len += strlen(packed_depth_stencil); + } + + if (gles1_ctx->matrix_palette) { + len += strlen(matrix_palette); + } + + str = yagl_malloc0(len + 1); + + strcpy(str, default_ext); + + if (gles1_ctx->base.texture_npot) { + strcat(str, texture_npot); + } + + if (gles1_ctx->base.texture_filter_anisotropic) { + strcat(str, texture_filter_anisotropic); + } + + if (gles1_ctx->base.packed_depth_stencil) { + strcat(str, packed_depth_stencil); + } + + if (gles1_ctx->matrix_palette) { + strcat(str, matrix_palette); + } + + return str; +} + +typedef struct YaglGles1PalFmtDesc { + GLenum uncomp_format; + GLenum pixel_type; + unsigned pixel_size; + unsigned bits_per_index; +} YaglGles1PalFmtDesc; + +static inline int yagl_log2(int val) +{ + int ret = 0; + + if (val > 0) { + while (val >>= 1) { + ret++; + } + } + + return ret; +} + +static inline int yagl_gles1_tex_dims_valid(GLsizei width, + GLsizei height, + int max_size) +{ + if (width < 0 || height < 0 || width > max_size || height > max_size || + (width & (width - 1)) || (height & (height - 1))) { + return 0; + } + + return 1; +} + +static void yagl_gles1_cpal_format_get_descr(GLenum format, + YaglGles1PalFmtDesc *desc) +{ + assert(format >= GL_PALETTE4_RGB8_OES && format <= GL_PALETTE8_RGB5_A1_OES); + + switch (format) { + case GL_PALETTE4_RGB8_OES: + desc->uncomp_format = GL_RGB; + desc->bits_per_index = 4; + desc->pixel_type = GL_UNSIGNED_BYTE; + desc->pixel_size = 3; + break; + case GL_PALETTE4_RGBA8_OES: + desc->uncomp_format = GL_RGBA; + desc->bits_per_index = 4; + desc->pixel_type = GL_UNSIGNED_BYTE; + desc->pixel_size = 4; + break; + case GL_PALETTE4_R5_G6_B5_OES: + desc->uncomp_format = GL_RGB; + desc->bits_per_index = 4; + desc->pixel_type = GL_UNSIGNED_SHORT_5_6_5; + desc->pixel_size = 2; + break; + case GL_PALETTE4_RGBA4_OES: + desc->uncomp_format = GL_RGBA; + desc->bits_per_index = 4; + desc->pixel_type = GL_UNSIGNED_SHORT_4_4_4_4; + desc->pixel_size = 2; + break; + case GL_PALETTE4_RGB5_A1_OES: + desc->uncomp_format = GL_RGBA; + desc->bits_per_index = 4; + desc->pixel_type = GL_UNSIGNED_SHORT_5_5_5_1; + desc->pixel_size = 2; + break; + case GL_PALETTE8_RGB8_OES: + desc->uncomp_format = GL_RGB; + desc->bits_per_index = 8; + desc->pixel_type = GL_UNSIGNED_BYTE; + desc->pixel_size = 3; + break; + case GL_PALETTE8_RGBA8_OES: + desc->uncomp_format = GL_RGBA; + desc->bits_per_index = 8; + desc->pixel_type = GL_UNSIGNED_BYTE; + desc->pixel_size = 4; + break; + case GL_PALETTE8_R5_G6_B5_OES: + desc->uncomp_format = GL_RGB; + desc->bits_per_index = 8; + desc->pixel_type = GL_UNSIGNED_SHORT_5_6_5; + desc->pixel_size = 2; + break; + case GL_PALETTE8_RGBA4_OES: + desc->uncomp_format = GL_RGBA; + desc->bits_per_index = 8; + desc->pixel_type = GL_UNSIGNED_SHORT_4_4_4_4; + desc->pixel_size = 2; + break; + case GL_PALETTE8_RGB5_A1_OES: + desc->uncomp_format = GL_RGBA; + desc->bits_per_index = 8; + desc->pixel_type = GL_UNSIGNED_SHORT_5_5_5_1; + desc->pixel_size = 2; + break; + } +} + +static GLsizei yagl_gles1_cpal_tex_size(YaglGles1PalFmtDesc *fmt_desc, + unsigned width, + unsigned height, + unsigned max_level) +{ + GLsizei size; + + /* Palette table size */ + size = (1 << fmt_desc->bits_per_index) * fmt_desc->pixel_size; + + /* Texture palette indices array size for each miplevel */ + do { + if (fmt_desc->bits_per_index == 4) { + size += (width * height + 1) / 2; + } else { + size += width * height; + } + + width >>= 1; + if (width == 0) { + width = 1; + } + + height >>= 1; + if (height == 0) { + height = 1; + } + } while (max_level--); + + return size; +} + +static void yagl_gles1_cpal_tex_uncomp_and_apply(struct yagl_gles_context *ctx, + YaglGles1PalFmtDesc *fmt_desc, + unsigned max_level, + unsigned width, + unsigned height, + const GLvoid *data) +{ + uint8_t *tex_img_data = NULL; + uint8_t *img; + const uint8_t *indices; + unsigned cur_level, i; + unsigned num_of_texels = width * height; + GLint saved_alignment; + + if (!data) { + for (cur_level = 0; cur_level <= max_level; ++cur_level) { + yagl_host_glTexImage2D(GL_TEXTURE_2D, + cur_level, + fmt_desc->uncomp_format, + width, height, + 0, + fmt_desc->uncomp_format, + fmt_desc->pixel_type, + NULL, 0); + width >>= 1; + height >>= 1; + + if (width == 0) { + width = 1; + } + + if (height == 0) { + height = 1; + } + } + + return; + } + + /* Jump over palette data to first image data */ + indices = data + (1 << fmt_desc->bits_per_index) * fmt_desc->pixel_size; + + /* 0 level image is the largest */ + tex_img_data = yagl_malloc(num_of_texels * fmt_desc->pixel_size); + + /* We will pass tightly packed data to glTexImage2D */ + saved_alignment = ctx->unpack_alignment; + + if (saved_alignment != 1) { + yagl_host_glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + } + + for (cur_level = 0; cur_level <= max_level; ++cur_level) { + img = tex_img_data; + + if (fmt_desc->bits_per_index == 4) { + unsigned cur_idx; + + for (i = 0; i < num_of_texels; ++i) { + if ((i % 2) == 0) { + cur_idx = indices[i / 2] >> 4; + } else { + cur_idx = indices[i / 2] & 0xf; + } + + memcpy(img, + data + cur_idx * fmt_desc->pixel_size, + fmt_desc->pixel_size); + + img += fmt_desc->pixel_size; + } + + indices += (num_of_texels + 1) / 2; + } else { + for (i = 0; i < num_of_texels; ++i) { + memcpy(img, + data + indices[i] * fmt_desc->pixel_size, + fmt_desc->pixel_size); + img += fmt_desc->pixel_size; + } + + indices += num_of_texels; + } + + yagl_host_glTexImage2D(GL_TEXTURE_2D, + cur_level, + fmt_desc->uncomp_format, + width, height, + 0, + fmt_desc->uncomp_format, + fmt_desc->pixel_type, + tex_img_data, + num_of_texels * fmt_desc->pixel_size); + + width >>= 1; + if (width == 0) { + width = 1; + } + + height >>= 1; + if (height == 0) { + height = 1; + } + + num_of_texels = width * height; + } + + yagl_free(tex_img_data); + + if (saved_alignment != 1) { + yagl_host_glPixelStorei(GL_UNPACK_ALIGNMENT, saved_alignment); + } +} + +static GLenum yagl_gles1_context_compressed_tex_image(struct yagl_gles_context *ctx, + GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const GLvoid *data) +{ + const int max_tex_size = ((struct yagl_gles1_context*)ctx)->max_tex_size; + YaglGles1PalFmtDesc fmt_desc; + + if (target != GL_TEXTURE_2D) { + return GL_INVALID_ENUM; + } + + switch (internalformat) { + case GL_PALETTE4_RGB8_OES ... GL_PALETTE8_RGB5_A1_OES: + yagl_gles1_cpal_format_get_descr(internalformat, &fmt_desc); + + if ((level > 0) || (-level > yagl_log2(max_tex_size)) || + !yagl_gles1_tex_dims_valid(width, height, max_tex_size) || + border != 0 || (imageSize != + yagl_gles1_cpal_tex_size(&fmt_desc, width, height, -level))) { + return GL_INVALID_VALUE; + } + + yagl_gles1_cpal_tex_uncomp_and_apply(ctx, + &fmt_desc, + -level, + width, + height, + data); + break; + default: + return GL_INVALID_ENUM; + } + + return GL_NO_ERROR; +} + +static int yagl_gles1_context_enable(struct yagl_gles_context *ctx, + GLenum cap, + GLboolean enable) +{ + struct yagl_gles1_context *gles1_ctx = (struct yagl_gles1_context*)ctx; + + switch (cap) { + case GL_TEXTURE_2D: + yagl_gles_context_active_texture_set_enabled(ctx, + yagl_gles_texture_target_2d, enable); + break; + case GL_ALPHA_TEST: + case GL_COLOR_LOGIC_OP: + case GL_COLOR_MATERIAL: + case GL_FOG: + case GL_LIGHTING: + case GL_LINE_SMOOTH: + case GL_MULTISAMPLE: + case GL_NORMALIZE: + case GL_POINT_SMOOTH: + case GL_POINT_SPRITE_OES: + case GL_RESCALE_NORMAL: + case GL_SAMPLE_ALPHA_TO_ONE: + break; + default: + if ((cap >= GL_CLIP_PLANE0 && + cap <= (GL_CLIP_PLANE0 + gles1_ctx->max_clip_planes - 1)) || + (cap >= GL_LIGHT0 && + cap <= (GL_LIGHT0 + gles1_ctx->max_lights - 1))) { + break; + } + return 0; + } + + if (enable) { + yagl_host_glEnable(cap); + } else { + yagl_host_glDisable(cap); + } + + return 1; +} + +static int yagl_gles1_context_is_enabled(struct yagl_gles_context *ctx, + GLenum cap, + GLboolean *enabled) +{ + struct yagl_gles1_context *gles1_ctx = (struct yagl_gles1_context*)ctx; + struct yagl_gles_texture_target_state *tts; + + switch (cap) { + case GL_TEXTURE_2D: + tts = yagl_gles_context_get_active_texture_target_state(ctx, + yagl_gles_texture_target_2d); + *enabled = tts->enabled; + return 1; + case GL_VERTEX_ARRAY: + case GL_NORMAL_ARRAY: + case GL_COLOR_ARRAY: + case GL_TEXTURE_COORD_ARRAY: + case GL_POINT_SIZE_ARRAY_OES: + *enabled = ctx->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, cap)].enabled; + return 1; + case GL_ALPHA_TEST: + case GL_COLOR_LOGIC_OP: + case GL_COLOR_MATERIAL: + case GL_FOG: + case GL_LIGHTING: + case GL_LINE_SMOOTH: + case GL_MULTISAMPLE: + case GL_NORMALIZE: + case GL_POINT_SMOOTH: + case GL_RESCALE_NORMAL: + case GL_SAMPLE_ALPHA_TO_ONE: + case GL_POINT_SPRITE_OES: + break; + default: + if ((cap >= GL_CLIP_PLANE0 && + cap <= (GL_CLIP_PLANE0 + gles1_ctx->max_clip_planes - 1)) || + (cap >= GL_LIGHT0 && + cap <= (GL_LIGHT0 + gles1_ctx->max_lights - 1))) { + break; + } + return 0; + } + + *enabled = yagl_host_glIsEnabled(cap); + + return 1; +} + +static int yagl_gles1_context_get_integerv(struct yagl_gles_context *ctx, + GLenum pname, + GLint *params, + uint32_t *num_params) +{ + int processed = 1; + struct yagl_gles1_context *gles1_ctx = (struct yagl_gles1_context*)ctx; + + switch (pname) { + case GL_COMPRESSED_TEXTURE_FORMATS: + yagl_gles1_compressed_texture_formats_fill(params); + *num_params = YAGL_GLES1_NUM_COMP_TEX_FORMATS; + break; + case GL_NUM_COMPRESSED_TEXTURE_FORMATS: + *params = YAGL_GLES1_NUM_COMP_TEX_FORMATS; + *num_params = 1; + break; + case GL_MAX_CLIP_PLANES: + *params = gles1_ctx->max_clip_planes; + *num_params = 1; + break; + case GL_MAX_LIGHTS: + *params = gles1_ctx->max_lights; + *num_params = 1; + break; + case GL_MAX_TEXTURE_SIZE: + *params = gles1_ctx->max_tex_size; + *num_params = 1; + break; + case GL_VERTEX_ARRAY: + case GL_NORMAL_ARRAY: + case GL_COLOR_ARRAY: + case GL_TEXTURE_COORD_ARRAY: + case GL_POINT_SIZE_ARRAY_OES: + *params = ctx->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].enabled; + *num_params = 1; + break; + case GL_VERTEX_ARRAY_BUFFER_BINDING: + case GL_COLOR_ARRAY_BUFFER_BINDING: + case GL_NORMAL_ARRAY_BUFFER_BINDING: + case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING: + case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: + *params = ctx->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].vbo ? + ctx->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].vbo->base.local_name + : 0; + *num_params = 1; + break; + case GL_VERTEX_ARRAY_STRIDE: + case GL_COLOR_ARRAY_STRIDE: + case GL_NORMAL_ARRAY_STRIDE: + case GL_TEXTURE_COORD_ARRAY_STRIDE: + case GL_POINT_SIZE_ARRAY_STRIDE_OES: + *params = ctx->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].stride; + *num_params = 1; + break; + case GL_VERTEX_ARRAY_TYPE: + case GL_COLOR_ARRAY_TYPE: + case GL_NORMAL_ARRAY_TYPE: + case GL_TEXTURE_COORD_ARRAY_TYPE: + case GL_POINT_SIZE_ARRAY_TYPE_OES: + *params = ctx->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].type; + *num_params = 1; + break; + case GL_VERTEX_ARRAY_SIZE: + case GL_COLOR_ARRAY_SIZE: + case GL_TEXTURE_COORD_ARRAY_SIZE: + *params = ctx->arrays[yagl_gles1_array_idx_from_pname(gles1_ctx, pname)].size; + *num_params = 1; + break; + default: + processed = 0; + break; + } + + if (processed) { + return 1; + } + + switch (pname) { + case GL_ALPHA_TEST: + *num_params = 1; + break; + case GL_ALPHA_TEST_FUNC: + *num_params = 1; + break; + case GL_BLEND_DST: + *num_params = 1; + break; + case GL_BLEND_SRC: + *num_params = 1; + break; + case GL_CLIENT_ACTIVE_TEXTURE: + *num_params = 1; + break; + case GL_COLOR_LOGIC_OP: + *num_params = 1; + break; + case GL_COLOR_MATERIAL: + *num_params = 1; + break; + case GL_FOG: + *num_params = 1; + break; + case GL_FOG_HINT: + *num_params = 1; + break; + case GL_FOG_MODE: + *num_params = 1; + break; + case GL_LIGHTING: + *num_params = 1; + break; + case GL_LIGHT_MODEL_TWO_SIDE: + *num_params = 1; + break; + case GL_LINE_SMOOTH: + *num_params = 1; + break; + case GL_LINE_SMOOTH_HINT: + *num_params = 1; + break; + case GL_LOGIC_OP_MODE: + *num_params = 1; + break; + case GL_MATRIX_MODE: + *num_params = 1; + break; + case GL_MAX_MODELVIEW_STACK_DEPTH: + *num_params = 1; + break; + case GL_MAX_PROJECTION_STACK_DEPTH: + *num_params = 1; + break; + case GL_MAX_TEXTURE_STACK_DEPTH: + *num_params = 1; + break; + case GL_MAX_TEXTURE_UNITS: + *num_params = 1; + break; + case GL_MODELVIEW_STACK_DEPTH: + *num_params = 1; + break; + case GL_MULTISAMPLE: + *num_params = 1; + break; + case GL_NORMALIZE: + *num_params = 1; + break; + case GL_PERSPECTIVE_CORRECTION_HINT: + *num_params = 1; + break; + case GL_POINT_SMOOTH: + *num_params = 1; + break; + case GL_POINT_SMOOTH_HINT: + *num_params = 1; + break; + case GL_POINT_SPRITE_OES: + *num_params = 1; + break; + case GL_PROJECTION_STACK_DEPTH: + *num_params = 1; + break; + case GL_RESCALE_NORMAL: + *num_params = 1; + break; + case GL_SAMPLE_ALPHA_TO_ONE: + *num_params = 1; + break; + case GL_SHADE_MODEL: + *num_params = 1; + break; + case GL_TEXTURE_2D: + *num_params = 1; + break; + case GL_TEXTURE_STACK_DEPTH: + *num_params = 1; + break; + /* GL_OES_matrix_palette */ + case GL_MAX_PALETTE_MATRICES_OES: + case GL_MAX_VERTEX_UNITS_OES: + case GL_CURRENT_PALETTE_MATRIX_OES: + case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES: + case GL_MATRIX_INDEX_ARRAY_SIZE_OES: + case GL_MATRIX_INDEX_ARRAY_STRIDE_OES: + case GL_MATRIX_INDEX_ARRAY_TYPE_OES: + case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES: + case GL_WEIGHT_ARRAY_SIZE_OES: + case GL_WEIGHT_ARRAY_STRIDE_OES: + case GL_WEIGHT_ARRAY_TYPE_OES: + if (!gles1_ctx->matrix_palette) { + return 0; + } + *num_params = 1; + break; + default: + if ((pname >= GL_CLIP_PLANE0 && + pname <= (GL_CLIP_PLANE0 + gles1_ctx->max_clip_planes - 1)) || + (pname >= GL_LIGHT0 && + pname <= (GL_LIGHT0 + gles1_ctx->max_lights - 1))) { + *num_params = 1; + break; + } + return 0; + } + + yagl_host_glGetIntegerv(pname, params, *num_params, NULL); + + return 1; +} + +static int yagl_gles1_context_get_floatv(struct yagl_gles_context *ctx, + GLenum pname, + GLfloat *params, + uint32_t *num_params, + int *needs_map) +{ + switch (pname) { + case GL_ALPHA_TEST_REF: + *num_params = 1; + *needs_map = 1; + break; + case GL_CURRENT_COLOR: + *num_params = 4; + *needs_map = 1; + break; + case GL_CURRENT_NORMAL: + *num_params = 3; + *needs_map = 1; + break; + case GL_CURRENT_TEXTURE_COORDS: + *num_params = 4; + break; + case GL_FOG_COLOR: + *num_params = 4; + *needs_map = 1; + break; + case GL_FOG_DENSITY: + *num_params = 1; + break; + case GL_FOG_END: + *num_params = 1; + break; + case GL_FOG_START: + *num_params = 1; + break; + case GL_LIGHT_MODEL_AMBIENT: + *num_params = 4; + *needs_map = 1; + break; + case GL_MODELVIEW_MATRIX: + *num_params = 16; + break; + case GL_POINT_DISTANCE_ATTENUATION: + *num_params = 3; + break; + case GL_POINT_FADE_THRESHOLD_SIZE: + *num_params = 1; + break; + case GL_POINT_SIZE: + *num_params = 1; + break; + case GL_POINT_SIZE_MAX: + *num_params = 1; + break; + case GL_POINT_SIZE_MIN: + *num_params = 1; + break; + case GL_PROJECTION_MATRIX: + *num_params = 16; + break; + case GL_SMOOTH_LINE_WIDTH_RANGE: + *num_params = 2; + break; + case GL_SMOOTH_POINT_SIZE_RANGE: + *num_params = 2; + break; + case GL_TEXTURE_MATRIX: + *num_params = 16; + break; + default: + return 0; + } + + yagl_host_glGetFloatv(pname, params, *num_params, NULL); + + return 1; +} + +static __inline GLfloat yagl_gles1_pointsize_to_float(struct yagl_gles_array *array, + const void *psize) +{ + switch (array->type) { + case GL_FIXED: + return yagl_fixed_to_float(*(GLfixed*)psize); + break; + case GL_FLOAT: + return *(GLfloat*)psize; + break; + default: + fprintf(stderr, "Critical error! Bad pointsize type!\n"); + exit(1); + } +} + +static void yagl_gles1_draw_arrays_psize(struct yagl_gles_context *ctx, + GLint first, + GLsizei count) +{ + struct yagl_gles_array *parray = &ctx->arrays[yagl_gles1_array_pointsize]; + unsigned i = 0; + unsigned stride = parray->stride; + GLsizei points_cnt; + GLint arr_offset; + const void *next_psize_p; + GLfloat cur_psize; + + if (parray->vbo) { + next_psize_p = parray->vbo->data + parray->offset + first * stride; + } else { + next_psize_p = parray->ptr + first * stride; + } + + while (i < count) { + points_cnt = 0; + arr_offset = i; + cur_psize = yagl_gles1_pointsize_to_float(parray, next_psize_p); + + do { + ++points_cnt; + ++i; + next_psize_p += stride; + } while ((i < count) && (cur_psize == yagl_gles1_pointsize_to_float(parray, next_psize_p))); + + yagl_host_glPointSize(cur_psize); + + yagl_host_glDrawArrays(GL_POINTS, first + arr_offset, points_cnt); + } +} + +static inline const void *yagl_get_next_psize_p(struct yagl_gles_buffer *ebo, + struct yagl_gles_array *parray, + GLenum type, + unsigned idx, + const GLvoid *indices, + int32_t indices_count) +{ + unsigned idx_val; + + if (ebo) { + if (type == GL_UNSIGNED_SHORT) { + idx_val = ((uint16_t *)(ebo->data + indices_count))[idx]; + } else { + idx_val = ((uint8_t *)(ebo->data + indices_count))[idx]; + } + } else { + if (type == GL_UNSIGNED_SHORT) { + idx_val = ((uint16_t *)indices)[idx]; + } else { + idx_val = ((uint8_t *)indices)[idx]; + } + } + + if (parray->vbo) { + return parray->vbo->data + parray->offset + idx_val * parray->stride; + } else { + return parray->ptr + idx_val * parray->stride; + } +} + +static void yagl_gles1_draw_elem_psize(struct yagl_gles_context *ctx, + GLsizei count, + GLenum type, + const GLvoid *indices, + int32_t indices_count) +{ + struct yagl_gles_array *parray = &ctx->arrays[yagl_gles1_array_pointsize]; + unsigned i = 0, el_size; + GLsizei points_cnt; + GLint arr_offset; + GLfloat cur_psize; + const void *next_psize_p; + + switch (type) { + case GL_UNSIGNED_BYTE: + el_size = 1; + break; + case GL_UNSIGNED_SHORT: + el_size = 2; + break; + default: + el_size = 0; + break; + } + + assert(el_size > 0); + + next_psize_p = yagl_get_next_psize_p(ctx->ebo, parray, type, i, indices, indices_count); + + while (i < count) { + points_cnt = 0; + arr_offset = i; + cur_psize = yagl_gles1_pointsize_to_float(parray, next_psize_p); + + do { + ++points_cnt; + ++i; + next_psize_p = yagl_get_next_psize_p(ctx->ebo, + parray, + type, + i, + indices, + indices_count); + } while ((i < count) && (cur_psize == yagl_gles1_pointsize_to_float(parray, next_psize_p))); + + yagl_host_glPointSize(cur_psize); + + if (ctx->ebo) { + yagl_host_glDrawElements(GL_POINTS, + points_cnt, + type, + NULL, + indices_count + arr_offset * el_size); + } else { + yagl_host_glDrawElements(GL_POINTS, + points_cnt, + type, + indices + arr_offset * el_size, + points_cnt * el_size); + } + } +} + +static void yagl_gles1_context_draw_arrays(struct yagl_gles_context *ctx, + GLenum mode, + GLint first, + GLsizei count) +{ + if (!ctx->arrays[yagl_gles1_array_vertex].enabled) { + return; + } + + if ((mode == GL_POINTS) && ctx->arrays[yagl_gles1_array_pointsize].enabled) { + yagl_gles1_draw_arrays_psize(ctx, first, count); + } else { + yagl_host_glDrawArrays(mode, first, count); + } +} + +static void yagl_gles1_context_draw_elements(struct yagl_gles_context *ctx, + GLenum mode, + GLsizei count, + GLenum type, + const GLvoid *indices, + int32_t indices_count) +{ + if (!ctx->arrays[yagl_gles1_array_vertex].enabled) { + return; + } + + if ((mode == GL_POINTS) && ctx->arrays[yagl_gles1_array_pointsize].enabled) { + yagl_gles1_draw_elem_psize(ctx, count, type, indices, indices_count); + } else { + yagl_host_glDrawElements(mode, count, type, indices, indices_count); + } +} + +struct yagl_client_context *yagl_gles1_context_create(struct yagl_sharegroup *sg) +{ + struct yagl_gles1_context *gles1_ctx; + + YAGL_LOG_FUNC_ENTER(yagl_gles1_context_create, NULL); + + gles1_ctx = yagl_malloc0(sizeof(*gles1_ctx)); + + yagl_gles_context_init(&gles1_ctx->base, yagl_client_api_gles1, sg); + + gles1_ctx->sg = sg; + + gles1_ctx->base.base.prepare = &yagl_gles1_context_prepare; + gles1_ctx->base.base.destroy = &yagl_gles1_context_destroy; + gles1_ctx->base.get_extensions = &yagl_gles1_context_get_extensions; + gles1_ctx->base.compressed_tex_image = &yagl_gles1_context_compressed_tex_image; + gles1_ctx->base.enable = &yagl_gles1_context_enable; + gles1_ctx->base.is_enabled = &yagl_gles1_context_is_enabled; + gles1_ctx->base.get_integerv = &yagl_gles1_context_get_integerv; + gles1_ctx->base.get_floatv = &yagl_gles1_context_get_floatv; + gles1_ctx->base.draw_arrays = &yagl_gles1_context_draw_arrays; + gles1_ctx->base.draw_elements = &yagl_gles1_context_draw_elements; + + YAGL_LOG_FUNC_EXIT("%p", gles1_ctx); + + return &gles1_ctx->base.base; +} diff --git a/GLESv1_CM/yagl_gles1_context.h b/GLESv1_CM/yagl_gles1_context.h new file mode 100644 index 0000000..ca19af6 --- /dev/null +++ b/GLESv1_CM/yagl_gles1_context.h @@ -0,0 +1,42 @@ +#ifndef _YAGL_GLES1_CONTEXT_H_ +#define _YAGL_GLES1_CONTEXT_H_ + +#include "yagl_gles_context.h" + +/* + * GLES1 has arrays of vertices, normals, colors, texture coordinates and + * point sizes. Every texture unit has its own texture coordinates array. + */ +typedef enum +{ + yagl_gles1_array_vertex = 0, + yagl_gles1_array_color, + yagl_gles1_array_normal, + yagl_gles1_array_pointsize, + yagl_gles1_array_texcoord, +} yagl_gles1_array_type; + +struct yagl_gles1_context +{ + struct yagl_gles_context base; + + /* + * From 'base.base.sg'. + */ + struct yagl_sharegroup *sg; + + /* GL_OES_matrix_palette */ + int matrix_palette; + + int client_active_texture; + + int max_clip_planes; + + int max_lights; + + int max_tex_size; +}; + +struct yagl_client_context *yagl_gles1_context_create(struct yagl_sharegroup *sg); + +#endif diff --git a/GLESv1_CM/yagl_gles1_interface.c b/GLESv1_CM/yagl_gles1_interface.c new file mode 100644 index 0000000..7462a1b --- /dev/null +++ b/GLESv1_CM/yagl_gles1_interface.c @@ -0,0 +1,34 @@ +#include "GLES/gl.h" +#include "yagl_export.h" +#include "yagl_client_interface.h" +#include "yagl_gles1_context.h" +#include "yagl_gles_image.h" +#include "yagl_gles_texture.h" + +static struct yagl_client_context *yagl_gles1_create_ctx(struct yagl_client_interface *iface, + struct yagl_sharegroup *sg) +{ + return yagl_gles1_context_create(sg); +} + +static struct yagl_client_image + *yagl_gles1_create_image(struct yagl_client_interface *iface, + yagl_object_name tex_global_name) +{ + return &yagl_gles_image_create(tex_global_name)->base; +} + +static void yagl_gles1_release_tex_image(struct yagl_client_interface *iface, + void *cookie) +{ + struct yagl_gles_texture *texture = cookie; + + yagl_gles_texture_release_tex_image(texture); +} + +YAGL_API struct yagl_client_interface yagl_gles1_interface = +{ + .create_ctx = &yagl_gles1_create_ctx, + .create_image = &yagl_gles1_create_image, + .release_tex_image = &yagl_gles1_release_tex_image +}; diff --git a/GLESv1_CM/yagl_gles1_validate.c b/GLESv1_CM/yagl_gles1_validate.c new file mode 100644 index 0000000..4091e83 --- /dev/null +++ b/GLESv1_CM/yagl_gles1_validate.c @@ -0,0 +1,128 @@ +#include "GLES/gl.h" +#include "yagl_gles1_validate.h" + +int yagl_gles1_get_texenv_param_count(GLenum type, int *count) +{ + switch (type) { + case GL_TEXTURE_ENV_COLOR: + *count = 4; + break; + case GL_TEXTURE_ENV_MODE: + case GL_COMBINE_RGB: + case GL_COMBINE_ALPHA: + case GL_SRC0_RGB: + case GL_SRC1_RGB: + case GL_SRC2_RGB: + case GL_SRC0_ALPHA: + case GL_SRC1_ALPHA: + case GL_SRC2_ALPHA: + case GL_OPERAND0_RGB: + case GL_OPERAND1_RGB: + case GL_OPERAND2_RGB: + case GL_OPERAND0_ALPHA: + case GL_OPERAND1_ALPHA: + case GL_OPERAND2_ALPHA: + case GL_RGB_SCALE: + case GL_ALPHA_SCALE: + case GL_COORD_REPLACE_OES: + *count = 1; + break; + default: + return 0; + } + return 1; +} + +int yagl_gles1_get_point_param_count(GLenum pname, int *count) +{ + switch (pname) { + case GL_POINT_DISTANCE_ATTENUATION: + *count = 3; + break; + case GL_POINT_SIZE_MIN: + case GL_POINT_SIZE_MAX: + case GL_POINT_FADE_THRESHOLD_SIZE: + *count = 1; + break; + default: + return 0; + } + return 1; +} + +int yagl_gles1_get_fog_param_count(GLenum pname, int *count) +{ + switch (pname) { + case GL_FOG_COLOR: + *count = 4; + break; + case GL_FOG_MODE: + case GL_FOG_DENSITY: + case GL_FOG_START: + case GL_FOG_END: + *count = 1; + break; + default: + return 0; + } + return 1; +} + +int yagl_gles1_get_light_param_count(GLenum pname, int *count) +{ + switch (pname) { + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_POSITION: + *count = 4; + break; + case GL_SPOT_DIRECTION: + *count = 3; + break; + case GL_SPOT_EXPONENT: + case GL_SPOT_CUTOFF: + case GL_CONSTANT_ATTENUATION: + case GL_LINEAR_ATTENUATION: + case GL_QUADRATIC_ATTENUATION: + *count = 1; + break; + default: + return 0; + } + return 1; +} + +int yagl_gles1_get_light_model_param_count(GLenum pname, int *count) +{ + switch (pname) { + case GL_LIGHT_MODEL_AMBIENT: + *count = 4; + break; + case GL_LIGHT_MODEL_TWO_SIDE: + *count = 1; + break; + default: + return 0; + } + return 1; +} + +int yagl_gles1_get_material_param_count(GLenum pname, int *count) +{ + switch (pname) { + case GL_AMBIENT: + case GL_DIFFUSE: + case GL_SPECULAR: + case GL_EMISSION: + case GL_AMBIENT_AND_DIFFUSE: + *count = 4; + break; + case GL_SHININESS: + *count = 1; + break; + default: + return 0; + } + return 1; +} diff --git a/GLESv1_CM/yagl_gles1_validate.h b/GLESv1_CM/yagl_gles1_validate.h new file mode 100644 index 0000000..6d49622 --- /dev/null +++ b/GLESv1_CM/yagl_gles1_validate.h @@ -0,0 +1,18 @@ +#ifndef _YAGL_GLES1_VALIDATE_H_ +#define _YAGL_GLES1_VALIDATE_H_ + +#include "yagl_types.h" + +int yagl_gles1_get_texenv_param_count(GLenum type, int *count); + +int yagl_gles1_get_point_param_count(GLenum pname, int *count); + +int yagl_gles1_get_fog_param_count(GLenum pname, int *count); + +int yagl_gles1_get_light_param_count(GLenum pname, int *count); + +int yagl_gles1_get_light_model_param_count(GLenum pname, int *count); + +int yagl_gles1_get_material_param_count(GLenum pname, int *count); + +#endif diff --git a/GLESv1_CM/yagl_host_gles1_calls.c b/GLESv1_CM/yagl_host_gles1_calls.c deleted file mode 100644 index 001194b..0000000 --- a/GLESv1_CM/yagl_host_gles1_calls.c +++ /dev/null @@ -1,2612 +0,0 @@ -/* - * Generated by gen-yagl-calls.py, do not modify! - */ -#include "yagl_host_gles1_calls.h" -#include "yagl_transport_gl1.h" -#include "yagl_state.h" -#include <assert.h> - -/* - * glActiveTexture wrapper. id = 1 - */ -void yagl_host_glActiveTexture(GLenum texture) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 1, 1 * 8, 1 * 8); - yagl_transport_put_out_GLenum(t, texture); - yagl_transport_end(t); -} - -/* - * glBindBuffer wrapper. id = 2 - */ -void yagl_host_glBindBuffer(GLenum target, GLuint buffer) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 2, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLuint(t, buffer); - yagl_transport_end(t); -} - -/* - * glBindFramebuffer wrapper. id = 3 - */ -void yagl_host_glBindFramebuffer(GLenum target, GLuint framebuffer) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 3, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLuint(t, framebuffer); - yagl_transport_end(t); -} - -/* - * glBindRenderbuffer wrapper. id = 4 - */ -void yagl_host_glBindRenderbuffer(GLenum target, GLuint renderbuffer) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 4, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLuint(t, renderbuffer); - yagl_transport_end(t); -} - -/* - * glBindTexture wrapper. id = 5 - */ -void yagl_host_glBindTexture(GLenum target, GLuint texture) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 5, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLuint(t, texture); - yagl_transport_end(t); -} - -/* - * glBlendEquation wrapper. id = 6 - */ -void yagl_host_glBlendEquation(GLenum mode) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 6, 1 * 8, 1 * 8); - yagl_transport_put_out_GLenum(t, mode); - yagl_transport_end(t); -} - -/* - * glBlendEquationSeparate wrapper. id = 7 - */ -void yagl_host_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 7, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, modeRGB); - yagl_transport_put_out_GLenum(t, modeAlpha); - yagl_transport_end(t); -} - -/* - * glBlendFunc wrapper. id = 8 - */ -void yagl_host_glBlendFunc(GLenum sfactor, GLenum dfactor) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 8, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, sfactor); - yagl_transport_put_out_GLenum(t, dfactor); - yagl_transport_end(t); -} - -/* - * glBlendFuncSeparate wrapper. id = 9 - */ -void yagl_host_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 9, 4 * 8, 4 * 8); - yagl_transport_put_out_GLenum(t, srcRGB); - yagl_transport_put_out_GLenum(t, dstRGB); - yagl_transport_put_out_GLenum(t, srcAlpha); - yagl_transport_put_out_GLenum(t, dstAlpha); - yagl_transport_end(t); -} - -/* - * glBufferData wrapper. id = 10 - */ -void yagl_host_glBufferData(GLenum target, const GLvoid *data, int32_t data_count, GLenum usage) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 10, 4 * 8, 2 * 8 + yagl_transport_array_size(data, data_count, 1)); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_array(t, data, data_count, 1); - yagl_transport_put_out_GLenum(t, usage); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(data, data_count * 1); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glBufferSubData wrapper. id = 11 - */ -void yagl_host_glBufferSubData(GLenum target, GLsizei offset, const GLvoid *data, int32_t data_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 11, 4 * 8, 2 * 8 + yagl_transport_array_size(data, data_count, 1)); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLsizei(t, offset); - yagl_transport_put_out_array(t, data, data_count, 1); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(data, data_count * 1); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glCheckFramebufferStatus wrapper. id = 12 - */ -GLenum yagl_host_glCheckFramebufferStatus(GLenum target) -{ - struct yagl_transport *t = yagl_get_transport(); - GLenum retval; - - yagl_transport_begin(t, yagl_api_id_gles1, 12, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_in_GLenum(t, &retval); - yagl_transport_end(t); - - return retval; -} - -/* - * glClear wrapper. id = 13 - */ -void yagl_host_glClear(GLbitfield mask) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 13, 1 * 8, 1 * 8); - yagl_transport_put_out_GLbitfield(t, mask); - yagl_transport_end(t); -} - -/* - * glClearColor wrapper. id = 14 - */ -void yagl_host_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 14, 4 * 8, 4 * 8); - yagl_transport_put_out_GLclampf(t, red); - yagl_transport_put_out_GLclampf(t, green); - yagl_transport_put_out_GLclampf(t, blue); - yagl_transport_put_out_GLclampf(t, alpha); - yagl_transport_end(t); -} - -/* - * glClearDepthf wrapper. id = 15 - */ -void yagl_host_glClearDepthf(GLclampf depth) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 15, 1 * 8, 1 * 8); - yagl_transport_put_out_GLclampf(t, depth); - yagl_transport_end(t); -} - -/* - * glClearStencil wrapper. id = 16 - */ -void yagl_host_glClearStencil(GLint s) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 16, 1 * 8, 1 * 8); - yagl_transport_put_out_GLint(t, s); - yagl_transport_end(t); -} - -/* - * glColorMask wrapper. id = 17 - */ -void yagl_host_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 17, 4 * 8, 4 * 8); - yagl_transport_put_out_GLboolean(t, red); - yagl_transport_put_out_GLboolean(t, green); - yagl_transport_put_out_GLboolean(t, blue); - yagl_transport_put_out_GLboolean(t, alpha); - yagl_transport_end(t); -} - -/* - * glCompressedTexImage2D wrapper. id = 18 - */ -void yagl_host_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, const GLvoid *data, int32_t data_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 18, 8 * 8, 6 * 8 + yagl_transport_array_size(data, data_count, 1)); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLint(t, level); - yagl_transport_put_out_GLenum(t, internalformat); - yagl_transport_put_out_GLsizei(t, width); - yagl_transport_put_out_GLsizei(t, height); - yagl_transport_put_out_GLint(t, border); - yagl_transport_put_out_array(t, data, data_count, 1); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(data, data_count * 1); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glCompressedTexSubImage2D wrapper. id = 19 - */ -void yagl_host_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, const GLvoid *data, int32_t data_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 19, 9 * 8, 7 * 8 + yagl_transport_array_size(data, data_count, 1)); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLint(t, level); - yagl_transport_put_out_GLint(t, xoffset); - yagl_transport_put_out_GLint(t, yoffset); - yagl_transport_put_out_GLsizei(t, width); - yagl_transport_put_out_GLsizei(t, height); - yagl_transport_put_out_GLenum(t, format); - yagl_transport_put_out_array(t, data, data_count, 1); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(data, data_count * 1); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glCopyTexImage2D wrapper. id = 20 - */ -void yagl_host_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 20, 8 * 8, 8 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLint(t, level); - yagl_transport_put_out_GLenum(t, internalformat); - yagl_transport_put_out_GLint(t, x); - yagl_transport_put_out_GLint(t, y); - yagl_transport_put_out_GLsizei(t, width); - yagl_transport_put_out_GLsizei(t, height); - yagl_transport_put_out_GLint(t, border); - yagl_transport_end(t); -} - -/* - * glCopyTexSubImage2D wrapper. id = 21 - */ -void yagl_host_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 21, 8 * 8, 8 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLint(t, level); - yagl_transport_put_out_GLint(t, xoffset); - yagl_transport_put_out_GLint(t, yoffset); - yagl_transport_put_out_GLint(t, x); - yagl_transport_put_out_GLint(t, y); - yagl_transport_put_out_GLsizei(t, width); - yagl_transport_put_out_GLsizei(t, height); - yagl_transport_end(t); -} - -/* - * glCullFace wrapper. id = 22 - */ -void yagl_host_glCullFace(GLenum mode) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 22, 1 * 8, 1 * 8); - yagl_transport_put_out_GLenum(t, mode); - yagl_transport_end(t); -} - -/* - * glDeleteBuffers wrapper. id = 23 - */ -void yagl_host_glDeleteBuffers(const GLuint *buffers, int32_t buffers_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 23, 2 * 8, 0 * 8 + yagl_transport_array_size(buffers, buffers_count, sizeof(GLuint))); - yagl_transport_put_out_array(t, buffers, buffers_count, sizeof(GLuint)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(buffers, buffers_count * sizeof(GLuint)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glDeleteFramebuffers wrapper. id = 24 - */ -void yagl_host_glDeleteFramebuffers(const GLuint *framebuffers, int32_t framebuffers_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 24, 2 * 8, 0 * 8 + yagl_transport_array_size(framebuffers, framebuffers_count, sizeof(GLuint))); - yagl_transport_put_out_array(t, framebuffers, framebuffers_count, sizeof(GLuint)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(framebuffers, framebuffers_count * sizeof(GLuint)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glDeleteRenderbuffers wrapper. id = 25 - */ -void yagl_host_glDeleteRenderbuffers(const GLuint *renderbuffers, int32_t renderbuffers_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 25, 2 * 8, 0 * 8 + yagl_transport_array_size(renderbuffers, renderbuffers_count, sizeof(GLuint))); - yagl_transport_put_out_array(t, renderbuffers, renderbuffers_count, sizeof(GLuint)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(renderbuffers, renderbuffers_count * sizeof(GLuint)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glDeleteTextures wrapper. id = 26 - */ -void yagl_host_glDeleteTextures(const GLuint *textures, int32_t textures_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 26, 2 * 8, 0 * 8 + yagl_transport_array_size(textures, textures_count, sizeof(GLuint))); - yagl_transport_put_out_array(t, textures, textures_count, sizeof(GLuint)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(textures, textures_count * sizeof(GLuint)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glDepthFunc wrapper. id = 27 - */ -void yagl_host_glDepthFunc(GLenum func) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 27, 1 * 8, 1 * 8); - yagl_transport_put_out_GLenum(t, func); - yagl_transport_end(t); -} - -/* - * glDepthMask wrapper. id = 28 - */ -void yagl_host_glDepthMask(GLboolean flag) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 28, 1 * 8, 1 * 8); - yagl_transport_put_out_GLboolean(t, flag); - yagl_transport_end(t); -} - -/* - * glDepthRangef wrapper. id = 29 - */ -void yagl_host_glDepthRangef(GLclampf zNear, GLclampf zFar) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 29, 2 * 8, 2 * 8); - yagl_transport_put_out_GLclampf(t, zNear); - yagl_transport_put_out_GLclampf(t, zFar); - yagl_transport_end(t); -} - -/* - * glDisable wrapper. id = 30 - */ -void yagl_host_glDisable(GLenum cap) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 30, 1 * 8, 1 * 8); - yagl_transport_put_out_GLenum(t, cap); - yagl_transport_end(t); -} - -/* - * glDrawArrays wrapper. id = 31 - */ -void yagl_host_glDrawArrays(GLenum mode, GLint first, GLsizei count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 31, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, mode); - yagl_transport_put_out_GLint(t, first); - yagl_transport_put_out_GLsizei(t, count); - yagl_transport_end(t); -} - -/* - * glEGLImageTargetTexture2DOES wrapper. id = 32 - */ -void yagl_host_glEGLImageTargetTexture2DOES(GLenum target, yagl_host_handle image) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 32, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_yagl_host_handle(t, image); - yagl_transport_end(t); -} - -/* - * glEnable wrapper. id = 33 - */ -void yagl_host_glEnable(GLenum cap) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 33, 1 * 8, 1 * 8); - yagl_transport_put_out_GLenum(t, cap); - yagl_transport_end(t); -} - -/* - * glFlush wrapper. id = 34 - */ -void yagl_host_glFlush() -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 34, 0 * 8, 0 * 8); - yagl_transport_end(t); - yagl_transport_sync(t); -} - -/* - * glFramebufferTexture2D wrapper. id = 35 - */ -void yagl_host_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 35, 5 * 8, 5 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, attachment); - yagl_transport_put_out_GLenum(t, textarget); - yagl_transport_put_out_GLuint(t, texture); - yagl_transport_put_out_GLint(t, level); - yagl_transport_end(t); -} - -/* - * glFramebufferRenderbuffer wrapper. id = 36 - */ -void yagl_host_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 36, 4 * 8, 4 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, attachment); - yagl_transport_put_out_GLenum(t, renderbuffertarget); - yagl_transport_put_out_GLuint(t, renderbuffer); - yagl_transport_end(t); -} - -/* - * glFrontFace wrapper. id = 37 - */ -void yagl_host_glFrontFace(GLenum mode) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 37, 1 * 8, 1 * 8); - yagl_transport_put_out_GLenum(t, mode); - yagl_transport_end(t); -} - -/* - * glGenBuffers wrapper. id = 38 - */ -void yagl_host_glGenBuffers(GLuint *buffers, int32_t buffers_maxcount, int32_t *buffers_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 38, 2 * 8, 0 * 8 + yagl_transport_array_size(buffers, buffers_maxcount, sizeof(GLuint))); - yagl_transport_put_in_array(t, buffers, buffers_maxcount, buffers_count, sizeof(GLuint)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(buffers, buffers_maxcount * sizeof(GLuint)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGenerateMipmap wrapper. id = 39 - */ -void yagl_host_glGenerateMipmap(GLenum target) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 39, 1 * 8, 1 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_end(t); -} - -/* - * glGenFramebuffers wrapper. id = 40 - */ -void yagl_host_glGenFramebuffers(GLuint *framebuffers, int32_t framebuffers_maxcount, int32_t *framebuffers_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 40, 2 * 8, 0 * 8 + yagl_transport_array_size(framebuffers, framebuffers_maxcount, sizeof(GLuint))); - yagl_transport_put_in_array(t, framebuffers, framebuffers_maxcount, framebuffers_count, sizeof(GLuint)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(framebuffers, framebuffers_maxcount * sizeof(GLuint)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGenRenderbuffers wrapper. id = 41 - */ -void yagl_host_glGenRenderbuffers(GLuint *renderbuffers, int32_t renderbuffers_maxcount, int32_t *renderbuffers_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 41, 2 * 8, 0 * 8 + yagl_transport_array_size(renderbuffers, renderbuffers_maxcount, sizeof(GLuint))); - yagl_transport_put_in_array(t, renderbuffers, renderbuffers_maxcount, renderbuffers_count, sizeof(GLuint)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(renderbuffers, renderbuffers_maxcount * sizeof(GLuint)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGenTextures wrapper. id = 42 - */ -void yagl_host_glGenTextures(GLuint *textures, int32_t textures_maxcount, int32_t *textures_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 42, 2 * 8, 0 * 8 + yagl_transport_array_size(textures, textures_maxcount, sizeof(GLuint))); - yagl_transport_put_in_array(t, textures, textures_maxcount, textures_count, sizeof(GLuint)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(textures, textures_maxcount * sizeof(GLuint)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGetBooleanv wrapper. id = 43 - */ -void yagl_host_glGetBooleanv(GLenum pname, GLboolean *params, int32_t params_maxcount, int32_t *params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 43, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLboolean))); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLboolean)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(params, params_maxcount * sizeof(GLboolean)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGetBufferParameteriv wrapper. id = 44 - */ -void yagl_host_glGetBufferParameteriv(GLenum target, GLenum pname, GLint *param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 44, 4 * 8, 4 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_GLint(t, param); - yagl_transport_end(t); -} - -/* - * glGetError wrapper. id = 45 - */ -GLenum yagl_host_glGetError() -{ - struct yagl_transport *t = yagl_get_transport(); - GLenum retval; - - yagl_transport_begin(t, yagl_api_id_gles1, 45, 2 * 8, 2 * 8); - yagl_transport_put_in_GLenum(t, &retval); - yagl_transport_end(t); - - return retval; -} - -/* - * glGetFloatv wrapper. id = 46 - */ -void yagl_host_glGetFloatv(GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 46, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLfloat))); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLfloat)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(params, params_maxcount * sizeof(GLfloat)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGetFramebufferAttachmentParameteriv wrapper. id = 47 - */ -void yagl_host_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 47, 5 * 8, 5 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, attachment); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_GLint(t, param); - yagl_transport_end(t); -} - -/* - * glGetIntegerv wrapper. id = 48 - */ -void yagl_host_glGetIntegerv(GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 48, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLint))); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLint)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(params, params_maxcount * sizeof(GLint)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGetRenderbufferParameteriv wrapper. id = 49 - */ -void yagl_host_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 49, 4 * 8, 4 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_GLint(t, param); - yagl_transport_end(t); -} - -/* - * glGetTexParameterfv wrapper. id = 50 - */ -void yagl_host_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 50, 4 * 8, 4 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_GLfloat(t, param); - yagl_transport_end(t); -} - -/* - * glGetTexParameteriv wrapper. id = 51 - */ -void yagl_host_glGetTexParameteriv(GLenum target, GLenum pname, GLint *param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 51, 4 * 8, 4 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_GLint(t, param); - yagl_transport_end(t); -} - -/* - * glHint wrapper. id = 52 - */ -void yagl_host_glHint(GLenum target, GLenum mode) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 52, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, mode); - yagl_transport_end(t); -} - -/* - * glIsBuffer wrapper. id = 53 - */ -GLboolean yagl_host_glIsBuffer(GLuint buffer) -{ - struct yagl_transport *t = yagl_get_transport(); - GLboolean retval; - - yagl_transport_begin(t, yagl_api_id_gles1, 53, 3 * 8, 3 * 8); - yagl_transport_put_out_GLuint(t, buffer); - yagl_transport_put_in_GLboolean(t, &retval); - yagl_transport_end(t); - - return retval; -} - -/* - * glIsEnabled wrapper. id = 54 - */ -GLboolean yagl_host_glIsEnabled(GLenum cap) -{ - struct yagl_transport *t = yagl_get_transport(); - GLboolean retval; - - yagl_transport_begin(t, yagl_api_id_gles1, 54, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, cap); - yagl_transport_put_in_GLboolean(t, &retval); - yagl_transport_end(t); - - return retval; -} - -/* - * glIsFramebuffer wrapper. id = 55 - */ -GLboolean yagl_host_glIsFramebuffer(GLuint framebuffer) -{ - struct yagl_transport *t = yagl_get_transport(); - GLboolean retval; - - yagl_transport_begin(t, yagl_api_id_gles1, 55, 3 * 8, 3 * 8); - yagl_transport_put_out_GLuint(t, framebuffer); - yagl_transport_put_in_GLboolean(t, &retval); - yagl_transport_end(t); - - return retval; -} - -/* - * glIsRenderbuffer wrapper. id = 56 - */ -GLboolean yagl_host_glIsRenderbuffer(GLuint renderbuffer) -{ - struct yagl_transport *t = yagl_get_transport(); - GLboolean retval; - - yagl_transport_begin(t, yagl_api_id_gles1, 56, 3 * 8, 3 * 8); - yagl_transport_put_out_GLuint(t, renderbuffer); - yagl_transport_put_in_GLboolean(t, &retval); - yagl_transport_end(t); - - return retval; -} - -/* - * glIsTexture wrapper. id = 57 - */ -GLboolean yagl_host_glIsTexture(GLuint texture) -{ - struct yagl_transport *t = yagl_get_transport(); - GLboolean retval; - - yagl_transport_begin(t, yagl_api_id_gles1, 57, 3 * 8, 3 * 8); - yagl_transport_put_out_GLuint(t, texture); - yagl_transport_put_in_GLboolean(t, &retval); - yagl_transport_end(t); - - return retval; -} - -/* - * glLineWidth wrapper. id = 58 - */ -void yagl_host_glLineWidth(GLfloat width) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 58, 1 * 8, 1 * 8); - yagl_transport_put_out_GLfloat(t, width); - yagl_transport_end(t); -} - -/* - * glPixelStorei wrapper. id = 59 - */ -void yagl_host_glPixelStorei(GLenum pname, GLint param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 59, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLint(t, param); - yagl_transport_end(t); -} - -/* - * glPolygonOffset wrapper. id = 60 - */ -void yagl_host_glPolygonOffset(GLfloat factor, GLfloat units) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 60, 2 * 8, 2 * 8); - yagl_transport_put_out_GLfloat(t, factor); - yagl_transport_put_out_GLfloat(t, units); - yagl_transport_end(t); -} - -/* - * glReadPixels wrapper. id = 61 - */ -void yagl_host_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels, int32_t pixels_maxcount, int32_t *pixels_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 61, 8 * 8, 6 * 8 + yagl_transport_array_size(pixels, pixels_maxcount, 1)); - yagl_transport_put_out_GLint(t, x); - yagl_transport_put_out_GLint(t, y); - yagl_transport_put_out_GLsizei(t, width); - yagl_transport_put_out_GLsizei(t, height); - yagl_transport_put_out_GLenum(t, format); - yagl_transport_put_out_GLenum(t, type); - yagl_transport_put_in_array(t, pixels, pixels_maxcount, pixels_count, 1); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(pixels, pixels_maxcount * 1); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glRenderbufferStorage wrapper. id = 62 - */ -void yagl_host_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 62, 4 * 8, 4 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, internalformat); - yagl_transport_put_out_GLsizei(t, width); - yagl_transport_put_out_GLsizei(t, height); - yagl_transport_end(t); -} - -/* - * glSampleCoverage wrapper. id = 63 - */ -void yagl_host_glSampleCoverage(GLclampf value, GLboolean invert) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 63, 2 * 8, 2 * 8); - yagl_transport_put_out_GLclampf(t, value); - yagl_transport_put_out_GLboolean(t, invert); - yagl_transport_end(t); -} - -/* - * glScissor wrapper. id = 64 - */ -void yagl_host_glScissor(GLint x, GLint y, GLsizei width, GLsizei height) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 64, 4 * 8, 4 * 8); - yagl_transport_put_out_GLint(t, x); - yagl_transport_put_out_GLint(t, y); - yagl_transport_put_out_GLsizei(t, width); - yagl_transport_put_out_GLsizei(t, height); - yagl_transport_end(t); -} - -/* - * glStencilFunc wrapper. id = 65 - */ -void yagl_host_glStencilFunc(GLenum func, GLint ref, GLuint mask) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 65, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, func); - yagl_transport_put_out_GLint(t, ref); - yagl_transport_put_out_GLuint(t, mask); - yagl_transport_end(t); -} - -/* - * glStencilMask wrapper. id = 66 - */ -void yagl_host_glStencilMask(GLuint mask) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 66, 1 * 8, 1 * 8); - yagl_transport_put_out_GLuint(t, mask); - yagl_transport_end(t); -} - -/* - * glStencilOp wrapper. id = 67 - */ -void yagl_host_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 67, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, fail); - yagl_transport_put_out_GLenum(t, zfail); - yagl_transport_put_out_GLenum(t, zpass); - yagl_transport_end(t); -} - -/* - * glTexImage2D wrapper. id = 68 - */ -void yagl_host_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, int32_t pixels_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 68, 10 * 8, 8 * 8 + yagl_transport_array_size(pixels, pixels_count, 1)); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLint(t, level); - yagl_transport_put_out_GLint(t, internalformat); - yagl_transport_put_out_GLsizei(t, width); - yagl_transport_put_out_GLsizei(t, height); - yagl_transport_put_out_GLint(t, border); - yagl_transport_put_out_GLenum(t, format); - yagl_transport_put_out_GLenum(t, type); - yagl_transport_put_out_array(t, pixels, pixels_count, 1); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(pixels, pixels_count * 1); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glTexParameterf wrapper. id = 69 - */ -void yagl_host_glTexParameterf(GLenum target, GLenum pname, GLfloat param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 69, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLfloat(t, param); - yagl_transport_end(t); -} - -/* - * glTexParameterfv wrapper. id = 70 - */ -void yagl_host_glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 70, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfloat))); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLfloat)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLfloat)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glTexParameteri wrapper. id = 71 - */ -void yagl_host_glTexParameteri(GLenum target, GLenum pname, GLint param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 71, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLint(t, param); - yagl_transport_end(t); -} - -/* - * glTexParameteriv wrapper. id = 72 - */ -void yagl_host_glTexParameteriv(GLenum target, GLenum pname, const GLint *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 72, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLint))); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLint)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLint)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glTexSubImage2D wrapper. id = 73 - */ -void yagl_host_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, int32_t pixels_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 73, 10 * 8, 8 * 8 + yagl_transport_array_size(pixels, pixels_count, 1)); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLint(t, level); - yagl_transport_put_out_GLint(t, xoffset); - yagl_transport_put_out_GLint(t, yoffset); - yagl_transport_put_out_GLsizei(t, width); - yagl_transport_put_out_GLsizei(t, height); - yagl_transport_put_out_GLenum(t, format); - yagl_transport_put_out_GLenum(t, type); - yagl_transport_put_out_array(t, pixels, pixels_count, 1); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(pixels, pixels_count * 1); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glViewport wrapper. id = 74 - */ -void yagl_host_glViewport(GLint x, GLint y, GLsizei width, GLsizei height) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 74, 4 * 8, 4 * 8); - yagl_transport_put_out_GLint(t, x); - yagl_transport_put_out_GLint(t, y); - yagl_transport_put_out_GLsizei(t, width); - yagl_transport_put_out_GLsizei(t, height); - yagl_transport_end(t); -} - -/* - * glTransferArrayYAGL wrapper. id = 75 - */ -void yagl_host_glTransferArrayYAGL(GLuint indx, GLint first, const GLvoid *data, int32_t data_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 75, 4 * 8, 2 * 8 + yagl_transport_array_size(data, data_count, 1)); - yagl_transport_put_out_GLuint(t, indx); - yagl_transport_put_out_GLint(t, first); - yagl_transport_put_out_array(t, data, data_count, 1); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(data, data_count * 1); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glDrawElementsIndicesYAGL wrapper. id = 76 - */ -void yagl_host_glDrawElementsIndicesYAGL(GLenum mode, GLenum type, const GLvoid *indices, int32_t indices_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 76, 4 * 8, 2 * 8 + yagl_transport_array_size(indices, indices_count, 1)); - yagl_transport_put_out_GLenum(t, mode); - yagl_transport_put_out_GLenum(t, type); - yagl_transport_put_out_array(t, indices, indices_count, 1); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(indices, indices_count * 1); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glDrawElementsOffsetYAGL wrapper. id = 77 - */ -void yagl_host_glDrawElementsOffsetYAGL(GLenum mode, GLenum type, GLsizei offset, GLsizei count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 77, 4 * 8, 4 * 8); - yagl_transport_put_out_GLenum(t, mode); - yagl_transport_put_out_GLenum(t, type); - yagl_transport_put_out_GLsizei(t, offset); - yagl_transport_put_out_GLsizei(t, count); - yagl_transport_end(t); -} - -/* - * glGetExtensionStringYAGL wrapper. id = 78 - */ -void yagl_host_glGetExtensionStringYAGL(GLchar *str, int32_t str_maxcount, int32_t *str_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 78, 2 * 8, 0 * 8 + yagl_transport_array_size(str, str_maxcount, sizeof(GLchar))); - yagl_transport_put_in_array(t, str, str_maxcount, str_count, sizeof(GLchar)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(str, str_maxcount * sizeof(GLchar)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGetVertexAttribRangeYAGL wrapper. id = 79 - */ -void yagl_host_glGetVertexAttribRangeYAGL(GLenum type, GLsizei offset, GLsizei count, GLint *range_first, GLsizei *range_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 79, 7 * 8, 7 * 8); - yagl_transport_put_out_GLenum(t, type); - yagl_transport_put_out_GLsizei(t, offset); - yagl_transport_put_out_GLsizei(t, count); - yagl_transport_put_in_GLint(t, range_first); - yagl_transport_put_in_GLsizei(t, range_count); - yagl_transport_end(t); -} - -/* - * glAlphaFunc wrapper. id = 80 - */ -void yagl_host_glAlphaFunc(GLenum func, GLclampf ref) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 80, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, func); - yagl_transport_put_out_GLclampf(t, ref); - yagl_transport_end(t); -} - -/* - * glClipPlanef wrapper. id = 81 - */ -void yagl_host_glClipPlanef(GLenum plane, const GLfloat *equation, int32_t equation_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 81, 3 * 8, 1 * 8 + yagl_transport_array_size(equation, equation_count, sizeof(GLfloat))); - yagl_transport_put_out_GLenum(t, plane); - yagl_transport_put_out_array(t, equation, equation_count, sizeof(GLfloat)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(equation, equation_count * sizeof(GLfloat)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glColor4f wrapper. id = 82 - */ -void yagl_host_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 82, 4 * 8, 4 * 8); - yagl_transport_put_out_GLfloat(t, red); - yagl_transport_put_out_GLfloat(t, green); - yagl_transport_put_out_GLfloat(t, blue); - yagl_transport_put_out_GLfloat(t, alpha); - yagl_transport_end(t); -} - -/* - * glFogf wrapper. id = 83 - */ -void yagl_host_glFogf(GLenum pname, GLfloat param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 83, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLfloat(t, param); - yagl_transport_end(t); -} - -/* - * glFogfv wrapper. id = 84 - */ -void yagl_host_glFogfv(GLenum pname, const GLfloat *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 84, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfloat))); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLfloat)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLfloat)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glFrustumf wrapper. id = 85 - */ -void yagl_host_glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 85, 6 * 8, 6 * 8); - yagl_transport_put_out_GLfloat(t, left); - yagl_transport_put_out_GLfloat(t, right); - yagl_transport_put_out_GLfloat(t, bottom); - yagl_transport_put_out_GLfloat(t, top); - yagl_transport_put_out_GLfloat(t, zNear); - yagl_transport_put_out_GLfloat(t, zFar); - yagl_transport_end(t); -} - -/* - * glGetClipPlanef wrapper. id = 86 - */ -void yagl_host_glGetClipPlanef(GLenum pname, GLfloat *eqn, int32_t eqn_maxcount, int32_t *eqn_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 86, 3 * 8, 1 * 8 + yagl_transport_array_size(eqn, eqn_maxcount, sizeof(GLfloat))); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_array(t, eqn, eqn_maxcount, eqn_count, sizeof(GLfloat)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(eqn, eqn_maxcount * sizeof(GLfloat)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGetLightfv wrapper. id = 87 - */ -void yagl_host_glGetLightfv(GLenum light, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 87, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLfloat))); - yagl_transport_put_out_GLenum(t, light); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLfloat)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(params, params_maxcount * sizeof(GLfloat)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGetMaterialfv wrapper. id = 88 - */ -void yagl_host_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 88, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLfloat))); - yagl_transport_put_out_GLenum(t, face); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLfloat)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(params, params_maxcount * sizeof(GLfloat)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGetTexEnvfv wrapper. id = 89 - */ -void yagl_host_glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 89, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLfloat))); - yagl_transport_put_out_GLenum(t, env); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLfloat)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(params, params_maxcount * sizeof(GLfloat)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glLightModelf wrapper. id = 90 - */ -void yagl_host_glLightModelf(GLenum pname, GLfloat param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 90, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLfloat(t, param); - yagl_transport_end(t); -} - -/* - * glLightModelfv wrapper. id = 91 - */ -void yagl_host_glLightModelfv(GLenum pname, const GLfloat *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 91, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfloat))); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLfloat)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLfloat)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glLightf wrapper. id = 92 - */ -void yagl_host_glLightf(GLenum light, GLenum pname, GLfloat param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 92, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, light); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLfloat(t, param); - yagl_transport_end(t); -} - -/* - * glLightfv wrapper. id = 93 - */ -void yagl_host_glLightfv(GLenum light, GLenum pname, const GLfloat *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 93, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfloat))); - yagl_transport_put_out_GLenum(t, light); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLfloat)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLfloat)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glLoadMatrixf wrapper. id = 94 - */ -void yagl_host_glLoadMatrixf(const GLfloat *m, int32_t m_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 94, 2 * 8, 0 * 8 + yagl_transport_array_size(m, m_count, sizeof(GLfloat))); - yagl_transport_put_out_array(t, m, m_count, sizeof(GLfloat)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(m, m_count * sizeof(GLfloat)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glMaterialf wrapper. id = 95 - */ -void yagl_host_glMaterialf(GLenum face, GLenum pname, GLfloat param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 95, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, face); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLfloat(t, param); - yagl_transport_end(t); -} - -/* - * glMaterialfv wrapper. id = 96 - */ -void yagl_host_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 96, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfloat))); - yagl_transport_put_out_GLenum(t, face); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLfloat)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLfloat)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glMultMatrixf wrapper. id = 97 - */ -void yagl_host_glMultMatrixf(const GLfloat *m, int32_t m_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 97, 2 * 8, 0 * 8 + yagl_transport_array_size(m, m_count, sizeof(GLfloat))); - yagl_transport_put_out_array(t, m, m_count, sizeof(GLfloat)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(m, m_count * sizeof(GLfloat)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glMultiTexCoord4f wrapper. id = 98 - */ -void yagl_host_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat tt, GLfloat r, GLfloat q) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 98, 5 * 8, 5 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLfloat(t, s); - yagl_transport_put_out_GLfloat(t, tt); - yagl_transport_put_out_GLfloat(t, r); - yagl_transport_put_out_GLfloat(t, q); - yagl_transport_end(t); -} - -/* - * glNormal3f wrapper. id = 99 - */ -void yagl_host_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 99, 3 * 8, 3 * 8); - yagl_transport_put_out_GLfloat(t, nx); - yagl_transport_put_out_GLfloat(t, ny); - yagl_transport_put_out_GLfloat(t, nz); - yagl_transport_end(t); -} - -/* - * glOrthof wrapper. id = 100 - */ -void yagl_host_glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 100, 6 * 8, 6 * 8); - yagl_transport_put_out_GLfloat(t, left); - yagl_transport_put_out_GLfloat(t, right); - yagl_transport_put_out_GLfloat(t, bottom); - yagl_transport_put_out_GLfloat(t, top); - yagl_transport_put_out_GLfloat(t, zNear); - yagl_transport_put_out_GLfloat(t, zFar); - yagl_transport_end(t); -} - -/* - * glPointParameterf wrapper. id = 101 - */ -void yagl_host_glPointParameterf(GLenum pname, GLfloat param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 101, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLfloat(t, param); - yagl_transport_end(t); -} - -/* - * glPointParameterfv wrapper. id = 102 - */ -void yagl_host_glPointParameterfv(GLenum pname, const GLfloat *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 102, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfloat))); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLfloat)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLfloat)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glPointSize wrapper. id = 103 - */ -void yagl_host_glPointSize(GLfloat size) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 103, 1 * 8, 1 * 8); - yagl_transport_put_out_GLfloat(t, size); - yagl_transport_end(t); -} - -/* - * glPointSizePointerOES wrapper. id = 104 - */ -void yagl_host_glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 104, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, type); - yagl_transport_put_out_GLsizei(t, stride); - yagl_transport_put_out_va(t, pointer); - yagl_transport_end(t); -} - -/* - * glRotatef wrapper. id = 105 - */ -void yagl_host_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 105, 4 * 8, 4 * 8); - yagl_transport_put_out_GLfloat(t, angle); - yagl_transport_put_out_GLfloat(t, x); - yagl_transport_put_out_GLfloat(t, y); - yagl_transport_put_out_GLfloat(t, z); - yagl_transport_end(t); -} - -/* - * glScalef wrapper. id = 106 - */ -void yagl_host_glScalef(GLfloat x, GLfloat y, GLfloat z) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 106, 3 * 8, 3 * 8); - yagl_transport_put_out_GLfloat(t, x); - yagl_transport_put_out_GLfloat(t, y); - yagl_transport_put_out_GLfloat(t, z); - yagl_transport_end(t); -} - -/* - * glTexEnvf wrapper. id = 107 - */ -void yagl_host_glTexEnvf(GLenum target, GLenum pname, GLfloat param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 107, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLfloat(t, param); - yagl_transport_end(t); -} - -/* - * glTexEnvfv wrapper. id = 108 - */ -void yagl_host_glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 108, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfloat))); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLfloat)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLfloat)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glTranslatef wrapper. id = 109 - */ -void yagl_host_glTranslatef(GLfloat x, GLfloat y, GLfloat z) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 109, 3 * 8, 3 * 8); - yagl_transport_put_out_GLfloat(t, x); - yagl_transport_put_out_GLfloat(t, y); - yagl_transport_put_out_GLfloat(t, z); - yagl_transport_end(t); -} - -/* - * glAlphaFuncx wrapper. id = 110 - */ -void yagl_host_glAlphaFuncx(GLenum func, GLclampx ref) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 110, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, func); - yagl_transport_put_out_GLclampx(t, ref); - yagl_transport_end(t); -} - -/* - * glClearColorx wrapper. id = 111 - */ -void yagl_host_glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 111, 4 * 8, 4 * 8); - yagl_transport_put_out_GLclampx(t, red); - yagl_transport_put_out_GLclampx(t, green); - yagl_transport_put_out_GLclampx(t, blue); - yagl_transport_put_out_GLclampx(t, alpha); - yagl_transport_end(t); -} - -/* - * glClearDepthx wrapper. id = 112 - */ -void yagl_host_glClearDepthx(GLclampx depth) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 112, 1 * 8, 1 * 8); - yagl_transport_put_out_GLclampx(t, depth); - yagl_transport_end(t); -} - -/* - * glClientActiveTexture wrapper. id = 113 - */ -void yagl_host_glClientActiveTexture(GLenum texture) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 113, 1 * 8, 1 * 8); - yagl_transport_put_out_GLenum(t, texture); - yagl_transport_end(t); -} - -/* - * glClipPlanex wrapper. id = 114 - */ -void yagl_host_glClipPlanex(GLenum plane, const GLfixed *equation, int32_t equation_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 114, 3 * 8, 1 * 8 + yagl_transport_array_size(equation, equation_count, sizeof(GLfixed))); - yagl_transport_put_out_GLenum(t, plane); - yagl_transport_put_out_array(t, equation, equation_count, sizeof(GLfixed)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(equation, equation_count * sizeof(GLfixed)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glColor4ub wrapper. id = 115 - */ -void yagl_host_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 115, 4 * 8, 4 * 8); - yagl_transport_put_out_GLubyte(t, red); - yagl_transport_put_out_GLubyte(t, green); - yagl_transport_put_out_GLubyte(t, blue); - yagl_transport_put_out_GLubyte(t, alpha); - yagl_transport_end(t); -} - -/* - * glColor4x wrapper. id = 116 - */ -void yagl_host_glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 116, 4 * 8, 4 * 8); - yagl_transport_put_out_GLfixed(t, red); - yagl_transport_put_out_GLfixed(t, green); - yagl_transport_put_out_GLfixed(t, blue); - yagl_transport_put_out_GLfixed(t, alpha); - yagl_transport_end(t); -} - -/* - * glColorPointer wrapper. id = 117 - */ -void yagl_host_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 117, 4 * 8, 4 * 8); - yagl_transport_put_out_GLint(t, size); - yagl_transport_put_out_GLenum(t, type); - yagl_transport_put_out_GLsizei(t, stride); - yagl_transport_put_out_va(t, pointer); - yagl_transport_end(t); -} - -/* - * glDepthRangex wrapper. id = 118 - */ -void yagl_host_glDepthRangex(GLclampx zNear, GLclampx zFar) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 118, 2 * 8, 2 * 8); - yagl_transport_put_out_GLclampx(t, zNear); - yagl_transport_put_out_GLclampx(t, zFar); - yagl_transport_end(t); -} - -/* - * glDisableClientState wrapper. id = 119 - */ -void yagl_host_glDisableClientState(GLenum array) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 119, 1 * 8, 1 * 8); - yagl_transport_put_out_GLenum(t, array); - yagl_transport_end(t); -} - -/* - * glEnableClientState wrapper. id = 120 - */ -void yagl_host_glEnableClientState(GLenum array) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 120, 1 * 8, 1 * 8); - yagl_transport_put_out_GLenum(t, array); - yagl_transport_end(t); -} - -/* - * glFogx wrapper. id = 121 - */ -void yagl_host_glFogx(GLenum pname, GLfixed param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 121, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLfixed(t, param); - yagl_transport_end(t); -} - -/* - * glFogxv wrapper. id = 122 - */ -void yagl_host_glFogxv(GLenum pname, const GLfixed *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 122, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfixed))); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLfixed)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLfixed)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glFrustumx wrapper. id = 123 - */ -void yagl_host_glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 123, 6 * 8, 6 * 8); - yagl_transport_put_out_GLfixed(t, left); - yagl_transport_put_out_GLfixed(t, right); - yagl_transport_put_out_GLfixed(t, bottom); - yagl_transport_put_out_GLfixed(t, top); - yagl_transport_put_out_GLfixed(t, zNear); - yagl_transport_put_out_GLfixed(t, zFar); - yagl_transport_end(t); -} - -/* - * glGetClipPlanex wrapper. id = 124 - */ -void yagl_host_glGetClipPlanex(GLenum pname, GLfixed *eqn, int32_t eqn_maxcount, int32_t *eqn_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 124, 3 * 8, 1 * 8 + yagl_transport_array_size(eqn, eqn_maxcount, sizeof(GLfixed))); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_array(t, eqn, eqn_maxcount, eqn_count, sizeof(GLfixed)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(eqn, eqn_maxcount * sizeof(GLfixed)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGetFixedv wrapper. id = 125 - */ -void yagl_host_glGetFixedv(GLenum pname, GLfixed *params, int32_t params_maxcount, int32_t *params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 125, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLfixed))); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLfixed)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(params, params_maxcount * sizeof(GLfixed)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGetLightxv wrapper. id = 126 - */ -void yagl_host_glGetLightxv(GLenum light, GLenum pname, GLfixed *params, int32_t params_maxcount, int32_t *params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 126, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLfixed))); - yagl_transport_put_out_GLenum(t, light); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLfixed)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(params, params_maxcount * sizeof(GLfixed)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGetMaterialxv wrapper. id = 127 - */ -void yagl_host_glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params, int32_t params_maxcount, int32_t *params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 127, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLfixed))); - yagl_transport_put_out_GLenum(t, face); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLfixed)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(params, params_maxcount * sizeof(GLfixed)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGetPointerv wrapper. id = 128 - */ -void yagl_host_glGetPointerv(GLenum pname, GLvoid **params) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 128, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_va(t, (void**)params); - yagl_transport_end(t); -} - -/* - * glGetTexEnviv wrapper. id = 129 - */ -void yagl_host_glGetTexEnviv(GLenum env, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 129, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLint))); - yagl_transport_put_out_GLenum(t, env); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLint)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(params, params_maxcount * sizeof(GLint)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGetTexEnvxv wrapper. id = 130 - */ -void yagl_host_glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params, int32_t params_maxcount, int32_t *params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 130, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_maxcount, sizeof(GLfixed))); - yagl_transport_put_out_GLenum(t, env); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_array(t, params, params_maxcount, params_count, sizeof(GLfixed)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_write(params, params_maxcount * sizeof(GLfixed)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glGetTexParameterxv wrapper. id = 131 - */ -void yagl_host_glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 131, 4 * 8, 4 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_in_GLfixed(t, param); - yagl_transport_end(t); -} - -/* - * glLightModelx wrapper. id = 132 - */ -void yagl_host_glLightModelx(GLenum pname, GLfixed param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 132, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLfixed(t, param); - yagl_transport_end(t); -} - -/* - * glLightModelxv wrapper. id = 133 - */ -void yagl_host_glLightModelxv(GLenum pname, const GLfixed *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 133, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfixed))); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLfixed)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLfixed)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glLightx wrapper. id = 134 - */ -void yagl_host_glLightx(GLenum light, GLenum pname, GLfixed param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 134, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, light); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLfixed(t, param); - yagl_transport_end(t); -} - -/* - * glLightxv wrapper. id = 135 - */ -void yagl_host_glLightxv(GLenum light, GLenum pname, const GLfixed *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 135, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfixed))); - yagl_transport_put_out_GLenum(t, light); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLfixed)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLfixed)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glLineWidthx wrapper. id = 136 - */ -void yagl_host_glLineWidthx(GLfixed width) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 136, 1 * 8, 1 * 8); - yagl_transport_put_out_GLfixed(t, width); - yagl_transport_end(t); -} - -/* - * glLoadIdentity wrapper. id = 137 - */ -void yagl_host_glLoadIdentity() -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 137, 0 * 8, 0 * 8); - yagl_transport_end(t); -} - -/* - * glLoadMatrixx wrapper. id = 138 - */ -void yagl_host_glLoadMatrixx(const GLfixed *m, int32_t m_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 138, 2 * 8, 0 * 8 + yagl_transport_array_size(m, m_count, sizeof(GLfixed))); - yagl_transport_put_out_array(t, m, m_count, sizeof(GLfixed)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(m, m_count * sizeof(GLfixed)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glLogicOp wrapper. id = 139 - */ -void yagl_host_glLogicOp(GLenum opcode) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 139, 1 * 8, 1 * 8); - yagl_transport_put_out_GLenum(t, opcode); - yagl_transport_end(t); -} - -/* - * glMaterialx wrapper. id = 140 - */ -void yagl_host_glMaterialx(GLenum face, GLenum pname, GLfixed param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 140, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, face); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLfixed(t, param); - yagl_transport_end(t); -} - -/* - * glMaterialxv wrapper. id = 141 - */ -void yagl_host_glMaterialxv(GLenum face, GLenum pname, const GLfixed *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 141, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfixed))); - yagl_transport_put_out_GLenum(t, face); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLfixed)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLfixed)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glMatrixMode wrapper. id = 142 - */ -void yagl_host_glMatrixMode(GLenum mode) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 142, 1 * 8, 1 * 8); - yagl_transport_put_out_GLenum(t, mode); - yagl_transport_end(t); -} - -/* - * glMultMatrixx wrapper. id = 143 - */ -void yagl_host_glMultMatrixx(const GLfixed *m, int32_t m_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 143, 2 * 8, 0 * 8 + yagl_transport_array_size(m, m_count, sizeof(GLfixed))); - yagl_transport_put_out_array(t, m, m_count, sizeof(GLfixed)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(m, m_count * sizeof(GLfixed)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glMultiTexCoord4x wrapper. id = 144 - */ -void yagl_host_glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed tt, GLfixed r, GLfixed q) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 144, 5 * 8, 5 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLfixed(t, s); - yagl_transport_put_out_GLfixed(t, tt); - yagl_transport_put_out_GLfixed(t, r); - yagl_transport_put_out_GLfixed(t, q); - yagl_transport_end(t); -} - -/* - * glNormal3x wrapper. id = 145 - */ -void yagl_host_glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 145, 3 * 8, 3 * 8); - yagl_transport_put_out_GLfixed(t, nx); - yagl_transport_put_out_GLfixed(t, ny); - yagl_transport_put_out_GLfixed(t, nz); - yagl_transport_end(t); -} - -/* - * glNormalPointer wrapper. id = 146 - */ -void yagl_host_glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 146, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, type); - yagl_transport_put_out_GLsizei(t, stride); - yagl_transport_put_out_va(t, pointer); - yagl_transport_end(t); -} - -/* - * glOrthox wrapper. id = 147 - */ -void yagl_host_glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 147, 6 * 8, 6 * 8); - yagl_transport_put_out_GLfixed(t, left); - yagl_transport_put_out_GLfixed(t, right); - yagl_transport_put_out_GLfixed(t, bottom); - yagl_transport_put_out_GLfixed(t, top); - yagl_transport_put_out_GLfixed(t, zNear); - yagl_transport_put_out_GLfixed(t, zFar); - yagl_transport_end(t); -} - -/* - * glPointParameterx wrapper. id = 148 - */ -void yagl_host_glPointParameterx(GLenum pname, GLfixed param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 148, 2 * 8, 2 * 8); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLfixed(t, param); - yagl_transport_end(t); -} - -/* - * glPointParameterxv wrapper. id = 149 - */ -void yagl_host_glPointParameterxv(GLenum pname, const GLfixed *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 149, 3 * 8, 1 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfixed))); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLfixed)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLfixed)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glPointSizex wrapper. id = 150 - */ -void yagl_host_glPointSizex(GLfixed size) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 150, 1 * 8, 1 * 8); - yagl_transport_put_out_GLfixed(t, size); - yagl_transport_end(t); -} - -/* - * glPolygonOffsetx wrapper. id = 151 - */ -void yagl_host_glPolygonOffsetx(GLfixed factor, GLfixed units) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 151, 2 * 8, 2 * 8); - yagl_transport_put_out_GLfixed(t, factor); - yagl_transport_put_out_GLfixed(t, units); - yagl_transport_end(t); -} - -/* - * glPopMatrix wrapper. id = 152 - */ -void yagl_host_glPopMatrix() -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 152, 0 * 8, 0 * 8); - yagl_transport_end(t); -} - -/* - * glPushMatrix wrapper. id = 153 - */ -void yagl_host_glPushMatrix() -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 153, 0 * 8, 0 * 8); - yagl_transport_end(t); -} - -/* - * glRotatex wrapper. id = 154 - */ -void yagl_host_glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 154, 4 * 8, 4 * 8); - yagl_transport_put_out_GLfixed(t, angle); - yagl_transport_put_out_GLfixed(t, x); - yagl_transport_put_out_GLfixed(t, y); - yagl_transport_put_out_GLfixed(t, z); - yagl_transport_end(t); -} - -/* - * glSampleCoveragex wrapper. id = 155 - */ -void yagl_host_glSampleCoveragex(GLclampx value, GLboolean invert) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 155, 2 * 8, 2 * 8); - yagl_transport_put_out_GLclampx(t, value); - yagl_transport_put_out_GLboolean(t, invert); - yagl_transport_end(t); -} - -/* - * glScalex wrapper. id = 156 - */ -void yagl_host_glScalex(GLfixed x, GLfixed y, GLfixed z) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 156, 3 * 8, 3 * 8); - yagl_transport_put_out_GLfixed(t, x); - yagl_transport_put_out_GLfixed(t, y); - yagl_transport_put_out_GLfixed(t, z); - yagl_transport_end(t); -} - -/* - * glShadeModel wrapper. id = 157 - */ -void yagl_host_glShadeModel(GLenum mode) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 157, 1 * 8, 1 * 8); - yagl_transport_put_out_GLenum(t, mode); - yagl_transport_end(t); -} - -/* - * glTexCoordPointer wrapper. id = 158 - */ -void yagl_host_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 158, 4 * 8, 4 * 8); - yagl_transport_put_out_GLint(t, size); - yagl_transport_put_out_GLenum(t, type); - yagl_transport_put_out_GLsizei(t, stride); - yagl_transport_put_out_va(t, pointer); - yagl_transport_end(t); -} - -/* - * glTexEnvi wrapper. id = 159 - */ -void yagl_host_glTexEnvi(GLenum target, GLenum pname, GLint param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 159, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLint(t, param); - yagl_transport_end(t); -} - -/* - * glTexEnvx wrapper. id = 160 - */ -void yagl_host_glTexEnvx(GLenum target, GLenum pname, GLfixed param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 160, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLfixed(t, param); - yagl_transport_end(t); -} - -/* - * glTexEnviv wrapper. id = 161 - */ -void yagl_host_glTexEnviv(GLenum target, GLenum pname, const GLint *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 161, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLint))); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLint)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLint)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glTexEnvxv wrapper. id = 162 - */ -void yagl_host_glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 162, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfixed))); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLfixed)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLfixed)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glTexParameterx wrapper. id = 163 - */ -void yagl_host_glTexParameterx(GLenum target, GLenum pname, GLfixed param) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 163, 3 * 8, 3 * 8); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_GLfixed(t, param); - yagl_transport_end(t); -} - -/* - * glTexParameterxv wrapper. id = 164 - */ -void yagl_host_glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params, int32_t params_count) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 164, 4 * 8, 2 * 8 + yagl_transport_array_size(params, params_count, sizeof(GLfixed))); - yagl_transport_put_out_GLenum(t, target); - yagl_transport_put_out_GLenum(t, pname); - yagl_transport_put_out_array(t, params, params_count, sizeof(GLfixed)); - if (yagl_transport_direct(t)) { - do { - yagl_transport_probe_read(params, params_count * sizeof(GLfixed)); - } while (!yagl_transport_end(t)); - } else { - yagl_transport_end(t); - } -} - -/* - * glTranslatex wrapper. id = 165 - */ -void yagl_host_glTranslatex(GLfixed x, GLfixed y, GLfixed z) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 165, 3 * 8, 3 * 8); - yagl_transport_put_out_GLfixed(t, x); - yagl_transport_put_out_GLfixed(t, y); - yagl_transport_put_out_GLfixed(t, z); - yagl_transport_end(t); -} - -/* - * glVertexPointer wrapper. id = 166 - */ -void yagl_host_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) -{ - struct yagl_transport *t = yagl_get_transport(); - - yagl_transport_begin(t, yagl_api_id_gles1, 166, 4 * 8, 4 * 8); - yagl_transport_put_out_GLint(t, size); - yagl_transport_put_out_GLenum(t, type); - yagl_transport_put_out_GLsizei(t, stride); - yagl_transport_put_out_va(t, pointer); - yagl_transport_end(t); -} diff --git a/GLESv1_CM/yagl_host_gles1_calls.h b/GLESv1_CM/yagl_host_gles1_calls.h deleted file mode 100644 index d0d1917..0000000 --- a/GLESv1_CM/yagl_host_gles1_calls.h +++ /dev/null @@ -1,841 +0,0 @@ -/* - * Generated by gen-yagl-calls.py, do not modify! - */ -#ifndef _YAGL_HOST_GLES1_CALLS_H_ -#define _YAGL_HOST_GLES1_CALLS_H_ - -#include "yagl_export.h" -#include "yagl_types.h" -#include "GLES/gl.h" - -/* - * glActiveTexture wrapper. id = 1 - */ -void yagl_host_glActiveTexture(GLenum texture); - -/* - * glBindBuffer wrapper. id = 2 - */ -void yagl_host_glBindBuffer(GLenum target, GLuint buffer); - -/* - * glBindFramebuffer wrapper. id = 3 - */ -void yagl_host_glBindFramebuffer(GLenum target, GLuint framebuffer); - -/* - * glBindRenderbuffer wrapper. id = 4 - */ -void yagl_host_glBindRenderbuffer(GLenum target, GLuint renderbuffer); - -/* - * glBindTexture wrapper. id = 5 - */ -void yagl_host_glBindTexture(GLenum target, GLuint texture); - -/* - * glBlendEquation wrapper. id = 6 - */ -void yagl_host_glBlendEquation(GLenum mode); - -/* - * glBlendEquationSeparate wrapper. id = 7 - */ -void yagl_host_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); - -/* - * glBlendFunc wrapper. id = 8 - */ -void yagl_host_glBlendFunc(GLenum sfactor, GLenum dfactor); - -/* - * glBlendFuncSeparate wrapper. id = 9 - */ -void yagl_host_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); - -/* - * glBufferData wrapper. id = 10 - */ -void yagl_host_glBufferData(GLenum target, const GLvoid *data, int32_t data_count, GLenum usage); - -/* - * glBufferSubData wrapper. id = 11 - */ -void yagl_host_glBufferSubData(GLenum target, GLsizei offset, const GLvoid *data, int32_t data_count); - -/* - * glCheckFramebufferStatus wrapper. id = 12 - */ -GLenum yagl_host_glCheckFramebufferStatus(GLenum target); - -/* - * glClear wrapper. id = 13 - */ -void yagl_host_glClear(GLbitfield mask); - -/* - * glClearColor wrapper. id = 14 - */ -void yagl_host_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - -/* - * glClearDepthf wrapper. id = 15 - */ -void yagl_host_glClearDepthf(GLclampf depth); - -/* - * glClearStencil wrapper. id = 16 - */ -void yagl_host_glClearStencil(GLint s); - -/* - * glColorMask wrapper. id = 17 - */ -void yagl_host_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); - -/* - * glCompressedTexImage2D wrapper. id = 18 - */ -void yagl_host_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, const GLvoid *data, int32_t data_count); - -/* - * glCompressedTexSubImage2D wrapper. id = 19 - */ -void yagl_host_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, const GLvoid *data, int32_t data_count); - -/* - * glCopyTexImage2D wrapper. id = 20 - */ -void yagl_host_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); - -/* - * glCopyTexSubImage2D wrapper. id = 21 - */ -void yagl_host_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); - -/* - * glCullFace wrapper. id = 22 - */ -void yagl_host_glCullFace(GLenum mode); - -/* - * glDeleteBuffers wrapper. id = 23 - */ -void yagl_host_glDeleteBuffers(const GLuint *buffers, int32_t buffers_count); - -/* - * glDeleteFramebuffers wrapper. id = 24 - */ -void yagl_host_glDeleteFramebuffers(const GLuint *framebuffers, int32_t framebuffers_count); - -/* - * glDeleteRenderbuffers wrapper. id = 25 - */ -void yagl_host_glDeleteRenderbuffers(const GLuint *renderbuffers, int32_t renderbuffers_count); - -/* - * glDeleteTextures wrapper. id = 26 - */ -void yagl_host_glDeleteTextures(const GLuint *textures, int32_t textures_count); - -/* - * glDepthFunc wrapper. id = 27 - */ -void yagl_host_glDepthFunc(GLenum func); - -/* - * glDepthMask wrapper. id = 28 - */ -void yagl_host_glDepthMask(GLboolean flag); - -/* - * glDepthRangef wrapper. id = 29 - */ -void yagl_host_glDepthRangef(GLclampf zNear, GLclampf zFar); - -/* - * glDisable wrapper. id = 30 - */ -void yagl_host_glDisable(GLenum cap); - -/* - * glDrawArrays wrapper. id = 31 - */ -void yagl_host_glDrawArrays(GLenum mode, GLint first, GLsizei count); - -/* - * glEGLImageTargetTexture2DOES wrapper. id = 32 - */ -void yagl_host_glEGLImageTargetTexture2DOES(GLenum target, yagl_host_handle image); - -/* - * glEnable wrapper. id = 33 - */ -void yagl_host_glEnable(GLenum cap); - -/* - * glFlush wrapper. id = 34 - */ -void yagl_host_glFlush(); - -/* - * glFramebufferTexture2D wrapper. id = 35 - */ -void yagl_host_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); - -/* - * glFramebufferRenderbuffer wrapper. id = 36 - */ -void yagl_host_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); - -/* - * glFrontFace wrapper. id = 37 - */ -void yagl_host_glFrontFace(GLenum mode); - -/* - * glGenBuffers wrapper. id = 38 - */ -void yagl_host_glGenBuffers(GLuint *buffers, int32_t buffers_maxcount, int32_t *buffers_count); - -/* - * glGenerateMipmap wrapper. id = 39 - */ -void yagl_host_glGenerateMipmap(GLenum target); - -/* - * glGenFramebuffers wrapper. id = 40 - */ -void yagl_host_glGenFramebuffers(GLuint *framebuffers, int32_t framebuffers_maxcount, int32_t *framebuffers_count); - -/* - * glGenRenderbuffers wrapper. id = 41 - */ -void yagl_host_glGenRenderbuffers(GLuint *renderbuffers, int32_t renderbuffers_maxcount, int32_t *renderbuffers_count); - -/* - * glGenTextures wrapper. id = 42 - */ -void yagl_host_glGenTextures(GLuint *textures, int32_t textures_maxcount, int32_t *textures_count); - -/* - * glGetBooleanv wrapper. id = 43 - */ -void yagl_host_glGetBooleanv(GLenum pname, GLboolean *params, int32_t params_maxcount, int32_t *params_count); - -/* - * glGetBufferParameteriv wrapper. id = 44 - */ -void yagl_host_glGetBufferParameteriv(GLenum target, GLenum pname, GLint *param); - -/* - * glGetError wrapper. id = 45 - */ -GLenum yagl_host_glGetError(); - -/* - * glGetFloatv wrapper. id = 46 - */ -void yagl_host_glGetFloatv(GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count); - -/* - * glGetFramebufferAttachmentParameteriv wrapper. id = 47 - */ -void yagl_host_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *param); - -/* - * glGetIntegerv wrapper. id = 48 - */ -void yagl_host_glGetIntegerv(GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count); - -/* - * glGetRenderbufferParameteriv wrapper. id = 49 - */ -void yagl_host_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint *param); - -/* - * glGetTexParameterfv wrapper. id = 50 - */ -void yagl_host_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *param); - -/* - * glGetTexParameteriv wrapper. id = 51 - */ -void yagl_host_glGetTexParameteriv(GLenum target, GLenum pname, GLint *param); - -/* - * glHint wrapper. id = 52 - */ -void yagl_host_glHint(GLenum target, GLenum mode); - -/* - * glIsBuffer wrapper. id = 53 - */ -GLboolean yagl_host_glIsBuffer(GLuint buffer); - -/* - * glIsEnabled wrapper. id = 54 - */ -GLboolean yagl_host_glIsEnabled(GLenum cap); - -/* - * glIsFramebuffer wrapper. id = 55 - */ -GLboolean yagl_host_glIsFramebuffer(GLuint framebuffer); - -/* - * glIsRenderbuffer wrapper. id = 56 - */ -GLboolean yagl_host_glIsRenderbuffer(GLuint renderbuffer); - -/* - * glIsTexture wrapper. id = 57 - */ -GLboolean yagl_host_glIsTexture(GLuint texture); - -/* - * glLineWidth wrapper. id = 58 - */ -void yagl_host_glLineWidth(GLfloat width); - -/* - * glPixelStorei wrapper. id = 59 - */ -void yagl_host_glPixelStorei(GLenum pname, GLint param); - -/* - * glPolygonOffset wrapper. id = 60 - */ -void yagl_host_glPolygonOffset(GLfloat factor, GLfloat units); - -/* - * glReadPixels wrapper. id = 61 - */ -void yagl_host_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels, int32_t pixels_maxcount, int32_t *pixels_count); - -/* - * glRenderbufferStorage wrapper. id = 62 - */ -void yagl_host_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); - -/* - * glSampleCoverage wrapper. id = 63 - */ -void yagl_host_glSampleCoverage(GLclampf value, GLboolean invert); - -/* - * glScissor wrapper. id = 64 - */ -void yagl_host_glScissor(GLint x, GLint y, GLsizei width, GLsizei height); - -/* - * glStencilFunc wrapper. id = 65 - */ -void yagl_host_glStencilFunc(GLenum func, GLint ref, GLuint mask); - -/* - * glStencilMask wrapper. id = 66 - */ -void yagl_host_glStencilMask(GLuint mask); - -/* - * glStencilOp wrapper. id = 67 - */ -void yagl_host_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass); - -/* - * glTexImage2D wrapper. id = 68 - */ -void yagl_host_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels, int32_t pixels_count); - -/* - * glTexParameterf wrapper. id = 69 - */ -void yagl_host_glTexParameterf(GLenum target, GLenum pname, GLfloat param); - -/* - * glTexParameterfv wrapper. id = 70 - */ -void yagl_host_glTexParameterfv(GLenum target, GLenum pname, const GLfloat *params, int32_t params_count); - -/* - * glTexParameteri wrapper. id = 71 - */ -void yagl_host_glTexParameteri(GLenum target, GLenum pname, GLint param); - -/* - * glTexParameteriv wrapper. id = 72 - */ -void yagl_host_glTexParameteriv(GLenum target, GLenum pname, const GLint *params, int32_t params_count); - -/* - * glTexSubImage2D wrapper. id = 73 - */ -void yagl_host_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, int32_t pixels_count); - -/* - * glViewport wrapper. id = 74 - */ -void yagl_host_glViewport(GLint x, GLint y, GLsizei width, GLsizei height); - -/* - * glTransferArrayYAGL wrapper. id = 75 - */ -void yagl_host_glTransferArrayYAGL(GLuint indx, GLint first, const GLvoid *data, int32_t data_count); - -/* - * glDrawElementsIndicesYAGL wrapper. id = 76 - */ -void yagl_host_glDrawElementsIndicesYAGL(GLenum mode, GLenum type, const GLvoid *indices, int32_t indices_count); - -/* - * glDrawElementsOffsetYAGL wrapper. id = 77 - */ -void yagl_host_glDrawElementsOffsetYAGL(GLenum mode, GLenum type, GLsizei offset, GLsizei count); - -/* - * glGetExtensionStringYAGL wrapper. id = 78 - */ -void yagl_host_glGetExtensionStringYAGL(GLchar *str, int32_t str_maxcount, int32_t *str_count); - -/* - * glGetVertexAttribRangeYAGL wrapper. id = 79 - */ -void yagl_host_glGetVertexAttribRangeYAGL(GLenum type, GLsizei offset, GLsizei count, GLint *range_first, GLsizei *range_count); - -/* - * glAlphaFunc wrapper. id = 80 - */ -void yagl_host_glAlphaFunc(GLenum func, GLclampf ref); - -/* - * glClipPlanef wrapper. id = 81 - */ -void yagl_host_glClipPlanef(GLenum plane, const GLfloat *equation, int32_t equation_count); - -/* - * glColor4f wrapper. id = 82 - */ -void yagl_host_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); - -/* - * glFogf wrapper. id = 83 - */ -void yagl_host_glFogf(GLenum pname, GLfloat param); - -/* - * glFogfv wrapper. id = 84 - */ -void yagl_host_glFogfv(GLenum pname, const GLfloat *params, int32_t params_count); - -/* - * glFrustumf wrapper. id = 85 - */ -void yagl_host_glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); - -/* - * glGetClipPlanef wrapper. id = 86 - */ -void yagl_host_glGetClipPlanef(GLenum pname, GLfloat *eqn, int32_t eqn_maxcount, int32_t *eqn_count); - -/* - * glGetLightfv wrapper. id = 87 - */ -void yagl_host_glGetLightfv(GLenum light, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count); - -/* - * glGetMaterialfv wrapper. id = 88 - */ -void yagl_host_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count); - -/* - * glGetTexEnvfv wrapper. id = 89 - */ -void yagl_host_glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params, int32_t params_maxcount, int32_t *params_count); - -/* - * glLightModelf wrapper. id = 90 - */ -void yagl_host_glLightModelf(GLenum pname, GLfloat param); - -/* - * glLightModelfv wrapper. id = 91 - */ -void yagl_host_glLightModelfv(GLenum pname, const GLfloat *params, int32_t params_count); - -/* - * glLightf wrapper. id = 92 - */ -void yagl_host_glLightf(GLenum light, GLenum pname, GLfloat param); - -/* - * glLightfv wrapper. id = 93 - */ -void yagl_host_glLightfv(GLenum light, GLenum pname, const GLfloat *params, int32_t params_count); - -/* - * glLoadMatrixf wrapper. id = 94 - */ -void yagl_host_glLoadMatrixf(const GLfloat *m, int32_t m_count); - -/* - * glMaterialf wrapper. id = 95 - */ -void yagl_host_glMaterialf(GLenum face, GLenum pname, GLfloat param); - -/* - * glMaterialfv wrapper. id = 96 - */ -void yagl_host_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params, int32_t params_count); - -/* - * glMultMatrixf wrapper. id = 97 - */ -void yagl_host_glMultMatrixf(const GLfloat *m, int32_t m_count); - -/* - * glMultiTexCoord4f wrapper. id = 98 - */ -void yagl_host_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat tt, GLfloat r, GLfloat q); - -/* - * glNormal3f wrapper. id = 99 - */ -void yagl_host_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz); - -/* - * glOrthof wrapper. id = 100 - */ -void yagl_host_glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); - -/* - * glPointParameterf wrapper. id = 101 - */ -void yagl_host_glPointParameterf(GLenum pname, GLfloat param); - -/* - * glPointParameterfv wrapper. id = 102 - */ -void yagl_host_glPointParameterfv(GLenum pname, const GLfloat *params, int32_t params_count); - -/* - * glPointSize wrapper. id = 103 - */ -void yagl_host_glPointSize(GLfloat size); - -/* - * glPointSizePointerOES wrapper. id = 104 - */ -void yagl_host_glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer); - -/* - * glRotatef wrapper. id = 105 - */ -void yagl_host_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); - -/* - * glScalef wrapper. id = 106 - */ -void yagl_host_glScalef(GLfloat x, GLfloat y, GLfloat z); - -/* - * glTexEnvf wrapper. id = 107 - */ -void yagl_host_glTexEnvf(GLenum target, GLenum pname, GLfloat param); - -/* - * glTexEnvfv wrapper. id = 108 - */ -void yagl_host_glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params, int32_t params_count); - -/* - * glTranslatef wrapper. id = 109 - */ -void yagl_host_glTranslatef(GLfloat x, GLfloat y, GLfloat z); - -/* - * glAlphaFuncx wrapper. id = 110 - */ -void yagl_host_glAlphaFuncx(GLenum func, GLclampx ref); - -/* - * glClearColorx wrapper. id = 111 - */ -void yagl_host_glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); - -/* - * glClearDepthx wrapper. id = 112 - */ -void yagl_host_glClearDepthx(GLclampx depth); - -/* - * glClientActiveTexture wrapper. id = 113 - */ -void yagl_host_glClientActiveTexture(GLenum texture); - -/* - * glClipPlanex wrapper. id = 114 - */ -void yagl_host_glClipPlanex(GLenum plane, const GLfixed *equation, int32_t equation_count); - -/* - * glColor4ub wrapper. id = 115 - */ -void yagl_host_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); - -/* - * glColor4x wrapper. id = 116 - */ -void yagl_host_glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); - -/* - * glColorPointer wrapper. id = 117 - */ -void yagl_host_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); - -/* - * glDepthRangex wrapper. id = 118 - */ -void yagl_host_glDepthRangex(GLclampx zNear, GLclampx zFar); - -/* - * glDisableClientState wrapper. id = 119 - */ -void yagl_host_glDisableClientState(GLenum array); - -/* - * glEnableClientState wrapper. id = 120 - */ -void yagl_host_glEnableClientState(GLenum array); - -/* - * glFogx wrapper. id = 121 - */ -void yagl_host_glFogx(GLenum pname, GLfixed param); - -/* - * glFogxv wrapper. id = 122 - */ -void yagl_host_glFogxv(GLenum pname, const GLfixed *params, int32_t params_count); - -/* - * glFrustumx wrapper. id = 123 - */ -void yagl_host_glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); - -/* - * glGetClipPlanex wrapper. id = 124 - */ -void yagl_host_glGetClipPlanex(GLenum pname, GLfixed *eqn, int32_t eqn_maxcount, int32_t *eqn_count); - -/* - * glGetFixedv wrapper. id = 125 - */ -void yagl_host_glGetFixedv(GLenum pname, GLfixed *params, int32_t params_maxcount, int32_t *params_count); - -/* - * glGetLightxv wrapper. id = 126 - */ -void yagl_host_glGetLightxv(GLenum light, GLenum pname, GLfixed *params, int32_t params_maxcount, int32_t *params_count); - -/* - * glGetMaterialxv wrapper. id = 127 - */ -void yagl_host_glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params, int32_t params_maxcount, int32_t *params_count); - -/* - * glGetPointerv wrapper. id = 128 - */ -void yagl_host_glGetPointerv(GLenum pname, GLvoid **params); - -/* - * glGetTexEnviv wrapper. id = 129 - */ -void yagl_host_glGetTexEnviv(GLenum env, GLenum pname, GLint *params, int32_t params_maxcount, int32_t *params_count); - -/* - * glGetTexEnvxv wrapper. id = 130 - */ -void yagl_host_glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params, int32_t params_maxcount, int32_t *params_count); - -/* - * glGetTexParameterxv wrapper. id = 131 - */ -void yagl_host_glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *param); - -/* - * glLightModelx wrapper. id = 132 - */ -void yagl_host_glLightModelx(GLenum pname, GLfixed param); - -/* - * glLightModelxv wrapper. id = 133 - */ -void yagl_host_glLightModelxv(GLenum pname, const GLfixed *params, int32_t params_count); - -/* - * glLightx wrapper. id = 134 - */ -void yagl_host_glLightx(GLenum light, GLenum pname, GLfixed param); - -/* - * glLightxv wrapper. id = 135 - */ -void yagl_host_glLightxv(GLenum light, GLenum pname, const GLfixed *params, int32_t params_count); - -/* - * glLineWidthx wrapper. id = 136 - */ -void yagl_host_glLineWidthx(GLfixed width); - -/* - * glLoadIdentity wrapper. id = 137 - */ -void yagl_host_glLoadIdentity(); - -/* - * glLoadMatrixx wrapper. id = 138 - */ -void yagl_host_glLoadMatrixx(const GLfixed *m, int32_t m_count); - -/* - * glLogicOp wrapper. id = 139 - */ -void yagl_host_glLogicOp(GLenum opcode); - -/* - * glMaterialx wrapper. id = 140 - */ -void yagl_host_glMaterialx(GLenum face, GLenum pname, GLfixed param); - -/* - * glMaterialxv wrapper. id = 141 - */ -void yagl_host_glMaterialxv(GLenum face, GLenum pname, const GLfixed *params, int32_t params_count); - -/* - * glMatrixMode wrapper. id = 142 - */ -void yagl_host_glMatrixMode(GLenum mode); - -/* - * glMultMatrixx wrapper. id = 143 - */ -void yagl_host_glMultMatrixx(const GLfixed *m, int32_t m_count); - -/* - * glMultiTexCoord4x wrapper. id = 144 - */ -void yagl_host_glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed tt, GLfixed r, GLfixed q); - -/* - * glNormal3x wrapper. id = 145 - */ -void yagl_host_glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz); - -/* - * glNormalPointer wrapper. id = 146 - */ -void yagl_host_glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer); - -/* - * glOrthox wrapper. id = 147 - */ -void yagl_host_glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); - -/* - * glPointParameterx wrapper. id = 148 - */ -void yagl_host_glPointParameterx(GLenum pname, GLfixed param); - -/* - * glPointParameterxv wrapper. id = 149 - */ -void yagl_host_glPointParameterxv(GLenum pname, const GLfixed *params, int32_t params_count); - -/* - * glPointSizex wrapper. id = 150 - */ -void yagl_host_glPointSizex(GLfixed size); - -/* - * glPolygonOffsetx wrapper. id = 151 - */ -void yagl_host_glPolygonOffsetx(GLfixed factor, GLfixed units); - -/* - * glPopMatrix wrapper. id = 152 - */ -void yagl_host_glPopMatrix(); - -/* - * glPushMatrix wrapper. id = 153 - */ -void yagl_host_glPushMatrix(); - -/* - * glRotatex wrapper. id = 154 - */ -void yagl_host_glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z); - -/* - * glSampleCoveragex wrapper. id = 155 - */ -void yagl_host_glSampleCoveragex(GLclampx value, GLboolean invert); - -/* - * glScalex wrapper. id = 156 - */ -void yagl_host_glScalex(GLfixed x, GLfixed y, GLfixed z); - -/* - * glShadeModel wrapper. id = 157 - */ -void yagl_host_glShadeModel(GLenum mode); - -/* - * glTexCoordPointer wrapper. id = 158 - */ -void yagl_host_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); - -/* - * glTexEnvi wrapper. id = 159 - */ -void yagl_host_glTexEnvi(GLenum target, GLenum pname, GLint param); - -/* - * glTexEnvx wrapper. id = 160 - */ -void yagl_host_glTexEnvx(GLenum target, GLenum pname, GLfixed param); - -/* - * glTexEnviv wrapper. id = 161 - */ -void yagl_host_glTexEnviv(GLenum target, GLenum pname, const GLint *params, int32_t params_count); - -/* - * glTexEnvxv wrapper. id = 162 - */ -void yagl_host_glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params, int32_t params_count); - -/* - * glTexParameterx wrapper. id = 163 - */ -void yagl_host_glTexParameterx(GLenum target, GLenum pname, GLfixed param); - -/* - * glTexParameterxv wrapper. id = 164 - */ -void yagl_host_glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params, int32_t params_count); - -/* - * glTranslatex wrapper. id = 165 - */ -void yagl_host_glTranslatex(GLfixed x, GLfixed y, GLfixed z); - -/* - * glVertexPointer wrapper. id = 166 - */ -void yagl_host_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); - -#endif |