mesa: Fix GL_LUMINANCE handling for textures in glGetTexImage
authorAnuj Phogat <anuj.phogat@gmail.com>
Fri, 16 Nov 2012 18:47:56 +0000 (10:47 -0800)
committerAndreas Boll <andreas.boll.dev@gmail.com>
Wed, 13 Feb 2013 17:38:42 +0000 (18:38 +0100)
commitb086d9ced7d3ab07afa008aea0253c75e827f392
treeaf922e1fc094d415f4459bb2ba104238d5658b60
parentce220540744c0dde30e5670441bbc7eab915cf89
mesa: Fix GL_LUMINANCE handling for textures in glGetTexImage

We need to rebase colors (ex: set G=B=0) when getting GL_LUMINANCE
textures in following cases:
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

A similar fix was pushed by Brian Paul for uncompressed textures
in commit: f5d0ced.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=47220

Observed no regressions in piglit and ogles2conform due to this fix.
This patch will cause failures in intel oglconform pxconv-gettex,
pxstore-gettex and pxtrans-gettex test cases. The cause of failures
is a bug in test cases. Expected luminance value is calculted
incorrectly in test cases: L = R+G+B.

V2: Set G = 0 when getting a RG texture but returning luminance.

Note: This is a candidate for stable branches.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ian Romanick <idr@freedesktop.org>
(cherry picked from commit 9ab896243cfdee7f6a626aceb26e4cb88bd4da2d)
src/mesa/drivers/common/meta.c
src/mesa/main/texgetimage.c