Commit ea6bed11 authored by Haihua Hu's avatar Haihua Hu Committed by Tim-Philipp Müller

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
parent 2fc05e90
......@@ -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;
......
......@@ -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,
......
......@@ -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)
......
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment