[Mesa-dev] [PATCH 7/9] dispatch: GLES1 fixes for _mesa_create_exec_table().

Paul Berry stereotype441 at gmail.com
Tue Oct 30 10:43:00 PDT 2012


Currently, _mesa_create_exec_table() (in api_exec.c) is used for all
APIs except GLES1.  In GLES1, _mesa_create_exec_table_es1() (a code
generated function) is used instead.

In principle, this shouldn't be necessary.  It should be possible for
api_exec.c to contain the logic for populating the dispatch table for
all API's.

This patch paves the way for using _mesa_create_exec_table() instead
of _mesa_create_exec_table_es1(), by making _mesa_create_exec_table()
(and the functions it calls) expose the correct subset of desktop GL
functions for GLES1.
---
 src/mesa/main/api_exec.c     | 255 ++++++++++++++++++++++++++++++-------------
 src/mesa/main/api_loopback.c |   9 +-
 src/mesa/main/bufferobj.c    |   2 +-
 src/mesa/main/shaderapi.c    |  74 +++++++------
 src/mesa/main/texgen.c       |  10 +-
 src/mesa/main/texgen.h       |   2 +-
 src/mesa/main/uniforms.c     |  52 ++++-----
 src/mesa/main/vtxfmt.c       |  51 +++++----
 8 files changed, 291 insertions(+), 164 deletions(-)

diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index a670fba..2d8d82a 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -49,9 +49,11 @@
 #include "depth.h"
 #include "dlist.h"
 #include "drawpix.h"
+#include "drawtex.h"
 #include "rastpos.h"
 #include "enable.h"
 #include "errors.h"
+#include "es1_conversion.h"
 #include "eval.h"
 #include "get.h"
 #include "feedback.h"
@@ -69,6 +71,7 @@
 #include "pixelstore.h"
 #include "points.h"
 #include "polygon.h"
+#include "querymatrix.h"
 #include "queryobj.h"
 #include "readpix.h"
 #include "samplerobj.h"
@@ -128,12 +131,14 @@ _mesa_create_exec_table(struct gl_context *ctx)
    SET_Disable(exec, _mesa_Disable);
    if (ctx->API == API_OPENGL || ctx->API == API_OPENGL_CORE)
       SET_DrawBuffer(exec, _mesa_DrawBuffer);
-   SET_ReadBuffer(exec, _mesa_ReadBuffer);
+   if (ctx->API != API_OPENGLES) {
+      SET_ReadBuffer(exec, _mesa_ReadBuffer);
+   }
    SET_Enable(exec, _mesa_Enable);
    SET_Finish(exec, _mesa_Finish);
    SET_Flush(exec, _mesa_Flush);
    SET_FrontFace(exec, _mesa_FrontFace);
-   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
+   if (ctx->API == API_OPENGL) {
       SET_Frustum(exec, _mesa_Frustum);
    }
    SET_GetError(exec, _mesa_GetError);
@@ -153,6 +158,8 @@ _mesa_create_exec_table(struct gl_context *ctx)
    if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_MatrixMode(exec, _mesa_MatrixMode);
       SET_MultMatrixf(exec, _mesa_MultMatrixf);
+   }
+   if (ctx->API == API_OPENGL) {
       SET_Ortho(exec, _mesa_Ortho);
    }
    SET_PixelStorei(exec, _mesa_PixelStorei);
@@ -185,7 +192,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
       _mesa_init_dlist_dispatch(exec);
    }
 
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_ClearDepth(exec, _mesa_ClearDepth);
    }
 
@@ -197,11 +204,11 @@ _mesa_create_exec_table(struct gl_context *ctx)
    SET_DepthFunc(exec, _mesa_DepthFunc);
    SET_DepthMask(exec, _mesa_DepthMask);
 
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_DepthRange(exec, _mesa_DepthRange);
    }
 
-   if (ctx->API != API_OPENGLES2 && ctx->API != API_OPENGL_CORE) {
+   if (ctx->API == API_OPENGL) {
       _mesa_init_drawpix_dispatch(exec);
    }
    if (ctx->API == API_OPENGL) {
@@ -210,33 +217,37 @@ _mesa_create_exec_table(struct gl_context *ctx)
 
    if (ctx->API == API_OPENGL) {
       SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT);
-      SET_Fogf(exec, _mesa_Fogf);
-      SET_Fogfv(exec, _mesa_Fogfv);
       SET_Fogi(exec, _mesa_Fogi);
       SET_Fogiv(exec, _mesa_Fogiv);
       SET_GetClipPlane(exec, _mesa_GetClipPlane);
    }
+   if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
+      SET_Fogf(exec, _mesa_Fogf);
+      SET_Fogfv(exec, _mesa_Fogfv);
+   }
    SET_GetBooleanv(exec, _mesa_GetBooleanv);
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_GetDoublev(exec, _mesa_GetDoublev);
    }
    SET_GetIntegerv(exec, _mesa_GetIntegerv);
    if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_GetLightfv(exec, _mesa_GetLightfv);
-      SET_GetLightiv(exec, _mesa_GetLightiv);
       SET_GetMaterialfv(exec, _mesa_GetMaterialfv);
-      SET_GetMaterialiv(exec, _mesa_GetMaterialiv);
-      SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple);
       SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv);
       SET_GetTexEnviv(exec, _mesa_GetTexEnviv);
    }
-   if (ctx->API != API_OPENGLES2) {
+   if (ctx->API == API_OPENGL) {
+      SET_GetLightiv(exec, _mesa_GetLightiv);
+      SET_GetMaterialiv(exec, _mesa_GetMaterialiv);
+      SET_GetPolygonStipple(exec, _mesa_GetPolygonStipple);
+   }
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv);
       SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv);
    }
    SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv);
    SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv);
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_GetTexImage(exec, _mesa_GetTexImage);
    }
    SET_Hint(exec, _mesa_Hint);
@@ -247,10 +258,12 @@ _mesa_create_exec_table(struct gl_context *ctx)
    if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_LightModelf(exec, _mesa_LightModelf);
       SET_LightModelfv(exec, _mesa_LightModelfv);
-      SET_LightModeli(exec, _mesa_LightModeli);
-      SET_LightModeliv(exec, _mesa_LightModeliv);
       SET_Lightf(exec, _mesa_Lightf);
       SET_Lightfv(exec, _mesa_Lightfv);
+   }
+   if (ctx->API == API_OPENGL) {
+      SET_LightModeli(exec, _mesa_LightModeli);
+      SET_LightModeliv(exec, _mesa_LightModeliv);
       SET_Lighti(exec, _mesa_Lighti);
       SET_Lightiv(exec, _mesa_Lightiv);
       SET_LoadMatrixd(exec, _mesa_LoadMatrixd);
@@ -263,10 +276,11 @@ _mesa_create_exec_table(struct gl_context *ctx)
    }
 
    if (ctx->API != API_OPENGLES2) {
-      SET_PixelStoref(exec, _mesa_PixelStoref);
-
       SET_PointSize(exec, _mesa_PointSize);
+   }
 
+   if (_mesa_is_desktop_gl(ctx)) {
+      SET_PixelStoref(exec, _mesa_PixelStoref);
       SET_PolygonMode(exec, _mesa_PolygonMode);
    }
 
@@ -278,19 +292,21 @@ _mesa_create_exec_table(struct gl_context *ctx)
    }
 
    SET_ReadPixels(exec, _mesa_ReadPixels);
-   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
+   if (ctx->API == API_OPENGL) {
       SET_Rotated(exec, _mesa_Rotated);
       SET_Scaled(exec, _mesa_Scaled);
       SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT);
+   }
+   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_TexEnvf(exec, _mesa_TexEnvf);
       SET_TexEnviv(exec, _mesa_TexEnviv);
    }
 
    if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
-      _mesa_init_texgen_dispatch(exec);
+      _mesa_init_texgen_dispatch(ctx, exec);
    }
 
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_TexImage1D(exec, _mesa_TexImage1D);
    }
    SET_TexParameterf(exec, _mesa_TexParameterf);
@@ -306,9 +322,11 @@ _mesa_create_exec_table(struct gl_context *ctx)
    SET_GenTextures(exec, _mesa_GenTextures);
    if (ctx->API == API_OPENGL) {
       SET_AreTexturesResident(exec, _mesa_AreTexturesResident);
+   }
+   if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
       SET_ColorPointer(exec, _mesa_ColorPointer);
    }
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D);
       SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D);
       SET_TexSubImage1D(exec, _mesa_TexSubImage1D);
@@ -320,8 +338,10 @@ _mesa_create_exec_table(struct gl_context *ctx)
 
    if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_DisableClientState(exec, _mesa_DisableClientState);
-      SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer);
       SET_EnableClientState(exec, _mesa_EnableClientState);
+   }
+   if (ctx->API == API_OPENGL) {
+      SET_EdgeFlagPointer(exec, _mesa_EdgeFlagPointer);
       SET_IndexPointer(exec, _mesa_IndexPointer);
       SET_InterleavedArrays(exec, _mesa_InterleavedArrays);
    }
@@ -331,18 +351,24 @@ _mesa_create_exec_table(struct gl_context *ctx)
    SET_IsTexture(exec, _mesa_IsTexture);
    if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_NormalPointer(exec, _mesa_NormalPointer);
-      SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures);
       SET_TexCoordPointer(exec, _mesa_TexCoordPointer);
       SET_VertexPointer(exec, _mesa_VertexPointer);
    }
+   if (ctx->API == API_OPENGL) {
+      SET_PrioritizeTextures(exec, _mesa_PrioritizeTextures);
+   }
 
    /* 1.2 */
-   SET_CopyTexSubImage3D(exec, _mesa_CopyTexSubImage3D);
-   SET_TexImage3D(exec, _mesa_TexImage3D);
-   SET_TexSubImage3D(exec, _mesa_TexSubImage3D);
+   if (ctx->API != API_OPENGLES) {
+      SET_CopyTexSubImage3D(exec, _mesa_CopyTexSubImage3D);
+      SET_TexImage3D(exec, _mesa_TexImage3D);
+      SET_TexSubImage3D(exec, _mesa_TexSubImage3D);
+   }
 
    /* OpenGL 1.2  GL_ARB_imaging */
-   SET_BlendColor(exec, _mesa_BlendColor);
+   if (ctx->API != API_OPENGLES) {
+      SET_BlendColor(exec, _mesa_BlendColor);
+   }
    SET_BlendEquation(exec, _mesa_BlendEquation);
    SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT);
 
@@ -353,9 +379,11 @@ _mesa_create_exec_table(struct gl_context *ctx)
    }
 
    /* OpenGL 2.0 */
-   SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate);
-   SET_StencilMaskSeparate(exec, _mesa_StencilMaskSeparate);
-   SET_StencilOpSeparate(exec, _mesa_StencilOpSeparate);
+   if (ctx->API != API_OPENGLES) {
+      SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate);
+      SET_StencilMaskSeparate(exec, _mesa_StencilMaskSeparate);
+      SET_StencilOpSeparate(exec, _mesa_StencilOpSeparate);
+   }
 
    _mesa_init_shader_dispatch(ctx, exec);
    _mesa_init_shader_uniform_dispatch(ctx, exec);
@@ -446,7 +474,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
    /* part of _mesa_init_rastpos_dispatch(exec); */
 
    /* 200. GL_IBM_multimode_draw_arrays */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM);
       SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM);
    }
@@ -466,8 +494,10 @@ _mesa_create_exec_table(struct gl_context *ctx)
       SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE);
    }
    /* Reused by ARB_vertex_array_object / OES_vertex_array_object */
-   SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE);
-   SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE);
+   if (ctx->API != API_OPENGLES) {
+      SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE);
+      SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE);
+   }
 
    /* 262. GL_NV_point_sprite */
    if (_mesa_is_desktop_gl(ctx)) {
@@ -481,23 +511,23 @@ _mesa_create_exec_table(struct gl_context *ctx)
    }
 
    /* 285. GL_NV_primitive_restart */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_PrimitiveRestartIndexNV(exec, _mesa_PrimitiveRestartIndex);
    }
 
    /* ???. GL_EXT_depth_bounds_test */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);
    }
 
    /* 352. GL_EXT_transform_feedback */
    /* ARB 93. GL_ARB_transform_feedback2 */
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       _mesa_init_transform_feedback_dispatch(ctx, exec);
    }
 
    /* 364. GL_EXT_provoking_vertex */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_ProvokingVertexEXT(exec, _mesa_ProvokingVertexEXT);
    }
 
