GLESv1 extensions

This fix adds support for OpenGLES 1.1 extensions in the codec
layer. This fix also includes bug fixes in GLEncoder (client-state)
and gles android wrapper modules.

Change-Id: I512649724d43e4af9d3ce5d49ae66d9f4da0b823
diff --git a/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp b/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp
index dfa14c9..1bd5de3 100644
--- a/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp
+++ b/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.cpp
@@ -61,12 +61,16 @@
     set_glNormalPointerOffset(s_glNormalPointerOffset);
     set_glTexCoordPointerOffset(s_glTexCoordPointerOffset);
     set_glPointSizePointerOffset(s_glPointSizePointerOffset);
+    set_glWeightPointerOffset(s_glWeightPointerOffset);
+    set_glMatrixIndexPointerOffset(s_glMatrixIndexPointerOffset);
 
     set_glVertexPointerData(s_glVertexPointerData);
     set_glColorPointerData(s_glColorPointerData);
     set_glNormalPointerData(s_glNormalPointerData);
     set_glTexCoordPointerData(s_glTexCoordPointerData);
     set_glPointSizePointerData(s_glPointSizePointerData);
+    set_glWeightPointerData(s_glWeightPointerData);
+    set_glMatrixIndexPointerData(s_glMatrixIndexPointerData);
 
     set_glDrawElementsOffset(s_glDrawElementsOffset);
     set_glDrawElementsData(s_glDrawElementsData);
@@ -104,6 +108,20 @@
     ctx->glPointSizePointerOES(type, stride, (void *)offset);
 }
 
+void GLDecoder::s_glWeightPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset)
+{
+    GLDecoder *ctx = (GLDecoder *)self;
+    ctx->glWeightPointerOES(size, type, stride, (void*)offset);
+}
+
+void GLDecoder::s_glMatrixIndexPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset)
+{
+    GLDecoder *ctx = (GLDecoder *)self;
+    ctx->glMatrixIndexPointerOES(size, type, stride, (void*)offset);
+}
+
+
+
 #define STORE_POINTER_DATA_OR_ABORT(location)    \
     if (ctx->m_contextData != NULL) {   \
         ctx->m_contextData->storePointerData((location), data, datalen); \
@@ -158,6 +176,24 @@
     ctx->glPointSizePointerOES(type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::POINTSIZE_LOCATION));
 }
 
+void GLDecoder::s_glWeightPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
+{
+    GLDecoder *ctx = (GLDecoder *)self;
+
+    STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::WEIGHT_LOCATION);
+
+    ctx->glWeightPointerOES(size, type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::WEIGHT_LOCATION));
+}
+
+void GLDecoder::s_glMatrixIndexPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen)
+{
+    GLDecoder *ctx = (GLDecoder *)self;
+
+    STORE_POINTER_DATA_OR_ABORT(GLDecoderContextData::MATRIXINDEX_LOCATION);
+
+    ctx->glMatrixIndexPointerOES(size, type, 0, ctx->m_contextData->pointerData(GLDecoderContextData::MATRIXINDEX_LOCATION));
+}
+
 void GLDecoder::s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset)
 {
     GLDecoder *ctx = (GLDecoder *)self;
diff --git a/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h b/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h
index 10e4968..5ef946d 100644
--- a/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h
+++ b/tools/emulator/opengl/host/libs/GLESv1_dec/GLDecoder.h
@@ -53,6 +53,12 @@
     static void s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset);
     static void s_glDrawElementsData(void *self, GLenum mode, GLsizei count, GLenum type, void * data, GLuint datalen);
 
+    static void s_glWeightPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen);
+    static void s_glWeightPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset);
+
+    static void s_glMatrixIndexPointerData(void * self, GLint size, GLenum type, GLsizei stride, void * data, GLuint datalen);
+    static void s_glMatrixIndexPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset);
+
     static void * s_getProc(const char *name, void *userData);
 
     GLDecoderContextData *m_contextData;
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp
index 9c70fc1..85def13 100644
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp
+++ b/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.cpp
@@ -17,6 +17,7 @@
 #include "ErrorLog.h"
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include "glUtils.h"
 #include <cutils/log.h>
 
@@ -46,6 +47,8 @@
     m_states[TEXCOORD5_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
     m_states[TEXCOORD6_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
     m_states[TEXCOORD7_LOCATION].glConst = GL_TEXTURE_COORD_ARRAY;
+    m_states[MATRIXINDEX_LOCATION].glConst = GL_MATRIX_INDEX_ARRAY_OES;
+    m_states[WEIGHT_LOCATION].glConst = GL_WEIGHT_ARRAY_OES;
     m_activeTexture = 0;
 
     m_pixelStore.unpack_alignment = 4;
@@ -131,12 +134,55 @@
     case GL_TEXTURE_COORD_ARRAY:
         retval = int (TEXCOORD0_LOCATION + m_activeTexture);
         break;
+    case GL_MATRIX_INDEX_ARRAY_OES:
+        retval = int (MATRIXINDEX_LOCATION);
+        break;
+    case GL_WEIGHT_ARRAY_OES:
+        retval = int (WEIGHT_LOCATION);
+        break;
     default:
         retval = loc;
     }
     return retval;
 }
 
+void GLClientState::getClientStatePointer(GLenum pname, GLvoid** params)
+{
+    const GLClientState::VertexAttribState *state = NULL;
+    switch (pname) {
+    case GL_VERTEX_ARRAY_POINTER: {
+        state = getState(GLClientState::VERTEX_LOCATION);
+        break;
+        }
+    case GL_NORMAL_ARRAY_POINTER: {
+        state = getState(GLClientState::NORMAL_LOCATION);
+        break;
+        }
+    case GL_COLOR_ARRAY_POINTER: {
+        state = getState(GLClientState::COLOR_LOCATION);
+        break;
+        }
+    case GL_TEXTURE_COORD_ARRAY_POINTER: {
+        state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
+        break;
+        }
+    case GL_POINT_SIZE_ARRAY_POINTER_OES: {
+        state = getState(GLClientState::POINTSIZE_LOCATION);
+        break;
+        }
+    case GL_MATRIX_INDEX_ARRAY_POINTER_OES: {
+        state = getState(GLClientState::MATRIXINDEX_LOCATION);
+        break;
+        }
+    case GL_WEIGHT_ARRAY_POINTER_OES: {
+        state = getState(GLClientState::WEIGHT_LOCATION);
+        break;
+        }
+    }
+    if (state && params)
+        *params = state->data;
+}
+
 int GLClientState::setPixelStore(GLenum param, GLint value)
 {
     int retval = 0;
@@ -162,6 +208,8 @@
 }
 
 
+
+
 size_t GLClientState::pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack)
 {
     int pixelsize = glUtilsPixelBitSize(format, type) >> 3;
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h b/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h
index be625d5..b680078 100644
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h
+++ b/tools/emulator/opengl/shared/OpenglCodecCommon/GLClientState.h
@@ -42,7 +42,9 @@
         TEXCOORD5_LOCATION = 9,
         TEXCOORD6_LOCATION = 10,
         TEXCOORD7_LOCATION = 11,
-        LAST_LOCATION = 12
+        MATRIXINDEX_LOCATION = 12,
+        WEIGHT_LOCATION = 13,
+        LAST_LOCATION = 14
     } StateLocation;
 
     typedef struct {
@@ -92,6 +94,21 @@
         }
         return err;
     }
+    int getBuffer(GLenum target)
+    {
+      int ret=0;
+      switch (target) {
+      case GL_ARRAY_BUFFER:
+          ret = m_currentArrayVbo;
+          break;
+      case GL_ELEMENT_ARRAY_BUFFER:
+          ret = m_currentIndexVbo;
+          break;
+      default:
+          ret = -1;
+      }
+      return ret;
+    }
     size_t pixelDataSize(GLsizei width, GLsizei height, GLenum format, GLenum type, int pack);
 
 private:
@@ -104,6 +121,190 @@
 
 
     bool validLocation(int location) { return (location >= 0 && location < m_nLocations); }
