Assigning a struct only copies the members - any padding is left as is.

Thus this code:

struct 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.

Signed-off-by: Lauri Kasanen <c...@gmx.com>
---
 src/gallium/drivers/r600/r600_state_common.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_state_common.c
b/src/gallium/drivers/r600/r600_state_common.c index 87a2e2e..bf7cc39
100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -710,7 +710,7 @@ static int r600_shader_select(struct pipe_context
*ctx, struct r600_pipe_shader_selector* sel,
         bool *dirty)
 {
-       struct r600_shader_key key;
+       struct r600_shader_key key = {0};
        struct r600_context *rctx = (struct r600_context *)ctx;
        struct r600_pipe_shader * shader = NULL;
        int r;
-- 
1.7.2.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to