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@globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15881>
This commit is contained in:
Sviatoslav Peleshko 2022-04-12 12:52:27 +03:00 committed by Marge Bot
parent f9e424f98d
commit dd7278aa10
2 changed files with 11 additions and 0 deletions

View file

@ -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;

View file

@ -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;