diff options
author | Niklas Haas <git@haasn.xyz> | 2017-07-11 01:59:21 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.xyz> | 2017-07-27 23:51:05 +0200 |
commit | 345bb193fe75ddbf2f21bd295869276b6fa87189 (patch) | |
tree | 319f31b8bb33be3532846916da32f93dd4b8152a /video/out/opengl/user_shaders.h | |
parent | f1af6e53f0b043cac2d3f1024d7d91785072f237 (diff) | |
download | mpv-345bb193fe75ddbf2f21bd295869276b6fa87189.tar.bz2 mpv-345bb193fe75ddbf2f21bd295869276b6fa87189.tar.xz |
vo_opengl: support loading custom user textures
Parsing the texture data as raw strings makes the textures the most
portable and self-contained. In order to facilitate different types of
shaders, the parse_user_shader interaction has been changed to instead
have it loop through blocks and call the passed functions for each valid
block parsed. This is more modular and also cleaner, with better code
separation.
Closes #4586.
Diffstat (limited to 'video/out/opengl/user_shaders.h')
-rw-r--r-- | video/out/opengl/user_shaders.h | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/video/out/opengl/user_shaders.h b/video/out/opengl/user_shaders.h index 7192309c54..bb550de2b8 100644 --- a/video/out/opengl/user_shaders.h +++ b/video/out/opengl/user_shaders.h @@ -55,7 +55,7 @@ struct szexp { } val; }; -struct gl_user_shader { +struct gl_user_shader_hook { struct bstr pass_desc; struct bstr hook_tex[SHADER_MAX_HOOKS]; struct bstr bind_tex[SHADER_MAX_BINDS]; @@ -70,10 +70,25 @@ struct gl_user_shader { int compute_h; }; -// Parse the next shader pass from `body`. The `struct bstr` is modified by the -// function. Returns false if the end of the string was reached (or on error). -bool parse_user_shader_pass(struct mp_log *log, struct bstr *body, - struct gl_user_shader *out); +struct gl_user_shader_tex { + struct bstr name; + int w, h, d; + int components; + int bytes; + int mpgl_type; + GLenum gl_target; + GLenum gl_filter; + GLenum gl_border; + void *texdata; + // for video.c + GLenum gl_tex; +}; + +// Parse the next shader block from `body`. The callbacks are invoked on every +// valid shader block parsed. +void parse_user_shader(struct mp_log *log, struct bstr shader, void *priv, + bool (*dohook)(void *p, struct gl_user_shader_hook hook), + bool (*dotex)(void *p, struct gl_user_shader_tex tex)); // Evaluate a szexp, given a lookup function for named textures bool eval_szexpr(struct mp_log *log, void *priv, |