<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 9, 2017 at 8:40 AM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra">For similar compute-related things (workgroup sizes) we handle this directly in nir_lower_system_values.<br></div></blockquote><div><br></div><div>Doing so would probably require adding a vertices_in thing to tes... I don't know how strongly I feel about doing it one way vs. another.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><div class="gmail_quote">On Sun, Jan 8, 2017 at 9:39 PM, Dave Airlie <span dir="ltr"><<a href="mailto:airlied@gmail.com" target="_blank">airlied@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 9 January 2017 at 15:26, Kenneth Graunke <<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>> wrote:<br>
> In Vulkan, we always have both the TCS and TES available in the same<br>
> pipeline, so we can simply use the TCS OutputVertices execution mode<br>
> value as the TES PatchVertices built-in.<br>
><br>
> For GLSL, we handle this in the linker. But we could use this pass<br>
> in the case when both TCS and TES are linked together, if we wanted.<br>
><br>
> Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>><br>
<br>
</span>Reviewed-by: Dave Airlie <<a href="mailto:airlied@redhat.com" target="_blank">airlied@redhat.com</a>><br>
though I'd like someone more NIR focused to also look at it.<br>
<span class="m_2690596670397053248HOEnZb"><font color="#888888"><br>
Dave.<br>
</font></span><div class="m_2690596670397053248HOEnZb"><div class="m_2690596670397053248h5"><br>
> ---<br>
> src/compiler/Makefile.sources | 1 +<br>
> src/compiler/nir/nir.h | 1 +<br>
> src/compiler/nir/nir_lower_pat<wbr>ch_vertices.c | 53 +++++++++++++++++++++++++++++<br>
> 3 files changed, 55 insertions(+)<br>
> create mode 100644 src/compiler/nir/nir_lower_pat<wbr>ch_vertices.c<br>
><br>
> diff --git a/src/compiler/Makefile.source<wbr>s b/src/compiler/Makefile.source<wbr>s<br>
> index 52f6e5428f4..7479afae047 100644<br>
> --- a/src/compiler/Makefile.source<wbr>s<br>
> +++ b/src/compiler/Makefile.source<wbr>s<br>
> @@ -218,6 +218,7 @@ NIR_FILES = \<br>
> nir/nir_lower_io_to_scalar.c \<br>
> nir/nir_lower_io_types.c \<br>
> nir/nir_lower_passthrough_edg<wbr>eflags.c \<br>
> + nir/nir_lower_patch_vertices.<wbr>c \<br>
> nir/nir_lower_phis_to_scalar.<wbr>c \<br>
> nir/nir_lower_regs_to_ssa.c \<br>
> nir/nir_lower_returns.c \<br>
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h<br>
> index d17924c2aac..cb8f7749745 100644<br>
> --- a/src/compiler/nir/nir.h<br>
> +++ b/src/compiler/nir/nir.h<br>
> @@ -2464,6 +2464,7 @@ void nir_lower_two_sided_color(nir_<wbr>shader *shader);<br>
> void nir_lower_clamp_color_outputs(<wbr>nir_shader *shader);<br>
><br>
> void nir_lower_passthrough_edgeflag<wbr>s(nir_shader *shader);<br>
> +void nir_lower_tes_patch_vertices(n<wbr>ir_shader *tes, unsigned patch_vertices);<br>
><br>
> typedef struct nir_lower_wpos_ytransform_opti<wbr>ons {<br>
> int state_tokens[5];<br>
> diff --git a/src/compiler/nir/nir_lower_p<wbr>atch_vertices.c b/src/compiler/nir/nir_lower_p<wbr>atch_vertices.c<br>
> new file mode 100644<br>
> index 00000000000..d196576b993<br>
> --- /dev/null<br>
> +++ b/src/compiler/nir/nir_lower_p<wbr>atch_vertices.c<br>
> @@ -0,0 +1,53 @@<br>
> +/*<br>
> + * Copyright © 2016 Intel Corporation<br>
> + *<br>
> + * Permission is hereby granted, free of charge, to any person obtaining a<br>
> + * copy of this software and associated documentation files (the "Software"),<br>
> + * to deal in the Software without restriction, including without limitation<br>
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
> + * and/or sell copies of the Software, and to permit persons to whom the<br>
> + * Software is furnished to do so, subject to the following conditions:<br>
> + *<br>
> + * The above copyright notice and this permission notice (including the next<br>
> + * paragraph) shall be included in all copies or substantial portions of the<br>
> + * Software.<br>
> + *<br>
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
> + * IN THE SOFTWARE.<br>
> + */<br>
> +<br>
> +#include "nir_builder.h"<br>
> +<br>
> +void<br>
> +nir_lower_tes_patch_vertices(<wbr>nir_shader *tes_nir, unsigned patch_vertices)<br>
> +{<br>
> + nir_foreach_function(<wbr>function, tes_nir) {<br>
> + if (function->impl) {<br>
> + nir_foreach_block(block, function->impl) {<br>
> + nir_builder b;<br>
> + nir_builder_init(&b, function->impl);<br>
> + nir_foreach_instr_safe(instr, block) {<br>
> + if (instr->type == nir_instr_type_intrinsic) {<br>
> + nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);<br>
> + if (intr->intrinsic != nir_intrinsic_load_patch_verti<wbr>ces_in)<br>
> + continue;<br>
> +<br>
> + b.cursor = nir_before_instr(&intr->instr)<wbr>;<br>
> + nir_ssa_def *val = nir_imm_int(&b, patch_vertices);<br>
> + nir_ssa_def_rewrite_uses(&intr<wbr>->dest.ssa,<br>
> + nir_src_for_ssa(val));<br>
> + nir_instr_remove(instr);<br>
> + }<br>
> + }<br>
> + }<br>
> +<br>
> + nir_metadata_preserve(functio<wbr>n->impl, nir_metadata_block_index |<br>
> + nir_metadata_dominance);<br>
> + }<br>
> + }<br>
> +}<br>
> --<br>
> 2.11.0<br>
><br>
> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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>
</div></div></blockquote></div><br></div><div class="HOEnZb"><div class="h5">
</div></div></blockquote></div><br></div></div>