From f1af6e53f0b043cac2d3f1024d7d91785072f237 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Mon, 10 Jul 2017 22:52:39 +0200 Subject: vo_opengl: slightly refactor user_shaders code - Each struct tex_hook now stores multiple hooks, this allows us to avoid the awkward way of the current code has to add the same pass multiple times. - As a consequence, SHADER_MAX_HOOKS was split up into SHADER_MAX_PASSES (number of tex_hooks) and SHADER_MAX_HOOKS (number of hooked textures per tex_hook), and both numbers decreased correspondingly. - Instead of having a weird free() callback, we can just leverage talloc's recursive free behavior. The only user is the user shaders code anyway. --- video/out/opengl/user_shaders.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'video/out/opengl/user_shaders.h') diff --git a/video/out/opengl/user_shaders.h b/video/out/opengl/user_shaders.h index 3b7913f236..7192309c54 100644 --- a/video/out/opengl/user_shaders.h +++ b/video/out/opengl/user_shaders.h @@ -21,8 +21,8 @@ #include "common.h" #include "utils.h" -#define SHADER_API 1 -#define SHADER_MAX_HOOKS 64 +#define SHADER_MAX_PASSES 32 +#define SHADER_MAX_HOOKS 16 #define SHADER_MAX_BINDS 6 #define SHADER_MAX_SAVED 64 #define MAX_SZEXP_SIZE 32 @@ -56,11 +56,11 @@ struct szexp { }; struct gl_user_shader { + struct bstr pass_desc; struct bstr hook_tex[SHADER_MAX_HOOKS]; struct bstr bind_tex[SHADER_MAX_BINDS]; struct bstr save_tex; struct bstr pass_body; - struct bstr desc; struct gl_transform offset; struct szexp width[MAX_SZEXP_SIZE]; struct szexp height[MAX_SZEXP_SIZE]; @@ -70,8 +70,8 @@ struct gl_user_shader { int compute_h; }; -// Parse the next shader pass from 'body'. Returns false if the end of the -// string was reached +// 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); -- cgit v1.2.3