[Mesa-dev] [PATCH 15/23] i965/vec4: Add non-mutating helper functions to modify src_reg::swizzle and ::negate.
Francisco Jerez
currojerez at riseup.net
Mon Dec 2 11:31:20 PST 2013
---
src/mesa/drivers/dri/i965/brw_vec4.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index db1604a..8ce3a5e 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -125,6 +125,30 @@ offset(src_reg reg, unsigned delta)
return reg;
}
+/**
+ * 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 backend_reg
{
public:
--
1.8.3.4
More information about the mesa-dev
mailing list