main: Allow ctx == NULL in _mesa_validate_shader_target().

This will allow this function to be used in circumstances where there
is no context available, such as when building built-in GLSL
functions.
mesa: use _mesa_validate_shader_target() more frequently.

This patch replaces code in _mesa_new_shader() and delete_shader_cb()
that checks the type of a shader with calls to
_mesa_validate_shader_target().  This has two advantages: it allows
for a more thorough check (since _mesa_validate_shader_target()
doesn't permit shader targets that aren't supported by the back-end),
and it reduces the amount of code that will need to be modified when
adding new shader stages.
glsl/linker: Refactor in preparation for adding more shader stages.

Rather than maintain separately named arrays and counts for vertex,
geometry, and fragment shaders, just maintain these as arrays indexed
by the gl_shader_type enum.
mesa: Replace ctx->Shader.Current{Vertex,Fragment,Geometry}Program with an array.

These are replaced with
ctx->Shader.CurrentProgram[MESA_SHADER_{VERTEX,FRAGMENT,GEOMETRY}].
In patches to follow, this will allow us to replace a lot of ad-hoc
logic with a variable index into the array.

With the exception of the changes to mtypes.h, this patch was
generated entirely by the command:

    find src -type f '(' -iname '*.c' -o -iname '*.cpp' ')' \
    -print0 | xargs -0 sed -i \
    -e 's/\.CurrentVertexProgram/.CurrentProgram[MESA_SHADER_VERTEX]/g' \
    -e 's/\.CurrentGeometryProgram/.CurrentProgram[MESA_SHADER_GEOMETRY]/g' \
    -e 's/\.CurrentFragmentProgram/.CurrentProgram[MESA_SHADER_FRAGMENT]/g'
mesa: Fold long lines introduced by the previous patch.
i965: Fix comments to refer to the new ctx->Shader.CurrentProgram array.
meta: Replace save_state::{Vertex,Geometry,Fragment}Shader with an array.

Since ctx->Shader.Current{Vertex,Geometry,Fragment}Program is an
array, this allows some meta code to be rolled up into loops.
mesa: Remove ad-hoc arrays of gl_shader_program.

Now that we have a ctx->Shader.CurrentProgram array, we can just use
it directly.
mesa: Change redundant code into loops in shaderapi.c.

This is possible now that ctx->Shader.CurrentProgram is an array.
mesa: Change redundant code into loops in texstate.c

This is possible now that ctx->Shader.CurrentProgram is an array.
mesa/cs: Add extension enable flags for ARB_compute_shader.
mesa/cs: Add dispatch API stubs for ARB_compute_shader.
glsl/cs: Change some linker loops to use MESA_SHADER_FRAGMENT as a bound.

Linker loops that iterate through all the stages in the pipeline need
to use MESA_SHADER_FRAGMENT as a bound, so that we can add an
additional MESA_SHADER_COMPUTE stage, without it being erroneously
included in the pipeline.
mesa/cs: Add a MESA_SHADER_COMPUTE stage and update switch statements.

This patch adds MESA_SHADER_COMPUTE to the gl_shader_stage enum.
Also, where it is trivial to do so, it adds a compute shader case to
switch statements that switch based on the type of shader.  This
avoids "unhandled switch case" compiler warnings.
glsl/cs: Populate default values for ctx->Const.Program[MESA_SHADER_COMPUTE].
glsl/cs: update main.cpp to use the ".comp" extension for compute shaders.
mesa/cs: Handle compute shaders in _mesa_use_program().
mesa/cs: Create the gl_compute_program struct, and the code to initialize it.
mesa/cs: Implement MAX_COMPUTE_WORK_GROUP_SIZE constant.
mesa/cs: Implement MAX_COMPUTE_WORK_GROUP_INVOCATIONS constant.