aboutsummaryrefslogtreecommitdiffstats
path: root/src/glsl/ir.h
diff options
context:
space:
mode:
authorOlivier Galibert <[email protected]>2012-05-02 23:11:40 +0200
committerKenneth Graunke <[email protected]>2012-05-08 12:55:50 -0700
commit8ec01ba2ff95449674c779c05afcd32bbf7dbdc8 (patch)
treee368ae55dbf3e8a52ddc966b3b8d2087e4bec1e3 /src/glsl/ir.h
parenta270e86d382597d4d01ebcfa1693e21d778cbe6d (diff)
glsl: Add methods to copy parts of one ir_constant into another.
- copy_masked_offset copies part of a constant into another, assign-like. - copy_offset copies a constant into (a subset of) another, funcall-return like. These methods are to be used to trace through assignments and function calls when computing a constant expression. Signed-off-by: Olivier Galibert <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> [v1]
Diffstat (limited to 'src/glsl/ir.h')
-rw-r--r--src/glsl/ir.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index dc96e1fe9ed..fe950861620 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -1683,6 +1683,31 @@ public:
ir_constant *get_record_field(const char *name);
/**
+ * Copy the values on another constant at a given offset.
+ *
+ * The offset is ignored for array or struct copies, it's only for
+ * scalars or vectors into vectors or matrices.
+ *
+ * With identical types on both sides and zero offset it's clone()
+ * without creating a new object.
+ */
+
+ void copy_offset(ir_constant *src, int offset);
+
+ /**
+ * Copy the values on another constant at a given offset and
+ * following an assign-like mask.
+ *
+ * The mask is ignored for scalars.
+ *
+ * Note that this function only handles what assign can handle,
+ * i.e. at most a vector as source and a column of a matrix as
+ * destination.
+ */
+
+ void copy_masked_offset(ir_constant *src, int offset, unsigned int mask);
+
+ /**
* Determine whether a constant has the same value as another constant
*
* \sa ir_constant::is_zero, ir_constant::is_one,