Skip to content

gsk/gl: texture libraries, shader creation

Christian Hergert requested to merge wip/chergert/gsk-gl-texture-library into main

This has one small fix from @matthiasc re: gtk-demo font title, but other than that its GSK texture and program related

In particular, this is just to get the drift down for the glyphy work so that the branch can be relatively small going forward.

  • Move atlas stuff out of GskGLDriver and into GskGLTextureLibrary where it's actually used
  • Pin atlases to a single library type (no more sharing between icons and glyphs) which makes way to have per-library formats going forward (alpha only for non-colored glyphs)
  • 1x1 pixel used for coloring now only exists within glyphs texture library
  • Add various vfuncs to allow more allocation control in subclasses, necessary for future work to integrate Glyphy which does not use rectangle packing
  • Shaders can not be created by joining bytes from external sources, which also allows for joining data or defines in the gskglprograms.defs (See Below)

Shader definition example:

GSK_GL_DEFINE_PROGRAM (thing,
                       GSK_GL_SHADER_JOINED (VERTEX,
                                             GSK_GL_SHADER_RESOURCE ("thing.vs.glsl"),
                                             NULL)
                       GSK_GL_SHADER_JOINED (FRAGMENT,
                                             GSK_GL_SHADER_STRING (thing_shader_source ()),
                                             GSK_GL_SHADER_STRING ("#define THING 1\n"),
                                             GSK_GL_SHADER_STRING (thing_other_shader_source ()),
                                             GSK_GL_SHADER_RESOURCE ("thing.fs.glsl"),
                                             NULL),
                       GSK_GL_ADD_UNIFORM (0, THING_PARAM, u_param))
Edited by Christian Hergert

Merge request reports