glformat: fix the usage of GST_GL_RGB565

GL_RGB565 is sized internal glformat, the corresponding glformat
should be GL_RGB and type is GL_UNSIGNED_SHORT_565. Otherwise will
return GL_INVALID_ENUM when creating texture.

https://bugzilla.gnome.org/show_bug.cgi?id=783066
This commit is contained in:
Haihua Hu 2017-05-25 11:05:47 +08:00 committed by Sebastian Dröge
parent 405d059a22
commit c2b2c68bea
4 changed files with 13 additions and 5 deletions

View file

@ -234,7 +234,7 @@ gst_gl_sized_gl_format_from_gl_format_type (GstGLContext * context,
&& !USING_GLES3 (context) ? GST_GL_RGB : GST_GL_RGB8;
break;
case GL_UNSIGNED_SHORT_5_6_5:
return GST_GL_RGB;
return GST_GL_RGB565;
break;
}
break;

View file

@ -245,8 +245,10 @@ _gl_tex_create (GstGLMemory * gl_mem, GError ** error)
tex_format = gl_mem->tex_format;
tex_type = GL_UNSIGNED_BYTE;
if (gl_mem->tex_format == GST_GL_RGB565)
if (gl_mem->tex_format == GST_GL_RGB565) {
tex_format = GST_GL_RGB;
tex_type = GL_UNSIGNED_SHORT_5_6_5;
}
internal_format =
gst_gl_sized_gl_format_from_gl_format_type (context, tex_format,
@ -779,8 +781,10 @@ _gl_tex_copy_thread (GstGLContext * context, gpointer data)
out_tex_target = gst_gl_texture_target_to_gl (copy_params->tex_target);
out_gl_format = copy_params->src->tex_format;
out_gl_type = GL_UNSIGNED_BYTE;
if (copy_params->out_format == GST_GL_RGB565)
if (copy_params->out_format == GST_GL_RGB565) {
out_gl_format = GST_GL_RGB;
out_gl_type = GL_UNSIGNED_SHORT_5_6_5;
}
internal_format =
gst_gl_sized_gl_format_from_gl_format_type (context, out_gl_format,

View file

@ -419,8 +419,10 @@ _gl_mem_copy_thread (GstGLContext * context, gpointer data)
gl = context->gl_vtable;
out_gl_format = copy_params->out_format;
out_gl_type = GL_UNSIGNED_BYTE;
if (copy_params->out_format == GST_GL_RGB565)
if (copy_params->out_format == GST_GL_RGB565) {
out_gl_format = GST_GL_RGB;
out_gl_type = GL_UNSIGNED_SHORT_5_6_5;
}
in_gl_format = src->mem.tex_format;
in_gl_type = GL_UNSIGNED_BYTE;
if (src->mem.tex_format == GST_GL_RGB565)

View file

@ -86,8 +86,10 @@ _gl_rbo_create (GstGLRenderbuffer * gl_mem, GError ** error)
tex_format = gl_mem->renderbuffer_format;
renderbuffer_type = GL_UNSIGNED_BYTE;
if (gl_mem->renderbuffer_format == GST_GL_RGB565)
if (gl_mem->renderbuffer_format == GST_GL_RGB565) {
tex_format = GST_GL_RGB;
renderbuffer_type = GL_UNSIGNED_SHORT_5_6_5;
}
internal_format =
gst_gl_sized_gl_format_from_gl_format_type (context, tex_format,