Now that we have pipe_context::invalidate_sub_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 <[email protected]> --- src/mesa/state_tracker/st_cb_clear.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 88fc12789e3..e3af3532fc4 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -357,6 +357,18 @@ 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_sub_surface && + is_scissor_enabled(ctx, rb)) { + struct st_renderbuffer *strb = st_renderbuffer(rb); + st->pipe->invalidate_sub_surface(st->pipe, strb->surface, + &st->state.scissor[0]); + } +} /** * Called via ctx->Driver.Clear() @@ -415,6 +427,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 +439,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 [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
