[gtk/matthiasc/glshader-node: 12/18] gtk-demo: Only use one GskGLShader in fishbowl
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/glshader-node: 12/18] gtk-demo: Only use one GskGLShader in fishbowl
- Date: Mon, 28 Sep 2020 16:52:32 +0000 (UTC)
commit 947a93381917af1f3116ebd04e7d5834fd1b29a2
Author: Alexander Larsson <alexl redhat com>
Date: Mon Sep 28 13:01:18 2020 +0200
gtk-demo: Only use one GskGLShader in fishbowl
We don't want to use a new shader per paintable, because then we will
need to recompile each one. Also remove some leftover unused vars from
the cogs glsl.
demos/gtk-demo/cogs2.glsl | 3 ---
demos/gtk-demo/fishbowl.c | 7 ++++---
2 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/demos/gtk-demo/cogs2.glsl b/demos/gtk-demo/cogs2.glsl
index 59fea55326..8d131eca8d 100644
--- a/demos/gtk-demo/cogs2.glsl
+++ b/demos/gtk-demo/cogs2.glsl
@@ -1,8 +1,5 @@
uniform float iTime;
-in vec2 fragCoord;
-out vec4 vFragColor;
-
// Originally from: https://www.shadertoy.com/view/3ljyDD
// License CC0: Hexagonal tiling + cog wheels
// Nothing fancy, just hexagonal tiling + cog wheels
diff --git a/demos/gtk-demo/fishbowl.c b/demos/gtk-demo/fishbowl.c
index 703a872cc1..659318b7cd 100644
--- a/demos/gtk-demo/fishbowl.c
+++ b/demos/gtk-demo/fishbowl.c
@@ -169,11 +169,12 @@ static GtkWidget *
create_cogs (void)
{
GtkWidget *picture;
- GskGLShader *shader;
+ static GskGLShader *cog_shader = NULL;
GdkPaintable *paintable;
- shader = gsk_gl_shader_new_from_resource ("/gltransition/cogs2.glsl");
- paintable = gsk_shader_paintable_new (shader, NULL);
+ if (cog_shader == NULL)
+ cog_shader = gsk_gl_shader_new_from_resource ("/gltransition/cogs2.glsl");
+ paintable = gsk_shader_paintable_new (g_object_ref (cog_shader), NULL);
picture = gtk_picture_new_for_paintable (paintable);
gtk_widget_set_size_request (picture, 150, 75);
gtk_widget_add_tick_callback (picture, update_paintable, NULL, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]