[Mesa-dev] [PATCH v2 05/14] meta: Abort meta pbo path if readpixels need signed-unsigned conversion

Iago Toral itoral at igalia.com
Wed Jun 24 23:00:57 PDT 2015


On Wed, 2015-06-24 at 18:39 -0700, Anuj Phogat wrote:
> Meta pbo path for ReadPixels rely on BlitFramebuffer which doesn't support
> signed to unsigned integer conversions and vice versa.
> 
> Without this patch, piglit test fbo_integer_readpixels_sint_uint fails, when
> forced to use the meta pbo path.
> 
> v2: Make need_rgb_to_luminance_conversion() a static function. (Iago)

I think you meant "need_signed_unsigned_int_conversion()" here

Other than that:

Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>


>     Bump up the comment and the commit message. (Jason)
> 
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
> Cc: Iago Toral <itoral at igalia.com>
> Cc: <mesa-stable at lists.freedesktop.org>
> ---
>  src/mesa/drivers/common/meta_tex_subimage.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/src/mesa/drivers/common/meta_tex_subimage.c b/src/mesa/drivers/common/meta_tex_subimage.c
> index 00364f8..a617b77 100644
> --- a/src/mesa/drivers/common/meta_tex_subimage.c
> +++ b/src/mesa/drivers/common/meta_tex_subimage.c
> @@ -248,6 +248,23 @@ fail:
>     return success;
>  }
>  
> +static bool
> +need_signed_unsigned_int_conversion(mesa_format rbFormat,
> +                                    GLenum format, GLenum type)
> +{
> +   const GLenum srcType = _mesa_get_format_datatype(rbFormat);
> +   return (srcType == GL_INT &&
> +           _mesa_is_enum_format_integer(format) &&
> +           (type == GL_UNSIGNED_INT ||
> +            type == GL_UNSIGNED_SHORT ||
> +            type == GL_UNSIGNED_BYTE)) ||
> +          (srcType == GL_UNSIGNED_INT &&
> +           _mesa_is_enum_format_integer(format) &&
> +           (type == GL_INT ||
> +            type == GL_SHORT ||
> +            type == GL_BYTE));
> +}
> +
>  bool
>  _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
>                                struct gl_texture_image *tex_image,
> @@ -283,6 +300,14 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims,
>  
>        if (_mesa_need_rgb_to_luminance_conversion(rb->Format, format))
>           return false;
> +
> +      /* This function rely on BlitFramebuffer to fill in the pixel data for
> +       * ReadPixels. But, BlitFrameBuffer doesn't support signed to unsigned
> +       * or unsigned to signed integer conversions. OpenGL spec expects an
> +       * invalid operation in that case.
> +       */
> +      if (need_signed_unsigned_int_conversion(rb->Format, format, type))
> +         return false;
>     }
>  
>     /* For arrays, use a tall (height * depth) 2D texture but taking into




More information about the mesa-dev mailing list