[Mesa-dev] [PATCH 02/18] mesa: Kill ES2 wrapper functions

Ian Romanick idr at freedesktop.org
Fri Aug 24 08:49:01 PDT 2012


From: Ian Romanick <ian.d.romanick at intel.com>

v2: Fix completely broken condition around ClearColorIiEXT and
ClearColorIuiEXT.

v3: Add special VertexAttrib handling for ES2.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/Android.gen.mk     |    8 +-
 src/mesa/Makefile.am        |   15 --
 src/mesa/SConscript         |   18 ---
 src/mesa/main/.gitignore    |    3 -
 src/mesa/main/api_exec.c    |  306 ++++++++++++++++++++++++++++---------------
 src/mesa/main/context.c     |   10 +-
 src/mesa/main/vtxfmt.c      |    3 +-
 src/mesa/sources.mak        |    1 -
 src/mesa/vbo/vbo_exec_api.c |   28 +++-
 9 files changed, 226 insertions(+), 166 deletions(-)

diff --git a/src/mesa/Android.gen.mk b/src/mesa/Android.gen.mk
index 5443bb9..f5e6323 100644
--- a/src/mesa/Android.gen.mk
+++ b/src/mesa/Android.gen.mk
@@ -35,13 +35,10 @@ sources := \
 	main/api_exec_es1.c \
 	main/api_exec_es1_dispatch.h \
 	main/api_exec_es1_remap_helper.h \
-	main/api_exec_es2.c \
-	main/api_exec_es2_dispatch.h \
 	program/program_parse.tab.c \
 	program/lex.yy.c \
 	main/dispatch.h \
-	main/remap_helper.h \
-	main/api_exec_es2_remap_helper.h
+	main/remap_helper.h
 
 LOCAL_SRC_FILES := $(filter-out $(sources), $(LOCAL_SRC_FILES))
 
@@ -100,9 +97,6 @@ $(intermediates)/main/api_exec_%_remap_helper.h: PRIVATE_XML := -f $(glapi)/gl_a
 $(intermediates)/main/api_exec_es1.c: $(es_src_deps)
 	$(call es-gen, -V GLES1.1)
 
-$(intermediates)/main/api_exec_es2.c: $(es_src_deps)
-	$(call es-gen, -V GLES2.0)
-
 $(intermediates)/main/api_exec_%_dispatch.h: $(es_hdr_deps)
 	$(call es-gen, -c $* -m remap_table)
 
diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
index 1ac64e6..b7d7f24 100644
--- a/src/mesa/Makefile.am
+++ b/src/mesa/Makefile.am
@@ -51,10 +51,7 @@ BUILT_SOURCES = \
 	main/git_sha1.h \
 	main/api_exec_es1_dispatch.h \
 	main/api_exec_es1_remap_helper.h \
-	main/api_exec_es2_dispatch.h \
-	main/api_exec_es2_remap_helper.h \
 	main/api_exec_es1.c \
-	main/api_exec_es2.c \
 	program/program_parse.tab.c \
 	program/program_parse.tab.h \
 	program/lex.yy.c
@@ -70,22 +67,10 @@ main/api_exec_es1_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_d
 
 main/api_exec_es1.o: main/api_exec_es1_dispatch.h main/api_exec_es1_remap_helper.h
 
-main/api_exec_es2_dispatch.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_dispatch_deps)
-	$(call glapi_gen_dispatch,$<,es2)
-
-main/api_exec_es2_remap_helper.h: $(GLAPI)/gl_and_es_API.xml $(glapi_gen_remap_deps)
-	$(call glapi_gen_remap,$<,es2)
-
-main/api_exec_es2.o: main/api_exec_es2_dispatch.h main/api_exec_es2_remap_helper.h
-
 main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
 	$(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/es_generator.py \
 	  -S $(srcdir)/main/APIspec.xml -V GLES1.1 > $@
 
-main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
-	$(AM_V_GEN) $(PYTHON2) $(PYTHON_FLAGS) $(srcdir)/main/es_generator.py \
-	  -S $(srcdir)/main/APIspec.xml -V GLES2.0 > $@
-
 program/program_parse.tab.c program/program_parse.tab.h: program/program_parse.y
 	$(MKDIR_P) program
 	$(AM_V_GEN) $(YACC) -v -d --output=program/program_parse.tab.c $<
diff --git a/src/mesa/SConscript b/src/mesa/SConscript
index 938eea5..5be8cbb 100644
--- a/src/mesa/SConscript
+++ b/src/mesa/SConscript
@@ -345,12 +345,6 @@ if env['gles']:
         source = 'main/APIspec.xml',
         command = python_cmd + ' $SCRIPT -S $SOURCE -V GLES1.1 > $TARGET'
     )
-    gles_sources += env.CodeGenerate(
-        target = 'main/api_exec_es2.c',
-        script = 'main/es_generator.py',
-        source = 'main/APIspec.xml',
-        command = python_cmd + ' $SCRIPT -S $SOURCE -V GLES2.0 > $TARGET'
-    )
 
     # generate GLES headers
     gles_headers = []
@@ -366,18 +360,6 @@ if env['gles']:
         source = GLAPI + 'gen/gl_and_es_API.xml',
         command = python_cmd + ' $SCRIPT -c es1 -f $SOURCE > $TARGET',
     )
-    gles_headers += env.CodeGenerate(
-        target = 'main/api_exec_es2_dispatch.h',
-        script = GLAPI + 'gen/gl_table.py',
-        source = GLAPI + 'gen/gl_and_es_API.xml',
-        command = python_cmd + ' $SCRIPT -c es2 -m remap_table -f $SOURCE > $TARGET',
-    )
-    gles_headers += env.CodeGenerate(
-        target = 'main/api_exec_es2_remap_helper.h',
-        script = GLAPI + 'gen/remap_helper.py',
-        source = GLAPI + 'gen/gl_and_es_API.xml',
-        command = python_cmd + ' $SCRIPT -c es2 -f $SOURCE > $TARGET',
-    )
 
     env.Depends(gles_sources, gles_headers)
 
diff --git a/src/mesa/main/.gitignore b/src/mesa/main/.gitignore
index caed74f..b26be22 100644
--- a/src/mesa/main/.gitignore
+++ b/src/mesa/main/.gitignore
@@ -1,5 +1,4 @@
 api_exec_es1.c
-api_exec_es2.c
 dispatch.h
 enums.c
 get_es1.c
@@ -8,6 +7,4 @@ git_sha1.h
 git_sha1.h.tmp
 api_exec_es1_dispatch.h
 api_exec_es1_remap_helper.h
-api_exec_es2_dispatch.h
-api_exec_es2_remap_helper.h
 remap_helper.h
diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c
index 356b133..af73074 100644
--- a/src/mesa/main/api_exec.c
+++ b/src/mesa/main/api_exec.c
@@ -106,7 +106,7 @@
 #include "main/dispatch.h"
 
 
-#if FEATURE_GL
+#if FEATURE_GL || FEATURE_ES2
 
 
 /**
@@ -133,7 +133,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
 #endif
 
    /* load the dispatch slots we understand */
-   if (ctx->API != API_OPENGL_CORE) {
+   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_AlphaFunc(exec, _mesa_AlphaFunc);
    }
 
@@ -145,14 +145,16 @@ _mesa_create_exec_table(struct gl_context *ctx)
    SET_CullFace(exec, _mesa_CullFace);
    SET_Disable(exec, _mesa_Disable);
 #if FEATURE_draw_read_buffer
-   SET_DrawBuffer(exec, _mesa_DrawBuffer);
+   if (ctx->API == API_OPENGL || ctx->API == API_OPENGL_CORE)
+      SET_DrawBuffer(exec, _mesa_DrawBuffer);
+
    SET_ReadBuffer(exec, _mesa_ReadBuffer);
 #endif
    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) {
+   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_Frustum(exec, _mesa_Frustum);
    }
    SET_GetError(exec, _mesa_GetError);
@@ -162,37 +164,39 @@ _mesa_create_exec_table(struct gl_context *ctx)
       SET_LineStipple(exec, _mesa_LineStipple);
    }
    SET_LineWidth(exec, _mesa_LineWidth);
-   if (ctx->API != API_OPENGL_CORE) {
+   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_LoadIdentity(exec, _mesa_LoadIdentity);
       SET_LoadMatrixf(exec, _mesa_LoadMatrixf);
    }
-   SET_LogicOp(exec, _mesa_LogicOp);
-   if (ctx->API != API_OPENGL_CORE) {
+   if (ctx->API != API_OPENGLES2) {
+      SET_LogicOp(exec, _mesa_LogicOp);
+   }
+   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_MatrixMode(exec, _mesa_MatrixMode);
       SET_MultMatrixf(exec, _mesa_MultMatrixf);
       SET_Ortho(exec, _mesa_Ortho);
    }
    SET_PixelStorei(exec, _mesa_PixelStorei);
-   if (ctx->API != API_OPENGL_CORE) {
+   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_PopMatrix(exec, _mesa_PopMatrix);
       SET_PushMatrix(exec, _mesa_PushMatrix);
       SET_Rotatef(exec, _mesa_Rotatef);
       SET_Scalef(exec, _mesa_Scalef);
    }
    SET_Scissor(exec, _mesa_Scissor);
-   if (ctx->API != API_OPENGL_CORE) {
+   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_ShadeModel(exec, _mesa_ShadeModel);
    }
    SET_StencilFunc(exec, _mesa_StencilFunc);
    SET_StencilMask(exec, _mesa_StencilMask);
    SET_StencilOp(exec, _mesa_StencilOp);
-   if (ctx->API != API_OPENGL_CORE) {
+   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_TexEnvfv(exec, _mesa_TexEnvfv);
       SET_TexEnvi(exec, _mesa_TexEnvi);
    }
    SET_TexImage2D(exec, _mesa_TexImage2D);
    SET_TexParameteri(exec, _mesa_TexParameteri);
-   if (ctx->API != API_OPENGL_CORE) {
+   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_Translatef(exec, _mesa_Translatef);
    }
    SET_Viewport(exec, _mesa_Viewport);
@@ -212,7 +216,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
    SET_DepthMask(exec, _mesa_DepthMask);
    SET_DepthRange(exec, _mesa_DepthRange);
 
-   _mesa_init_drawpix_dispatch(exec);
+   if (ctx->API != API_OPENGLES2 && ctx->API != API_OPENGL_CORE) {
+      _mesa_init_drawpix_dispatch(exec);
+   }
    if (ctx->API == API_OPENGL) {
       _mesa_init_feedback_dispatch(exec);
    }
