culling: Don't cull actors not being painted on the stage

Previously we were applying the culling optimization to any actor
painted without considering that we may be painting to an offscreen
framebuffer where the stage clip isn't applicable.

For now we simply expose a getter for the current draw framebuffer
and we can assume that a return value of NULL corresponds to the
stage.

Note: This will need to be updated as stages start to be backed by real
CoglFramebuffer objects and so we won't get NULL in those cases.
This commit is contained in:
Robert Bragg 2011-03-10 18:51:51 +00:00
parent 5ce13b58fe
commit 49ca9e8f12
2 changed files with 11 additions and 0 deletions

View File

@ -2524,6 +2524,14 @@ cull_actor (ClutterActor *self)
const ClutterPlane *stage_clip; const ClutterPlane *stage_clip;
ClutterCullResult result; ClutterCullResult result;
if (_cogl_get_draw_buffer () != NULL)
{
CLUTTER_NOTE (CLIPPING, "Bail from cull_actor without culling (%s): "
"Current framebuffer doesn't correspond to stage",
G_OBJECT_TYPE_NAME (self));
return FALSE;
}
if (!priv->last_paint_volume_valid) if (!priv->last_paint_volume_valid)
{ {
CLUTTER_NOTE (CLIPPING, "Bail from cull_actor without culling (%s): " CLUTTER_NOTE (CLIPPING, "Bail from cull_actor without culling (%s): "

View File

@ -1282,6 +1282,9 @@ _cogl_onscreen_clutter_backend_set_size (int width, int height);
void void
_cogl_swap_buffers_notify (void); _cogl_swap_buffers_notify (void);
CoglFramebuffer *
_cogl_get_draw_buffer (void);
G_END_DECLS G_END_DECLS
#undef __COGL_H_INSIDE__ #undef __COGL_H_INSIDE__