1 | /* |
2 | * GStreamer |
3 | * Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com> |
4 | * Copyright (C) 2014 Julien Isorce <julien.isorce@collabora.co.uk> |
5 | * |
6 | * This library is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU Library General Public |
8 | * License as published by the Free Software Foundation; either |
9 | * version 2 of the License, or (at your option) any later version. |
10 | * |
11 | * This library is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | * Library General Public License for more details. |
15 | * |
16 | * You should have received a copy of the GNU Library General Public |
17 | * License along with this library; if not, write to the |
18 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
19 | * Boston, MA 02110-1301, USA. |
20 | */ |
21 | |
22 | #ifndef __GST_GL_SHADER_H__ |
23 | #define __GST_GL_SHADER_H__ |
24 | |
25 | #include <gst/gl/gstgl_fwd.h> |
26 | |
27 | G_BEGIN_DECLS |
28 | |
29 | GST_GL_API |
30 | GType gst_gl_shader_get_type (void); |
31 | #define GST_TYPE_GL_SHADER (gst_gl_shader_get_type()) |
32 | |
33 | #define GST_GL_SHADER(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_SHADER, GstGLShader)) |
34 | #define GST_GL_SHADER_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_SHADER, GstGLShaderClass)) |
35 | #define GST_IS_GL_SHADER(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_SHADER)) |
36 | #define GST_IS_GL_SHADER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_SHADER)) |
37 | #define GST_GL_SHADER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_SHADER, GstGLShaderClass)) |
38 | |
39 | struct _GstGLShader |
40 | { |
41 | GstObject parent; |
42 | |
43 | GstGLContext *context; |
44 | |
45 | /*< private >*/ |
46 | GstGLShaderPrivate *priv; |
47 | |
48 | gpointer _padding[GST_PADDING]; |
49 | }; |
50 | |
51 | struct _GstGLShaderClass { |
52 | /*< private >*/ |
53 | GstObjectClass parent_class; |
54 | }; |
55 | |
56 | GST_GL_API |
57 | GstGLShader * gst_gl_shader_new (GstGLContext *context); |
58 | GST_GL_API |
59 | GstGLShader * gst_gl_shader_new_with_stages (GstGLContext * context, GError ** error, ...); |
60 | GST_GL_API |
61 | GstGLShader * gst_gl_shader_new_link_with_stages (GstGLContext * context, GError ** error, ...); |
62 | GST_GL_API |
63 | GstGLShader * gst_gl_shader_new_default (GstGLContext * context, GError ** error); |
64 | |
65 | GST_GL_API |
66 | gboolean gst_gl_shader_attach (GstGLShader * shader, GstGLSLStage * stage); |
67 | GST_GL_API |
68 | gboolean gst_gl_shader_attach_unlocked (GstGLShader * shader, GstGLSLStage * stage); |
69 | |
70 | GST_GL_API |
71 | void gst_gl_shader_detach (GstGLShader * shader, GstGLSLStage * stage); |
72 | GST_GL_API |
73 | void gst_gl_shader_detach_unlocked (GstGLShader * shader, GstGLSLStage * stage); |
74 | |
75 | GST_GL_API |
76 | gboolean gst_gl_shader_compile_attach_stage (GstGLShader * shader, |
77 | GstGLSLStage *stage, |
78 | GError ** error); |
79 | GST_GL_API |
80 | gboolean gst_gl_shader_link (GstGLShader * shader, GError ** error); |
81 | GST_GL_API |
82 | gboolean gst_gl_shader_is_linked (GstGLShader *shader); |
83 | |
84 | GST_GL_API |
85 | int gst_gl_shader_get_program_handle (GstGLShader * shader); |
86 | |
87 | GST_GL_API |
88 | void gst_gl_shader_release (GstGLShader *shader); |
89 | GST_GL_API |
90 | void gst_gl_shader_release_unlocked (GstGLShader * shader); |
91 | GST_GL_API |
92 | void gst_gl_shader_use (GstGLShader *shader); |
93 | GST_GL_API |
94 | void gst_gl_context_clear_shader (GstGLContext *context); |
95 | |
96 | GST_GL_API |
97 | void gst_gl_shader_set_uniform_1i (GstGLShader *shader, const gchar *name, gint value); |
98 | GST_GL_API |
99 | void gst_gl_shader_set_uniform_1iv (GstGLShader *shader, const gchar *name, guint count, const gint *value); |
100 | GST_GL_API |
101 | void gst_gl_shader_set_uniform_1f (GstGLShader *shader, const gchar *name, gfloat value); |
102 | GST_GL_API |
103 | void gst_gl_shader_set_uniform_1fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value); |
104 | GST_GL_API |
105 | void gst_gl_shader_set_uniform_2i (GstGLShader *shader, const gchar *name, gint v0, gint v1); |
106 | GST_GL_API |
107 | void gst_gl_shader_set_uniform_2iv (GstGLShader *shader, const gchar *name, guint count, const gint *value); |
108 | GST_GL_API |
109 | void gst_gl_shader_set_uniform_2f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1); |
110 | GST_GL_API |
111 | void gst_gl_shader_set_uniform_2fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value); |
112 | GST_GL_API |
113 | void gst_gl_shader_set_uniform_3i (GstGLShader *shader, const gchar *name, gint v0, gint v1, gint v2); |
114 | GST_GL_API |
115 | void gst_gl_shader_set_uniform_3iv (GstGLShader *shader, const gchar *name, guint count, const gint * value); |
116 | GST_GL_API |
117 | void gst_gl_shader_set_uniform_3f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1, gfloat v2); |
118 | GST_GL_API |
119 | void gst_gl_shader_set_uniform_3fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value); |
120 | GST_GL_API |
121 | void gst_gl_shader_set_uniform_4i (GstGLShader *shader, const gchar *name, gint v0, gint v1, gint v2, gint v3); |
122 | GST_GL_API |
123 | void gst_gl_shader_set_uniform_4iv (GstGLShader *shader, const gchar *name, guint count, const gint *value); |
124 | GST_GL_API |
125 | void gst_gl_shader_set_uniform_4f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1, gfloat v2, gfloat v3); |
126 | GST_GL_API |
127 | void gst_gl_shader_set_uniform_4fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value); |
128 | GST_GL_API |
129 | void gst_gl_shader_set_uniform_matrix_2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value); |
130 | GST_GL_API |
131 | void gst_gl_shader_set_uniform_matrix_3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value); |
132 | GST_GL_API |
133 | void gst_gl_shader_set_uniform_matrix_4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value); |
134 | GST_GL_API |
135 | void gst_gl_shader_set_uniform_matrix_2x3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value); |
136 | GST_GL_API |
137 | void gst_gl_shader_set_uniform_matrix_2x4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value); |
138 | GST_GL_API |
139 | void gst_gl_shader_set_uniform_matrix_3x2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value); |
140 | GST_GL_API |
141 | void gst_gl_shader_set_uniform_matrix_3x4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value); |
142 | GST_GL_API |
143 | void gst_gl_shader_set_uniform_matrix_4x2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value); |
144 | GST_GL_API |
145 | void gst_gl_shader_set_uniform_matrix_4x3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value); |
146 | |
147 | GST_GL_API |
148 | gint gst_gl_shader_get_attribute_location (GstGLShader *shader, const gchar *name); |
149 | GST_GL_API |
150 | void gst_gl_shader_bind_attribute_location (GstGLShader * shader, guint index, const gchar * name); |
151 | GST_GL_API |
152 | void gst_gl_shader_bind_frag_data_location (GstGLShader * shader, guint index, const gchar * name); |
153 | |
154 | G_END_DECLS |
155 | |
156 | #endif /* __GST_GL_SHADER_H__ */ |
157 | |