@@ -519,19 +549,23 @@ _mesa_create_exec_table(struct gl_context *ctx)
    SET_SampleCoverageARB(exec, _mesa_SampleCoverageARB);
 
    /* ARB 12. GL_ARB_texture_compression */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_CompressedTexImage1DARB(exec, _mesa_CompressedTexImage1DARB);
       SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB);
       SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB);
    }
 
-   SET_CompressedTexImage3DARB(exec, _mesa_CompressedTexImage3DARB);
+   if (ctx->API != API_OPENGLES) {
+      SET_CompressedTexImage3DARB(exec, _mesa_CompressedTexImage3DARB);
+   }
    SET_CompressedTexImage2DARB(exec, _mesa_CompressedTexImage2DARB);
-   SET_CompressedTexSubImage3DARB(exec, _mesa_CompressedTexSubImage3DARB);
+   if (ctx->API != API_OPENGLES) {
+      SET_CompressedTexSubImage3DARB(exec, _mesa_CompressedTexSubImage3DARB);
+   }
    SET_CompressedTexSubImage2DARB(exec, _mesa_CompressedTexSubImage2DARB);
 
    /* ARB 104. GL_ARB_robustness */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_GetnCompressedTexImageARB(exec, _mesa_GetnCompressedTexImageARB);
    }
 
@@ -576,10 +610,12 @@ _mesa_create_exec_table(struct gl_context *ctx)
    /* glVertexAttrib4NivARB handled in api_loopback.c */
    /* glVertexAttrib4NusvARB handled in api_loopback.c */
    /* glVertexAttrib4NuivARB handled in api_loopback.c */
-   SET_VertexAttribPointerARB(exec, _mesa_VertexAttribPointerARB);
-   SET_EnableVertexAttribArrayARB(exec, _mesa_EnableVertexAttribArrayARB);
-   SET_DisableVertexAttribArrayARB(exec, _mesa_DisableVertexAttribArrayARB);
-   if (ctx->API != API_OPENGLES2) {
+   if (ctx->API != API_OPENGLES) {
+      SET_VertexAttribPointerARB(exec, _mesa_VertexAttribPointerARB);
+      SET_EnableVertexAttribArrayARB(exec, _mesa_EnableVertexAttribArrayARB);
+      SET_DisableVertexAttribArrayARB(exec, _mesa_DisableVertexAttribArrayARB);
+   }
+   if (_mesa_is_desktop_gl(ctx)) {
       /* glBindProgramARB aliases glBindProgramNV */
       /* glDeleteProgramsARB aliases glDeleteProgramsNV */
       /* glGenProgramsARB aliases glGenProgramsNV */
@@ -590,9 +626,11 @@ _mesa_create_exec_table(struct gl_context *ctx)
       SET_ProgramStringARB(exec, _mesa_ProgramStringARB);
    }
 
-   SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB);
-   SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB);
-   SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervARB);
+   if (ctx->API != API_OPENGLES) {
+      SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB);
+      SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB);
+      SET_GetVertexAttribPointervNV(exec, _mesa_GetVertexAttribPointervARB);
+   }
    if (ctx->API == API_OPENGL) {
       SET_ProgramEnvParameter4dARB(exec, _mesa_ProgramEnvParameter4dARB);
       SET_ProgramEnvParameter4dvARB(exec, _mesa_ProgramEnvParameter4dvARB);
@@ -614,25 +652,27 @@ _mesa_create_exec_table(struct gl_context *ctx)
    _mesa_init_bufferobj_dispatch(ctx, exec);
 
    /* ARB 29. GL_ARB_occlusion_query */
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       _mesa_init_queryobj_dispatch(ctx, exec);
    }
 
    /* ARB 37. GL_ARB_draw_buffers */
-   SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB);
+   if (ctx->API != API_OPENGLES) {
+      SET_DrawBuffersARB(exec, _mesa_DrawBuffersARB);
+   }
 
    /* ARB 66. GL_ARB_sync */
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       _mesa_init_sync_dispatch(exec);
    }
 
    /* ARB 104. GL_ARB_debug_output */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       _mesa_init_errors_dispatch(exec);
    }
 
    /* ARB 105. GL_ARB_robustness */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_GetGraphicsResetStatusARB(exec, _mesa_GetGraphicsResetStatusARB);
       SET_GetnPolygonStippleARB(exec, _mesa_GetnPolygonStippleARB);
       SET_GetnTexImageARB(exec, _mesa_GetnTexImageARB);
@@ -663,16 +703,18 @@ _mesa_create_exec_table(struct gl_context *ctx)
    SET_DeleteFramebuffersEXT(exec, _mesa_DeleteFramebuffersEXT);
    SET_GenFramebuffersEXT(exec, _mesa_GenFramebuffersEXT);
    SET_CheckFramebufferStatusEXT(exec, _mesa_CheckFramebufferStatusEXT);
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_FramebufferTexture1DEXT(exec, _mesa_FramebufferTexture1DEXT);
    }
    SET_FramebufferTexture2DEXT(exec, _mesa_FramebufferTexture2DEXT);
-   SET_FramebufferTexture3DEXT(exec, _mesa_FramebufferTexture3DEXT);
+   if (ctx->API != API_OPENGLES) {
+      SET_FramebufferTexture3DEXT(exec, _mesa_FramebufferTexture3DEXT);
+   }
    SET_FramebufferRenderbufferEXT(exec, _mesa_FramebufferRenderbufferEXT);
    SET_GetFramebufferAttachmentParameterivEXT(exec, _mesa_GetFramebufferAttachmentParameterivEXT);
    SET_GenerateMipmapEXT(exec, _mesa_GenerateMipmapEXT);
 
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT);
    }
 
@@ -683,19 +725,19 @@ _mesa_create_exec_table(struct gl_context *ctx)
    }
 
    /* GL_MESA_texture_array / GL_EXT_texture_array */
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       SET_FramebufferTextureLayerEXT(exec, _mesa_FramebufferTextureLayerEXT);
    }
 
    /* GL_ATI_separate_stencil */
