r600g: Correctly initialize the shader key, v2 38/6438/1
authorLauri Kasanen <cand@gmx.com>
Fri, 3 May 2013 13:55:49 +0000 (16:55 +0300)
committerAndreas Boll <andreas.boll.dev@gmail.com>
Fri, 3 May 2013 17:28:57 +0000 (19:28 +0200)
commite495d88453076a4fe552502d66d6a3869ab70e4a
tree13cc525c21991df5a81869ff75814f02fb50ccbe
parent5ff81cfd8640d02dc78d736cad5020d54ef7a0dc
r600g: Correctly initialize the shader key, v2

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>
src/gallium/drivers/r600/r600_state_common.c