[gtk+] vulkan: Optimize getting textures
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] vulkan: Optimize getting textures
- Date: Sun, 1 Jan 2017 18:53:58 +0000 (UTC)
commit 2fe01a5b570972d01d33a405cf603736bbb94b97
Author: Benjamin Otte <otte redhat com>
Date: Sat Dec 31 22:58:15 2016 +0100
vulkan: Optimize getting textures
When we already have a texture or know we need to upload, just do that
instead of rendering to Cairo.
gsk/gskvulkanrenderpass.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gsk/gskvulkanrenderpass.c b/gsk/gskvulkanrenderpass.c
index b9136bc..68b9e48 100644
--- a/gsk/gskvulkanrenderpass.c
+++ b/gsk/gskvulkanrenderpass.c
@@ -324,6 +324,23 @@ gsk_vulkan_render_pass_get_node_as_texture (GskVulkanRenderPass *self,
cairo_surface_t *surface;
cairo_t *cr;
+ if (graphene_rect_equal (bounds, &node->bounds))
+ {
+ switch (gsk_render_node_get_node_type (node))
+ {
+ case GSK_TEXTURE_NODE:
+ return gsk_vulkan_renderer_ref_texture_image (GSK_VULKAN_RENDERER (gsk_vulkan_render_get_renderer
(render)),
+ gsk_texture_node_get_texture (node),
+ uploader);
+ case GSK_CAIRO_NODE:
+ surface = cairo_surface_reference (gsk_cairo_node_get_surface (node));
+ goto got_surface;
+
+ default:
+ break;
+ }
+ }
+
/* XXX: We could intersect bounds with clip bounds here */
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
ceil (bounds->size.width),
@@ -335,6 +352,7 @@ gsk_vulkan_render_pass_get_node_as_texture (GskVulkanRenderPass *self,
cairo_destroy (cr);
+got_surface:
result = gsk_vulkan_image_new_from_data (uploader,
cairo_image_surface_get_data (surface),
cairo_image_surface_get_width (surface),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]