summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_format.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/util/u_format.h')
-rw-r--r--src/gallium/auxiliary/util/u_format.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index f7daa6d923..fc550405d8 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -32,7 +32,7 @@
#include "pipe/p_format.h"
#include "util/u_debug.h"
-#include "util/u_inline_init.h"
+#include "util/u_format_s3tc.h"
#ifdef __cplusplus
extern "C" {
@@ -169,6 +169,13 @@ struct util_format_description
unsigned is_mixed:1;
/**
+ * Whether the pack/unpack functions actually work.
+ *
+ * Call util_format_is_supported instead of using this directly.
+ */
+ unsigned is_supported:1;
+
+ /**
* Input channel description.
*
* Only valid for UTIL_FORMAT_LAYOUT_PLAIN formats.
@@ -507,6 +514,20 @@ util_format_get_nr_components(enum pipe_format format)
* Format access functions.
*/
+static INLINE boolean
+util_format_is_supported(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+
+ if(!desc)
+ return FALSE;
+
+ if(desc->layout == UTIL_FORMAT_LAYOUT_S3TC)
+ util_format_s3tc_init();
+
+ return desc->is_supported;
+}
+
void
util_format_read_4f(enum pipe_format format,
float *dst, unsigned dst_stride,