Commit 4a8b31af authored by Matthew Waters's avatar Matthew Waters 🐨 Committed by Tim-Philipp Müller

glfeature: remove GST_GL_API_GLES3

instead check the gl version using gst_gl_context_check_gl_version()
parent bfd8550b
......@@ -23,11 +23,11 @@
#include "../gstgleffects.h"
#define USING_OPENGL(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL)
#define USING_OPENGL3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL3)
#define USING_GLES(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES)
#define USING_GLES2(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2)
#define USING_GLES3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES3)
#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
static void
gst_gl_effects_identity_callback (gint width, gint height, guint texture,
......
......@@ -23,11 +23,11 @@
#include "../gstgleffects.h"
#define USING_OPENGL(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL)
#define USING_OPENGL3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL3)
#define USING_GLES(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES)
#define USING_GLES2(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2)
#define USING_GLES3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES3)
#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
static void
gst_gl_effects_mirror_callback (gint width, gint height, guint texture,
......
......@@ -23,11 +23,11 @@
#include "../gstgleffects.h"
#define USING_OPENGL(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL)
#define USING_OPENGL3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL3)
#define USING_GLES(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES)
#define USING_GLES2(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2)
#define USING_GLES3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES3)
#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
static void
gst_gl_effects_squeeze_callback (gint width, gint height, guint texture,
......
......@@ -101,11 +101,11 @@ GST_DEBUG_CATEGORY (gst_debug_glimage_sink);
#define GST_GLIMAGE_SINK_UNLOCK(glsink) \
(g_mutex_unlock(&GST_GLIMAGE_SINK_GET_LOCK (glsink)))
#define USING_OPENGL(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL)
#define USING_OPENGL3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL3)
#define USING_GLES(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES)
#define USING_GLES2(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2)
#define USING_GLES3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES3)
#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
#if GST_GL_HAVE_GLES2
static void gst_glimage_sink_thread_init_redisplay (GstGLImageSink * gl_sink);
......
......@@ -42,8 +42,10 @@
/* These are the core GL functions which we assume will always be
available */
GST_GL_EXT_BEGIN (core,
0, 0,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES1 | GST_GL_API_GLES2,
1, 0,
1, 0,
"\0",
"\0")
GST_GL_EXT_FUNCTION (void, BindTexture,
......@@ -178,8 +180,10 @@ GST_GL_EXT_FUNCTION (void, LineWidth, (GLfloat width))
GST_GL_EXT_FUNCTION (void, PolygonOffset, (GLfloat factor, GLfloat units))
GST_GL_EXT_END ()
GST_GL_EXT_BEGIN (texture_3d, 1, 2,
0, /* not in either GLES */
GST_GL_EXT_BEGIN (texture_3d,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3,
1, 2,
255, 255, /* not in either GLES */
"OES\0",
"texture_3D\0")
GST_GL_EXT_FUNCTION (void, TexImage3D,
......@@ -199,9 +203,10 @@ GST_GL_EXT_FUNCTION (void, TexSubImage3D,
GST_GL_EXT_END ()
GST_GL_EXT_BEGIN (only_in_both_gles_and_gl_1_3,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES1 | GST_GL_API_GLES2,
1, 3,
GST_GL_API_GLES1 |
GST_GL_API_GLES2,
1, 0,
"\0",
"\0")
GST_GL_EXT_FUNCTION (void, CompressedTexImage2D,
......@@ -228,18 +233,21 @@ GST_GL_EXT_FUNCTION (void, SampleCoverage,
GST_GL_EXT_END ()
GST_GL_EXT_BEGIN (only_in_both_gles_and_gl_1_5,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES1 | GST_GL_API_GLES2,
1, 5,
GST_GL_API_GLES1 |
GST_GL_API_GLES2,
1, 0,
"\0",
"\0")
GST_GL_EXT_FUNCTION (void, GetBufferParameteriv,
(GLenum target, GLenum pname, GLint* params))
GST_GL_EXT_END ()
GST_GL_EXT_BEGIN (vbos, 1, 5,
GST_GL_API_GLES1 |
GST_GL_API_GLES2,
GST_GL_EXT_BEGIN (vbos,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES1 | GST_GL_API_GLES2,
1, 5,
1, 0,
"ARB\0",
"vertex_buffer_object\0")
GST_GL_EXT_FUNCTION (void, GenBuffers,
......@@ -267,11 +275,13 @@ GST_GL_EXT_END ()
/* Available in GL 1.3, the multitexture extension or GLES. These are
required */
GST_GL_EXT_BEGIN (multitexture_part0, 1, 3,
GST_GL_API_GLES1 |
GST_GL_API_GLES2,
"ARB\0",
"multitexture\0")
GST_GL_EXT_BEGIN (multitexture_part0,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES1 | GST_GL_API_GLES2,
1, 3,
1, 0,
"ARB\0",
"multitexture\0")
GST_GL_EXT_FUNCTION (void, ActiveTexture,
(GLenum texture))
GST_GL_EXT_END ()
......@@ -279,10 +289,12 @@ GST_GL_EXT_END ()
/* GLES doesn't support mapping buffers in core so this has to be a
separate check */
GST_GL_EXT_BEGIN (map_vbos, 1, 5,
0, /* not in GLES core */
"ARB\0OES\0",
"vertex_buffer_object\0mapbuffer\0")
GST_GL_EXT_BEGIN (map_vbos,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3,
1, 5,
255, 255, /* not in GLES core */
"ARB\0OES\0",
"vertex_buffer_object\0mapbuffer\0")
GST_GL_EXT_FUNCTION (void *, MapBuffer,
(GLenum target,
GLenum access))
......@@ -291,8 +303,10 @@ GST_GL_EXT_FUNCTION (GLboolean, UnmapBuffer,
GST_GL_EXT_END ()
GST_GL_EXT_BEGIN (gl3,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES2,
3, 1,
GST_GL_API_GLES3,
3, 0,
"\0",
"\0")
GST_GL_EXT_FUNCTION (const GLubyte*, GetStringi,
......
......@@ -38,8 +38,11 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
GST_GL_EXT_BEGIN (blending, 1, 2,
GST_GL_EXT_BEGIN (blending,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES2,
1, 2,
2, 0,
"\0",
"\0")
GST_GL_EXT_FUNCTION (void, BlendEquation,
......@@ -52,8 +55,11 @@ GST_GL_EXT_FUNCTION (void, BlendColor,
GST_GL_EXT_END ()
/* Optional, declared in 1.4 or GLES 1.2 */
GST_GL_EXT_BEGIN (blend_func_separate, 1, 4,
GST_GL_EXT_BEGIN (blend_func_separate,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES2,
1, 4,
2, 0,
"EXT\0",
"blend_func_separate\0")
GST_GL_EXT_FUNCTION (void, BlendFuncSeparate,
......@@ -64,8 +70,11 @@ GST_GL_EXT_FUNCTION (void, BlendFuncSeparate,
GST_GL_EXT_END ()
/* Optional, declared in 2.0 */
GST_GL_EXT_BEGIN (blend_equation_separate, 2, 0,
GST_GL_EXT_BEGIN (blend_equation_separate,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES2,
2, 0,
2, 0,
"EXT\0",
"blend_equation_separate\0")
GST_GL_EXT_FUNCTION (void, BlendEquationSeparate,
......@@ -75,8 +84,10 @@ GST_GL_EXT_END ()
/* GL and GLES 2.0 apis */
GST_GL_EXT_BEGIN (two_point_zero_api,
2, 0,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES2,
2, 0,
2, 0,
"\0",
"\0")
GST_GL_EXT_FUNCTION (void, StencilFuncSeparate,
......
......@@ -38,8 +38,10 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
GST_GL_EXT_BEGIN (EGL_image, 255, 255,
0, /* not in either GLES */
GST_GL_EXT_BEGIN (EGL_image,
GST_GL_API_NONE,
255, 255,
255, 255, /* not in either GLES */
"OES\0",
"EGL_image\0")
GST_GL_EXT_FUNCTION (void, EGLImageTargetTexture2D,
......
......@@ -39,8 +39,10 @@
*/
GST_GL_EXT_BEGIN (offscreen,
3, 0,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES2,
3, 0,
2, 0,
/* for some reason the ARB version of this
extension doesn't have an ARB suffix for the
functions */
......@@ -99,8 +101,10 @@ GST_GL_EXT_FUNCTION (GLboolean, IsFramebuffer,
(GLuint framebuffer))
GST_GL_EXT_END ()
GST_GL_EXT_BEGIN (offscreen_blit, 255, 255,
0, /* not in either GLES */
GST_GL_EXT_BEGIN (offscreen_blit,
GST_GL_API_NONE,
255, 255,
255, 255, /* not in either GLES */
"EXT\0ANGLE\0",
"framebuffer_blit\0")
GST_GL_EXT_FUNCTION (void, BlitFramebuffer,
......@@ -116,8 +120,10 @@ GST_GL_EXT_FUNCTION (void, BlitFramebuffer,
GLenum filter))
GST_GL_EXT_END ()
GST_GL_EXT_BEGIN (framebuffer_discard, 255, 255,
0, /* not in either GLES */
GST_GL_EXT_BEGIN (framebuffer_discard,
GST_GL_API_NONE,
255, 255,
255, 255, /* not in either GLES */
"EXT\0",
"framebuffer_discard\0")
GST_GL_EXT_FUNCTION (void, DiscardFramebuffer,
......@@ -127,16 +133,22 @@ GST_GL_EXT_FUNCTION (void, DiscardFramebuffer,
GST_GL_EXT_END ()
GST_GL_EXT_BEGIN (read_buffer, 1, 0,
GST_GL_API_GLES3,
GST_GL_EXT_BEGIN (read_buffer,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES2,
1, 0,
3, 0,
"NV\0",
"read_buffer\0")
GST_GL_EXT_FUNCTION (void, ReadBuffer,
(GLenum mode))
GST_GL_EXT_END ()
GST_GL_EXT_BEGIN (draw_buffers, 2, 1,
GST_GL_API_GLES3,
GST_GL_EXT_BEGIN (draw_buffers,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES2,
2, 1,
3, 0,
"ARB\0ATI\0NV\0",
"draw_buffers\0")
GST_GL_EXT_FUNCTION (void, DrawBuffers,
......
......@@ -38,8 +38,11 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
GST_GL_EXT_BEGIN (multitexture_part1, 1, 3,
GST_GL_EXT_BEGIN (multitexture_part1,
GST_GL_API_OPENGL |
GST_GL_API_GLES1,
1, 3,
1, 0,
"ARB\0",
"multitexture\0")
GST_GL_EXT_FUNCTION (void, ClientActiveTexture,
......@@ -49,8 +52,10 @@ GST_GL_EXT_END ()
/* These are the core GL functions which are available when the API
supports fixed-function (ie, GL and GLES1.1) */
GST_GL_EXT_BEGIN (fixed_function_core,
0, 0,
GST_GL_API_OPENGL |
GST_GL_API_GLES1,
0, 0,
1, 0,
"\0",
"\0")
GST_GL_EXT_FUNCTION (void, AlphaFunc,
......@@ -106,8 +111,9 @@ GST_GL_EXT_END ()
/* Eventually we want to remove this category */
GST_GL_EXT_BEGIN (fixed_function_gl_only,
GST_GL_API_OPENGL,
0, 0,
0, 0,
0,
"\0",
"\0")
GST_GL_EXT_FUNCTION (void, PushAttrib,
......
......@@ -39,9 +39,10 @@
*/
GST_GL_EXT_BEGIN (only_in_both_gles,
255, 255,
GST_GL_API_GLES1 |
GST_GL_API_GLES2,
255, 255,
1, 0,
"\0",
"\0")
GST_GL_EXT_FUNCTION (void, DepthRangef,
......@@ -51,16 +52,18 @@ GST_GL_EXT_FUNCTION (void, ClearDepthf,
GST_GL_EXT_END ()
GST_GL_EXT_BEGIN (only_in_gles1,
255, 255,
GST_GL_API_GLES1,
255, 255,
1, 0,
"\0",
"\0")
GST_GL_EXT_FUNCTION (void, ClipPlanef, (GLenum plane, const GLfloat *equation))
GST_GL_EXT_END ()
GST_GL_EXT_BEGIN (gles2_only_api,
255, 255,
GST_GL_API_GLES2,
255, 255,
2, 0,
"\0",
"\0")
GST_GL_EXT_FUNCTION (void, ReleaseShaderCompiler, (void))
......@@ -77,8 +80,10 @@ GST_GL_EXT_FUNCTION (void, ShaderBinary,
GLsizei length))
GST_GL_EXT_END ()
GST_GL_EXT_BEGIN (IMG_multisampled_render_to_texture, 255, 255,
0, /* not in either GLES */
GST_GL_EXT_BEGIN (IMG_multisampled_render_to_texture,
GST_GL_API_NONE,
255, 255,
255, 255, /* not in either GLES */
"\0",
"IMG_multisampled_render_to_texture\0")
GST_GL_EXT_FUNCTION (void, RenderbufferStorageMultisampleIMG,
......
......@@ -41,8 +41,9 @@
/* These are the core GL functions which are only available in big
GL */
GST_GL_EXT_BEGIN (only_in_big_gl,
0, 0,
0, /* not in GLES */
GST_GL_API_OPENGL | GST_GL_API_OPENGL3,
1, 0,
255, 255, /* not in GLES */
"\0",
"\0")
GST_GL_EXT_FUNCTION (void, GetTexLevelParameteriv,
......@@ -52,10 +53,18 @@ GST_GL_EXT_FUNCTION (void, GetTexImage,
(GLenum target, GLint level,
GLenum format, GLenum type,
GLvoid *pixels))
GST_GL_EXT_FUNCTION (void, ClipPlane,
(GLenum plane, const double *equation))
GST_GL_EXT_FUNCTION (void, DepthRange,
(double near_val, double far_val))
GST_GL_EXT_FUNCTION (void, DrawBuffer,
(GLenum mode))
GST_GL_EXT_END ()
GST_GL_EXT_BEGIN (only_in_big_gl_compat,
GST_GL_API_OPENGL,
1, 0,
255, 255, /* not in GLES */
"\0",
"\0")
GST_GL_EXT_FUNCTION (void, ClipPlane,
(GLenum plane, const double *equation))
GST_GL_EXT_END ()
......@@ -40,8 +40,11 @@
/* This lists functions that are unique to GL 2.0 or GLES 2.0 and are
* not in the old GLSL extensions */
GST_GL_EXT_BEGIN (shaders_glsl_2_only, 2, 0,
GST_GL_EXT_BEGIN (shaders_glsl_2_only,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES2,
2, 0,
2, 0,
"\0",
"\0")
GST_GL_EXT_FUNCTION (GLuint, CreateProgram,
......@@ -90,8 +93,11 @@ GST_GL_EXT_END ()
/* These functions are provided by GL_ARB_shader_objects or are in GL
* 2.0 core */
GST_GL_EXT_BEGIN (shader_objects_or_gl2, 2, 0,
GST_GL_EXT_BEGIN (shader_objects_or_gl2,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES2,
2, 0,
2, 0,
"ARB\0",
"shader_objects\0")
GST_GL_EXT_FUNCTION (void, ShaderSource,
......@@ -216,8 +222,11 @@ GST_GL_EXT_END ()
/* These functions are provided by GL_ARB_vertex_shader or are in GL
* 2.0 core */
GST_GL_EXT_BEGIN (vertex_shaders, 2, 0,
GST_GL_EXT_BEGIN (vertex_shaders,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES2,
2, 0,
2, 0,
"ARB\0",
"vertex_shader\0")
GST_GL_EXT_FUNCTION (void, VertexAttribPointer,
......@@ -270,8 +279,10 @@ GST_GL_EXT_END ()
/* These only list functions that come from the old GLSL extensions.
* Functions that are common to the extensions and GLSL 2.0 should
* instead be listed in cogl-glsl-functions.h */
GST_GL_EXT_BEGIN (shader_objects, 255, 255,
0, /* not in either GLES */
GST_GL_EXT_BEGIN (shader_objects,
GST_GL_API_NONE,
255, 255,
255, 255, /* not in either GLES */
"ARB\0",
"shader_objects\0")
GST_GL_EXT_FUNCTION (GLuint, CreateProgramObject,
......@@ -303,8 +314,10 @@ GST_GL_EXT_FUNCTION (void, GetAttachedObjects,
GST_GL_EXT_END ()
/* ARB_fragment_program */
GST_GL_EXT_BEGIN (arbfp, 255, 255,
0, /* not in either GLES */
GST_GL_EXT_BEGIN (arbfp,
GST_GL_API_NONE,
255, 255,
255, 255, /* not in either GLES */
"ARB\0",
"fragment_program\0")
GST_GL_EXT_FUNCTION (void, GenPrograms,
......@@ -329,8 +342,11 @@ GST_GL_EXT_END ()
/* This lists functions that are unique to GL 2.1 or GLES 3.0 and are
* not in the old GLSL extensions */
GST_GL_EXT_BEGIN (shaders_2_1, 2, 1,
GST_GL_API_GLES3,
GST_GL_EXT_BEGIN (shaders_2_1,
GST_GL_API_OPENGL | GST_GL_API_OPENGL3 |
GST_GL_API_GLES2,
2, 1,
3, 0,
"\0",
"\0")
GST_GL_EXT_FUNCTION (void, UniformMatrix2x3fv,
......
......@@ -68,13 +68,6 @@ gst_gl_api_to_string (GstGLAPI api)
str = g_string_new (GST_GL_API_GLES2_NAME);
}
}
if (api & GST_GL_API_GLES3) {
if (str) {
g_string_append (str, " " GST_GL_API_GLES3_NAME);
} else {
str = g_string_new (GST_GL_API_GLES3_NAME);
}
}
out:
if (!str)
......@@ -117,9 +110,6 @@ gst_gl_api_from_string (const gchar * apis_s)
} else if (g_strstr_len (apis, 5, GST_GL_API_GLES2_NAME)) {
ret |= GST_GL_API_GLES2;
apis = &apis[5];
} else if (g_strstr_len (apis, 5, GST_GL_API_GLES3_NAME)) {
ret |= GST_GL_API_GLES3;
apis = &apis[5];
} else {
GST_ERROR ("Error parsing \'%s\'", apis);
break;
......
......@@ -97,7 +97,6 @@ typedef enum {
GST_GL_API_OPENGL3 = (1 << 1),
GST_GL_API_GLES1 = (1 << 15),
GST_GL_API_GLES2 = (1 << 16),
GST_GL_API_GLES3 = (1 << 17),
GST_GL_API_ANY = G_MAXUINT32
} GstGLAPI;
......@@ -106,7 +105,6 @@ typedef enum {
#define GST_GL_API_OPENGL3_NAME "opengl3"
#define GST_GL_API_GLES1_NAME "gles1"
#define GST_GL_API_GLES2_NAME "gles2"
#define GST_GL_API_GLES3_NAME "gles3"
typedef enum
{
......@@ -120,7 +118,8 @@ typedef enum
GST_GL_PLATFORM_ANY = G_MAXUINT32
} GstGLPlatform;
#define GST_GL_EXT_BEGIN(name, min_gl, maj_gl, in_gles, ext_suf, ext_name)
#define GST_GL_EXT_BEGIN(name, gl_availability, min_gl, maj_gl, gles_maj, \
gles_min, ext_suf, ext_name)
#define GST_GL_EXT_FUNCTION(ret, name, args) \
ret GSTGLAPI (*name) args;
#define GST_GL_EXT_END()
......
......@@ -41,11 +41,11 @@
* gst_gl_color_convert_set_texture_scaling().
*/
#define USING_OPENGL(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL)
#define USING_OPENGL3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL3)
#define USING_GLES(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES)
#define USING_GLES2(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2)
#define USING_GLES3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES3)
#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
static void _do_convert (GstGLContext * context, GstGLColorConvert * convert);
static gboolean _init_convert (GstGLColorConvert * convert);
......
......@@ -37,11 +37,11 @@
* A #GstGLDownload can be created with gst_gl_download_new()
*/
#define USING_OPENGL(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL)
#define USING_OPENGL3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL3)
#define USING_GLES(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES)
#define USING_GLES2(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2)
#define USING_GLES3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES3)
#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
static gboolean _do_download (GstGLDownload * download, guint texture_id,
gpointer data[GST_VIDEO_MAX_PLANES]);
......
......@@ -54,8 +54,9 @@ gst_gl_check_extension (const char *name, const gchar * ext)
/* Define a set of arrays containing the functions required from GL
for each feature */
#define GST_GL_EXT_BEGIN(name, \
gl_availability, \
min_gl_major, min_gl_minor, \
gles_availability, \
min_gles_major, min_gles_minor, \
namespaces, extension_names) \
static const GstGLFeatureFunction gst_gl_ext_ ## name ## _funcs[] = {
#define GST_GL_EXT_FUNCTION(ret, name, args) \
......@@ -66,16 +67,18 @@ gst_gl_check_extension (const char *name, const gchar * ext)
#include "glprototypes/all_functions.h"
#undef GST_GL_EXT_BEGIN
#undef GST_GL_EXT_FUNCTION
#undef GST_GL_EXT_END
#define GST_GL_EXT_BEGIN(name, \
gl_availability, \
min_gl_major, min_gl_minor, \
gles_availability, \
min_gles_major, min_gles_minor, \
namespaces, extension_names) \
{ min_gl_major, min_gl_minor, gles_availability, namespaces, \
extension_names, \
{ G_STRINGIFY (name), gl_availability, min_gl_major, min_gl_minor, min_gles_major, \
min_gles_minor, namespaces, extension_names, \
gst_gl_ext_ ## name ## _funcs },
#undef GST_GL_EXT_FUNCTION
#define GST_GL_EXT_FUNCTION(ret, name, args)
#undef GST_GL_EXT_END
#define GST_GL_EXT_END()
static const GstGLFeatureData gst_gl_feature_ext_functions_data[] = {
......@@ -149,15 +152,25 @@ _gst_gl_feature_check (GstGLContext * context,
const char *suffix = NULL;
int func_num;
GstGLFuncs *gst_gl = context->gl_vtable;
guint gl_min = 0, gl_maj = 0;
GstGLAPI gl_api = gst_gl_context_get_gl_api (context);
if (gl_api & (GST_GL_API_OPENGL | GST_GL_API_OPENGL3)) {
gl_maj = data->min_gl_major;
gl_min = data->min_gl_minor;
} else if (gl_api & (GST_GL_API_GLES1 | GST_GL_API_GLES2)) {
gl_maj = data->min_gles_major;
gl_min = data->min_gles_minor;
}
GST_DEBUG ("%s, 0x%x, %d.%d vs 0x%x, %d.%d", data->feature_name,
data->gl_availability, gl_maj, gl_min,
gst_gl_context_get_gl_api (context), gl_major, gl_minor);
/* First check whether the functions should be directly provided by
GL */
if (((gl_api & GST_GL_API_OPENGL) &&
GST_GL_CHECK_GL_VERSION (gl_major, gl_minor,
data->min_gl_major, data->min_gl_minor)) ||
((gl_api & GST_GL_API_GLES2) &&
(data->gl_availability & GST_GL_API_GLES2))) {
if (gst_gl_context_check_gl_version (context, data->gl_availability, gl_maj,
gl_min)) {
in_core = TRUE;
suffix = "";
} else {
......@@ -217,6 +230,7 @@ _gst_gl_feature_check (GstGLContext * context,
* then set all of the functions pointers to NULL so we can safely
* do feature testing by just looking at the function pointers */
error:
GST_DEBUG ("failed to find feature %s", data->feature_name);
for (func_num = 0; data->functions[func_num].name; func_num++) {
*(void **) ((guint8 *) gst_gl +
......@@ -224,7 +238,7 @@ error:
}
if (full_function_name) {
GST_TRACE ("failed to find function %s", full_function_name);
GST_DEBUG ("failed to find function %s", full_function_name);
g_free (full_function_name);
}
......
......@@ -68,13 +68,19 @@ typedef struct _GstGLFeatureData GstGLFeatureData;
struct _GstGLFeatureData
{
/* A minimum GL version which the functions should be defined in
without needing an extension. Set to 255,255 if it's only
provided in an extension */
int min_gl_major, min_gl_minor;
/* name of the feature */
const char *feature_name;
/* Flags specifying which versions of GL the feature is available
in core in */
GstGLAPI gl_availability;
/* A minimum GL version which the functions should be defined in
without needing an extension. Set to 255, 255 if it's only
provided in an extension */
int min_gl_major, min_gl_minor;
/* A minimum GLES version which the functions should be defined in
without needing an extension. Set to 255, 255 if it's only
provided in an extension */
int min_gles_major, min_gles_minor;
/* \0 separated list of namespaces to try. Eg "EXT\0ARB\0" */
const char *namespaces;
/* \0 separated list of required extension names without the GL_EXT
......
......@@ -42,11 +42,11 @@
* Data is uploaded or downloaded from the GPU as is necessary.
*/
#define USING_OPENGL(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL)
#define USING_OPENGL3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL3)
#define USING_GLES(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES)
#define USING_GLES2(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2)
#define USING_GLES3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES3)
#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_MEMORY);
#define GST_CAT_DEFUALT GST_CAT_GL_MEMORY
......@@ -438,7 +438,7 @@ _calculate_unpack_length (GstGLMemory * gl_mem)
#if GST_GL_HAVE_OPENGL || GST_GL_HAVE_GLES3
if (USING_OPENGL (gl_mem->context) || USING_GLES3 (gl_mem->context)) {
gl_mem->unpack_length = gl_mem->stride / n_gl_bytes;
}
} else
#endif
#if GST_GL_HAVE_GLES2
if (USING_GLES2 (gl_mem->context)) {
......
......@@ -59,11 +59,11 @@ static const gchar *simple_fragment_shader_str_gles2 =
#define GST_GL_SHADER_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), GST_GL_TYPE_SHADER, GstGLShaderPrivate))
#define USING_OPENGL(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL)
#define USING_OPENGL3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_OPENGL3)
#define USING_GLES(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES)
#define USING_GLES2(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES2)
#define USING_GLES3(context) (gst_gl_context_get_gl_api (context) & GST_GL_API_GLES3)
#define USING_OPENGL(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL, 1, 0))
#define USING_OPENGL3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 1))
#define USING_GLES(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES, 1, 0))
#define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
#define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))