From 1163e9a8e2a95fc2de29576030bb40dff8d3f79f Mon Sep 17 00:00:00 2001 From: Sviatoslav Peleshko Date: Tue, 12 Apr 2022 12:52:27 +0300 Subject: [PATCH] mesa: flush bitmap caches when changing scissors or window rects state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Marek Olšák Part-of: (cherry picked from commit dd7278aa10af21b8622cb5721253eb90c3c0752f) --- .pick_status.json | 2 +- src/mesa/main/enable.c | 5 +++++ src/mesa/main/scissor.c | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index c3af904c3ce..63bd78d3dd6 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1476,7 +1476,7 @@ "description": "mesa: flush bitmap caches when changing scissors or window rects state", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "because_sha": null }, { 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;