On Mon, 2012-09-10 at 10:10 +0300, Ian Romanick wrote: > On 09/10/2012 09:41 AM, Imre Deak wrote: > > Needed by the next patch. > > > > Signed-off-by: Imre Deak <imre.d...@intel.com> > > --- > > src/mesa/main/context.c | 2 ++ > > src/mesa/main/mtypes.h | 2 ++ > > src/mesa/main/version.c | 3 +++ > > 3 files changed, 7 insertions(+) > > > > diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c > > index 6b28690..1167ea5 100644 > > --- a/src/mesa/main/context.c > > +++ b/src/mesa/main/context.c > > @@ -1040,6 +1040,8 @@ _mesa_initialize_context(struct gl_context *ctx, > > ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; > > ctx->Point.PointSprite = GL_TRUE; /* always on for ES 2.x */ > > break; > > + default: > > + _mesa_problem(ctx, "Unknown API %d\n", ctx->API); > > } > > > > ctx->FirstTimeCurrent = GL_TRUE; > > diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h > > index ba43e57..5fc3b8e 100644 > > --- a/src/mesa/main/mtypes.h > > +++ b/src/mesa/main/mtypes.h > > @@ -3340,6 +3340,8 @@ typedef enum > > API_OPENGLES, > > API_OPENGLES2, > > API_OPENGL_CORE, > > + > > + API_NUM, > > } gl_api; > > I'm not a fan of this. As you noticed, it means you have to add > unnecessary default cases to any switch statements involving gl_api. > Doing this means that when a new API_* is added, some switch statement > that needs to be updated may be missed. > > There are two ways to handle this that I would prefer. > > 1. Add > > API_LAST = API_OPENGL_CORE > > at the end of the enum. Then use 'API_LAST + 1' in all the places where > you now have API_NUM.
Ok, I can use this instead. > > 2. Do the above, but also add > > #define API_NUM (API_LAST + 1) > > There may be some bikeshedding over the API_NUM name as well. > > > > > /** > > diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c > > index bc7b1fa..7deb614 100644 > > --- a/src/mesa/main/version.c > > +++ b/src/mesa/main/version.c > > @@ -322,6 +322,9 @@ _mesa_compute_version(struct gl_context *ctx) > > case API_OPENGLES2: > > compute_version_es2(ctx); > > break; > > + default: > > + _mesa_problem(ctx, "unknown or unsupported API"); > > + break; > > } > > > > } > > > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev