diff options
author | wm4 <wm4@nowhere> | 2017-07-22 21:53:50 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-07-22 21:55:38 +0200 |
commit | d3dfffdf020e0c4de1159b45a69e938cb300a2e1 (patch) | |
tree | 90b80a00df313c09dd7d2413565e206f75a73852 /video/out/opengl/video.c | |
parent | a24df94fedb762c5fb587d3e8a442ae22b5ce053 (diff) | |
download | mpv-d3dfffdf020e0c4de1159b45a69e938cb300a2e1.tar.bz2 mpv-d3dfffdf020e0c4de1159b45a69e938cb300a2e1.tar.xz |
vo_opengl: osd: use new VAO mechanism
In addition to using the new VAO mechanism introduced in the previous
commit, this tries to keep the OSD code self-contained. This doesn't
work all too well (because of the pass and CMS stuff), but it's still
better than before.
Diffstat (limited to 'video/out/opengl/video.c')
-rw-r--r-- | video/out/opengl/video.c | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index 17433b4647..2fe0d14986 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -2407,26 +2407,10 @@ static void pass_draw_osd(struct gl_video *p, int draw_flags, double pts, p->gl->BindFramebuffer(GL_FRAMEBUFFER, fbo); for (int n = 0; n < MAX_OSD_PARTS; n++) { - enum sub_bitmap_format fmt = mpgl_osd_get_part_format(p->osd, n); - if (!fmt) + // (This returns false if this part is empty with nothing to draw.) + if (!mpgl_osd_draw_prepare(p->osd, n, p->sc)) continue; - gl_sc_uniform_tex(p->sc, "osdtex", GL_TEXTURE_2D, - mpgl_osd_get_part_texture(p->osd, n)); - switch (fmt) { - case SUBBITMAP_RGBA: { - pass_describe(p, "drawing osd (rgba)"); - GLSL(color = texture(osdtex, texcoord).bgra;) - break; - } - case SUBBITMAP_LIBASS: { - pass_describe(p, "drawing osd (libass)"); - GLSL(color = - vec4(ass_color.rgb, ass_color.a * texture(osdtex, texcoord).r);) - break; - } - default: - abort(); - } + pass_describe(p, "drawing osd"); // When subtitles need to be color managed, assume they're in sRGB // (for lack of anything saner to do) if (cms) { @@ -2438,11 +2422,9 @@ static void pass_draw_osd(struct gl_video *p, int draw_flags, double pts, pass_colormanage(p, csp_srgb, true); } - gl_sc_set_vao(p->sc, mpgl_osd_get_vao(p->osd)); pass_record(p, gl_sc_generate(p->sc)); - mpgl_osd_draw_part(p->osd, vp_w, vp_h, n); + mpgl_osd_draw_finish(p->osd, vp_w, vp_h, n, p->sc); gl_sc_reset(p->sc); - gl_sc_set_vao(p->sc, NULL); } } |