glsl: implement switch flow control using a loop
[mesa.git] / src / glsl / opt_flip_matrices.cpp
index 497513fe82e4e01ecc2aa4850059f83fbf8bf522..04c6170b845ba204e3f65e4ec338ad520dc81b23 100644 (file)
@@ -45,8 +45,7 @@ public:
       mvp_transpose = NULL;
       texmat_transpose = NULL;
 
-      foreach_list(n, instructions) {
-         ir_instruction *ir = (ir_instruction *) n;
+      foreach_in_list(ir_instruction, ir, instructions) {
          ir_variable *var = ir->as_variable();
          if (!var)
             continue;
@@ -81,8 +80,10 @@ matrix_flipper::visit_enter(ir_expression *ir)
 
    if (mvp_transpose &&
        strcmp(mat_var->name, "gl_ModelViewProjectionMatrix") == 0) {
+#ifndef NDEBUG
       ir_dereference_variable *deref = ir->operands[0]->as_dereference_variable();
       assert(deref && deref->var == mat_var);
+#endif
 
       void *mem_ctx = ralloc_parent(ir);
 
@@ -102,8 +103,8 @@ matrix_flipper::visit_enter(ir_expression *ir)
 
       var_ref->var = texmat_transpose;
 
-      texmat_transpose->max_array_access =
-         MAX2(texmat_transpose->max_array_access, mat_var->max_array_access);
+      texmat_transpose->data.max_array_access =
+         MAX2(texmat_transpose->data.max_array_access, mat_var->data.max_array_access);
 
       progress = true;
    }