From fd0ce66ac18e0e2e5994d9493ff604db4e7f5a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Fri, 22 Nov 2019 11:30:11 +0100 Subject: [PATCH] clutter/paint-nodes: Stop using implicit framebuffer stack Cogl API Stop using API that uses the implicit Cogl framebuffer stack, (e.g. cogl_push_matrix()) and replace usage by the corresponding API taking an explicit framebuffer (e.g. cogl_framebuffer_push_matrix()). For offscreens etc, the offscreen framebuffer is still pushed to and popped from the Cogl framebuffer stack, so that paint nodes still draw to the right framebuffer. https://gitlab.gnome.org/GNOME/mutter/merge_requests/935 --- clutter/clutter/clutter-paint-nodes.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/clutter/clutter/clutter-paint-nodes.c b/clutter/clutter/clutter-paint-nodes.c index d7daec777..9f3024917 100644 --- a/clutter/clutter/clutter-paint-nodes.c +++ b/clutter/clutter/clutter-paint-nodes.c @@ -1256,6 +1256,7 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node, ClutterPaintContext *paint_context) { ClutterLayerNode *lnode = (ClutterLayerNode *) node; + CoglFramebuffer *framebuffer; CoglMatrix matrix; /* if we were unable to create an offscreen buffer for this node, then @@ -1271,7 +1272,8 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node, /* copy the same modelview from the current framebuffer to the one we * are going to use */ - cogl_get_modelview_matrix (&matrix); + framebuffer = cogl_get_draw_framebuffer (); + cogl_framebuffer_get_modelview_matrix (framebuffer, &matrix); cogl_push_framebuffer (lnode->offscreen); @@ -1291,7 +1293,7 @@ clutter_layer_node_pre_draw (ClutterPaintNode *node, COGL_BUFFER_BIT_COLOR | COGL_BUFFER_BIT_DEPTH, 0.f, 0.f, 0.f, 0.f); - cogl_push_matrix (); + cogl_framebuffer_push_matrix (lnode->offscreen); /* every draw operation after this point will happen an offscreen * framebuffer @@ -1309,7 +1311,7 @@ clutter_layer_node_post_draw (ClutterPaintNode *node, guint i; /* switch to the previous framebuffer */ - cogl_pop_matrix (); + cogl_framebuffer_pop_matrix (lnode->offscreen); cogl_pop_framebuffer (); fb = cogl_get_draw_framebuffer ();