2011-11-18 16:27:45 +00:00
|
|
|
/*
|
2008-07-18 08:49:34 +00:00
|
|
|
* GStreamer
|
|
|
|
* Copyright (C) 2008 Filippo Argiolas <filippo.argiolas@gmail.com>
|
2014-04-30 14:20:23 +00:00
|
|
|
* Copyright (C) 2014 Julien Isorce <julien.isorce@collabora.co.uk>
|
2008-07-18 08:49:34 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library 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
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-08 11:53:56 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2008-07-18 08:49:34 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_GL_SHADER_H__
|
|
|
|
#define __GST_GL_SHADER_H__
|
|
|
|
|
2013-07-11 09:03:31 +00:00
|
|
|
#include <gst/gl/gstgl_fwd.h>
|
2008-07-18 08:49:34 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
GType gst_gl_shader_get_type (void);
|
2016-10-05 01:19:12 +00:00
|
|
|
#define GST_TYPE_GL_SHADER (gst_gl_shader_get_type())
|
|
|
|
|
|
|
|
/* FIXME: remove this when moving to -base */
|
2017-03-04 09:15:58 +00:00
|
|
|
#ifndef GST_DISABLE_DEPRECATED
|
2017-03-04 09:47:04 +00:00
|
|
|
#define GST_GL_TYPE_SHADER GST_TYPE_GL_SHADER
|
2017-03-04 09:15:58 +00:00
|
|
|
#endif
|
2016-10-05 01:19:12 +00:00
|
|
|
#define GST_GL_SHADER(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_TYPE_GL_SHADER, GstGLShader))
|
|
|
|
#define GST_GL_SHADER_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_TYPE_GL_SHADER, GstGLShaderClass))
|
|
|
|
#define GST_IS_GL_SHADER(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_TYPE_GL_SHADER))
|
|
|
|
#define GST_IS_GL_SHADER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_TYPE_GL_SHADER))
|
|
|
|
#define GST_GL_SHADER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_TYPE_GL_SHADER, GstGLShaderClass))
|
2008-07-18 08:49:34 +00:00
|
|
|
|
2016-09-28 05:20:25 +00:00
|
|
|
struct _GstGLShader
|
|
|
|
{
|
2014-05-08 05:30:49 +00:00
|
|
|
GstObject parent;
|
2012-12-06 07:40:26 +00:00
|
|
|
|
2013-09-15 04:23:43 +00:00
|
|
|
GstGLContext *context;
|
2012-12-06 07:40:26 +00:00
|
|
|
|
2016-09-28 05:20:25 +00:00
|
|
|
/*< private >*/
|
2008-07-18 08:49:34 +00:00
|
|
|
GstGLShaderPrivate *priv;
|
2015-09-04 06:02:32 +00:00
|
|
|
|
|
|
|
gpointer _padding[GST_PADDING];
|
2008-07-18 08:49:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GstGLShaderClass {
|
|
|
|
/*< private >*/
|
2014-05-08 05:30:49 +00:00
|
|
|
GstObjectClass parent_class;
|
2008-07-18 08:49:34 +00:00
|
|
|
};
|
|
|
|
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
GstGLShader * gst_gl_shader_new (GstGLContext *context);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
GstGLShader * gst_gl_shader_new_with_stages (GstGLContext * context, GError ** error, ...);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
GstGLShader * gst_gl_shader_new_link_with_stages (GstGLContext * context, GError ** error, ...);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
GstGLShader * gst_gl_shader_new_default (GstGLContext * context, GError ** error);
|
2008-07-18 08:49:34 +00:00
|
|
|
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
gboolean gst_gl_shader_attach (GstGLShader * shader, GstGLSLStage * stage);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
gboolean gst_gl_shader_attach_unlocked (GstGLShader * shader, GstGLSLStage * stage);
|
2014-07-07 08:51:28 +00:00
|
|
|
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
void gst_gl_shader_detach (GstGLShader * shader, GstGLSLStage * stage);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
void gst_gl_shader_detach_unlocked (GstGLShader * shader, GstGLSLStage * stage);
|
2008-07-18 08:49:34 +00:00
|
|
|
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
gboolean gst_gl_shader_compile_attach_stage (GstGLShader * shader,
|
|
|
|
GstGLSLStage *stage,
|
|
|
|
GError ** error);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
gboolean gst_gl_shader_link (GstGLShader * shader, GError ** error);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
gboolean gst_gl_shader_is_linked (GstGLShader *shader);
|
2014-10-21 08:30:38 +00:00
|
|
|
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
int gst_gl_shader_get_program_handle (GstGLShader * shader);
|
2012-12-06 07:40:26 +00:00
|
|
|
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
void gst_gl_shader_release (GstGLShader *shader);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
void gst_gl_shader_release_unlocked (GstGLShader * shader);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
void gst_gl_shader_use (GstGLShader *shader);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2015-09-04 06:02:32 +00:00
|
|
|
void gst_gl_context_clear_shader (GstGLContext *context);
|
2012-12-06 07:40:26 +00:00
|
|
|
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_1i (GstGLShader *shader, const gchar *name, gint value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2018-02-05 03:58:06 +00:00
|
|
|
void gst_gl_shader_set_uniform_1iv (GstGLShader *shader, const gchar *name, guint count, const gint *value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_1f (GstGLShader *shader, const gchar *name, gfloat value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2018-02-05 03:58:06 +00:00
|
|
|
void gst_gl_shader_set_uniform_1fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_2i (GstGLShader *shader, const gchar *name, gint v0, gint v1);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2018-02-05 03:58:06 +00:00
|
|
|
void gst_gl_shader_set_uniform_2iv (GstGLShader *shader, const gchar *name, guint count, const gint *value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_2f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2018-02-05 03:58:06 +00:00
|
|
|
void gst_gl_shader_set_uniform_2fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_3i (GstGLShader *shader, const gchar *name, gint v0, gint v1, gint v2);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2018-02-05 03:58:06 +00:00
|
|
|
void gst_gl_shader_set_uniform_3iv (GstGLShader *shader, const gchar *name, guint count, const gint * value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_3f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1, gfloat v2);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2018-02-05 03:58:06 +00:00
|
|
|
void gst_gl_shader_set_uniform_3fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_4i (GstGLShader *shader, const gchar *name, gint v0, gint v1, gint v2, gint v3);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2018-02-05 03:58:06 +00:00
|
|
|
void gst_gl_shader_set_uniform_4iv (GstGLShader *shader, const gchar *name, guint count, const gint *value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_4f (GstGLShader *shader, const gchar *name, gfloat v0, gfloat v1, gfloat v2, gfloat v3);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2018-02-05 03:58:06 +00:00
|
|
|
void gst_gl_shader_set_uniform_4fv (GstGLShader *shader, const gchar *name, guint count, const gfloat *value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_matrix_2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_matrix_3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_matrix_4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_matrix_2x3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_matrix_2x4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_matrix_3x2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_matrix_3x4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_matrix_4x2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_set_uniform_matrix_4x3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value);
|
2008-07-18 08:49:34 +00:00
|
|
|
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
gint gst_gl_shader_get_attribute_location (GstGLShader *shader, const gchar *name);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2012-12-06 07:40:26 +00:00
|
|
|
void gst_gl_shader_bind_attribute_location (GstGLShader * shader, guint index, const gchar * name);
|
2016-10-27 02:47:58 +00:00
|
|
|
GST_EXPORT
|
2016-03-31 08:25:32 +00:00
|
|
|
void gst_gl_shader_bind_frag_data_location (GstGLShader * shader, guint index, const gchar * name);
|
2008-09-06 22:45:34 +00:00
|
|
|
|
2008-07-18 08:49:34 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GST_GL_SHADER_H__ */
|