<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 30, 2019, 3:54 PM Rhys Perry <<a href="mailto:pendingchaos02@gmail.com">pendingchaos02@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Otherwise LLVM can sink them and their texture coordinate calculations<br>
into divergent branches.<br>
<br>
v2: simplify the conditions on which the intrinsic is marked as convergent<br>
<br>
Cc: <<a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank" rel="noreferrer">mesa-stable@lists.freedesktop.org</a>><br>
Signed-off-by: Rhys Perry <<a href="mailto:pendingchaos02@gmail.com" target="_blank" rel="noreferrer">pendingchaos02@gmail.com</a>><br>
Reviewed-By: Bas Nieuwenhuizen <<a href="mailto:bas@basnieuwenhuizen.nl" target="_blank" rel="noreferrer">bas@basnieuwenhuizen.nl</a>><br>
---<br>
src/amd/common/ac_nir_to_llvm.c | 12 ++++++++++++<br>
1 file changed, 12 insertions(+)<br>
<br>
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c<br>
index 265e3b636c4..b1a191ac24c 100644<br>
--- a/src/amd/common/ac_nir_to_llvm.c<br>
+++ b/src/amd/common/ac_nir_to_llvm.c<br>
@@ -1394,6 +1394,18 @@ static LLVMValueRef build_tex_intrinsic(struct ac_nir_context *ctx,<br>
}<br>
<br>
args->attributes = AC_FUNC_ATTR_READNONE;<br>
+ /* Prevent texture instructions with implicit derivatives from being<br>
+ * sinked into branches. */<br>
+ switch (instr->op) {<br>
+ case nir_texop_tex:<br>
+ case nir_texop_txb:<br>
+ case nir_texop_lod:<br>
+ args->attributes |= AC_FUNC_ATTR_CONVERGENT;<br>
+ break;<br>
+ default:<br>
+ break;<br>
+ }<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">I think this should only apply to the fragment shader.</div><div dir="auto"><br></div><div dir="auto">Marek</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
return ac_build_image_opcode(&ctx->ac, args);<br>
}<br>
<br>
-- <br>
2.21.0<br>
<br>
</blockquote></div></div></div>