From 0bb67b1055d7a9c73e686dc7fa38388afa7a33a5 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Tue, 12 Sep 2017 03:00:47 +0200 Subject: 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) --- video/out/opengl/shader_cache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'video') 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: { -- cgit v1.2.3