Snapshot.pushGlShader

Push a GskGLShaderNode.

The node uses the given [class@Gsk.GLShader] and uniform values Additionally this takes a list of @n_children other nodes which will be passed to the GskGLShaderNode.

The @take_args argument is a block of data to use for uniform arguments, as per types and offsets defined by the @shader. Normally this is generated by [method@Gsk.GLShader.format_args] or [struct@Gsk.ShaderArgsBuilder].

The snapshotter takes ownership of @take_args, so the caller should not free it after this.

If the renderer doesn't support GL shaders, or if there is any problem when compiling the shader, then the node will draw pink. You should use [method@Gsk.GLShader.compile] to ensure the @shader will work for the renderer before using it.

If the shader requires textures (see [method@Gsk.GLShader.get_n_textures]), then it is expected that you call [method@Gtk.Snapshot.gl_shader_pop_texture] the number of times that are required. Each of these calls will generate a node that is added as a child to the GskGLShaderNode, which in turn will render these offscreen and pass as a texture to the shader.

Once all textures (if any) are pop:ed, you must call the regular [method@Gtk.Snapshot.pop].

If you want to use pre-existing textures as input to the shader rather than rendering new ones, use [method@Gtk.Snapshot.append_texture] to push a texture node. These will be used directly rather than being re-rendered.

For details on how to write shaders, see [class@Gsk.GLShader].

class Snapshot
void
pushGlShader

Parameters

shader GLShader

The code to run

bounds Rect

the rectangle to render into

takeArgs Bytes

Data block with arguments for the shader.

Meta