glsl: Rewrote _mesa_glsl_process_extension to use table-driven logic.
glsl: Rewrote _mesa_glsl_process_extension to use table-driven logic.

Instead of using a chain of manually maintained if/else blocks to
handle "#extension" directives, we now consult a table that specifies,
for each extension, the circumstances under which it is available, and
what flags in _mesa_glsl_parse_state need to be set in order to
activate it.

This makes it easier to add new GLSL extensions in the future, and
fixes the following bugs:

- Previously, _mesa_glsl_process_extension would sometimes set the
  "_enable" and "_warn" flags for an extension before checking whether
  the extension was supported by the driver; as a result, specifying
  "enable" behavior for an unsupported extension would sometimes cause
  front-end support for that extension to be switched on in spite of
  the fact that back-end support was not available, leading to strange
  failures, such as those in
  https://bugs.freedesktop.org/show_bug.cgi?id=38015.

- "#extension all: warn" and "#extension all: disable" had no effect.

Notes:

- All extensions are currently marked as unavailable in geometry
  shaders.  This should not have any adverse effects since geometry
  shaders aren't supported yet.  When we return to working on geometry
  shader support, we'll need to update the table for those extensions
  that are available in geometry shaders.

- Previous to this commit, if a shader mentioned
  ARB_shader_texture_lod, extension ARB_texture_rectangle would be
  automatically turned on in order to ensure that the types
  sampler2DRect and sampler2DRectShadow would be defined.  This was
  unnecessary, because (a) ARB_shader_texture_lod works perfectly well
  without those types provided that the builtin functions that
  reference them are not called, and (b) ARB_texture_rectangle is
  enabled by default in non-ES contexts anyway.  I eliminated this
  unnecessary behavior in order to make the behavior of all extensions
  consistent.

NOTE: This is a candidate for the 7.10 and 7.11 branches.

Reviewed-by: Ian Romanick <2b237cafb16dc45038e85df6c85e74e6d899eba9@intel.com>

wolf96/glsl-optimizer,mapbox/glsl-optimizer,KTXSoftware/glsl2agal,dellis1972/glsl-optimizer,adobe/glsl2agal,jbarczak/glsl-optimizer,tokyovigilante/glsl-optimizer,metora/MesaGLSLCompiler,zeux/glsl-optimizer,mcanthony/glsl-optimizer,tokyovigilante/glsl-optimizer,bkaradzic/glsl-optimizer,wolf96/glsl-optimizer,dellis1972/glsl-optimizer,tokyovigilante/glsl-optimizer,zeux/glsl-optimizer,mapbox/glsl-optimizer,adobe/glsl2agal,bkaradzic/glsl-optimizer,zz85/glsl-optimizer,jbarczak/glsl-optimizer,benaadams/glsl-optimizer,jbarczak/glsl-optimizer,jbarczak/glsl-optimizer,KTXSoftware/glsl2agal,tokyovigilante/glsl-optimizer,dellis1972/glsl-optimizer,dellis1972/glsl-optimizer,zz85/glsl-optimizer,zz85/glsl-optimizer,bkaradzic/glsl-optimizer,zeux/glsl-optimizer,KTXSoftware/glsl2agal,djreep81/glsl-optimizer,bkaradzic/glsl-optimizer,adobe/glsl2agal,benaadams/glsl-optimizer,mcanthony/glsl-optimizer,mapbox/glsl-optimizer,benaadams/glsl-optimizer,zz85/glsl-optimizer,mcanthony/glsl-optimizer,metora/MesaGLSLCompiler,djreep81/glsl-optimizer,zeux/glsl-optimizer,djreep81/glsl-optimizer,benaadams/glsl-optimizer,benaadams/glsl-optimizer,zz85/glsl-optimizer,zz85/glsl-optimizer,mapbox/glsl-optimizer,djreep81/glsl-optimizer,wolf96/glsl-optimizer,djreep81/glsl-optimizer,dellis1972/glsl-optimizer,zeux/glsl-optimizer,wolf96/glsl-optimizer,bkaradzic/glsl-optimizer,KTXSoftware/glsl2agal,tokyovigilante/glsl-optimizer,benaadams/glsl-optimizer,wolf96/glsl-optimizer,adobe/glsl2agal,mcanthony/glsl-optimizer,metora/MesaGLSLCompiler,adobe/glsl2agal,KTXSoftware/glsl2agal,jbarczak/glsl-optimizer,mapbox/glsl-optimizer,mcanthony/glsl-optimizer