diff options
author | José Fonseca <jfonseca@vmware.com> | 2010-03-31 13:55:12 +0100 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2010-03-31 13:55:12 +0100 |
commit | 7a26c875a9195587c408188ddc7d02a42dfde2bb (patch) | |
tree | 6f5effca3597eaa1c317cf139ea7b799531ce44c /src/gallium/auxiliary/util/u_format.h | |
parent | e566046efcaa4229f595acdc419670d70db66c1c (diff) |
util: Generalize lp_format_is_rgba8 into util_format_is_rgba8_variant.
Diffstat (limited to 'src/gallium/auxiliary/util/u_format.h')
-rw-r--r-- | src/gallium/auxiliary/util/u_format.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h index 98d4b98ebb..4d59b9927d 100644 --- a/src/gallium/auxiliary/util/u_format.h +++ b/src/gallium/auxiliary/util/u_format.h @@ -261,6 +261,34 @@ util_format_is_depth_and_stencil(enum pipe_format format) desc->swizzle[1] != UTIL_FORMAT_SWIZZLE_NONE) ? TRUE : FALSE; } +/** + * Whether this format is a rgab8 variant. + * + * That is, any format that matches the + * + * PIPE_FORMAT_?8?8?8?8_UNORM + */ +static INLINE boolean +util_format_is_rgba8_variant(const struct util_format_description *desc) +{ + unsigned chan; + + if(desc->block.width != 1 || + desc->block.height != 1 || + desc->block.bits != 32) + return FALSE; + + for(chan = 0; chan < 4; ++chan) { + if(desc->channel[chan].type != UTIL_FORMAT_TYPE_UNSIGNED && + desc->channel[chan].type != UTIL_FORMAT_TYPE_VOID) + return FALSE; + if(desc->channel[chan].size != 8) + return FALSE; + } + + return TRUE; +} + /** * Return total bits needed for the pixel format per block. |