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:
parent
66f02ae93d
commit
138907c480
@ -643,6 +643,7 @@
|
|||||||
#include "clutter-main.h"
|
#include "clutter-main.h"
|
||||||
#include "clutter-marshal.h"
|
#include "clutter-marshal.h"
|
||||||
#include "clutter-mutter.h"
|
#include "clutter-mutter.h"
|
||||||
|
#include "clutter-paint-context-private.h"
|
||||||
#include "clutter-paint-nodes.h"
|
#include "clutter-paint-nodes.h"
|
||||||
#include "clutter-paint-node-private.h"
|
#include "clutter-paint-node-private.h"
|
||||||
#include "clutter-paint-volume-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
|
* means there's no point in trying to cull descendants of the current
|
||||||
* node. */
|
* node. */
|
||||||
static gboolean
|
static gboolean
|
||||||
cull_actor (ClutterActor *self,
|
cull_actor (ClutterActor *self,
|
||||||
ClutterCullResult *result_out)
|
ClutterPaintContext *paint_context,
|
||||||
|
ClutterCullResult *result_out)
|
||||||
{
|
{
|
||||||
ClutterActorPrivate *priv = self->priv;
|
ClutterActorPrivate *priv = self->priv;
|
||||||
ClutterStage *stage;
|
ClutterStage *stage;
|
||||||
@ -3622,10 +3624,10 @@ cull_actor (ClutterActor *self,
|
|||||||
return FALSE;
|
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): "
|
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));
|
_clutter_actor_get_debug_name (self));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -4058,7 +4060,7 @@ clutter_actor_paint (ClutterActor *self,
|
|||||||
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)))
|
CLUTTER_DEBUG_DISABLE_CLIPPED_REDRAWS)))
|
||||||
_clutter_actor_update_last_paint_volume (self);
|
_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))
|
if (G_UNLIKELY (clutter_paint_debug_flags & CLUTTER_DEBUG_REDRAWS))
|
||||||
_clutter_actor_paint_cull_result (self, success, result, actor_node);
|
_clutter_actor_paint_cull_result (self, success, result, actor_node);
|
||||||
|
@ -27,4 +27,6 @@ void clutter_paint_context_push_framebuffer (ClutterPaintContext *paint_context,
|
|||||||
|
|
||||||
void clutter_paint_context_pop_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 */
|
#endif /* CLUTTER_PAINT_CONTEXT_PRIVATE_H */
|
||||||
|
@ -137,3 +137,19 @@ clutter_paint_context_get_stage_view (ClutterPaintContext *paint_context)
|
|||||||
{
|
{
|
||||||
return paint_context->view;
|
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;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user