projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b0f9717
)
util: new util_format_get_nr_components helper
author
Roland Scheidegger
<sroland@vmware.com>
Wed, 17 Feb 2010 15:41:30 +0000
(16:41 +0100)
committer
Roland Scheidegger
<sroland@vmware.com>
Wed, 17 Feb 2010 15:41:30 +0000
(16:41 +0100)
src/gallium/auxiliary/util/u_format.h
patch
|
blob
|
history
diff --git
a/src/gallium/auxiliary/util/u_format.h
b/src/gallium/auxiliary/util/u_format.h
index 2fbbb83d4ba14463a2f2ba3ebcb9f99c05cd498d..6345a11a8cfb12f88785e9925524a14c7ec8813f 100644
(file)
--- a/
src/gallium/auxiliary/util/u_format.h
+++ b/
src/gallium/auxiliary/util/u_format.h
@@
-404,6
+404,23
@@
util_format_has_alpha(enum pipe_format format)
}
}
+/**
+ * Return the number of components stored.
+ * Formats with block size != 1x1 will always have 1 component (the block).
+ */
+static INLINE unsigned
+util_format_get_nr_components(enum pipe_format format)
+{
+ const struct util_format_description *desc = util_format_description(format);
+ unsigned chan;
+ unsigned nr_comp = 0;
+ for (chan = 0; chan < 4; chan++) {
+ if (desc->channel[chan].size != 0) {
+ nr_comp++;
+ }
+ }
+ return nr_comp;
+}
/*
* Format access functions.