+public:
+    void getClientStatePointer(GLenum pname, GLvoid** params);
+    template <class T>
+    bool getClientStateParameter(GLenum param, T* ptr)
+    {
+        bool isClientStateParam = false;
+        switch (param) {
+        case GL_CLIENT_ACTIVE_TEXTURE: {
+            GLint tex = getActiveTexture() + GL_TEXTURE0;
+            *ptr = tex;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_VERTEX_ARRAY_SIZE: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
+            *ptr = state->size;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_VERTEX_ARRAY_TYPE: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
+            *ptr = state->type;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_VERTEX_ARRAY_STRIDE: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
+            *ptr = state->stride;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_COLOR_ARRAY_SIZE: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
+            *ptr = state->size;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_COLOR_ARRAY_TYPE: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
+            *ptr = state->type;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_COLOR_ARRAY_STRIDE: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
+            *ptr = state->stride;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_NORMAL_ARRAY_TYPE: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::NORMAL_LOCATION);
+            *ptr = state->type;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_NORMAL_ARRAY_STRIDE: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::NORMAL_LOCATION);
+            *ptr = state->stride;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_TEXTURE_COORD_ARRAY_SIZE: {
+            const GLClientState::VertexAttribState *state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
+            *ptr = state->size;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_TEXTURE_COORD_ARRAY_TYPE: {
+            const GLClientState::VertexAttribState *state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
+            *ptr = state->type;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_TEXTURE_COORD_ARRAY_STRIDE: {
+            const GLClientState::VertexAttribState *state = getState(getActiveTexture() + GLClientState::TEXCOORD0_LOCATION);
+            *ptr = state->stride;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_POINT_SIZE_ARRAY_TYPE_OES: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::POINTSIZE_LOCATION);
+            *ptr = state->type;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_POINT_SIZE_ARRAY_STRIDE_OES: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::POINTSIZE_LOCATION);
+            *ptr = state->stride;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_MATRIX_INDEX_ARRAY_SIZE_OES: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
+            *ptr = state->size;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_MATRIX_INDEX_ARRAY_TYPE_OES: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
+            *ptr = state->type;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_MATRIX_INDEX_ARRAY_STRIDE_OES: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
+            *ptr = state->stride;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_WEIGHT_ARRAY_SIZE_OES: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
+            *ptr = state->size;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_WEIGHT_ARRAY_TYPE_OES: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
+            *ptr = state->type;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_WEIGHT_ARRAY_STRIDE_OES: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
+            *ptr = state->stride;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_VERTEX_ARRAY_BUFFER_BINDING: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::VERTEX_LOCATION);
+            *ptr = state->bufferObject;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_NORMAL_ARRAY_BUFFER_BINDING: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::NORMAL_LOCATION);
+            *ptr = state->bufferObject;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_COLOR_ARRAY_BUFFER_BINDING: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::COLOR_LOCATION);
+            *ptr = state->bufferObject;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING: {
+            const GLClientState::VertexAttribState *state = getState(getActiveTexture()+GLClientState::TEXCOORD0_LOCATION);
+            *ptr = state->bufferObject;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::POINTSIZE_LOCATION);
+            *ptr = state->bufferObject;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::MATRIXINDEX_LOCATION);
+            *ptr = state->bufferObject;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES: {
+            const GLClientState::VertexAttribState *state = getState(GLClientState::WEIGHT_LOCATION);
+            *ptr = state->bufferObject;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_ARRAY_BUFFER_BINDING: {
+            int buffer = getBuffer(GL_ARRAY_BUFFER);
+            *ptr = buffer;
+            isClientStateParam = true;
+            break;
+            }
+        case GL_ELEMENT_ARRAY_BUFFER_BINDING: {
+            int buffer = getBuffer(GL_ELEMENT_ARRAY_BUFFER);
+            *ptr = buffer;
+            isClientStateParam = true;
+            break;
+            }
+        }
+        return isClientStateParam;
+    }
 
 };
 #endif
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/GLDecoderContextData.h b/tools/emulator/opengl/shared/OpenglCodecCommon/GLDecoderContextData.h
index b087447..eeb4734 100644
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/GLDecoderContextData.h
+++ b/tools/emulator/opengl/shared/OpenglCodecCommon/GLDecoderContextData.h
@@ -35,7 +35,9 @@
         TEXCOORD5_LOCATION = 9,
         TEXCOORD6_LOCATION = 10,
         TEXCOORD7_LOCATION = 11,
