If you wanted to be extra spiffy, you could add a discard helper to nir_builder and make it do it automatically :)
In any case, Reviewed-by: Jason Ekstrand <ja...@jlekstrand.net> On Fri, Aug 26, 2016 at 6:13 PM, Eric Anholt <e...@anholt.net> wrote: > vc4 is about to start using the shader info field to set up discard > handling. > --- > src/compiler/nir/nir_lower_bitmap.c | 2 ++ > src/compiler/nir/nir_lower_clip.c | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git a/src/compiler/nir/nir_lower_bitmap.c > b/src/compiler/nir/nir_lower_bitmap.c > index bd5c30f8dc19..216bedf57403 100644 > --- a/src/compiler/nir/nir_lower_bitmap.c > +++ b/src/compiler/nir/nir_lower_bitmap.c > @@ -107,6 +107,8 @@ lower_bitmap(nir_shader *shader, nir_builder *b, > discard = nir_intrinsic_instr_create(shader, > nir_intrinsic_discard_if); > discard->src[0] = nir_src_for_ssa(cond); > nir_builder_instr_insert(b, &discard->instr); > + > + shader->info.fs.uses_discard = true; > } > > static void > diff --git a/src/compiler/nir/nir_lower_clip.c > b/src/compiler/nir/nir_lower_clip.c > index 80db653a4286..b74e6cca39f4 100644 > --- a/src/compiler/nir/nir_lower_clip.c > +++ b/src/compiler/nir/nir_lower_clip.c > @@ -286,6 +286,8 @@ lower_clip_fs(nir_function_impl *impl, unsigned > ucp_enables, > nir_intrinsic_discard_if); > discard->src[0] = nir_src_for_ssa(cond); > nir_builder_instr_insert(&b, &discard->instr); > + > + b.shader->info.fs.uses_discard = true; > } > } > } > -- > 2.9.3 > > _______________________________________________ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/mesa-dev >
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev