Mesa (master): u_inlines: split pipe_surface_init in pipe_surface_reset and *_init

Luca Barbieri lb at kemper.freedesktop.org
Sun Apr 18 20:58:47 UTC 2010


Module: Mesa
Branch: master
Commit: eeabe9d1797765056dcf0ca70ad5fc11b3aa758d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=eeabe9d1797765056dcf0ca70ad5fc11b3aa758d

Author: Luca Barbieri <luca at luca-barbieri.com>
Date:   Sun Apr 18 22:37:32 2010 +0200

u_inlines: split pipe_surface_init in pipe_surface_reset and *_init

---

 src/gallium/auxiliary/util/u_inlines.h  |   12 ++++++++++--
 src/gallium/auxiliary/util/u_surfaces.c |    1 -
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index b2a0408..089adcf 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -122,9 +122,8 @@ pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_
    *ptr = view;
 }
 
-/* you have to call pipe_reference_init(&ps->reference, 1) yourself if it is just allocated */
 static INLINE void
-pipe_surface_init(struct pipe_surface* ps, struct pipe_resource *pt,
+pipe_surface_reset(struct pipe_surface* ps, struct pipe_resource *pt,
 		unsigned face, unsigned level, unsigned zslice, unsigned flags)
 {
    pipe_resource_reference(&ps->texture, pt);
@@ -137,6 +136,15 @@ pipe_surface_init(struct pipe_surface* ps, struct pipe_resource *pt,
    ps->zslice = zslice;
 }
 
+static INLINE void
+pipe_surface_init(struct pipe_surface* ps, struct pipe_resource *pt,
+                unsigned face, unsigned level, unsigned zslice, unsigned flags)
+{
+   ps->texture = 0;
+   pipe_reference_init(&ps->reference, 1);
+   pipe_surface_reset(ps, pt, face, level, zslice, flags);
+}
+
 /*
  * Convenience wrappers for screen buffer functions.
  */
diff --git a/src/gallium/auxiliary/util/u_surfaces.c b/src/gallium/auxiliary/util/u_surfaces.c
index 056b8f2..ddfc7a9 100644
--- a/src/gallium/auxiliary/util/u_surfaces.c
+++ b/src/gallium/auxiliary/util/u_surfaces.c
@@ -50,7 +50,6 @@ util_surfaces_do_get(struct util_surfaces *us, unsigned surface_struct_size, str
    if(!ps)
       return NULL;
 
-   pipe_reference_init(&ps->reference, 1);
    pipe_surface_init(ps, pt, face, level, zslice, flags);
    ps->offset = ~0;
 




More information about the mesa-commit mailing list