diff options
author | Bin Jin <bjin@ctrl-d.org> | 2019-03-12 02:24:51 +0000 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2019-06-06 20:01:56 +0200 |
commit | ae1c489b319eab1fe200200c39f58246de75a6f3 (patch) | |
tree | 28a9e74588a36b3163fb81443f62e5fa3db6f786 /video/out/gpu/user_shaders.c | |
parent | 4d001bb30db6786a44658b0625dc31027767a393 (diff) | |
download | mpv-ae1c489b319eab1fe200200c39f58246de75a6f3.tar.bz2 mpv-ae1c489b319eab1fe200200c39f58246de75a6f3.tar.xz |
vo_gpu: allow user shader to fix texture offset
This commit essentially makes user shader able to fix offset (produced
by other prescaler, for example) like builtin `--scale`.
Diffstat (limited to 'video/out/gpu/user_shaders.c')
-rw-r--r-- | video/out/gpu/user_shaders.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/video/out/gpu/user_shaders.c b/video/out/gpu/user_shaders.c index 0613eb93f6..f0c8a9d19a 100644 --- a/video/out/gpu/user_shaders.c +++ b/video/out/gpu/user_shaders.c @@ -170,6 +170,7 @@ static bool parse_hook(struct mp_log *log, struct bstr *body, *out = (struct gl_user_shader_hook){ .pass_desc = bstr0("(unknown)"), .offset = identity_trans, + .align_offset = false, .width = {{ SZEXP_VAR_W, { .varname = bstr0("HOOKED") }}}, .height = {{ SZEXP_VAR_H, { .varname = bstr0("HOOKED") }}}, .cond = {{ SZEXP_CONST, { .cval = 1.0 }}}, @@ -221,13 +222,18 @@ static bool parse_hook(struct mp_log *log, struct bstr *body, } if (bstr_eatstart0(&line, "OFFSET")) { - float ox, oy; - if (bstr_sscanf(line, "%f %f", &ox, &oy) != 2) { - mp_err(log, "Error while parsing OFFSET!\n"); - return false; + line = bstr_strip(line); + if (bstr_equals0(line, "ALIGN")) { + out->align_offset = true; + } else { + float ox, oy; + if (bstr_sscanf(line, "%f %f", &ox, &oy) != 2) { + mp_err(log, "Error while parsing OFFSET!\n"); + return false; + } + out->offset.t[0] = ox; + out->offset.t[1] = oy; } - out->offset.t[0] = ox; - out->offset.t[1] = oy; continue; } |