1
0
Fork 0

clutter/actor: Use paint context when culling to check render target

Rendering off stage we never cull, and previously this was checked by
comparing the "active framebuffer" of the stage, to the current
framebuffer in the cogl stack. Replace this by checking whether the
current paint context is currently drawing on stage or not.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/935
This commit is contained in:
Jonas Ådahl 2019-11-21 16:26:35 +01:00 committed by Georges Basile Stavracas Neto
parent 66f02ae93d
commit 138907c480
3 changed files with 25 additions and 5 deletions

View file

@ -643,6 +643,7 @@
#include "clutter-main.h"
#include "clutter-marshal.h"
#include "clutter-mutter.h"
#include "clutter-paint-context-private.h"
#include "clutter-paint-nodes.h"
#include "clutter-paint-node-private.h"
#include "clutter-paint-volume-private.h"
@ -3594,8 +3595,9 @@ in_clone_paint (void)
* means there's no point in trying to cull descendants of the current
* node. */
static gboolean
cull_actor (ClutterActor *self,
ClutterCullResult *result_out)
cull_actor (ClutterActor *self,
ClutterPaintContext *paint_context,
ClutterCullResult *result_out)
{
ClutterActorPrivate *priv = self->priv;
ClutterStage *stage;
@ -3622,10 +3624,10 @@ cull_actor (ClutterActor *self,
return FALSE;
}
if (cogl_get_draw_framebuffer () != _clutter_stage_get_active_framebuffer (stage))
if (clutter_paint_context_is_drawing_off_stage (paint_context))
{
CLUTTER_NOTE (CLIPPING, "Bail from cull_actor without culling (%s): "
"Current framebuffer doesn't correspond to stage",
"Drawing off stage",
_clutter_actor_get_debug_name (self));
return FALSE;
}
@ -4058,7 +4060,7 @@ clutter_actor_paint (ClutterActor *self,
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)))
_clutter_actor_update_last_paint_volume (self);
success = cull_actor (self, &result);
success = cull_actor (self, paint_context, &result);
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS))
_clutter_actor_paint_cull_result (self, success, result, actor_node);

View file

@ -27,4 +27,6 @@ void clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context,
void clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context);
gboolean clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context);
#endif /* CLUTTER_PAINT_CONTEXT_PRIVATE_H */

View file

@ -137,3 +137,19 @@ clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context)
{
return paint_context->view;
}
/**
* clutter_paint_context_is_drawing_off_stage: (skip)
*
* Return %TRUE if the paint context is currently drawing off stage.
* This happens if there are any framebuffers pushed, and the base framebuffer
* comes from the stage view.
*/
gboolean
clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context)
{
if (g_list_length (paint_context->framebuffers) > 1)
return TRUE;
return !paint_context->view;
}