<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 30, 2019, 7:08 PM Bas Nieuwenhuizen <<a href="mailto:bas@basnieuwenhuizen.nl">bas@basnieuwenhuizen.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 31, 2019, 12:49 AM Marek Olšák <<a href="mailto:maraeo@gmail.com" target="_blank" rel="noreferrer">maraeo@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 30, 2019, 6:44 PM Bas Nieuwenhuizen <<a href="mailto:bas@basnieuwenhuizen.nl" rel="noreferrer noreferrer" target="_blank">bas@basnieuwenhuizen.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 30, 2019, 11:45 PM Marek Olšák <<a href="mailto:maraeo@gmail.com" rel="noreferrer noreferrer noreferrer" target="_blank">maraeo@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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" rel="noreferrer noreferrer noreferrer noreferrer" target="_blank">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" rel="noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">mesa-stable@lists.freedesktop.org</a>><br>
Signed-off-by: Rhys Perry <<a href="mailto:pendingchaos02@gmail.com" rel="noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">pendingchaos02@gmail.com</a>><br>
Reviewed-By: Bas Nieuwenhuizen <<a href="mailto:bas@basnieuwenhuizen.nl" rel="noreferrer noreferrer noreferrer noreferrer noreferrer" target="_blank">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></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Well these opcodes will only be used in fragment shaders anyway, right?</div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">I think the normal tex opcode can be used in vertex shaders as well, probably only in OpenGL.</div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">What is the behavior there? Implicit lod of 0?</div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Yes.</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"><div dir="auto"><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"><div dir="auto"><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"><div dir="auto"><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"><div dir="auto"><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>
</blockquote></div></div></div>
</blockquote></div></div></div>
</blockquote></div></div></div>
</blockquote></div></div></div>