diff options
author | wm4 <wm4@nowhere> | 2016-09-14 20:42:52 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-09-14 20:46:45 +0200 |
commit | 88a07c5f53812b4bb4959e6cfc8353180b6b5c91 (patch) | |
tree | 2f696c828d06b73fa6bf91efa66aade61c070d54 /video/out/opengl/video.h | |
parent | e24ba8fa7f1a0645307ab53e16d9d6d1fe2349b2 (diff) | |
download | mpv-88a07c5f53812b4bb4959e6cfc8353180b6b5c91.tar.bz2 mpv-88a07c5f53812b4bb4959e6cfc8353180b6b5c91.tar.xz |
vo_opengl: dynamically manage texture units
A minor cleanup that makes the code simpler, and guarantees that we
cleanup the GL state properly at any point.
We do this by reusing the uniform caching, and assigning each sampler
uniform its own texture unit by incrementing a counter. This has various
subtle consequences for the GL driver, which hopefully don't matter. For
example, it will bind fewer textures at a time, but also rebind them
more often.
For some reason we keep TEXUNIT_VIDEO_NUM, because it limits the number
of hook passes that can be bound at the same time.
OSD rendering is an exception: we do many passes with the same shader,
and rebinding the texture each pass. For now, this is handled in an
unclean way, and we make the shader cache reserve texture unit 0 for the
OSD texture. At a later point, we should allocate that one dynamically
too, and just pass the texture unit to the OSD rendering code. Right now
I feel like vo_rpi.c (may it rot in hell) is in the way.
Diffstat (limited to 'video/out/opengl/video.h')
-rw-r--r-- | video/out/opengl/video.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/video/out/opengl/video.h b/video/out/opengl/video.h index a6c7ca2898..9c76c4a454 100644 --- a/video/out/opengl/video.h +++ b/video/out/opengl/video.h @@ -27,14 +27,10 @@ #include "lcms.h" #include "video/out/filter_kernels.h" -// Texture units 0-5 are used by the video, and for free use by the passes +// Assume we have this many texture units for sourcing additional passes. +// The actual texture unit assignment is dynamic. #define TEXUNIT_VIDEO_NUM 6 -// Other texture units are reserved for specific purposes -#define TEXUNIT_SCALERS TEXUNIT_VIDEO_NUM -#define TEXUNIT_3DLUT (TEXUNIT_SCALERS+SCALER_COUNT) -#define TEXUNIT_DITHER (TEXUNIT_3DLUT+1) - struct scaler_fun { char *name; float params[2]; |