@@ -228,7 +234,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
    SET_GetBooleanv(exec, _mesa_GetBooleanv);
    SET_GetDoublev(exec, _mesa_GetDoublev);
    SET_GetIntegerv(exec, _mesa_GetIntegerv);
-   if (ctx->API != API_OPENGL_CORE) {
+   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);
@@ -237,17 +243,21 @@ _mesa_create_exec_table(struct gl_context *ctx)
       SET_GetTexEnvfv(exec, _mesa_GetTexEnvfv);
       SET_GetTexEnviv(exec, _mesa_GetTexEnviv);
    }
-   SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv);
-   SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv);
+   if (ctx->API != API_OPENGLES2) {
+      SET_GetTexLevelParameterfv(exec, _mesa_GetTexLevelParameterfv);
+      SET_GetTexLevelParameteriv(exec, _mesa_GetTexLevelParameteriv);
+   }
    SET_GetTexParameterfv(exec, _mesa_GetTexParameterfv);
    SET_GetTexParameteriv(exec, _mesa_GetTexParameteriv);
-   SET_GetTexImage(exec, _mesa_GetTexImage);
+   if (ctx->API != API_OPENGLES2) {
+      SET_GetTexImage(exec, _mesa_GetTexImage);
+   }
    SET_Hint(exec, _mesa_Hint);
    if (ctx->API == API_OPENGL) {
       SET_IndexMask(exec, _mesa_IndexMask);
    }
    SET_IsEnabled(exec, _mesa_IsEnabled);
-   if (ctx->API != API_OPENGL_CORE) {
+   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);
@@ -265,19 +275,25 @@ _mesa_create_exec_table(struct gl_context *ctx)
       _mesa_init_pixel_dispatch(exec);
    }
 
-   SET_PixelStoref(exec, _mesa_PixelStoref);
+   if (ctx->API != API_OPENGLES2) {
+      SET_PixelStoref(exec, _mesa_PixelStoref);
+   }
+
    SET_PointSize(exec, _mesa_PointSize);
-   SET_PolygonMode(exec, _mesa_PolygonMode);
+
+   if (ctx->API != API_OPENGLES2) {
+      SET_PolygonMode(exec, _mesa_PolygonMode);
+   }
+
    SET_PolygonOffset(exec, _mesa_PolygonOffset);
    if (ctx->API == API_OPENGL) {
       SET_PolygonStipple(exec, _mesa_PolygonStipple);
-
       _mesa_init_attrib_dispatch(exec);
       _mesa_init_rastpos_dispatch(exec);
    }
 
    SET_ReadPixels(exec, _mesa_ReadPixels);
-   if (ctx->API != API_OPENGL_CORE) {
+   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       SET_Rotated(exec, _mesa_Rotated);
       SET_Scaled(exec, _mesa_Scaled);
       SET_SecondaryColorPointerEXT(exec, _mesa_SecondaryColorPointerEXT);
@@ -285,11 +301,13 @@ _mesa_create_exec_table(struct gl_context *ctx)
       SET_TexEnviv(exec, _mesa_TexEnviv);
    }
 
-   if (ctx->API != API_OPENGL_CORE) {
+   if (ctx->API != API_OPENGL_CORE && ctx->API != API_OPENGLES2) {
       _mesa_init_texgen_dispatch(exec);
    }
 
-   SET_TexImage1D(exec, _mesa_TexImage1D);
+   if (ctx->API != API_OPENGLES2) {
+      SET_TexImage1D(exec, _mesa_TexImage1D);
+   }
    SET_TexParameterf(exec, _mesa_TexParameterf);
    SET_TexParameterfv(exec, _mesa_TexParameterfv);
    SET_TexParameteriv(exec, _mesa_TexParameteriv);
@@ -306,11 +324,17 @@ _mesa_create_exec_table(struct gl_context *ctx)
       SET_AreTexturesResident(exec, _mesa_AreTexturesResident);
       SET_ColorPointer(exec, _mesa_ColorPointer);
    }
-   SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D);
+   if (ctx->API != API_OPENGLES2) {
+      SET_CopyTexImage1D(exec, _mesa_CopyTexImage1D);
+      SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D);
+      SET_TexSubImage1D(exec, _mesa_TexSubImage1D);
+   }
+
    SET_CopyTexImage2D(exec, _mesa_CopyTexImage2D);
-   SET_CopyTexSubImage1D(exec, _mesa_CopyTexSubImage1D);
    SET_CopyTexSubImage2D(exec, _mesa_CopyTexSubImage2D);
-   if (ctx->API != API_OPENGL_CORE) {
+   SET_TexSubImage2D(exec, _mesa_TexSubImage2D);
+
+   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);
@@ -319,13 +343,11 @@ _mesa_create_exec_table(struct gl_context *ctx)
       SET_InterleavedArrays(exec, _mesa_InterleavedArrays);
    }
    SET_IsTexture(exec, _mesa_IsTexture);