-        LAST_LOCATION = 12
+        MATRIXINDEX_LOCATION = 12,
+        WEIGHT_LOCATION = 13,
+        LAST_LOCATION = 14
     } PointerDataLocation;
 
     void storePointerData(PointerDataLocation loc, void *data, size_t len) {
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp b/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp
index 645d08f..9e8dc78 100644
--- a/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp
+++ b/tools/emulator/opengl/shared/OpenglCodecCommon/glUtils.cpp
@@ -49,6 +49,15 @@
 
     switch(param)
     {
+    case GL_DEPTH_BITS:
+    case GL_MAX_CLIP_PLANES:
+    case GL_GREEN_BITS:
+    case GL_MAX_MODELVIEW_STACK_DEPTH:
+    case GL_MAX_PROJECTION_STACK_DEPTH:
+    case GL_MAX_TEXTURE_STACK_DEPTH:
+    case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES:
+    case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES:
+    case GL_NUM_COMPRESSED_TEXTURE_FORMATS:
     case GL_MAX_TEXTURE_SIZE:
     case GL_TEXTURE_GEN_MODE_OES:
     case GL_TEXTURE_ENV_MODE:
@@ -82,11 +91,125 @@
     case GL_TEXTURE_STACK_DEPTH:
     case GL_ALPHA_TEST_FUNC:
     case GL_ALPHA_TEST_REF:
+    case GL_ALPHA_TEST:
     case GL_BLEND_DST:
     case GL_BLEND_SRC:
+    case GL_BLEND:
     case GL_LOGIC_OP_MODE:
     case GL_SCISSOR_TEST:
     case GL_MAX_TEXTURE_UNITS:
+    case GL_ACTIVE_TEXTURE:
+    case GL_ALPHA_BITS:
+    case GL_ARRAY_BUFFER_BINDING:
+    case GL_BLUE_BITS:
+    case GL_CLIENT_ACTIVE_TEXTURE:
+    case GL_CLIP_PLANE0:
+    case GL_CLIP_PLANE1:
+    case GL_CLIP_PLANE2:
+    case GL_CLIP_PLANE3:
+    case GL_CLIP_PLANE4:
+    case GL_CLIP_PLANE5:
+    case GL_COLOR_ARRAY:
+    case GL_COLOR_ARRAY_BUFFER_BINDING:
+    case GL_COLOR_ARRAY_SIZE:
+    case GL_COLOR_ARRAY_STRIDE:
+    case GL_COLOR_ARRAY_TYPE:
+    case GL_COLOR_LOGIC_OP:
+    case GL_COLOR_MATERIAL:
+    case GL_PACK_ALIGNMENT:
+    case GL_PERSPECTIVE_CORRECTION_HINT:
+    case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES:
+    case GL_POINT_SIZE_ARRAY_STRIDE_OES:
+    case GL_POINT_SIZE_ARRAY_TYPE_OES:
+    case GL_POINT_SMOOTH:
+    case GL_POINT_SMOOTH_HINT:
+    case GL_POINT_SPRITE_OES:
+    case GL_COORD_REPLACE_OES:
+    case GL_COMBINE_ALPHA:
+    case GL_SRC0_RGB:
+    case GL_SRC1_RGB:
+    case GL_SRC2_RGB:
+    case GL_OPERAND0_RGB:
+    case GL_OPERAND1_RGB:
+    case GL_OPERAND2_RGB:
+    case GL_SRC0_ALPHA:
+    case GL_SRC1_ALPHA:
+    case GL_SRC2_ALPHA:
+    case GL_OPERAND0_ALPHA:
+    case GL_OPERAND1_ALPHA:
+    case GL_OPERAND2_ALPHA:
+    case GL_RGB_SCALE:
+    case GL_ALPHA_SCALE:
+    case GL_COMBINE_RGB:
+    case GL_POLYGON_OFFSET_FACTOR:
+    case GL_POLYGON_OFFSET_FILL:
+    case GL_POLYGON_OFFSET_UNITS:
+    case GL_RED_BITS:
+    case GL_RESCALE_NORMAL:
+    case GL_SAMPLE_ALPHA_TO_COVERAGE:
+    case GL_SAMPLE_ALPHA_TO_ONE:
+    case GL_SAMPLE_BUFFERS:
+    case GL_SAMPLE_COVERAGE:
+    case GL_SAMPLE_COVERAGE_INVERT:
+    case GL_SAMPLE_COVERAGE_VALUE:
+    case GL_SAMPLES:
+    case GL_STENCIL_BITS:
+    case GL_STENCIL_CLEAR_VALUE:
+    case GL_STENCIL_FUNC:
+    case GL_STENCIL_TEST:
+    case GL_STENCIL_VALUE_MASK:
+    case GL_SUBPIXEL_BITS:
+    case GL_TEXTURE_2D:
+    case GL_TEXTURE_BINDING_2D:
+    case GL_TEXTURE_COORD_ARRAY:
+    case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING:
+    case GL_TEXTURE_COORD_ARRAY_SIZE:
+    case GL_TEXTURE_COORD_ARRAY_STRIDE:
+    case GL_TEXTURE_COORD_ARRAY_TYPE:
+    case GL_UNPACK_ALIGNMENT:
+    case GL_VERTEX_ARRAY:
+    case GL_VERTEX_ARRAY_BUFFER_BINDING:
+    case GL_VERTEX_ARRAY_SIZE:
+    case GL_VERTEX_ARRAY_STRIDE:
+    case GL_VERTEX_ARRAY_TYPE:
+    case GL_SPOT_CUTOFF:
+    case GL_TEXTURE_MIN_FILTER:
+    case GL_TEXTURE_MAG_FILTER:
+    case GL_TEXTURE_WRAP_S:
+    case GL_TEXTURE_WRAP_T:
+    case GL_GENERATE_MIPMAP:
+    case GL_RENDERBUFFER_WIDTH_OES:
+    case GL_RENDERBUFFER_HEIGHT_OES:
+    case GL_RENDERBUFFER_INTERNAL_FORMAT_OES:
+    case GL_RENDERBUFFER_RED_SIZE_OES:
+    case GL_RENDERBUFFER_GREEN_SIZE_OES:
+    case GL_RENDERBUFFER_BLUE_SIZE_OES:
+    case GL_RENDERBUFFER_ALPHA_SIZE_OES:
+    case GL_RENDERBUFFER_DEPTH_SIZE_OES:
+    case GL_RENDERBUFFER_STENCIL_SIZE_OES:
+    case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES:
+    case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES:
+    case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES:
+    case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES:
+    case GL_FENCE_STATUS_NV:
+    case GL_FENCE_CONDITION_NV:
+    case GL_TEXTURE_WIDTH_QCOM:
+    case GL_TEXTURE_HEIGHT_QCOM:
+    case GL_TEXTURE_DEPTH_QCOM:
+    case GL_TEXTURE_INTERNAL_FORMAT_QCOM:
+    case GL_TEXTURE_FORMAT_QCOM:
+    case GL_TEXTURE_TYPE_QCOM:
+    case GL_TEXTURE_IMAGE_VALID_QCOM:
+    case GL_TEXTURE_NUM_LEVELS_QCOM:
+    case GL_TEXTURE_TARGET_QCOM:
+    case GL_TEXTURE_OBJECT_VALID_QCOM:
+    case GL_BLEND_EQUATION_RGB_OES:
+    case GL_BLEND_EQUATION_ALPHA_OES:
+    case GL_BLEND_DST_RGB_OES:
+    case GL_BLEND_SRC_RGB_OES:
+    case GL_BLEND_DST_ALPHA_OES:
+    case GL_BLEND_SRC_ALPHA_OES:
+    case GL_MAX_LIGHTS:
         s = 1;
         break;
     case GL_ALIASED_LINE_WIDTH_RANGE:
@@ -115,12 +238,16 @@
     case GL_SCISSOR_BOX:
     case GL_VIEWPORT:
     case GL_TEXTURE_CROP_RECT_OES:
+    case GL_COLOR_CLEAR_VALUE:
+    case GL_COLOR_WRITEMASK:
+    case GL_AMBIENT_AND_DIFFUSE:
         s =  4;
         break;
     case GL_MODELVIEW_MATRIX:
     case GL_PROJECTION_MATRIX:
     case GL_TEXTURE_MATRIX:
         s = 16;
+	break;
     default:
         ERR("glUtilsParamSize: unknow param 0x%08x\n", param);
         s = 1; // assume 1
diff --git a/tools/emulator/opengl/shared/OpenglCodecCommon/gl_base_types.h b/tools/emulator/opengl/shared/OpenglCodecCommon/gl_base_types.h
new file mode 100644
index 0000000..82acd39
--- /dev/null
+++ b/tools/emulator/opengl/shared/OpenglCodecCommon/gl_base_types.h
@@ -0,0 +1,42 @@
+/*
+* Copyright (C) 2011 The Android Open Source Project
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+#ifndef __GL_BASE_TYPES__H
+#define __GL_BASE_TYPES__H
+
+#include <KHR/khrplatform.h>
+typedef void             GLvoid;
+typedef unsigned int     GLenum;
+typedef unsigned char    GLboolean;
+typedef unsigned int     GLbitfield;
+typedef char             GLchar;
+typedef khronos_int8_t   GLbyte;
+typedef short            GLshort;
+typedef int              GLint;
+typedef int              GLsizei;
+typedef khronos_uint8_t  GLubyte;
+typedef unsigned short   GLushort;
+typedef unsigned int     GLuint;
+typedef khronos_float_t  GLfloat;
+typedef khronos_float_t  GLclampf;
+typedef khronos_int32_t  GLfixed;
+typedef khronos_int32_t  GLclampx;
+typedef khronos_intptr_t GLintptr;
+typedef khronos_ssize_t  GLsizeiptr;
+typedef char *GLstr;
+/* JR XXX Treating this as an in handle - is this correct? */
+typedef void * GLeglImageOES;
+
+#endif
diff --git a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp b/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp
index 01656cf..fe9aa04 100644
--- a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp
+++ b/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.cpp
@@ -40,16 +40,17 @@
     return m_compressedTextureFormats;
 }
 
-
 void GLEncoder::s_glGetIntegerv(void *self, GLenum param, GLint *ptr)
-{
+{ 
     GLEncoder *ctx = (GLEncoder *)self;
+    assert(ctx->m_state != NULL);
     if (param == GL_COMPRESSED_TEXTURE_FORMATS) {
         GLint * compressedTextureFormats = ctx->getCompressedTextureFormats();
         if (ctx->m_num_compressedTextureFormats > 0 && compressedTextureFormats != NULL) {
             memcpy(ptr, compressedTextureFormats, ctx->m_num_compressedTextureFormats * sizeof(GLint));
         }
-    } else {
+    } 
+    else if (!ctx->m_state->getClientStateParameter<GLint>(param,ptr)) {
         ctx->m_glGetIntegerv_enc(self, param, ptr);
     }
 }
@@ -57,6 +58,7 @@
 void GLEncoder::s_glGetFloatv(void *self, GLenum param, GLfloat *ptr)
 {
     GLEncoder *ctx = (GLEncoder *)self;
+    assert(ctx->m_state != NULL);
     if (param == GL_COMPRESSED_TEXTURE_FORMATS) {
         GLint * compressedTextureFormats = ctx->getCompressedTextureFormats();
         if (ctx->m_num_compressedTextureFormats > 0 && compressedTextureFormats != NULL) {
@@ -64,7 +66,8 @@
                 ptr[i] = (GLfloat) compressedTextureFormats[i];
             }
         }
-    } else {
+    }
+    else if (!ctx->m_state->getClientStateParameter<GLfloat>(param,ptr)) {
         ctx->m_glGetFloatv_enc(self, param, ptr);
     }
 }
@@ -72,6 +75,7 @@
 void GLEncoder::s_glGetFixedv(void *self, GLenum param, GLfixed *ptr)
 {
     GLEncoder *ctx = (GLEncoder *)self;
+    assert(ctx->m_state != NULL);
     if (param == GL_COMPRESSED_TEXTURE_FORMATS) {
         GLint * compressedTextureFormats = ctx->getCompressedTextureFormats();
         if (ctx->m_num_compressedTextureFormats > 0 && compressedTextureFormats != NULL) {
@@ -79,7 +83,8 @@
                 ptr[i] =  compressedTextureFormats[i] << 16;
             }
         }
-    } else {
+    }
+    else if (!ctx->m_state->getClientStateParameter<GLfixed>(param,ptr)) {
         ctx->m_glGetFixedv_enc(self, param, ptr);
     }
 }
@@ -87,13 +92,22 @@
 void GLEncoder::s_glGetBooleanv(void *self, GLenum param, GLboolean *ptr)
 {
     GLEncoder *ctx = (GLEncoder *)self;
+    assert(ctx->m_state != NULL);
     if (param == GL_COMPRESSED_TEXTURE_FORMATS) {
         // ignore the command, although we should have generated a GLerror;
-    } else {
+    }
+    else if (!ctx->m_state->getClientStateParameter<GLboolean>(param,ptr)) {
         ctx->m_glGetBooleanv_enc(self, param, ptr);
     }
 }
 
