From af5345d9371e927019d51ce3ad198958f8cd42a9 Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Sun, 5 Dec 2010 12:04:47 +0100 Subject: nvfx: fixes after array textures merge Signed-off-by: Xavier Chantry Signed-off-by: Patrice Mandin --- src/gallium/drivers/nvfx/nvfx_miptree.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/gallium/drivers/nvfx/nvfx_miptree.c') diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c index db48025d34..2f9d5538b0 100644 --- a/src/gallium/drivers/nvfx/nvfx_miptree.c +++ b/src/gallium/drivers/nvfx/nvfx_miptree.c @@ -193,18 +193,19 @@ struct pipe_surface * nvfx_miptree_surface_new(struct pipe_context *pipe, struct pipe_resource *pt, const struct pipe_surface *surf_tmpl) { - struct nvfx_miptree* mt = (struct nvfx_miptree*)pt; - struct nvfx_surface *ns; + struct nvfx_miptree *mt = (struct nvfx_miptree *)pt; unsigned level = surf_tmpl->u.tex.level; + struct nvfx_surface *ns = NULL; assert(surf_tmpl->u.tex.first_layer == surf_tmpl->u.tex.last_layer); - ns = (struct nvfx_surface*)util_surfaces_get(&mt->surfaces, sizeof(struct nvfx_surface), NULL, pt, - level, surf_tmpl->u.tex.first_layer, surf_tmpl->usage); - if(ns->offset == ~0) { - util_dirty_surface_init(&ns->base); - ns->pitch = nvfx_subresource_pitch(pt, level); - ns->offset = nvfx_subresource_offset(pt, surf_tmpl->u.tex.first_layer, level, surf_tmpl->u.tex.first_layer); + if(util_surfaces_get(&mt->surfaces, sizeof(struct nvfx_surface), NULL, + pt, level, surf_tmpl->u.tex.first_layer, + surf_tmpl->usage, (struct pipe_surface **)&ns)) { + util_dirty_surface_init(&ns->base); + ns->pitch = nvfx_subresource_pitch(pt, level); + ns->offset = nvfx_subresource_offset(pt, surf_tmpl->u.tex.first_layer, level, surf_tmpl->u.tex.first_layer); } + ns->base.base.context = pipe; return &ns->base.base; } -- cgit v1.2.3