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/utils.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/utils.h')
-rw-r--r-- | video/out/opengl/utils.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/video/out/opengl/utils.h b/video/out/opengl/utils.h index ab3c13c915..33c2daa5be 100644 --- a/video/out/opengl/utils.h +++ b/video/out/opengl/utils.h @@ -156,7 +156,9 @@ void gl_sc_haddf(struct gl_shader_cache *sc, const char *textf, ...); void gl_sc_hadd_bstr(struct gl_shader_cache *sc, struct bstr text); void gl_sc_uniform_sampler(struct gl_shader_cache *sc, char *name, GLenum target, int unit); -void gl_sc_uniform_sampler_ui(struct gl_shader_cache *sc, char *name, int unit); +void gl_sc_uniform_tex(struct gl_shader_cache *sc, char *name, GLenum target, + GLuint texture); +void gl_sc_uniform_tex_ui(struct gl_shader_cache *sc, char *name, GLuint texture); void gl_sc_uniform_f(struct gl_shader_cache *sc, char *name, GLfloat f); void gl_sc_uniform_i(struct gl_shader_cache *sc, char *name, GLint f); void gl_sc_uniform_vec2(struct gl_shader_cache *sc, char *name, GLfloat f[2]); |