mesa: add support for threaded glCompileShader

Threaded glCompileShader can be enabled for a context by calling
_mesa_enable_glsl_threadpool.  It will initialize the singleton GLSL thread
pool and defer glCompileShader calls to the thread pool.

For applications to benefit from threaded glCompileShader, they have to
compile shaders in this fashion

 for (i = 0; i < num_shaders; i++)
   glCompileShader(shaders[i]);
 for (i = 0; i < num_shaders; i++)
   glGetShaderiv(shaders[i], GL_COMPILE_STATUS, &val);

As each glGetShaderiv call will force mesa to wait for the deferred
glCompileShader to complete, compiling shaders in the traditional way will
defeat this feature.  This is also why the feature needs to be explicitly
enabled with _mesa_enable_glsl_threadpool.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
i965: add drirc option multithread_glsl_compiler

Setting it to a non-zero value N will cause glCompileShader to be deferred to
a thread pool.  When N is greater than 1, it indicates the maximum number of
threads in the pool.  When N is 1, the number of threads is up to the driver.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
mail
glsl: constify gl_context for _mesa_glsl_compile_shader