[Mesa-dev] [PATCH] i965: Add support for GL_SKIP_DECODE_EXT on other SRGB formats.

Kenneth Graunke kenneth at whitecape.org
Mon Jul 30 13:55:50 PDT 2012


On 07/30/2012 01:13 PM, Eric Anholt wrote:
> Fixes some failures in getteximage-formats.
> ---
>  src/mesa/drivers/dri/i965/brw_wm_surface_state.c |   14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> index 65ca2fc..9e7fcf1 100644
> --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
> @@ -31,6 +31,7 @@
>                     
>  
>  #include "main/mtypes.h"
> +#include "main/enums.h"
>  #include "main/samplerobj.h"
>  #include "program/prog_parameter.h"
>  
> @@ -598,6 +599,11 @@ translate_tex_format(gl_format mesa_format,
>  		     GLenum depth_mode,
>  		     GLenum srgb_decode)
>  {
> +   if (srgb_decode == GL_SKIP_DECODE_EXT &&
> +       _mesa_get_format_color_encoding(mesa_format) == GL_SRGB) {
> +      mesa_format = _mesa_get_srgb_format_linear(mesa_format);
> +   }
> +
>     switch( mesa_format ) {
>  
>     case MESA_FORMAT_Z16:
> @@ -613,14 +619,6 @@ translate_tex_format(gl_format mesa_format,
>     case MESA_FORMAT_Z32_FLOAT_X24S8:
>        return BRW_SURFACEFORMAT_R32G32_FLOAT;
>  
> -   case MESA_FORMAT_SARGB8:
> -   case MESA_FORMAT_SLA8:
> -   case MESA_FORMAT_SL8:
> -      if (srgb_decode == GL_DECODE_EXT)
> -	 return brw_format_for_mesa_format(mesa_format);
> -      else if (srgb_decode == GL_SKIP_DECODE_EXT)
> -	 return brw_format_for_mesa_format(_mesa_get_srgb_format_linear(mesa_format));
> -
>     case MESA_FORMAT_RGBA_FLOAT32:
>        /* The value of this BRW_SURFACEFORMAT is 0, which tricks the
>         * assertion below.

Yes, please!  I also double checked that _mesa_get_srgb_format_linear
actually handles the DXTn formats.  It does.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>


More information about the mesa-dev mailing list