1
mirror of https://github.com/mpv-player/mpv synced 2024-10-22 08:51:57 +02:00

vo_opengl: add output_size uniform to custom shader

logically, scaler should know its input and output size

Signed-off-by: wm4 <wm4@nowhere>
This commit is contained in:
Muhammad Faiz 2016-06-24 00:49:10 +07:00 committed by wm4
parent 40c9b38023
commit d5615102d5
2 changed files with 6 additions and 0 deletions

View File

@ -629,6 +629,9 @@ Available video output drivers are:
never resets (regardless of seeks).
vec2 image_size
The size in pixels of the input image.
vec2 target_size
The size in pixels of the visible part of the scaled (and possibly
cropped) image.
For example, a shader that inverts the colors could look like this::

View File

@ -1239,6 +1239,9 @@ static void load_shader(struct gl_video *p, struct bstr body)
gl_sc_uniform_f(p->sc, "frame", p->frames_uploaded);
gl_sc_uniform_vec2(p->sc, "image_size", (GLfloat[]){p->image_params.w,
p->image_params.h});
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});
}
static const char *get_custom_shader_fn(struct gl_video *p, const char *body)