-   if (ctx->API != API_OPENGL_CORE) {
+   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_TexSubImage1D(exec, _mesa_TexSubImage1D);
-   SET_TexSubImage2D(exec, _mesa_TexSubImage2D);
    if (ctx->API != API_OPENGL_CORE) {
       SET_VertexPointer(exec, _mesa_VertexPointer);
    }
@@ -392,7 +414,7 @@ _mesa_create_exec_table(struct gl_context *ctx)
 
    /* 14. SGI_color_table */
 #if 0
-   if (ctx->API != API_OPENGL_CORE) {
+   if (ctx->API == API_OPENGL) {
       SET_ColorTableSGI(exec, _mesa_ColorTable);
       SET_ColorSubTableSGI(exec, _mesa_ColorSubTable);
       SET_GetColorTableSGI(exec, _mesa_GetColorTable);
@@ -456,8 +478,10 @@ _mesa_create_exec_table(struct gl_context *ctx)
 
    /* 200. GL_IBM_multimode_draw_arrays */
 #if _HAVE_FULL_GL
-   SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM);
-   SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM);
+   if (ctx->API != API_OPENGLES2) {
+      SET_MultiModeDrawArraysIBM(exec, _mesa_MultiModeDrawArraysIBM);
+      SET_MultiModeDrawElementsIBM(exec, _mesa_MultiModeDrawElementsIBM);
+   }
 #endif
 
    /* 233. GL_NV_vertex_program */
@@ -498,8 +522,10 @@ _mesa_create_exec_table(struct gl_context *ctx)
       SET_GenVertexArraysAPPLE(exec, _mesa_GenVertexArraysAPPLE);
    }
    /* Reused by ARB_vertex_array_object */
-   SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE);
-   SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE);
+   if (ctx->API != API_OPENGLES2) {
+      SET_DeleteVertexArraysAPPLE(exec, _mesa_DeleteVertexArraysAPPLE);
+      SET_IsVertexArrayAPPLE(exec, _mesa_IsVertexArrayAPPLE);
+   }
 
    /* 282. GL_NV_fragment_program */
 #if FEATURE_NV_fragment_program
@@ -533,22 +559,32 @@ _mesa_create_exec_table(struct gl_context *ctx)
 #endif
 
    /* 285. GL_NV_primitive_restart */
-   SET_PrimitiveRestartIndexNV(exec, _mesa_PrimitiveRestartIndex);
+   if (ctx->API != API_OPENGLES2) {
+      SET_PrimitiveRestartIndexNV(exec, _mesa_PrimitiveRestartIndex);
+   }
 
    /* ???. GL_EXT_depth_bounds_test */
-   SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);
+   if (ctx->API != API_OPENGLES2) {
+      SET_DepthBoundsEXT(exec, _mesa_DepthBoundsEXT);
+   }
 
    /* 352. GL_EXT_transform_feedback */
    /* ARB 93. GL_ARB_transform_feedback2 */
-   _mesa_init_transform_feedback_dispatch(exec);
+   if (ctx->API != API_OPENGLES2) {
+      _mesa_init_transform_feedback_dispatch(exec);
+   }
 
    /* 364. GL_EXT_provoking_vertex */
-   SET_ProvokingVertexEXT(exec, _mesa_ProvokingVertexEXT);
+   if (ctx->API != API_OPENGLES2) {
+      SET_ProvokingVertexEXT(exec, _mesa_ProvokingVertexEXT);
+   }
 
    /* ARB 1. GL_ARB_multitexture */
 #if _HAVE_FULL_GL
    SET_ActiveTextureARB(exec, _mesa_ActiveTextureARB);
-   SET_ClientActiveTextureARB(exec, _mesa_ClientActiveTextureARB);
+   if (ctx->API != API_OPENGLES2) {
+      SET_ClientActiveTextureARB(exec, _mesa_ClientActiveTextureARB);
+   }
 #endif
 
    /* ARB 3. GL_ARB_transpose_matrix */
@@ -568,16 +604,21 @@ _mesa_create_exec_table(struct gl_context *ctx)
 
    /* ARB 12. GL_ARB_texture_compression */
 #if _HAVE_FULL_GL
+   if (ctx->API != API_OPENGLES2) {
+      SET_CompressedTexImage1DARB(exec, _mesa_CompressedTexImage1DARB);
+      SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB);
+      SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB);
+   }
+
    SET_CompressedTexImage3DARB(exec, _mesa_CompressedTexImage3DARB);
    SET_CompressedTexImage2DARB(exec, _mesa_CompressedTexImage2DARB);
-   SET_CompressedTexImage1DARB(exec, _mesa_CompressedTexImage1DARB);
    SET_CompressedTexSubImage3DARB(exec, _mesa_CompressedTexSubImage3DARB);
    SET_CompressedTexSubImage2DARB(exec, _mesa_CompressedTexSubImage2DARB);
-   SET_CompressedTexSubImage1DARB(exec, _mesa_CompressedTexSubImage1DARB);
-   SET_GetCompressedTexImageARB(exec, _mesa_GetCompressedTexImageARB);
 
    /* ARB 104. GL_ARB_robustness */
-   SET_GetnCompressedTexImageARB(exec, _mesa_GetnCompressedTexImageARB);
+   if (ctx->API != API_OPENGLES2) {
+      SET_GetnCompressedTexImageARB(exec, _mesa_GetnCompressedTexImageARB);
+   }
 #endif
 
    /* ARB 14. GL_ARB_point_parameters */
@@ -625,12 +666,15 @@ _mesa_create_exec_table(struct gl_context *ctx)
    SET_VertexAttribPointerARB(exec, _mesa_VertexAttribPointerARB);
    SET_EnableVertexAttribArrayARB(exec, _mesa_EnableVertexAttribArrayARB);
    SET_DisableVertexAttribArrayARB(exec, _mesa_DisableVertexAttribArrayARB);
