summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/user_shaders.h
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2017-07-10 22:52:39 +0200
committerNiklas Haas <git@haasn.xyz>2017-07-27 23:45:17 +0200
commitf1af6e53f0b043cac2d3f1024d7d91785072f237 (patch)
tree9a0acb7243e78a83054cb71a7ce278c3d0a3271c /video/out/opengl/user_shaders.h
parentea76f79e5d89f54cf1b8e78d5c1d71bfce69d958 (diff)
downloadmpv-f1af6e53f0b043cac2d3f1024d7d91785072f237.tar.bz2
mpv-f1af6e53f0b043cac2d3f1024d7d91785072f237.tar.xz
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.
Diffstat (limited to 'video/out/opengl/user_shaders.h')
-rw-r--r--video/out/opengl/user_shaders.h10
1 files changed, 5 insertions, 5 deletions
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);