From ac7b52cf242fa7e44cace3b989eb50f7e0c33806 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Mon, 5 Aug 2019 17:41:45 +0200 Subject: [PATCH] vrend: Keep track op HW scissor state and disable them in vrend_clear vrend_clear executes the Gallium clear command which is only called when the whole viewport is cleared. So far mesa was doing excessive checks on the scissors, thereby updating the scissors to framebuffer size when they were disabled, and the according state changes were transmitted to the host. With mesa/2037478 this was optimized away, so that not disabling the scissors in the clear command manifested itself as a regression in a number of tests. Keeping track of the scissor state in the hardware and disabling the scissors before the clear is executes, and re-enabling them according to the last state fixes this. Closes #116 Signed-off-by: Gert Wollny Reviewed-by: Gurchetan Singh --- src/vrend_renderer.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 1384781..845d0f7 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -3492,6 +3492,8 @@ void vrend_clear(struct vrend_context *ctx, vrend_use_program(ctx, 0); + glDisable(GL_SCISSOR_TEST); + if (buffers & PIPE_CLEAR_COLOR) { if (ctx->sub->nr_cbufs && ctx->sub->surf[0] && vrend_format_is_emulated_alpha(ctx->sub->surf[0]->format)) { glClearColor(color->f[3], 0.0, 0.0, 0.0); @@ -3603,6 +3605,10 @@ void vrend_clear(struct vrend_context *ctx, ctx->sub->hw_blend_state.rt[0].colormask & PIPE_MASK_A ? GL_TRUE : GL_FALSE); } } + if (ctx->sub->hw_rs_state.scissor) + glEnable(GL_SCISSOR_TEST); + else + glDisable(GL_SCISSOR_TEST); } static void vrend_update_scissor_state(struct vrend_context *ctx) @@ -5247,6 +5253,7 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx) glEnable(GL_SCISSOR_TEST); else glDisable(GL_SCISSOR_TEST); + ctx->sub->hw_rs_state.scissor = state->scissor; }