Sebastian Wick 5e98ee5dbe cogl: Add pipeline hooks to user program pipelines
Instead of just adding the cogl header boilerplate, we'll redirect the
main function with #define and #undef to cogl_main(). The real main
calls the hooks-generated cogl_hooks() which chains up to the users
main() which is now called cogl_main().

    <boilerplate>
    #define main cogl_main
    <user shader>
    <hook functions>
    void
    cogl_hooks () {
      cogl_main ();
      <hook code>
    }
    #undef main
    void main () { cogl_hooks(); }

This allows the user shader to continue using shaders which seem like
they define the main function and output to the framebuffer but also
gives the CoglPipeline a chance to add hooks.

This in particular makes our ClutterColorState transform hooks work on
user programs which are used by ClutterShaderEffects.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7804
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7805
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3662
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4037>
2024-11-06 10:51:55 +00:00
..
2024-10-08 16:00:57 +00:00