+void GLEncoder::s_glGetPointerv(void * self, GLenum param, GLvoid **params)
+{
+    GLEncoder * ctx = (GLEncoder *) self;
+    assert(ctx->m_state != NULL);
+    ctx->m_state->getClientStatePointer(param,params);
+}
+
 void GLEncoder::s_glFlush(void *self)
 {
     GLEncoder *ctx = (GLEncoder *)self;
@@ -125,57 +139,73 @@
 {
     GLEncoder *ctx = (GLEncoder *)self;
     ctx->m_glPixelStorei_enc(ctx, param, value);
-    assert(m_state != NULL);
+    assert(ctx->m_state != NULL);
     ctx->m_state->setPixelStore(param, value);
 }
 
 void GLEncoder::s_glVertexPointer(void *self, int size, GLenum type, GLsizei stride, void *data)
 {
     GLEncoder *ctx = (GLEncoder *)self;
-    assert(m_state != NULL);
+    assert(ctx->m_state != NULL);
     ctx->m_state->setState(GLClientState::VERTEX_LOCATION, size, type, stride, data);
 }
 
 void GLEncoder::s_glNormalPointer(void *self, GLenum type, GLsizei stride, void *data)
 {
     GLEncoder *ctx = (GLEncoder *)self;
-    assert(m_state != NULL);
+    assert(ctx->m_state != NULL);
     ctx->m_state->setState(GLClientState::NORMAL_LOCATION, 3, type, stride, data);
 }
 
 void GLEncoder::s_glColorPointer(void *self, int size, GLenum type, GLsizei stride, void *data)
 {
     GLEncoder *ctx = (GLEncoder *)self;
-    assert(m_state != NULL);
+    assert(ctx->m_state != NULL);
     ctx->m_state->setState(GLClientState::COLOR_LOCATION, size, type, stride, data);
 }
 
 void GLEncoder::s_glPointsizePointer(void *self, GLenum type, GLsizei stride, void *data)
 {
     GLEncoder *ctx = (GLEncoder *)self;
-    assert(m_state != NULL);
+    assert(ctx->m_state != NULL);
     ctx->m_state->setState(GLClientState::POINTSIZE_LOCATION, 1, type, stride, data);
 }
 
 void GLEncoder::s_glClientActiveTexture(void *self, GLenum texture)
 {
     GLEncoder *ctx = (GLEncoder *)self;
-    assert(m_state != NULL);
+    assert(ctx->m_state != NULL);
     ctx->m_state->setActiveTexture(texture - GL_TEXTURE0);
 }
 
 void GLEncoder::s_glTexcoordPointer(void *self, int size, GLenum type, GLsizei stride, void *data)
 {
     GLEncoder *ctx = (GLEncoder *)self;
-    assert(m_state != NULL);
+    assert(ctx->m_state != NULL);
     int loc = ctx->m_state->getLocation(GL_TEXTURE_COORD_ARRAY);
     ctx->m_state->setState(loc, size, type, stride, data);
 }
 
+void GLEncoder::s_glMatrixIndexPointerOES(void *self, int size, GLenum type, GLsizei stride, void * data)
+{
+    GLEncoder *ctx = (GLEncoder *)self;
+    assert(ctx->m_state != NULL);
+    int loc = ctx->m_state->getLocation(GL_MATRIX_INDEX_ARRAY_OES);
+    ctx->m_state->setState(loc, size, type, stride, data);
+}
+
+void GLEncoder::s_glWeightPointerOES(void * self, int size, GLenum type, GLsizei stride, void * data)
+{
+    GLEncoder *ctx = (GLEncoder *)self;
+    assert(ctx->m_state != NULL);
+    int loc = ctx->m_state->getLocation(GL_WEIGHT_ARRAY_OES);
+    ctx->m_state->setState(loc, size, type, stride, data);
+}
+
 void GLEncoder::s_glEnableClientState(void *self, GLenum state)
 {
     GLEncoder *ctx = (GLEncoder *) self;
-    assert(m_state != NULL);
+    assert(ctx->m_state != NULL);
     int loc = ctx->m_state->getLocation(state);
     ctx->m_state->enable(loc, 1);
 }
@@ -183,15 +213,28 @@
 void GLEncoder::s_glDisableClientState(void *self, GLenum state)
 {
     GLEncoder *ctx = (GLEncoder *) self;
-    assert(m_state != NULL);
+    assert(ctx->m_state != NULL);
     int loc = ctx->m_state->getLocation(state);
     ctx->m_state->enable(loc, 0);
 }
 
+GLboolean GLEncoder::s_glIsEnabled(void *self, GLenum cap)
+{
+    GLEncoder *ctx = (GLEncoder *) self;
+    assert(ctx->m_state != NULL);
+    int loc = ctx->m_state->getLocation(cap);
+    const GLClientState::VertexAttribState *state = ctx->m_state->getState(loc);
+
+    if (state!=NULL)
+      return state->enabled;
+
+    return ctx->m_glIsEnabled_enc(self,cap);
+}
+
 void GLEncoder::s_glBindBuffer(void *self, GLenum target, GLuint id)
 {
     GLEncoder *ctx = (GLEncoder *) self;
-    assert(m_state != NULL);
+    assert(ctx->m_state != NULL);
     ctx->m_state->bindBuffer(target, id);
     // TODO set error state if needed;
     ctx->m_glBindBuffer_enc(self, target, id);
@@ -255,6 +298,14 @@
                     this->glPointSizePointerData(this, state->type, state->stride,
                                                  (unsigned char *) state->data + firstIndex, datalen);
                     break;
+                case GLClientState::WEIGHT_LOCATION:
+                    this->glWeightPointerData(this, state->size, state->type, state->stride,
+                                              (unsigned char * ) state->data + firstIndex, datalen);
+                    break;
+                case GLClientState::MATRIXINDEX_LOCATION:
+                    this->glMatrixIndexPointerData(this, state->size, state->type, state->stride,
+                                                  (unsigned char *)state->data + firstIndex, datalen);
+                    break;
                 }
             } else {
                 this->glBindBuffer(this, GL_ARRAY_BUFFER, state->bufferObject);
@@ -287,6 +338,14 @@
                     this->glTexCoordPointerOffset(this, state->size, state->type, state->stride,
                                                   (GLuint) state->data + firstIndex);
                     break;
+                case GLClientState::WEIGHT_LOCATION:
+                    this->glWeightPointerOffset(this,state->size,state->type,state->stride,
+                                                (GLuint)state->data+firstIndex);
+                    break;
+                case GLClientState::MATRIXINDEX_LOCATION:
+                    this->glMatrixIndexPointerOffset(this,state->size,state->type,state->stride,
+                                              (GLuint)state->data+firstIndex);
+                    break;
                 }
             }
         } else {
@@ -307,7 +366,7 @@
 {
 
     GLEncoder *ctx = (GLEncoder *)self;
-    assert(m_state != NULL);
+    assert(ctx->m_state != NULL);
 
     bool has_immediate_arrays = false;
     bool has_indirect_arrays = false;
@@ -392,15 +451,19 @@
     m_glPointSizePointerOES_enc = set_glPointSizePointerOES(s_glPointsizePointer);
     m_glClientActiveTexture_enc = set_glClientActiveTexture(s_glClientActiveTexture);
     m_glTexCoordPointer_enc = set_glTexCoordPointer(s_glTexcoordPointer);
+    m_glMatrixIndexPointerOES_enc = set_glMatrixIndexPointerOES(s_glMatrixIndexPointerOES);
+    m_glWeightPointerOES_enc = set_glWeightPointerOES(s_glWeightPointerOES);
 
     m_glGetIntegerv_enc = set_glGetIntegerv(s_glGetIntegerv);
     m_glGetFloatv_enc = set_glGetFloatv(s_glGetFloatv);
     m_glGetBooleanv_enc = set_glGetBooleanv(s_glGetBooleanv);
     m_glGetFixedv_enc = set_glGetFixedv(s_glGetFixedv);
+    m_glGetPointerv_enc = set_glGetPointerv(s_glGetPointerv);
 
     m_glBindBuffer_enc = set_glBindBuffer(s_glBindBuffer);
     m_glEnableClientState_enc = set_glEnableClientState(s_glEnableClientState);
     m_glDisableClientState_enc = set_glDisableClientState(s_glDisableClientState);
+    m_glIsEnabled_enc = set_glIsEnabled(s_glIsEnabled);
     m_glDrawArrays_enc = set_glDrawArrays(s_glDrawArrays);
     m_glDrawElements_enc = set_glDrawElements(s_glDrawElements);
     set_glGetString(s_glGetString);
diff --git a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h b/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h
index 71c6089..7c50f61 100644
--- a/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h
+++ b/tools/emulator/opengl/system/GLESv1_enc/GLEncoder.h
@@ -43,6 +43,7 @@
     glGetFloatv_client_proc_t m_glGetFloatv_enc;
     glGetFixedv_client_proc_t m_glGetFixedv_enc;
     glGetBooleanv_client_proc_t m_glGetBooleanv_enc;
+    glGetPointerv_client_proc_t m_glGetPointerv_enc;
 
     glPixelStorei_client_proc_t m_glPixelStorei_enc;
     glVertexPointer_client_proc_t m_glVertexPointer_enc;
@@ -51,10 +52,13 @@
     glPointSizePointerOES_client_proc_t m_glPointSizePointerOES_enc;
     glTexCoordPointer_client_proc_t m_glTexCoordPointer_enc;
     glClientActiveTexture_client_proc_t m_glClientActiveTexture_enc;
+    glMatrixIndexPointerOES_client_proc_t m_glMatrixIndexPointerOES_enc;
+    glWeightPointerOES_client_proc_t m_glWeightPointerOES_enc;
 
     glBindBuffer_client_proc_t m_glBindBuffer_enc;
     glEnableClientState_client_proc_t m_glEnableClientState_enc;
     glDisableClientState_client_proc_t m_glDisableClientState_enc;
+    glIsEnabled_client_proc_t m_glIsEnabled_enc;
     glDrawArrays_client_proc_t m_glDrawArrays_enc;
     glDrawElements_client_proc_t m_glDrawElements_enc;
     glFlush_client_proc_t m_glFlush_enc;
@@ -64,6 +68,7 @@
     static void s_glGetBooleanv(void *self, GLenum pname, GLboolean *ptr);
     static void s_glGetFloatv(void *self, GLenum pname, GLfloat *ptr);
     static void s_glGetFixedv(void *self, GLenum pname, GLfixed *ptr);
+    static void s_glGetPointerv(void *self, GLenum pname, GLvoid **params);
 
     static void s_glFlush(void * self);
     static GLubyte * s_glGetString(void *self, GLenum name);
@@ -73,8 +78,11 @@
     static void s_glPointsizePointer(void *self, GLenum type, GLsizei stride, void *data);
     static void s_glClientActiveTexture(void *self, GLenum texture);
     static void s_glTexcoordPointer(void *self, int size, GLenum type, GLsizei stride, void *data);
+    static void s_glMatrixIndexPointerOES(void *self, int size, GLenum type, GLsizei stride, void * data);
+    static void s_glWeightPointerOES(void *self, int size, GLenum type, GLsizei stride, void * data);
     static void s_glDisableClientState(void *self, GLenum state);
     static void s_glEnableClientState(void *self, GLenum state);
+    static GLboolean s_glIsEnabled(void *self, GLenum cap);
     static void s_glBindBuffer(void *self, GLenum target, GLuint id);
     static void s_glDrawArrays(void *self, GLenum mode, GLint first, GLsizei count);
     static void s_glDrawElements(void *self, GLenum mode, GLsizei count, GLenum type, void *indices);
@@ -109,6 +117,5 @@
             src++;
         }
     }