-   SET_ProgramStringARB(exec, _mesa_ProgramStringARB);
-   /* glBindProgramARB aliases glBindProgramNV */
-   /* glDeleteProgramsARB aliases glDeleteProgramsNV */
-   /* glGenProgramsARB aliases glGenProgramsNV */
-   /* glIsProgramARB aliases glIsProgramNV */
-   SET_GetVertexAttribdvARB(exec, _mesa_GetVertexAttribdvARB);
+   if (ctx->API != API_OPENGLES2) {
+      SET_ProgramStringARB(exec, _mesa_ProgramStringARB);
+      /* glBindProgramARB aliases glBindProgramNV */
+      /* glDeleteProgramsARB aliases glDeleteProgramsNV */
+      /* glGenProgramsARB aliases glGenProgramsNV */
+      /* glIsProgramARB aliases glIsProgramNV */
+      SET_GetVertexAttribdvARB(exec, _mesa_GetVertexAttribdvARB);
+   }
+
    SET_GetVertexAttribfvARB(exec, _mesa_GetVertexAttribfvARB);
    SET_GetVertexAttribivARB(exec, _mesa_GetVertexAttribivARB);
    /* glGetVertexAttribPointervARB aliases glGetVertexAttribPointervNV */
@@ -656,7 +700,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
    _mesa_init_bufferobj_dispatch(ctx, exec);
 
    /* ARB 29. GL_ARB_occlusion_query */
-   _mesa_init_queryobj_dispatch(exec);
+   if (ctx->API != API_OPENGLES2) {
+      _mesa_init_queryobj_dispatch(exec);
+   }
 
    /* ARB 37. GL_ARB_draw_buffers */
 #if FEATURE_draw_read_buffer
@@ -664,16 +710,22 @@ _mesa_create_exec_table(struct gl_context *ctx)
 #endif
 
    /* ARB 66. GL_ARB_sync */
-   _mesa_init_sync_dispatch(exec);
+   if (ctx->API != API_OPENGLES2) {
+      _mesa_init_sync_dispatch(exec);
+   }
 
    /* ARB 104. GL_ARB_debug_output */
-   _mesa_init_errors_dispatch(exec);
+   if (ctx->API != API_OPENGLES2) {
+      _mesa_init_errors_dispatch(exec);
+   }
 
    /* ARB 105. GL_ARB_robustness */
-   SET_GetGraphicsResetStatusARB(exec, _mesa_GetGraphicsResetStatusARB);
-   SET_GetnPolygonStippleARB(exec, _mesa_GetnPolygonStippleARB);
-   SET_GetnTexImageARB(exec, _mesa_GetnTexImageARB);
-   SET_ReadnPixelsARB(exec, _mesa_ReadnPixelsARB);
+   if (ctx->API != API_OPENGLES2) {
+      SET_GetGraphicsResetStatusARB(exec, _mesa_GetGraphicsResetStatusARB);
+      SET_GetnPolygonStippleARB(exec, _mesa_GetnPolygonStippleARB);
+      SET_GetnTexImageARB(exec, _mesa_GetnTexImageARB);
+      SET_ReadnPixelsARB(exec, _mesa_ReadnPixelsARB);
+   }
 
   /* GL_ATI_fragment_shader */
    if (ctx->API == API_OPENGL) {
@@ -700,7 +752,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
    SET_DeleteFramebuffersEXT(exec, _mesa_DeleteFramebuffersEXT);
    SET_GenFramebuffersEXT(exec, _mesa_GenFramebuffersEXT);
    SET_CheckFramebufferStatusEXT(exec, _mesa_CheckFramebufferStatusEXT);
-   SET_FramebufferTexture1DEXT(exec, _mesa_FramebufferTexture1DEXT);
+   if (ctx->API != API_OPENGLES2) {
+      SET_FramebufferTexture1DEXT(exec, _mesa_FramebufferTexture1DEXT);
+   }
    SET_FramebufferTexture2DEXT(exec, _mesa_FramebufferTexture2DEXT);
    SET_FramebufferTexture3DEXT(exec, _mesa_FramebufferTexture3DEXT);
    SET_FramebufferRenderbufferEXT(exec, _mesa_FramebufferRenderbufferEXT);
@@ -709,7 +763,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
 #endif
 
 #if FEATURE_EXT_framebuffer_blit
-   SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT);
+   if (ctx->API != API_OPENGLES2) {
+      SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT);
+   }
 #endif
 
    /* GL_EXT_gpu_program_parameters */
@@ -722,7 +778,9 @@ _mesa_create_exec_table(struct gl_context *ctx)
 
    /* GL_MESA_texture_array / GL_EXT_texture_array */
 #if FEATURE_EXT_framebuffer_object
-   SET_FramebufferTextureLayerEXT(exec, _mesa_FramebufferTextureLayerEXT);
+   if (ctx->API != API_OPENGLES2) {
+      SET_FramebufferTextureLayerEXT(exec, _mesa_FramebufferTextureLayerEXT);
+   }
 #endif
 
    /* GL_ATI_separate_stencil */
@@ -734,32 +792,44 @@ _mesa_create_exec_table(struct gl_context *ctx)
    /* The ARB_fbo functions are the union of
     * GL_EXT_fbo, GL_EXT_framebuffer_blit, GL_EXT_texture_array
     */
-   SET_RenderbufferStorageMultisample(exec, _mesa_RenderbufferStorageMultisample);
+   if (ctx->API != API_OPENGLES2) {
+      SET_RenderbufferStorageMultisample(exec, _mesa_RenderbufferStorageMultisample);
+   }
 #endif
 
 #if FEATURE_ARB_map_buffer_range
-   SET_MapBufferRange(exec, _mesa_MapBufferRange);
-   SET_FlushMappedBufferRange(exec, _mesa_FlushMappedBufferRange);
+   if (ctx->API != API_OPENGLES2) {
+      SET_MapBufferRange(exec, _mesa_MapBufferRange);
+      SET_FlushMappedBufferRange(exec, _mesa_FlushMappedBufferRange);
+   }
 #endif
 
    /* GL_ARB_copy_buffer */
-   SET_CopyBufferSubData(exec, _mesa_CopyBufferSubData);
+   if (ctx->API != API_OPENGLES2) {
+      SET_CopyBufferSubData(exec, _mesa_CopyBufferSubData);
+   }
 
    /* GL_ARB_vertex_array_object */
-   SET_BindVertexArray(exec, _mesa_BindVertexArray);
-   SET_GenVertexArrays(exec, _mesa_GenVertexArrays);
+   if (ctx->API != API_OPENGLES2) {
+      SET_BindVertexArray(exec, _mesa_BindVertexArray);
+      SET_GenVertexArrays(exec, _mesa_GenVertexArrays);
+   }
 
    /* GL_EXT_draw_buffers2 */
-   SET_ColorMaskIndexedEXT(exec, _mesa_ColorMaskIndexed);
-   SET_GetBooleanIndexedvEXT(exec, _mesa_GetBooleanIndexedv);
-   SET_GetIntegerIndexedvEXT(exec, _mesa_GetIntegerIndexedv);
-   SET_EnableIndexedEXT(exec, _mesa_EnableIndexed);
-   SET_DisableIndexedEXT(exec, _mesa_DisableIndexed);
-   SET_IsEnabledIndexedEXT(exec, _mesa_IsEnabledIndexed);
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
+      SET_ColorMaskIndexedEXT(exec, _mesa_ColorMaskIndexed);
+      SET_GetBooleanIndexedvEXT(exec, _mesa_GetBooleanIndexedv);
+      SET_GetIntegerIndexedvEXT(exec, _mesa_GetIntegerIndexedv);
+      SET_EnableIndexedEXT(exec, _mesa_EnableIndexed);
+      SET_DisableIndexedEXT(exec, _mesa_DisableIndexed);
+      SET_IsEnabledIndexedEXT(exec, _mesa_IsEnabledIndexed);
+   }
 
    /* GL_NV_conditional_render */
-   SET_BeginConditionalRenderNV(exec, _mesa_BeginConditionalRender);
-   SET_EndConditionalRenderNV(exec, _mesa_EndConditionalRender);
+   if (ctx->API != API_OPENGLES2) {
+      SET_BeginConditionalRenderNV(exec, _mesa_BeginConditionalRender);
+      SET_EndConditionalRenderNV(exec, _mesa_EndConditionalRender);
+   }
 
 #if FEATURE_OES_EGL_image
    SET_EGLImageTargetTexture2DOES(exec, _mesa_EGLImageTargetTexture2DOES);
@@ -767,64 +837,90 @@ _mesa_create_exec_table(struct gl_context *ctx)
 #endif
 
 #if FEATURE_APPLE_object_purgeable
-   SET_ObjectPurgeableAPPLE(exec, _mesa_ObjectPurgeableAPPLE);
-   SET_ObjectUnpurgeableAPPLE(exec, _mesa_ObjectUnpurgeableAPPLE);
-   SET_GetObjectParameterivAPPLE(exec, _mesa_GetObjectParameterivAPPLE);
+   if (ctx->API != API_OPENGLES2) {
+      SET_ObjectPurgeableAPPLE(exec, _mesa_ObjectPurgeableAPPLE);
+      SET_ObjectUnpurgeableAPPLE(exec, _mesa_ObjectUnpurgeableAPPLE);
+      SET_GetObjectParameterivAPPLE(exec, _mesa_GetObjectParameterivAPPLE);
+   }
 #endif
 
 #if FEATURE_ARB_geometry_shader4
-   SET_FramebufferTextureARB(exec, _mesa_FramebufferTextureARB);
-   SET_FramebufferTextureFaceARB(exec, _mesa_FramebufferTextureFaceARB);
+   if (ctx->API != API_OPENGLES2) {
+      SET_FramebufferTextureARB(exec, _mesa_FramebufferTextureARB);
+      SET_FramebufferTextureFaceARB(exec, _mesa_FramebufferTextureFaceARB);
+   }
 #endif
 
-   SET_ClampColorARB(exec, _mesa_ClampColorARB);
+   if (ctx->API != API_OPENGLES2) {
+      SET_ClampColorARB(exec, _mesa_ClampColorARB);
+   }
 
    /* GL_EXT_texture_integer */
