glsl: remove duplicate interpolation_string() function
authorTimothy Arceri <timothy.arceri@collabora.com>
Sat, 13 Feb 2016 22:51:31 +0000 (09:51 +1100)
committerTimothy Arceri <timothy.arceri@collabora.com>
Tue, 16 Feb 2016 20:26:38 +0000 (07:26 +1100)
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.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
src/compiler/glsl/ast.h
src/compiler/glsl/ast_to_hir.cpp
src/compiler/glsl/ast_type.cpp

index 03df6c0..9aa5bb9 100644 (file)
@@ -685,18 +685,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,
index 0bb2ba2..36cdd3c 100644 (file)
@@ -4690,8 +4690,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";
@@ -4721,9 +4720,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) {
index e0e3311..dcd83ef 100644 (file)
@@ -102,19 +102,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