-
 };
 #endif
diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl.attrib b/tools/emulator/opengl/system/GLESv1_enc/gl.attrib
index 9f776a9..374009c 100644
--- a/tools/emulator/opengl/system/GLESv1_enc/gl.attrib
+++ b/tools/emulator/opengl/system/GLESv1_enc/gl.attrib
@@ -293,6 +293,18 @@
 	flag custom_decoder
 	custom_pack data glUtilsPackPointerData((unsigned char *)ptr, (unsigned char *)data, size, type, stride, datalen)
 
+#void glWeightPointerData(GLint size, GLenum type, GLsizei stride,  void * data, GLuint datalen)
+glWeightPointerData
+  len data datalen
+  custom_pack data glUtilsPackPointerData((unsigned char *)ptr, (unsigned char*)data, size, type, stride, datalen)
+  flag custom_decoder
+
+#void glMatrixIndexPointerData(GLint size, GLenum type, GLsizei stride,  void * data, GLuint datalen)
+glMatrixIndexPointerData
+  len data datalen
+  custom_pack data glUtilsPackPointerData((unsigned char *)ptr, (unsigned char*)data, size, type, stride, datalen)
+  flag custom_decoder
+
 glVertexPointerOffset
 	flag custom_decoder
 glNormalPointerOffset
@@ -303,6 +315,10 @@
 	flag custom_decoder
 glColorPointerOffset
 	flag custom_decoder
+glWeightPointerOffset
+  flag custom_decoder
+glMatrixIndexPointerOffset
+  flag custom_decoder
 
 glDrawElementsData
 	len data datalen
@@ -311,7 +327,14 @@
 glDrawElementsOffset
 	flag custom_decoder
 
-	
+glGetCompressedTextureFormats
+	dir formats out
+	len formats (count * sizeof(GLint))
+	flag custom_decoder
+
+
+#gles1 extensions
+
 #void glDrawTexsvOES(GLshort *coords)
 glDrawTexsvOES
 	len coords (5 * sizeof(GLshort))
@@ -328,14 +351,31 @@
 glDrawTexfvOES
 	len coords (5 * sizeof(GLfloat))
 
-#void glClipPlanexOES(GLenum plane, GLfixed *equation)
+#glClipPlanexOES(GLenum plane, const GLfixed * equation)
 glClipPlanexOES
+	dir equation in
+	len equation (4 * sizeof(GLfixed))
+
+#glClipPlanexIMG(GLenum plane, const GLfixed * equation)
+glClipPlanexIMG
+	dir equation in
 	len equation (4 * sizeof(GLfixed))
 
 #void glFogxvOES(GLenum pname, GLfixed *params)
 glFogxvOES
+	dir params in
 	len params (glUtilsParamSize(pname) * sizeof(GLfixed))
 
+#void glGetClipPlanexOES(GLenum pname,  GLfixed * eqn)
+glGetClipPlanexOES
+	dir eqn out
+	len eqn (4 * sizeof(GLfixed))
+
+#void glGetClipPlanex(GLenum pname,  GLfixed * eqn)
+glGetClipPlanex
+	dir eqn out
+	len eqn (4 * sizeof(GLfixed))
+
 #void glGetFixedvOES(GLenum pname, GLfixed *params)
 glGetFixedvOES
 	dir params out
@@ -363,42 +403,52 @@
 
 #void glLightModelxvOES(GLenum pname, GLfixed *params)
 glLightModelxvOES
+	dir params in
 	len params (glUtilsParamSize(pname) * sizeof(GLfixed))
 
 #void glLightxvOES(GLenum light, GLenum pname, GLfixed *params)
 glLightxvOES
+	dir params in
 	len params (glUtilsParamSize(pname) * sizeof(GLfixed))
 
 #void glLoadMatrixxOES(GLfixed *m)
 glLoadMatrixxOES
+	dir m in
 	len m (16 * sizeof(GLfixed))
 
 #void glMaterialxvOES(GLenum face, GLenum pname, GLfixed *params)
 glMaterialxvOES
+	dir params in
 	len params (glUtilsParamSize(pname) * sizeof(GLfixed))
 
 #void glMultMatrixxOES(GLfixed *m)
 glMultMatrixxOES
+	dir m in
 	len m (16 * sizeof(GLfixed))
 
 #void glPointParameterxvOES(GLenum pname, GLfixed *params)
 glPointParameterxvOES
+	dir params in
 	len params (glUtilsParamSize(pname) * sizeof(GLfixed))
 
 #void glTexEnvxvOES(GLenum target, GLenum pname, GLfixed *params)
 glTexEnvxvOES
+	dir params in
 	len params (glUtilsParamSize(pname) * sizeof(GLfixed))
 
 #void glTexParameterxvOES(GLenum target, GLenum pname, GLfixed *params)
 glTexParameterxvOES
+	dir params in
 	len params (glUtilsParamSize(pname) * sizeof(GLfixed))
 
 #void glDeleteRenderbuffersOES(GLsizei n, GLuint *renderbuffers)
 glDeleteRenderbuffersOES
+	dir renderbuffers in
 	len renderbuffers (n * sizeof(GLuint))
 
 #void glGenRenderbuffersOES(GLsizei n, GLuint *renderbuffers)
 glGenRenderbuffersOES
+	dir renderbuffers in
 	len renderbuffers (n * sizeof(GLuint))
 
 #void glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint *params)
@@ -408,10 +458,12 @@
 
 #void glDeleteFramebuffersOES(GLsizei n, GLuint *framebuffers)
 glDeleteFramebuffersOES
+	dir framebuffers in
 	len framebuffers (n * sizeof(GLuint))
 
 #void glGenFramebuffersOES(GLsizei n, GLuint *framebuffers)
 glGenFramebuffersOES
+	dir framebuffers out
 	len framebuffers (n * sizeof(GLuint))
 
 #void glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint *params)
@@ -423,28 +475,55 @@
 glMapBufferOES
 	flag unsupported
 
+#void glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid ** params)
+glGetBufferPointervOES
+	flag unsupported
+
 #void glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, GLvoid *pointer)
 glMatrixIndexPointerOES
+	len pointer (sizeof(unsigned int))
 	flag unsupported
 
 #void glWeightPointerOES(GLint size, GLenum type, GLsizei stride, GLvoid *pointer)
 glWeightPointerOES
+	len pointer (sizeof(unsigned int))
 	flag unsupported
 
+#glQueryMatrixxOES(GLfixed * mantissa, GLint * exponent)
+glQueryMatrixxOES
+	dir mantissa out
+	len mantissa (16 * sizeof(GLfixed))
+	dir exponent out
+	len exponent (16 * sizeof(GLfixed))
+
 #void glClipPlanefOES(GLenum plane, GLfloat *equation)
 glClipPlanefOES
+	dir equation in
 	len equation (4 * sizeof(GLfloat))
 
+#void glClipPlanefIMG(GLenum plane, GLfloat *equation)
+glClipPlanefIMG
+	dir equation in
+	len equation (4 * sizeof(GLfloat))
+
+#void glGetClipPlanefOES(GLenum pname, GLfloat * eqn)
+glGetClipPlanefOES
+	dir eqn out
+	len eqn (4 * sizeof(GLfloat))
+
 #void glTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params)
 glTexGenfvOES
+	dir params out
 	len params (glUtilsParamSize(pname) * sizeof(GLfloat))
 
 #void glTexGenivOES(GLenum coord, GLenum pname, GLint *params)
 glTexGenivOES
+	dir params out
 	len params (glUtilsParamSize(pname) * sizeof(GLint))
 
 #void glTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params)
 glTexGenxvOES
+	dir params out
 	len params (glUtilsParamSize(pname) * sizeof(GLfixed))
 
 #void glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params)
@@ -462,18 +541,123 @@
 	dir params out
 	len params (glUtilsParamSize(pname) * sizeof(GLfixed))
 
-#glGetClipPlanexOES(...)
-glGetClipPlanexOES
+#void glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays)
+glDeleteVertexArraysOES
+	dir arrays in
+	len arrays (n * sizeof(GLuint))
+
+#void glGenVertexArraysOES(GLsizei n, GLuint *arrays)
+glGenVertexArraysOES
+	dir arrays out
+	len arrays (n * sizeof(GLuint))
+
+#void glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments)
+glDiscardFramebufferEXT
+	dir attachments in
+	len attachments (numAttachments * sizeof(const GLenum))
+
+#void glMultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount)
+glMultiDrawArraysEXT
 	flag unsupported
-#glGetClipPlanefOES(...)
-glGetClipPlanefOES
+	
+#void glMultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount)
+glMultiDrawElementsEXT
 	flag unsupported
 
-#glQueryMatrixxOES
-glQueryMatrixxOES
+#void glMultiDrawArraysSUN(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount)
+glMultiDrawArraysSUN
+	flag unsupported
+	
+#void glMultiDrawElementsSUN(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount)
+glMultiDrawElementsSUN
 	flag unsupported
 
