mesa: fix GL_LUMINANCE handling in glGetTexImage
mesa: fix GL_LUMINANCE handling in glGetTexImage

There are several cases in which we need to explicity "rebase" colors
(ex: set G=B=0) when getting GL_LUMINANCE textures:
1. If the luminance texture is actually stored as rgba
2. If getting a luminance texture, but returning rgba
3. If getting an rgba texture, but returning luminance

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=46679

Also fixes the new piglit getteximage-luminance test.

Reviewed-by: José Fonseca <61b5a29db2c0650f7c8510f93eece059c1b09320@vmware.com>

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