From: Eric Anholt Date: Fri, 26 Mar 2010 19:16:54 +0000 (-0700) Subject: Add support for ast_to_hir of pre inc/dec. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=76ea56c007263ec3b79234e7b775e3a7b519a54a;p=mesa.git Add support for ast_to_hir of pre inc/dec. --- diff --git a/ast_to_hir.cpp b/ast_to_hir.cpp index f8ca3710340..67fed4cc893 100644 --- a/ast_to_hir.cpp +++ b/ast_to_hir.cpp @@ -656,7 +656,26 @@ ast_expression::hir(exec_list *instructions, case ast_conditional: case ast_pre_inc: - case ast_pre_dec: + case ast_pre_dec: { + op[0] = this->subexpressions[0]->hir(instructions, state); + if (op[0]->type->base_type == GLSL_TYPE_FLOAT) + op[1] = new ir_constant(1.0f); + else + op[1] = new ir_constant(1); + + type = arithmetic_result_type(op[0]->type, op[1]->type, + false, state); + + struct ir_rvalue *temp_rhs; + temp_rhs = new ir_expression(operations[this->oper], type, + op[0], op[1]); + + result = do_assignment(instructions, state, op[0], temp_rhs, + this->subexpressions[0]->get_location()); + type = result->type; + error_emitted = op[0]->type->is_error(); + break; + } case ast_post_inc: case ast_post_dec: {