-   if (ctx->API == API_OPENGL) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_StencilFuncSeparateATI(exec, _mesa_StencilFuncSeparateATI);
    }
 
    /* The ARB_fbo functions are the union of
     * GL_EXT_fbo, GL_EXT_framebuffer_blit, GL_EXT_texture_array
     */
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       SET_RenderbufferStorageMultisample(exec, _mesa_RenderbufferStorageMultisample);
    }
 
@@ -704,13 +746,15 @@ _mesa_create_exec_table(struct gl_context *ctx)
    SET_FlushMappedBufferRange(exec, _mesa_FlushMappedBufferRange);
 
    /* GL_ARB_copy_buffer */
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       SET_CopyBufferSubData(exec, _mesa_CopyBufferSubData);
    }
 
    /* GL_ARB_vertex_array_object / GL_OES_vertex_array_object */
-   SET_BindVertexArray(exec, _mesa_BindVertexArray);
-   SET_GenVertexArrays(exec, _mesa_GenVertexArrays);
+   if (ctx->API != API_OPENGLES) {
+      SET_BindVertexArray(exec, _mesa_BindVertexArray);
+      SET_GenVertexArrays(exec, _mesa_GenVertexArrays);
+   }
 
    /* GL_EXT_draw_buffers2 */
    if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
@@ -725,7 +769,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
    }
 
    /* GL_NV_conditional_render */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_BeginConditionalRenderNV(exec, _mesa_BeginConditionalRender);
       SET_EndConditionalRenderNV(exec, _mesa_EndConditionalRender);
    }
@@ -733,18 +777,18 @@ _mesa_create_exec_table(struct gl_context *ctx)
    SET_EGLImageTargetTexture2DOES(exec, _mesa_EGLImageTargetTexture2DOES);
    SET_EGLImageTargetRenderbufferStorageOES(exec, _mesa_EGLImageTargetRenderbufferStorageOES);
 
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_ObjectPurgeableAPPLE(exec, _mesa_ObjectPurgeableAPPLE);
       SET_ObjectUnpurgeableAPPLE(exec, _mesa_ObjectUnpurgeableAPPLE);
       SET_GetObjectParameterivAPPLE(exec, _mesa_GetObjectParameterivAPPLE);
    }
 
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_FramebufferTextureARB(exec, _mesa_FramebufferTextureARB);
       SET_FramebufferTextureFaceARB(exec, _mesa_FramebufferTextureFaceARB);
    }
 
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_ClampColorARB(exec, _mesa_ClampColorARB);
    }
 
@@ -753,7 +797,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
       SET_ClearColorIiEXT(exec, _mesa_ClearColorIiEXT);
       SET_ClearColorIuiEXT(exec, _mesa_ClearColorIuiEXT);
    }
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_GetTexParameterIivEXT(exec, _mesa_GetTexParameterIiv);
       SET_GetTexParameterIuivEXT(exec, _mesa_GetTexParameterIuiv);
       SET_TexParameterIivEXT(exec, _mesa_TexParameterIiv);
@@ -761,14 +805,14 @@ _mesa_create_exec_table(struct gl_context *ctx)
    }
 
    /* GL_EXT_gpu_shader4 / OpenGL 3.0 */
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       SET_GetVertexAttribIivEXT(exec, _mesa_GetVertexAttribIiv);
       SET_GetVertexAttribIuivEXT(exec, _mesa_GetVertexAttribIuiv);
       SET_VertexAttribIPointerEXT(exec, _mesa_VertexAttribIPointer);
    }
 
    /* GL 3.0 (functions not covered by other extensions) */
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       SET_ClearBufferiv(exec, _mesa_ClearBufferiv);
       SET_ClearBufferuiv(exec, _mesa_ClearBufferuiv);
       SET_ClearBufferfv(exec, _mesa_ClearBufferfv);
@@ -777,12 +821,12 @@ _mesa_create_exec_table(struct gl_context *ctx)
    }
 
    /* GL_ARB_instanced_arrays */
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       SET_VertexAttribDivisorARB(exec, _mesa_VertexAttribDivisor);
    }
 
    /* GL_ARB_draw_buffer_blend */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_BlendFunciARB(exec, _mesa_BlendFunci);
       SET_BlendFuncSeparateiARB(exec, _mesa_BlendFuncSeparatei);
       SET_BlendEquationiARB(exec, _mesa_BlendEquationi);
@@ -790,17 +834,17 @@ _mesa_create_exec_table(struct gl_context *ctx)
    }
 
    /* GL_NV_texture_barrier */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_TextureBarrierNV(exec, _mesa_TextureBarrierNV);
    }
  
    /* GL_ARB_texture_buffer_object */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_TexBufferARB(exec, _mesa_TexBuffer);
    }
 
    /* GL_ARB_texture_storage */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_TexStorage1D(exec, _mesa_TexStorage1D);
       SET_TextureStorage1DEXT(exec, _mesa_TextureStorage1DEXT);
    }
@@ -813,7 +857,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
       SET_TextureStorage3DEXT(exec, _mesa_TextureStorage3DEXT);
    }
 
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       _mesa_init_sampler_object_dispatch(ctx, exec);
    }
 
@@ -827,5 +871,66 @@ _mesa_create_exec_table(struct gl_context *ctx)
       SET_InvalidateFramebuffer(exec, _mesa_InvalidateFramebuffer);
    }
 
