On Wed, Dec 12, 2018 at 10:54 AM Ilia Mirkin <imir...@alum.mit.edu> wrote: > > On Wed, Dec 12, 2018 at 10:49 AM Rob Clark <robdcl...@gmail.com> wrote: > > > > Now that we have pipe_context::invalidate_surface(), we can also > > use this to hint to driver about scissored clears (which use draw_vbo()). > > This is useful in particular for tilers because the driver can avoid > > bringing (some) tiles back into the tile buffer from system memory. > > > > Signed-off-by: Rob Clark <robdcl...@gmail.com> > > --- > > src/mesa/state_tracker/st_cb_clear.c | 18 ++++++++++++++++++ > > 1 file changed, 18 insertions(+) > > > > diff --git a/src/mesa/state_tracker/st_cb_clear.c > > b/src/mesa/state_tracker/st_cb_clear.c > > index 88fc12789e3..90647807561 100644 > > --- a/src/mesa/state_tracker/st_cb_clear.c > > +++ b/src/mesa/state_tracker/st_cb_clear.c > > @@ -357,6 +357,22 @@ is_stencil_masked(struct gl_context *ctx, struct > > gl_renderbuffer *rb) > > return (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax; > > } > > > > +static void > > +handle_scissor_invalidate(struct gl_context *ctx, struct gl_renderbuffer > > *rb) > > +{ > > + struct st_context *st = st_context(ctx); > > + > > + if (st->pipe->invalidate_surface && > > + is_scissor_enabled(ctx, rb)) { > > + struct st_renderbuffer *strb = st_renderbuffer(rb); > > + struct pipe_scissor_state *s = &st->state.scissor[0]; > > + struct pipe_box region; > > + > > + u_box_2d(s->minx, s->miny, s->maxx - s->minx, s->maxy - s->miny, > > ®ion); > > This would only cover the first layer of the surface. Presumably you > want to do u_box_3d here and do z = 0, > depth=sf->u.tex.last_layer-first_layer.
Also, I think you want maxx - minx + 1... iirc those u_box helpers want a width, not a maxx. > > > + > > + st->pipe->invalidate_surface(st->pipe, strb->surface, ®ion); > > + } > > +} > > > > /** > > * Called via ctx->Driver.Clear() > > @@ -415,6 +431,7 @@ st_Clear(struct gl_context *ctx, GLbitfield mask) > > struct st_renderbuffer *strb = st_renderbuffer(depthRb); > > > > if (strb->surface && ctx->Depth.Mask) { > > + handle_scissor_invalidate(ctx, depthRb); > > if (is_scissor_enabled(ctx, depthRb) || > > is_window_rectangle_enabled(ctx)) > > quad_buffers |= PIPE_CLEAR_DEPTH; > > @@ -426,6 +443,7 @@ st_Clear(struct gl_context *ctx, GLbitfield mask) > > struct st_renderbuffer *strb = st_renderbuffer(stencilRb); > > > > if (strb->surface && !is_stencil_disabled(ctx, stencilRb)) { > > + handle_scissor_invalidate(ctx, stencilRb); > > if (is_scissor_enabled(ctx, stencilRb) || > > is_window_rectangle_enabled(ctx) || > > is_stencil_masked(ctx, stencilRb)) > > -- > > 2.19.2 > > > > _______________________________________________ > > mesa-dev mailing list > > mesa-dev@lists.freedesktop.org > > https://lists.freedesktop.org/mailman/listinfo/mesa-dev _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev