Mesa (master): u_inlines: add function to initialize pipe_surface

Luca Barbieri lb at kemper.freedesktop.org
Sun Apr 18 14:23:19 UTC 2010


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

Author: Luca Barbieri <luca at luca-barbieri.com>
Date:   Sun Apr 18 14:53:25 2010 +0200

u_inlines: add function to initialize pipe_surface

---

 src/gallium/auxiliary/util/u_inlines.h |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index c2f4f05..b2a0408 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -35,6 +35,7 @@
 #include "util/u_debug.h"
 #include "util/u_atomic.h"
 #include "util/u_box.h"
+#include "util/u_math.h"
 
 
 #ifdef __cplusplus
@@ -121,6 +122,20 @@ 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,
+		unsigned face, unsigned level, unsigned zslice, unsigned flags)
+{
+   pipe_resource_reference(&ps->texture, pt);
+   ps->format = pt->format;
+   ps->width = u_minify(pt->width0, level);
+   ps->height = u_minify(pt->height0, level);
+   ps->usage = flags;
+   ps->face = face;
+   ps->level = level;
+   ps->zslice = zslice;
+}
 
 /*
  * Convenience wrappers for screen buffer functions.




More information about the mesa-commit mailing list