[Mesa-dev] [PATCH 3/6] i915: Use _mesa_get_format_name to describe translate_tex_format() fail.

Kenneth Graunke kenneth at whitecape.org
Mon Jul 11 22:53:48 PDT 2011


On 07/11/2011 06:53 PM, Eric Anholt wrote:
> I don't want to go count up to what format number 29 is.

Presumably earlier checking has ensured that mesa_format is actually a
legitimate format (if it could be a random GLuint, _mesa_get_format_info
could index an array out of bounds).  But I assume such checking is in
place.  So:

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

> ---
>  src/mesa/drivers/dri/i915/i830_texstate.c |    3 ++-
>  src/mesa/drivers/dri/i915/i915_texstate.c |    3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c
> index d4af5e5..71ce44f 100644
> --- a/src/mesa/drivers/dri/i915/i830_texstate.c
> +++ b/src/mesa/drivers/dri/i915/i830_texstate.c
> @@ -76,7 +76,8 @@ translate_texture_format(GLuint mesa_format)
>     case MESA_FORMAT_RGBA_DXT5:
>        return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
>     default:
> -      fprintf(stderr, "%s: bad image format %x\n", __FUNCTION__, mesa_format);
> +      fprintf(stderr, "%s: bad image format %s\n", __FUNCTION__,
> +	      _mesa_get_format_name(mesa_format));
>        abort();
>        return 0;
>     }
> diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c
> index bcf42d5..90ebee3 100644
> --- a/src/mesa/drivers/dri/i915/i915_texstate.c
> +++ b/src/mesa/drivers/dri/i915/i915_texstate.c
> @@ -89,7 +89,8 @@ translate_texture_format(gl_format mesa_format, GLenum DepthMode)
>        else
>  	 return (MAPSURF_32BIT | MT_32BIT_x8L24);
>     default:
> -      fprintf(stderr, "%s: bad image format %x\n", __FUNCTION__, mesa_format);
> +      fprintf(stderr, "%s: bad image format %s\n", __FUNCTION__,
> +	      _mesa_get_format_name(mesa_format));
>        abort();
>        return 0;
>     }


More information about the mesa-dev mailing list