<div dir="ltr"><div>Yes, I'm OK with pushing this.</div><div><br></div><div>Marek<br></div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 31, 2018 at 3:53 AM, Alex Smith <span dir="ltr"><<a href="mailto:asmith@feralinteractive.com" target="_blank">asmith@feralinteractive.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hmm, the crash I was seeing is in RenderDoc from one of its own shaders. Maybe it's missing some support checks? I'll look into it.<div><br></div><div>If you're happy with this though, I'll push it.</div><div><br></div><div>Thanks,</div><div>Alex</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 30 May 2018 at 21:17, Marek Olšák <span dir="ltr"><<a href="mailto:maraeo@gmail.com" target="_blank">maraeo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Reviewed-by: Marek Olšák <<a href="mailto:marek.olsak@amd.com" target="_blank">marek.olsak@amd.com</a>></div><div><br></div><div>Note that radeonsi doesn't support MSAA images.</div><div><br></div><div>Marek<br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_-5771478729176025206h5">On Wed, May 30, 2018 at 4:48 AM, Alex Smith <span dir="ltr"><<a href="mailto:asmith@feralinteractive.com" target="_blank">asmith@feralinteractive.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-5771478729176025206h5">The value returned by tgsi_util_get_texture_coord_di<wbr>m() does not<br>
account for the sample index. This means image_fetch_coords() will not<br>
fetch it, leading to a null deref in ac_build_image_opcode() which<br>
expects it to be present (the return value of ac_num_coords() *does*<br>
include the sample index).<br>
<br>
Signed-off-by: Alex Smith <<a href="mailto:asmith@feralinteractive.com" target="_blank">asmith@feralinteractive.com</a>><br>
Cc: "18.1" <<a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">mesa-stable@lists.freedesktop<wbr>.org</a>><br>
---<br>
 src/gallium/drivers/radeonsi/<wbr>si_shader_tgsi_mem.c | 8 +++++++-<br>
 1 file changed, 7 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/gallium/drivers/radeonsi<wbr>/si_shader_tgsi_mem.c b/src/gallium/drivers/radeonsi<wbr>/si_shader_tgsi_mem.c<br>
index 1c244fa3c0..d0dd4e7cab 100644<br>
--- a/src/gallium/drivers/radeonsi<wbr>/si_shader_tgsi_mem.c<br>
+++ b/src/gallium/drivers/radeonsi<wbr>/si_shader_tgsi_mem.c<br>
@@ -276,10 +276,16 @@ static void image_fetch_coords(<br>
        struct si_shader_context *ctx = si_shader_context(bld_base);<br>
        LLVMBuilderRef builder = ctx->ac.builder;<br>
        unsigned target = inst->Memory.Texture;<br>
-       const unsigned num_coords = tgsi_util_get_texture_coord_di<wbr>m(target);<br>
+       unsigned num_coords = tgsi_util_get_texture_coord_di<wbr>m(target);<br>
        LLVMValueRef tmp;<br>
        int chan;<br>
<br>
+       if (target == TGSI_TEXTURE_2D_MSAA ||<br>
+           target == TGSI_TEXTURE_2D_ARRAY_MSAA) {<br>
+               /* Need the sample index as well. */<br>
+               num_coords++;<br>
+       }<br>
+<br>
        for (chan = 0; chan < num_coords; ++chan) {<br>
                tmp = lp_build_emit_fetch(bld_base, inst, src, chan);<br>
                tmp = ac_to_integer(&ctx->ac, tmp);<br>
</div></div><span class="m_-5771478729176025206HOEnZb"><font color="#888888"><span class="m_-5771478729176025206m_1024454185828207825HOEnZb"><font color="#888888">-- <br>
2.14.3<br>
<br>
______________________________<wbr>_________________<br>
mesa-stable mailing list<br>
<a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">mesa-stable@lists.freedesktop.<wbr>org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-stable" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-stable</a><br>
</font></span></font></span></blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>