mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-01 17:31:10 +00:00
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:
parent
187d4441eb
commit
48f8b5b46b
1 changed files with 14 additions and 3 deletions
|
@ -224,7 +224,9 @@ gst_gl_texture_type_from_format (GstGLContext * context,
|
||||||
#else
|
#else
|
||||||
gboolean texture_rg =
|
gboolean texture_rg =
|
||||||
gst_gl_context_check_feature (context, "GL_EXT_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
|
#endif
|
||||||
guint n_plane_components;
|
guint n_plane_components;
|
||||||
|
|
||||||
|
@ -295,8 +297,12 @@ gst_gl_texture_type_from_format (GstGLContext * context,
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline GLenum
|
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) {
|
switch (format) {
|
||||||
case GL_RGBA:
|
case GL_RGBA:
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -318,6 +324,8 @@ _sized_gl_format_from_gl_format_type (GLenum format, GLenum type)
|
||||||
case GL_RG:
|
case GL_RG:
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GL_UNSIGNED_BYTE:
|
case GL_UNSIGNED_BYTE:
|
||||||
|
if (ext_texture_rg)
|
||||||
|
return GL_RG;
|
||||||
return GL_RG8;
|
return GL_RG8;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -325,6 +333,8 @@ _sized_gl_format_from_gl_format_type (GLenum format, GLenum type)
|
||||||
case GL_RED:
|
case GL_RED:
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case GL_UNSIGNED_BYTE:
|
case GL_UNSIGNED_BYTE:
|
||||||
|
if (ext_texture_rg)
|
||||||
|
return GL_RED;
|
||||||
return GL_R8;
|
return GL_R8;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -389,7 +399,8 @@ _generate_texture (GstGLContext * context, GenTexture * data)
|
||||||
data->gl_format, data->gl_type, data->width, data->height);
|
data->gl_format, data->gl_type, data->width, data->height);
|
||||||
|
|
||||||
internal_format =
|
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->GenTextures (1, &data->result);
|
||||||
gl->BindTexture (data->gl_target, data->result);
|
gl->BindTexture (data->gl_target, data->result);
|
||||||
|
|
Loading…
Reference in a new issue