Move pf_is_depth_stencil() to u_format auxiliary module.
[mesa.git] / src / gallium / auxiliary / util / u_format.h
index b5504ebe05600090f74b8748424f5da7af9873dc..cd883d38ca866a63175d6783afdf1321a4ef1abb 100644 (file)
@@ -111,4 +111,63 @@ const struct util_format_description *
 util_format_description(enum pipe_format format);
 
 
+/*
+ * Format query functions.
+ */
+
+static INLINE boolean 
+util_format_is_compressed(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   assert(format);
+   if (!format) {
+      return FALSE;
+   }
+
+   return desc->layout == UTIL_FORMAT_LAYOUT_DXT ? TRUE : FALSE;
+}
+
+static INLINE boolean 
+util_format_is_depth_or_stencil(enum pipe_format format)
+{
+   const struct util_format_description *desc = util_format_description(format);
+
+   assert(format);
+   if (!format) {
+      return FALSE;
+   }
+
+   return desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS ? TRUE : FALSE;
+}
+
+
+/*
+ * Format access functions.
+ */
+
+void
+util_format_read_4f(enum pipe_format format,
+                    float *dst, unsigned dst_stride, 
+                    const void *src, unsigned src_stride, 
+                    unsigned x, unsigned y, unsigned w, unsigned h);
+
+void
+util_format_write_4f(enum pipe_format format,
+                     const float *src, unsigned src_stride, 
+                     void *dst, unsigned dst_stride, 
+                     unsigned x, unsigned y, unsigned w, unsigned h);
+
+void
+util_format_read_4ub(enum pipe_format format,
+                     uint8_t *dst, unsigned dst_stride, 
+                     const void *src, unsigned src_stride, 
+                     unsigned x, unsigned y, unsigned w, unsigned h);
+
+void
+util_format_write_4ub(enum pipe_format format,
+                      const uint8_t *src, unsigned src_stride, 
+                      void *dst, unsigned dst_stride, 
+                      unsigned x, unsigned y, unsigned w, unsigned h);
+
 #endif /* ! U_FORMAT_H */