diff --git a/gsk/gskglrenderer.c b/gsk/gskglrenderer.c index 5cbb0a0029..bb98e2ff42 100644 --- a/gsk/gskglrenderer.c +++ b/gsk/gskglrenderer.c @@ -760,8 +760,40 @@ gsk_gl_renderer_add_render_item (GskGLRenderer *self, return; case GSK_NOT_A_RENDER_NODE: - default: + g_assert_not_reached (); return; + + default: + { + graphene_rect_t bounds; + cairo_surface_t *surface; + cairo_t *cr; + + gsk_render_node_get_bounds (node, &bounds); + + surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, + ceil (bounds.size.width), + ceil (bounds.size.height)); + cr = cairo_create (surface); + cairo_translate (cr, -bounds.origin.x, -bounds.origin.y); + + gsk_render_node_draw (node, cr); + + cairo_destroy (cr); + + /* Upload the Cairo surface to a GL texture */ + item.render_data.texture_id = gsk_gl_driver_create_texture (self->gl_driver, + item.size.width, + item.size.height); + gsk_gl_driver_bind_source_texture (self->gl_driver, item.render_data.texture_id); + gsk_gl_driver_init_texture_with_surface (self->gl_driver, + item.render_data.texture_id, + surface, + GL_NEAREST, GL_NEAREST); + + cairo_surface_destroy (surface); + } + break; } /* Create the vertex buffers holding the geometry of the quad */ diff --git a/gsk/gskvulkanrenderpass.c b/gsk/gskvulkanrenderpass.c index 62af7e324c..86ac1a198b 100644 --- a/gsk/gskvulkanrenderpass.c +++ b/gsk/gskvulkanrenderpass.c @@ -72,10 +72,14 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self, switch (gsk_render_node_get_node_type (node)) { case GSK_NOT_A_RENDER_NODE: - default: g_assert_not_reached (); break; + default: + op.type = GSK_VULKAN_OP_FALLBACK; + g_array_append_val (self->render_ops, op); + break; + case GSK_CAIRO_NODE: op.type = GSK_VULKAN_OP_SURFACE; g_array_append_val (self->render_ops, op); @@ -150,7 +154,7 @@ gsk_vulkan_render_pass_upload_fallback (GskVulkanRenderPass *self, ceil (bounds.size.width), ceil (bounds.size.height)); cr = cairo_create (surface); - cairo_translate (cr, bounds.origin.x, bounds.origin.y); + cairo_translate (cr, -bounds.origin.x, -bounds.origin.y); gsk_render_node_draw (op->node, cr);