summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_builder.cpp
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-03-19 16:27:34 -0700
committerEric Anholt <[email protected]>2012-04-13 17:01:17 -0700
commitd32780d5041a6d241834fe565739104f86300425 (patch)
tree5e6e53978ce49f6a292623bd656fada08af8ad59 /src/glsl/ir_builder.cpp
parent7e88f8ce8f9d72bbda248554e0630b4aca7e1154 (diff)
glsl: Add a helper for ir_builder to make dereferences for assignments.
v2: Fix writemask setup for non-vec4 assignments. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/ir_builder.cpp')
-rw-r--r--src/glsl/ir_builder.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp
index 98ac3c100a1..0c8a15bc86e 100644
--- a/src/glsl/ir_builder.cpp
+++ b/src/glsl/ir_builder.cpp
@@ -34,6 +34,24 @@ ir_factory::emit(ir_instruction *ir)
instructions->push_tail(ir);
}
+ir_assignment *
+assign(deref lhs, operand rhs, int writemask)
+{
+ void *mem_ctx = ralloc_parent(lhs.val);
+
+ ir_assignment *assign = new(mem_ctx) ir_assignment(lhs.val,
+ rhs.val,
+ NULL, writemask);
+
+ return assign;
+}
+
+ir_assignment *
+assign(deref lhs, operand rhs)
+{
+ return assign(lhs, rhs, (1 << lhs.val->type->vector_elements) - 1);
+}
+
ir_swizzle *
swizzle(operand a, int swizzle, int components)
{