summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/context.c')
-rw-r--r--src/mesa/main/context.c48
1 files changed, 43 insertions, 5 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 8d71cefdcf3..0963e75f35e 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -394,7 +394,25 @@ one_time_init( GLcontext *ctx )
_mesa_get_cpu_features();
- _mesa_init_remap_table();
+ switch (ctx->API) {
+#if FEATURE_GL
+ case API_OPENGL:
+ _mesa_init_remap_table();
+ break;
+#endif
+#if FEATURE_ES1
+ case API_OPENGLES:
+ _mesa_init_remap_table_es1();
+ break;
+#endif
+#if FEATURE_ES2
+ case API_OPENGLES2:
+ _mesa_init_remap_table_es2();
+ break;
+#endif
+ default:
+ break;
+ }
_mesa_init_sqrt_table();
@@ -812,9 +830,6 @@ _mesa_initialize_context_for_api(GLcontext *ctx,
assert(driverFunctions->NewTextureObject);
assert(driverFunctions->FreeTexImageData);
- /* misc one-time initializations */
- one_time_init(ctx);
-
ctx->API = api;
ctx->Visual = *visual;
ctx->DrawBuffer = NULL;
@@ -822,6 +837,9 @@ _mesa_initialize_context_for_api(GLcontext *ctx,
ctx->WinSysDrawBuffer = NULL;
ctx->WinSysReadBuffer = NULL;
+ /* misc one-time initializations */
+ one_time_init(ctx);
+
/* Plug in driver functions and context pointer here.
* This is important because when we call alloc_shared_state() below
* we'll call ctx->Driver.NewTextureObject() to create the default
@@ -853,7 +871,27 @@ _mesa_initialize_context_for_api(GLcontext *ctx,
#if FEATURE_dispatch
/* setup the API dispatch tables */
- ctx->Exec = _mesa_create_exec_table();
+ switch (ctx->API) {
+#if FEATURE_GL
+ case API_OPENGL:
+ ctx->Exec = _mesa_create_exec_table();
+ break;
+#endif
+#if FEATURE_ES1
+ case API_OPENGLES:
+ 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;
+ }
+
if (!ctx->Exec) {
_mesa_release_shared_state(ctx, ctx->Shared);
return GL_FALSE;