Signed-off-by: Topi Pohjolainen <topi.pohjolai...@intel.com>
---
 src/glsl/ast_to_hir.cpp | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 332de5b..a8909ce 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1962,17 +1962,23 @@ ast_fully_specified_type::glsl_type(const char **name,
    if (type == NULL)
       return NULL;
 
-   if (type->base_type == GLSL_TYPE_FLOAT
-       && state->es_shader
-       && state->stage == MESA_SHADER_FRAGMENT
-       && this->qualifier.precision == ast_precision_none
-       && state->symbols->get_variable("#default precision") == NULL) {
+   if (type->base_type != GLSL_TYPE_FLOAT || !state->es_shader)
+      return type;
+
+   if (state->stage == MESA_SHADER_FRAGMENT &&
+       this->qualifier.precision == ast_precision_none &&
+       !state->symbols->get_variable("#default precision")) {
       YYLTYPE loc = this->get_location();
       _mesa_glsl_error(&loc, state,
                        "no precision specified this scope for type `%s'",
                        type->name);
    }
 
+   if (this->qualifier.precision == ast_precision_medium ||
+       this->qualifier.precision == ast_precision_low)
+      type = glsl_type::get_instance(
+         GLSL_TYPE_HALF, type->vector_elements, type->matrix_columns);
+
    return type;
 }
 
-- 
1.9.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to