dispatch: Make a header to go along with querymatrix.c.

This patch creates a header querymatrix.h, to allow functions defined
in querymatrix.c to be used from other .c files.  It also switches
from the nonstandard GL_APIENTRY to GLAPIENTRY.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

v2: Don't declare _mesa_Get{Integer,Float}v in querymatrix.c.
Instead, just include main/get.h.
dispatch: GLES1 fixes for _mesa_create_exec_table().

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.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
dispatch: stop using _mesa_create_exec_table_es1() for GLES1.

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.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>

v2: Leave GLES1.1 dispatch sanity test disabled when not building
GLES1 support.
dispatch: stop generating separate GLES1 API code.

This patch removes the generated files api_exec_es1.c,
api_exec_es1_dispatch.h, and api_exec_es1_remap_helper.h (and the
source files and build rules used to generate them), since they are no
longer used.  GLES1 now uses the same dispatch table layout as all the
other APIs.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
dispatch: Remove a few FEATURE_ES1 conditionals.

This allows the GLES1.1 dispatch sanity test to be run on all builds,
even builds that do not include GLES1 support.
glapi: Use GL_ or GLX_ prefix for all category names.

This patch standardizes the category names used in the glapi XML files
to begin each extension name with the prefix "GL_" or "GLX_".  There
is no functional change, because these category names are not used in
the generated code.
glapi: Mark GLX extensions as window_system="glX".

We were already doing this for some GLX extensions, but not others.
This patch makes our use of window_system="glX" consistent.
glapi: Annotate XML with deprecated="3.1" for deprecated functions.

Future patches will use this annotation when code generating
_mesa_create_exec_table(), to determine which functions should be
skipped in core contexts.
glapi: Annotate XML with exec="skip" for unimplemented functions.

Future patches will use this annotation when code generating
_mesa_create_exec_table(), to determine which functions should be
skipped because they aren't implemented by Mesa.
glapi: Annotate XML with exec="dynamic" for dynamic functions.

Future patches will use this annotation when code generating
_mesa_create_exec_table(), to determine which functions should be
skipped because Mesa dispatches them differently depending on GL
state.
glapi: Annotate XML with exec="loopback" for loopback functions.

Future patches will use this annotation when code generating
_mesa_create_exec_table(), to determine which functions should be
dispatched to functions in api_loopback.c.
glapi: Annotate XML with exec="{es,check}" for special GLES1 functions.

Future patches will use this annotation when code generating
_mesa_create_exec_table(), to determine which functions should be
dispatched to ES-specific implementations.  exec="es" indicates that
the ES-specific implementation has a name beginning with "_es_"
(e.g. _es_QueryMatrixxOES), and exec="check" indicates that the
ES-specific implementation has a name beginning with "_check_"
(e.g. _check_GetTexGenxvOES).
glapi: Annotate XML with desktop="false" for GLES-only functions.

Future patches will use this annotation when code generating
_mesa_create_exec_table(), to determine which functions should be
skipped when the API is desktop GL.
glapi: Annotate XML with function name suffix anomalies.

When the XML lists one or more GL api functions as aliases for another
GL function, the mesa function that implements the functionality is
usually named after the canonical version of the function (the one
that is the target of the aliases).  For example, FogCoordd is listed
as an alias of FogCoorddEXT, and the Mesa function implementing the
functionality is called loopback_FogCoorddEXT.

However, there are exceptions.  For example, Enablei is listed as an
alias of EnableIndexedEXT, but the Mesa function implementing the
functionality is called _mesa_EnableIndexed.

To account for these anomalies, this patch annotates the XML with
"mesa_name" attributes, which describe how to adjust the function name
to find the corresponding Mesa function.

For example:

  <function name="EnableIndexedEXT" mesa_name="-EXT">...</function>
  <function name="IsProgramNV" mesa_name="-NV+ARB">...</function>

means that EnableIndexedEXT is implemented by a Mesa function called
_mesa_EnableIndexed, and IsProgramNV is implemented by a Mesa function
called _mesa_IsProgramARB.

Future patches will use this annotation when code generating
_mesa_create_exec_table(), to determine the name of the Mesa function
that should be stored in each dispatch table entry.
dispatch: De-static loopback functions.

