ac/nir: set lod to 0 when it's unused

Submitted by Samuel Pitoiset on April 26, 2018, 10:17 a.m.

Details

Message ID 20180426101705.20654-1-samuel.pitoiset@gmail.com
State New
Headers show
Series "ac/nir: set lod to 0 when it's unused" ( rev: 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Samuel Pitoiset April 26, 2018, 10:17 a.m.
Otherwise we hit an assertion in ac_build_image_opcode()
for ac_image_load_mip.

Fixes: 24fb3e6aa16 ("ac/nir: use ac_build_image_opcode for image intrinsics")
Cc: 18.1 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
---
 src/amd/common/ac_nir_to_llvm.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index e4ae6ef49ad..08ee81611e3 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1276,6 +1276,8 @@  static LLVMValueRef build_tex_intrinsic(struct ac_nir_context *ctx,
 		args->opcode = args->level_zero ||
 			       instr->sampler_dim == GLSL_SAMPLER_DIM_MS ?
 					ac_image_load : ac_image_load_mip;
+		if (!args->lod)
+			args->lod = ctx->ac.i32_0;
 		args->level_zero = false;
 		break;
 	case nir_texop_txs:

Comments

Reviewed-by: Marek Olšák <marek.olsak@amd.com>

Marek

On Thu, Apr 26, 2018 at 6:17 AM, Samuel Pitoiset <samuel.pitoiset@gmail.com>
wrote:

> Otherwise we hit an assertion in ac_build_image_opcode()
> for ac_image_load_mip.
>
> Fixes: 24fb3e6aa16 ("ac/nir: use ac_build_image_opcode for image
> intrinsics")
> Cc: 18.1 <mesa-stable@lists.freedesktop.org>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
> ---
>  src/amd/common/ac_nir_to_llvm.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_
> llvm.c
> index e4ae6ef49ad..08ee81611e3 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -1276,6 +1276,8 @@ static LLVMValueRef build_tex_intrinsic(struct
> ac_nir_context *ctx,
>                 args->opcode = args->level_zero ||
>                                instr->sampler_dim == GLSL_SAMPLER_DIM_MS ?
>                                         ac_image_load : ac_image_load_mip;
> +               if (!args->lod)
> +                       args->lod = ctx->ac.i32_0;
>                 args->level_zero = false;
>                 break;
>         case nir_texop_txs:
> --
> 2.17.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
Ignore that. Nicolai's point is correct.

Marek

On Fri, Apr 27, 2018 at 1:51 AM, Marek Olšák <maraeo@gmail.com> wrote:

> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
>
> Marek
>
> On Thu, Apr 26, 2018 at 6:17 AM, Samuel Pitoiset <
> samuel.pitoiset@gmail.com> wrote:
>
>> Otherwise we hit an assertion in ac_build_image_opcode()
>> for ac_image_load_mip.
>>
>> Fixes: 24fb3e6aa16 ("ac/nir: use ac_build_image_opcode for image
>> intrinsics")
>> Cc: 18.1 <mesa-stable@lists.freedesktop.org>
>> Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
>> ---
>>  src/amd/common/ac_nir_to_llvm.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/src/amd/common/ac_nir_to_llvm.c
>> b/src/amd/common/ac_nir_to_llvm.c
>> index e4ae6ef49ad..08ee81611e3 100644
>> --- a/src/amd/common/ac_nir_to_llvm.c
>> +++ b/src/amd/common/ac_nir_to_llvm.c
>> @@ -1276,6 +1276,8 @@ static LLVMValueRef build_tex_intrinsic(struct
>> ac_nir_context *ctx,
>>                 args->opcode = args->level_zero ||
>>                                instr->sampler_dim == GLSL_SAMPLER_DIM_MS ?
>>                                         ac_image_load : ac_image_load_mip;
>> +               if (!args->lod)
>> +                       args->lod = ctx->ac.i32_0;
>>                 args->level_zero = false;
>>                 break;
>>         case nir_texop_txs:
>> --
>> 2.17.0
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>>
>
>