[gtk+: 15/97] gl renderer: save on some frame buffers
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+: 15/97] gl renderer: save on some frame buffers
- Date: Thu, 21 Dec 2017 18:09:29 +0000 (UTC)
commit cd730ccff524857ac37cf03ef8584eb99b7f977c
Author: Timm Bäder <mail baedert org>
Date: Thu Nov 16 09:47:19 2017 +0100
gl renderer: save on some frame buffers
If the child of a color matrix node is a texture, we can directly use
that instead of drawing it to a texture first and then using that
texture.
gsk/gskglrenderer.c | 34 +++++++++++++++++++++++++++-------
1 files changed, 27 insertions(+), 7 deletions(-)
---
diff --git a/gsk/gskglrenderer.c b/gsk/gskglrenderer.c
index 7634359..8c6275e 100644
--- a/gsk/gskglrenderer.c
+++ b/gsk/gskglrenderer.c
@@ -656,7 +656,10 @@ render_item (GskGLRenderer *self,
float vec[4];
glUniform1i (item->program->source_location, 0);
- gsk_gl_driver_bind_source_texture (self->gl_driver, item->render_target);
+ if (item->render_target != 0)
+ gsk_gl_driver_bind_source_texture (self->gl_driver, item->render_target);
+ else
+ gsk_gl_driver_bind_source_texture (self->gl_driver, item->texture_id);
graphene_matrix_to_float (&item->color_matrix_data.color_matrix, mat);
glUniformMatrix4fv (item->program->color_matrix_location, 1, GL_FALSE, mat);
@@ -855,13 +858,30 @@ gsk_gl_renderer_add_render_item (GskGLRenderer *self,
case GSK_COLOR_MATRIX_NODE:
{
GskRenderNode *child = gsk_color_matrix_node_get_child (node);
- graphene_matrix_t p;
- graphene_matrix_t identity;
- graphene_matrix_init_identity (&identity);
- init_framebuffer_for_node (self, &item, node, projection, &p);
- gsk_gl_renderer_add_render_item (self, &p, &identity, item.children, child,
- item.render_target);
+ if (gsk_render_node_get_node_type (child) != GSK_TEXTURE_NODE)
+ {
+
+ graphene_matrix_t p;
+ graphene_matrix_t identity;
+
+ graphene_matrix_init_identity (&identity);
+ init_framebuffer_for_node (self, &item, node, projection, &p);
+ gsk_gl_renderer_add_render_item (self, &p, &identity, item.children, child,
+ item.render_target);
+ }
+ else
+ {
+ GdkTexture *texture = gsk_texture_node_get_texture (child);
+ int gl_min_filter = GL_NEAREST, gl_mag_filter = GL_NEAREST;
+
+ get_gl_scaling_filters (node, &gl_min_filter, &gl_mag_filter);
+
+ item.texture_id = gsk_gl_driver_get_texture_for_texture (self->gl_driver,
+ texture,
+ gl_min_filter,
+ gl_mag_filter);
+ }
item.mode = MODE_COLOR_MATRIX;
item.program = &self->color_matrix_program;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]