[Mesa-dev] [PATCH 26/59] i965/fs: always pass the bitsize to brw_type_for_nir_type()

Pohjolainen, Topi topi.pohjolainen at intel.com
Tue May 3 07:24:22 UTC 2016


On Tue, May 03, 2016 at 09:22:23AM +0200, Samuel Iglesias Gons?lvez wrote:
> 
> 
> On 02/05/16 09:22, Pohjolainen, Topi wrote:
> > On Fri, Apr 29, 2016 at 01:29:23PM +0200, Samuel Iglesias Gons?lvez wrote:
> >> From: Connor Abbott <connor.w.abbott at intel.com>
> >>
> >> v2 (Sam):
> >> - Add bitsize to brw_type_for_nir_type() in optimize_extract_to_float()
> >> ---
> >>  src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 12 +++++++++---
> >>  1 file changed, 9 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> >> index 333ca2b..3ed3343 100644
> >> --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> >> +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> >> @@ -527,7 +527,9 @@ fs_visitor::optimize_extract_to_float(nir_alu_instr *instr,
> >>     }
> >>  
> >>     fs_reg op0 = get_nir_src(src0->src[0].src);
> >> -   op0.type = brw_type_for_nir_type(nir_op_infos[src0->op].input_types[0]);
> >> +   op0.type =
> >> +      brw_type_for_nir_type((nir_alu_type)(nir_op_infos[src0->op].input_types[0] |
> >> +                                           nir_src_bit_size(src0->src[0].src)));
> > 
> > If we wrote it like this, for example, we wouldn't overflow the line width:
> > 
> >       op0.type = brw_type_for_nir_type((nir_alu_type)(
> >                     nir_op_infos[src0->op].input_types[0] |
> >                     nir_src_bit_size(src0->src[0].src)));
> > 
> 
> What about this?
> 
>    op0.type = brw_type_for_nir_type(
>       (nir_alu_type)(nir_op_infos[src0->op].input_types[0] |
>                      nir_src_bit_size(src0->src[0].src)));

Looks good to me, thanks!


More information about the mesa-dev mailing list