+#if FEATURE_ES1
+   if (ctx->API == API_OPENGLES) {
+      SET_AlphaFuncxOES(exec, _es_AlphaFuncx);
+      SET_ClearColorxOES(exec, _es_ClearColorx);
+      SET_ClearDepthxOES(exec, _es_ClearDepthx);
+      SET_ClipPlanefOES(exec, _es_ClipPlanef);
+      SET_ClipPlanexOES(exec, _es_ClipPlanex);
+      SET_Color4xOES(exec, _es_Color4x);
+      SET_DepthRangexOES(exec, _es_DepthRangex);
+      SET_DrawTexfOES(exec, _mesa_DrawTexf);
+      SET_DrawTexfvOES(exec, _mesa_DrawTexfv);
+      SET_DrawTexiOES(exec, _mesa_DrawTexi);
+      SET_DrawTexivOES(exec, _mesa_DrawTexiv);
+      SET_DrawTexsOES(exec, _mesa_DrawTexs);
+      SET_DrawTexsvOES(exec, _mesa_DrawTexsv);
+      SET_DrawTexxOES(exec, _es_DrawTexxOES);
+      SET_DrawTexxvOES(exec, _es_DrawTexxvOES);
+      SET_FogxOES(exec, _es_Fogx);
+      SET_FogxvOES(exec, _es_Fogxv);
+      SET_FrustumfOES(exec, _es_Frustumf);
+      SET_FrustumxOES(exec, _es_Frustumx);
+      SET_GetClipPlanefOES(exec, _es_GetClipPlanef);
+      SET_GetClipPlanexOES(exec, _es_GetClipPlanex);
+      SET_GetFixedvOES(exec, _mesa_GetFixedv);
+      SET_GetLightxvOES(exec, _es_GetLightxv);
+      SET_GetMaterialxvOES(exec, _es_GetMaterialxv);
+      SET_GetTexEnvxvOES(exec, _es_GetTexEnvxv);
+      SET_GetTexGenxvOES(exec, _check_GetTexGenxvOES);
+      SET_GetTexParameterxvOES(exec, _es_GetTexParameterxv);
+      SET_LightModelxOES(exec, _es_LightModelx);
+      SET_LightModelxvOES(exec, _es_LightModelxv);
+      SET_LightxOES(exec, _es_Lightx);
+      SET_LightxvOES(exec, _es_Lightxv);
+      SET_LineWidthxOES(exec, _es_LineWidthx);
+      SET_LoadMatrixxOES(exec, _es_LoadMatrixx);
+      SET_MaterialxOES(exec, _es_Materialx);
+      SET_MaterialxvOES(exec, _es_Materialxv);
+      SET_MultMatrixxOES(exec, _es_MultMatrixx);
+      SET_MultiTexCoord4xOES(exec, _es_MultiTexCoord4x);
+      SET_Normal3xOES(exec, _es_Normal3x);
+      SET_OrthofOES(exec, _es_Orthof);
+      SET_OrthoxOES(exec, _es_Orthox);
+      SET_PointParameterxOES(exec, _es_PointParameterx);
+      SET_PointParameterxvOES(exec, _es_PointParameterxv);
+      SET_PointSizePointerOES(exec, _mesa_PointSizePointer);
+      SET_PointSizexOES(exec, _es_PointSizex);
+      SET_PolygonOffsetxOES(exec, _es_PolygonOffsetx);
+      SET_QueryMatrixxOES(exec, _es_QueryMatrixxOES);
+      SET_RotatexOES(exec, _es_Rotatex);
+      SET_SampleCoveragexOES(exec, _es_SampleCoveragex);
+      SET_ScalexOES(exec, _es_Scalex);
+      SET_TexEnvxOES(exec, _es_TexEnvx);
+      SET_TexEnvxvOES(exec, _es_TexEnvxv);
+      SET_TexGenxOES(exec, _check_TexGenxOES);
+      SET_TexGenxvOES(exec, _check_TexGenxvOES);
+      SET_TexParameterxOES(exec, _es_TexParameterx);
+      SET_TexParameterxvOES(exec, _es_TexParameterxv);
+      SET_TranslatexOES(exec, _es_Translatex);
+   }
+#endif
+
    return exec;
 }
diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c
index 330eb22..2d35f17 100644
--- a/src/mesa/main/api_loopback.c
+++ b/src/mesa/main/api_loopback.c
@@ -37,6 +37,7 @@
 #include "glapi/glthread.h"
 #include "main/dispatch.h"
 #include "mfeatures.h"
