[Mesa-dev] [PATCH 3/4] i965/tex_image: Pull the tex format from the renderbuffer in intelSetTexBuffer2

Chad Versace chadversary at chromium.org
Tue Nov 21 23:19:16 UTC 2017


On Wed 08 Nov 2017, Jason Ekstrand wrote:
> Cc: "17.3" <mesa-stable at lists.freedesktop.org>
> ---
>  src/mesa/drivers/dri/i965/intel_tex_image.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
> index c52992a..28800f6 100644
> --- a/src/mesa/drivers/dri/i965/intel_tex_image.c
> +++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
> @@ -462,20 +462,23 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
>        return;
>  
>     if (rb->mt->cpp == 4) {
> -      if (texture_format == __DRI_TEXTURE_FORMAT_RGB) {
> +      if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
>           internal_format = GL_RGB;
> -         texFormat = MESA_FORMAT_B8G8R8A8_UNORM;
> -      }
> -      else {
> +      else
>           internal_format = GL_RGBA;
> -         texFormat = MESA_FORMAT_B8G8R8A8_UNORM;
> -      }
>     } else if (rb->mt->cpp == 2) {
>        /* This is 565 */
>        internal_format = GL_RGB;
> -      texFormat = MESA_FORMAT_B5G6R5_UNORM;
>     }
>  
> +   /* The interactions between GLX_EXT_texture_from_pixmap and sRGB are not
> +    * defined at all.  However, since X has classically assumed that your data
> +    * is just bits and sRGB rendering was added on, the assumption is that the
> +    * the result of glXBindTexImageEXT will be a texture with a linear format
> +    * even if it was rendered with sRGB encoding enabled.
> +    */
> +   texFormat = _mesa_get_srgb_format_linear(intel_rb_format(rb));
> +
>     intel_miptree_make_shareable(brw, rb->mt);
>  
>     _mesa_lock_texture(&brw->ctx, texObj);

I believe this patch preserves behavior whenever previous behavior was
correct. And it might fix some corner case incorrect behavior where
texFormat was inferred incorrectly.

Patch 3/4 is
Reviewed-by: Chad Versace <chadversary at chromium.org>



More information about the mesa-dev mailing list