1
0
Fork 0

cogl/journal: Invalidate framebuffer mipmaps on each journal insertion

Because the framebuffer itself might be backed by a texture, which might
have mipmapping enabled. If so then rendering to the framebuffer will make
those mipmaps out of date.

Technically we are flagging the framebuffer's mipmaps as dirty *before*
they are, because the journal hasn't been flushed yet. But we need to do
it early because ideally the next flush will both write the offscreen
framebuffer contents and then read them for use in rendering to an onscreen
framebuffer. And the `mipmaps_dirty` flag needs to be set before the read,
so therefore we need to do it before the next journal flush.

Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3146
where the offscreen framebuffer in question is meta-background's
`monitor->fbo`.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1664>
This commit is contained in:
Daniel van Vugt 2021-01-07 17:55:33 +08:00
parent d415b2b841
commit f0a9ec0519

View file

@ -35,6 +35,7 @@
#include "cogl-graphene.h"
#include "cogl-journal-private.h"
#include "cogl-texture-private.h"
#include "cogl-texture-2d-private.h"
#include "cogl-pipeline-private.h"
#include "cogl-framebuffer-private.h"
#include "cogl-profile.h"
@ -1629,6 +1630,13 @@ _cogl_journal_log_quad (CoglJournal *journal,
add_framebuffer_deps_cb,
framebuffer);
if (COGL_IS_OFFSCREEN (framebuffer))
{
CoglOffscreen *offscreen = COGL_OFFSCREEN (framebuffer);
_cogl_texture_2d_externally_modified (offscreen->texture);
}
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SYNC_PRIMITIVE)))
{
_cogl_journal_flush (journal);