summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i965/brw_fs.h
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2012-11-17 15:10:53 -0800
committerEric Anholt <eric@anholt.net>2012-11-30 13:15:39 -0800
commit8d0bb74a11f1905e32f6db23fbf8bb29ff8fa367 (patch)
tree8d4bc5ca7bfec4d7c4b1a71c0b7d2bbaa3863e88 /src/mesa/drivers/dri/i965/brw_fs.h
parent4cedb65a43ae81c7ac71e631c854b7404dd2b61b (diff)
i965/fs: Add fs_reg::is_zero() and is_one(); use for opt_algebraic().
These helper macros save you from writing nasty expressions like: if ((inst->src[1].type == BRW_REGISTER_TYPE_F && inst->src[1].imm.f == 1.0) || ((inst->src[1].type == BRW_REGISTER_TYPE_D || inst->src[1].type == BRW_REGISTER_TYPE_UD) && inst->src[1].imm.u == 1)) { Instead, you simply get to write inst->src[1].is_one(). Simple. Also, this makes the FS backend match the VS backend (which has these). This patch also converts opt_algebraic to use the new helper functions. As a consequence, it will now also optimize integer-typed expressions. Reviewed-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_fs.h')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index a0ed743486b..86c33bc8b0f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -91,6 +91,8 @@ public:
fs_reg(class fs_visitor *v, const struct glsl_type *type);
bool equals(const fs_reg &r) const;
+ bool is_zero() const;
+ bool is_one() const;
/** Register file: ARF, GRF, MRF, IMM. */
enum register_file file;