From fd8d923a34a009cfbbd7d9194fd89f29e16aa321 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Mon, 21 Oct 2024 10:25:33 +0200 Subject: [PATCH] Adapt to exposed CoglSnippetHook It was exposed few cycles back, so get rid of the duplicated type. Part-of: --- js/ui/lightbox.js | 3 ++- js/ui/screenshot.js | 2 +- src/shell-glsl-effect.c | 10 +++++----- src/shell-glsl-effect.h | 23 +---------------------- 4 files changed, 9 insertions(+), 29 deletions(-) diff --git a/js/ui/lightbox.js b/js/ui/lightbox.js index 56b4d78c5..7544cc2ff 100644 --- a/js/ui/lightbox.js +++ b/js/ui/lightbox.js @@ -1,4 +1,5 @@ import Clutter from 'gi://Clutter'; +import Cogl from 'gi://Cogl'; import GObject from 'gi://GObject'; import Shell from 'gi://Shell'; import St from 'gi://St'; @@ -52,7 +53,7 @@ const RadialShaderEffect = GObject.registerClass({ } vfunc_build_pipeline() { - this.add_glsl_snippet(Shell.SnippetHook.FRAGMENT, + this.add_glsl_snippet(Cogl.SnippetHook.FRAGMENT, VIGNETTE_DECLARATIONS, VIGNETTE_CODE, true); } diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index d5c47d42b..34385d006 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -2993,7 +2993,7 @@ const RecolorEffect = GObject.registerClass({ cogl_color_out.rgb = \n mix(recolor_color, cogl_color_out.rgb, blend); \n`; - this.add_glsl_snippet(Shell.SnippetHook.FRAGMENT, decl, src, false); + this.add_glsl_snippet(Cogl.SnippetHook.FRAGMENT, decl, src, false); } }); diff --git a/src/shell-glsl-effect.c b/src/shell-glsl-effect.c index 7c0bcfa22..48eba31fb 100644 --- a/src/shell-glsl-effect.c +++ b/src/shell-glsl-effect.c @@ -50,7 +50,7 @@ shell_glsl_effect_create_pipeline (ClutterOffscreenEffect *effect, */ void shell_glsl_effect_add_glsl_snippet (ShellGLSLEffect *effect, - ShellSnippetHook hook, + CoglSnippetHook hook, const char *declarations, const char *code, gboolean is_replace) @@ -62,16 +62,16 @@ shell_glsl_effect_add_glsl_snippet (ShellGLSLEffect *effect, if (is_replace) { - snippet = cogl_snippet_new ((CoglSnippetHook)hook, declarations, NULL); + snippet = cogl_snippet_new (hook, declarations, NULL); cogl_snippet_set_replace (snippet, code); } else { - snippet = cogl_snippet_new ((CoglSnippetHook)hook, declarations, code); + snippet = cogl_snippet_new (hook, declarations, code); } - if (hook == SHELL_SNIPPET_HOOK_VERTEX || - hook == SHELL_SNIPPET_HOOK_FRAGMENT) + if (hook == COGL_SNIPPET_HOOK_VERTEX || + hook == COGL_SNIPPET_HOOK_FRAGMENT) cogl_pipeline_add_snippet (klass->base_pipeline, snippet); else cogl_pipeline_add_layer_snippet (klass->base_pipeline, 0, snippet); diff --git a/src/shell-glsl-effect.h b/src/shell-glsl-effect.h index 10b70e13c..ae391695e 100644 --- a/src/shell-glsl-effect.h +++ b/src/shell-glsl-effect.h @@ -3,27 +3,6 @@ #include "st.h" -/** - * ShellSnippetHook: - * Temporary hack to work around Cogl not exporting CoglSnippetHook in - * the 1.0 API. Don't use. - */ -typedef enum { - /* Per pipeline vertex hooks */ - SHELL_SNIPPET_HOOK_VERTEX = 0, - SHELL_SNIPPET_HOOK_VERTEX_TRANSFORM, - - /* Per pipeline fragment hooks */ - SHELL_SNIPPET_HOOK_FRAGMENT = 2048, - - /* Per layer vertex hooks */ - SHELL_SNIPPET_HOOK_TEXTURE_COORD_TRANSFORM = 4096, - - /* Per layer fragment hooks */ - SHELL_SNIPPET_HOOK_LAYER_FRAGMENT = 6144, - SHELL_SNIPPET_HOOK_TEXTURE_LOOKUP -} ShellSnippetHook; - #define SHELL_TYPE_GLSL_EFFECT (shell_glsl_effect_get_type ()) G_DECLARE_DERIVABLE_TYPE (ShellGLSLEffect, shell_glsl_effect, SHELL, GLSL_EFFECT, ClutterOffscreenEffect) @@ -38,7 +17,7 @@ struct _ShellGLSLEffectClass }; void shell_glsl_effect_add_glsl_snippet (ShellGLSLEffect *effect, - ShellSnippetHook hook, + CoglSnippetHook hook, const char *declarations, const char *code, gboolean is_replace);