+#include "main/context.h"
 
 /* KW: A set of functions to convert unusual Color/Normal/Vertex/etc
  * calls to a smaller set of driver-provided formats.  Currently just
@@ -1503,6 +1504,10 @@ _mesa_loopback_init_api_table(const struct gl_context *ctx,
                               struct _glapi_table *dest)
 {
    if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
+      SET_Color4ub(dest, loopback_Color4ub_f);
+      SET_Materialf(dest, loopback_Materialf);
+   }
+   if (ctx->API == API_OPENGL) {
       SET_Color3b(dest, loopback_Color3b_f);
       SET_Color3d(dest, loopback_Color3d_f);
       SET_Color3i(dest, loopback_Color3i_f);
@@ -1516,7 +1521,6 @@ _mesa_loopback_init_api_table(const struct gl_context *ctx,
       SET_Color4s(dest, loopback_Color4s_f);
       SET_Color4ui(dest, loopback_Color4ui_f);
       SET_Color4us(dest, loopback_Color4us_f);
-      SET_Color4ub(dest, loopback_Color4ub_f);
       SET_Color3bv(dest, loopback_Color3bv_f);
       SET_Color3dv(dest, loopback_Color3dv_f);
       SET_Color3iv(dest, loopback_Color3iv_f);
@@ -1637,7 +1641,6 @@ _mesa_loopback_init_api_table(const struct gl_context *ctx,
       SET_EvalCoord1dv(dest, loopback_EvalCoord1dv);
       SET_EvalCoord1fv(dest, loopback_EvalCoord1fv);
       SET_EvalCoord1d(dest, loopback_EvalCoord1d);
-      SET_Materialf(dest, loopback_Materialf);
       SET_Materiali(dest, loopback_Materiali);
       SET_Materialiv(dest, loopback_Materialiv);
       SET_Rectd(dest, loopback_Rectd);
@@ -1685,7 +1688,7 @@ _mesa_loopback_init_api_table(const struct gl_context *ctx,
       SET_VertexAttribs4ubvNV(dest, loopback_VertexAttribs4ubvNV);
    }
 
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_VertexAttrib1sARB(dest, loopback_VertexAttrib1sARB);
       SET_VertexAttrib1dARB(dest, loopback_VertexAttrib1dARB);
       SET_VertexAttrib2sARB(dest, loopback_VertexAttrib2sARB);
diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index ac58c99..9bf2065 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2345,7 +2345,7 @@ _mesa_init_bufferobj_dispatch(struct gl_context *ctx, struct _glapi_table *disp)
     * exist for it.
     */
    SET_GetBufferPointervARB(disp, _mesa_GetBufferPointervARB);
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_GetBufferSubDataARB(disp, _mesa_GetBufferSubDataARB);
    }
    SET_IsBufferARB(disp, _mesa_IsBufferARB);
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index d40a353..ec1559d 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1692,7 +1692,7 @@ _mesa_init_shader_dispatch(const struct gl_context *ctx,
 {
 #if FEATURE_GL
    /* GL_ARB_vertex/fragment_shader */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_DeleteObjectARB(exec, _mesa_DeleteObjectARB);
       SET_GetHandleARB(exec, _mesa_GetHandleARB);
       SET_DetachObjectARB(exec, _mesa_DetachObjectARB);
@@ -1705,34 +1705,36 @@ _mesa_init_shader_dispatch(const struct gl_context *ctx,
       SET_GetAttachedObjectsARB(exec, _mesa_GetAttachedObjectsARB);
    }
 
-   SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB);
-   SET_CompileShaderARB(exec, _mesa_CompileShaderARB);
-   SET_LinkProgramARB(exec, _mesa_LinkProgramARB);
-   SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB);
-   SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB);
-   SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB);
-
-   /* OpenGL 2.0 */
-   SET_AttachShader(exec, _mesa_AttachShader);
-   SET_CreateProgram(exec, _mesa_CreateProgram);
-   SET_CreateShader(exec, _mesa_CreateShader);
-   SET_DeleteProgram(exec, _mesa_DeleteProgram);
-   SET_DeleteShader(exec, _mesa_DeleteShader);
-   SET_DetachShader(exec, _mesa_DetachShader);
-   SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders);
-   SET_GetProgramiv(exec, _mesa_GetProgramiv);
-   SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog);
-   SET_GetShaderiv(exec, _mesa_GetShaderiv);
-   SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog);
-   SET_IsProgram(exec, _mesa_IsProgram);
-   SET_IsShader(exec, _mesa_IsShader);
-
-   /* GL_ARB_vertex_shader */
-   SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB);
-   SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB);
-   SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB);
-
-   if (ctx->API != API_OPENGLES2) {
+   if (ctx->API != API_OPENGLES) {
+      SET_ShaderSourceARB(exec, _mesa_ShaderSourceARB);
+      SET_CompileShaderARB(exec, _mesa_CompileShaderARB);
+      SET_LinkProgramARB(exec, _mesa_LinkProgramARB);
+      SET_UseProgramObjectARB(exec, _mesa_UseProgramObjectARB);
+      SET_ValidateProgramARB(exec, _mesa_ValidateProgramARB);
+      SET_GetShaderSourceARB(exec, _mesa_GetShaderSourceARB);
+
+      /* OpenGL 2.0 */
+      SET_AttachShader(exec, _mesa_AttachShader);
+      SET_CreateProgram(exec, _mesa_CreateProgram);
+      SET_CreateShader(exec, _mesa_CreateShader);
+      SET_DeleteProgram(exec, _mesa_DeleteProgram);
+      SET_DeleteShader(exec, _mesa_DeleteShader);
+      SET_DetachShader(exec, _mesa_DetachShader);
+      SET_GetAttachedShaders(exec, _mesa_GetAttachedShaders);
+      SET_GetProgramiv(exec, _mesa_GetProgramiv);
+      SET_GetProgramInfoLog(exec, _mesa_GetProgramInfoLog);
+      SET_GetShaderiv(exec, _mesa_GetShaderiv);
+      SET_GetShaderInfoLog(exec, _mesa_GetShaderInfoLog);
+      SET_IsProgram(exec, _mesa_IsProgram);
+      SET_IsShader(exec, _mesa_IsShader);
+
+      /* GL_ARB_vertex_shader */
+      SET_BindAttribLocationARB(exec, _mesa_BindAttribLocationARB);
+      SET_GetActiveAttribARB(exec, _mesa_GetActiveAttribARB);
+      SET_GetAttribLocationARB(exec, _mesa_GetAttribLocationARB);
+   }
+
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_ProgramParameteriARB(exec, _mesa_ProgramParameteriARB);
 
       SET_UseShaderProgramEXT(exec, _mesa_UseShaderProgramEXT);
@@ -1741,20 +1743,22 @@ _mesa_init_shader_dispatch(const struct gl_context *ctx,
    }
 
    /* GL_EXT_gpu_shader4 / GL 3.0 */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_BindFragDataLocationEXT(exec, _mesa_BindFragDataLocation);
    }
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       SET_GetFragDataLocationEXT(exec, _mesa_GetFragDataLocation);
    }
 
    /* GL_ARB_ES2_compatibility */
-   SET_ReleaseShaderCompiler(exec, _mesa_ReleaseShaderCompiler);
-   SET_GetShaderPrecisionFormat(exec, _mesa_GetShaderPrecisionFormat);
-   SET_ShaderBinary(exec, _mesa_ShaderBinary);
+   if (ctx->API != API_OPENGLES) {
+      SET_ReleaseShaderCompiler(exec, _mesa_ReleaseShaderCompiler);
+      SET_GetShaderPrecisionFormat(exec, _mesa_GetShaderPrecisionFormat);
+      SET_ShaderBinary(exec, _mesa_ShaderBinary);
+   }
 
    /* GL_ARB_blend_func_extended */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_BindFragDataLocationIndexed(exec, _mesa_BindFragDataLocationIndexed);
       SET_GetFragDataIndex(exec, _mesa_GetFragDataIndex);
    }
diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c
index 0b0f673..c5a8786 100644
--- a/src/mesa/main/texgen.c
+++ b/src/mesa/main/texgen.c
@@ -426,15 +426,17 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params )
 
 
 void
