r600g/sb: add support for multiple streams to SB backend
authorDave Airlie <airlied@redhat.com>
Thu, 9 Jul 2015 06:36:16 +0000 (16:36 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 2 Sep 2015 05:55:47 +0000 (15:55 +1000)
This adds a peephole and removes an assert that isn't
actually valid with some of the stream emit instructions.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/drivers/r600/sb/sb_bc_finalize.cpp
src/gallium/drivers/r600/sb/sb_bc_parser.cpp

index dadee456a1f2d2f7a8fd8aab81d14ef822278f35..522ff9d956e251ea6e8ed7f298a9fec55aaec7d8 100644 (file)
@@ -764,8 +764,6 @@ void bc_finalizer::finalize_cf(cf_node* c) {
                        mask |= (1 << chan);
                }
 
-               assert(reg >= 0 && mask);
-
                if (reg >= 0)
                        update_ngpr(reg);
 
index c4799270d9f7c16ebeeaad97e782e954178b4224..19bd0784a61eb5c1bc64bff6a4853ba012f2b6f8 100644 (file)
@@ -757,10 +757,22 @@ int bc_parser::prepare_ir() {
                        c->bc.end_of_program = eop;
 
                } else if (flags & CF_EMIT) {
-                       c->flags |= NF_DONT_KILL | NF_DONT_HOIST | NF_DONT_MOVE;
+                       /* quick peephole */
+                       cf_node *prev = static_cast<cf_node *>(c->prev);
+                       if (c->bc.op == CF_OP_CUT_VERTEX &&
+                               prev && prev->is_valid() &&
+                               prev->bc.op == CF_OP_EMIT_VERTEX &&
+                               c->bc.count == prev->bc.count) {
+                               prev->bc.set_op(CF_OP_EMIT_CUT_VERTEX);
+                               prev->bc.end_of_program = c->bc.end_of_program;
+                               c->remove();
+                       }
+                       else {
+                               c->flags |= NF_DONT_KILL | NF_DONT_HOIST | NF_DONT_MOVE;
 
-                       c->src.push_back(sh->get_special_value(SV_GEOMETRY_EMIT));
-                       c->dst.push_back(sh->get_special_value(SV_GEOMETRY_EMIT));
+                               c->src.push_back(sh->get_special_value(SV_GEOMETRY_EMIT));
+                               c->dst.push_back(sh->get_special_value(SV_GEOMETRY_EMIT));
+                       }
                }
        }