On Mon, 11 Apr 2011 09:16:32 -0700, Ian Romanick <i...@freedesktop.org> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 04/09/2011 10:08 PM, Eric Anholt wrote:
> > This is like what we do for add/mul, but we have to invert the
> > predicate to choose the other source instead.
> > 
> > This removes 5 extra moves of constants in nexuiz shaders.
> > ---
> >  src/mesa/drivers/dri/i965/brw_eu.c   |    5 +++++
> >  src/mesa/drivers/dri/i965/brw_eu.h   |    1 +
> >  src/mesa/drivers/dri/i965/brw_fs.cpp |    9 +++++++++
> >  src/mesa/drivers/dri/i965/brw_fs.h   |    1 +
> >  4 files changed, 16 insertions(+), 0 deletions(-)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/brw_eu.c 
> > b/src/mesa/drivers/dri/i965/brw_eu.c
> > index b59d6b2..7e63482 100644
> > --- a/src/mesa/drivers/dri/i965/brw_eu.c
> > +++ b/src/mesa/drivers/dri/i965/brw_eu.c
> > @@ -82,6 +82,11 @@ void brw_set_predicate_control( struct brw_compile *p, 
> > GLuint pc )
> >     p->current->header.predicate_control = pc;
> >  }
> >  
> > +void brw_set_predicate_inverse(struct brw_compile *p, bool 
> > predicate_inverse)
> > +{
> > +   p->current->header.predicate_inverse = predicate_inverse;
> > +}
> > +
> >  void brw_set_conditionalmod( struct brw_compile *p, GLuint conditional )
> >  {
> >     p->current->header.destreg__conditionalmod = conditional;
> > diff --git a/src/mesa/drivers/dri/i965/brw_eu.h 
> > b/src/mesa/drivers/dri/i965/brw_eu.h
> > index c2e59c1..718b380 100644
> > --- a/src/mesa/drivers/dri/i965/brw_eu.h
> > +++ b/src/mesa/drivers/dri/i965/brw_eu.h
> > @@ -772,6 +772,7 @@ void brw_set_access_mode( struct brw_compile *p, GLuint 
> > access_mode );
> >  void brw_set_compression_control( struct brw_compile *p, GLboolean control 
> > );
> >  void brw_set_predicate_control_flag_value( struct brw_compile *p, GLuint 
> > value );
> >  void brw_set_predicate_control( struct brw_compile *p, GLuint pc );
> > +void brw_set_predicate_inverse(struct brw_compile *p, bool 
> > predicate_inverse);
> >  void brw_set_conditionalmod( struct brw_compile *p, GLuint conditional );
> >  void brw_set_acc_write_control(struct brw_compile *p, GLuint value);
> >  
> > diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
> > b/src/mesa/drivers/dri/i965/brw_fs.cpp
> > index 128bbe9..12f9e6a 100644
> > --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> > +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> > @@ -2963,6 +2963,14 @@ fs_visitor::propagate_constants()
> >            if (i == 1) {
> >               scan_inst->src[i] = inst->src[0];
> >               progress = true;
> > +          } else if (i == 0 && scan_inst->src[1].file != IMM) {
> > +             /* Fit this constant in by swapping the operands and
> > +              * flipping the predicate
> > +              */
> > +             scan_inst->src[0] = scan_inst->src[1];
> > +             scan_inst->src[1] = inst->src[0];
> > +             scan_inst->predicate_inverse = ~scan_inst->predicate_inverse;
> 
> Since predicate_inverse is a bool, shouldn't that be
> !scan_inst->predicate_inverse instead of ~scan_inst->predicate_inverse?

Some day I'll type the right one on the first try.  Thanks.

Attachment: pgpPPpLBpc3rZ.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to