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
27G_BEGIN_DECLS
28
29GST_GL_API
30GType 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
39struct _GstGLShader
40{
41 GstObject parent;
42
43 GstGLContext *context;
44
45 /*< private >*/
46 GstGLShaderPrivate *priv;
47
48 gpointer _padding[GST_PADDING];
49};
50
51struct _GstGLShaderClass {
52 /*< private >*/
53 GstObjectClass parent_class;
54};
55
56GST_GL_API
57GstGLShader * gst_gl_shader_new (GstGLContext *context);
58GST_GL_API
59GstGLShader * gst_gl_shader_new_with_stages (GstGLContext * context, GError ** error, ...);
60GST_GL_API
61GstGLShader * gst_gl_shader_new_link_with_stages (GstGLContext * context, GError ** error, ...);
62GST_GL_API
63GstGLShader * gst_gl_shader_new_default (GstGLContext * context, GError ** error);
64
65GST_GL_API
66gboolean gst_gl_shader_attach (GstGLShader * shader, GstGLSLStage * stage);
67GST_GL_API
68gboolean gst_gl_shader_attach_unlocked (GstGLShader * shader, GstGLSLStage * stage);
69
70GST_GL_API
71void gst_gl_shader_detach (GstGLShader * shader, GstGLSLStage * stage);
72GST_GL_API
73void gst_gl_shader_detach_unlocked (GstGLShader * shader, GstGLSLStage * stage);
74
75GST_GL_API
76gboolean gst_gl_shader_compile_attach_stage (GstGLShader * shader,
77 GstGLSLStage *stage,
78 GError ** error);
79GST_GL_API
80gboolean gst_gl_shader_link (GstGLShader * shader, GError ** error);
81GST_GL_API
82gboolean gst_gl_shader_is_linked (GstGLShader *shader);
83
84GST_GL_API
85int gst_gl_shader_get_program_handle (GstGLShader * shader);
86
87GST_GL_API
88void gst_gl_shader_release (GstGLShader *shader);
89GST_GL_API
90void gst_gl_shader_release_unlocked (GstGLShader * shader);
91GST_GL_API
92void gst_gl_shader_use (GstGLShader *shader);
93GST_GL_API
94void gst_gl_context_clear_shader (GstGLContext *context);
95
96GST_GL_API
97void gst_gl_shader_set_uniform_1i (GstGLShader *shader, const gchar *name, gint value);
98GST_GL_API
99void gst_gl_shader_set_uniform_1iv (GstGLShader *shader, const gchar *name, guint count, const gint *value);
100GST_GL_API
101void gst_gl_shader_set_uniform_1f (GstGLShader *shader, const gchar *name, gfloat value);
102GST_GL_API
103void gst_gl_shader_set_uniform_1fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value);
104GST_GL_API
105void gst_gl_shader_set_uniform_2i (GstGLShader *shader, const gchar *name, gint v0, gint v1);
106GST_GL_API
107void gst_gl_shader_set_uniform_2iv (GstGLShader *shader, const gchar *name, guint count, const gint *value);
108GST_GL_API
109void gst_gl_shader_set_uniform_2f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1);
110GST_GL_API
111void gst_gl_shader_set_uniform_2fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value);
112GST_GL_API
113void gst_gl_shader_set_uniform_3i (GstGLShader *shader, const gchar *name, gint v0, gint v1, gint v2);
114GST_GL_API
115void gst_gl_shader_set_uniform_3iv (GstGLShader *shader, const gchar *name, guint count, const gint * value);
116GST_GL_API
117void gst_gl_shader_set_uniform_3f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1, gfloat v2);
118GST_GL_API
119void gst_gl_shader_set_uniform_3fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value);
120GST_GL_API
121void gst_gl_shader_set_uniform_4i (GstGLShader *shader, const gchar *name, gint v0, gint v1, gint v2, gint v3);
122GST_GL_API
123void gst_gl_shader_set_uniform_4iv (GstGLShader *shader, const gchar *name, guint count, const gint *value);
124GST_GL_API
125void gst_gl_shader_set_uniform_4f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1, gfloat v2, gfloat v3);
126GST_GL_API
127void gst_gl_shader_set_uniform_4fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value);
128GST_GL_API
129void gst_gl_shader_set_uniform_matrix_2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
130GST_GL_API
131void gst_gl_shader_set_uniform_matrix_3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
132GST_GL_API
133void gst_gl_shader_set_uniform_matrix_4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
134GST_GL_API
135void gst_gl_shader_set_uniform_matrix_2x3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
136GST_GL_API
137void gst_gl_shader_set_uniform_matrix_2x4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
138GST_GL_API
139void gst_gl_shader_set_uniform_matrix_3x2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
140GST_GL_API
141void gst_gl_shader_set_uniform_matrix_3x4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
142GST_GL_API
143void gst_gl_shader_set_uniform_matrix_4x2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
144GST_GL_API
145void gst_gl_shader_set_uniform_matrix_4x3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
146
147GST_GL_API
148gint gst_gl_shader_get_attribute_location (GstGLShader *shader, const gchar *name);
149GST_GL_API
150void gst_gl_shader_bind_attribute_location (GstGLShader * shader, guint index, const gchar * name);
151GST_GL_API
152void gst_gl_shader_bind_frag_data_location (GstGLShader * shader, guint index, const gchar * name);
153
154G_END_DECLS
155
156#endif /* __GST_GL_SHADER_H__ */
157

source code of include/gstreamer-1.0/gst/gl/gstglshader.h