-_mesa_init_texgen_dispatch(struct _glapi_table *disp)
+_mesa_init_texgen_dispatch(struct gl_context *ctx, struct _glapi_table *disp)
 {
-   SET_GetTexGendv(disp, _mesa_GetTexGendv);
    SET_GetTexGenfv(disp, _mesa_GetTexGenfv);
    SET_GetTexGeniv(disp, _mesa_GetTexGeniv);
-   SET_TexGend(disp, _mesa_TexGend);
-   SET_TexGendv(disp, _mesa_TexGendv);
    SET_TexGenf(disp, _mesa_TexGenf);
    SET_TexGenfv(disp, _mesa_TexGenfv);
    SET_TexGeni(disp, _mesa_TexGeni);
    SET_TexGeniv(disp, _mesa_TexGeniv);
+   if (ctx->API == API_OPENGL) {
+      SET_GetTexGendv(disp, _mesa_GetTexGendv);
+      SET_TexGend(disp, _mesa_TexGend);
+      SET_TexGendv(disp, _mesa_TexGendv);
+   }
 }
diff --git a/src/mesa/main/texgen.h b/src/mesa/main/texgen.h
index 35a7995..03dd49c 100644
--- a/src/mesa/main/texgen.h
+++ b/src/mesa/main/texgen.h
@@ -50,7 +50,7 @@ extern void GLAPIENTRY
 _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params );
 
 extern void
-_mesa_init_texgen_dispatch(struct _glapi_table *disp);
+_mesa_init_texgen_dispatch(struct gl_context *ctx, struct _glapi_table *disp);
 
 
 extern void GLAPIENTRY
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index d89255a..861601e 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -808,33 +808,35 @@ _mesa_init_shader_uniform_dispatch(const struct gl_context *ctx,
                                    struct _glapi_table *exec)
 {
 #if FEATURE_GL
-   SET_Uniform1fARB(exec, _mesa_Uniform1fARB);
-   SET_Uniform2fARB(exec, _mesa_Uniform2fARB);
-   SET_Uniform3fARB(exec, _mesa_Uniform3fARB);
-   SET_Uniform4fARB(exec, _mesa_Uniform4fARB);
-   SET_Uniform1iARB(exec, _mesa_Uniform1iARB);
-   SET_Uniform2iARB(exec, _mesa_Uniform2iARB);
-   SET_Uniform3iARB(exec, _mesa_Uniform3iARB);
-   SET_Uniform4iARB(exec, _mesa_Uniform4iARB);
-   SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB);
-   SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB);
-   SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB);
-   SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB);
-   SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB);
-   SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB);
-   SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB);
-   SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB);
-   SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB);
-   SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB);
-   SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB);
-
-   SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB);
-   SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB);
-   SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB);
-   SET_GetUniformivARB(exec, _mesa_GetUniformivARB);
+   if (ctx->API != API_OPENGLES) {
+      SET_Uniform1fARB(exec, _mesa_Uniform1fARB);
+      SET_Uniform2fARB(exec, _mesa_Uniform2fARB);
+      SET_Uniform3fARB(exec, _mesa_Uniform3fARB);
+      SET_Uniform4fARB(exec, _mesa_Uniform4fARB);
+      SET_Uniform1iARB(exec, _mesa_Uniform1iARB);
+      SET_Uniform2iARB(exec, _mesa_Uniform2iARB);
+      SET_Uniform3iARB(exec, _mesa_Uniform3iARB);
+      SET_Uniform4iARB(exec, _mesa_Uniform4iARB);
+      SET_Uniform1fvARB(exec, _mesa_Uniform1fvARB);
+      SET_Uniform2fvARB(exec, _mesa_Uniform2fvARB);
+      SET_Uniform3fvARB(exec, _mesa_Uniform3fvARB);
+      SET_Uniform4fvARB(exec, _mesa_Uniform4fvARB);
+      SET_Uniform1ivARB(exec, _mesa_Uniform1ivARB);
+      SET_Uniform2ivARB(exec, _mesa_Uniform2ivARB);
+      SET_Uniform3ivARB(exec, _mesa_Uniform3ivARB);
+      SET_Uniform4ivARB(exec, _mesa_Uniform4ivARB);
+      SET_UniformMatrix2fvARB(exec, _mesa_UniformMatrix2fvARB);
+      SET_UniformMatrix3fvARB(exec, _mesa_UniformMatrix3fvARB);
+      SET_UniformMatrix4fvARB(exec, _mesa_UniformMatrix4fvARB);
+
+      SET_GetActiveUniformARB(exec, _mesa_GetActiveUniformARB);
+      SET_GetUniformLocationARB(exec, _mesa_GetUniformLocationARB);
+      SET_GetUniformfvARB(exec, _mesa_GetUniformfvARB);
+      SET_GetUniformivARB(exec, _mesa_GetUniformivARB);
+   }
 
    /* OpenGL 2.1 */
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       SET_UniformMatrix2x3fv(exec, _mesa_UniformMatrix2x3fv);
       SET_UniformMatrix3x2fv(exec, _mesa_UniformMatrix3x2fv);
       SET_UniformMatrix2x4fv(exec, _mesa_UniformMatrix2x4fv);
diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c
index 462cc88..5891a52 100644
--- a/src/mesa/main/vtxfmt.c
+++ b/src/mesa/main/vtxfmt.c
@@ -47,10 +47,13 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
                const GLvertexformat *vfmt)
 {
    if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
+      SET_Color4f(tab, vfmt->Color4f);
+   }
+
+   if (ctx->API == API_OPENGL) {
       _mesa_install_arrayelt_vtxfmt(tab, vfmt);
       SET_Color3f(tab, vfmt->Color3f);
       SET_Color3fv(tab, vfmt->Color3fv);
-      SET_Color4f(tab, vfmt->Color4f);
       SET_Color4fv(tab, vfmt->Color4fv);
       SET_EdgeFlag(tab, vfmt->EdgeFlag);
    }
@@ -60,21 +63,27 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
    }
 
    if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
