Signed-off-by: Topi Pohjolainen <topi.pohjolai...@intel.com> --- src/glsl/ir_print_visitor.cpp | 1 + src/glsl/opt_algebraic.cpp | 11 ++++++++--- src/glsl/opt_constant_propagation.cpp | 1 + src/glsl/opt_minmax.cpp | 2 ++ 4 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp index 01f52e8..1727855 100644 --- a/src/glsl/ir_print_visitor.cpp +++ b/src/glsl/ir_print_visitor.cpp @@ -424,6 +424,7 @@ void ir_print_visitor::visit(ir_constant *ir) switch (ir->type->base_type) { case GLSL_TYPE_UINT: fprintf(f, "%u", ir->value.u[i]); break; case GLSL_TYPE_INT: fprintf(f, "%d", ir->value.i[i]); break; + case GLSL_TYPE_HALF: case GLSL_TYPE_FLOAT: if (ir->value.f[i] == 0.0f) /* 0.0 == -0.0, so print with %f to get the proper sign. */ diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index fa5db70..8555d00 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -125,7 +125,8 @@ is_valid_vec_const(ir_constant *ir) static inline bool is_less_than_one(ir_constant *ir) { - assert(ir->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->type->base_type == GLSL_TYPE_HALF || + ir->type->base_type == GLSL_TYPE_FLOAT); if (!is_valid_vec_const(ir)) return false; @@ -142,7 +143,8 @@ is_less_than_one(ir_constant *ir) static inline bool is_greater_than_zero(ir_constant *ir) { - assert(ir->type->base_type == GLSL_TYPE_FLOAT); + assert(ir->type->base_type == GLSL_TYPE_HALF || + ir->type->base_type == GLSL_TYPE_FLOAT); if (!is_valid_vec_const(ir)) return false; @@ -602,6 +604,7 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) case ir_binop_div: if (is_vec_one(op_const[0]) && ( + ir->type->base_type == GLSL_TYPE_HALF || ir->type->base_type == GLSL_TYPE_FLOAT || ir->type->base_type == GLSL_TYPE_DOUBLE)) { return new(mem_ctx) ir_expression(ir_unop_rcp, @@ -798,7 +801,8 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) case ir_binop_min: case ir_binop_max: - if (ir->type->base_type != GLSL_TYPE_FLOAT || options->EmitNoSat) + if ((ir->type->base_type != GLSL_TYPE_HALF && + ir->type->base_type != GLSL_TYPE_FLOAT) || options->EmitNoSat) break; /* Replace min(max) operations and its commutative combinations with @@ -920,6 +924,7 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) ir_constant *one; switch (ir->type->base_type) { + case GLSL_TYPE_HALF: case GLSL_TYPE_FLOAT: one = new(mem_ctx) ir_constant(1.0f, op2_components); break; diff --git a/src/glsl/opt_constant_propagation.cpp b/src/glsl/opt_constant_propagation.cpp index 90cc0c8..e81a288 100644 --- a/src/glsl/opt_constant_propagation.cpp +++ b/src/glsl/opt_constant_propagation.cpp @@ -191,6 +191,7 @@ ir_constant_propagation_visitor::handle_rvalue(ir_rvalue **rvalue) } switch (type->base_type) { + case GLSL_TYPE_HALF: case GLSL_TYPE_FLOAT: data.f[i] = found->constant->value.f[rhs_channel]; break; diff --git a/src/glsl/opt_minmax.cpp b/src/glsl/opt_minmax.cpp index 23d0b10..6295d0c 100644 --- a/src/glsl/opt_minmax.cpp +++ b/src/glsl/opt_minmax.cpp @@ -125,6 +125,7 @@ compare_components(ir_constant *a, ir_constant *b) else foundequal = true; break; + case GLSL_TYPE_HALF: case GLSL_TYPE_FLOAT: if (a->value.f[c0] < b->value.f[c1]) foundless = true; @@ -181,6 +182,7 @@ combine_constant(bool ismin, ir_constant *a, ir_constant *b) (!ismin && b->value.i[i] > c->value.i[i])) c->value.i[i] = b->value.i[i]; break; + case GLSL_TYPE_HALF: case GLSL_TYPE_FLOAT: if ((ismin && b->value.f[i] < c->value.f[i]) || (!ismin && b->value.f[i] > c->value.f[i])) -- 1.9.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev