vc4: Track the last block we emitted at the top level.
authorEric Anholt <eric@anholt.net>
Fri, 24 Feb 2017 20:00:38 +0000 (12:00 -0800)
committerEric Anholt <eric@anholt.net>
Sat, 25 Feb 2017 00:31:54 +0000 (16:31 -0800)
This will be used for delaying our VPM reads (which must be unconditional)
until just before they're used.

src/gallium/drivers/vc4/vc4_program.c
src/gallium/drivers/vc4/vc4_qir.c
src/gallium/drivers/vc4/vc4_qir.h

index e6131708c1fb2f12d057f62df7e5e9e4755edcaa..164257ec76347537cf6f8f37ae59c51b9bbf0cdb 100644 (file)
@@ -1956,11 +1956,12 @@ ntq_emit_if(struct vc4_compile *c, nir_if *if_stmt)
         qir_link_blocks(c->cur_block, after_block);
 
         qir_set_emit_block(c, after_block);
-        if (was_top_level)
+        if (was_top_level) {
                 c->execute = c->undef;
-        else
+                c->last_top_block = c->cur_block;
+        } else {
                 ntq_activate_execute_for_block(c);
-
+        }
 }
 
 static void
@@ -2084,10 +2085,12 @@ ntq_emit_loop(struct vc4_compile *c, nir_loop *loop)
         qir_link_blocks(c->cur_block, c->loop_break_block);
 
         qir_set_emit_block(c, c->loop_break_block);
-        if (was_top_level)
+        if (was_top_level) {
                 c->execute = c->undef;
-        else
+                c->last_top_block = c->cur_block;
+        } else {
                 ntq_activate_execute_for_block(c);
+        }
 
         c->loop_break_block = save_loop_break_block;
         c->loop_cont_block = save_loop_cont_block;
index ed76c64ba9c7c351a9e1132fa9c0c102e66a6fc3..c829e7f93b765da2ed8d1b6968f962e07f638a4a 100644 (file)
@@ -646,6 +646,7 @@ qir_compile_init(void)
 
         list_inithead(&c->blocks);
         qir_set_emit_block(c, qir_new_block(c));
+        c->last_top_block = c->cur_block;
 
         c->output_position_index = -1;
         c->output_color_index = -1;
index daeb52b9aee33395baea703ed46df37541ff9531..6469e51b051cd0bdd7195089863109e40a0b2736 100644 (file)
@@ -506,6 +506,7 @@ struct vc4_compile {
         struct qblock *cur_block;
         struct qblock *loop_cont_block;
         struct qblock *loop_break_block;
+        struct qblock *last_top_block;
 
         struct list_head qpu_inst_list;