Mesa (master): nir/lower_gs_intrinsics: Use nir_builder control-flow helpers

Jason Ekstrand jekstrand at kemper.freedesktop.org
Thu Mar 2 02:18:43 UTC 2017


Module: Mesa
Branch: master
Commit: 3ce8eeb5a1252173f68c63e9b8341a71012e0e76
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3ce8eeb5a1252173f68c63e9b8341a71012e0e76

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Wed Feb 15 10:14:47 2017 -0800

nir/lower_gs_intrinsics: Use nir_builder control-flow helpers

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

---

 src/compiler/nir/nir_lower_gs_intrinsics.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/compiler/nir/nir_lower_gs_intrinsics.c b/src/compiler/nir/nir_lower_gs_intrinsics.c
index 3acb742..68e20dd 100644
--- a/src/compiler/nir/nir_lower_gs_intrinsics.c
+++ b/src/compiler/nir/nir_lower_gs_intrinsics.c
@@ -84,12 +84,7 @@ rewrite_emit_vertex(nir_intrinsic_instr *intrin, struct state *state)
     * The new if statement needs to be hooked up to the control flow graph
     * before we start inserting instructions into it.
     */
-   nir_if *if_stmt = nir_if_create(b->shader);
-   if_stmt->condition = nir_src_for_ssa(nir_ilt(b, count, max_vertices));
-   nir_builder_cf_insert(b, &if_stmt->cf_node);
-
-   /* Fill out the new then-block */
-   b->cursor = nir_after_cf_list(&if_stmt->then_list);
+   nir_push_if(b, nir_ilt(b, count, max_vertices));
 
    nir_intrinsic_instr *lowered =
       nir_intrinsic_instr_create(b->shader,
@@ -103,6 +98,8 @@ rewrite_emit_vertex(nir_intrinsic_instr *intrin, struct state *state)
                  nir_iadd(b, count, nir_imm_int(b, 1)),
                  0x1); /* .x */
 
+   nir_pop_if(b, NULL);
+
    nir_instr_remove(&intrin->instr);
 
    state->progress = true;




More information about the mesa-commit mailing list