dri2: Hard-code the DRI2 version
[mesa.git] / src / glsl / ast_to_hir.cpp
index 9252df1495266fa4381c504d93b1d4e32a71e89a..bbe8f0596f957dbf5ee6bf69378a4445265e3c0f 100644 (file)
@@ -760,13 +760,11 @@ do_assignment(exec_list *instructions, struct _mesa_glsl_parse_state *state,
                                           ir_var_temporary);
    ir_dereference_variable *deref_var = new(ctx) ir_dereference_variable(var);
    instructions->push_tail(var);
-   instructions->push_tail(new(ctx) ir_assignment(deref_var,
-                                                 rhs,
-                                                 NULL));
+   instructions->push_tail(new(ctx) ir_assignment(deref_var, rhs));
    deref_var = new(ctx) ir_dereference_variable(var);
 
    if (!error_emitted)
-      instructions->push_tail(new(ctx) ir_assignment(lhs, deref_var, NULL));
+      instructions->push_tail(new(ctx) ir_assignment(lhs, deref_var));
 
    return new(ctx) ir_dereference_variable(var);
 }
@@ -783,7 +781,7 @@ get_lvalue_copy(exec_list *instructions, ir_rvalue *lvalue)
    var->mode = ir_var_auto;
 
    instructions->push_tail(new(ctx) ir_assignment(new(ctx) ir_dereference_variable(var),
-                                                 lvalue, NULL));
+                                                 lvalue));
 
    return new(ctx) ir_dereference_variable(var);
 }
