On 05/03/2013 03:10 PM, Lauri Kasanen wrote:
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};
I suspect the effect of this initialization on padding is undefined.
Probably it's safer to use memset.
Vadim
struct r600_context *rctx = (struct r600_context *)ctx;
struct r600_pipe_shader * shader = NULL;
int r;
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev