[Mesa-dev] [PATCH] glsl: remove duplicate interpolation_string() function

Samuel Iglesias Gonsálvez siglesias at igalia.com
Tue Feb 16 10:53:42 UTC 2016


Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

On Sun, Feb 14, 2016 at 09:51:31AM +1100, Timothy Arceri wrote:
> We already have one in the IR code that can be used everywhere its
> needed in the AST code so remove the one from the AST.
> ---
>  src/compiler/glsl/ast.h          | 12 ------------
>  src/compiler/glsl/ast_to_hir.cpp |  7 ++-----
>  src/compiler/glsl/ast_type.cpp   | 13 -------------
>  3 files changed, 2 insertions(+), 30 deletions(-)
> 
> diff --git a/src/compiler/glsl/ast.h b/src/compiler/glsl/ast.h
> index 9a77908..6f4da80 100644
> --- a/src/compiler/glsl/ast.h
> +++ b/src/compiler/glsl/ast.h
> @@ -726,18 +726,6 @@ struct ast_type_qualifier {
>      */
>     bool has_auxiliary_storage() const;
>  
> -   /**
> -    * \brief Return string representation of interpolation qualifier.
> -    *
> -    * If an interpolation qualifier is present, then return that qualifier's
> -    * string representation. Otherwise, return null. For example, if the
> -    * noperspective bit is set, then this returns "noperspective".
> -    *
> -    * If multiple interpolation qualifiers are somehow present, then the
> -    * returned string is undefined but not null.
> -    */
> -   const char *interpolation_string() const;
> -
>     bool merge_qualifier(YYLTYPE *loc,
>  			_mesa_glsl_parse_state *state,
>                          const ast_type_qualifier &q,
> diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
> index 05a1b57..49e9e0d 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -4862,8 +4862,7 @@ ast_declarator_list::hir(exec_list *instructions,
>            && this->type->qualifier.has_interpolation()
>            && this->type->qualifier.flags.q.varying) {
>  
> -         const char *i = this->type->qualifier.interpolation_string();
> -         assert(i != NULL);
> +         const char *i = interpolation_string(var->data.interpolation);
>           const char *s;
>           if (this->type->qualifier.flags.q.centroid)
>              s = "centroid varying";
> @@ -4893,9 +4892,7 @@ ast_declarator_list::hir(exec_list *instructions,
>        if (state->is_version(130, 300)
>            && this->type->qualifier.has_interpolation()) {
>  
> -         const char *i = this->type->qualifier.interpolation_string();
> -         assert(i != NULL);
> -
> +         const char *i = interpolation_string(var->data.interpolation);
>           switch (state->stage) {
>           case MESA_SHADER_VERTEX:
>              if (this->type->qualifier.flags.q.in) {
> diff --git a/src/compiler/glsl/ast_type.cpp b/src/compiler/glsl/ast_type.cpp
> index 7dd8798..e0014f3 100644
> --- a/src/compiler/glsl/ast_type.cpp
> +++ b/src/compiler/glsl/ast_type.cpp
> @@ -107,19 +107,6 @@ ast_type_qualifier::has_auxiliary_storage() const
>            || this->flags.q.patch;
>  }
>  
> -const char*
> -ast_type_qualifier::interpolation_string() const
> -{
> -   if (this->flags.q.smooth)
> -      return "smooth";
> -   else if (this->flags.q.flat)
> -      return "flat";
> -   else if (this->flags.q.noperspective)
> -      return "noperspective";
> -   else
> -      return NULL;
> -}
> -
>  /**
>   * This function merges both duplicate identifies within a single layout and
>   * multiple layout qualifiers on a single variable declaration. The
> -- 
> 2.5.0
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list