summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/user_shaders.h
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2016-05-12 03:34:47 +0200
committerNiklas Haas <git@nand.wakku.to>2016-05-15 20:42:02 +0200
commit034faaa9d818bd8c1c52c879e383b8e7350d3df5 (patch)
tree18333dad4b120905363456479bafb14fff1db299 /video/out/opengl/user_shaders.h
parent7c3d78fd82d4d1e1a0b15284386d39b4014cb7d1 (diff)
downloadmpv-034faaa9d818bd8c1c52c879e383b8e7350d3df5.tar.bz2
mpv-034faaa9d818bd8c1c52c879e383b8e7350d3df5.tar.xz
vo_opengl: use RPN expressions for user hook sizes
This replaces the previous TRANSFORM by WIDTH, HEIGHT and OFFSET where WIDTH and HEIGHT are RPN expressions. This allows for more fine-grained control over the output size, and also makes sure that overwriting existing textures works more cleanly. (Also add some more useful bstr functions)
Diffstat (limited to 'video/out/opengl/user_shaders.h')
-rw-r--r--video/out/opengl/user_shaders.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/video/out/opengl/user_shaders.h b/video/out/opengl/user_shaders.h
index 051dcaaa58..0e32f53c57 100644
--- a/video/out/opengl/user_shaders.h
+++ b/video/out/opengl/user_shaders.h
@@ -24,13 +24,40 @@
#define SHADER_API 1
#define SHADER_MAX_HOOKS 16
#define SHADER_MAX_BINDS 6
+#define MAX_SZEXP_SIZE 32
+
+enum szexp_op {
+ SZEXP_OP_ADD,
+ SZEXP_OP_SUB,
+ SZEXP_OP_MUL,
+ SZEXP_OP_DIV,
+};
+
+enum szexp_tag {
+ SZEXP_END = 0, // End of an RPN expression
+ SZEXP_CONST, // Push a constant value onto the stack
+ SZEXP_VAR_W, // Get the width/height of a named texture (variable)
+ SZEXP_VAR_H,
+ SZEXP_OP2, // Pop two elements and push the result of a dyadic operation
+} tag;
+
+struct szexp {
+ enum szexp_tag tag;
+ union {
+ float cval;
+ struct bstr varname;
+ enum szexp_op op;
+ } val;
+};
struct gl_user_shader {
struct bstr hook_tex[SHADER_MAX_HOOKS];
struct bstr bind_tex[SHADER_MAX_BINDS];
struct bstr save_tex;
struct bstr pass_body;
- struct gl_transform transform;
+ struct gl_transform offset;
+ struct szexp width[MAX_SZEXP_SIZE];
+ struct szexp height[MAX_SZEXP_SIZE];
int components;
};