summaryrefslogtreecommitdiffstats
path: root/video/out/gl_osd.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-12-20 18:43:11 +0100
committerwm4 <wm4@nowhere>2014-12-20 18:43:11 +0100
commit501290da027d9ce852c7800e9cb8a14468fa240f (patch)
tree46f506e5244097d679913364142cd7d0680c63e1 /video/out/gl_osd.c
parent7d43a7ea840e752221c0da5cd99e11cf8b3fd834 (diff)
downloadmpv-501290da027d9ce852c7800e9cb8a14468fa240f.tar.bz2
mpv-501290da027d9ce852c7800e9cb8a14468fa240f.tar.xz
vo_opengl_old: fix OSD regression
Commit 0e8fbdbd removed the rg_texture requirement from vo_opengl; commit 541f6731 changed to a more convenient method. Both commits broke vo_opengl_old in some ways. vo_opengl_old always requires GL_ALPHA for single-channel texture, because it draws the OSD without shaders and by using certain blend modes. So we need to explicitly distinguish between vo_opengl and vo_opengl_old in the OSD renderer, and force fixed texture formats for vo_opengl_old. The other logic is specific to the internals of vo_opengl. (Although it might be possible to get the same result by playing with the old GL fixed-function functions in vo_opengl_old. But seems like a waste of time.) Fixes #1370.
Diffstat (limited to 'video/out/gl_osd.c')
-rw-r--r--video/out/gl_osd.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/video/out/gl_osd.c b/video/out/gl_osd.c
index 2bac4ef357..5219e3fbf8 100644
--- a/video/out/gl_osd.c
+++ b/video/out/gl_osd.c
@@ -47,12 +47,18 @@ static const struct osd_fmt_entry osd_to_gles3_formats[SUBBITMAP_COUNT] = {
[SUBBITMAP_RGBA] = {GL_RGBA8, GL_BGRA, GL_UNSIGNED_BYTE},
};
-static const struct osd_fmt_entry osd_to_gl_legacy_formats[SUBBITMAP_COUNT] = {
+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},
};
-struct mpgl_osd *mpgl_osd_init(GL *gl, struct mp_log *log, struct osd_state *osd)
+static const struct osd_fmt_entry osd_to_gl_legacy_formats[SUBBITMAP_COUNT] = {
+ [SUBBITMAP_LIBASS] = {GL_ALPHA, GL_ALPHA, GL_UNSIGNED_BYTE},
+ [SUBBITMAP_RGBA] = {GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE},
+};
+
+struct mpgl_osd *mpgl_osd_init(GL *gl, struct mp_log *log, struct osd_state *osd,
+ bool legacy)
{
GLint max_texture_size;
gl->GetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size);
@@ -66,10 +72,12 @@ struct mpgl_osd *mpgl_osd_init(GL *gl, struct mp_log *log, struct osd_state *osd
.scratch = talloc_zero_size(ctx, 1),
};
- if (gl->es >= 300) {
+ if (legacy) {
+ ctx->fmt_table = osd_to_gl_legacy_formats;
+ } else if (gl->es >= 300) {
ctx->fmt_table = osd_to_gles3_formats;
} else if (!(gl->mpgl_caps & MPGL_CAP_TEX_RG)) {
- ctx->fmt_table = osd_to_gl_legacy_formats;
+ ctx->fmt_table = osd_to_gl2_formats;
}
for (int n = 0; n < MAX_OSD_PARTS; n++) {