1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 09:32:40 +00:00

vo_opengl: GLES does not support GL_BGRA

Apparently GLES 2 and 3 do not support this. (The implementations I
tested with were derived from desktop OpenGL and were not overly strict
with this.)

This is no problem; just use GL_RGBA and mangle the channels in the
shader.

Also disable direct support for image formats like IMGFMT_RGB555 with
GLES; at least some of them are not supported in this form, and the
formats aren't important anyway.
This commit is contained in:
wm4 2014-12-20 19:23:17 +01:00
parent 501290da02
commit f6dac5d884
3 changed files with 5 additions and 5 deletions

View File

@ -39,17 +39,17 @@ static const int blend_factors[SUBBITMAP_COUNT][4] = {
static const struct osd_fmt_entry osd_to_gl3_formats[SUBBITMAP_COUNT] = {
[SUBBITMAP_LIBASS] = {GL_RED, GL_RED, GL_UNSIGNED_BYTE},
[SUBBITMAP_RGBA] = {GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE},
[SUBBITMAP_RGBA] = {GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE},
};
static const struct osd_fmt_entry osd_to_gles3_formats[SUBBITMAP_COUNT] = {
[SUBBITMAP_LIBASS] = {GL_R8, GL_RED, GL_UNSIGNED_BYTE},
[SUBBITMAP_RGBA] = {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE},
[SUBBITMAP_RGBA] = {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE},
};
static const struct osd_fmt_entry osd_to_gl2_formats[SUBBITMAP_COUNT] = {
[SUBBITMAP_LIBASS] = {GL_LUMINANCE, GL_LUMINANCE, GL_UNSIGNED_BYTE},
[SUBBITMAP_RGBA] = {GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE},
[SUBBITMAP_RGBA] = {GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE},
};
static const struct osd_fmt_entry osd_to_gl_legacy_formats[SUBBITMAP_COUNT] = {

View File

@ -2335,7 +2335,7 @@ static bool init_format(int fmt, struct gl_video *init)
// Packed RGB special formats
for (const struct fmt_entry *e = mp_to_gl_formats; e->mp_format; e++) {
if (e->mp_format == fmt) {
if (!gl->es && e->mp_format == fmt) {
plane_format[0] = e;
goto supported;
}

View File

@ -161,7 +161,7 @@ in vec2 texcoord;
DECLARE_FRAGPARMS
void main() {
out_color = texture(texture0, texcoord);
out_color = texture(texture0, texcoord).bgra;
}
#!section frag_video