On Thu, Jan 26, 2012 at 2:56 PM, Brian Paul <span dir="ltr"><<a href="mailto:brian.e.paul@gmail.com">brian.e.paul@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Thu, Jan 26, 2012 at 4:55 PM, Ian Romanick <<a href="mailto:idr@freedesktop.org">idr@freedesktop.org</a>> wrote:<br>
> On 01/26/2012 06:40 AM, Brian Paul wrote:<br>
>><br>
>> On Tue, Jan 24, 2012 at 10:58 PM, Anuj Phogat<<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>><br>
>> wrote:<br>
>>><br>
>>> Color clamping should be enabled in glGetTexImage if texture dataType is<br>
>>> GL_UNSIGNED_NORMALIZED and format is GL_LUMINANCE or GL_LUMINANCE_ALPHA<br>
>>><br>
>>> Fixes 2 Intel oglconform test cases: pxconv-gettex and pxtrans-gettex<br>
>>> <a href="https://bugs.freedesktop.org/show_bug.cgi?id=40864" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=40864</a><br>
>>><br>
>>> NOTE: This is a candidate for the 8.0 branch<br>
>>><br>
>>> Signed-off-by: Anuj Phogat<<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>><br>
>>> ---<br>
>>> src/mesa/main/texgetimage.c | 7 ++++++-<br>
>>> 1 files changed, 6 insertions(+), 1 deletions(-)<br>
>>><br>
>>> diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c<br>
>>> index 8c85c1e..f89b868 100644<br>
>>> --- a/src/mesa/main/texgetimage.c<br>
>>> +++ b/src/mesa/main/texgetimage.c<br>
>>> @@ -415,7 +415,12 @@ get_tex_rgba(struct gl_context *ctx, GLuint<br>
>>> dimensions,<br>
>>> transferOps |= IMAGE_CLAMP_BIT;<br>
>>> }<br>
>>> }<br>
>>> -<br>
>>> + else if ((format == GL_LUMINANCE ||<br>
>>> + format == GL_LUMINANCE_ALPHA)&&<br>
>>> + dataType == GL_UNSIGNED_NORMALIZED) {<br>
>>> + transferOps |= IMAGE_CLAMP_BIT;<br>
>>> + }<br>
>>> +<br>
>>> if (_mesa_is_format_compressed(texImage->TexFormat)) {<br>
>>> get_tex_rgba_compressed(ctx, dimensions, format, type,<br>
>>> pixels, texImage, transferOps);<br>
>>> --<br>
>><br>
>><br>
>> This looks OK. However, we need to add more comments here. I had to<br>
>> do some digging to recall why luminance and lum/alpha are special.<br>
>> The reason is if the source image is RGB, the returned luminance is<br>
>> R+G+B and we need to clamp the sum to [0,1].<br>
><br>
><br>
> When Anuj and I discussed this patch, I had another concern, but I'm not<br>
> sure it matters. If dataType is GL_SIGNED_NORMALIZED, it seems like the<br>
> value should clamp to [-1,1]. We don't currently have a way to do that.<br>
> Does that seem right to you?<br>
<br>
</div></div>I would expect so too. I'll put it on my to-do list, but it might be a while.</blockquote><div>I can add clamp [-1, 1] . I'll send out a separate patch for that.</div></div><br>