[Mesa-dev] [PATCH 2/3] i965: Split merge_inputs and clear_buffers.

Mathias Fröhlich Mathias.Froehlich at gmx.net
Tue Jun 12 06:19:27 UTC 2018


Hi Chris,

Thanks for looking into that!

On Saturday, 2 June 2018 10:02:36 CEST Chris Wilson wrote:
> Quoting Mathias.Froehlich at gmx.net (2018-05-17 07:38:27)
> > From: Mathias Fröhlich <mathias.froehlich at web.de>
> > 
> > The merge_inputs function handles that part that changes when the
> > inputs change. The clear_buffers function triggers when we may need
> > a new upload. Thus the merge_inputs can be limited to be once
> > per brw_draw_prims.
> > 
> > Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
> > ---
> >  src/mesa/drivers/dri/i965/brw_draw.c | 30 ++++++++++++++++++++++--------
> >  1 file changed, 22 insertions(+), 8 deletions(-)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
> > index ae3b7be2dd..2a7562a684 100644
> > --- a/src/mesa/drivers/dri/i965/brw_draw.c
> > +++ b/src/mesa/drivers/dri/i965/brw_draw.c
> > @@ -278,21 +278,34 @@ brw_emit_prim(struct brw_context *brw,
> >  
> >  
> >  static void
> > -brw_merge_inputs(struct brw_context *brw)
> > +brw_clear_buffers(struct brw_context *brw)
> >  {
> > -   const struct gen_device_info *devinfo = &brw->screen->devinfo;
> > -   const struct gl_context *ctx = &brw->ctx;
> > -   GLuint i;
> > -
> > -   for (i = 0; i < brw->vb.nr_buffers; i++) {
> > +   for (unsigned i = 0; i < brw->vb.nr_buffers; ++i) {
> >        brw_bo_unreference(brw->vb.buffers[i].bo);
> >        brw->vb.buffers[i].bo = NULL;
> >     }
> >     brw->vb.nr_buffers = 0;
> >  
> > +   for (unsigned i = 0; i < brw->vb.nr_enabled; ++i) {
> > +      brw->vb.enabled[i]->buffer = -1;
> > +   }
> 
> Hmm, can we have an enabled buffer that is not in the set of
> brw->vb.buffers[]?

No, that cannot. The brw_vertex_element::buffer variable is only an integer
index exactly into the brw_vertex_buffer array at vb.buffers[]. So, I would say
by the semantics of the brw_vertex_element::buffer value it cannot refer to
anywhere else than to vb.buffers[].
... I am not sure I got your question right?

best

Mathias




More information about the mesa-dev mailing list