<p dir="ltr">Thanks. Rb</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Aug 18, 2016 19:46, "Kenneth Graunke" <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We want to insert the code at the end of the program. Looping over<br>
all the functions (of which there was only one) was the old way of doing<br>
this, but now we have nir_shader_get_entrypoint(), so let's use it.<br>
<br>
Suggested by Connor Abbott.<br>
<br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
.../drivers/dri/i965/brw_nir_<wbr>tcs_workarounds.c | 23 +++++++++++-----------<br>
1 file changed, 11 insertions(+), 12 deletions(-)<br>
<br>
Sorry, I pushed the patch rather quickly...here's a follow-on to use<br>
nir_shader_get_entrypoint().<br>
<br>
Shouldn't be also be using it in nir_lower_gs_intrinsics.c?<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_nir_tcs_workarounds.c b/src/mesa/drivers/dri/i965/<wbr>brw_nir_tcs_workarounds.c<br>
index 0626981..ac4f9e0 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_nir_tcs_workarounds.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_nir_tcs_workarounds.c<br>
@@ -134,19 +134,18 @@ brw_nir_apply_tcs_quads_<wbr>workaround(nir_shader *nir)<br>
{<br>
assert(nir->stage == MESA_SHADER_TESS_CTRL);<br>
<br>
- nir_foreach_function(func, nir) {<br>
- if (!func->impl)<br>
- continue;<br>
+ nir_function *func = nir_shader_get_entrypoint(nir)<wbr>;<br>
+ if (!func->impl)<br>
+ return;<br>
<br>
- nir_builder b;<br>
- nir_builder_init(&b, func->impl);<br>
+ nir_builder b;<br>
+ nir_builder_init(&b, func->impl);<br>
<br>
- struct set_entry *entry;<br>
- set_foreach(func->impl->end_<wbr>block->predecessors, entry) {<br>
- nir_block *pred = (nir_block *) entry->key;<br>
- emit_quads_workaround(&b, pred);<br>
- }<br>
-<br>
- nir_metadata_preserve(func-><wbr>impl, 0);<br>
+ struct set_entry *entry;<br>
+ set_foreach(func->impl->end_<wbr>block->predecessors, entry) {<br>
+ nir_block *pred = (nir_block *) entry->key;<br>
+ emit_quads_workaround(&b, pred);<br>
}<br>
+<br>
+ nir_metadata_preserve(func-><wbr>impl, 0);<br>
}<br>
--<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>
</blockquote></div></div>