[Mesa-dev] [RFC 09/16] glsl/ast: Use half float type for medium and low precisions
Topi Pohjolainen
topi.pohjolainen at intel.com
Fri May 15 02:39:36 PDT 2015
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at 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
More information about the mesa-dev
mailing list