[virglrenderer-devel] [PATCH] vrend: Set scissor_state_dirty correctly.

Lepton Wu lepton at chromium.org
Tue Jul 24 17:52:50 UTC 2018


We forgot to set scissor_state_dirty when we disable GL_SCISSOR_TEST
in vrend_renderer_blit_int. This fixes bug mentioned in
https://lists.freedesktop.org/archives/virglrenderer-devel/2018-July/001230.html
---
 src/vrend_renderer.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index c68bda0..17e9674 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -6689,12 +6689,19 @@ static void vrend_renderer_blit_int(struct vrend_context *ctx,
       src_y2 = src_res->base.height0 - info->src.box.y;
    }
 
-   if (info->scissor_enable) {
+   bool current_scissor = glIsEnabled(GL_SCISSOR_TEST);
+   bool tmp_scissor = info->scissor_enable;
+   if (tmp_scissor) {
       glScissor(info->scissor.minx, info->scissor.miny, info->scissor.maxx - info->scissor.minx, info->scissor.maxy - info->scissor.miny);
+   }
+   if (current_scissor != tmp_scissor) {
       ctx->sub->scissor_state_dirty = (1 << 0);
-      glEnable(GL_SCISSOR_TEST);
-   } else
-      glDisable(GL_SCISSOR_TEST);
+      if (tmp_scissor) {
+         glEnable(GL_SCISSOR_TEST);
+      } else {
+         glDisable(GL_SCISSOR_TEST);
+      }
+   }
 
    /* 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
-- 
2.18.0.233.g985f88cf7e-goog



More information about the virglrenderer-devel mailing list