aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/ir_builder.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-07-13 12:16:00 +0200
committermarha <marha@users.sourceforge.net>2012-07-13 12:16:00 +0200
commitdcf9ae77854778629cabd0d6943dda3678eb91fa (patch)
tree087d3bb4beb55bcc0c5857b41d2b5b10edd0e2f3 /mesalib/src/glsl/ir_builder.cpp
parent2c8d7aa6bda138693fa1827852ba6b75d1721ff8 (diff)
parentf0a7d1d88be0c31bd471f4428c4493a93f2d9321 (diff)
downloadvcxsrv-dcf9ae77854778629cabd0d6943dda3678eb91fa.tar.gz
vcxsrv-dcf9ae77854778629cabd0d6943dda3678eb91fa.tar.bz2
vcxsrv-dcf9ae77854778629cabd0d6943dda3678eb91fa.zip
Merge remote-tracking branch 'origin/released'
Conflicts: xorg-server/glx/glxext.c xorg-server/hw/xwin/InitOutput.c
Diffstat (limited to 'mesalib/src/glsl/ir_builder.cpp')
-rw-r--r--mesalib/src/glsl/ir_builder.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/mesalib/src/glsl/ir_builder.cpp b/mesalib/src/glsl/ir_builder.cpp
index 9a16c90e5..d96e25c18 100644
--- a/mesalib/src/glsl/ir_builder.cpp
+++ b/mesalib/src/glsl/ir_builder.cpp
@@ -77,6 +77,21 @@ swizzle(operand a, int swizzle, int components)
}
ir_swizzle *
+swizzle_for_size(operand a, int components)
+{
+ void *mem_ctx = ralloc_parent(a.val);
+
+ if (a.val->type->vector_elements < components)
+ components = a.val->type->vector_elements;
+
+ unsigned s[4] = { 0, 1, 2, 3 };
+ for (int i = components; i < 4; i++)
+ s[i] = components - 1;
+
+ return new(mem_ctx) ir_swizzle(a.val, s, components);
+}
+
+ir_swizzle *
swizzle_xxxx(operand a)
{
return swizzle(a, SWIZZLE_XXXX, 4);
@@ -143,6 +158,14 @@ swizzle_xyzw(operand a)
}
ir_expression *
+expr(ir_expression_operation op, operand a)
+{
+ void *mem_ctx = ralloc_parent(a.val);
+
+ return new(mem_ctx) ir_expression(op, a.val);
+}
+
+ir_expression *
expr(ir_expression_operation op, operand a, operand b)
{
void *mem_ctx = ralloc_parent(a.val);