[Mesa-dev] [PATCH 08/12] i965/vec4/nir: simplify glsl_type_for_nir_alu_type()

Timothy Arceri t_arceri at yahoo.com.au
Fri Aug 14 17:14:09 PDT 2015


On Fri, 2015-08-14 at 15:30 -0700, Connor Abbott wrote:
> Less duplication and one less case to handle for doubles.
> 
> Signed-off-by: Connor Abbott <connor.w.abbott at intel.com>
> ---
>  src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 16 ++--------------
>  1 file changed, 2 insertions(+), 14 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp 
> b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> index b13465b..19ae7fd 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp
> @@ -1339,20 +1339,8 @@ const glsl_type *
>  glsl_type_for_nir_alu_type(nir_alu_type alu_type,
>                             unsigned components)
>  {
> -   switch (alu_type) {
> -   case nir_type_float:
> -      return glsl_type::vec(components);
> -   case nir_type_int:
> -      return glsl_type::ivec(components);
> -   case nir_type_unsigned:
> -      return glsl_type::uvec(components);
> -   case nir_type_bool:
> -      return glsl_type::bvec(components);
> -   default:
> -      return glsl_type::error_type;
> -   }
> -
> -   return glsl_type::error_type;
> +   return 
> glsl_type::get_instance(brw_glsl_base_type_for_nir_type(alu_type),
> +                                  1, components);

The switch above handles nir_type_bool using brw_glsl_base_type_for_nir_type()
you would hit unreachable("bad type") for nir_type_bool.

>  }
>  
>  void


More information about the mesa-dev mailing list