summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2014-02-19 15:20:27 +0100
committerIan Romanick <[email protected]>2014-02-26 17:58:20 -0800
commit3efb934deee37bc6203577f686c55d658ea4c7c3 (patch)
treef6325e1d00dc06c635f1706060bf87abb2b5b33b /src
parent29876a4d28cd595da900a89b38057348bea24c4d (diff)
i965/vec4: Add non-mutating helper functions to modify src_reg::swizzle and ::negate.
Reviewed-by: Paul Berry <[email protected]> (cherry picked from commit 98306e727b8291507ff4fd5dd5c4806f3fed9202)
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index e17b5cd3f37..2a1d99215ae 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -142,6 +142,30 @@ public:
src_reg *reladdr;
};
+/**
+ * Reswizzle a given source register.
+ * \sa brw_swizzle().
+ */
+static inline src_reg
+swizzle(src_reg reg, unsigned swizzle)
+{
+ assert(reg.file != HW_REG);
+ reg.swizzle = BRW_SWIZZLE4(
+ BRW_GET_SWZ(reg.swizzle, BRW_GET_SWZ(swizzle, 0)),
+ BRW_GET_SWZ(reg.swizzle, BRW_GET_SWZ(swizzle, 1)),
+ BRW_GET_SWZ(reg.swizzle, BRW_GET_SWZ(swizzle, 2)),
+ BRW_GET_SWZ(reg.swizzle, BRW_GET_SWZ(swizzle, 3)));
+ return reg;
+}
+
+static inline src_reg
+negate(src_reg reg)
+{
+ assert(reg.file != HW_REG && reg.file != IMM);
+ reg.negate = !reg.negate;
+ return reg;
+}
+
class dst_reg : public reg
{
public: