Mesa (7.10): glsl: Fix semantic checks on precision qualifiers

Ian Romanick idr at kemper.freedesktop.org
Sat Feb 5 00:14:06 UTC 2011


Module: Mesa
Branch: 7.10
Commit: a9eec42b0e4c5acbbe6e3b949c787d56b32b76ff
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a9eec42b0e4c5acbbe6e3b949c787d56b32b76ff

Author: Chad Versace <chad.versace at intel.com>
Date:   Mon Jan 17 15:28:39 2011 -0800

glsl: Fix semantic checks on precision qualifiers

The check for
   Precision qualifiers only apply to floating point and integer types.
was incomplete. It rejected only type 'bool' and structures.
(cherry picked from commit 45e8e6c6b1b7f3bc00a578fa6809c9bc719c171a)

---

 src/glsl/ast_to_hir.cpp |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 81c27f1..4259c46 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2273,7 +2273,7 @@ ast_declarator_list::hir(exec_list *instructions,
       }
 
 
-      /* Precision qualifiers do not apply to bools and structs.
+      /* Precision qualifiers only apply to floating point and integer types.
        *
        * From section 4.5.2 of the GLSL 1.30 spec:
        *    "Any floating point or any integer declaration can have the type
@@ -2282,16 +2282,15 @@ ast_declarator_list::hir(exec_list *instructions,
        *    variables.
        */
       if (this->type->specifier->precision != ast_precision_none
-          && this->type->specifier->type_specifier == ast_bool) {
+          && !var->type->is_float()
+          && !var->type->is_integer()
+          && !(var->type->is_array()
+               && (var->type->fields.array->is_float()
+                   || var->type->fields.array->is_integer()))) {
 
          _mesa_glsl_error(&loc, state,
-                          "preicion qualifiers do not apply to type bool");
-      }
-      if (this->type->specifier->precision != ast_precision_none
-          && this->type->specifier->structure != NULL) {
-
-         _mesa_glsl_error(&loc, state,
-                          "precision qualifiers do not apply to structures");
+                          "precision qualifiers apply only to floating point "
+                          "and integer types");
       }
 
       /* Process the initializer and add its instructions to a temporary




More information about the mesa-commit mailing list