[Mesa-dev] [PATCH 08/13] isl/format: Add more isl_format_has_type_channel functions

Jason Ekstrand jason at jlekstrand.net
Sat Apr 16 19:45:16 UTC 2016


---
 src/intel/isl/isl.h        | 23 +++++++++++++++++++----
 src/intel/isl/isl_format.c | 24 ++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index c6fe318..c84e685 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -835,11 +835,26 @@ isl_format_get_layout(enum isl_format fmt)
    return &isl_format_layouts[fmt];
 }
 
-bool
-isl_format_has_uint_channel(enum isl_format fmt) ATTRIBUTE_CONST;
+bool isl_format_has_unorm_channel(enum isl_format fmt) ATTRIBUTE_CONST;
+bool isl_format_has_snorm_channel(enum isl_format fmt) ATTRIBUTE_CONST;
+bool isl_format_has_ufloat_channel(enum isl_format fmt) ATTRIBUTE_CONST;
+bool isl_format_has_sfloat_channel(enum isl_format fmt) ATTRIBUTE_CONST;
+bool isl_format_has_uint_channel(enum isl_format fmt) ATTRIBUTE_CONST;
+bool isl_format_has_sint_channel(enum isl_format fmt) ATTRIBUTE_CONST;
 
-bool
-isl_format_has_sint_channel(enum isl_format fmt) ATTRIBUTE_CONST;
+static inline bool
+isl_format_has_normalized_channel(enum isl_format fmt)
+{
+   return isl_format_has_unorm_channel(fmt) ||
+          isl_format_has_snorm_channel(fmt);
+}
+
+static inline bool
+isl_format_has_float_channel(enum isl_format fmt)
+{
+   return isl_format_has_ufloat_channel(fmt) ||
+          isl_format_has_sfloat_channel(fmt);
+}
 
 static inline bool
 isl_format_has_int_channel(enum isl_format fmt)
diff --git a/src/intel/isl/isl_format.c b/src/intel/isl/isl_format.c
index b0450d9..6013562 100644
--- a/src/intel/isl/isl_format.c
+++ b/src/intel/isl/isl_format.c
@@ -40,6 +40,30 @@ isl_format_has_channel_of_type(enum isl_format fmt, enum isl_base_type type)
 }
 
 bool
+isl_format_has_unorm_channel(enum isl_format fmt)
+{
+   return isl_format_has_channel_of_type(fmt, ISL_UNORM);
+}
+
+bool
+isl_format_has_snorm_channel(enum isl_format fmt)
+{
+   return isl_format_has_channel_of_type(fmt, ISL_SNORM);
+}
+
+bool
+isl_format_has_ufloat_channel(enum isl_format fmt)
+{
+   return isl_format_has_channel_of_type(fmt, ISL_UFLOAT);
+}
+
+bool
+isl_format_has_sfloat_channel(enum isl_format fmt)
+{
+   return isl_format_has_channel_of_type(fmt, ISL_SFLOAT);
+}
+
+bool
 isl_format_has_uint_channel(enum isl_format fmt)
 {
    return isl_format_has_channel_of_type(fmt, ISL_UINT);
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list