Xiang, Haihao wrote:
>> -----Original Message-----
>> From: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of Brian Paul
>> Sent: 2007年3月10日 0:14
>> To: [EMAIL PROTECTED]
>> Subject: mesa: Branch 'master'
>>
>> src/mesa/main/image.c    |   19 ++++++++++++++-----
>> src/mesa/main/mtypes.h   |    1 +
>> src/mesa/main/texstore.c |    2 +-
>> 3 files changed, 16 insertions(+), 6 deletions(-)
>>
>> New commits:
>> diff-tree f9f79c8d770e696249bd98c68b563f887562c974 (from
>> 4d9901a1cab8e0d55b1b2309cf3ffec235e53149)
>> Author: Brian <[EMAIL PROTECTED]>
>> Date:   Fri Mar 9 09:08:41 2007 -0700
>>
>>    New IMAGE_RED_TO_LUMINANCE flag passed to _mesa_pack_rgba_span_float() to
>> fix glGetTexImage(GL_LUMINANCE) bug #10232.
>>
> It seems some glGetTexImage issues still exist (see 
> http://bugs.freedesktop.org/show_bug.cgi?id=10288)
> 
>>From the context, the format passed to _mesa_pack_rgba_span_float is the 
>>format of the target, the base internal format of the texture image is 
>>invisible in _mesa_pack_rgba_span_float. So I think the color components 
>>should be assigned among R, G, B, A according to table 6.1(spec2.1) before 
>>calling  _mesa_pack_rgba_span_float.  
> The following patch works fine for me.
> 
> diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
> index 994fb16..8ef4039 100644
> --- a/src/mesa/main/texstore.c
> +++ b/src/mesa/main/texstore.c
> @@ -3608,6 +3608,22 @@ #endif /* FEATURE_EXT_texture_sRGB */
>                 GLint col;
>                 for (col = 0; col < width; col++) {
>                    (*texImage->FetchTexelf)(texImage, col, row, img, 
> rgba[col]);
> +                  if (texImage->TexFormat->BaseFormat == GL_ALPHA) {
> +                      rgba[col][RCOMP] = 0.0;
> +                      rgba[col][GCOMP] = 0.0;
> +                      rgba[col][BCOMP] = 0.0;
> +                  } else if (texImage->TexFormat->BaseFormat == 
> GL_LUMINANCE) {
> +                      rgba[col][GCOMP] = 0.0;
> +                      rgba[col][BCOMP] = 0.0;
> +                      rgba[col][ACOMP] = 1.0;
> +                  } else if (texImage->TexFormat->BaseFormat == 
> GL_LUMINANCE_ALPHA) {
> +                      rgba[col][GCOMP] = 0.0;
> +                      rgba[col][BCOMP] = 0.0;
> +                  } else if (texImage->TexFormat->BaseFormat == 
> GL_INTENSITY) {
> +                      rgba[col][GCOMP] = 0.0;
> +                      rgba[col][BCOMP] = 0.0;
> +                      rgba[col][ACOMP] = 1.0;
> +                  }
>                 }
>                 _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
>                                            format, type, dest,
> 
Yes, looks like that's needed. I guess the root cause is really that the
spec says that "fetchTexel" is different if it's used for actual
texturing or just for readback.
I think though it should not be necessary to fix up R,G,B for GL_ALPHA
and A for GL_LUMINANCE, as the fetchtexel functions already should do
that (as it's the same as when used for texturing). Not doing that
wouldn't make the code more obvious though exactly...

Roland

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to