Mesa (main): mesa: flush bitmap caches when changing scissors or window rects state

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 18 13:09:39 UTC 2022


Module: Mesa
Branch: main
Commit: dd7278aa10af21b8622cb5721253eb90c3c0752f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dd7278aa10af21b8622cb5721253eb90c3c0752f

Author: Sviatoslav Peleshko <sviatoslav.peleshko at globallogic.com>
Date:   Tue Apr 12 12:52:27 2022 +0300

mesa: flush bitmap caches when changing scissors or window rects state

If we change the sate without flushing the bitmap cache, the cache might be
rendered with the new scissor, which excludes some parts that should've
been rendered with the old state, and vice versa.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6233

Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko at globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15881>

---

 src/mesa/main/enable.c  | 5 +++++
 src/mesa/main/scissor.c | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index b6b34f90e24..e1c74225fb3 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -45,6 +45,7 @@
 #include "varray.h"
 #include "api_exec_decl.h"
 
+#include "state_tracker/st_cb_bitmap.h"
 #include "state_tracker/st_context.h"
 
 void
@@ -865,6 +866,8 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
             GLbitfield newEnabled =
                state * ((1 << ctx->Const.MaxViewports) - 1);
             if (newEnabled != ctx->Scissor.EnableFlags) {
+               st_flush_bitmap_cache(st_context(ctx));
+
                FLUSH_VERTICES(ctx, 0,
                               GL_SCISSOR_BIT | GL_ENABLE_BIT);
                ctx->NewDriverState |= ST_NEW_SCISSOR | ST_NEW_RASTERIZER;
@@ -1390,6 +1393,8 @@ _mesa_set_enablei(struct gl_context *ctx, GLenum cap,
          return;
       }
       if (((ctx->Scissor.EnableFlags >> index) & 1) != state) {
+         st_flush_bitmap_cache(st_context(ctx));
+
          FLUSH_VERTICES(ctx, 0,
                         GL_SCISSOR_BIT | GL_ENABLE_BIT);
          ctx->NewDriverState |= ST_NEW_SCISSOR | ST_NEW_RASTERIZER;
diff --git a/src/mesa/main/scissor.c b/src/mesa/main/scissor.c
index 054c5abaccd..90ac5e57676 100644
--- a/src/mesa/main/scissor.c
+++ b/src/mesa/main/scissor.c
@@ -30,6 +30,7 @@
 #include "main/scissor.h"
 #include "api_exec_decl.h"
 
+#include "state_tracker/st_cb_bitmap.h"
 #include "state_tracker/st_context.h"
 
 /**
@@ -50,6 +51,9 @@ set_scissor_no_notify(struct gl_context *ctx, unsigned idx,
        height == ctx->Scissor.ScissorArray[idx].Height)
       return;
 
+   if (ctx->Scissor.EnableFlags)
+      st_flush_bitmap_cache(st_context(ctx));
+
    FLUSH_VERTICES(ctx, 0, GL_SCISSOR_BIT);
    ctx->NewDriverState |= ST_NEW_SCISSOR;
 
@@ -294,6 +298,8 @@ _mesa_WindowRectanglesEXT(GLenum mode, GLsizei count, const GLint *box)
       box += 4;
    }
 
+   st_flush_bitmap_cache(st_context(ctx));
+
    FLUSH_VERTICES(ctx, 0, GL_SCISSOR_BIT);
    ctx->NewDriverState |= ST_NEW_WINDOW_RECTANGLES;
 



More information about the mesa-commit mailing list