diff options
author | Jason Ekstrand <[email protected]> | 2016-04-15 21:36:21 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-04-21 20:44:27 -0700 |
commit | 2980507a1983b2af157dc538fb22e759c1d257e8 (patch) | |
tree | 5fcb0ca0a1fe3d81eb4b3ebd36796d9fc05df85f /src/intel/isl/isl_format.c | |
parent | 3415cf5f2f66128488a260f024e075f239368c35 (diff) |
isl/format: Add a get_num_channels helper
Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/intel/isl/isl_format.c')
-rw-r--r-- | src/intel/isl/isl_format.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/intel/isl/isl_format.c b/src/intel/isl/isl_format.c index fd16ea19658..4d02b1dd1e6 100644 --- a/src/intel/isl/isl_format.c +++ b/src/intel/isl/isl_format.c @@ -75,6 +75,21 @@ isl_format_has_sint_channel(enum isl_format fmt) return isl_format_has_channel_type(fmt, ISL_SINT); } +unsigned +isl_format_get_num_channels(enum isl_format fmt) +{ + const struct isl_format_layout *fmtl = isl_format_get_layout(fmt); + + assert(fmtl->channels.p.bits == 0); + + return (fmtl->channels.r.bits > 0) + + (fmtl->channels.g.bits > 0) + + (fmtl->channels.b.bits > 0) + + (fmtl->channels.a.bits > 0) + + (fmtl->channels.l.bits > 0) + + (fmtl->channels.i.bits > 0); +} + enum isl_format isl_format_rgb_to_rgba(enum isl_format rgb) { |