[Mesa-dev] [PATCH 06/15] mesa: Turn target_can_be_compressed() in to a utility function

Jason Ekstrand jason at jlekstrand.net
Tue Jul 29 17:01:49 PDT 2014


If we're going to make a utility function declared in glformats.h, let's
move the function body to glformats.c.


On Fri, Jun 6, 2014 at 4:57 PM, Anuj Phogat <anuj.phogat at gmail.com> wrote:

> Cc: <mesa-stable at lists.freedesktop.org>
> Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
> ---
>  src/mesa/main/glformats.h |  3 +++
>  src/mesa/main/teximage.c  | 12 ++++++------
>  2 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h
> index af10899..5c3b2e3 100644
> --- a/src/mesa/main/glformats.h
> +++ b/src/mesa/main/glformats.h
> @@ -125,6 +125,9 @@ extern GLenum
>  _mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
>                                        GLenum internalFormat);
>
> +extern GLboolean
> +_mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum
> target,
> +                               GLenum intFormat);
>
>  #ifdef __cplusplus
>  }
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 845ba80..b8627a3 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -1779,9 +1779,9 @@ compressedteximage_only_format(const struct
> gl_context *ctx, GLenum format)
>   * Helper function to determine whether a target and specific compression
>   * format are supported.
>   */
> -static GLboolean
> -target_can_be_compressed(const struct gl_context *ctx, GLenum target,
> -                         GLenum intFormat)
> +GLboolean
> +_mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum
> target,
> +                               GLenum intFormat)
>  {
>     (void) intFormat;  /* not used yet */
>
> @@ -2204,7 +2204,7 @@ texture_error_check( struct gl_context *ctx,
>
>     /* additional checks for compressed textures */
>     if (_mesa_is_compressed_format(ctx, internalFormat)) {
> -      if (!target_can_be_compressed(ctx, target, internalFormat)) {
> +      if (!_mesa_target_can_be_compressed(ctx, target, internalFormat)) {
>           _mesa_error(ctx, GL_INVALID_ENUM,
>                       "glTexImage%dD(target can't be compressed)",
> dimensions);
>           return GL_TRUE;
> @@ -2260,7 +2260,7 @@ compressed_texture_error_check(struct gl_context
> *ctx, GLint dimensions,
>     GLenum error = GL_NO_ERROR;
>     char *reason = ""; /* no error */
>
> -   if (!target_can_be_compressed(ctx, target, internalFormat)) {
> +   if (!_mesa_target_can_be_compressed(ctx, target, internalFormat)) {
>        reason = "target";
>        error = GL_INVALID_ENUM;
>        goto error;
> @@ -2694,7 +2694,7 @@ copytexture_error_check( struct gl_context *ctx,
> GLuint dimensions,
>     }
>
>     if (_mesa_is_compressed_format(ctx, internalFormat)) {
> -      if (!target_can_be_compressed(ctx, target, internalFormat)) {
> +      if (!_mesa_target_can_be_compressed(ctx, target, internalFormat)) {
>           _mesa_error(ctx, GL_INVALID_ENUM,
>                       "glCopyTexImage%dD(target)", dimensions);
>           return GL_TRUE;
> --
> 1.8.3.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140729/bb5027f4/attachment.html>


More information about the mesa-dev mailing list