-   SET_ClearColorIiEXT(exec, _mesa_ClearColorIiEXT);
-   SET_ClearColorIuiEXT(exec, _mesa_ClearColorIuiEXT);
-   SET_GetTexParameterIivEXT(exec, _mesa_GetTexParameterIiv);
-   SET_GetTexParameterIuivEXT(exec, _mesa_GetTexParameterIuiv);
-   SET_TexParameterIivEXT(exec, _mesa_TexParameterIiv);
-   SET_TexParameterIuivEXT(exec, _mesa_TexParameterIuiv);
+   if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
+      SET_ClearColorIiEXT(exec, _mesa_ClearColorIiEXT);
+      SET_ClearColorIuiEXT(exec, _mesa_ClearColorIuiEXT);
+   }
+   if (ctx->API != API_OPENGLES2) {
+      SET_GetTexParameterIivEXT(exec, _mesa_GetTexParameterIiv);
+      SET_GetTexParameterIuivEXT(exec, _mesa_GetTexParameterIuiv);
+      SET_TexParameterIivEXT(exec, _mesa_TexParameterIiv);
+      SET_TexParameterIuivEXT(exec, _mesa_TexParameterIuiv);
+   }
 
    /* GL_EXT_gpu_shader4 / OpenGL 3.0 */
-   SET_GetVertexAttribIivEXT(exec, _mesa_GetVertexAttribIiv);
-   SET_GetVertexAttribIuivEXT(exec, _mesa_GetVertexAttribIuiv);
-   SET_VertexAttribIPointerEXT(exec, _mesa_VertexAttribIPointer);
+   if (ctx->API != API_OPENGLES2) {
+      SET_GetVertexAttribIivEXT(exec, _mesa_GetVertexAttribIiv);
+      SET_GetVertexAttribIuivEXT(exec, _mesa_GetVertexAttribIuiv);
+      SET_VertexAttribIPointerEXT(exec, _mesa_VertexAttribIPointer);
+   }
 
    /* GL 3.0 (functions not covered by other extensions) */
-   SET_ClearBufferiv(exec, _mesa_ClearBufferiv);
-   SET_ClearBufferuiv(exec, _mesa_ClearBufferuiv);
-   SET_ClearBufferfv(exec, _mesa_ClearBufferfv);
-   SET_ClearBufferfi(exec, _mesa_ClearBufferfi);
-   SET_GetStringi(exec, _mesa_GetStringi);
-   SET_ClampColor(exec, _mesa_ClampColorARB);
+   if (ctx->API != API_OPENGLES2) {
+      SET_ClearBufferiv(exec, _mesa_ClearBufferiv);
+      SET_ClearBufferuiv(exec, _mesa_ClearBufferuiv);
+      SET_ClearBufferfv(exec, _mesa_ClearBufferfv);
+      SET_ClearBufferfi(exec, _mesa_ClearBufferfi);
+      SET_GetStringi(exec, _mesa_GetStringi);
+      SET_ClampColor(exec, _mesa_ClampColorARB);
+   }
 
    /* GL_ARB_instanced_arrays */
-   SET_VertexAttribDivisorARB(exec, _mesa_VertexAttribDivisor);
+   if (ctx->API != API_OPENGLES2) {
+      SET_VertexAttribDivisorARB(exec, _mesa_VertexAttribDivisor);
+   }
 
    /* GL_ARB_draw_buffer_blend */
-   SET_BlendFunciARB(exec, _mesa_BlendFunci);
-   SET_BlendFuncSeparateiARB(exec, _mesa_BlendFuncSeparatei);
-   SET_BlendEquationiARB(exec, _mesa_BlendEquationi);
-   SET_BlendEquationSeparateiARB(exec, _mesa_BlendEquationSeparatei);
+   if (ctx->API != API_OPENGLES2) {
+      SET_BlendFunciARB(exec, _mesa_BlendFunci);
+      SET_BlendFuncSeparateiARB(exec, _mesa_BlendFuncSeparatei);
+      SET_BlendEquationiARB(exec, _mesa_BlendEquationi);
+      SET_BlendEquationSeparateiARB(exec, _mesa_BlendEquationSeparatei);
+   }
 
    /* GL_NV_texture_barrier */
-   SET_TextureBarrierNV(exec, _mesa_TextureBarrierNV);
+   if (ctx->API != API_OPENGLES2) {
+      SET_TextureBarrierNV(exec, _mesa_TextureBarrierNV);
+   }
  
    /* GL_ARB_texture_buffer_object */
-   SET_TexBufferARB(exec, _mesa_TexBuffer);
+   if (ctx->API != API_OPENGLES2) {
+      SET_TexBufferARB(exec, _mesa_TexBuffer);
+   }
 
    /* GL_ARB_texture_storage */
-   SET_TexStorage1D(exec, _mesa_TexStorage1D);
+   if (ctx->API != API_OPENGLES2) {
+      SET_TexStorage1D(exec, _mesa_TexStorage1D);
+      SET_TextureStorage1DEXT(exec, _mesa_TextureStorage1DEXT);
+   }
    SET_TexStorage2D(exec, _mesa_TexStorage2D);
    SET_TexStorage3D(exec, _mesa_TexStorage3D);
-   SET_TextureStorage1DEXT(exec, _mesa_TextureStorage1DEXT);
    SET_TextureStorage2DEXT(exec, _mesa_TextureStorage2DEXT);
    SET_TextureStorage3DEXT(exec, _mesa_TextureStorage3DEXT);
 
 #if FEATURE_ARB_sampler_objects
-   _mesa_init_sampler_object_dispatch(exec);
+   if (ctx->API != API_OPENGLES2) {
+      _mesa_init_sampler_object_dispatch(exec);
+   }
 #endif
 
    if (_mesa_is_desktop_gl(ctx)) {
@@ -840,4 +936,4 @@ _mesa_create_exec_table(struct gl_context *ctx)
    return exec;
 }
 