-glGetCompressedTextureFormats
-	dir formats out
-	len formats (count * sizeof(GLint))
-	flag custom_decoder
+#void glDeleteFencesNV(GLsizei n, const GLuint *fences)
+glDeleteFencesNV
+	dir fences in
+	len fences (n * sizeof(GLuint))
+
+#void glGenFencesNV(GLsizei n, GLuint *fences)
+glGenFencesNV
+	dir fences in
+	len fences (n * sizeof(GLuint))
+
+#void glGetFenceivNV(GLuint fence, GLenum pname, GLint *params)
+glGetFenceivNV
+	dir params out
+	len params (glUtilsParamSize(pname) * sizeof(GLint))
+
+#void glGetDriverControlsQCOM(GLint *num, GLsizei size, GLuint *driverControls)
+glGetDriverControlsQCOM
+	dir num out
+	len num (1 * sizeof(GLint))
+	dir driverControls out
+	len driverControls (size * sizeof(GLuint))
+
+#void glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString)
+glGetDriverControlStringQCOM
+	dir length out
+	len length (1 * sizeof(GLsizei))
+	dir driverControlString out
+	len driverControlString (1 * sizeof(GLchar))
+
+#void glExtGetTexturesQCOM(GLuint *textures, GLint maxTextures, GLint *numTextures)
+glExtGetTexturesQCOM
+	dir textures out
+	len textures (maxTextures * sizeof(GLuint))
+	dir numTextures out
+	len numTextures (1 * sizeof(GLint))
+
+#void glExtGetBuffersQCOM(GLuint *buffers, GLint maxBuffers, GLint *numBuffers)
+glExtGetBuffersQCOM
+	dir buffers out
+	len buffers (maxBuffers * sizeof(GLuint))
+	dir numBuffers out
+	len numBuffers (1 * sizeof(GLint))
+
+#void glExtGetRenderbuffersQCOM(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers)
+glExtGetRenderbuffersQCOM
+	dir renderbuffers out
+	len renderbuffers (maxRenderbuffers * sizeof(GLuint))
+	dir numRenderbuffers out
+	len numRenderbuffers (1 * sizeof(GLint))
+
+#void glExtGetFramebuffersQCOM(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers)
+glExtGetFramebuffersQCOM
+	dir framebuffers out
+	len framebuffers (maxFramebuffers * sizeof(GLuint))
+	dir numFramebuffers out
+	len numFramebuffers (1 * sizeof(GLint))
+
+#void glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params)
+glExtGetTexLevelParameterivQCOM
+	dir params out
+	len params (glUtilsParamSize(pname) * sizeof(GLint))
+
+#void glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels)
+glExtGetTexSubImageQCOM
+	dir texels out
+	len texels (depth * pixelDataSize(self, width, height, format, type, 0))
+
+#void glExtGetBufferPointervQCOM(GLenum target, GLvoid **params)
+glExtGetBufferPointervQCOM
+	flag unsupported
+
+#void glExtGetShadersQCOM(GLuint *shaders, GLint maxShaders, GLint *numShaders)
+glExtGetShadersQCOM
+	dir shaders out
+	len shaders (maxShaders * sizeof(GLuint))
+	dir numShaders out
+	len numShaders (1 * sizeof(GLint))
+
+#void glExtGetProgramsQCOM(GLuint *programs, GLint maxPrograms, GLint *numPrograms)
+glExtGetProgramsQCOM
+	dir programs out
+	len programs (maxPrograms * sizeof(GLuint))
+	dir numPrograms out
+	len numPrograms (1 * sizeof(GLint))
+
+#void glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar *source, GLint *length)
+glExtGetProgramBinarySourceQCOM
+	flag unsupported
+
diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl.in b/tools/emulator/opengl/system/GLESv1_enc/gl.in
index a1186d4..0b0e2d2 100644
--- a/tools/emulator/opengl/system/GLESv1_enc/gl.in
+++ b/tools/emulator/opengl/system/GLESv1_enc/gl.in
@@ -148,16 +148,28 @@
 GL_ENTRY(void, glNormalPointerOffset, GLenum type, GLsizei stride,  GLuint offset)
 GL_ENTRY(void, glPointSizePointerOffset, GLenum type, GLsizei stride,  GLuint offset)
 GL_ENTRY(void, glTexCoordPointerOffset, GLint size, GLenum type, GLsizei stride,  GLuint offset)
+GL_ENTRY(void, glWeightPointerOffset, GLint size, GLenum type, GLsizei stride,  GLuint offset)
+GL_ENTRY(void, glMatrixIndexPointerOffset, GLint size, GLenum type, GLsizei stride,  GLuint offset)
 
 GL_ENTRY(void, glVertexPointerData, GLint size, GLenum type, GLsizei stride,  void * data, GLuint datalen)
 GL_ENTRY(void, glColorPointerData, GLint size, GLenum type, GLsizei stride,  void * data, GLuint datalen)
 GL_ENTRY(void, glNormalPointerData, GLenum type, GLsizei stride,  void * data, GLuint datalen)
 GL_ENTRY(void, glTexCoordPointerData, GLint unit, GLint size, GLenum type, GLsizei stride,  void * data, GLuint datalen)
 GL_ENTRY(void, glPointSizePointerData, GLenum type, GLsizei stride,  void * data, GLuint datalen)
+GL_ENTRY(void, glWeightPointerData, GLint size, GLenum type, GLsizei stride,  void * data, GLuint datalen)
+GL_ENTRY(void, glMatrixIndexPointerData, GLint size, GLenum type, GLsizei stride,  void * data, GLuint datalen)
 
 GL_ENTRY(void, glDrawElementsOffset, GLenum mode, GLsizei count, GLenum type, GLuint offset)
 GL_ENTRY(void, glDrawElementsData, GLenum mode, GLsizei count, GLenum type, void *data, GLuint datalen)
 GL_ENTRY(void, glGetCompressedTextureFormats, int count, GLint *formats);
