[Mesa-stable] [PATCH] radeonsi: Fix crash on shaders using MSAA image load/store

Alex Smith asmith at feralinteractive.com
Thu May 31 07:53:39 UTC 2018


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.

If you're happy with this though, I'll push it.

Thanks,
Alex

On 30 May 2018 at 21:17, Marek Olšák <maraeo at gmail.com> wrote:

> Reviewed-by: Marek Olšák <marek.olsak at amd.com>
>
> Note that radeonsi doesn't support MSAA images.
>
> Marek
>
> On Wed, May 30, 2018 at 4:48 AM, Alex Smith <asmith at feralinteractive.com>
> wrote:
>
>> The value returned by tgsi_util_get_texture_coord_dim() does not
>> account for the sample index. This means image_fetch_coords() will not
>> fetch it, leading to a null deref in ac_build_image_opcode() which
>> expects it to be present (the return value of ac_num_coords() *does*
>> include the sample index).
>>
>> Signed-off-by: Alex Smith <asmith at feralinteractive.com>
>> Cc: "18.1" <mesa-stable at lists.freedesktop.org>
>> ---
>>  src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c | 8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
>> b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
>> index 1c244fa3c0..d0dd4e7cab 100644
>> --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
>> +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
>> @@ -276,10 +276,16 @@ static void image_fetch_coords(
>>         struct si_shader_context *ctx = si_shader_context(bld_base);
>>         LLVMBuilderRef builder = ctx->ac.builder;
>>         unsigned target = inst->Memory.Texture;
>> -       const unsigned num_coords = tgsi_util_get_texture_coord_di
>> m(target);
>> +       unsigned num_coords = tgsi_util_get_texture_coord_dim(target);
>>         LLVMValueRef tmp;
>>         int chan;
>>
>> +       if (target == TGSI_TEXTURE_2D_MSAA ||
>> +           target == TGSI_TEXTURE_2D_ARRAY_MSAA) {
>> +               /* Need the sample index as well. */
>> +               num_coords++;
>> +       }
>> +
>>         for (chan = 0; chan < num_coords; ++chan) {
>>                 tmp = lp_build_emit_fetch(bld_base, inst, src, chan);
>>                 tmp = ac_to_integer(&ctx->ac, tmp);
>> --
>> 2.14.3
>>
>> _______________________________________________
>> mesa-stable mailing list
>> mesa-stable at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-stable
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-stable/attachments/20180531/cb5f31fd/attachment.html>


More information about the mesa-stable mailing list