[gtk/wip/chergert/glyphy] gsk/gl: add use GSK_GL_RESOURCE for resource path
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/glyphy] gsk/gl: add use GSK_GL_RESOURCE for resource path
- Date: Wed, 16 Mar 2022 23:25:54 +0000 (UTC)
commit 51cb20f870bee3b16f7e6248629081ef10cf5cc3
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 16 16:20:40 2022 -0700
gsk/gl: add use GSK_GL_RESOURCE for resource path
The goal here is that we can add additional defines for joining shader
data instead of requiring everything coming from resources directly. This
will eventually be needed for glyphy sources from libglyphy.
gsk/gl/gskgldriver.c | 12 ++++++++++--
gsk/gl/gskglprograms.defs | 32 ++++++++++++++++----------------
2 files changed, 26 insertions(+), 18 deletions(-)
---
diff --git a/gsk/gl/gskgldriver.c b/gsk/gl/gskgldriver.c
index 48c72213e3..6226d2883f 100644
--- a/gsk/gl/gskgldriver.c
+++ b/gsk/gl/gskgldriver.c
@@ -239,6 +239,7 @@ gsk_gl_driver_dispose (GObject *object)
g_assert (self->in_frame == FALSE);
#define GSK_GL_NO_UNIFORMS
+#define GSK_GL_RESOURCE(name)
#define GSK_GL_ADD_UNIFORM(pos, KEY, name)
#define GSK_GL_DEFINE_PROGRAM(name, resource, uniforms) \
GSK_GL_DELETE_PROGRAM(name); \
@@ -252,6 +253,7 @@ gsk_gl_driver_dispose (GObject *object)
} G_STMT_END;
# include "gskglprograms.defs"
#undef GSK_GL_NO_UNIFORMS
+#undef GSK_GL_RESOURCE
#undef GSK_GL_ADD_UNIFORM
#undef GSK_GL_DEFINE_PROGRAM
@@ -370,10 +372,14 @@ gsk_gl_driver_load_programs (GskGLDriver *self,
/* Use XMacros to register all of our programs and their uniforms */
#define GSK_GL_NO_UNIFORMS
+#define GSK_GL_RESOURCE(name) \
+ gsk_gl_compiler_set_source_from_resource (compiler, \
+ GSK_GL_COMPILER_ALL, \
+ "/org/gtk/libgsk/gl/" name)
#define GSK_GL_ADD_UNIFORM(pos, KEY, name) \
gsk_gl_program_add_uniform (program, #name, UNIFORM_##KEY);
-#define GSK_GL_DEFINE_PROGRAM(name, resource, uniforms) \
- gsk_gl_compiler_set_source_from_resource (compiler, GSK_GL_COMPILER_ALL, resource); \
+#define GSK_GL_DEFINE_PROGRAM(name, sources, uniforms) \
+ sources; \
GSK_GL_COMPILE_PROGRAM(name ## _no_clip, uniforms, "#define NO_CLIP 1\n"); \
GSK_GL_COMPILE_PROGRAM(name ## _rect_clip, uniforms, "#define RECT_CLIP 1\n"); \
GSK_GL_COMPILE_PROGRAM(name, uniforms, "");
@@ -406,6 +412,8 @@ gsk_gl_driver_load_programs (GskGLDriver *self,
#undef GSK_GL_DEFINE_PROGRAM_CLIP
#undef GSK_GL_DEFINE_PROGRAM
#undef GSK_GL_ADD_UNIFORM
+#undef GSK_GL_RESOURCE
+#undef GSK_GL_NO_UNIFORMS
ret = TRUE;
diff --git a/gsk/gl/gskglprograms.defs b/gsk/gl/gskglprograms.defs
index a6d9515a78..ac98b4d0e0 100644
--- a/gsk/gl/gskglprograms.defs
+++ b/gsk/gl/gskglprograms.defs
@@ -1,71 +1,71 @@
GSK_GL_DEFINE_PROGRAM (blend,
- "/org/gtk/libgsk/gl/blend.glsl",
+ GSK_GL_RESOURCE ("blend.glsl"),
GSK_GL_ADD_UNIFORM (1, BLEND_SOURCE2, u_source2)
GSK_GL_ADD_UNIFORM (2, BLEND_MODE, u_mode))
GSK_GL_DEFINE_PROGRAM (blit,
- "/org/gtk/libgsk/gl/blit.glsl",
+ GSK_GL_RESOURCE ("blit.glsl"),
GSK_GL_NO_UNIFORMS)
GSK_GL_DEFINE_PROGRAM (blur,
- "/org/gtk/libgsk/gl/blur.glsl",
+ GSK_GL_RESOURCE ("blur.glsl"),
GSK_GL_ADD_UNIFORM (1, BLUR_RADIUS, u_blur_radius)
GSK_GL_ADD_UNIFORM (2, BLUR_SIZE, u_blur_size)
GSK_GL_ADD_UNIFORM (3, BLUR_DIR, u_blur_dir))
GSK_GL_DEFINE_PROGRAM (border,
- "/org/gtk/libgsk/gl/border.glsl",
+ GSK_GL_RESOURCE ("border.glsl"),
GSK_GL_ADD_UNIFORM (1, BORDER_WIDTHS, u_widths)
GSK_GL_ADD_UNIFORM (2, BORDER_OUTLINE_RECT, u_outline_rect))
GSK_GL_DEFINE_PROGRAM (color,
- "/org/gtk/libgsk/gl/color.glsl",
+ GSK_GL_RESOURCE ("color.glsl"),
GSK_GL_NO_UNIFORMS)
GSK_GL_DEFINE_PROGRAM (coloring,
- "/org/gtk/libgsk/gl/coloring.glsl",
+ GSK_GL_RESOURCE ("coloring.glsl"),
GSK_GL_NO_UNIFORMS)
GSK_GL_DEFINE_PROGRAM (color_matrix,
- "/org/gtk/libgsk/gl/color_matrix.glsl",
+ GSK_GL_RESOURCE ("color_matrix.glsl"),
GSK_GL_ADD_UNIFORM (1, COLOR_MATRIX_COLOR_MATRIX, u_color_matrix)
GSK_GL_ADD_UNIFORM (2, COLOR_MATRIX_COLOR_OFFSET, u_color_offset))
GSK_GL_DEFINE_PROGRAM (conic_gradient,
- "/org/gtk/libgsk/gl/conic_gradient.glsl",
+ GSK_GL_RESOURCE ("conic_gradient.glsl"),
GSK_GL_ADD_UNIFORM (1, CONIC_GRADIENT_COLOR_STOPS, u_color_stops)
GSK_GL_ADD_UNIFORM (2, CONIC_GRADIENT_NUM_COLOR_STOPS, u_num_color_stops)
GSK_GL_ADD_UNIFORM (3, CONIC_GRADIENT_GEOMETRY, u_geometry))
GSK_GL_DEFINE_PROGRAM (cross_fade,
- "/org/gtk/libgsk/gl/cross_fade.glsl",
+ GSK_GL_RESOURCE ("cross_fade.glsl"),
GSK_GL_ADD_UNIFORM (1, CROSS_FADE_PROGRESS, u_progress)
GSK_GL_ADD_UNIFORM (2, CROSS_FADE_SOURCE2, u_source2))
GSK_GL_DEFINE_PROGRAM (filled_border,
- "/org/gtk/libgsk/gl/filled_border.glsl",
+ GSK_GL_RESOURCE ("filled_border.glsl"),
GSK_GL_ADD_UNIFORM (1, FILLED_BORDER_WIDTHS, u_widths)
GSK_GL_ADD_UNIFORM (2, FILLED_BORDER_OUTLINE_RECT, u_outline_rect))
GSK_GL_DEFINE_PROGRAM (inset_shadow,
- "/org/gtk/libgsk/gl/inset_shadow.glsl",
+ GSK_GL_RESOURCE ("inset_shadow.glsl"),
GSK_GL_ADD_UNIFORM (1, INSET_SHADOW_SPREAD, u_spread)
GSK_GL_ADD_UNIFORM (2, INSET_SHADOW_OFFSET, u_offset)
GSK_GL_ADD_UNIFORM (3, INSET_SHADOW_OUTLINE_RECT, u_outline_rect))
GSK_GL_DEFINE_PROGRAM (linear_gradient,
- "/org/gtk/libgsk/gl/linear_gradient.glsl",
+ GSK_GL_RESOURCE ("linear_gradient.glsl"),
GSK_GL_ADD_UNIFORM (1, LINEAR_GRADIENT_COLOR_STOPS, u_color_stops)
GSK_GL_ADD_UNIFORM (2, LINEAR_GRADIENT_NUM_COLOR_STOPS, u_num_color_stops)
GSK_GL_ADD_UNIFORM (3, LINEAR_GRADIENT_POINTS, u_points)
GSK_GL_ADD_UNIFORM (4, LINEAR_GRADIENT_REPEAT, u_repeat))
GSK_GL_DEFINE_PROGRAM (outset_shadow,
- "/org/gtk/libgsk/gl/outset_shadow.glsl",
+ GSK_GL_RESOURCE ("outset_shadow.glsl"),
GSK_GL_ADD_UNIFORM (1, OUTSET_SHADOW_OUTLINE_RECT, u_outline_rect))
GSK_GL_DEFINE_PROGRAM (radial_gradient,
- "/org/gtk/libgsk/gl/radial_gradient.glsl",
+ GSK_GL_RESOURCE ("radial_gradient.glsl"),
GSK_GL_ADD_UNIFORM (1, RADIAL_GRADIENT_COLOR_STOPS, u_color_stops)
GSK_GL_ADD_UNIFORM (2, RADIAL_GRADIENT_NUM_COLOR_STOPS, u_num_color_stops)
GSK_GL_ADD_UNIFORM (3, RADIAL_GRADIENT_REPEAT, u_repeat)
@@ -73,12 +73,12 @@ GSK_GL_DEFINE_PROGRAM (radial_gradient,
GSK_GL_ADD_UNIFORM (5, RADIAL_GRADIENT_GEOMETRY, u_geometry))
GSK_GL_DEFINE_PROGRAM (repeat,
- "/org/gtk/libgsk/gl/repeat.glsl",
+ GSK_GL_RESOURCE ("repeat.glsl"),
GSK_GL_ADD_UNIFORM (1, REPEAT_CHILD_BOUNDS, u_child_bounds)
GSK_GL_ADD_UNIFORM (2, REPEAT_TEXTURE_RECT, u_texture_rect))
GSK_GL_DEFINE_PROGRAM (unblurred_outset_shadow,
- "/org/gtk/libgsk/gl/unblurred_outset_shadow.glsl",
+ GSK_GL_RESOURCE ("unblurred_outset_shadow.glsl"),
GSK_GL_ADD_UNIFORM (1, UNBLURRED_OUTSET_SHADOW_SPREAD, u_spread)
GSK_GL_ADD_UNIFORM (2, UNBLURRED_OUTSET_SHADOW_OFFSET, u_offset)
GSK_GL_ADD_UNIFORM (3, UNBLURRED_OUTSET_SHADOW_OUTLINE_RECT, u_outline_rect))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]