diff options
Diffstat (limited to 'src/mesa/pipe/nv40/nv40_miptree.c')
-rw-r--r-- | src/mesa/pipe/nv40/nv40_miptree.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/mesa/pipe/nv40/nv40_miptree.c b/src/mesa/pipe/nv40/nv40_miptree.c index 48062d1ae8..df70feaa05 100644 --- a/src/mesa/pipe/nv40/nv40_miptree.c +++ b/src/mesa/pipe/nv40/nv40_miptree.c @@ -53,27 +53,26 @@ nv40_miptree_layout(struct nv40_miptree *nv40mt) nv40mt->total_size = offset; } -static void -nv40_miptree_create(struct pipe_context *pipe, struct pipe_texture **pt) +static struct pipe_texture * +nv40_miptree_create(struct pipe_context *pipe, const struct pipe_texture *pt) { struct pipe_winsys *ws = pipe->winsys; - struct nv40_miptree *nv40mt; - - nv40mt = realloc(*pt, sizeof(struct nv40_miptree)); - if (!nv40mt) - return; - *pt = NULL; - - nv40_miptree_layout(nv40mt); - - nv40mt->buffer = ws->buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL, - nv40mt->total_size); - if (!nv40mt->buffer) { - free(nv40mt); - return; + struct nv40_miptree *mt; + + mt = malloc(sizeof(struct nv40_miptree)); + if (!mt) + return NULL; + mt->base = *pt; + nv40_miptree_layout(mt); + + mt->buffer = ws->buffer_create(ws, 256, PIPE_BUFFER_USAGE_PIXEL, + mt->total_size); + if (!mt->buffer) { + free(mt); + return NULL; } - - *pt = &nv40mt->base; + + return &mt->base; } static void |