Mesa (7.9): glsl: Accept precision qualifiers on sampler types, but only in ES.

Kenneth Graunke kwg at kemper.freedesktop.org
Wed May 25 18:28:06 UTC 2011


Module: Mesa
Branch: 7.9
Commit: 5408ccb09f6f6cb8643ae9bb7169150dfa715a16
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5408ccb09f6f6cb8643ae9bb7169150dfa715a16

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sat Mar 26 23:37:09 2011 -0700

glsl: Accept precision qualifiers on sampler types, but only in ES.

GLSL 1.30 states clearly that only float and int are allowed, while the
GLSL ES specification's issues section states that sampler types may
take precision qualifiers.

Fixes compilation failures in 3DMarkMobileES 2.0 and GLBenchmark 2.0,
as well as a regression in the Meego Tablet UX.

(cherry-picked from 45e8e6c6b1b7f3bc00a578fa6809c9bc719c171a)

---

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

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 6a916bb..b41e305 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2021,17 +2021,24 @@ ast_declarator_list::hir(exec_list *instructions,
        *    preceded by one of these precision qualifiers [...] Literal
        *    constants do not have precision qualifiers. Neither do Boolean
        *    variables.
+       *
+       * In GLSL ES, sampler types are also allowed.
+       *
+       * From page 87 of the GLSL ES spec:
+       *    "RESOLUTION: Allow sampler types to take a precision qualifier."
        */
       if (this->type->specifier->precision != ast_precision_none
           && !var->type->is_float()
           && !var->type->is_integer()
+          && !(var->type->is_sampler() && state->es_shader)
           && !(var->type->is_array()
                && (var->type->fields.array->is_float()
                    || var->type->fields.array->is_integer()))) {
 
          _mesa_glsl_error(&loc, state,
-                          "precision qualifiers apply only to floating point "
-                          "and integer types");
+                          "precision qualifiers apply only to floating point"
+                          "%s types", state->es_shader ? ", integer, and sampler"
+						       : "and integer");
       }
 
       /* Process the initializer and add its instructions to a temporary




More information about the mesa-commit mailing list