diff options
author | Xavier Chantry <[email protected]> | 2010-12-05 12:09:30 +0100 |
---|---|---|
committer | Patrice Mandin <[email protected]> | 2010-12-05 12:09:38 +0100 |
commit | e3256ccb045032960f099318938991392b896b44 (patch) | |
tree | f8402da232504712c69c691b9454d4e79e6dd88c /src/gallium/auxiliary/util | |
parent | af5345d9371e927019d51ce3ad198958f8cd42a9 (diff) |
init ps->context with util_surfaces_get and do_get
Signed-off-by: Xavier Chantry <[email protected]>
Reviewed-by: Jakob Bornecrantz <wallbraker at gmail.com>
Signed-off-by: Patrice Mandin <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r-- | src/gallium/auxiliary/util/u_inlines.h | 13 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_surfaces.c | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_surfaces.h | 8 |
3 files changed, 15 insertions, 12 deletions
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index d5bc114fce6..e55aafe90f0 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -136,8 +136,9 @@ pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_ } static INLINE void -pipe_surface_reset(struct pipe_surface* ps, struct pipe_resource *pt, - unsigned level, unsigned layer, unsigned flags) +pipe_surface_reset(struct pipe_context *ctx, struct pipe_surface* ps, + struct pipe_resource *pt, unsigned level, unsigned layer, + unsigned flags) { pipe_resource_reference(&ps->texture, pt); ps->format = pt->format; @@ -146,15 +147,17 @@ pipe_surface_reset(struct pipe_surface* ps, struct pipe_resource *pt, ps->usage = flags; ps->u.tex.level = level; ps->u.tex.first_layer = ps->u.tex.last_layer = layer; + ps->context = ctx; } static INLINE void -pipe_surface_init(struct pipe_surface* ps, struct pipe_resource *pt, - unsigned level, unsigned layer, unsigned flags) +pipe_surface_init(struct pipe_context *ctx, struct pipe_surface* ps, + struct pipe_resource *pt, unsigned level, unsigned layer, + unsigned flags) { ps->texture = 0; pipe_reference_init(&ps->reference, 1); - pipe_surface_reset(ps, pt, level, layer, flags); + pipe_surface_reset(ctx, ps, pt, level, layer, flags); } /* diff --git a/src/gallium/auxiliary/util/u_surfaces.c b/src/gallium/auxiliary/util/u_surfaces.c index fd55bd1830c..b0cfec2a826 100644 --- a/src/gallium/auxiliary/util/u_surfaces.c +++ b/src/gallium/auxiliary/util/u_surfaces.c @@ -31,7 +31,7 @@ boolean util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, - struct pipe_screen *pscreen, struct pipe_resource *pt, + struct pipe_context *ctx, struct pipe_resource *pt, unsigned level, unsigned layer, unsigned flags, struct pipe_surface **res) { @@ -51,7 +51,7 @@ util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, ps = us->u.array[level]; } - if(ps) + if(ps && ps->context == ctx) { p_atomic_inc(&ps->reference.count); *res = ps; @@ -65,7 +65,7 @@ util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, return FALSE; } - pipe_surface_init(ps, pt, level, layer, flags); + pipe_surface_init(ctx, ps, pt, level, layer, flags); if(pt->target == PIPE_TEXTURE_3D || pt->target == PIPE_TEXTURE_CUBE) cso_hash_insert(us->u.hash, (layer << 8) | level, ps); diff --git a/src/gallium/auxiliary/util/u_surfaces.h b/src/gallium/auxiliary/util/u_surfaces.h index da4fbbfc254..9581feda7c8 100644 --- a/src/gallium/auxiliary/util/u_surfaces.h +++ b/src/gallium/auxiliary/util/u_surfaces.h @@ -45,21 +45,21 @@ struct util_surfaces /* 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, + struct pipe_context *ctx, struct pipe_resource *pt, unsigned level, unsigned layer, unsigned flags, struct pipe_surface **res); /* fast inline path for the very common case */ static INLINE boolean util_surfaces_get(struct util_surfaces *us, unsigned surface_struct_size, - struct pipe_screen *pscreen, struct pipe_resource *pt, + struct pipe_context *ctx, 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)) { struct pipe_surface *ps = us->u.array[level]; - if(ps) + if(ps && ps->context == ctx) { p_atomic_inc(&ps->reference.count); *res = ps; @@ -67,7 +67,7 @@ util_surfaces_get(struct util_surfaces *us, unsigned surface_struct_size, } } - return util_surfaces_do_get(us, surface_struct_size, pscreen, pt, level, layer, flags, res); + return util_surfaces_do_get(us, surface_struct_size, ctx, pt, level, layer, flags, res); } static INLINE struct pipe_surface * |