[Mesa-dev] [PATCH 8/9] dispatch: stop using _mesa_create_exec_table_es1() for GLES1.

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


This patch modifies context creation code for GLES1 to use
_mesa_create_exec_table() (which is used for all other APIs) instead
of the GLES1-specific _mesa_create_exec_table_es1().

There is a slight change in functionality.  As a result of a mistake
in the code generation of _mesa_create_exec_table_es1(), it does not
include glFlushMappedBufferRangeEXT or glMapBufferRangeEXT (this is
because when support for those two functions was added in commit
762d9ac, src/mesa/main/APIspec.xml wasn't updated).  With this patch,
glFlushMappedBufferRangeEXT and glMapBufferRangeEXT are properly
included in the dispatch table.  Accordingly, dispatch_sanity.cpp is
modified to expect these two functions to be present.

Since _mesa_create_exec_table() is available even when not building
ES1 support, we can now test GLES1.1 dispatch in all builds.
---
 src/mesa/main/context.c                 | 27 ++-------------------------
 src/mesa/main/tests/dispatch_sanity.cpp | 29 +++++++++++++++++------------
 2 files changed, 19 insertions(+), 37 deletions(-)

diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index a510738..a4dedee 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -422,14 +422,7 @@ one_time_init( struct gl_context *ctx )
    if (!(api_init_mask & (1 << ctx->API))) {
       _mesa_init_get_hash(ctx);
 
-      /*
-       * This is fine as ES does not use the remap table, but it may not be
-       * future-proof.  We cannot always initialize the remap table because
-       * when an app is linked to libGLES*, there are not enough dynamic
-       * entries.
-       */
-      if (_mesa_is_desktop_gl(ctx) || ctx->API == API_OPENGLES2)
-         _mesa_init_remap_table();
+      _mesa_init_remap_table();
    }
 
    api_init_mask |= 1 << ctx->API;
@@ -943,23 +936,7 @@ _mesa_initialize_context(struct gl_context *ctx,
    }
 
    /* setup the API dispatch tables */
-   switch (ctx->API) {
-#if FEATURE_GL || FEATURE_ES2
-   case API_OPENGL:
-   case API_OPENGL_CORE:
-   case API_OPENGLES2:
-      ctx->Exec = _mesa_create_exec_table(ctx);
-      break;
-#endif
-#if FEATURE_ES1
-   case API_OPENGLES:
-      ctx->Exec = _mesa_create_exec_table_es1();
-      break;
-#endif
-   default:
-      _mesa_problem(ctx, "unknown or unsupported API");
-      break;
-   }
+   ctx->Exec = _mesa_create_exec_table(ctx);
 
    if (!ctx->Exec) {
       _mesa_reference_shared_state(ctx, &ctx->Shared, NULL);
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp
index 1195633..58313cd 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -72,14 +72,10 @@ struct function {
    int offset;
 };
 
+extern const struct function gles11_functions_possible[];
 extern const struct function gles2_functions_possible[];
 extern const struct function gles3_functions_possible[];
 
-#if FEATURE_ES1
-extern "C" _glapi_table *_mesa_create_exec_table_es1(void);
-extern const struct function gles11_functions_possible[];
-#endif /* FEATURE_ES1 */
-
 class DispatchSanity_test : public ::testing::Test {
 public:
    virtual void SetUp();
@@ -144,14 +140,23 @@ validate_nops(const _glapi_proc *table)
    }
 }
 
-#if FEATURE_ES1
 TEST_F(DispatchSanity_test, GLES11)
 {
-   _glapi_proc *exec = (_glapi_proc *) _mesa_create_exec_table_es1();
-   validate_functions(exec, gles11_functions_possible);
-   validate_nops(exec);
+   ctx.Version = 11;
+   _mesa_initialize_context(&ctx,
+                            API_OPENGLES,
+                            &visual,
+                            NULL /* share_list */,
+                            &driver_functions);
+
+   _swrast_CreateContext(&ctx);
+   _vbo_CreateContext(&ctx);
+   _tnl_CreateContext(&ctx);
+   _swsetup_CreateContext(&ctx);
+
+   validate_functions((_glapi_proc *) ctx.Exec, gles11_functions_possible);
+   validate_nops((_glapi_proc *) ctx.Exec);
 }
-#endif /* FEATURE_ES1 */
 
 TEST_F(DispatchSanity_test, GLES2)
 {
@@ -190,7 +195,6 @@ TEST_F(DispatchSanity_test, GLES3)
    validate_nops((_glapi_proc *) ctx.Exec);
 }
 
-#if FEATURE_ES1
 const struct function gles11_functions_possible[] = {
    { "glActiveTexture", _gloffset_ActiveTextureARB },
    { "glAlphaFunc", _gloffset_AlphaFunc },
@@ -251,6 +255,7 @@ const struct function gles11_functions_possible[] = {
    { "glEnableClientState", _gloffset_EnableClientState },
    { "glFinish", _gloffset_Finish },
    { "glFlush", _gloffset_Flush },
+   { "glFlushMappedBufferRangeEXT", -1 },
    { "glFogf", _gloffset_Fogf },
    { "glFogfv", _gloffset_Fogfv },
    { "glFogx", -1 },
@@ -312,6 +317,7 @@ const struct function gles11_functions_possible[] = {
    { "glLoadMatrixx", -1 },
    { "glLogicOp", _gloffset_LogicOp },
    { "glMapBufferOES", -1 },
+   { "glMapBufferRangeEXT", -1 },
    { "glMaterialf", _gloffset_Materialf },
    { "glMaterialfv", _gloffset_Materialfv },
    { "glMaterialx", -1 },
@@ -382,7 +388,6 @@ const struct function gles11_functions_possible[] = {
    { "glViewport", _gloffset_Viewport },
    { NULL, -1 }
 };
-#endif /* FEATURE_ES1 */
 
 const struct function gles2_functions_possible[] = {
    { "glActiveTexture", _gloffset_ActiveTextureARB },
-- 
1.7.12.4



More information about the mesa-dev mailing list