[Mesa-dev] [PATCH RFC 06/11] glsl: add swizzle_component() to ir_builder
Connor Abbott
cwabbott0 at gmail.com
Wed Jan 22 09:16:53 PST 2014
Like swizzle_x(), swizzle_y(), etc., except the index is programmable.
---
src/glsl/ir_builder.cpp | 6 ++++++
src/glsl/ir_builder.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/src/glsl/ir_builder.cpp b/src/glsl/ir_builder.cpp
index 7f41ed6..2229cd2 100644
--- a/src/glsl/ir_builder.cpp
+++ b/src/glsl/ir_builder.cpp
@@ -166,6 +166,12 @@ swizzle_xy(operand a)
}
ir_swizzle *
+swizzle_component(operand a, int component)
+{
+ return swizzle(a, MAKE_SWIZZLE4(component, component, component, component), 1);
+}
+
+ir_swizzle *
swizzle_xyz(operand a)
{
return swizzle(a, SWIZZLE_XYZW, 3);
diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h
index f00e6f3..ae10995 100644
--- a/src/glsl/ir_builder.h
+++ b/src/glsl/ir_builder.h
@@ -206,6 +206,7 @@ ir_swizzle *swizzle_x(operand a);
ir_swizzle *swizzle_y(operand a);
ir_swizzle *swizzle_z(operand a);
ir_swizzle *swizzle_w(operand a);
+ir_swizzle *swizzle_component(operand a, int component);
ir_swizzle *swizzle_xy(operand a);
ir_swizzle *swizzle_xyz(operand a);
ir_swizzle *swizzle_xyzw(operand a);
--
1.8.3.1
More information about the mesa-dev
mailing list