glsl: Pass type to is_valid_default_precision_type instead of name
authorIan Romanick <ian.d.romanick@intel.com>
Fri, 9 Aug 2013 22:15:45 +0000 (15:15 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 21 Aug 2013 14:43:48 +0000 (07:43 -0700)
This is used by the next patch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "9.2" <mesa-stable@lists.freedesktop.org>
src/glsl/ast_to_hir.cpp

index c439391ab27dd31d9d4b766388a88a55e3b19765..88d9fd60b561d17227421f1edb3d79043885b816 100644 (file)
@@ -4225,10 +4225,8 @@ ast_iteration_statement::hir(exec_list *instructions,
  * version.
  */
 static bool
-is_valid_default_precision_type(const struct _mesa_glsl_parse_state *state,
-                                const char *type_name)
+is_valid_default_precision_type(const struct glsl_type *const type)
 {
-   const struct glsl_type *type = state->symbols->get_type(type_name);
    if (type == NULL)
       return false;
 
@@ -4280,7 +4278,10 @@ ast_type_specifier::hir(exec_list *instructions,
                           "arrays");
          return NULL;
       }
-      if (!is_valid_default_precision_type(state, this->type_name)) {
+
+      const struct glsl_type *const type =
+         state->symbols->get_type(this->type_name);
+      if (!is_valid_default_precision_type(type)) {
          _mesa_glsl_error(&loc, state,
                           "default precision statements apply only to "
                           "float, int, and sampler types");