summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorigv <igv@mail.com>2016-07-15 09:26:35 +0300
committerwm4 <wm4@nowhere>2017-03-25 13:39:21 +0100
commit6b8dadd7c18f682d51c695dbfa7b3f3ea2794969 (patch)
tree09a5fce2fa046d06549be457773358b322903ddd
parent2aae5ce0bae31f97d2506c455596150fdea49b0b (diff)
downloadmpv-6b8dadd7c18f682d51c695dbfa7b3f3ea2794969.tar.bz2
mpv-6b8dadd7c18f682d51c695dbfa7b3f3ea2794969.tar.xz
vo_opengl: add tex_offset uniform variable to user shaders
-rw-r--r--DOCS/man/options.rst2
-rw-r--r--video/out/opengl/video.c5
2 files changed, 7 insertions, 0 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 2a56097f77..bdcf708557 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -4204,6 +4204,8 @@ The following video options are currently all specific to ``--vo=opengl`` and
vec2 target_size
The size in pixels of the visible part of the scaled (and possibly
cropped) image.
+ vec2 tex_offset
+ Texture offset introduced by user shaders or options like panscan, video-align-x/y, video-pan-x/y.
Internally, vo_opengl may generate any number of the following textures.
Whenever a texture is rendered and saved by vo_opengl, all of the passes
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c
index b9764063c0..f6db1514f5 100644
--- a/video/out/opengl/video.c
+++ b/video/out/opengl/video.c
@@ -1229,6 +1229,11 @@ static void load_shader(struct gl_video *p, struct bstr body)
gl_sc_uniform_vec2(p->sc, "target_size",
(GLfloat[]){p->dst_rect.x1 - p->dst_rect.x0,
p->dst_rect.y1 - p->dst_rect.y0});
+ gl_sc_uniform_vec2(p->sc, "tex_offset",
+ (GLfloat[]){p->src_rect.x0 * p->texture_offset.m[0][0] +
+ p->texture_offset.t[0],
+ p->src_rect.y0 * p->texture_offset.m[1][1] +
+ p->texture_offset.t[1]});
}
// Semantic equality