summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/ilo/ilo_resource.h
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2014-02-20 14:37:23 +0800
committerChia-I Wu <[email protected]>2014-02-22 22:45:13 +0800
commitf57bddc7e431e553e946563d1030e5f239911c8b (patch)
treec36cda8e0fd1222366b3d2c545b0d856a62e0916 /src/gallium/drivers/ilo/ilo_resource.h
parent4afb8a7fb5a5f0581ba1bbf608033e69dab6dbb3 (diff)
ilo: add slice clear value
It is needed for 3DSTATE_CLEAR_PARAMS, and can also be used to track what value the slice has been cleared to.
Diffstat (limited to 'src/gallium/drivers/ilo/ilo_resource.h')
-rw-r--r--src/gallium/drivers/ilo/ilo_resource.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/gallium/drivers/ilo/ilo_resource.h b/src/gallium/drivers/ilo/ilo_resource.h
index d7bc5f9be71..cba425c11dc 100644
--- a/src/gallium/drivers/ilo/ilo_resource.h
+++ b/src/gallium/drivers/ilo/ilo_resource.h
@@ -61,7 +61,7 @@ enum ilo_texture_flags {
* Set when the texture is cleared.
*
* When set in resolve flags, the new writer will clear. When set in slice
- * flags, the slice has been cleared.
+ * flags, the slice has been cleared to ilo_texture_slice::clear_value.
*/
ILO_TEXTURE_CLEAR = 1 << 6,
@@ -91,6 +91,18 @@ struct ilo_texture_slice {
/* 2D offset to the slice */
unsigned x, y;
unsigned flags;
+
+ /*
+ * Slice clear value. It is served for two purposes
+ *
+ * - the clear value used in commands such as 3DSTATE_CLEAR_PARAMS
+ * - the clear value when ILO_TEXTURE_CLEAR is set
+ *
+ * Since commands such as 3DSTATE_CLEAR_PARAMS expect a single clear value
+ * for all slices, ilo_blit_resolve_slices() will silently make all slices
+ * to have the same clear value.
+ */
+ uint32_t clear_value;
};
struct ilo_texture {
@@ -189,6 +201,22 @@ ilo_texture_set_slice_flags(struct ilo_texture *tex, unsigned level,
}
}
+static inline void
+ilo_texture_set_slice_clear_value(struct ilo_texture *tex, unsigned level,
+ unsigned first_slice, unsigned num_slices,
+ uint32_t clear_value)
+{
+ const struct ilo_texture_slice *last =
+ ilo_texture_get_slice(tex, level, first_slice + num_slices - 1);
+ struct ilo_texture_slice *slice =
+ ilo_texture_get_slice(tex, level, first_slice);
+
+ while (slice <= last) {
+ slice->clear_value = clear_value;
+ slice++;
+ }
+}
+
static inline bool
ilo_texture_can_enable_hiz(const struct ilo_texture *tex, unsigned level,
unsigned first_slice, unsigned num_slices)