[Mesa-dev] [PATCH] nir: Make nir_const_value a union

Vinson Lee vlee at freedesktop.org
Thu May 26 22:59:22 UTC 2016


On Thu, May 26, 2016 at 3:40 PM, Jason Ekstrand <jason at jlekstrand.net> wrote:
> There's no good reason for it to be a struct of an anonymous union.
>
> Cc: Vinson Lee <vlee at freedesktop.org>
> ---
>  src/compiler/nir/nir.h                       | 16 +++++++---------
>  src/compiler/nir/nir_constant_expressions.py |  2 +-
>  2 files changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
> index 008f4db..a166a0d 100644
> --- a/src/compiler/nir/nir.h
> +++ b/src/compiler/nir/nir.h
> @@ -1266,15 +1266,13 @@ nir_tex_instr_src_index(nir_tex_instr *instr, nir_tex_src_type type)
>     return -1;
>  }
>
> -typedef struct {
> -   union {
> -      float f32[4];
> -      double f64[4];
> -      int32_t i32[4];
> -      uint32_t u32[4];
> -      int64_t i64[4];
> -      uint64_t u64[4];
> -   };
> +typedef union {
> +   float f32[4];
> +   double f64[4];
> +   int32_t i32[4];
> +   uint32_t u32[4];
> +   int64_t i64[4];
> +   uint64_t u64[4];
>  } nir_const_value;
>
>  typedef struct {
> diff --git a/src/compiler/nir/nir_constant_expressions.py b/src/compiler/nir/nir_constant_expressions.py
> index e36dc48..96d5255 100644
> --- a/src/compiler/nir/nir_constant_expressions.py
> +++ b/src/compiler/nir/nir_constant_expressions.py
> @@ -270,7 +270,7 @@ static nir_const_value
>  evaluate_${name}(unsigned num_components, unsigned bit_size,
>                   nir_const_value *_src)
>  {
> -   nir_const_value _dst_val = { { {0, 0, 0, 0} } };
> +   nir_const_value _dst_val = { {0, } };
>
>     switch (bit_size) {
>     % for bit_size in [32, 64]:
> --
> 2.5.0.400.gff86faf
>

Fixes Bugzilla 96221 for me.

Tested-by: Vinson Lee <vlee at freedesktop.org>


More information about the mesa-dev mailing list