From 052584c9e2b87a69ef2359d88989a694910ac506 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 1 Oct 2016 12:01:57 +0200 Subject: vo_opengl: add debugging options for testing with padded textures --- DOCS/man/options.rst | 8 +++++++- video/out/opengl/video.c | 13 +++++++++---- video/out/opengl/video.h | 1 + 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 9103d3d641..04d178764a 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -4490,12 +4490,18 @@ The following video options are currently all specific to ``--vo=opengl`` and ``--opengl-rectangle-textures`` Force use of rectangle textures (default: no). Normally this shouldn't have any advantages over normal textures. Note that hardware decoding overrides - this flag. + this flag. Could be removed any time. ``--background=`` Color used to draw parts of the mpv window not covered by video. See ``--osd-color`` option how colors are defined. +``--opengl-tex-pad-x``, ``--opengl-tex-pad-y`` + Enlarge the video source textures by this many pixels. For debugging only + (normally textures are sized exactly, but due to hardware decoding interop + we may have to deal with additional padding, which can be tested with these + options). Could be removed any time. + Miscellaneous ------------- diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index 93930a5a21..7d7641a1ea 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -409,6 +409,8 @@ const struct m_sub_options gl_video_conf = { OPT_FLAG("deband", deband, 0), OPT_SUBSTRUCT("deband", deband_opts, deband_conf, 0), OPT_FLOAT("sharpen", unsharp, 0), + OPT_INTRANGE("opengl-tex-pad-x", tex_pad_x, 0, 0, 4096), + OPT_INTRANGE("opengl-tex-pad-y", tex_pad_y, 0, 0, 4096), OPT_SUBSTRUCT("", icc_opts, mp_icc_conf, 0), {0} @@ -875,14 +877,16 @@ static void init_video(struct gl_video *p) plane->gl_target = gl_target; - plane->w = plane->tex_w = mp_image_plane_w(&layout, n); - plane->h = plane->tex_h = mp_image_plane_h(&layout, n); + plane->w = mp_image_plane_w(&layout, n); + plane->h = mp_image_plane_h(&layout, n); + plane->tex_w = plane->w + p->opts.tex_pad_x; + plane->tex_h = plane->h + p->opts.tex_pad_y; gl->GenTextures(1, &plane->gl_texture); gl->BindTexture(gl_target, plane->gl_texture); gl->TexImage2D(gl_target, 0, plane->gl_internal_format, - plane->w, plane->h, 0, + plane->tex_w, plane->tex_h, 0, plane->gl_format, plane->gl_type, NULL); int filter = plane->use_integer ? GL_NEAREST : GL_LINEAR; @@ -893,7 +897,8 @@ static void init_video(struct gl_video *p) gl->BindTexture(gl_target, 0); - MP_VERBOSE(p, "Texture for plane %d: %dx%d\n", n, plane->w, plane->h); + MP_VERBOSE(p, "Texture for plane %d: %dx%d\n", n, + plane->tex_w, plane->tex_h); } } diff --git a/video/out/opengl/video.h b/video/out/opengl/video.h index 9c76c4a454..f2fe5e4423 100644 --- a/video/out/opengl/video.h +++ b/video/out/opengl/video.h @@ -130,6 +130,7 @@ struct gl_video_opts { int deband; struct deband_opts *deband_opts; float unsharp; + int tex_pad_x, tex_pad_y; struct mp_icc_opts *icc_opts; }; -- cgit v1.2.3