+
+
+
+#opengl extensions
+
+GL_ENTRY(void, glBlendEquationSeparateOES, GLenum modeRGB, GLenum modeAlpha)
+GL_ENTRY(void, glBlendFuncSeparateOES, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
+GL_ENTRY(void, glBlendEquationOES, GLenum mode)
 GL_ENTRY(void, glDrawTexsOES, GLshort x, GLshort y, GLshort z, GLshort width, GLshort height)
 GL_ENTRY(void, glDrawTexiOES, GLint x, GLint y, GLint z, GLint width, GLint height)
 GL_ENTRY(void, glDrawTexxOES, GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height)
@@ -165,4 +177,123 @@
 GL_ENTRY(void, glDrawTexivOES, const GLint *coords)
 GL_ENTRY(void, glDrawTexxvOES, const GLfixed *coords)
 GL_ENTRY(void, glDrawTexfOES, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height)
-GL_ENTRY(void, glDrawTexfvOES, const GLfloat *coords)
\ No newline at end of file
+GL_ENTRY(void, glDrawTexfvOES, const GLfloat *coords)
+GL_ENTRY(void, glEGLImageTargetTexture2DOES, GLenum target, GLeglImageOES image)
+GL_ENTRY(void, glEGLImageTargetRenderbufferStorageOES, GLenum target, GLeglImageOES image)
+GL_ENTRY(void, glAlphaFuncxOES, GLenum func, GLclampx ref)
+GL_ENTRY(void, glClearColorxOES, GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha)
+GL_ENTRY(void, glClearDepthxOES, GLclampx depth)
+GL_ENTRY(void, glClipPlanexOES, GLenum plane, const GLfixed * equation)
+GL_ENTRY(void, glClipPlanexIMG, GLenum plane, const GLfixed * equation)
+GL_ENTRY(void, glColor4xOES, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha)
+GL_ENTRY(void, glDepthRangexOES, GLclampx zNear, GLclampx zFar)
+GL_ENTRY(void, glFogxOES, GLenum pname, GLfixed param)
+GL_ENTRY(void, glFogxvOES, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glFrustumxOES, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
+GL_ENTRY(void, glGetClipPlanexOES, GLenum pname, GLfixed* eqn)
+GL_ENTRY(void, glGetClipPlanex, GLenum pname, GLfixed* eqn)
+GL_ENTRY(void, glGetFixedvOES, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetLightxvOES, GLenum light, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetMaterialxvOES, GLenum face, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetTexEnvxvOES, GLenum env, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glGetTexParameterxvOES, GLenum target, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glLightModelxOES, GLenum pname, GLfixed param)
+GL_ENTRY(void, glLightModelxvOES, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glLightxOES, GLenum light, GLenum pname, GLfixed param)
+GL_ENTRY(void, glLightxvOES, GLenum light, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glLineWidthxOES, GLfixed width)
+GL_ENTRY(void, glLoadMatrixxOES, const GLfixed *m)
+GL_ENTRY(void, glMaterialxOES, GLenum face, GLenum pname, GLfixed param)
+GL_ENTRY(void, glMaterialxvOES, GLenum face, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glMultMatrixxOES, const GLfixed *m)
+GL_ENTRY(void, glMultiTexCoord4xOES, GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q)
+GL_ENTRY(void, glNormal3xOES, GLfixed nx, GLfixed ny, GLfixed nz)
+GL_ENTRY(void, glOrthoxOES, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar)
+GL_ENTRY(void, glPointParameterxOES, GLenum pname, GLfixed param)
+GL_ENTRY(void, glPointParameterxvOES, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glPointSizexOES, GLfixed size)
+GL_ENTRY(void, glPolygonOffsetxOES, GLfixed factor, GLfixed units)
+GL_ENTRY(void, glRotatexOES, GLfixed angle, GLfixed x, GLfixed y, GLfixed z)
+GL_ENTRY(void, glSampleCoveragexOES, GLclampx value, GLboolean invert)
+GL_ENTRY(void, glScalexOES, GLfixed x, GLfixed y, GLfixed z)
+GL_ENTRY(void, glTexEnvxOES, GLenum target, GLenum pname, GLfixed param)
+GL_ENTRY(void, glTexEnvxvOES, GLenum target, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glTexParameterxOES, GLenum target, GLenum pname, GLfixed param)
+GL_ENTRY(void, glTexParameterxvOES, GLenum target, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glTranslatexOES, GLfixed x, GLfixed y, GLfixed z)
+GL_ENTRY(GLboolean, glIsRenderbufferOES, GLuint renderbuffer)
+GL_ENTRY(void, glBindRenderbufferOES, GLenum target, GLuint renderbuffer)
+GL_ENTRY(void, glDeleteRenderbuffersOES, GLsizei n, const GLuint* renderbuffers)
+GL_ENTRY(void, glGenRenderbuffersOES, GLsizei n, GLuint* renderbuffers)
+GL_ENTRY(void, glRenderbufferStorageOES, GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
+GL_ENTRY(void, glGetRenderbufferParameterivOES, GLenum target, GLenum pname, GLint* params)
+GL_ENTRY(GLboolean, glIsFramebufferOES, GLuint framebuffer)
+GL_ENTRY(void, glBindFramebufferOES, GLenum target, GLuint framebuffer)
+GL_ENTRY(void, glDeleteFramebuffersOES, GLsizei n, const GLuint* framebuffers)
+GL_ENTRY(void, glGenFramebuffersOES, GLsizei n, GLuint* framebuffers)
+GL_ENTRY(GLenum, glCheckFramebufferStatusOES, GLenum target)
+GL_ENTRY(void, glFramebufferRenderbufferOES, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
+GL_ENTRY(void, glFramebufferTexture2DOES, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
+GL_ENTRY(void, glGetFramebufferAttachmentParameterivOES, GLenum target, GLenum attachment, GLenum pname, GLint* params)
+GL_ENTRY(void, glGenerateMipmapOES, GLenum target)
+GL_ENTRY(void*, glMapBufferOES, GLenum target, GLenum access)
+GL_ENTRY(GLboolean, glUnmapBufferOES, GLenum target)
+GL_ENTRY(void, glGetBufferPointervOES, GLenum target, GLenum pname, GLvoid* *params)
+GL_ENTRY(void, glCurrentPaletteMatrixOES, GLuint matrixpaletteindex)
+GL_ENTRY(void, glLoadPaletteFromModelViewMatrixOES, void)
+GL_ENTRY(void, glMatrixIndexPointerOES, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer)
+GL_ENTRY(void, glWeightPointerOES, GLint size, GLenum type, GLsizei stride, const GLvoid * pointer)
+GL_ENTRY(GLbitfield, glQueryMatrixxOES, GLfixed * mantissa, GLint * exponent)
+GL_ENTRY(void, glDepthRangefOES, GLclampf zNear, GLclampf zFar)
+GL_ENTRY(void, glFrustumfOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
+GL_ENTRY(void, glOrthofOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar)
+GL_ENTRY(void, glClipPlanefOES, GLenum plane, const GLfloat *equation)
+GL_ENTRY(void, glClipPlanefIMG, GLenum plane, GLfloat *equation)
+GL_ENTRY(void, glGetClipPlanefOES, GLenum pname, GLfloat * eqn)
+GL_ENTRY(void, glClearDepthfOES, GLclampf depth)
+GL_ENTRY(void, glTexGenfOES, GLenum coord, GLenum pname, GLfloat param)
+GL_ENTRY(void, glTexGenfvOES, GLenum coord, GLenum pname, const GLfloat *params)
+GL_ENTRY(void, glTexGeniOES, GLenum coord, GLenum pname, GLint param)
+GL_ENTRY(void, glTexGenivOES, GLenum coord, GLenum pname, const GLint *params)
+GL_ENTRY(void, glTexGenxOES, GLenum coord, GLenum pname, GLfixed param)
+GL_ENTRY(void, glTexGenxvOES, GLenum coord, GLenum pname, const GLfixed *params)
+GL_ENTRY(void, glGetTexGenfvOES, GLenum coord, GLenum pname, GLfloat *params)
+GL_ENTRY(void, glGetTexGenivOES, GLenum coord, GLenum pname, GLint *params)
+GL_ENTRY(void, glGetTexGenxvOES, GLenum coord, GLenum pname, GLfixed *params)
+GL_ENTRY(void, glBindVertexArrayOES, GLuint array)
+GL_ENTRY(void, glDeleteVertexArraysOES, GLsizei n, const GLuint *arrays)
+GL_ENTRY(void, glGenVertexArraysOES, GLsizei n, GLuint *arrays)
+GL_ENTRY(GLboolean, glIsVertexArrayOES, GLuint array)
+GL_ENTRY(void, glDiscardFramebufferEXT, GLenum target, GLsizei numAttachments, const GLenum *attachments)
+GL_ENTRY(void, glMultiDrawArraysEXT, GLenum mode, GLint *first, GLsizei *count, GLsizei primcount)
+GL_ENTRY(void, glMultiDrawElementsEXT, GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount)
+GL_ENTRY(void, glMultiDrawArraysSUN, GLenum mode, GLint *first, GLsizei *count, GLsizei primcount)
+GL_ENTRY(void, glMultiDrawElementsSUN, GLenum mode, const GLsizei *count, GLenum type, const GLvoid **indices, GLsizei primcount)
+GL_ENTRY(void, glRenderbufferStorageMultisampleIMG, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
+GL_ENTRY(void, glFramebufferTexture2DMultisampleIMG, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples)
+GL_ENTRY(void, glDeleteFencesNV, GLsizei n, const GLuint *fences)
+GL_ENTRY(void, glGenFencesNV, GLsizei n, GLuint *fences)
+GL_ENTRY(GLboolean, glIsFenceNV, GLuint fence)
+GL_ENTRY(GLboolean, glTestFenceNV, GLuint fence)
+GL_ENTRY(void, glGetFenceivNV, GLuint fence, GLenum pname, GLint *params)
+GL_ENTRY(void, glFinishFenceNV, GLuint fence)
+GL_ENTRY(void, glSetFenceNV, GLuint fence, GLenum condition)
+GL_ENTRY(void, glGetDriverControlsQCOM, GLint *num, GLsizei size, GLuint *driverControls)
+GL_ENTRY(void, glGetDriverControlStringQCOM, GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString)
+GL_ENTRY(void, glEnableDriverControlQCOM, GLuint driverControl)
+GL_ENTRY(void, glDisableDriverControlQCOM, GLuint driverControl)
+GL_ENTRY(void, glExtGetTexturesQCOM, GLuint *textures, GLint maxTextures, GLint *numTextures)
+GL_ENTRY(void, glExtGetBuffersQCOM, GLuint *buffers, GLint maxBuffers, GLint *numBuffers)
+GL_ENTRY(void, glExtGetRenderbuffersQCOM, GLuint * renderbuffers, GLint maxRenderbuffers, GLint * numRenderbuffers)
+GL_ENTRY(void, glExtGetFramebuffersQCOM, GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers)
+GL_ENTRY(void, glExtGetTexLevelParameterivQCOM, GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params)
+GL_ENTRY(void, glExtTexObjectStateOverrideiQCOM, GLenum target, GLenum pname, GLint param)
+GL_ENTRY(void, glExtGetTexSubImageQCOM, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels)
+GL_ENTRY(void, glExtGetBufferPointervQCOM, GLenum target, GLvoid* *params)
+GL_ENTRY(void, glExtGetShadersQCOM, GLuint *shaders, GLint maxShaders, GLint *numShaders)
+GL_ENTRY(void, glExtGetProgramsQCOM, GLuint *programs, GLint maxPrograms, GLint *numPrograms)
+GL_ENTRY(GLboolean, glExtIsProgramBinaryQCOM, GLuint program)
+GL_ENTRY(void, glExtGetProgramBinarySourceQCOM, GLuint program, GLenum shadertype, GLchar *source, GLint *length)
+GL_ENTRY(void, glStartTilingQCOM, GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask)
+GL_ENTRY(void, glEndTilingQCOM, GLbitfield preserveMask)
+
diff --git a/tools/emulator/opengl/system/GLESv1_enc/gl_types.h b/tools/emulator/opengl/system/GLESv1_enc/gl_types.h
index af7a70d..36fabfb 100644
--- a/tools/emulator/opengl/system/GLESv1_enc/gl_types.h
+++ b/tools/emulator/opengl/system/GLESv1_enc/gl_types.h
@@ -16,25 +16,5 @@
 #ifndef __GL_TYPES__H
 #define __GL_TYPES__H
 
-#include <KHR/khrplatform.h>
-typedef void             GLvoid;
-typedef unsigned int     GLenum;
-typedef unsigned char    GLboolean;
-typedef unsigned int     GLbitfield;
-typedef khronos_int8_t   GLbyte;
-typedef short            GLshort;
-typedef int              GLint;
-typedef int              GLsizei;
-typedef khronos_uint8_t  GLubyte;
-typedef unsigned short   GLushort;
-typedef unsigned int     GLuint;
-typedef khronos_float_t  GLfloat;
-typedef khronos_float_t  GLclampf;
-typedef khronos_int32_t  GLfixed;
-typedef khronos_int32_t  GLclampx;
-typedef khronos_intptr_t GLintptr;
-typedef khronos_ssize_t  GLsizeiptr;
-/* JR XXX Treating this as an in handle - is this correct? */
-typedef void * GLeglImageOES;
-
+#include "gl_base_types.h"
 #endif
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/gles.cpp b/tools/emulator/opengl/tests/gles_android_wrapper/gles.cpp
index 4987237..f0a22aa 100644
--- a/tools/emulator/opengl/tests/gles_android_wrapper/gles.cpp
+++ b/tools/emulator/opengl/tests/gles_android_wrapper/gles.cpp
@@ -100,7 +100,7 @@
 
 void glGetClipPlanef(GLenum pname, GLfloat eqn[4])
 {
-     getDispatch()->glGetClipPlanef(pname, eqn[4]);
+     getDispatch()->glGetClipPlanef(pname, eqn);
 }
 
 void glGetFloatv(GLenum pname, GLfloat *params)
@@ -450,7 +450,7 @@
 
 void glGetClipPlanex(GLenum pname, GLfixed eqn[4])
 {
-     getDispatch()->glGetClipPlanex(pname, eqn[4]);
+     getDispatch()->glGetClipPlanex(pname, eqn);
 }
 
 void glGenBuffers(GLsizei n, GLuint *buffers)
@@ -490,7 +490,7 @@
 
 void glGetPointerv(GLenum pname, GLvoid **params)
 {
-     getDispatch()->glGetPointerv(pname, *params);
+     getDispatch()->glGetPointerv(pname, params);
 }
 
 const GLubyte* glGetString(GLenum name)
@@ -890,7 +890,7 @@
 
 void glGetClipPlanexOES(GLenum pname, GLfixed eqn[4])
 {
-     getDispatch()->glGetClipPlanexOES(pname, eqn[4]);
+     getDispatch()->glGetClipPlanexOES(pname, eqn);
 }
 
 void glGetFixedvOES(GLenum pname, GLfixed *params)
@@ -1150,7 +1150,7 @@
 
 GLbitfield glQueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16])
 {
-     return getDispatch()->glQueryMatrixxOES(mantissa[16], exponent[16]);
+     return getDispatch()->glQueryMatrixxOES(mantissa, exponent);
 }
 
 void glDepthRangefOES(GLclampf zNear, GLclampf zFar)
@@ -1175,7 +1175,7 @@
 
 void glGetClipPlanefOES(GLenum pname, GLfloat eqn[4])
 {
-     getDispatch()->glGetClipPlanefOES(pname, eqn[4]);
+     getDispatch()->glGetClipPlanefOES(pname, eqn);
 }
 
 void glClearDepthfOES(GLclampf depth)
@@ -1375,7 +1375,7 @@
 
 void glExtGetBufferPointervQCOM(GLenum target, GLvoid **params)
 {
-     getDispatch()->glExtGetBufferPointervQCOM(target, *params);
+     getDispatch()->glExtGetBufferPointervQCOM(target, params);
 }
 
 void glExtGetShadersQCOM(GLuint *shaders, GLint maxShaders, GLint *numShaders)
diff --git a/tools/emulator/opengl/tests/gles_android_wrapper/gles_proc.h b/tools/emulator/opengl/tests/gles_android_wrapper/gles_proc.h
index 612b658..afd94b9 100644
--- a/tools/emulator/opengl/tests/gles_android_wrapper/gles_proc.h
+++ b/tools/emulator/opengl/tests/gles_android_wrapper/gles_proc.h
@@ -29,7 +29,7 @@
 typedef void (* glFogf_t) (GLenum, GLfloat);
 typedef void (* glFogfv_t) (GLenum, const GLfloat*);
 typedef void (* glFrustumf_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-typedef void (* glGetClipPlanef_t) (GLenum, GLfloat);
+typedef void (* glGetClipPlanef_t) (GLenum, GLfloat*);
 typedef void (* glGetFloatv_t) (GLenum, GLfloat*);
 typedef void (* glGetLightfv_t) (GLenum, GLenum, GLfloat*);
 typedef void (* glGetMaterialfv_t) (GLenum, GLenum, GLfloat*);
@@ -99,7 +99,7 @@
 typedef void (* glFrustumx_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
 typedef void (* glGetBooleanv_t) (GLenum, GLboolean*);
 typedef void (* glGetBufferParameteriv_t) (GLenum, GLenum, GLint*);
-typedef void (* glGetClipPlanex_t) (GLenum, GLfixed);
+typedef void (* glGetClipPlanex_t) (GLenum, GLfixed*);
 typedef void (* glGenBuffers_t) (GLsizei, GLuint*);
 typedef void (* glGenTextures_t) (GLsizei, GLuint*);
 typedef GLenum (* glGetError_t) ();
@@ -107,7 +107,7 @@
 typedef void (* glGetIntegerv_t) (GLenum, GLint*);
 typedef void (* glGetLightxv_t) (GLenum, GLenum, GLfixed*);
 typedef void (* glGetMaterialxv_t) (GLenum, GLenum, GLfixed*);
-typedef void (* glGetPointerv_t) (GLenum, GLvoid*);
+typedef void (* glGetPointerv_t) (GLenum, GLvoid**);
 typedef const GLubyte* (* glGetString_t) (GLenum);
 typedef void (* glGetTexEnviv_t) (GLenum, GLenum, GLint*);
 typedef void (* glGetTexEnvxv_t) (GLenum, GLenum, GLfixed*);
@@ -187,7 +187,7 @@
 typedef void (* glFogxOES_t) (GLenum, GLfixed);
 typedef void (* glFogxvOES_t) (GLenum, const GLfixed*);
 typedef void (* glFrustumxOES_t) (GLfixed, GLfixed, GLfixed, GLfixed, GLfixed, GLfixed);
-typedef void (* glGetClipPlanexOES_t) (GLenum, GLfixed);
+typedef void (* glGetClipPlanexOES_t) (GLenum, GLfixed*);
 typedef void (* glGetFixedvOES_t) (GLenum, GLfixed*);
 typedef void (* glGetLightxvOES_t) (GLenum, GLenum, GLfixed*);
 typedef void (* glGetMaterialxvOES_t) (GLenum, GLenum, GLfixed*);
@@ -239,12 +239,12 @@
 typedef void (* glLoadPaletteFromModelViewMatrixOES_t) ();
 typedef void (* glMatrixIndexPointerOES_t) (GLint, GLenum, GLsizei, const GLvoid*);
 typedef void (* glWeightPointerOES_t) (GLint, GLenum, GLsizei, const GLvoid*);
-typedef GLbitfield (* glQueryMatrixxOES_t) (GLfixed, GLint);
+typedef GLbitfield (* glQueryMatrixxOES_t) (GLfixed*, GLint*);
 typedef void (* glDepthRangefOES_t) (GLclampf, GLclampf);
 typedef void (* glFrustumfOES_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
 typedef void (* glOrthofOES_t) (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
 typedef void (* glClipPlanefOES_t) (GLenum, const GLfloat*);
-typedef void (* glGetClipPlanefOES_t) (GLenum, GLfloat);
+typedef void (* glGetClipPlanefOES_t) (GLenum, GLfloat*);
 typedef void (* glClearDepthfOES_t) (GLclampf);
 typedef void (* glTexGenfOES_t) (GLenum, GLenum, GLfloat);
 typedef void (* glTexGenfvOES_t) (GLenum, GLenum, const GLfloat*);
@@ -284,7 +284,7 @@
 typedef void (* glExtGetTexLevelParameterivQCOM_t) (GLuint, GLenum, GLint, GLenum, GLint*);
 typedef void (* glExtTexObjectStateOverrideiQCOM_t) (GLenum, GLenum, GLint);
 typedef void (* glExtGetTexSubImageQCOM_t) (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, GLvoid*);
-typedef void (* glExtGetBufferPointervQCOM_t) (GLenum, GLvoid*);
+typedef void (* glExtGetBufferPointervQCOM_t) (GLenum, GLvoid**);
 typedef void (* glExtGetShadersQCOM_t) (GLuint*, GLint, GLint*);
 typedef void (* glExtGetProgramsQCOM_t) (GLuint*, GLint, GLint*);
 typedef GLboolean (* glExtIsProgramBinaryQCOM_t) (GLuint);
diff --git a/tools/emulator/opengl/tests/ut_rendercontrol_enc/Android.mk b/tools/emulator/opengl/tests/ut_rendercontrol_enc/Android.mk
index d9beb85..29a4857 100644
--- a/tools/emulator/opengl/tests/ut_rendercontrol_enc/Android.mk
+++ b/tools/emulator/opengl/tests/ut_rendercontrol_enc/Android.mk
@@ -1,6 +1,7 @@
 LOCAL_PATH := $(call my-dir)
 
 emulatorOpengl := $(LOCAL_PATH)/../..
+EMUGEN := $(BUILD_OUT_EXECUTABLES)/emugen
 #### ut_rendercontrol  ####
 include $(CLEAR_VARS)