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
This commit is contained in:
Matthew Waters 2015-03-14 18:45:01 +00:00 committed by Tim-Philipp Müller
parent a4287991ae
commit 420cdf9cf6

View file

@ -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);