-#endif /* FEATURE_GL */
+#endif /* FEATURE_GL || FEATURE_ES2 */
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index b78bcee..0a52a1a 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -431,7 +431,7 @@ one_time_init( struct gl_context *ctx )
        * when an app is linked to libGLES*, there are not enough dynamic
        * entries.
        */
-      if (_mesa_is_desktop_gl(ctx))
+      if (_mesa_is_desktop_gl(ctx) || ctx->API == API_OPENGLES2)
          _mesa_init_remap_table();
    }
 
@@ -964,9 +964,10 @@ _mesa_initialize_context(struct gl_context *ctx,
 #if FEATURE_dispatch
    /* setup the API dispatch tables */
    switch (ctx->API) {
-#if FEATURE_GL
+#if FEATURE_GL || FEATURE_ES2
    case API_OPENGL:
    case API_OPENGL_CORE:
+   case API_OPENGLES2:
       ctx->Exec = _mesa_create_exec_table(ctx);
       break;
 #endif
@@ -975,11 +976,6 @@ _mesa_initialize_context(struct gl_context *ctx,
       ctx->Exec = _mesa_create_exec_table_es1();
       break;
 #endif
-#if FEATURE_ES2
-   case API_OPENGLES2:
-      ctx->Exec = _mesa_create_exec_table_es2();
-      break;
-#endif
    default:
       _mesa_problem(ctx, "unknown or unsupported API");
       break;
diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c
index ce490ed..c73cfbb 100644
--- a/src/mesa/main/vtxfmt.c
+++ b/src/mesa/main/vtxfmt.c
@@ -218,8 +218,7 @@ install_vtxfmt(struct gl_context *ctx, struct _glapi_table *tab,
 void
 _mesa_install_exec_vtxfmt(struct gl_context *ctx, const GLvertexformat *vfmt)
 {
-   if (_mesa_is_desktop_gl(ctx))
-      install_vtxfmt( ctx, ctx->Exec, vfmt );
+   install_vtxfmt( ctx, ctx->Exec, vfmt );
 }
 
 
diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak
index dedeed9..6cb801a 100644
--- a/src/mesa/sources.mak
+++ b/src/mesa/sources.mak
@@ -6,7 +6,6 @@
 # this is part of MAIN_FILES
 MAIN_ES_FILES = \
 	$(BUILDDIR)main/api_exec_es1.c \
-	$(BUILDDIR)main/api_exec_es2.c \
 	$(SRCDIR)main/es1_conversion.c
 
 MAIN_FILES = \
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index a97f8d7..781e360 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -898,6 +898,7 @@ vbo_exec_PrimitiveRestartNV(void)
 
 static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec )
 {
+   struct gl_context *ctx = exec->ctx;
    GLvertexformat *vfmt = &exec->vtxfmt;
 
    _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_);
@@ -946,14 +947,25 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec )
    vfmt->Vertex4f = vbo_Vertex4f;
    vfmt->Vertex4fv = vbo_Vertex4fv;
    
-   vfmt->VertexAttrib1fARB = vbo_VertexAttrib1fARB;
-   vfmt->VertexAttrib1fvARB = vbo_VertexAttrib1fvARB;
-   vfmt->VertexAttrib2fARB = vbo_VertexAttrib2fARB;
-   vfmt->VertexAttrib2fvARB = vbo_VertexAttrib2fvARB;
-   vfmt->VertexAttrib3fARB = vbo_VertexAttrib3fARB;
-   vfmt->VertexAttrib3fvARB = vbo_VertexAttrib3fvARB;
-   vfmt->VertexAttrib4fARB = vbo_VertexAttrib4fARB;
-   vfmt->VertexAttrib4fvARB = vbo_VertexAttrib4fvARB;
+   if (ctx->API == API_OPENGLES2) {
+      vfmt->VertexAttrib1fARB = _es_VertexAttrib1f;
+      vfmt->VertexAttrib1fvARB = _es_VertexAttrib1fv;
+      vfmt->VertexAttrib2fARB = _es_VertexAttrib2f;
+      vfmt->VertexAttrib2fvARB = _es_VertexAttrib2fv;
+      vfmt->VertexAttrib3fARB = _es_VertexAttrib3f;
+      vfmt->VertexAttrib3fvARB = _es_VertexAttrib3fv;
+      vfmt->VertexAttrib4fARB = _es_VertexAttrib4f;
+      vfmt->VertexAttrib4fvARB = _es_VertexAttrib4fv;
+   } else {
+      vfmt->VertexAttrib1fARB = vbo_VertexAttrib1fARB;
+      vfmt->VertexAttrib1fvARB = vbo_VertexAttrib1fvARB;
+      vfmt->VertexAttrib2fARB = vbo_VertexAttrib2fARB;
+      vfmt->VertexAttrib2fvARB = vbo_VertexAttrib2fvARB;
+      vfmt->VertexAttrib3fARB = vbo_VertexAttrib3fARB;
+      vfmt->VertexAttrib3fvARB = vbo_VertexAttrib3fvARB;
+      vfmt->VertexAttrib4fARB = vbo_VertexAttrib4fARB;
+      vfmt->VertexAttrib4fvARB = vbo_VertexAttrib4fvARB;
+   }
 
    vfmt->VertexAttrib1fNV = vbo_VertexAttrib1fNV;
    vfmt->VertexAttrib1fvNV = vbo_VertexAttrib1fvNV;
-- 
1.7.6.5



More information about the mesa-dev mailing list