diff options
author | Niklas Haas <git@haasn.xyz> | 2017-09-12 03:00:47 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.xyz> | 2017-09-12 03:00:47 +0200 |
commit | 0bb67b1055d7a9c73e686dc7fa38388afa7a33a5 (patch) | |
tree | e5b5dbea79ec33780ff12f5fe32ef16ad0b3509a /video/out/opengl | |
parent | 0c2cb69597f52592bdb58312d9987978cb86a9d3 (diff) | |
download | mpv-0bb67b1055d7a9c73e686dc7fa38388afa7a33a5.tar.bz2 mpv-0bb67b1055d7a9c73e686dc7fa38388afa7a33a5.tar.xz |
vo_opengl: always initialize uniforms on first use
Even if the contents are entirely zero. In the current code, these
entries were left uninitialized. (Which always worked for nvidia - but
randomly blew up for AMD)
Diffstat (limited to 'video/out/opengl')
-rw-r--r-- | video/out/opengl/shader_cache.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/video/out/opengl/shader_cache.c b/video/out/opengl/shader_cache.c index fe5ca3fdbd..90a757617b 100644 --- a/video/out/opengl/shader_cache.c +++ b/video/out/opengl/shader_cache.c @@ -46,6 +46,7 @@ struct sc_uniform { struct sc_cached_uniform { union uniform_val v; int index; // for ra_renderpass_input_val + bool set; // whether the uniform has ever been set }; struct sc_entry { @@ -472,10 +473,11 @@ static void update_uniform(struct gl_shader_cache *sc, struct sc_entry *e, { struct sc_cached_uniform *un = &e->cached_uniforms[n]; struct ra_layout layout = ra_renderpass_input_layout(&u->input); - if (layout.size > 0 && memcmp(&un->v, &u->v, layout.size) == 0) + if (layout.size > 0 && un->set && memcmp(&un->v, &u->v, layout.size) == 0) return; un->v = u->v; + un->set = true; switch (u->type) { case SC_UNIFORM_TYPE_GLOBAL: { |