summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/user_shaders.h
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2016-06-08 15:05:28 +0200
committerwm4 <wm4@nowhere>2016-06-08 20:50:19 +0200
commit54c48bd80120a3085e6d23f7cf6124b0657436e7 (patch)
treed060ec1b942d4d544597c1e7c5fa5898d921edb1 /video/out/opengl/user_shaders.h
parenta15181e5df5ba8a21e6a5b953213f4a72690c47f (diff)
downloadmpv-54c48bd80120a3085e6d23f7cf6124b0657436e7.tar.bz2
mpv-54c48bd80120a3085e6d23f7cf6124b0657436e7.tar.xz
vo_opengl: make user hook passes optional
User hooks can now use an extra WHEN expression to specify when the shader should be run. For example, this can be used to only run a chroma scaling shader `WHEN CHROMA.w LUMA.w <`. There's a slight semantics change to user shaders: When trying to bind a texture that does not exist, a shader will now be silently skipped (similar to when the condition is false) instead of generating an error. This allows shader stages to depend on an optional earlier stage without having to copy/paste the same condition everywhere. (In other words: there's an implicit condition on all of the bound textures existing)
Diffstat (limited to 'video/out/opengl/user_shaders.h')
-rw-r--r--video/out/opengl/user_shaders.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/video/out/opengl/user_shaders.h b/video/out/opengl/user_shaders.h
index 3a651164e3..b8c287b6bd 100644
--- a/video/out/opengl/user_shaders.h
+++ b/video/out/opengl/user_shaders.h
@@ -31,6 +31,9 @@ enum szexp_op {
SZEXP_OP_SUB,
SZEXP_OP_MUL,
SZEXP_OP_DIV,
+ SZEXP_OP_NOT,
+ SZEXP_OP_GT,
+ SZEXP_OP_LT,
};
enum szexp_tag {
@@ -39,6 +42,7 @@ enum szexp_tag {
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
+ SZEXP_OP1, // Pop one element and push the result of a monadic operation
};
struct szexp {
@@ -58,6 +62,7 @@ struct gl_user_shader {
struct gl_transform offset;
struct szexp width[MAX_SZEXP_SIZE];
struct szexp height[MAX_SZEXP_SIZE];
+ struct szexp cond[MAX_SZEXP_SIZE];
int components;
};