[Mesa-dev] [PATCH 1/2] i965: Add an is_negative_one() method.
Matt Turner
mattst88 at gmail.com
Thu Feb 12 15:36:36 PST 2015
---
src/mesa/drivers/dri/i965/brw_shader.cpp | 16 ++++++++++++++++
src/mesa/drivers/dri/i965/brw_shader.h | 1 +
2 files changed, 17 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp
index 8b87d0d..d7b9c44 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.cpp
+++ b/src/mesa/drivers/dri/i965/brw_shader.cpp
@@ -734,6 +734,22 @@ backend_reg::is_one() const
}
bool
+backend_reg::is_negative_one() const
+{
+ if (file != IMM)
+ return false;
+
+ switch (type) {
+ case BRW_REGISTER_TYPE_F:
+ return fixed_hw_reg.dw1.f == -1.0;
+ case BRW_REGISTER_TYPE_D:
+ return fixed_hw_reg.dw1.d == -1;
+ default:
+ return false;
+ }
+}
+
+bool
backend_reg::is_null() const
{
return file == HW_REG &&
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index 4b5c573..7bff186 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -51,6 +51,7 @@ struct backend_reg
#ifdef __cplusplus
bool is_zero() const;
bool is_one() const;
+ bool is_negative_one() const;
bool is_null() const;
bool is_accumulator() const;
#endif
--
2.0.5
More information about the mesa-dev
mailing list