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)
This commit is contained in:
Niklas Haas 2017-09-12 03:00:47 +02:00
parent 0c2cb69597
commit 0bb67b1055
No known key found for this signature in database
GPG Key ID: 9A09076581B27402
1 changed files with 3 additions and 1 deletions

View File

@ -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: {