s/equal/EQUAL/, fix bugs in logical or/and code.
authorBrian <brian@yutani.localnet.net>
Wed, 7 Mar 2007 18:26:47 +0000 (11:26 -0700)
committerBrian <brian@yutani.localnet.net>
Wed, 7 Mar 2007 18:26:47 +0000 (11:26 -0700)
src/mesa/shader/slang/slang_codegen.c
src/mesa/shader/slang/slang_compile.c
src/mesa/shader/slang/slang_compile_operation.c
src/mesa/shader/slang/slang_compile_operation.h
src/mesa/shader/slang/slang_print.c
src/mesa/shader/slang/slang_typeinfo.c

index 5c2ee3c4388ef2c0608351618669419acc266804..d1e3544b5455dc084abc5f9b8f0f2843a7307fd9 100644 (file)
@@ -1650,8 +1650,8 @@ _slang_gen_logical_and(slang_assemble_ctx *A, slang_operation *oper)
    slang_operation_copy(&select->children[0], &oper->children[0]);
    slang_operation_copy(&select->children[1], &oper->children[1]);
    select->children[2].type = SLANG_OPER_LITERAL_BOOL;
-   ASSIGN_4V(select->children[2].literal, 0, 0, 0, 0);
-   select->children[2].literal_size = 2;
+   ASSIGN_4V(select->children[2].literal, 0, 0, 0, 0); /* false */
+   select->children[2].literal_size = 1;
 
    n = _slang_gen_select(A, select);
 
@@ -1680,9 +1680,9 @@ _slang_gen_logical_or(slang_assemble_ctx *A, slang_operation *oper)
 
    slang_operation_copy(&select->children[0], &oper->children[0]);
    select->children[1].type = SLANG_OPER_LITERAL_BOOL;
-   ASSIGN_4V(select->children[2].literal, 1, 1, 1, 1);
+   ASSIGN_4V(select->children[1].literal, 1, 1, 1, 1); /* true */
+   select->children[1].literal_size = 1;
    slang_operation_copy(&select->children[2], &oper->children[1]);
-   select->children[2].literal_size = 2;
 
    n = _slang_gen_select(A, select);
 
@@ -2281,11 +2281,11 @@ _slang_gen_operation(slang_assemble_ctx * A, slang_operation *oper)
       return new_node2(IR_SGT,
                       _slang_gen_operation(A, &oper->children[1]),
                       _slang_gen_operation(A, &oper->children[0]));
-   case SLANG_OPER_GREATERequal:
+   case SLANG_OPER_GREATEREQUAL:
       return new_node2(IR_SGE,
                       _slang_gen_operation(A, &oper->children[0]),
                       _slang_gen_operation(A, &oper->children[1]));
-   case SLANG_OPER_LESSequal:
+   case SLANG_OPER_LESSEQUAL:
       /* child[0] <= child[1]  ---->   child[1] >= child[0] */
       return new_node2(IR_SGE,
                       _slang_gen_operation(A, &oper->children[1]),
index 4609de684a0f85fd3b9523fff7d4e998654747c0..e1837520253b30829976ce4ccd8825e4b62d2568 100644 (file)
@@ -1037,12 +1037,12 @@ parse_expression(slang_parse_ctx * C, slang_output_ctx * O,
             return 0;
          break;
       case OP_LESSEQUAL:
-         op->type = SLANG_OPER_LESSequal;
+         op->type = SLANG_OPER_LESSEQUAL;
          if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
             return 0;
          break;
       case OP_GREATEREQUAL:
-         op->type = SLANG_OPER_GREATERequal;
+         op->type = SLANG_OPER_GREATEREQUAL;
          if (!handle_nary_expression(C, op, &ops, &num_ops, 2))
             return 0;
          break;
index aa66be889581da3f5e695a0d54d28d168da746ba..cf8208006607ea1ef187037f5b2f074d5bc2c935 100644 (file)
@@ -42,6 +42,7 @@ slang_operation_construct(slang_operation * oper)
    oper->children = NULL;
    oper->num_children = 0;
    oper->literal[0] = 0.0;
+   oper->literal_size = 1;
    oper->a_id = SLANG_ATOM_NULL;
    oper->locals = _slang_variable_scope_new(NULL);
    if (oper->locals == NULL)
@@ -104,6 +105,8 @@ slang_operation_copy(slang_operation * x, const slang_operation * y)
    z.literal[2] = y->literal[2];
    z.literal[3] = y->literal[3];
    z.literal_size = y->literal_size;
+   assert(y->literal_size >= 1);
+   assert(y->literal_size <= 4);
    z.a_id = y->a_id;
    if (y->locals) {
       if (!slang_variable_scope_copy(z.locals, y->locals)) {
index 4adcd2ab0e6691b7e19cb702df96773cd84098f7..02f677f813907e01ceec63a46f2c4547599572df 100644 (file)
@@ -77,8 +77,8 @@ typedef enum slang_operation_type_
    SLANG_OPER_NOTEQUAL,         /* [expr] "!=" [expr] */
    SLANG_OPER_LESS,             /* [expr] "<" [expr] */
    SLANG_OPER_GREATER,          /* [expr] ">" [expr] */
-   SLANG_OPER_LESSequal,        /* [expr] "<=" [expr] */
-   SLANG_OPER_GREATERequal,     /* [expr] ">=" [expr] */
+   SLANG_OPER_LESSEQUAL,        /* [expr] "<=" [expr] */
+   SLANG_OPER_GREATEREQUAL,     /* [expr] ">=" [expr] */
    /*SLANG_OPER_LSHIFT, */
    /*SLANG_OPER_RSHIFT, */
    SLANG_OPER_ADD,              /* [expr] "+" [expr] */
index e53378e46135ecfc38b08857a90dd1ed13b166be..a2f3691ddb188067853652c30d3aea2f8959b8b0 100644 (file)
@@ -499,11 +499,11 @@ slang_print_tree(const slang_operation *op, int indent)
       print_binary(op, ">", indent);
       break;
 
-   case SLANG_OPER_LESSequal:
+   case SLANG_OPER_LESSEQUAL:
       print_binary(op, "<=", indent);
       break;
 
-   case SLANG_OPER_GREATERequal:
+   case SLANG_OPER_GREATEREQUAL:
       print_binary(op, ">=", indent);
       break;
 
index 07ec514c678a660abb40b6c40865e86e60534f60..6a358d66d8927dbc20db8120896a654ba0f63d57 100644 (file)
@@ -392,8 +392,8 @@ _slang_typeof_operation_(const slang_operation * op,
    case SLANG_OPER_NOTEQUAL:
    case SLANG_OPER_LESS:
    case SLANG_OPER_GREATER:
-   case SLANG_OPER_LESSequal:
-   case SLANG_OPER_GREATERequal:
+   case SLANG_OPER_LESSEQUAL:
+   case SLANG_OPER_GREATEREQUAL:
    case SLANG_OPER_NOT:
       ti->spec.type = SLANG_SPEC_BOOL;
       break;