2020-09-18 15:46:57 +00:00
|
|
|
/* GSK - The GTK Scene Kit
|
|
|
|
*
|
|
|
|
* Copyright 2020 Red Hat Inc
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2023-03-31 19:11:10 +00:00
|
|
|
#pragma once
|
2020-09-18 15:46:57 +00:00
|
|
|
|
|
|
|
#if !defined (__GSK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
|
|
|
#error "Only <gsk/gsk.h> can be included directly."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include <gsk/gsktypes.h>
|
|
|
|
#include <gsk/gskenums.h>
|
|
|
|
|
2024-07-04 16:12:16 +00:00
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
|
|
|
2020-09-18 15:46:57 +00:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
#define GSK_TYPE_SHADER_ARGS_BUILDER (gsk_shader_args_builder_get_type ())
|
|
|
|
|
2020-12-01 14:16:45 +00:00
|
|
|
/**
|
|
|
|
* GskShaderArgsBuilder:
|
|
|
|
*
|
2021-05-20 03:40:54 +00:00
|
|
|
* An object to build the uniforms data for a `GskGLShader`.
|
2020-12-01 14:16:45 +00:00
|
|
|
*/
|
2024-07-04 16:12:16 +00:00
|
|
|
typedef struct _GskGLShader GskGLShader GDK_DEPRECATED_TYPE_IN_4_16_FOR(GtkGLArea);
|
|
|
|
typedef struct _GskShaderArgsBuilder GskShaderArgsBuilder GDK_DEPRECATED_TYPE_IN_4_16_FOR(GtkGLArea);
|
2020-09-18 15:46:57 +00:00
|
|
|
|
|
|
|
#define GSK_TYPE_GL_SHADER (gsk_gl_shader_get_type ())
|
|
|
|
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
G_DECLARE_FINAL_TYPE (GskGLShader, gsk_gl_shader, GSK, GL_SHADER, GObject)
|
|
|
|
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
GskGLShader * gsk_gl_shader_new_from_bytes (GBytes *sourcecode);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
GskGLShader * gsk_gl_shader_new_from_resource (const char *resource_path);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
gboolean gsk_gl_shader_compile (GskGLShader *shader,
|
|
|
|
GskRenderer *renderer,
|
|
|
|
GError **error);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
GBytes * gsk_gl_shader_get_source (GskGLShader *shader);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
const char * gsk_gl_shader_get_resource (GskGLShader *shader);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
int gsk_gl_shader_get_n_textures (GskGLShader *shader);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
int gsk_gl_shader_get_n_uniforms (GskGLShader *shader);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
const char * gsk_gl_shader_get_uniform_name (GskGLShader *shader,
|
2020-09-29 15:32:03 +00:00
|
|
|
int idx);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
int gsk_gl_shader_find_uniform_by_name (GskGLShader *shader,
|
2020-09-29 15:32:03 +00:00
|
|
|
const char *name);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
GskGLUniformType gsk_gl_shader_get_uniform_type (GskGLShader *shader,
|
2020-09-29 15:32:03 +00:00
|
|
|
int idx);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
int gsk_gl_shader_get_uniform_offset (GskGLShader *shader,
|
2020-09-29 15:32:03 +00:00
|
|
|
int idx);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-29 15:32:03 +00:00
|
|
|
gsize gsk_gl_shader_get_args_size (GskGLShader *shader);
|
2020-09-18 15:46:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Helpers for managing shader args */
|
|
|
|
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
GBytes * gsk_gl_shader_format_args_va (GskGLShader *shader,
|
|
|
|
va_list uniforms);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
GBytes * gsk_gl_shader_format_args (GskGLShader *shader,
|
|
|
|
...) G_GNUC_NULL_TERMINATED;
|
|
|
|
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
float gsk_gl_shader_get_arg_float (GskGLShader *shader,
|
|
|
|
GBytes *args,
|
|
|
|
int idx);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
gint32 gsk_gl_shader_get_arg_int (GskGLShader *shader,
|
|
|
|
GBytes *args,
|
|
|
|
int idx);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
guint32 gsk_gl_shader_get_arg_uint (GskGLShader *shader,
|
|
|
|
GBytes *args,
|
|
|
|
int idx);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
gboolean gsk_gl_shader_get_arg_bool (GskGLShader *shader,
|
|
|
|
GBytes *args,
|
|
|
|
int idx);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
void gsk_gl_shader_get_arg_vec2 (GskGLShader *shader,
|
|
|
|
GBytes *args,
|
|
|
|
int idx,
|
|
|
|
graphene_vec2_t *out_value);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
void gsk_gl_shader_get_arg_vec3 (GskGLShader *shader,
|
|
|
|
GBytes *args,
|
|
|
|
int idx,
|
|
|
|
graphene_vec3_t *out_value);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
void gsk_gl_shader_get_arg_vec4 (GskGLShader *shader,
|
|
|
|
GBytes *args,
|
|
|
|
int idx,
|
|
|
|
graphene_vec4_t *out_value);
|
|
|
|
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
GType gsk_shader_args_builder_get_type (void) G_GNUC_CONST;
|
|
|
|
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
GskShaderArgsBuilder *gsk_shader_args_builder_new (GskGLShader *shader,
|
|
|
|
GBytes *initial_values);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
GBytes * gsk_shader_args_builder_to_args (GskShaderArgsBuilder *builder);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
GBytes * gsk_shader_args_builder_free_to_args (GskShaderArgsBuilder *builder);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
GskShaderArgsBuilder *gsk_shader_args_builder_ref (GskShaderArgsBuilder *builder);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
void gsk_shader_args_builder_unref (GskShaderArgsBuilder *builder);
|
|
|
|
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
void gsk_shader_args_builder_set_float (GskShaderArgsBuilder *builder,
|
|
|
|
int idx,
|
|
|
|
float value);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
void gsk_shader_args_builder_set_int (GskShaderArgsBuilder *builder,
|
|
|
|
int idx,
|
|
|
|
gint32 value);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
void gsk_shader_args_builder_set_uint (GskShaderArgsBuilder *builder,
|
|
|
|
int idx,
|
|
|
|
guint32 value);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
void gsk_shader_args_builder_set_bool (GskShaderArgsBuilder *builder,
|
|
|
|
int idx,
|
|
|
|
gboolean value);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
void gsk_shader_args_builder_set_vec2 (GskShaderArgsBuilder *builder,
|
|
|
|
int idx,
|
|
|
|
const graphene_vec2_t *value);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
void gsk_shader_args_builder_set_vec3 (GskShaderArgsBuilder *builder,
|
|
|
|
int idx,
|
|
|
|
const graphene_vec3_t *value);
|
2024-07-04 16:12:16 +00:00
|
|
|
GDK_DEPRECATED_IN_4_16_FOR(GtkGLArea)
|
2020-09-18 15:46:57 +00:00
|
|
|
void gsk_shader_args_builder_set_vec4 (GskShaderArgsBuilder *builder,
|
|
|
|
int idx,
|
|
|
|
const graphene_vec4_t *value);
|
|
|
|
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2024-07-04 16:12:16 +00:00
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|