+      SET_Materialfv(tab, vfmt->Materialfv);
+      SET_MultiTexCoord4fARB(tab, vfmt->MultiTexCoord4fARB);
+      SET_Normal3f(tab, vfmt->Normal3f);
+   }
+
+   if (ctx->API == API_OPENGL) {
       SET_FogCoordfEXT(tab, vfmt->FogCoordfEXT);
       SET_FogCoordfvEXT(tab, vfmt->FogCoordfvEXT);
       SET_Indexf(tab, vfmt->Indexf);
       SET_Indexfv(tab, vfmt->Indexfv);
-      SET_Materialfv(tab, vfmt->Materialfv);
       SET_MultiTexCoord1fARB(tab, vfmt->MultiTexCoord1fARB);
       SET_MultiTexCoord1fvARB(tab, vfmt->MultiTexCoord1fvARB);
       SET_MultiTexCoord2fARB(tab, vfmt->MultiTexCoord2fARB);
       SET_MultiTexCoord2fvARB(tab, vfmt->MultiTexCoord2fvARB);
       SET_MultiTexCoord3fARB(tab, vfmt->MultiTexCoord3fARB);
       SET_MultiTexCoord3fvARB(tab, vfmt->MultiTexCoord3fvARB);
-      SET_MultiTexCoord4fARB(tab, vfmt->MultiTexCoord4fARB);
       SET_MultiTexCoord4fvARB(tab, vfmt->MultiTexCoord4fvARB);
-      SET_Normal3f(tab, vfmt->Normal3f);
       SET_Normal3fv(tab, vfmt->Normal3fv);
+   }
+
+   if (ctx->API == API_OPENGL) {
       SET_SecondaryColor3fEXT(tab, vfmt->SecondaryColor3fEXT);
       SET_SecondaryColor3fvEXT(tab, vfmt->SecondaryColor3fvEXT);
       SET_TexCoord1f(tab, vfmt->TexCoord1f);
@@ -105,13 +114,13 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
 
    SET_DrawArrays(tab, vfmt->DrawArrays);
    SET_DrawElements(tab, vfmt->DrawElements);
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       SET_DrawRangeElements(tab, vfmt->DrawRangeElements);
    }
 
    SET_MultiDrawElementsEXT(tab, vfmt->MultiDrawElementsEXT);
 
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_DrawElementsBaseVertex(tab, vfmt->DrawElementsBaseVertex);
       SET_DrawRangeElementsBaseVertex(tab, vfmt->DrawRangeElementsBaseVertex);
       SET_MultiDrawElementsBaseVertex(tab, vfmt->MultiDrawElementsBaseVertex);
@@ -121,12 +130,12 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
       SET_DrawElementsInstancedBaseVertexBaseInstance(tab, vfmt->DrawElementsInstancedBaseVertexBaseInstance);
    }
 
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       SET_DrawArraysInstancedARB(tab, vfmt->DrawArraysInstanced);
       SET_DrawElementsInstancedARB(tab, vfmt->DrawElementsInstanced);
    }
 
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_DrawTransformFeedback(tab, vfmt->DrawTransformFeedback);
       SET_DrawTransformFeedbackStream(tab, vfmt->DrawTransformFeedbackStream);
       SET_DrawTransformFeedbackInstanced(tab,
@@ -147,17 +156,19 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
       SET_VertexAttrib4fvNV(tab, vfmt->VertexAttrib4fvNV);
    }
 
-   SET_VertexAttrib1fARB(tab, vfmt->VertexAttrib1fARB);
-   SET_VertexAttrib1fvARB(tab, vfmt->VertexAttrib1fvARB);
-   SET_VertexAttrib2fARB(tab, vfmt->VertexAttrib2fARB);
-   SET_VertexAttrib2fvARB(tab, vfmt->VertexAttrib2fvARB);
-   SET_VertexAttrib3fARB(tab, vfmt->VertexAttrib3fARB);
-   SET_VertexAttrib3fvARB(tab, vfmt->VertexAttrib3fvARB);
-   SET_VertexAttrib4fARB(tab, vfmt->VertexAttrib4fARB);
-   SET_VertexAttrib4fvARB(tab, vfmt->VertexAttrib4fvARB);
+   if (ctx->API != API_OPENGLES) {
+      SET_VertexAttrib1fARB(tab, vfmt->VertexAttrib1fARB);
+      SET_VertexAttrib1fvARB(tab, vfmt->VertexAttrib1fvARB);
+      SET_VertexAttrib2fARB(tab, vfmt->VertexAttrib2fARB);
+      SET_VertexAttrib2fvARB(tab, vfmt->VertexAttrib2fvARB);
+      SET_VertexAttrib3fARB(tab, vfmt->VertexAttrib3fARB);
+      SET_VertexAttrib3fvARB(tab, vfmt->VertexAttrib3fvARB);
+      SET_VertexAttrib4fARB(tab, vfmt->VertexAttrib4fARB);
+      SET_VertexAttrib4fvARB(tab, vfmt->VertexAttrib4fvARB);
+   }
 
    /* GL_EXT_gpu_shader4 / OpenGL 3.0 */
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_VertexAttribI1iEXT(tab, vfmt->VertexAttribI1i);
       SET_VertexAttribI2iEXT(tab, vfmt->VertexAttribI2i);
       SET_VertexAttribI3iEXT(tab, vfmt->VertexAttribI3i);
@@ -171,14 +182,14 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
       SET_VertexAttribI3uivEXT(tab, vfmt->VertexAttribI3uiv);
    }
 
-   if (ctx->API != API_OPENGLES2 || _mesa_is_gles3(ctx)) {
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
       SET_VertexAttribI4iEXT(tab, vfmt->VertexAttribI4i);
       SET_VertexAttribI4ivEXT(tab, vfmt->VertexAttribI4iv);
       SET_VertexAttribI4uiEXT(tab, vfmt->VertexAttribI4ui);
       SET_VertexAttribI4uivEXT(tab, vfmt->VertexAttribI4uiv);
    }
 
-   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
+   if (ctx->API == API_OPENGL) {
       /* GL_ARB_vertex_type_10_10_10_2_rev / GL 3.3 */
       SET_VertexP2ui(tab, vfmt->VertexP2ui);
       SET_VertexP2uiv(tab, vfmt->VertexP2uiv);
@@ -217,7 +228,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
       SET_SecondaryColorP3uiv(tab, vfmt->SecondaryColorP3uiv);
    }
 
-   if (ctx->API != API_OPENGLES2) {
+   if (_mesa_is_desktop_gl(ctx)) {
       SET_VertexAttribP1ui(tab, vfmt->VertexAttribP1ui);
       SET_VertexAttribP2ui(tab, vfmt->VertexAttribP2ui);
       SET_VertexAttribP3ui(tab, vfmt->VertexAttribP3ui);
-- 
1.7.12.4



More information about the mesa-dev mailing list