Mesa (master): ilo: add flags to texture slices

Chia-I Wu olv at kemper.freedesktop.org
Wed Jan 8 10:13:10 UTC 2014


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

Author: Chia-I Wu <olvaffe at gmail.com>
Date:   Thu Dec 26 12:03:44 2013 +0800

ilo: add flags to texture slices

The flags are used to mark who (CPU, BLT, or RENDER) has accessed the resource
and how (READ or WRITE).

---

 src/gallium/drivers/ilo/ilo_resource.h |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/src/gallium/drivers/ilo/ilo_resource.h b/src/gallium/drivers/ilo/ilo_resource.h
index d23622a..124581a 100644
--- a/src/gallium/drivers/ilo/ilo_resource.h
+++ b/src/gallium/drivers/ilo/ilo_resource.h
@@ -32,6 +32,16 @@
 
 #include "ilo_common.h"
 
+enum ilo_texture_flags {
+   ILO_TEXTURE_RENDER_WRITE   = 1 << 0,
+   ILO_TEXTURE_BLT_WRITE      = 1 << 1,
+   ILO_TEXTURE_CPU_WRITE      = 1 << 2,
+   ILO_TEXTURE_RENDER_READ    = 1 << 3,
+   ILO_TEXTURE_BLT_READ       = 1 << 4,
+   ILO_TEXTURE_CPU_READ       = 1 << 5,
+   ILO_TEXTURE_CLEAR          = 1 << 6,
+};
+
 struct ilo_screen;
 
 struct ilo_buffer {
@@ -48,6 +58,7 @@ struct ilo_buffer {
 struct ilo_texture_slice {
    /* 2D offset to the slice */
    unsigned x, y;
+   unsigned flags;
 };
 
 struct ilo_texture {
@@ -130,4 +141,22 @@ ilo_texture_get_slice_offset(const struct ilo_texture *tex,
                              unsigned level, unsigned slice,
                              unsigned *x_offset, unsigned *y_offset);
 
+static inline void
+ilo_texture_set_slice_flags(struct ilo_texture *tex, unsigned level,
+                            unsigned first_slice, unsigned num_slices,
+                            unsigned mask, unsigned value)
+{
+   struct ilo_texture_slice *slice =
+      ilo_texture_get_slice(tex, level, first_slice);
+
+   assert(first_slice + num_slices - 1 <
+         ((tex->base.target == PIPE_TEXTURE_3D) ?
+          u_minify(tex->base.depth0, level) : tex->base.array_size));
+
+   while (num_slices--) {
+      slice->flags = (slice->flags & ~mask) | (value & mask);
+      slice++;
+   }
+}
+
 #endif /* ILO_RESOURCE_H */




More information about the mesa-commit mailing list