[Mesa-dev] [PATCH 3/5] meta: Move the call to _mesa_get_format_datatype() out of switch

Pohjolainen, Topi topi.pohjolainen at intel.com
Mon Aug 4 02:27:44 PDT 2014


On Wed, Jul 30, 2014 at 07:11:25PM -0700, Anuj Phogat wrote:
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>  src/mesa/drivers/common/meta.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> index ba84eb8..edddd94 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -2722,6 +2722,7 @@ static GLenum
>  get_temp_image_type(struct gl_context *ctx, mesa_format format)
>  {
>     GLenum baseFormat = _mesa_get_format_base_format(format);
> +   GLenum datatype = _mesa_get_format_datatype(format);

Same here, could be constant.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>

>     GLint format_red_bits = _mesa_get_format_bits(format, GL_RED_BITS);
>  
>     switch (baseFormat) {
> @@ -2738,25 +2739,20 @@ get_temp_image_type(struct gl_context *ctx, mesa_format format)
>        } else if (format_red_bits <= 16) {
>           return GL_UNSIGNED_SHORT;
>        } else {
> -         GLenum datatype = _mesa_get_format_datatype(format);
>           if (datatype == GL_INT || datatype == GL_UNSIGNED_INT)
>              return datatype;
>           return GL_FLOAT;
>        }
> -   case GL_DEPTH_COMPONENT: {
> -      GLenum datatype = _mesa_get_format_datatype(format);
> +   case GL_DEPTH_COMPONENT:
>        if (datatype == GL_FLOAT)
>           return GL_FLOAT;
>        else
>           return GL_UNSIGNED_INT;
> -   }
> -   case GL_DEPTH_STENCIL: {
> -      GLenum datatype = _mesa_get_format_datatype(format);
> +   case GL_DEPTH_STENCIL:
>        if (datatype == GL_FLOAT)
>           return GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
>        else
>           return GL_UNSIGNED_INT_24_8;
> -   }
>     default:
>        _mesa_problem(ctx, "Unexpected format %d in get_temp_image_type()",
>  		    baseFormat);
> -- 
> 1.9.3
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list