@@ -1223,12 +1221,12 @@ ast_expression::hir(exec_list *instructions,
         stmt->then_instructions.append_list(&rhs_instructions);
         ir_dereference *const then_deref = new(ctx) ir_dereference_variable(tmp);
         ir_assignment *const then_assign =
-           new(ctx) ir_assignment(then_deref, op[1], NULL);
+           new(ctx) ir_assignment(then_deref, op[1]);
         stmt->then_instructions.push_tail(then_assign);
 
         ir_dereference *const else_deref = new(ctx) ir_dereference_variable(tmp);
         ir_assignment *const else_assign =
-           new(ctx) ir_assignment(else_deref, new(ctx) ir_constant(false), NULL);
+           new(ctx) ir_assignment(else_deref, new(ctx) ir_constant(false));
         stmt->else_instructions.push_tail(else_assign);
 
         result = new(ctx) ir_dereference_variable(tmp);
@@ -1258,13 +1256,13 @@ ast_expression::hir(exec_list *instructions,
 
         ir_dereference *const then_deref = new(ctx) ir_dereference_variable(tmp);
         ir_assignment *const then_assign =
-           new(ctx) ir_assignment(then_deref, new(ctx) ir_constant(true), NULL);
+           new(ctx) ir_assignment(then_deref, new(ctx) ir_constant(true));
         stmt->then_instructions.push_tail(then_assign);
 
         stmt->else_instructions.append_list(&rhs_instructions);
         ir_dereference *const else_deref = new(ctx) ir_dereference_variable(tmp);
         ir_assignment *const else_assign =
-           new(ctx) ir_assignment(else_deref, op[1], NULL);
+           new(ctx) ir_assignment(else_deref, op[1]);
         stmt->else_instructions.push_tail(else_assign);
 
         result = new(ctx) ir_dereference_variable(tmp);
@@ -1452,14 +1450,14 @@ ast_expression::hir(exec_list *instructions,
         ir_dereference *const then_deref =
            new(ctx) ir_dereference_variable(tmp);
         ir_assignment *const then_assign =
-           new(ctx) ir_assignment(then_deref, op[1], NULL);
+           new(ctx) ir_assignment(then_deref, op[1]);
         stmt->then_instructions.push_tail(then_assign);
 
         else_instructions.move_nodes_to(& stmt->else_instructions);
         ir_dereference *const else_deref =
            new(ctx) ir_dereference_variable(tmp);
         ir_assignment *const else_assign =
-           new(ctx) ir_assignment(else_deref, op[2], NULL);
+           new(ctx) ir_assignment(else_deref, op[2]);
         stmt->else_instructions.push_tail(else_assign);
 
         result = new(ctx) ir_dereference_variable(tmp);
@@ -3438,9 +3436,7 @@ ast_jump_statement::hir(exec_list *instructions,
               new(ctx) ir_dereference_variable(is_break_var);
            ir_constant *const true_val = new(ctx) ir_constant(true);
            ir_assignment *const set_break_var =
-              new(ctx) ir_assignment(deref_is_break_var,
-                                     true_val,
-                                     NULL);
+              new(ctx) ir_assignment(deref_is_break_var, true_val);
            
            instructions->push_tail(set_break_var);
         }
@@ -3521,11 +3517,9 @@ ast_switch_statement::hir(exec_list *instructions,
     *
     *    "The type of init-expression in a switch statement must be a 
     *     scalar integer." 
-    *
-    * The checks are separated so that higher quality diagnostics can be
-    * generated for cases where the rule is violated.
     */
-   if (!test_expression->type->is_integer()) {
+   if (!test_expression->type->is_scalar() ||
+       !test_expression->type->is_integer()) {
       YYLTYPE loc = this->test_expression->get_location();
 
       _mesa_glsl_error(& loc,
@@ -3556,8 +3550,7 @@ ast_switch_statement::hir(exec_list *instructions,
    ir_dereference_variable *deref_is_fallthru_var =
       new(ctx) ir_dereference_variable(state->switch_state.is_fallthru_var);
    instructions->push_tail(new(ctx) ir_assignment(deref_is_fallthru_var,
-                                                 is_fallthru_val,
-                                                 NULL));
+                                                 is_fallthru_val));
 
    /* Initalize is_break state to false.
     */
@@ -3570,8 +3563,7 @@ ast_switch_statement::hir(exec_list *instructions,
    ir_dereference_variable *deref_is_break_var =
       new(ctx) ir_dereference_variable(state->switch_state.is_break_var);
    instructions->push_tail(new(ctx) ir_assignment(deref_is_break_var,
-                                                 is_break_val,
-                                                 NULL));
+                                                 is_break_val));
 
    /* Cache test expression.
     */
@@ -3601,15 +3593,14 @@ ast_switch_statement::test_to_hir(exec_list *instructions,
       test_expression->hir(instructions,
                           state);
 
-   state->switch_state.test_var = new(ctx) ir_variable(glsl_type::int_type,
+   state->switch_state.test_var = new(ctx) ir_variable(test_val->type,
                                                       "switch_test_tmp",
                                                       ir_var_temporary);
    ir_dereference_variable *deref_test_var =
       new(ctx) ir_dereference_variable(state->switch_state.test_var);
 
    instructions->push_tail(state->switch_state.test_var);
-   instructions->push_tail(new(ctx) ir_assignment(deref_test_var, test_val,
-                                                 NULL));
+   instructions->push_tail(new(ctx) ir_assignment(deref_test_var, test_val));
 }
 
 
@@ -3731,7 +3722,6 @@ ast_case_label::hir(exec_list *instructions,
         new(ctx) ir_dereference_variable(state->switch_state.test_var);
 
       ir_rvalue *const test_cond = new(ctx) ir_expression(ir_binop_all_equal,
-                                                         glsl_type::bool_type,
                                                          label_const,
                                                          deref_test_var);
 
@@ -3743,13 +3733,10 @@ ast_case_label::hir(exec_list *instructions,
       instructions->push_tail(set_fallthru_on_test);
    } else { /* default case */
       if (state->switch_state.previous_default) {
-        printf("a\n");
         YYLTYPE loc = this->get_location();
         _mesa_glsl_error(& loc, state,
                          "multiple default labels in one switch");
 
-        printf("b\n");
-
         loc = state->switch_state.previous_default->get_location();
         _mesa_glsl_error(& loc, state,
                          "this is the first default label");
@@ -3758,7 +3745,7 @@ ast_case_label::hir(exec_list *instructions,
 
       /* Set falltrhu state. */
       ir_assignment *set_fallthru =
-        new(ctx) ir_assignment(deref_fallthru_var, true_val, NULL);
+        new(ctx) ir_assignment(deref_fallthru_var, true_val);
 
       instructions->push_tail(set_fallthru);
    }
@@ -3788,9 +3775,7 @@ ast_iteration_statement::condition_to_hir(ir_loop *stmt,
          * like 'if (!condition) break;' as the loop termination condition.
          */
         ir_rvalue *const not_cond =
-           new(ctx) ir_expression(ir_unop_logic_not, glsl_type::bool_type,
-                                  cond,
-                                  NULL);
+           new(ctx) ir_expression(ir_unop_logic_not, cond);
 
         ir_if *const if_stmt = new(ctx) ir_if(not_cond);
 
@@ -4004,6 +3989,17 @@ ast_struct_specifier::hir(exec_list *instructions,
    return NULL;
 }
 
+ir_rvalue *
+ast_uniform_block::hir(exec_list *instructions,
+                      struct _mesa_glsl_parse_state *state)
+{
+   /* The ast_uniform_block has a list of ast_declarator_lists.  We
+    * need to turn those into ir_variables with an association
+    * with this uniform block.
+    */
+   return NULL;
+}
+
 static void
 detect_conflicting_assignments(struct _mesa_glsl_parse_state *state,
                               exec_list *instructions)