vo_opengl: replace uniform variable image_size with input_size

input_size can be the size of a cropped image

Signed-off-by: wm4 <wm4@nowhere>
This commit is contained in:
igv 2017-03-19 16:13:51 +02:00 committed by wm4
parent 6b8dadd7c1
commit 16e8ecb031
3 changed files with 9 additions and 4 deletions

View File

@ -26,6 +26,8 @@ Interface changes
--vo-image-format options
- the "jpeg" choice in the option above now leads to a ".jpg" file extension
- --af=drc is gone (you can use e.g. lavfi/acompressor instead)
- remove image_size predefined uniform from OpenGL user shaders. Use
input_size instead
--- mpv 0.24.0 ---
- deprecate --hwdec-api and replace it with --opengl-hwdec-interop.
The new option accepts both --hwdec values, as well as named backends.

View File

@ -4199,8 +4199,8 @@ The following video options are currently all specific to ``--vo=opengl`` and
int frame
A simple count of frames rendered, increases by one per frame and never
resets (regardless of seeks).
vec2 image_size
The size in pixels of the input image.
vec2 input_size
The size in pixels of the input image (possibly cropped and prescaled).
vec2 target_size
The size in pixels of the visible part of the scaled (and possibly
cropped) image.

View File

@ -1224,8 +1224,11 @@ static void load_shader(struct gl_video *p, struct bstr body)
gl_sc_hadd_bstr(p->sc, body);
gl_sc_uniform_f(p->sc, "random", (double)av_lfg_get(&p->lfg) / UINT32_MAX);
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, "input_size",
(GLfloat[]){(p->src_rect.x1 - p->src_rect.x0) *
p->texture_offset.m[0][0],
(p->src_rect.y1 - p->src_rect.y0) *
p->texture_offset.m[1][1]});
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});