On Tuesday, September 02, 2014 11:49:29 AM Kenneth Graunke wrote:
> On Monday, September 01, 2014 09:44:28 AM Jordan Justen wrote:
> > This common init routine can be used by constructors for multiple program
> > types.
> > 
> > Signed-off-by: Jordan Justen <[email protected]>
> > ---
> >  src/mesa/drivers/dri/i965/brw_scalar.h           | 1 +
> >  src/mesa/drivers/dri/i965/brw_scalar_visitor.cpp | 6 ++++++
> >  2 files changed, 7 insertions(+)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/brw_scalar.h 
> > b/src/mesa/drivers/dri/i965/brw_scalar.h
> > index b60c6d2..7d3ebdb 100644
> > --- a/src/mesa/drivers/dri/i965/brw_scalar.h
> > +++ b/src/mesa/drivers/dri/i965/brw_scalar.h
> > @@ -215,6 +215,7 @@ public:
> >                    struct gl_fragment_program *fp,
> >                    unsigned dispatch_width);
> >     ~scalar_visitor();
> > +   void init();
> >  
> >     fs_reg *variable_storage(ir_variable *var);
> >     int virtual_grf_alloc(int size);
> > diff --git a/src/mesa/drivers/dri/i965/brw_scalar_visitor.cpp 
> > b/src/mesa/drivers/dri/i965/brw_scalar_visitor.cpp
> > index 5eadb1e..9616b2a 100644
> > --- a/src/mesa/drivers/dri/i965/brw_scalar_visitor.cpp
> > +++ b/src/mesa/drivers/dri/i965/brw_scalar_visitor.cpp
> > @@ -3262,6 +3262,12 @@ scalar_visitor::scalar_visitor(struct brw_context 
> > *brw,
> >  {
> >     this->fp = fp;
> >     this->mem_ctx = mem_ctx;
> > +   init();
> > +}
> > +
> > +void
> > +scalar_visitor::init()
> > +{
> >     this->failed = false;
> >     this->simd16_unsupported = false;
> >     this->no16_msg = NULL;
> > 
> 
> I don't see why this is necessary.  If you're planning to go the subclass 
> route, where you have:
> 
>   scalar_visitor
>      |--> fs_visitor
>      |--> compute_visitor
>      |--> scalar_vs_visitor
> 
> Then the constructors for compute_visitor etc. can just call the constructor 
> for scalar_visitor using an initialization list.
> 
> The reason we use this approach in fs_reg is because we wanted to share code 
> between multiple constructors for a single class; IIRC constructors can't 
> call sibling constructors.  But you can definitely call parent constructors.

Ah, but if you're not planning to go the subclass route, and are instead 
planning on having multiple constructors that take say a gl_fragment_program 
vs. a gl_compute_program....then this would make sense.

Which is what you said in your commit message, if I read it more carefully.
Sorry for the trouble.

Reviewed-by: Kenneth Graunke <[email protected]>

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to