[Mesa-dev] [PATCH 2/2] nir: fix shift for uint64_t

Nicolai Hähnle nhaehnle at gmail.com
Tue Dec 12 09:34:41 UTC 2017


I have a slight preference for Jason's suggestion, but either way, both 
patches:

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>


On 12.12.2017 04:47, Timothy Arceri wrote:
> ---
>   src/compiler/nir/nir_lower_io_arrays_to_elements.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/compiler/nir/nir_lower_io_arrays_to_elements.c b/src/compiler/nir/nir_lower_io_arrays_to_elements.c
> index dca5719f114..cdf9a76a881 100644
> --- a/src/compiler/nir/nir_lower_io_arrays_to_elements.c
> +++ b/src/compiler/nir/nir_lower_io_arrays_to_elements.c
> @@ -240,21 +240,21 @@ create_indirects_mask(nir_shader *shader, uint64_t *indirects,
>                      intr->intrinsic != nir_intrinsic_interp_var_at_centroid &&
>                      intr->intrinsic != nir_intrinsic_interp_var_at_sample &&
>                      intr->intrinsic != nir_intrinsic_interp_var_at_offset)
>                     continue;
>   
>                  nir_variable *var = intr->variables[0]->var;
>   
>                  if (var->data.mode != mode)
>                     continue;
>   
> -               uint64_t loc_mask = 1 << var->data.location;
> +               uint64_t loc_mask = ((uint64_t)1) << var->data.location;
>                  if (var->data.patch) {
>                     if (deref_has_indirect(&b, var, intr->variables[0]))
>                        patch_indirects[var->data.location_frac] |= loc_mask;
>                  } else {
>                     if (deref_has_indirect(&b, var, intr->variables[0]))
>                        indirects[var->data.location_frac] |= loc_mask;
>                  }
>               }
>            }
>         }
> @@ -282,21 +282,21 @@ lower_io_arrays_to_elements(nir_shader *shader, nir_variable_mode mask,
>                  if (intr->intrinsic != nir_intrinsic_load_var &&
>                      intr->intrinsic != nir_intrinsic_store_var &&
>                      intr->intrinsic != nir_intrinsic_interp_var_at_centroid &&
>                      intr->intrinsic != nir_intrinsic_interp_var_at_sample &&
>                      intr->intrinsic != nir_intrinsic_interp_var_at_offset)
>                     continue;
>   
>                  nir_variable *var = intr->variables[0]->var;
>   
>                  /* Skip indirects */
> -               uint64_t loc_mask = 1 << var->data.location;
> +               uint64_t loc_mask = ((uint64_t)1) << var->data.location;
>                  if (var->data.patch) {
>                     if (patch_indirects[var->data.location_frac] & loc_mask)
>                        continue;
>                  } else {
>                     if (indirects[var->data.location_frac] & loc_mask)
>                        continue;
>                  }
>   
>                  nir_variable_mode mode = var->data.mode;
>   
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list