On 11/16/2012 05:06 PM, Anuj Phogat wrote:
On Fri, Nov 16, 2012 at 3:28 PM, Ian Romanick<i...@freedesktop.org>  wrote:
On 11/16/2012 01:21 PM, Anuj Phogat wrote:

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 intel oglconform pxconv-gettex test:
https://bugs.freedesktop.org/show_bug.cgi?id=47220

Observed no failures in piglit and ogles2conform due to this fix.
This patch will cause failures in intel oglconform pxstore-gettex
and pxtrans-gettex test cases. The cause of a failures is a bug
in test cases. Expected luminance value is calculted incorrectly:

                                              calculated

L = R+G+B.


This seems weird.  We fail pxconv-gettex because we convert the luminance
texture supplied by the application to RGB by replicating the L value to
each of R, G, and B.  In this case, and this case only, we need to read back
luminance by just returning R.  If the application actually specified an RGB
texture, we need to read back luminance by R+G+B.  Right?

If a texture is stored in RGB/RGBA internal format and we later read it back
using glGetTexImage. There is no way to find out the format of initial texture
data supplied by application later in the driver.

Mmm, you should be able to look at gl_texture_image::InternalFormat to see what the user requested. And then check for luminance with _mesa_base_tex_format(texImage->InternalFormat)==GL_LUMINANCE.


For glGetTexImage we
return L = Tex(R). This is what we do in mesa for uncompressed textures.
it's different from glReadPixels which returns L=R+G+B.

Does this match what pxconv-gettex and pxconv-trans expect?

This L vs. RGB crap confuses me every time...

Yeah this is confusing. pxstore-gettex and pxtrans-gettex expects
L=R+G+B  when getting an rgba texture, but returning luminance.
Sometime back I submitted a fix to change the expected values
in pxconv-gettex to L = tex(R). Similar fix is required for failing two
test cases.

-Brian
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to