summaryrefslogtreecommitdiff
path: root/gst-libs/gst/gl/gstglmemory.c
diff options
context:
space:
mode:
authorMatthew Waters <matthew@centricular.com>2015-03-14 18:45:01 +0000
committerMatthew Waters <matthew@centricular.com>2015-03-14 18:59:27 +0000
commit48f8b5b46bae70477a59f615bdb075f02b7b90ac (patch)
tree17061ab24682f1475fe3ee3909f71adfc42a609b /gst-libs/gst/gl/gstglmemory.c
parent187d4441eb9f662611a02ce6d889eea43b90199d (diff)
downloadgstreamer-plugins-bad-48f8b5b46bae70477a59f615bdb075f02b7b90ac.tar.gz
glmemory: fix the slight difference between EXT_rg and ARB_rg
GL_EXT_texture_rg doesn't take sized formats for the internalformat parameter of TexImage* but GL_ARB_texture_rg and GL(ES)3 do. https://bugzilla.gnome.org/show_bug.cgi?id=732507
Diffstat (limited to 'gst-libs/gst/gl/gstglmemory.c')
-rw-r--r--gst-libs/gst/gl/gstglmemory.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c
index e134d162a..397d216fb 100644
--- a/gst-libs/gst/gl/gstglmemory.c
+++ b/gst-libs/gst/gl/gstglmemory.c
@@ -224,7 +224,9 @@ gst_gl_texture_type_from_format (GstGLContext * context,
#else
gboolean texture_rg =
gst_gl_context_check_feature (context, "GL_EXT_texture_rg")
- || gst_gl_context_check_feature (context, "GL_ARB_texture_rg");
+ || gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0)
+ || gst_gl_context_check_feature (context, "GL_ARB_texture_rg")
+ || gst_gl_context_check_gl_version (context, GST_GL_API_OPENGL3, 3, 0);
#endif
guint n_plane_components;
@@ -295,8 +297,12 @@ gst_gl_texture_type_from_format (GstGLContext * context,
}
static inline GLenum
-_sized_gl_format_from_gl_format_type (GLenum format, GLenum type)
+_sized_gl_format_from_gl_format_type (GstGLContext * context, GLenum format,
+ GLenum type)
{
+ gboolean ext_texture_rg =
+ gst_gl_context_check_feature (context, "GL_EXT_texture_rg");
+
switch (format) {
case GL_RGBA:
switch (type) {
@@ -318,6 +324,8 @@ _sized_gl_format_from_gl_format_type (GLenum format, GLenum type)
case GL_RG:
switch (type) {
case GL_UNSIGNED_BYTE:
+ if (ext_texture_rg)
+ return GL_RG;
return GL_RG8;
break;
}
@@ -325,6 +333,8 @@ _sized_gl_format_from_gl_format_type (GLenum format, GLenum type)
case GL_RED:
switch (type) {
case GL_UNSIGNED_BYTE:
+ if (ext_texture_rg)
+ return GL_RED;
return GL_R8;
break;
}
@@ -389,7 +399,8 @@ _generate_texture (GstGLContext * context, GenTexture * data)
data->gl_format, data->gl_type, data->width, data->height);
internal_format =
- _sized_gl_format_from_gl_format_type (data->gl_format, data->gl_type);
+ _sized_gl_format_from_gl_format_type (context, data->gl_format,
+ data->gl_type);
gl->GenTextures (1, &data->result);
gl->BindTexture (data->gl_target, data->result);