gsk: Deprecate GskGLShader and the rendernode

The new renderers don't support them due to the required complexity of
integrating them with Vulkan and the assumptions those nodes make about
the renderer (the GL renderer exports its internal APIs into the
GLShader).

There haven't been any complaints that I'm aware of since 4.14 was
released where the default renderer does not support the nodes, so usage
in public seems to be close to nonexistant.

The 2 uses I know of were workarounds about missing features in GTK that
have stopped since GTK now supports them:

1. GStreamer used in to do premultiplication when the old GL renderer
   did not do so in hardware but on the CPU.
2. Adwaita used it for masking before the mask node wa added in 4.10.
This commit is contained in:
Benjamin Otte 2024-07-04 18:12:16 +02:00
parent 53ac80d6c8
commit 32625381fa
31 changed files with 315 additions and 46 deletions

View File

@ -170,6 +170,7 @@ update_paintable (GtkWidget *widget,
static GtkWidget * static GtkWidget *
create_cogs (void) create_cogs (void)
{ {
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GtkWidget *picture; GtkWidget *picture;
static GskGLShader *cog_shader = NULL; static GskGLShader *cog_shader = NULL;
GdkPaintable *paintable; GdkPaintable *paintable;
@ -182,6 +183,7 @@ create_cogs (void)
gtk_widget_add_tick_callback (picture, update_paintable, NULL, NULL); gtk_widget_add_tick_callback (picture, update_paintable, NULL, NULL);
return picture; return picture;
G_GNUC_END_IGNORE_DEPRECATIONS
} }
static gboolean static gboolean

View File

@ -20,6 +20,8 @@
#include "gtkshadertoy.h" #include "gtkshadertoy.h"
#include "gskshaderpaintable.h" #include "gskshaderpaintable.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *demo_window = NULL; static GtkWidget *demo_window = NULL;
static void static void
@ -360,3 +362,5 @@ do_gltransition (GtkWidget *do_widget)
return demo_window; return demo_window;
} }
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@ -22,6 +22,8 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "gskshaderpaintable.h" #include "gskshaderpaintable.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/** /**
* GskShaderPaintable: * GskShaderPaintable:
* *
@ -332,3 +334,5 @@ gsk_shader_paintable_update_time (GskShaderPaintable *self,
g_bytes_unref (args); g_bytes_unref (args);
} }
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@ -22,6 +22,8 @@
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gsk/gsk.h> #include <gsk/gsk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_BEGIN_DECLS G_BEGIN_DECLS
#define GSK_TYPE_SHADER_PAINTABLE (gsk_shader_paintable_get_type ()) #define GSK_TYPE_SHADER_PAINTABLE (gsk_shader_paintable_get_type ())
@ -41,3 +43,5 @@ void gsk_shader_paintable_update_time (GskShaderPaintable *self
int time_idx, int time_idx,
gint64 frame_time); gint64 frame_time);
G_END_DECLS G_END_DECLS
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@ -1,5 +1,7 @@
#include "gtkshaderbin.h" #include "gtkshaderbin.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
typedef struct { typedef struct {
GskGLShader *shader; GskGLShader *shader;
GtkStateFlags state; GtkStateFlags state;
@ -262,3 +264,5 @@ gtk_shader_bin_new (void)
return GTK_WIDGET (self); return GTK_WIDGET (self);
} }
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@ -2,6 +2,8 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_BEGIN_DECLS G_BEGIN_DECLS
#define GTK_TYPE_SHADER_BIN (gtk_shader_bin_get_type ()) #define GTK_TYPE_SHADER_BIN (gtk_shader_bin_get_type ())
@ -18,3 +20,5 @@ void gtk_shader_bin_set_child (GtkShaderBin *self,
GtkWidget *gtk_shader_bin_get_child (GtkShaderBin *self); GtkWidget *gtk_shader_bin_get_child (GtkShaderBin *self);
G_END_DECLS G_END_DECLS
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@ -1,5 +1,7 @@
#include "gtkshaderstack.h" #include "gtkshaderstack.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
struct _GtkShaderStack struct _GtkShaderStack
{ {
GtkWidget parent_instance; GtkWidget parent_instance;
@ -359,3 +361,5 @@ gtk_shader_stack_set_active (GtkShaderStack *self,
self->current = MIN (index, self->children->len); self->current = MIN (index, self->children->len);
update_child_visible (self); update_child_visible (self);
} }
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@ -2,6 +2,8 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_BEGIN_DECLS G_BEGIN_DECLS
#define GTK_TYPE_SHADER_STACK (gtk_shader_stack_get_type ()) #define GTK_TYPE_SHADER_STACK (gtk_shader_stack_get_type ())
@ -18,3 +20,5 @@ void gtk_shader_stack_set_active (GtkShaderStack *self,
int index); int index);
G_END_DECLS G_END_DECLS
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@ -245,6 +245,7 @@ gsk_gl_driver_dispose (GObject *object)
#undef GSK_GL_DEFINE_PROGRAM #undef GSK_GL_DEFINE_PROGRAM
#undef GSK_GL_DEFINE_PROGRAM_NO_CLIP #undef GSK_GL_DEFINE_PROGRAM_NO_CLIP
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (self->shader_cache != NULL) if (self->shader_cache != NULL)
{ {
GHashTableIter iter; GHashTableIter iter;
@ -262,6 +263,7 @@ gsk_gl_driver_dispose (GObject *object)
g_clear_pointer (&self->shader_cache, g_hash_table_unref); g_clear_pointer (&self->shader_cache, g_hash_table_unref);
} }
G_GNUC_END_IGNORE_DEPRECATIONS
if (self->command_queue != NULL) if (self->command_queue != NULL)
{ {
@ -1230,6 +1232,8 @@ gsk_gl_driver_release_render_target (GskGLDriver *self,
return release_render_target (self, render_target, release_texture, TRUE); return release_render_target (self, render_target, release_texture, TRUE);
} }
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/** /**
* gsk_gl_driver_lookup_shader: * gsk_gl_driver_lookup_shader:
* @self: a `GskGLDriver` * @self: a `GskGLDriver`
@ -1347,6 +1351,8 @@ gsk_gl_driver_lookup_shader (GskGLDriver *self,
return program; return program;
} }
G_GNUC_END_IGNORE_DEPRECATIONS
#if 0 #if 0
void void
gsk_gl_driver_save_texture_to_png (GskGLDriver *driver, gsk_gl_driver_save_texture_to_png (GskGLDriver *driver,

View File

@ -177,9 +177,11 @@ void gsk_gl_driver_add_texture_slices (GskGLDriver *s
gboolean ensure_mipmap, gboolean ensure_mipmap,
GskGLTextureSlice **out_slices, GskGLTextureSlice **out_slices,
guint *out_n_slices); guint *out_n_slices);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GskGLProgram * gsk_gl_driver_lookup_shader (GskGLDriver *self, GskGLProgram * gsk_gl_driver_lookup_shader (GskGLDriver *self,
GskGLShader *shader, GskGLShader *shader,
GError **error); GError **error);
G_GNUC_END_IGNORE_DEPRECATIONS
#if 0 #if 0
void gsk_gl_driver_save_texture_to_png (GskGLDriver *self, void gsk_gl_driver_save_texture_to_png (GskGLDriver *self,

View File

@ -525,6 +525,8 @@ gsk_gl_renderer_init (GskGLRenderer *self)
{ {
} }
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gboolean gboolean
gsk_gl_renderer_try_compile_gl_shader (GskGLRenderer *renderer, gsk_gl_renderer_try_compile_gl_shader (GskGLRenderer *renderer,
GskGLShader *shader, GskGLShader *shader,
@ -540,3 +542,4 @@ gsk_gl_renderer_try_compile_gl_shader (GskGLRenderer *renderer,
return program != NULL; return program != NULL;
} }
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@ -26,9 +26,13 @@
G_BEGIN_DECLS G_BEGIN_DECLS
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gboolean gsk_gl_renderer_try_compile_gl_shader (GskGLRenderer *renderer, gboolean gsk_gl_renderer_try_compile_gl_shader (GskGLRenderer *renderer,
GskGLShader *shader, GskGLShader *shader,
GError **error); GError **error);
G_GNUC_END_IGNORE_DEPRECATIONS
G_END_DECLS G_END_DECLS

View File

@ -3501,6 +3501,7 @@ static inline void
gsk_gl_render_job_visit_gl_shader_node (GskGLRenderJob *job, gsk_gl_render_job_visit_gl_shader_node (GskGLRenderJob *job,
const GskRenderNode *node) const GskRenderNode *node)
{ {
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GError *error = NULL; GError *error = NULL;
GskGLShader *shader; GskGLShader *shader;
GskGLProgram *program; GskGLProgram *program;
@ -3612,6 +3613,7 @@ gsk_gl_render_job_visit_gl_shader_node (GskGLRenderJob *job,
gsk_gl_render_job_end_draw (job); gsk_gl_render_job_end_draw (job);
} }
} }
G_GNUC_END_IGNORE_DEPRECATIONS
} }
static void static void

View File

@ -132,6 +132,15 @@
* fragColor = position * source1 + (1.0 - position) * source2; * fragColor = position * source1 + (1.0 - position) * source2;
* } * }
* ``` * ```
*
* # Deprecation
*
* This feature was deprecated in GTK 4.16 after the new rendering infrastructure
* introduced in 4.14 did not support it.
* The lack of Vulkan inegration would have made it a very hard feature to support.
*
* If you want to use OpenGL directly, you should look at [GtkGLArea](../gtk4/class.GLArea.html)
* which uses a different approach and is still well supported.
*/ */
#include "config.h" #include "config.h"
@ -141,6 +150,8 @@
#include "gl/gskglrendererprivate.h" #include "gl/gskglrendererprivate.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GskGLUniformType static GskGLUniformType
uniform_type_from_glsl (const char *str) uniform_type_from_glsl (const char *str)
{ {
@ -481,6 +492,10 @@ gsk_gl_shader_init (GskGLShader *shader)
* Creates a `GskGLShader` that will render pixels using the specified code. * Creates a `GskGLShader` that will render pixels using the specified code.
* *
* Returns: (transfer full): A new `GskGLShader` * Returns: (transfer full): A new `GskGLShader`
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
GskGLShader * GskGLShader *
gsk_gl_shader_new_from_bytes (GBytes *sourcecode) gsk_gl_shader_new_from_bytes (GBytes *sourcecode)
@ -500,6 +515,10 @@ gsk_gl_shader_new_from_bytes (GBytes *sourcecode)
* Creates a `GskGLShader` that will render pixels using the specified code. * Creates a `GskGLShader` that will render pixels using the specified code.
* *
* Returns: (transfer full): A new `GskGLShader` * Returns: (transfer full): A new `GskGLShader`
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
GskGLShader * GskGLShader *
gsk_gl_shader_new_from_resource (const char *resource_path) gsk_gl_shader_new_from_resource (const char *resource_path)
@ -531,6 +550,10 @@ gsk_gl_shader_new_from_resource (const char *resource_path)
* widget snapshot. * widget snapshot.
* *
* Returns: %TRUE on success, %FALSE if an error occurred * Returns: %TRUE on success, %FALSE if an error occurred
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
gboolean gboolean
gsk_gl_shader_compile (GskGLShader *shader, gsk_gl_shader_compile (GskGLShader *shader,
@ -555,6 +578,10 @@ gsk_gl_shader_compile (GskGLShader *shader,
* Gets the GLSL sourcecode being used to render this shader. * Gets the GLSL sourcecode being used to render this shader.
* *
* Returns: (transfer none): The source code for the shader * Returns: (transfer none): The source code for the shader
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
GBytes * GBytes *
gsk_gl_shader_get_source (GskGLShader *shader) gsk_gl_shader_get_source (GskGLShader *shader)
@ -572,6 +599,10 @@ gsk_gl_shader_get_source (GskGLShader *shader)
* to render this shader. * to render this shader.
* *
* Returns: (transfer none) (nullable): The resource path for the shader * Returns: (transfer none) (nullable): The resource path for the shader
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
const char * const char *
gsk_gl_shader_get_resource (GskGLShader *shader) gsk_gl_shader_get_resource (GskGLShader *shader)
@ -592,6 +623,10 @@ gsk_gl_shader_get_resource (GskGLShader *shader)
* u_textureN value that the shader defines. * u_textureN value that the shader defines.
* *
* Returns: The number of texture inputs required by @shader * Returns: The number of texture inputs required by @shader
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
int int
gsk_gl_shader_get_n_textures (GskGLShader *shader) gsk_gl_shader_get_n_textures (GskGLShader *shader)
@ -608,6 +643,10 @@ gsk_gl_shader_get_n_textures (GskGLShader *shader)
* Get the number of declared uniforms for this shader. * Get the number of declared uniforms for this shader.
* *
* Returns: The number of declared uniforms * Returns: The number of declared uniforms
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
int int
gsk_gl_shader_get_n_uniforms (GskGLShader *shader) gsk_gl_shader_get_n_uniforms (GskGLShader *shader)
@ -625,6 +664,10 @@ gsk_gl_shader_get_n_uniforms (GskGLShader *shader)
* Get the name of the declared uniform for this shader at index @idx. * Get the name of the declared uniform for this shader at index @idx.
* *
* Returns: (transfer none): The name of the declared uniform * Returns: (transfer none): The name of the declared uniform
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
const char * const char *
gsk_gl_shader_get_uniform_name (GskGLShader *shader, gsk_gl_shader_get_uniform_name (GskGLShader *shader,
@ -645,6 +688,10 @@ gsk_gl_shader_get_uniform_name (GskGLShader *shader,
* of the uniform, or -1 if it was not found. * of the uniform, or -1 if it was not found.
* *
* Returns: The index of the uniform, or -1 * Returns: The index of the uniform, or -1
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
int int
gsk_gl_shader_find_uniform_by_name (GskGLShader *shader, gsk_gl_shader_find_uniform_by_name (GskGLShader *shader,
@ -670,6 +717,10 @@ gsk_gl_shader_find_uniform_by_name (GskGLShader *shader,
* Get the type of the declared uniform for this shader at index @idx. * Get the type of the declared uniform for this shader at index @idx.
* *
* Returns: The type of the declared uniform * Returns: The type of the declared uniform
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
GskGLUniformType GskGLUniformType
gsk_gl_shader_get_uniform_type (GskGLShader *shader, gsk_gl_shader_get_uniform_type (GskGLShader *shader,
@ -689,6 +740,10 @@ gsk_gl_shader_get_uniform_type (GskGLShader *shader,
* Get the offset into the data block where data for this uniforms is stored. * Get the offset into the data block where data for this uniforms is stored.
* *
* Returns: The data offset * Returns: The data offset
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
int int
gsk_gl_shader_get_uniform_offset (GskGLShader *shader, gsk_gl_shader_get_uniform_offset (GskGLShader *shader,
@ -715,6 +770,10 @@ gsk_gl_shader_get_uniforms (GskGLShader *shader,
* Get the size of the data block used to specify arguments for this shader. * Get the size of the data block used to specify arguments for this shader.
* *
* Returns: The size of the data block * Returns: The size of the data block
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
gsize gsize
gsk_gl_shader_get_args_size (GskGLShader *shader) gsk_gl_shader_get_args_size (GskGLShader *shader)
@ -749,6 +808,10 @@ gsk_gl_shader_find_uniform (GskGLShader *shader,
* The uniform must be of float type. * The uniform must be of float type.
* *
* Returns: The value * Returns: The value
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
float float
gsk_gl_shader_get_arg_float (GskGLShader *shader, gsk_gl_shader_get_arg_float (GskGLShader *shader,
@ -782,6 +845,10 @@ gsk_gl_shader_get_arg_float (GskGLShader *shader,
* The uniform must be of int type. * The uniform must be of int type.
* *
* Returns: The value * Returns: The value
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
gint32 gint32
gsk_gl_shader_get_arg_int (GskGLShader *shader, gsk_gl_shader_get_arg_int (GskGLShader *shader,
@ -815,6 +882,10 @@ gsk_gl_shader_get_arg_int (GskGLShader *shader,
* The uniform must be of uint type. * The uniform must be of uint type.
* *
* Returns: The value * Returns: The value
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
guint32 guint32
gsk_gl_shader_get_arg_uint (GskGLShader *shader, gsk_gl_shader_get_arg_uint (GskGLShader *shader,
@ -848,6 +919,10 @@ gsk_gl_shader_get_arg_uint (GskGLShader *shader,
* The uniform must be of bool type. * The uniform must be of bool type.
* *
* Returns: The value * Returns: The value
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
gboolean gboolean
gsk_gl_shader_get_arg_bool (GskGLShader *shader, gsk_gl_shader_get_arg_bool (GskGLShader *shader,
@ -880,6 +955,10 @@ gsk_gl_shader_get_arg_bool (GskGLShader *shader,
* Gets the value of the uniform @idx in the @args block. * Gets the value of the uniform @idx in the @args block.
* *
* The uniform must be of vec2 type. * The uniform must be of vec2 type.
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
void void
gsk_gl_shader_get_arg_vec2 (GskGLShader *shader, gsk_gl_shader_get_arg_vec2 (GskGLShader *shader,
@ -913,6 +992,10 @@ gsk_gl_shader_get_arg_vec2 (GskGLShader *shader,
* Gets the value of the uniform @idx in the @args block. * Gets the value of the uniform @idx in the @args block.
* *
* The uniform must be of vec3 type. * The uniform must be of vec3 type.
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
void void
gsk_gl_shader_get_arg_vec3 (GskGLShader *shader, gsk_gl_shader_get_arg_vec3 (GskGLShader *shader,
@ -946,6 +1029,10 @@ gsk_gl_shader_get_arg_vec3 (GskGLShader *shader,
* Gets the value of the uniform @idx in the @args block. * Gets the value of the uniform @idx in the @args block.
* *
* The uniform must be of vec4 type. * The uniform must be of vec4 type.
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
void void
gsk_gl_shader_get_arg_vec4 (GskGLShader *shader, gsk_gl_shader_get_arg_vec4 (GskGLShader *shader,
@ -989,6 +1076,10 @@ gsk_gl_shader_get_arg_vec4 (GskGLShader *shader,
* *
* Returns: (transfer full): A newly allocated block of data which can be * Returns: (transfer full): A newly allocated block of data which can be
* passed to [ctor@Gsk.GLShaderNode.new]. * passed to [ctor@Gsk.GLShaderNode.new].
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
GBytes * GBytes *
gsk_gl_shader_format_args_va (GskGLShader *shader, gsk_gl_shader_format_args_va (GskGLShader *shader,
@ -1073,6 +1164,10 @@ gsk_gl_shader_format_args_va (GskGLShader *shader,
* *
* Returns: (transfer full): A newly allocated block of data which can be * Returns: (transfer full): A newly allocated block of data which can be
* passed to [ctor@Gsk.GLShaderNode.new]. * passed to [ctor@Gsk.GLShaderNode.new].
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
GBytes * GBytes *
gsk_gl_shader_format_args (GskGLShader *shader, gsk_gl_shader_format_args (GskGLShader *shader,
@ -1109,6 +1204,10 @@ G_DEFINE_BOXED_TYPE (GskShaderArgsBuilder, gsk_shader_args_builder,
* *
* Returns: (transfer full): The newly allocated builder, free with * Returns: (transfer full): The newly allocated builder, free with
* [method@Gsk.ShaderArgsBuilder.unref] * [method@Gsk.ShaderArgsBuilder.unref]
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
GskShaderArgsBuilder * GskShaderArgsBuilder *
gsk_shader_args_builder_new (GskGLShader *shader, gsk_shader_args_builder_new (GskGLShader *shader,
@ -1147,9 +1246,12 @@ gsk_shader_args_builder_new (GskGLShader *shader,
* This function is intended primarily for bindings. C code should use * This function is intended primarily for bindings. C code should use
* [method@Gsk.ShaderArgsBuilder.free_to_args]. * [method@Gsk.ShaderArgsBuilder.free_to_args].
* *
*
* Returns: (transfer full): the newly allocated buffer with * Returns: (transfer full): the newly allocated buffer with
* all the args added to @builder * all the args added to @builder
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
GBytes * GBytes *
gsk_shader_args_builder_to_args (GskShaderArgsBuilder *builder) gsk_shader_args_builder_to_args (GskShaderArgsBuilder *builder)
@ -1170,6 +1272,10 @@ gsk_shader_args_builder_to_args (GskShaderArgsBuilder *builder)
* *
* Returns: (transfer full): the newly allocated buffer with * Returns: (transfer full): the newly allocated buffer with
* all the args added to @builder * all the args added to @builder
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
GBytes * GBytes *
gsk_shader_args_builder_free_to_args (GskShaderArgsBuilder *builder) gsk_shader_args_builder_free_to_args (GskShaderArgsBuilder *builder)
@ -1193,6 +1299,10 @@ gsk_shader_args_builder_free_to_args (GskShaderArgsBuilder *builder)
* Decreases the reference count of a `GskShaderArgBuilder` by one. * Decreases the reference count of a `GskShaderArgBuilder` by one.
* *
* If the resulting reference count is zero, frees the builder. * If the resulting reference count is zero, frees the builder.
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
void void
gsk_shader_args_builder_unref (GskShaderArgsBuilder *builder) gsk_shader_args_builder_unref (GskShaderArgsBuilder *builder)
@ -1217,6 +1327,10 @@ gsk_shader_args_builder_unref (GskShaderArgsBuilder *builder)
* Increases the reference count of a `GskShaderArgsBuilder` by one. * Increases the reference count of a `GskShaderArgsBuilder` by one.
* *
* Returns: the passed in `GskShaderArgsBuilder` * Returns: the passed in `GskShaderArgsBuilder`
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
GskShaderArgsBuilder * GskShaderArgsBuilder *
gsk_shader_args_builder_ref (GskShaderArgsBuilder *builder) gsk_shader_args_builder_ref (GskShaderArgsBuilder *builder)
@ -1264,6 +1378,10 @@ gsk_shader_args_builder_set_float (GskShaderArgsBuilder *builder,
* Sets the value of the uniform @idx. * Sets the value of the uniform @idx.
* *
* The uniform must be of int type. * The uniform must be of int type.
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
void void
gsk_shader_args_builder_set_int (GskShaderArgsBuilder *builder, gsk_shader_args_builder_set_int (GskShaderArgsBuilder *builder,
@ -1292,6 +1410,10 @@ gsk_shader_args_builder_set_int (GskShaderArgsBuilder *builder,
* Sets the value of the uniform @idx. * Sets the value of the uniform @idx.
* *
* The uniform must be of uint type. * The uniform must be of uint type.
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
void void
gsk_shader_args_builder_set_uint (GskShaderArgsBuilder *builder, gsk_shader_args_builder_set_uint (GskShaderArgsBuilder *builder,
@ -1320,6 +1442,10 @@ gsk_shader_args_builder_set_uint (GskShaderArgsBuilder *builder,
* Sets the value of the uniform @idx. * Sets the value of the uniform @idx.
* *
* The uniform must be of bool type. * The uniform must be of bool type.
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
void void
gsk_shader_args_builder_set_bool (GskShaderArgsBuilder *builder, gsk_shader_args_builder_set_bool (GskShaderArgsBuilder *builder,
@ -1348,6 +1474,10 @@ gsk_shader_args_builder_set_bool (GskShaderArgsBuilder *builder,
* Sets the value of the uniform @idx. * Sets the value of the uniform @idx.
* *
* The uniform must be of vec2 type. * The uniform must be of vec2 type.
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
void void
gsk_shader_args_builder_set_vec2 (GskShaderArgsBuilder *builder, gsk_shader_args_builder_set_vec2 (GskShaderArgsBuilder *builder,
@ -1376,6 +1506,10 @@ gsk_shader_args_builder_set_vec2 (GskShaderArgsBuilder *builder,
* Sets the value of the uniform @idx. * Sets the value of the uniform @idx.
* *
* The uniform must be of vec3 type. * The uniform must be of vec3 type.
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
void void
gsk_shader_args_builder_set_vec3 (GskShaderArgsBuilder *builder, gsk_shader_args_builder_set_vec3 (GskShaderArgsBuilder *builder,
@ -1404,6 +1538,10 @@ gsk_shader_args_builder_set_vec3 (GskShaderArgsBuilder *builder,
* Sets the value of the uniform @idx. * Sets the value of the uniform @idx.
* *
* The uniform must be of vec4 type. * The uniform must be of vec4 type.
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
void void
gsk_shader_args_builder_set_vec4 (GskShaderArgsBuilder *builder, gsk_shader_args_builder_set_vec4 (GskShaderArgsBuilder *builder,
@ -1422,3 +1560,5 @@ gsk_shader_args_builder_set_vec4 (GskShaderArgsBuilder *builder,
args_dest = builder->data + u->offset; args_dest = builder->data + u->offset;
graphene_vec4_to_float (value, (float *)args_dest); graphene_vec4_to_float (value, (float *)args_dest);
} }
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@ -27,6 +27,8 @@
#include <gsk/gsktypes.h> #include <gsk/gsktypes.h>
#include <gsk/gskenums.h> #include <gsk/gskenums.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_BEGIN_DECLS G_BEGIN_DECLS
#define GSK_TYPE_SHADER_ARGS_BUILDER (gsk_shader_args_builder_get_type ()) #define GSK_TYPE_SHADER_ARGS_BUILDER (gsk_shader_args_builder_get_type ())
@ -36,126 +38,127 @@ G_BEGIN_DECLS
* *
* An object to build the uniforms data for a `GskGLShader`. * An object to build the uniforms data for a `GskGLShader`.
*/ */
typedef struct _GskShaderArgsBuilder GskShaderArgsBuilder; typedef struct _GskGLShader GskGLShader GDK_DEPRECATED_TYPE_IN_4_16_FOR(GtkGLArea);
typedef struct _GskShaderArgsBuilder GskShaderArgsBuilder GDK_DEPRECATED_TYPE_IN_4_16_FOR(GtkGLArea);
#define GSK_TYPE_GL_SHADER (gsk_gl_shader_get_type ()) #define GSK_TYPE_GL_SHADER (gsk_gl_shader_get_type ())
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
G_DECLARE_FINAL_TYPE (GskGLShader, gsk_gl_shader, GSK, GL_SHADER, GObject) G_DECLARE_FINAL_TYPE (GskGLShader, gsk_gl_shader, GSK, GL_SHADER, GObject)
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GskGLShader * gsk_gl_shader_new_from_bytes (GBytes *sourcecode); GskGLShader * gsk_gl_shader_new_from_bytes (GBytes *sourcecode);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GskGLShader * gsk_gl_shader_new_from_resource (const char *resource_path); GskGLShader * gsk_gl_shader_new_from_resource (const char *resource_path);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
gboolean gsk_gl_shader_compile (GskGLShader *shader, gboolean gsk_gl_shader_compile (GskGLShader *shader,
GskRenderer *renderer, GskRenderer *renderer,
GError **error); GError **error);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GBytes * gsk_gl_shader_get_source (GskGLShader *shader); GBytes * gsk_gl_shader_get_source (GskGLShader *shader);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
const char * gsk_gl_shader_get_resource (GskGLShader *shader); const char * gsk_gl_shader_get_resource (GskGLShader *shader);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
int gsk_gl_shader_get_n_textures (GskGLShader *shader); int gsk_gl_shader_get_n_textures (GskGLShader *shader);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
int gsk_gl_shader_get_n_uniforms (GskGLShader *shader); int gsk_gl_shader_get_n_uniforms (GskGLShader *shader);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
const char * gsk_gl_shader_get_uniform_name (GskGLShader *shader, const char * gsk_gl_shader_get_uniform_name (GskGLShader *shader,
int idx); int idx);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
int gsk_gl_shader_find_uniform_by_name (GskGLShader *shader, int gsk_gl_shader_find_uniform_by_name (GskGLShader *shader,
const char *name); const char *name);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GskGLUniformType gsk_gl_shader_get_uniform_type (GskGLShader *shader, GskGLUniformType gsk_gl_shader_get_uniform_type (GskGLShader *shader,
int idx); int idx);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
int gsk_gl_shader_get_uniform_offset (GskGLShader *shader, int gsk_gl_shader_get_uniform_offset (GskGLShader *shader,
int idx); int idx);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
gsize gsk_gl_shader_get_args_size (GskGLShader *shader); gsize gsk_gl_shader_get_args_size (GskGLShader *shader);
/* Helpers for managing shader args */ /* Helpers for managing shader args */
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GBytes * gsk_gl_shader_format_args_va (GskGLShader *shader, GBytes * gsk_gl_shader_format_args_va (GskGLShader *shader,
va_list uniforms); va_list uniforms);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GBytes * gsk_gl_shader_format_args (GskGLShader *shader, GBytes * gsk_gl_shader_format_args (GskGLShader *shader,
...) G_GNUC_NULL_TERMINATED; ...) G_GNUC_NULL_TERMINATED;
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
float gsk_gl_shader_get_arg_float (GskGLShader *shader, float gsk_gl_shader_get_arg_float (GskGLShader *shader,
GBytes *args, GBytes *args,
int idx); int idx);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
gint32 gsk_gl_shader_get_arg_int (GskGLShader *shader, gint32 gsk_gl_shader_get_arg_int (GskGLShader *shader,
GBytes *args, GBytes *args,
int idx); int idx);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
guint32 gsk_gl_shader_get_arg_uint (GskGLShader *shader, guint32 gsk_gl_shader_get_arg_uint (GskGLShader *shader,
GBytes *args, GBytes *args,
int idx); int idx);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
gboolean gsk_gl_shader_get_arg_bool (GskGLShader *shader, gboolean gsk_gl_shader_get_arg_bool (GskGLShader *shader,
GBytes *args, GBytes *args,
int idx); int idx);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
void gsk_gl_shader_get_arg_vec2 (GskGLShader *shader, void gsk_gl_shader_get_arg_vec2 (GskGLShader *shader,
GBytes *args, GBytes *args,
int idx, int idx,
graphene_vec2_t *out_value); graphene_vec2_t *out_value);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
void gsk_gl_shader_get_arg_vec3 (GskGLShader *shader, void gsk_gl_shader_get_arg_vec3 (GskGLShader *shader,
GBytes *args, GBytes *args,
int idx, int idx,
graphene_vec3_t *out_value); graphene_vec3_t *out_value);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
void gsk_gl_shader_get_arg_vec4 (GskGLShader *shader, void gsk_gl_shader_get_arg_vec4 (GskGLShader *shader,
GBytes *args, GBytes *args,
int idx, int idx,
graphene_vec4_t *out_value); graphene_vec4_t *out_value);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GType gsk_shader_args_builder_get_type (void) G_GNUC_CONST; GType gsk_shader_args_builder_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GskShaderArgsBuilder *gsk_shader_args_builder_new (GskGLShader *shader, GskShaderArgsBuilder *gsk_shader_args_builder_new (GskGLShader *shader,
GBytes *initial_values); GBytes *initial_values);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GBytes * gsk_shader_args_builder_to_args (GskShaderArgsBuilder *builder); GBytes * gsk_shader_args_builder_to_args (GskShaderArgsBuilder *builder);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GBytes * gsk_shader_args_builder_free_to_args (GskShaderArgsBuilder *builder); GBytes * gsk_shader_args_builder_free_to_args (GskShaderArgsBuilder *builder);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GskShaderArgsBuilder *gsk_shader_args_builder_ref (GskShaderArgsBuilder *builder); GskShaderArgsBuilder *gsk_shader_args_builder_ref (GskShaderArgsBuilder *builder);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
void gsk_shader_args_builder_unref (GskShaderArgsBuilder *builder); void gsk_shader_args_builder_unref (GskShaderArgsBuilder *builder);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
void gsk_shader_args_builder_set_float (GskShaderArgsBuilder *builder, void gsk_shader_args_builder_set_float (GskShaderArgsBuilder *builder,
int idx, int idx,
float value); float value);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
void gsk_shader_args_builder_set_int (GskShaderArgsBuilder *builder, void gsk_shader_args_builder_set_int (GskShaderArgsBuilder *builder,
int idx, int idx,
gint32 value); gint32 value);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
void gsk_shader_args_builder_set_uint (GskShaderArgsBuilder *builder, void gsk_shader_args_builder_set_uint (GskShaderArgsBuilder *builder,
int idx, int idx,
guint32 value); guint32 value);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
void gsk_shader_args_builder_set_bool (GskShaderArgsBuilder *builder, void gsk_shader_args_builder_set_bool (GskShaderArgsBuilder *builder,
int idx, int idx,
gboolean value); gboolean value);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
void gsk_shader_args_builder_set_vec2 (GskShaderArgsBuilder *builder, void gsk_shader_args_builder_set_vec2 (GskShaderArgsBuilder *builder,
int idx, int idx,
const graphene_vec2_t *value); const graphene_vec2_t *value);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
void gsk_shader_args_builder_set_vec3 (GskShaderArgsBuilder *builder, void gsk_shader_args_builder_set_vec3 (GskShaderArgsBuilder *builder,
int idx, int idx,
const graphene_vec3_t *value); const graphene_vec3_t *value);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
void gsk_shader_args_builder_set_vec4 (GskShaderArgsBuilder *builder, void gsk_shader_args_builder_set_vec4 (GskShaderArgsBuilder *builder,
int idx, int idx,
const graphene_vec4_t *value); const graphene_vec4_t *value);
@ -163,3 +166,4 @@ void gsk_shader_args_builder_set_vec4 (GskShaderArgsBuilder *builder,
G_END_DECLS G_END_DECLS
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@ -2,6 +2,8 @@
#include <gsk/gskglshader.h> #include <gsk/gskglshader.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_BEGIN_DECLS G_BEGIN_DECLS
typedef struct { typedef struct {
@ -15,3 +17,5 @@ const GskGLUniform *gsk_gl_shader_get_uniforms (GskGLShader *shader,
G_END_DECLS G_END_DECLS
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@ -196,7 +196,7 @@ typedef struct _GskCrossFadeNode GskCrossFadeNode;
typedef struct _GskTextNode GskTextNode; typedef struct _GskTextNode GskTextNode;
typedef struct _GskBlurNode GskBlurNode; typedef struct _GskBlurNode GskBlurNode;
typedef struct _GskMaskNode GskMaskNode; typedef struct _GskMaskNode GskMaskNode;
typedef struct _GskGLShaderNode GskGLShaderNode; typedef struct _GskGLShaderNode GskGLShaderNode GDK_DEPRECATED_TYPE_IN_4_16_FOR(GtkGLArea);
typedef struct _GskSubsurfaceNode GskSubsurfaceNode; typedef struct _GskSubsurfaceNode GskSubsurfaceNode;
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
@ -574,24 +574,28 @@ GskRenderNode * gsk_mask_node_get_mask (const GskRender
GDK_AVAILABLE_IN_4_10 GDK_AVAILABLE_IN_4_10
GskMaskMode gsk_mask_node_get_mask_mode (const GskRenderNode *node); GskMaskMode gsk_mask_node_get_mask_mode (const GskRenderNode *node);
GDK_AVAILABLE_IN_ALL G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GType gsk_gl_shader_node_get_type (void) G_GNUC_CONST; GType gsk_gl_shader_node_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GskRenderNode * gsk_gl_shader_node_new (GskGLShader *shader, GskRenderNode * gsk_gl_shader_node_new (GskGLShader *shader,
const graphene_rect_t *bounds, const graphene_rect_t *bounds,
GBytes *args, GBytes *args,
GskRenderNode **children, GskRenderNode **children,
guint n_children); guint n_children);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
guint gsk_gl_shader_node_get_n_children (const GskRenderNode *node) G_GNUC_PURE; guint gsk_gl_shader_node_get_n_children (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GskRenderNode * gsk_gl_shader_node_get_child (const GskRenderNode *node, GskRenderNode * gsk_gl_shader_node_get_child (const GskRenderNode *node,
guint idx) G_GNUC_PURE; guint idx) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GBytes * gsk_gl_shader_node_get_args (const GskRenderNode *node) G_GNUC_PURE; GBytes * gsk_gl_shader_node_get_args (const GskRenderNode *node) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
GskGLShader * gsk_gl_shader_node_get_shader (const GskRenderNode *node) G_GNUC_PURE; GskGLShader * gsk_gl_shader_node_get_shader (const GskRenderNode *node) G_GNUC_PURE;
G_GNUC_END_IGNORE_DEPRECATIONS
GDK_AVAILABLE_IN_4_14 GDK_AVAILABLE_IN_4_14
GType gsk_subsurface_node_get_type (void) G_GNUC_CONST; GType gsk_subsurface_node_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_4_14 GDK_AVAILABLE_IN_4_14

View File

@ -6717,6 +6717,7 @@ gsk_debug_node_get_message (const GskRenderNode *node)
/* }}} */ /* }}} */
/* {{{ GSK_GL_SHADER_NODE */ /* {{{ GSK_GL_SHADER_NODE */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/** /**
* GskGLShaderNode: * GskGLShaderNode:
* *
@ -6826,6 +6827,10 @@ gsk_gl_shader_node_class_init (gpointer g_class,
* renderer before using it. * renderer before using it.
* *
* Returns: (transfer full) (type GskGLShaderNode): A new `GskRenderNode` * Returns: (transfer full) (type GskGLShaderNode): A new `GskRenderNode`
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
GskRenderNode * GskRenderNode *
gsk_gl_shader_node_new (GskGLShader *shader, gsk_gl_shader_node_new (GskGLShader *shader,
@ -6877,6 +6882,10 @@ gsk_gl_shader_node_new (GskGLShader *shader,
* Returns the number of children * Returns the number of children
* *
* Returns: The number of children * Returns: The number of children
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
guint guint
gsk_gl_shader_node_get_n_children (const GskRenderNode *node) gsk_gl_shader_node_get_n_children (const GskRenderNode *node)
@ -6894,6 +6903,10 @@ gsk_gl_shader_node_get_n_children (const GskRenderNode *node)
* Gets one of the children. * Gets one of the children.
* *
* Returns: (transfer none): the @idx'th child of @node * Returns: (transfer none): the @idx'th child of @node
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
GskRenderNode * GskRenderNode *
gsk_gl_shader_node_get_child (const GskRenderNode *node, gsk_gl_shader_node_get_child (const GskRenderNode *node,
@ -6927,6 +6940,10 @@ gsk_gl_shader_node_get_shader (const GskRenderNode *node)
* Gets args for the node. * Gets args for the node.
* *
* Returns: (transfer none): A `GBytes` with the uniform arguments * Returns: (transfer none): A `GBytes` with the uniform arguments
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
* for OpenGL rendering.
*/ */
GBytes * GBytes *
gsk_gl_shader_node_get_args (const GskRenderNode *node) gsk_gl_shader_node_get_args (const GskRenderNode *node)
@ -6935,6 +6952,7 @@ gsk_gl_shader_node_get_args (const GskRenderNode *node)
return self->args; return self->args;
} }
G_GNUC_END_IGNORE_DEPRECATIONS
/* }}} */ /* }}} */
/* {{{ GSK_SUBSURFACE_NODE */ /* {{{ GSK_SUBSURFACE_NODE */
@ -7283,10 +7301,12 @@ gsk_render_node_init_types_once (void)
gsk_mask_node_class_init); gsk_mask_node_class_init);
gsk_render_node_types[GSK_MASK_NODE] = node_type; gsk_render_node_types[GSK_MASK_NODE] = node_type;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
node_type = gsk_render_node_type_register_static (I_("GskGLShaderNode"), node_type = gsk_render_node_type_register_static (I_("GskGLShaderNode"),
sizeof (GskGLShaderNode), sizeof (GskGLShaderNode),
gsk_gl_shader_node_class_init); gsk_gl_shader_node_class_init);
gsk_render_node_types[GSK_GL_SHADER_NODE] = node_type; gsk_render_node_types[GSK_GL_SHADER_NODE] = node_type;
G_GNUC_END_IGNORE_DEPRECATIONS
node_type = gsk_render_node_type_register_static (I_("GskDebugNode"), node_type = gsk_render_node_type_register_static (I_("GskDebugNode"),
sizeof (GskDebugNode), sizeof (GskDebugNode),

View File

@ -1645,6 +1645,7 @@ parse_inset_shadow_node (GtkCssParser *parser,
return gsk_inset_shadow_node_new (&outline, &color, dx, dy, spread, blur); return gsk_inset_shadow_node_new (&outline, &color, dx, dy, spread, blur);
} }
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
typedef union { typedef union {
gint32 i; gint32 i;
double v[4]; double v[4];
@ -1887,6 +1888,7 @@ parse_glshader_node (GtkCssParser *parser,
return node; return node;
} }
G_GNUC_END_IGNORE_DEPRECATIONS
static GskRenderNode * static GskRenderNode *
parse_mask_node (GtkCssParser *parser, parse_mask_node (GtkCssParser *parser,
@ -3113,12 +3115,14 @@ printer_init_duplicates_for_node (Printer *printer,
case GSK_GL_SHADER_NODE: case GSK_GL_SHADER_NODE:
{ {
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
guint i; guint i;
for (i = 0; i < gsk_gl_shader_node_get_n_children (node); i++) for (i = 0; i < gsk_gl_shader_node_get_n_children (node); i++)
{ {
printer_init_duplicates_for_node (printer, gsk_gl_shader_node_get_child (node, i)); printer_init_duplicates_for_node (printer, gsk_gl_shader_node_get_child (node, i));
} }
G_GNUC_END_IGNORE_DEPRECATIONS
} }
break; break;
@ -4294,6 +4298,7 @@ render_node_print (Printer *p,
case GSK_GL_SHADER_NODE: case GSK_GL_SHADER_NODE:
{ {
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GskGLShader *shader = gsk_gl_shader_node_get_shader (node); GskGLShader *shader = gsk_gl_shader_node_get_shader (node);
GBytes *args = gsk_gl_shader_node_get_args (node); GBytes *args = gsk_gl_shader_node_get_args (node);
@ -4407,6 +4412,7 @@ render_node_print (Printer *p,
} }
end_node (p); end_node (p);
G_GNUC_END_IGNORE_DEPRECATIONS
} }
break; break;

View File

@ -91,6 +91,7 @@ struct _GtkSnapshotState {
struct { struct {
graphene_rect_t bounds; graphene_rect_t bounds;
} clip; } clip;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
struct { struct {
GskGLShader *shader; GskGLShader *shader;
GBytes *args; GBytes *args;
@ -98,6 +99,7 @@ struct _GtkSnapshotState {
GskRenderNode **nodes; GskRenderNode **nodes;
GskRenderNode *internal_nodes[4]; GskRenderNode *internal_nodes[4];
} glshader; } glshader;
G_GNUC_END_IGNORE_DEPRECATIONS
struct { struct {
graphene_rect_t bounds; graphene_rect_t bounds;
int node_idx; int node_idx;
@ -917,6 +919,8 @@ gtk_snapshot_push_clip (GtkSnapshot *snapshot,
gtk_graphene_rect_scale_affine (bounds, scale_x, scale_y, dx, dy, &state->data.clip.bounds); gtk_graphene_rect_scale_affine (bounds, scale_x, scale_y, dx, dy, &state->data.clip.bounds);
} }
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GskRenderNode * static GskRenderNode *
gtk_snapshot_collect_gl_shader (GtkSnapshot *snapshot, gtk_snapshot_collect_gl_shader (GtkSnapshot *snapshot,
GtkSnapshotState *state, GtkSnapshotState *state,
@ -1045,6 +1049,10 @@ gtk_snapshot_collect_gl_shader_texture (GtkSnapshot *snapshot,
* re-rendered. * re-rendered.
* *
* For details on how to write shaders, see [class@Gsk.GLShader]. * For details on how to write shaders, see [class@Gsk.GLShader].
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [class@Gtk.GLArea] for
* OpenGL rendering.
*/ */
void void
gtk_snapshot_push_gl_shader (GtkSnapshot *snapshot, gtk_snapshot_push_gl_shader (GtkSnapshot *snapshot,
@ -1126,6 +1134,8 @@ gtk_snapshot_collect_rounded_clip (GtkSnapshot *snapshot,
return clip_node; return clip_node;
} }
G_GNUC_END_IGNORE_DEPRECATIONS
/** /**
* gtk_snapshot_push_rounded_clip: * gtk_snapshot_push_rounded_clip:
* @snapshot: a `GtkSnapshot` * @snapshot: a `GtkSnapshot`
@ -1956,6 +1966,10 @@ gtk_snapshot_pop (GtkSnapshot *snapshot)
* This must be called the same number of times as the number * This must be called the same number of times as the number
* of textures is needed for the shader in * of textures is needed for the shader in
* [method@Gtk.Snapshot.push_gl_shader]. * [method@Gtk.Snapshot.push_gl_shader].
*
* Deprecated: 4.16: GTK's new Vulkan-focused rendering
* does not support this feature. Use [class@Gtk.GLArea] for
* OpenGL rendering.
*/ */
void void
gtk_snapshot_gl_shader_pop_texture (GtkSnapshot *snapshot) gtk_snapshot_gl_shader_pop_texture (GtkSnapshot *snapshot)

View File

@ -109,13 +109,15 @@ void gtk_snapshot_push_mask (GtkSnapshot
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
void gtk_snapshot_push_cross_fade (GtkSnapshot *snapshot, void gtk_snapshot_push_cross_fade (GtkSnapshot *snapshot,
double progress); double progress);
GDK_AVAILABLE_IN_ALL G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
void gtk_snapshot_push_gl_shader (GtkSnapshot *snapshot, void gtk_snapshot_push_gl_shader (GtkSnapshot *snapshot,
GskGLShader *shader, GskGLShader *shader,
const graphene_rect_t *bounds, const graphene_rect_t *bounds,
GBytes *take_args); GBytes *take_args);
GDK_AVAILABLE_IN_ALL GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
void gtk_snapshot_gl_shader_pop_texture (GtkSnapshot *snapshot); void gtk_snapshot_gl_shader_pop_texture (GtkSnapshot *snapshot);
G_GNUC_END_IGNORE_DEPRECATIONS
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
void gtk_snapshot_pop (GtkSnapshot *snapshot); void gtk_snapshot_pop (GtkSnapshot *snapshot);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL

View File

@ -328,6 +328,7 @@ create_list_model_for_render_node (GskRenderNode *node)
case GSK_GL_SHADER_NODE: case GSK_GL_SHADER_NODE:
{ {
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GListStore *store = g_list_store_new (GDK_TYPE_PAINTABLE); GListStore *store = g_list_store_new (GDK_TYPE_PAINTABLE);
for (guint i = 0; i < gsk_gl_shader_node_get_n_children (node); i++) for (guint i = 0; i < gsk_gl_shader_node_get_n_children (node); i++)
@ -343,6 +344,7 @@ create_list_model_for_render_node (GskRenderNode *node)
} }
return G_LIST_MODEL (store); return G_LIST_MODEL (store);
G_GNUC_END_IGNORE_DEPRECATIONS
} }
case GSK_CONTAINER_NODE: case GSK_CONTAINER_NODE:
@ -1240,6 +1242,7 @@ populate_render_node_properties (GListStore *store,
case GSK_GL_SHADER_NODE: case GSK_GL_SHADER_NODE:
{ {
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GskGLShader *shader = gsk_gl_shader_node_get_shader (node); GskGLShader *shader = gsk_gl_shader_node_get_shader (node);
GBytes *args = gsk_gl_shader_node_get_args (node); GBytes *args = gsk_gl_shader_node_get_args (node);
int i; int i;
@ -1315,6 +1318,7 @@ populate_render_node_properties (GListStore *store,
} }
g_free (title); g_free (title);
} }
G_GNUC_END_IGNORE_DEPRECATIONS
} }
break; break;

View File

@ -142,6 +142,7 @@ node_attach (const GskRenderNode *node,
case GSK_GL_SHADER_NODE: case GSK_GL_SHADER_NODE:
{ {
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GskRenderNode **children; GskRenderNode **children;
children = g_newa (GskRenderNode *, gsk_gl_shader_node_get_n_children (node)); children = g_newa (GskRenderNode *, gsk_gl_shader_node_get_n_children (node));
@ -155,6 +156,7 @@ node_attach (const GskRenderNode *node,
for (int i = 0; i < gsk_gl_shader_node_get_n_children (node); i++) for (int i = 0; i < gsk_gl_shader_node_get_n_children (node); i++)
gsk_render_node_unref (children[i]); gsk_render_node_unref (children[i]);
return res; return res;
G_GNUC_END_IGNORE_DEPRECATIONS
} }
case GSK_MASK_NODE: case GSK_MASK_NODE:

View File

@ -191,7 +191,9 @@ test_renderer (GskRenderer *renderer)
GdkSurface *surface; GdkSurface *surface;
gboolean res; gboolean res;
GError *error = NULL; GError *error = NULL;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GskGLShader *shader; GskGLShader *shader;
G_GNUC_END_IGNORE_DEPRECATIONS
GBytes *bytes; GBytes *bytes;
g_assert (GSK_IS_RENDERER (renderer)); g_assert (GSK_IS_RENDERER (renderer));
@ -217,6 +219,7 @@ test_renderer (GskRenderer *renderer)
g_assert_true (gsk_renderer_is_realized (renderer)); g_assert_true (gsk_renderer_is_realized (renderer));
g_assert_true (gsk_renderer_get_surface (renderer) == surface); g_assert_true (gsk_renderer_get_surface (renderer) == surface);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
bytes = g_bytes_new_static (shader1, sizeof (shader1)); bytes = g_bytes_new_static (shader1, sizeof (shader1));
shader = gsk_gl_shader_new_from_bytes (bytes); shader = gsk_gl_shader_new_from_bytes (bytes);
g_bytes_unref (bytes); g_bytes_unref (bytes);
@ -232,6 +235,7 @@ test_renderer (GskRenderer *renderer)
g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED); g_assert_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED);
g_clear_error (&error); g_clear_error (&error);
} }
G_GNUC_END_IGNORE_DEPRECATIONS
gsk_renderer_unrealize (renderer); gsk_renderer_unrealize (renderer);

View File

@ -302,6 +302,7 @@ replay_debug_node (GskRenderNode *node, GtkSnapshot *snapshot)
static void static void
replay_gl_shader_node (GskRenderNode *node, GtkSnapshot *snapshot) replay_gl_shader_node (GskRenderNode *node, GtkSnapshot *snapshot)
{ {
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
graphene_rect_t bounds; graphene_rect_t bounds;
gsk_render_node_get_bounds (node, &bounds); gsk_render_node_get_bounds (node, &bounds);
GskGLShader *shader = gsk_gl_shader_node_get_shader (node); GskGLShader *shader = gsk_gl_shader_node_get_shader (node);
@ -315,6 +316,7 @@ replay_gl_shader_node (GskRenderNode *node, GtkSnapshot *snapshot)
gtk_snapshot_gl_shader_pop_texture (snapshot); gtk_snapshot_gl_shader_pop_texture (snapshot);
} }
gtk_snapshot_pop (snapshot); gtk_snapshot_pop (snapshot);
G_GNUC_END_IGNORE_DEPRECATIONS
} }
static void static void

View File

@ -19,6 +19,8 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* shader fragment as found in nature */ /* shader fragment as found in nature */
const char shader0[] = const char shader0[] =
"// author: bobylito\n" "// author: bobylito\n"
@ -303,3 +305,5 @@ main (int argc,
return g_test_run (); return g_test_run ();
} }
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@ -129,12 +129,14 @@ test_type (gconstpointer data)
GBytes *bytes = g_bytes_new_static (pixels, sizeof (pixels)); GBytes *bytes = g_bytes_new_static (pixels, sizeof (pixels));
instance = (GObject *) gdk_memory_texture_new (1, 1, GDK_MEMORY_DEFAULT, bytes, 4); instance = (GObject *) gdk_memory_texture_new (1, 1, GDK_MEMORY_DEFAULT, bytes, 4);
g_bytes_unref (bytes); g_bytes_unref (bytes);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
} }
else if (g_type_is_a (type, GSK_TYPE_GL_SHADER)) else if (g_type_is_a (type, GSK_TYPE_GL_SHADER))
{ {
GBytes *bytes = g_bytes_new_static ("", 0); GBytes *bytes = g_bytes_new_static ("", 0);
instance = g_object_new (type, "source", bytes, NULL); instance = g_object_new (type, "source", bytes, NULL);
g_bytes_unref (bytes); g_bytes_unref (bytes);
G_GNUC_END_IGNORE_DEPRECATIONS
} }
else if (g_type_is_a (type, GDK_TYPE_CLIPBOARD) || else if (g_type_is_a (type, GDK_TYPE_CLIPBOARD) ||
g_str_equal (g_type_name (type), "GdkX11Cursor")) g_str_equal (g_type_name (type), "GdkX11Cursor"))
@ -193,10 +195,12 @@ test_type (gconstpointer data)
strcmp (pspec->name, "display") == 0) strcmp (pspec->name, "display") == 0)
check = FALSE; check = FALSE;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* set in the constructor */ /* set in the constructor */
if (g_type_is_a (type, GSK_TYPE_GL_SHADER) && if (g_type_is_a (type, GSK_TYPE_GL_SHADER) &&
strcmp (pspec->name, "source") == 0) strcmp (pspec->name, "source") == 0)
check = FALSE; check = FALSE;
G_GNUC_END_IGNORE_DEPRECATIONS
/* This one has a special-purpose default value */ /* This one has a special-purpose default value */
if (g_type_is_a (type, GTK_TYPE_DIALOG) && if (g_type_is_a (type, GTK_TYPE_DIALOG) &&

View File

@ -555,12 +555,14 @@ test_type (gconstpointer data)
GBytes *bytes = g_bytes_new_static (pixels, sizeof (pixels)); GBytes *bytes = g_bytes_new_static (pixels, sizeof (pixels));
instance = (GObject *) gdk_memory_texture_new (1, 1, GDK_MEMORY_DEFAULT, bytes, 4); instance = (GObject *) gdk_memory_texture_new (1, 1, GDK_MEMORY_DEFAULT, bytes, 4);
g_bytes_unref (bytes); g_bytes_unref (bytes);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
} }
else if (g_type_is_a (type, GSK_TYPE_GL_SHADER)) else if (g_type_is_a (type, GSK_TYPE_GL_SHADER))
{ {
GBytes *bytes = g_bytes_new_static ("", 0); GBytes *bytes = g_bytes_new_static ("", 0);
instance = g_object_new (type, "source", bytes, NULL); instance = g_object_new (type, "source", bytes, NULL);
g_bytes_unref (bytes); g_bytes_unref (bytes);
G_GNUC_END_IGNORE_DEPRECATIONS
} }
else if (g_type_is_a (type, GTK_TYPE_FILTER_LIST_MODEL) || else if (g_type_is_a (type, GTK_TYPE_FILTER_LIST_MODEL) ||
g_type_is_a (type, GTK_TYPE_NO_SELECTION) || g_type_is_a (type, GTK_TYPE_NO_SELECTION) ||

View File

@ -75,12 +75,14 @@ test_finalize_object (gconstpointer data)
GBytes *bytes = g_bytes_new_static (pixels, sizeof (pixels)); GBytes *bytes = g_bytes_new_static (pixels, sizeof (pixels));
object = (GObject *) gdk_memory_texture_new (1, 1, GDK_MEMORY_DEFAULT, bytes, 4); object = (GObject *) gdk_memory_texture_new (1, 1, GDK_MEMORY_DEFAULT, bytes, 4);
g_bytes_unref (bytes); g_bytes_unref (bytes);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
} }
else if (g_type_is_a (test_type, GSK_TYPE_GL_SHADER)) else if (g_type_is_a (test_type, GSK_TYPE_GL_SHADER))
{ {
GBytes *bytes = g_bytes_new_static ("", 0); GBytes *bytes = g_bytes_new_static ("", 0);
object = g_object_new (test_type, "source", bytes, NULL); object = g_object_new (test_type, "source", bytes, NULL);
g_bytes_unref (bytes); g_bytes_unref (bytes);
G_GNUC_END_IGNORE_DEPRECATIONS
} }
else if (g_type_is_a (test_type, GTK_TYPE_FILTER_LIST_MODEL) || else if (g_type_is_a (test_type, GTK_TYPE_FILTER_LIST_MODEL) ||
g_type_is_a (test_type, GTK_TYPE_NO_SELECTION) || g_type_is_a (test_type, GTK_TYPE_NO_SELECTION) ||

View File

@ -236,8 +236,10 @@ extract_from_node (GskRenderNode *node)
break; break;
case GSK_GL_SHADER_NODE: case GSK_GL_SHADER_NODE:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
for (unsigned int i = 0; i < gsk_gl_shader_node_get_n_children (node); i++) for (unsigned int i = 0; i < gsk_gl_shader_node_get_n_children (node); i++)
extract_from_node (gsk_gl_shader_node_get_child (node, i)); extract_from_node (gsk_gl_shader_node_get_child (node, i));
G_GNUC_END_IGNORE_DEPRECATIONS
break; break;
case GSK_MASK_NODE: case GSK_MASK_NODE:

View File

@ -116,11 +116,13 @@ count_nodes (GskRenderNode *node,
break; break;
case GSK_GL_SHADER_NODE: case GSK_GL_SHADER_NODE:
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
for (unsigned int i = 0; i < gsk_gl_shader_node_get_n_children (node); i++) for (unsigned int i = 0; i < gsk_gl_shader_node_get_n_children (node); i++)
{ {
count_nodes (gsk_gl_shader_node_get_child (node, i), counts, &dd); count_nodes (gsk_gl_shader_node_get_child (node, i), counts, &dd);
d = MAX (d, dd); d = MAX (d, dd);
} }
G_GNUC_END_IGNORE_DEPRECATIONS
break; break;
case GSK_TEXTURE_SCALE_NODE: case GSK_TEXTURE_SCALE_NODE: