Skip to content

Replace implicit Cogl stacks (framebuffer and source) with a paint and pick context

Jonas Ådahl requested to merge jadahl/mutter:wip/paint-context into master

When painting, actors rely on global singletons to get various state, such as the current draw framebuffer. Having state hidden in such ways can be very deceiving as it's hard to follow changes spread out, and adding more and more state that should be tracked during a paint gets annoying as they will not change in isolation but one by one in their own places. To do this better, introduce a paint context that is passed along in paint calls that contains the necessary state needed during painting.

In this commit, the context is only introduced, but not used. It aims to replace the Cogl framebuffer stack, and will allow actors to know what view it is currently painted on.


This is just the API changes, I intend to start replacing the usage of the framebuffer stack with this. I know it might eventually end up useless with render nodes, but so be it, I need the paint context for other things anyway.

What I'm having an internal debate over, currently, is whether to have layer immutable paint contexts over each other, or have different "stacks" just as the cogl framebuffer stack for things that might change during a paint. Any opinions?

I.e. either there'd be things like clutter_paint_context_push_framebuffer () and clutter_paint_context_pop_framebuffer (), or there'll be clutter_paint_context_new_wrap_with_framebuffer (paint_context, framebuffer) (or something using properties maybe, to change more things at a time) and clutter_paint_context_pop () to get the parent.

Edited by Jonas Ådahl

Merge request reports