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/auxiliary/util/u_surfaces.c | 16 +++++++++++----- src/gallium/auxiliary/util/u_surfaces.h | 19 ++++++++++++++----- 2 files changed, 25 insertions(+), 10 deletions(-) (limited to 'src/gallium/auxiliary/util') diff --git a/src/gallium/auxiliary/util/u_surfaces.c b/src/gallium/auxiliary/util/u_surfaces.c index 45aa15e044..fd55bd1830 100644 --- a/src/gallium/auxiliary/util/u_surfaces.c +++ b/src/gallium/auxiliary/util/u_surfaces.c @@ -29,10 +29,11 @@ #include "util/u_inlines.h" #include "util/u_memory.h" -struct pipe_surface * +boolean util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, struct pipe_screen *pscreen, struct pipe_resource *pt, - unsigned level, unsigned layer, unsigned flags) + unsigned level, unsigned layer, unsigned flags, + struct pipe_surface **res) { struct pipe_surface *ps; @@ -53,12 +54,16 @@ util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, if(ps) { p_atomic_inc(&ps->reference.count); - return ps; + *res = ps; + return FALSE; } ps = (struct pipe_surface *)CALLOC(1, surface_struct_size); if(!ps) - return NULL; + { + *res = NULL; + return FALSE; + } pipe_surface_init(ps, pt, level, layer, flags); @@ -67,7 +72,8 @@ util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, else us->u.array[level] = ps; - return ps; + *res = ps; + return TRUE; } void diff --git a/src/gallium/auxiliary/util/u_surfaces.h b/src/gallium/auxiliary/util/u_surfaces.h index 86a1c2f83c..da4fbbfc25 100644 --- a/src/gallium/auxiliary/util/u_surfaces.h +++ b/src/gallium/auxiliary/util/u_surfaces.h @@ -42,11 +42,19 @@ struct util_surfaces } u; }; -struct pipe_surface *util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, struct pipe_screen *pscreen, struct pipe_resource *pt, unsigned level, unsigned layer, unsigned flags); +/* Return value indicates if the pipe surface result is new */ +boolean +util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, + struct pipe_screen *pscreen, struct pipe_resource *pt, + unsigned level, unsigned layer, unsigned flags, + struct pipe_surface **res); /* fast inline path for the very common case */ -static INLINE struct pipe_surface * -util_surfaces_get(struct util_surfaces *us, unsigned surface_struct_size, struct pipe_screen *pscreen, struct pipe_resource *pt, unsigned level, unsigned layer, unsigned flags) +static INLINE boolean +util_surfaces_get(struct util_surfaces *us, unsigned surface_struct_size, + struct pipe_screen *pscreen, struct pipe_resource *pt, + unsigned level, unsigned layer, unsigned flags, + struct pipe_surface **res) { if(likely((pt->target == PIPE_TEXTURE_2D || pt->target == PIPE_TEXTURE_RECT) && us->u.array)) { @@ -54,11 +62,12 @@ util_surfaces_get(struct util_surfaces *us, unsigned surface_struct_size, struct if(ps) { p_atomic_inc(&ps->reference.count); - return ps; + *res = ps; + return FALSE; } } - return util_surfaces_do_get(us, surface_struct_size, pscreen, pt, level, layer, flags); + return util_surfaces_do_get(us, surface_struct_size, pscreen, pt, level, layer, flags, res); } static INLINE struct pipe_surface * -- cgit v1.2.3