<div dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 17, 2019 at 5:21 AM Boris Brezillon <<a href="mailto:boris.brezillon@collabora.com">boris.brezillon@collabora.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The code considers that projector lowering was done even if it's not<br>
really the case. Change the project_src() prototype to return a bool<br>
encoding whether projector lowering happened or not and update the<br>
progress var accordingly in nir_lower_tex_block().<br>
<br>
This prevents an infinite loop when doing:<br>
<br>
do progress = nir_lower_tex(); while (progress);<br>
<br>
Signed-off-by: Boris Brezillon <<a href="mailto:boris.brezillon@collabora.com" target="_blank">boris.brezillon@collabora.com</a>><br>
---<br>
src/compiler/nir/nir_lower_tex.c | 8 ++++----<br>
1 file changed, 4 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c<br>
index c29581d9b048..73b26dbdb238 100644<br>
--- a/src/compiler/nir/nir_lower_tex.c<br>
+++ b/src/compiler/nir/nir_lower_tex.c<br>
@@ -39,13 +39,13 @@<br>
#include "nir_builder.h"<br>
#include "nir_format_convert.h"<br>
<br>
-static void<br>
+static bool<br>
project_src(nir_builder *b, nir_tex_instr *tex)<br>
{<br>
/* Find the projector in the srcs list, if present. */<br>
int proj_index = nir_tex_instr_src_index(tex, nir_tex_src_projector);<br>
if (proj_index < 0)<br>
- return;<br>
+ return false;<br>
<br>
b->cursor = nir_before_instr(&tex->instr);<br>
<br>
@@ -100,6 +100,7 @@ project_src(nir_builder *b, nir_tex_instr *tex)<br>
}<br>
<br>
nir_tex_instr_remove_src(tex, proj_index);<br>
+ return true;<br>
}<br>
<br>
static nir_ssa_def *<br>
@@ -1049,8 +1050,7 @@ nir_lower_tex_block(nir_block *block, nir_builder *b,<br>
* as clamping happens *after* projection:<br>
*/<br>
if (lower_txp || sat_mask) {<br>
- project_src(b, tex);<br>
- progress = true;<br>
+ progress |= project_src(b, tex);<br>
}<br>
<br>
if ((tex->op == nir_texop_txf && options->lower_txf_offset) ||<br>
-- <br>
2.20.1<br>
<br>
</blockquote></div>