Assigning a struct only copies the members - any padding is left as is.
Thus this code:
struct foo_t foo;
foo = bar;
leaves the padding of foo intact, ie uninitialized random garbage.
This patch fixes constant shader recompiles by initializing the struct
to zero. For completeness, memcpy is used to copy the key to the shader
struct.
NOTE: This is a candidate for the stable branches.
Signed-off-by: Lauri Kasanen <cand@gmx.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
struct r600_pipe_shader * shader = NULL;
int r;
+ memset(&key, 0, sizeof(key));
key = r600_shader_selector_key(ctx, sel);
/* Check if we don't need to change anything.
key = r600_shader_selector_key(ctx, sel);
}
- shader->key = key;
+ memcpy(&shader->key, &key, sizeof(key));
sel->num_shaders++;
}