IR builder already offers a lot of swizzling functions, such as
swizzle_xxxx, swizzle_z, or swizzle_for_size.

The swizzle_xxxx style is convenient if you statically know which
components you want.  swizzle_for_size is great if you want to select
the first few components.  However, if you want to select components
based on, say, a loop counter, none of those are sufficient.

IR builder actually already had support for arbitrary swizzling, but
didn't expose it.  This patch exposes that API.

Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
---
 src/glsl/ir_builder.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/glsl/ir_builder.h b/src/glsl/ir_builder.h
index 6d32d7a..091cf40 100644
--- a/src/glsl/ir_builder.h
+++ b/src/glsl/ir_builder.h
@@ -171,6 +171,7 @@ ir_expression *u2i(operand a);
 ir_expression *b2i(operand a);
 ir_expression *i2b(operand a);
 
+ir_swizzle *swizzle(operand a, int swizzle, int components);
 /**
  * Swizzle away later components, but preserve the ordering.
  */
-- 
1.8.3.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to