According to the GL spec, it seems when reading values from a texture in luminance format it should set the R component to the luminance value and set the G and B components to zero but Mesa is currently setting all of the components to the luminance value. This makes it so that if you try to read it back in luminance format you don't get the same values you put in. There is already code in texgetimage.c to handle this for glGetTexImage so I guess we should just copy that to somewhere in readpix.c.
This bug was found while discussing bug 46631.
Created attachment 57719 [details] [review]
Test case for piglit
Anuj, I've got some Mesa patches to fix this. I just need to clean them up and post for review...
Fixed with commit f5d0ced242abc9e4e777bbe374585f44399b75af
on Jun 27, 2016 at 02:09:16.
(provided by the Example extension).