<div dir="ltr"><div><div><div>If you wanted to be extra spiffy, you could add a discard helper to nir_builder and make it do it automatically :)<br><br></div>In any case,<br><br></div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 26, 2016 at 6:13 PM, Eric Anholt <span dir="ltr"><<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">vc4 is about to start using the shader info field to set up discard<br>
handling.<br>
---<br>
 src/compiler/nir/nir_lower_<wbr>bitmap.c | 2 ++<br>
 src/compiler/nir/nir_lower_<wbr>clip.c   | 2 ++<br>
 2 files changed, 4 insertions(+)<br>
<br>
diff --git a/src/compiler/nir/nir_lower_<wbr>bitmap.c b/src/compiler/nir/nir_lower_<wbr>bitmap.c<br>
index bd5c30f8dc19..216bedf57403 100644<br>
--- a/src/compiler/nir/nir_lower_<wbr>bitmap.c<br>
+++ b/src/compiler/nir/nir_lower_<wbr>bitmap.c<br>
@@ -107,6 +107,8 @@ lower_bitmap(nir_shader *shader, nir_builder *b,<br>
    discard = nir_intrinsic_instr_create(<wbr>shader, nir_intrinsic_discard_if);<br>
    discard->src[0] = nir_src_for_ssa(cond);<br>
    nir_builder_instr_insert(b, &discard->instr);<br>
+<br>
+   shader->info.fs.uses_discard = true;<br>
 }<br>
<br>
 static void<br>
diff --git a/src/compiler/nir/nir_lower_<wbr>clip.c b/src/compiler/nir/nir_lower_<wbr>clip.c<br>
index 80db653a4286..b74e6cca39f4 100644<br>
--- a/src/compiler/nir/nir_lower_<wbr>clip.c<br>
+++ b/src/compiler/nir/nir_lower_<wbr>clip.c<br>
@@ -286,6 +286,8 @@ lower_clip_fs(nir_function_<wbr>impl *impl, unsigned ucp_enables,<br>
                                               nir_intrinsic_discard_if);<br>
          discard->src[0] = nir_src_for_ssa(cond);<br>
          nir_builder_instr_insert(&b, &discard->instr);<br>
+<br>
+         b.shader->info.fs.uses_discard = true;<br>
       }<br>
    }<br>
 }<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.9.3<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>