summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-02-12 15:50:12 -0800
committerEmil Velikov <[email protected]>2018-02-28 20:15:05 +0000
commit5b6b4e4f3871f9d3ba64ea2ca2921c3d722b47cd (patch)
tree43b9d65c427408fbbfbc9cdff55ca6ce203a0021 /src
parent03d801a1761d480654369d88bfecb0b3eb4c63a7 (diff)
intel/isl: Add an isl_color_value_is_zero helper
Cc: [email protected] Reviewed-by: Nanley Chery <[email protected]> (cherry picked from commit 4796025ba518baa0e8893337591a3f452a375d94)
Diffstat (limited to 'src')
-rw-r--r--src/intel/isl/isl.c20
-rw-r--r--src/intel/isl/isl.h3
2 files changed, 23 insertions, 0 deletions
diff --git a/src/intel/isl/isl.c b/src/intel/isl/isl.c
index 59f512fc050..f4b0502efe1 100644
--- a/src/intel/isl/isl.c
+++ b/src/intel/isl/isl.c
@@ -269,6 +269,26 @@ isl_tiling_get_info(enum isl_tiling tiling,
}
bool
+isl_color_value_is_zero(union isl_color_value value,
+ enum isl_format format)
+{
+ const struct isl_format_layout *fmtl = isl_format_get_layout(format);
+
+#define RETURN_FALSE_IF_NOT_0(c, i) \
+ if (fmtl->channels.c.bits && value.u32[i] != 0) \
+ return false
+
+ RETURN_FALSE_IF_NOT_0(r, 0);
+ RETURN_FALSE_IF_NOT_0(g, 1);
+ RETURN_FALSE_IF_NOT_0(b, 2);
+ RETURN_FALSE_IF_NOT_0(a, 3);
+
+#undef RETURN_FALSE_IF_NOT_0
+
+ return true;
+}
+
+bool
isl_color_value_is_zero_one(union isl_color_value value,
enum isl_format format)
{
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index e3acb0ec280..e1607aa0636 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -1668,6 +1668,9 @@ isl_extent4d(uint32_t width, uint32_t height, uint32_t depth,
return e;
}
+bool isl_color_value_is_zero(union isl_color_value value,
+ enum isl_format format);
+
bool isl_color_value_is_zero_one(union isl_color_value value,
enum isl_format format);