nir/spirv: Add a missing break statement
[mesa.git] / src / glsl / lower_discard.cpp
index b95313df8c817e943a77081a80b9af783889ad63..b44d2a6d28da0cf3248fc8393210d6ee88dbb653 100644 (file)
 #include "glsl_types.h"
 #include "ir.h"
 
+namespace {
+
 class lower_discard_visitor : public ir_hierarchical_visitor {
 public:
    lower_discard_visitor()
@@ -120,6 +122,7 @@ public:
    bool progress;
 };
 
+} /* anonymous namespace */
 
 bool
 lower_discard(exec_list *instructions)
@@ -135,8 +138,8 @@ lower_discard(exec_list *instructions)
 static ir_discard *
 find_discard(exec_list &instructions)
 {
-   foreach_list(n, &instructions) {
-      ir_discard *ir = ((ir_instruction *) n)->as_discard();
+   foreach_in_list(ir_instruction, node, &instructions) {
+      ir_discard *ir = node->as_discard();
       if (ir != NULL)
         return ir;
    }
@@ -170,7 +173,7 @@ lower_discard_visitor::visit_leave(ir_if *ir)
    if (then_discard == NULL && else_discard == NULL)
       return visit_continue;
 
-   void *mem_ctx = talloc_parent(ir);
+   void *mem_ctx = ralloc_parent(ir);
 
    ir_variable *temp = new(mem_ctx) ir_variable(glsl_type::bool_type,
                                                "discard_cond_temp",