summaryrefslogtreecommitdiff
path: root/src/mesa/pipe
diff options
context:
space:
mode:
authorBen Skeggs <skeggsb@gmail.com>2007-12-17 21:49:16 +1100
committerBen Skeggs <skeggsb@gmail.com>2007-12-17 21:49:16 +1100
commitc5ffd8e9afd3df1d4daf189344ec8cbf8a021143 (patch)
treeb637820693ecaaaa612efda251dd9d11f6c382f9 /src/mesa/pipe
parent8043d2d2618120828d1a94c861ac8fc16fee7af7 (diff)
nv40: fix valgrind complaints
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/nv40/nv40_fragprog.c1
-rw-r--r--src/mesa/pipe/nv40/nv40_miptree.c9
2 files changed, 4 insertions, 6 deletions
diff --git a/src/mesa/pipe/nv40/nv40_fragprog.c b/src/mesa/pipe/nv40/nv40_fragprog.c
index 9cc1267108..c95f31e143 100644
--- a/src/mesa/pipe/nv40/nv40_fragprog.c
+++ b/src/mesa/pipe/nv40/nv40_fragprog.c
@@ -124,6 +124,7 @@ emit_src(struct nv40_fpc *fpc, int pos, struct nv40_sreg src)
fpd = &fp->consts[fp->nr_consts - 1];
fpd->offset = fpc->inst_offset + 4;
fpd->index = fpc->consts[src.index].pipe;
+ memset(&fp->insn[fpd->offset], 0, sizeof(uint32_t) * 4);
} else {
memcpy(&fp->insn[fpc->inst_offset + 4],
fpc->consts[src.index].vals,
diff --git a/src/mesa/pipe/nv40/nv40_miptree.c b/src/mesa/pipe/nv40/nv40_miptree.c
index 9d4fbb6826..625c2fc32d 100644
--- a/src/mesa/pipe/nv40/nv40_miptree.c
+++ b/src/mesa/pipe/nv40/nv40_miptree.c
@@ -55,17 +55,14 @@ nv40_miptree_layout(struct nv40_miptree *nv40mt)
static void
nv40_miptree_create(struct pipe_context *pipe, struct pipe_texture **pt)
{
- struct pipe_texture *mt = *pt;
struct pipe_winsys *ws = pipe->winsys;
struct nv40_miptree *nv40mt;
- *pt = NULL;
-
- nv40mt = calloc(1, sizeof(struct nv40_miptree));
+ nv40mt = realloc(*pt, sizeof(struct nv40_miptree));
if (!nv40mt)
return;
+ *pt = NULL;
- memcpy(&nv40mt->base, mt, sizeof(struct pipe_texture));
nv40_miptree_layout(nv40mt);
nv40mt->buffer = ws->buffer_create(ws, 256, 0, 0);
@@ -91,7 +88,7 @@ nv40_miptree_release(struct pipe_context *pipe, struct pipe_texture **pt)
int l;
ws->buffer_reference(ws, &nv40mt->buffer, NULL);
- for (l = 0; l < PIPE_MAX_TEXTURE_LEVELS; l++) {
+ for (l = mt->first_level; l <= mt->last_level; l++) {
if (nv40mt->level[l].image_offset)
free(nv40mt->level[l].image_offset);
}