summaryrefslogtreecommitdiffstats
path: root/src/intel/isl/isl_format.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-04-15 21:25:00 -0700
committerJason Ekstrand <[email protected]>2016-04-21 20:44:27 -0700
commita4c04dd41021647ba84fbb88242fd467ecb734a9 (patch)
tree910ad10f32f25ab5dca52936bc901f1b917cdac7 /src/intel/isl/isl_format.c
parentca8c5993bf75cd627115d8545f14dda1e330d189 (diff)
isl/format: Break the guts of has_[us]int_channel into a helper
Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/intel/isl/isl_format.c')
-rw-r--r--src/intel/isl/isl_format.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/src/intel/isl/isl_format.c b/src/intel/isl/isl_format.c
index 32bd70186c6..353aea4bdf9 100644
--- a/src/intel/isl/isl_format.c
+++ b/src/intel/isl/isl_format.c
@@ -25,32 +25,30 @@
#include "isl.h"
-bool
-isl_format_has_uint_channel(enum isl_format fmt)
+static inline bool
+isl_format_has_channel_type(enum isl_format fmt, enum isl_base_type type)
{
const struct isl_format_layout *fmtl = isl_format_get_layout(fmt);
- return fmtl->channels.r.type == ISL_UINT ||
- fmtl->channels.g.type == ISL_UINT ||
- fmtl->channels.b.type == ISL_UINT ||
- fmtl->channels.a.type == ISL_UINT ||
- fmtl->channels.l.type == ISL_UINT ||
- fmtl->channels.i.type == ISL_UINT ||
- fmtl->channels.p.type == ISL_UINT;
+ return fmtl->channels.r.type == type ||
+ fmtl->channels.g.type == type ||
+ fmtl->channels.b.type == type ||
+ fmtl->channels.a.type == type ||
+ fmtl->channels.l.type == type ||
+ fmtl->channels.i.type == type ||
+ fmtl->channels.p.type == type;
}
bool
-isl_format_has_sint_channel(enum isl_format fmt)
+isl_format_has_uint_channel(enum isl_format fmt)
{
- const struct isl_format_layout *fmtl = isl_format_get_layout(fmt);
+ return isl_format_has_channel_type(fmt, ISL_UINT);
+}
- return fmtl->channels.r.type == ISL_SINT ||
- fmtl->channels.g.type == ISL_SINT ||
- fmtl->channels.b.type == ISL_SINT ||
- fmtl->channels.a.type == ISL_SINT ||
- fmtl->channels.l.type == ISL_SINT ||
- fmtl->channels.i.type == ISL_SINT ||
- fmtl->channels.p.type == ISL_SINT;
+bool
+isl_format_has_sint_channel(enum isl_format fmt)
+{
+ return isl_format_has_channel_type(fmt, ISL_SINT);
}
enum isl_format