[Mesa-dev] [PATCH 2/7] glsl/lower_if: check more node types in check_control_flow -> check_ir_node

Marek Olšák maraeo at gmail.com
Fri Oct 28 23:13:37 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

---
 src/compiler/glsl/lower_if_to_cond_assign.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/compiler/glsl/lower_if_to_cond_assign.cpp b/src/compiler/glsl/lower_if_to_cond_assign.cpp
index 2875e79..01a7335 100644
--- a/src/compiler/glsl/lower_if_to_cond_assign.cpp
+++ b/src/compiler/glsl/lower_if_to_cond_assign.cpp
@@ -90,30 +90,33 @@ lower_if_to_cond_assign(exec_list *instructions, unsigned max_depth)
       return false;
 
    ir_if_to_cond_assign_visitor v(max_depth);
 
    visit_list_elements(&v, instructions);
 
    return v.progress;
 }
 
 void
-check_control_flow(ir_instruction *ir, void *data)
+check_ir_node(ir_instruction *ir, void *data)
 {
    ir_if_to_cond_assign_visitor *v = (ir_if_to_cond_assign_visitor *)data;
 
    switch (ir->ir_type) {
    case ir_type_call:
    case ir_type_discard:
    case ir_type_loop:
    case ir_type_loop_jump:
    case ir_type_return:
+   case ir_type_emit_vertex:
+   case ir_type_end_primitive:
+   case ir_type_barrier:
       v->found_unsupported_op = true;
       break;
    default:
       break;
    }
 }
 
 void
 move_block_to_cond_assign(void *mem_ctx,
 			  ir_if *if_ir, ir_rvalue *cond_expr,
@@ -176,24 +179,24 @@ ir_if_to_cond_assign_visitor::visit_leave(ir_if *ir)
    /* Only flatten when beyond the GPU's maximum supported nesting depth. */
    if (this->depth-- <= this->max_depth)
       return visit_continue;
 
    this->found_unsupported_op = false;
 
    ir_assignment *assign;
 
    /* Check that both blocks don't contain anything we can't support. */
    foreach_in_list(ir_instruction, then_ir, &ir->then_instructions) {
-      visit_tree(then_ir, check_control_flow, this);
+      visit_tree(then_ir, check_ir_node, this);
    }
    foreach_in_list(ir_instruction, else_ir, &ir->else_instructions) {
-      visit_tree(else_ir, check_control_flow, this);
+      visit_tree(else_ir, check_ir_node, this);
    }
    if (this->found_unsupported_op)
       return visit_continue; /* can't handle inner unsupported opcodes */
 
    void *mem_ctx = ralloc_parent(ir);
 
    /* Store the condition to a variable.  Move all of the instructions from
     * the then-clause of the if-statement.  Use the condition variable as a
     * condition for all assignments.
     */
-- 
2.7.4



More information about the mesa-dev mailing list