1 /*
2  * GStreamer
3  * Copyright (C) 2015 Matthew Waters <matthew@centricular.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef __GST_GLSL_PRIVATE_H__
22 #define __GST_GLSL_PRIVATE_H__
23 
24 #include <gst/gl/gstgl_fwd.h>
25 #include <gst/gl/gstglfuncs.h>
26 
27 G_BEGIN_DECLS
28 
29 #ifndef GL_COMPILE_STATUS
30 #define GL_COMPILE_STATUS             0x8B81
31 #endif
32 #ifndef GLhandleARB
33 #define GLhandleARB GLuint
34 #endif
35 
36 typedef struct _GstGLSLFuncs
37 {
38   gboolean initialized;
39 
40   GLuint (GSTGLAPI *CreateProgram) (void);
41   void (GSTGLAPI *DeleteProgram) (GLuint program);
42   void (GSTGLAPI *UseProgram) (GLuint program);
43   void (GSTGLAPI *GetAttachedShaders) (GLuint program, GLsizei maxcount,
44       GLsizei * count, GLuint * shaders);
45 
46   GLuint (GSTGLAPI *CreateShader) (GLenum shaderType);
47   void (GSTGLAPI *DeleteShader) (GLuint shader);
48   void (GSTGLAPI *AttachShader) (GLuint program, GLuint shader);
49   void (GSTGLAPI *DetachShader) (GLuint program, GLuint shader);
50 
51   void (GSTGLAPI *GetShaderiv) (GLuint program, GLenum pname, GLint * params);
52   void (GSTGLAPI *GetProgramiv) (GLuint program, GLenum pname, GLint * params);
53   void (GSTGLAPI *GetShaderInfoLog) (GLuint shader, GLsizei maxLength,
54       GLsizei * length, char *log);
55   void (GSTGLAPI *GetProgramInfoLog) (GLuint shader, GLsizei maxLength,
56       GLsizei * length, char *log);
57 } GstGLSLFuncs;
58 
59 G_GNUC_INTERNAL gboolean _gst_glsl_funcs_fill (GstGLSLFuncs * vtable, GstGLContext * context);
60 G_GNUC_INTERNAL const gchar * _gst_glsl_shader_string_find_version (const gchar * str);
61 
62 G_GNUC_INTERNAL gchar *
63 _gst_glsl_mangle_shader (const gchar * str, guint shader_type, GstGLTextureTarget from,
64     GstGLTextureTarget to, GstGLContext * context, GstGLSLVersion * version, GstGLSLProfile * profile);
65 
66 G_END_DECLS
67 
68 #endif /* __GST_GLSL_PRIVATE_H__ */
69