#include "pipe/p_format.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* Describe how to best pack/unpack pixels into/from the prescribed format.
}
}
+static INLINE boolean
+util_format_has_alpha(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+
+ assert(format);
+ if (!format) {
+ return FALSE;
+ }
+
+ switch (desc->layout) {
+ case UTIL_FORMAT_LAYOUT_SCALAR:
+ case UTIL_FORMAT_LAYOUT_ARITH:
+ case UTIL_FORMAT_LAYOUT_ARRAY:
+ /* FIXME: pf_get_component_bits( PIPE_FORMAT_A8L8_UNORM, PIPE_FORMAT_COMP_A ) should not return 0 right? */
+ if (format == PIPE_FORMAT_A8_UNORM ||
+ format == PIPE_FORMAT_A8L8_UNORM ||
+ format == PIPE_FORMAT_A8L8_SRGB) {
+ return TRUE;
+ }
+ return util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 3) != 0;
+ case UTIL_FORMAT_LAYOUT_YUV:
+ return FALSE;
+ case UTIL_FORMAT_LAYOUT_DXT:
+ switch (format) {
+ case PIPE_FORMAT_DXT1_RGBA:
+ case PIPE_FORMAT_DXT3_RGBA:
+ case PIPE_FORMAT_DXT5_RGBA:
+ case PIPE_FORMAT_DXT1_SRGBA:
+ case PIPE_FORMAT_DXT3_SRGBA:
+ case PIPE_FORMAT_DXT5_SRGBA:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+ default:
+ assert(0);
+ return FALSE;
+ }
+}
+
/*
* Format access functions.
void *dst, unsigned dst_stride,
unsigned x, unsigned y, unsigned w, unsigned h);
+#ifdef __cplusplus
+} // extern "C" {
+#endif
+
#endif /* ! U_FORMAT_H */