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_H__
22 #define __GST_GLSL_H__
23 
24 #include <gst/gl/gstgl_fwd.h>
25 
26 G_BEGIN_DECLS
27 
28 GST_GL_API
29 GQuark gst_glsl_error_quark (void);
30 
31 /**
32  * GST_GLSL_ERROR:
33  *
34  * Error domain for GStreamer's GLSL module. Errors in this domain will be
35  * from the #GstGLSLError enumeration
36  */
37 #define GST_GLSL_ERROR (gst_glsl_error_quark ())
38 
39 /**
40  * GstGLSLError:
41  * @GST_GLSL_ERROR_COMPILE: Compilation error occured
42  * @GST_GLSL_ERROR_LINK: Link error occured
43  * @GST_GLSL_ERROR_PROGRAM: General program error occured
44  *
45  * Compilation stage that caused an error
46  *
47  * Since: 1.8
48  */
49 typedef enum {
50   GST_GLSL_ERROR_COMPILE,
51   GST_GLSL_ERROR_LINK,
52   GST_GLSL_ERROR_PROGRAM,
53 } GstGLSLError;
54 
55 /**
56  * GstGLSLVersion:
57  * @GST_GLSL_VERSION_NONE: no version
58  * @GST_GLSL_VERSION_100: version 100 (only valid for ES)
59  * @GST_GLSL_VERSION_110: version 110 (only valid for compatibility desktop GL)
60  * @GST_GLSL_VERSION_120: version 120 (only valid for compatibility desktop GL)
61  * @GST_GLSL_VERSION_130: version 130 (only valid for compatibility desktop GL)
62  * @GST_GLSL_VERSION_140: version 140 (only valid for compatibility desktop GL)
63  * @GST_GLSL_VERSION_150: version 150 (valid for compatibility/core desktop GL)
64  * @GST_GLSL_VERSION_300: version 300 (only valid for ES)
65  * @GST_GLSL_VERSION_310: version 310 (only valid for ES)
66  * @GST_GLSL_VERSION_320: version 320 (only valid for ES)
67  * @GST_GLSL_VERSION_330: version 330 (valid for compatibility/core desktop GL)
68  * @GST_GLSL_VERSION_400: version 400 (valid for compatibility/core desktop GL)
69  * @GST_GLSL_VERSION_410: version 410 (valid for compatibility/core desktop GL)
70  * @GST_GLSL_VERSION_420: version 420 (valid for compatibility/core desktop GL)
71  * @GST_GLSL_VERSION_430: version 430 (valid for compatibility/core desktop GL)
72  * @GST_GLSL_VERSION_440: version 440 (valid for compatibility/core desktop GL)
73  * @GST_GLSL_VERSION_450: version 450 (valid for compatibility/core desktop GL)
74  *
75  * GLSL version list
76  *
77  * Since: 1.8
78  */
79 typedef enum
80 {
81   GST_GLSL_VERSION_NONE = 0,
82 
83   GST_GLSL_VERSION_100 = 100, /* ES */
84   GST_GLSL_VERSION_110 = 110, /* GL */
85   GST_GLSL_VERSION_120 = 120, /* GL */
86   GST_GLSL_VERSION_130 = 130, /* GL */
87   GST_GLSL_VERSION_140 = 140, /* GL */
88   GST_GLSL_VERSION_150 = 150, /* GL */
89   GST_GLSL_VERSION_300 = 300, /* ES */
90   GST_GLSL_VERSION_310 = 310, /* ES */
91   GST_GLSL_VERSION_320 = 320, /* ES */
92   GST_GLSL_VERSION_330 = 330, /* GL */
93   GST_GLSL_VERSION_400 = 400, /* GL */
94   GST_GLSL_VERSION_410 = 410, /* GL */
95   GST_GLSL_VERSION_420 = 420, /* GL */
96   GST_GLSL_VERSION_430 = 430, /* GL */
97   GST_GLSL_VERSION_440 = 440, /* GL */
98   GST_GLSL_VERSION_450 = 450, /* GL */
99 } GstGLSLVersion;
100 
101 /**
102  * GstGLSLProfile:
103  * @GST_GLSL_PROFILE_NONE: no profile supported/available
104  * @GST_GLSL_PROFILE_ES: OpenGL|ES profile
105  * @GST_GLSL_PROFILE_CORE: OpenGL core profile
106  * @GST_GLSL_PROFILE_COMPATIBILITY: OpenGL compatibility profile
107  * @GST_GLSL_PROFILE_ANY: any OpenGL/OpenGL|ES profile
108  *
109  * GLSL profiles
110  *
111  * Since: 1.8
112  */
113 /* FIXME: For GST_GLSL_PROFILE_ANY ~0 -> 0xffffffff see
114  * https://bugzilla.gnome.org/show_bug.cgi?id=732633
115 */
116 typedef enum
117 {
118   /* XXX: maybe make GstGLAPI instead */
119   GST_GLSL_PROFILE_NONE = 0,
120 
121   GST_GLSL_PROFILE_ES = (1 << 0),
122   GST_GLSL_PROFILE_CORE = (1 << 1),
123   GST_GLSL_PROFILE_COMPATIBILITY = (1 << 2),
124 
125   GST_GLSL_PROFILE_ANY = (gint) (0xffffffff),
126 } GstGLSLProfile;
127 
128 GST_GL_API
129 GstGLSLVersion gst_glsl_version_from_string         (const gchar * string);
130 GST_GL_API
131 const gchar *  gst_glsl_version_to_string           (GstGLSLVersion version);
132 
133 GST_GL_API
134 GstGLSLProfile gst_glsl_profile_from_string         (const gchar * string);
135 GST_GL_API
136 const gchar *  gst_glsl_profile_to_string           (GstGLSLProfile profile);
137 
138 GST_GL_API
139 gchar *        gst_glsl_version_profile_to_string   (GstGLSLVersion version,
140                                                      GstGLSLProfile profile);
141 GST_GL_API
142 gboolean       gst_glsl_version_profile_from_string (const gchar * string,
143                                                      GstGLSLVersion * version_ret,
144                                                      GstGLSLProfile * profile_ret);
145 
146 GST_GL_API
147 gboolean       gst_glsl_string_get_version_profile  (const gchar *s,
148                                                      GstGLSLVersion * version,
149                                                      GstGLSLProfile * profile);
150 
151 GST_GL_API
152 GstGLSLVersion gst_gl_version_to_glsl_version       (GstGLAPI gl_api, gint maj, gint min);
153 GST_GL_API
154 gboolean       gst_gl_context_supports_glsl_profile_version (GstGLContext * context,
155                                                              GstGLSLVersion version,
156                                                              GstGLSLProfile profile);
157 
158 GST_GL_API
159 gboolean       gst_gl_context_supports_precision        (GstGLContext * context,
160                                                          GstGLSLVersion version,
161                                                          GstGLSLProfile profile);
162 GST_GL_API
163 gboolean       gst_gl_context_supports_precision_highp  (GstGLContext * context,
164                                                          GstGLSLVersion version,
165                                                          GstGLSLProfile profile);
166 
167 G_END_DECLS
168 
169 #endif /* __GST_GLSL_H__ */
170