This patch removes the "static" modifier from the functions defined in
api_loopback.c, and adds them to the api_loopback.h header, so that
api_exec.c will be able to refer to them directly.
dispatch: De-static other dispatch functions.

This patch removes the "static" modifier from the API functions
declared in src/mesa/main/*.c files, and adds them to the
corresponding headers, so that api_exec will be able to refer to them
directly.
glapi/gen: Comment fix.
glapi/gen: Gather API version info across aliased functions.

gl_XML.py's gl_function class keeps track of an entry_point_api_map
property that tracks, for each set of aliased functions, which ES1 or
ES2 version the given function name first appeared in.

This patch aggregates that information together across aliased
functions, into an easier-to-use api_map property.

Future patches will use this information when code generating
_mesa_create_exec_table(), to determine which set of dispatch table
entries should be populated based on the API.
glapi/gen: handle new XML attributes.

This patch updates gl_XML.py to parse the new XML attributes "exec",
"desktop", "deprecated", and "mesa_name", which will be needed to code
generate _mesa_create_exec_table().
glapi/gen: Add code generation script for _mesa_create_exec_table().

This script generates the file api_exec.c, which contains just the
function _mesa_create_exec_table(), based on the XML files in
src/mapi/glapi/gen.

The following XML attributes, in particular, are used:
- "es1" indicates functions that should be available in ES1 contexts.
- "es2" indicates functions that should be available in ES2/ES3
  contexts.
- "exec" indicates which Mesa function should be dispatched to.  E.g.
  if the GL function is glFoo(), then:
  - exec="mesa" (the default) dispatches to _mesa_Foo().
  - exec="check" dispatches to _check_Foo().
  - exec="es" dispatches to _es_Foo().
  - exec="loopback" dispatches to loopback_Foo().
  - exec="skip" or exec="dynamic" causes this function to be skipped;
    either it is not yet supported ("skip"), or its dispatch table
    entry will be dynamically populated based on GL state ("dynamic").
- "desktop" indicates functions that should be available in desktop GL
  (non-ES) contexts.
- "deprecated" indicates functions that should not be available in
  core contexts.
- "mesa_name" indicates functions whose implementation in Mesa has a
  different suffix than the corresponding GL function name.

The generated code looks roughly like this (showing just a single
statement in each block for brevity):

    struct _glapi_table *
    _mesa_create_exec_table(struct gl_context *ctx)
    {
       struct _glapi_table *exec;

       exec = _mesa_alloc_dispatch_table(_gloffset_COUNT);
       if (exec == NULL)
          return NULL;

       if (_mesa_is_desktop_gl(ctx)) {
          SET_ActiveProgramEXT(exec, _mesa_ActiveProgramEXT);
          /* other functions not shown */
       }
       if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) {
          SET_BeginQueryARB(exec, _mesa_BeginQueryARB);
          /* other functions not shown */
       }
       if (_mesa_is_desktop_gl(ctx) || ctx->API == API_OPENGLES) {
          SET_GetPointerv(exec, _mesa_GetPointerv);
          /* other functions not shown */
       }
       if (_mesa_is_desktop_gl(ctx) || ctx->API == API_OPENGLES || ctx->API == API_OPENGLES2) {
          SET_ActiveTextureARB(exec, _mesa_ActiveTextureARB);
          /* other functions not shown */
       }
       if (_mesa_is_desktop_gl(ctx) || ctx->API == API_OPENGLES2) {
          SET_AttachShader(exec, _mesa_AttachShader);
          /* other functions not shown */
       }
       if (ctx->API == API_OPENGL) {
          SET_Accum(exec, _mesa_Accum);
          /* other functions not shown */
       }
       if (ctx->API == API_OPENGL || ctx->API == API_OPENGLES) {
          SET_AlphaFunc(exec, _mesa_AlphaFunc);
          /* other functions not shown */
       }
       if (ctx->API == API_OPENGLES) {
          SET_AlphaFuncxOES(exec, _es_AlphaFuncx);
          /* other functions not shown */
       }

       return exec;
    }