From 2ebcc6d69acd4c96497efe73507cd5f1cc40c054 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 13 Dec 2018 14:34:47 +1000 Subject: [PATCH] virglrenderer: move scissor enables out of draw path. Reviewed-by: Erik Faye-Lund --- src/vrend_renderer.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index faf8e0b..8637174 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -3342,16 +3342,10 @@ void vrend_clear(struct vrend_context *ctx, static void vrend_update_scissor_state(struct vrend_context *ctx) { struct pipe_scissor_state *ss; - struct pipe_rasterizer_state *state = &ctx->sub->rs_state; GLint y; GLuint idx; unsigned mask = ctx->sub->scissor_state_dirty; - if (state->scissor) - glEnable(GL_SCISSOR_TEST); - else - glDisable(GL_SCISSOR_TEST); - while (mask) { idx = u_bit_scan(&mask); if (idx >= PIPE_MAX_VIEWPORTS) { @@ -4886,6 +4880,12 @@ static void vrend_hw_emit_rs(struct vrend_context *ctx) glDisable(GL_SAMPLE_SHADING); } } + + if (state->scissor) + glEnable(GL_SCISSOR_TEST); + else + glDisable(GL_SCISSOR_TEST); + } void vrend_object_bind_rasterizer(struct vrend_context *ctx, @@ -4906,7 +4906,6 @@ void vrend_object_bind_rasterizer(struct vrend_context *ctx, } ctx->sub->rs_state = *state; - ctx->sub->scissor_state_dirty = (1 << 0); ctx->sub->shader_dirty = true; vrend_hw_emit_rs(ctx); } @@ -7274,6 +7273,9 @@ void vrend_renderer_resource_copy_region(struct vrend_context *ctx, dy2, glmask, GL_NEAREST); glBindFramebuffer(GL_FRAMEBUFFER, ctx->sub->fb_id); + + if (ctx->sub->rs_state.scissor) + glEnable(GL_SCISSOR_TEST); } static void vrend_renderer_blit_int(struct vrend_context *ctx, @@ -7373,10 +7375,10 @@ static void vrend_renderer_blit_int(struct vrend_context *ctx, if (info->scissor_enable) { glScissor(info->scissor.minx, info->scissor.miny, info->scissor.maxx - info->scissor.minx, info->scissor.maxy - info->scissor.miny); + ctx->sub->scissor_state_dirty = (1 << 0); glEnable(GL_SCISSOR_TEST); } else glDisable(GL_SCISSOR_TEST); - ctx->sub->scissor_state_dirty = (1 << 0); /* An GLES GL_INVALID_OPERATION is generated if one wants to blit from a * multi-sample fbo to a non multi-sample fbo and the source and destination @@ -7487,6 +7489,11 @@ static void vrend_renderer_blit_int(struct vrend_context *ctx, vrend_renderer_resource_destroy(intermediate_copy, false); glDeleteFramebuffers(1, &intermediate_fbo); } + + if (ctx->sub->rs_state.scissor) + glEnable(GL_SCISSOR_TEST); + else + glDisable(GL_SCISSOR_TEST); } void vrend_renderer_blit(struct vrend_context *ctx,