Mesa (master): nv50: Initialize variables.

Vinson Lee vlee at kemper.freedesktop.org
Sun Apr 18 04:22:56 UTC 2010


Module: Mesa
Branch: master
Commit: 891e9d6f3f123e9e4a89743535d18bfb543626d3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=891e9d6f3f123e9e4a89743535d18bfb543626d3

Author: Vinson Lee <vlee at vmware.com>
Date:   Sat Apr 17 21:21:31 2010 -0700

nv50: Initialize variables.

Silences GCC uninitialized variable warnings.

---

 src/gallium/drivers/nv50/nv50_program.c        |   10 +++++-----
 src/gallium/drivers/nv50/nv50_state_validate.c |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c
index 11ca2a2..608daa1 100644
--- a/src/gallium/drivers/nv50/nv50_program.c
+++ b/src/gallium/drivers/nv50/nv50_program.c
@@ -1615,7 +1615,7 @@ emit_lit(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask,
 	struct nv50_reg *zero = alloc_immd(pc, 0.0);
 	struct nv50_reg *neg128 = alloc_immd(pc, -127.999999);
 	struct nv50_reg *pos128 = alloc_immd(pc,  127.999999);
-	struct nv50_reg *tmp[4];
+	struct nv50_reg *tmp[4] = { 0 };
 	boolean allow32 = pc->allow32;
 
 	pc->allow32 = FALSE;
@@ -2553,7 +2553,7 @@ nv50_program_tx_insn(struct nv50_pc *pc,
 		     const struct tgsi_full_instruction *inst)
 {
 	struct nv50_reg *rdst[4], *dst[4], *brdc, *src[3][4], *temp;
-	unsigned mask, sat, unit;
+	unsigned mask, sat, unit = 0;
 	int i, c;
 
 	mask = inst->Dst[0].Register.WriteMask;
@@ -3531,7 +3531,7 @@ nv50_program_tx_prep(struct nv50_pc *pc)
 	struct tgsi_parse_context tp;
 	struct nv50_program *p = pc->p;
 	boolean ret = FALSE;
-	unsigned i, c, instance_id, vertex_id, flat_nr = 0;
+	unsigned i, c, instance_id = 0, vertex_id = 0, flat_nr = 0;
 
 	tgsi_parse_init(&tp, pc->p->pipe.tokens);
 	while (!tgsi_parse_end_of_tokens(&tp)) {
@@ -3729,7 +3729,7 @@ nv50_program_tx_prep(struct nv50_pc *pc)
 		copy_semantic_info(p);
 	} else
 	if (p->type == PIPE_SHADER_FRAGMENT) {
-		int rid, aid;
+		int rid = 0, aid;
 		unsigned n = 0, m = pc->attr_nr - flat_nr;
 
 		pc->allow32 = TRUE;
@@ -4601,7 +4601,7 @@ construct_vp_gp_mapping(uint32_t *map32, int m,
 	int i, j, c;
 
         for (i = 0; i < gp->cfg.in_nr; ++i) {
-                uint8_t oid, mv = 0, mg = gp->cfg.in[i].mask;
+                uint8_t oid = 0, mv = 0, mg = gp->cfg.in[i].mask;
 
                 for (j = 0; j < vp->cfg.out_nr; ++j) {
                         if (vp->cfg.out[j].sn == gp->cfg.in[i].sn &&
diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c
index 5cac3a2..14c3490 100644
--- a/src/gallium/drivers/nv50/nv50_state_validate.c
+++ b/src/gallium/drivers/nv50/nv50_state_validate.c
@@ -32,7 +32,7 @@ validate_fb(struct nv50_context *nv50)
 	struct nouveau_grobj *tesla = nv50->screen->tesla;
 	struct nouveau_stateobj *so = so_new(32, 79, 18);
 	struct pipe_framebuffer_state *fb = &nv50->framebuffer;
-	unsigned i, w, h, gw = 0;
+	unsigned i, w = 0, h = 0, gw = 0;
 
 	/* Set nr of active RTs and select RT for each colour output.
 	 * FP result 0 always goes to RT[0], bits 4 - 6 are ignored.




More information about the mesa-commit mailing list