[Mesa-dev] [PATCH 1/3] mesa: Use helper function need_rgb_to_luminance_conversion()

Tapani Pälli tapani.palli at intel.com
Thu Jun 11 10:08:44 PDT 2015


On 06/11/2015 08:00 PM, Anuj Phogat wrote:
> On Thu, Jun 11, 2015 at 2:44 AM, Tapani Pälli <tapani.palli at intel.com> wrote:
>>
>> On 06/11/2015 02:54 AM, Anuj Phogat wrote:
>>> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
>>> ---
>>>    src/mesa/main/readpix.c | 11 ++++-------
>>>    1 file changed, 4 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
>>> index 9166a50..cba9db8 100644
>>> --- a/src/mesa/main/readpix.c
>>> +++ b/src/mesa/main/readpix.c
>>> @@ -421,7 +421,7 @@ read_rgba_pixels( struct gl_context *ctx,
>>>                      const struct gl_pixelstore_attrib *packing )
>>>    {
>>>       GLbitfield transferOps;
>>> -   bool dst_is_integer, dst_is_luminance, needs_rebase;
>>> +   bool dst_is_integer, convert_rgb_to_lum, needs_rebase;
>>>       int dst_stride, src_stride, rb_stride;
>>>       uint32_t dst_format, src_format;
>>>       GLubyte *dst, *map;
>>> @@ -442,10 +442,7 @@ read_rgba_pixels( struct gl_context *ctx,
>>>       dst_is_integer = _mesa_is_enum_format_integer(format);
>>>       dst_stride = _mesa_image_row_stride(packing, width, format, type);
>>>       dst_format = _mesa_format_from_format_and_type(format, type);
>>> -   dst_is_luminance = format == GL_LUMINANCE ||
>>> -                      format == GL_LUMINANCE_ALPHA ||
>>> -                      format == GL_LUMINANCE_INTEGER_EXT ||
>>> -                      format == GL_LUMINANCE_ALPHA_INTEGER_EXT;
>>
>>
>> Is it ok to drop checks for GL_LUMINANCE_INTEGER_EXT and
>> GL_LUMINANCE_ALPHA_INTEGER_EXT, these are not checked against in
>> need_rgb_to_luminance_conversion function?
>>
> No, It's not ok. I missed a patch in this series. Sent it out as 0.5/3 of
> this series.

OK, with that this patch is

Reviewed-by: Tapani Pälli <tapani.palli at intel.com>

>>
>>> +   convert_rgb_to_lum = need_rgb_to_luminance_conversion(rb->Format,
>>> format);
>>>       dst = (GLubyte *) _mesa_image_address2d(packing, pixels, width,
>>> height,
>>>                                               format, type, 0, 0);
>>>
>>> @@ -493,7 +490,7 @@ read_rgba_pixels( struct gl_context *ctx,
>>>        */
>>>       assert(!transferOps || (transferOps && !dst_is_integer));
>>>
>>> -   needs_rgba = transferOps || dst_is_luminance;
>>> +   needs_rgba = transferOps || convert_rgb_to_lum;
>>>       rgba = NULL;
>>>       if (needs_rgba) {
>>>          uint32_t rgba_format;
>>> @@ -566,7 +563,7 @@ read_rgba_pixels( struct gl_context *ctx,
>>>        * If the dst format is Luminance, we need to do the conversion by
>>> computing
>>>        * L=R+G+B values.
>>>        */
>>> -   if (!dst_is_luminance) {
>>> +   if (!convert_rgb_to_lum) {
>>>          _mesa_format_convert(dst, dst_format, dst_stride,
>>>                               src, src_format, src_stride,
>>>                               width, height,
>>>



More information about the mesa-dev mailing list